@nathanclaire/edge-telemetry-sdk 4.0.0 → 5.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +185 -30
- package/dist/appLifecycle-DS_fEclk.cjs +2 -0
- package/dist/appLifecycle-DS_fEclk.cjs.map +1 -0
- package/dist/{appLifecycle-DQErzJIR.js → appLifecycle-PffQ4vC1.js} +5 -3
- package/dist/appLifecycle-PffQ4vC1.js.map +1 -0
- package/dist/autoTaps.native-By9I4Kr2.cjs +2 -0
- package/dist/autoTaps.native-By9I4Kr2.cjs.map +1 -0
- package/dist/autoTaps.native-DQCXevD7.js +66 -0
- package/dist/autoTaps.native-DQCXevD7.js.map +1 -0
- package/dist/crashHandler.web-6KvedEB-.cjs +2 -0
- package/dist/crashHandler.web-6KvedEB-.cjs.map +1 -0
- package/dist/crashHandler.web-BUlSXYoS.js +30 -0
- package/dist/crashHandler.web-BUlSXYoS.js.map +1 -0
- package/dist/crashHandlerNative.native-CFVQ5UcO.cjs +2 -0
- package/dist/crashHandlerNative.native-CFVQ5UcO.cjs.map +1 -0
- package/dist/{crashHandlerNative.native-FupMnr1U.js → crashHandlerNative.native-DsCRd-oN.js} +13 -13
- package/dist/crashHandlerNative.native-DsCRd-oN.js.map +1 -0
- package/dist/deviceInfo.native-D5gNBG7m.cjs +2 -0
- package/dist/{deviceInfo.native-BoeTZcD6.cjs.map → deviceInfo.native-D5gNBG7m.cjs.map} +1 -1
- package/dist/deviceInfo.native-DiiHrnI3.js +53 -0
- package/dist/{deviceInfo.native-BJ-3Jj1T.js.map → deviceInfo.native-DiiHrnI3.js.map} +1 -1
- package/dist/{deviceInfo.web-BFB1-pcA.js → deviceInfo.web-BHsjVveq.js} +3 -3
- package/dist/{deviceInfo.web-BFB1-pcA.js.map → deviceInfo.web-BHsjVveq.js.map} +1 -1
- package/dist/{deviceInfo.web-3L3IDQQA.cjs → deviceInfo.web-DGCUHAnv.cjs} +2 -2
- package/dist/{deviceInfo.web-3L3IDQQA.cjs.map → deviceInfo.web-DGCUHAnv.cjs.map} +1 -1
- package/dist/deviceState.native-BEysbZ6O.js +58 -0
- package/dist/deviceState.native-BEysbZ6O.js.map +1 -0
- package/dist/deviceState.native-CrQMy11_.cjs +2 -0
- package/dist/deviceState.native-CrQMy11_.cjs.map +1 -0
- package/dist/deviceState.web-ByaQm9Ry.js +14 -0
- package/dist/deviceState.web-ByaQm9Ry.js.map +1 -0
- package/dist/deviceState.web-CSfUgHDU.cjs +2 -0
- package/dist/deviceState.web-CSfUgHDU.cjs.map +1 -0
- package/dist/frameTracker-9j0en6Zm.cjs +2 -0
- package/dist/frameTracker-9j0en6Zm.cjs.map +1 -0
- package/dist/{frameTracker-DdB8W_kC.js → frameTracker-BzXnxSkb.js} +18 -19
- package/dist/frameTracker-BzXnxSkb.js.map +1 -0
- package/dist/{httpAttributes-BrrtM8zh.js → httpAttributes-BWXOr4eP.js} +1 -1
- package/dist/{httpAttributes-BrrtM8zh.js.map → httpAttributes-BWXOr4eP.js.map} +1 -1
- package/dist/{httpAttributes-D0m6UID7.cjs → httpAttributes-COY0_kiF.cjs} +1 -1
- package/dist/{httpAttributes-D0m6UID7.cjs.map → httpAttributes-COY0_kiF.cjs.map} +1 -1
- package/dist/index.native.cjs +1 -1
- package/dist/index.native.cjs.map +1 -1
- package/dist/index.native.d.ts +1 -1
- package/dist/index.native.js +128 -71
- package/dist/index.native.js.map +1 -1
- package/dist/index.web.cjs +1 -1
- package/dist/index.web.cjs.map +1 -1
- package/dist/index.web.d.ts +1 -1
- package/dist/index.web.js +51 -38
- package/dist/index.web.js.map +1 -1
- package/dist/{interactionWeb.web-CJAviVQ7.js → interactionWeb.web-BWBjmovb.js} +8 -8
- package/dist/{interactionWeb.web-CJAviVQ7.js.map → interactionWeb.web-BWBjmovb.js.map} +1 -1
- package/dist/interactionWeb.web-CKDJLD9r.cjs +2 -0
- package/dist/{interactionWeb.web-Bl_cZlgh.cjs.map → interactionWeb.web-CKDJLD9r.cjs.map} +1 -1
- package/dist/{interceptFetchWeb.web-UXC2Lb6X.js → interceptFetchWeb.web-DjSR_Rft.js} +18 -17
- package/dist/interceptFetchWeb.web-DjSR_Rft.js.map +1 -0
- package/dist/interceptFetchWeb.web-ZHw6IQkU.cjs +2 -0
- package/dist/{interceptFetchWeb.web-UXC2Lb6X.js.map → interceptFetchWeb.web-ZHw6IQkU.cjs.map} +1 -1
- package/dist/{interceptHttpNative.native-BVpFuoNB.cjs → interceptHttpNative.native-C5scIcgY.cjs} +2 -2
- package/dist/{interceptHttpNative.native-BVpFuoNB.cjs.map → interceptHttpNative.native-C5scIcgY.cjs.map} +1 -1
- package/dist/{interceptHttpNative.native-rX-lPNST.js → interceptHttpNative.native-vF_Fksjk.js} +2 -2
- package/dist/{interceptHttpNative.native-rX-lPNST.js.map → interceptHttpNative.native-vF_Fksjk.js.map} +1 -1
- package/dist/{loadingTime-Bhomd9qq.cjs → loadingTime-Cj5Oh8lT.cjs} +1 -1
- package/dist/{loadingTime-Bhomd9qq.cjs.map → loadingTime-Cj5Oh8lT.cjs.map} +1 -1
- package/dist/{loadingTime-ZkYvFijA.js → loadingTime-DMc0zTY8.js} +1 -1
- package/dist/{loadingTime-ZkYvFijA.js.map → loadingTime-DMc0zTY8.js.map} +1 -1
- package/dist/memoryNative.native-CK3QFVjY.cjs +2 -0
- package/dist/memoryNative.native-CK3QFVjY.cjs.map +1 -0
- package/dist/{memoryNative.native-C42h9SjK.js → memoryNative.native-DkA6f7id.js} +12 -12
- package/dist/memoryNative.native-DkA6f7id.js.map +1 -0
- package/dist/nativeSender-Dt1HLaLi.js +37 -0
- package/dist/nativeSender-Dt1HLaLi.js.map +1 -0
- package/dist/nativeSender-hCgUa7Vz.cjs +2 -0
- package/dist/nativeSender-hCgUa7Vz.cjs.map +1 -0
- package/dist/navigationRef-CVIv0aIK.js +30 -0
- package/dist/navigationRef-CVIv0aIK.js.map +1 -0
- package/dist/navigationRef-CfIbeXX8.cjs +2 -0
- package/dist/navigationRef-CfIbeXX8.cjs.map +1 -0
- package/dist/navigationWeb.web-CRHpr5zl.js +51 -0
- package/dist/navigationWeb.web-CRHpr5zl.js.map +1 -0
- package/dist/navigationWeb.web-DwWjL80b.cjs +2 -0
- package/dist/navigationWeb.web-DwWjL80b.cjs.map +1 -0
- package/dist/{networkChange-CUO1hRLj.cjs → networkChange-2FGIQM-N.cjs} +2 -2
- package/dist/networkChange-2FGIQM-N.cjs.map +1 -0
- package/dist/{networkChange-D39hdSb0.js → networkChange-QA0893vW.js} +2 -2
- package/dist/networkChange-QA0893vW.js.map +1 -0
- package/dist/networkInfo.native-CcJ3JVRF.js +31 -0
- package/dist/networkInfo.native-CcJ3JVRF.js.map +1 -0
- package/dist/networkInfo.native-whB2wf6a.cjs +2 -0
- package/dist/networkInfo.native-whB2wf6a.cjs.map +1 -0
- package/dist/{networkInfo.web-B2YlLNsI.js → networkInfo.web-CcUpXMUK.js} +2 -2
- package/dist/networkInfo.web-CcUpXMUK.js.map +1 -0
- package/dist/{networkInfo.web-PltJTHsy.cjs → networkInfo.web-DfO-BUFx.cjs} +2 -2
- package/dist/networkInfo.web-DfO-BUFx.cjs.map +1 -0
- package/dist/react-bqe7KPOf.cjs +4 -0
- package/dist/react-bqe7KPOf.cjs.map +1 -0
- package/dist/react-urNtDGTL.js +413 -0
- package/dist/react-urNtDGTL.js.map +1 -0
- package/dist/runtimeReady.native-CxFl1rQR.js +35 -0
- package/dist/runtimeReady.native-CxFl1rQR.js.map +1 -0
- package/dist/runtimeReady.native-zueSbsEv.cjs +2 -0
- package/dist/runtimeReady.native-zueSbsEv.cjs.map +1 -0
- package/dist/{runtimeReady.web-C8fdIbVR.js → runtimeReady.web-JuE239Tg.js} +2 -2
- package/dist/{runtimeReady.web-C8fdIbVR.js.map → runtimeReady.web-JuE239Tg.js.map} +1 -1
- package/dist/{runtimeReady.web-DHW682RN.cjs → runtimeReady.web-vhAJFU61.cjs} +2 -2
- package/dist/{runtimeReady.web-DHW682RN.cjs.map → runtimeReady.web-vhAJFU61.cjs.map} +1 -1
- package/dist/{seedRuntimeReady-Cz8nOKoo.js → seedRuntimeReady-BlRdf3pR.js} +2 -2
- package/dist/{seedRuntimeReady-Cz8nOKoo.js.map → seedRuntimeReady-BlRdf3pR.js.map} +1 -1
- package/dist/seedRuntimeReady-CbjqbWCd.cjs +2 -0
- package/dist/{seedRuntimeReady-BKwkBEAF.cjs.map → seedRuntimeReady-CbjqbWCd.cjs.map} +1 -1
- package/dist/src/adapters/appLifecycle.d.ts +3 -3
- package/dist/src/adapters/batch.d.ts +44 -0
- package/dist/src/adapters/crashCapture.d.ts +5 -1
- package/dist/src/adapters/deviceState.d.ts +9 -0
- package/dist/src/adapters/frameAggregate.d.ts +15 -13
- package/dist/src/adapters/frameTracker.d.ts +1 -1
- package/dist/src/adapters/hangDetector.d.ts +41 -0
- package/dist/src/adapters/manualSpans.d.ts +41 -0
- package/dist/src/adapters/native/autoTaps.native.d.ts +15 -0
- package/dist/src/adapters/native/deviceState.native.d.ts +15 -0
- package/dist/src/adapters/native/memoryNative.native.d.ts +3 -3
- package/dist/src/adapters/native/networkInfo.native.d.ts +1 -1
- package/dist/src/adapters/native/runtimeReady.native.d.ts +16 -0
- package/dist/src/adapters/navigationRef.d.ts +17 -9
- package/dist/src/adapters/networkChange.d.ts +2 -2
- package/dist/src/adapters/traceManager.d.ts +18 -5
- package/dist/src/adapters/uiInteraction.d.ts +1 -1
- package/dist/src/adapters/viewManager.d.ts +24 -8
- package/dist/src/adapters/web/deviceState.web.d.ts +10 -0
- package/dist/src/adapters/web/navigationWeb.web.d.ts +6 -10
- package/dist/src/adapters/web/webVitals.web.d.ts +7 -0
- package/dist/src/adapters/xhrIntercept.d.ts +2 -0
- package/dist/src/core/breadcrumbs.d.ts +10 -0
- package/dist/src/core/telemetry.d.ts +139 -29
- package/dist/src/core/userProfile.d.ts +7 -0
- package/dist/src/createTelemetry.native.d.ts +3 -1
- package/dist/src/createTelemetry.web.d.ts +2 -1
- package/dist/src/golden.helper.d.ts +4 -0
- package/dist/src/index.base.d.ts +80 -6
- package/dist/src/index.native.d.ts +4 -61
- package/dist/src/index.web.d.ts +4 -51
- package/dist/src/react.d.ts +45 -0
- package/dist/src/telemetryNative.native.d.ts +79 -0
- package/dist/src/telemetryWeb.web.d.ts +59 -0
- package/dist/{store.native-TPqXngmF.cjs → store.native-BbS76uWV.cjs} +1 -1
- package/dist/{store.native-TPqXngmF.cjs.map → store.native-BbS76uWV.cjs.map} +1 -1
- package/dist/{store.native-BYBJcy6o.js → store.native-MlWyGgBp.js} +1 -1
- package/dist/{store.native-BYBJcy6o.js.map → store.native-MlWyGgBp.js.map} +1 -1
- package/dist/{store.web-CvqqN-_Z.cjs → store.web-BzKaP57Z.cjs} +1 -1
- package/dist/{store.web-CvqqN-_Z.cjs.map → store.web-BzKaP57Z.cjs.map} +1 -1
- package/dist/{store.web-DJAlN0nc.js → store.web-rhh0NOfs.js} +1 -1
- package/dist/{store.web-DJAlN0nc.js.map → store.web-rhh0NOfs.js.map} +1 -1
- package/dist/telemetry-60sfWkh0.js +1754 -0
- package/dist/telemetry-60sfWkh0.js.map +1 -0
- package/dist/telemetry-CW63glwb.cjs +2 -0
- package/dist/telemetry-CW63glwb.cjs.map +1 -0
- package/dist/{uiInteraction-DAqxxz0q.js → uiInteraction-BIDOMcrL.js} +39 -34
- package/dist/{uiInteraction-DAqxxz0q.js.map → uiInteraction-BIDOMcrL.js.map} +1 -1
- package/dist/uiInteraction-DxlwCVSn.cjs +2 -0
- package/dist/{uiInteraction-CdzvEI1p.cjs.map → uiInteraction-DxlwCVSn.cjs.map} +1 -1
- package/dist/{viewport-Dd85GUNO.cjs → viewport-9JcVIXYF.cjs} +1 -1
- package/dist/{viewport-Dd85GUNO.cjs.map → viewport-9JcVIXYF.cjs.map} +1 -1
- package/dist/{viewport-Dzmt5QwK.js → viewport-GWTEBt2K.js} +1 -1
- package/dist/{viewport-Dzmt5QwK.js.map → viewport-GWTEBt2K.js.map} +1 -1
- package/dist/{web-vitals.attribution-CVCPiX-h.cjs → web-vitals.attribution-DAvBvdng.cjs} +1 -1
- package/dist/{web-vitals.attribution-CVCPiX-h.cjs.map → web-vitals.attribution-DAvBvdng.cjs.map} +1 -1
- package/dist/{web-vitals.attribution-xw9N5MKQ.js → web-vitals.attribution-DcoMtvlY.js} +1 -1
- package/dist/{web-vitals.attribution-xw9N5MKQ.js.map → web-vitals.attribution-DcoMtvlY.js.map} +1 -1
- package/dist/webSender-DA087xb5.cjs +2 -0
- package/dist/webSender-DA087xb5.cjs.map +1 -0
- package/dist/webSender-g4rs5TIg.js +44 -0
- package/dist/webSender-g4rs5TIg.js.map +1 -0
- package/dist/{webVitals.web-CNIpsKlA.js → webVitals.web-DRTDK6s5.js} +39 -24
- package/dist/webVitals.web-DRTDK6s5.js.map +1 -0
- package/dist/webVitals.web-DvScDIjX.cjs +2 -0
- package/dist/webVitals.web-DvScDIjX.cjs.map +1 -0
- package/dist/{xhrIntercept-BNiA41Mj.js → xhrIntercept-9uAkQh3N.js} +16 -14
- package/dist/xhrIntercept-9uAkQh3N.js.map +1 -0
- package/dist/xhrIntercept-xG1Yl5RI.cjs +2 -0
- package/dist/xhrIntercept-xG1Yl5RI.cjs.map +1 -0
- package/docs/migration-v4.md +1 -1
- package/docs/migration-v5.md +178 -0
- package/package.json +12 -4
- package/dist/appLifecycle-CECgRVu_.cjs +0 -2
- package/dist/appLifecycle-CECgRVu_.cjs.map +0 -1
- package/dist/appLifecycle-DQErzJIR.js.map +0 -1
- package/dist/batch-CwoO7noL.js +0 -56
- package/dist/batch-CwoO7noL.js.map +0 -1
- package/dist/batch-DNu8Xr9T.cjs +0 -2
- package/dist/batch-DNu8Xr9T.cjs.map +0 -1
- package/dist/crashCapture-BOJ8nSAZ.cjs +0 -4
- package/dist/crashCapture-BOJ8nSAZ.cjs.map +0 -1
- package/dist/crashCapture-BW8WuyaU.js +0 -70
- package/dist/crashCapture-BW8WuyaU.js.map +0 -1
- package/dist/crashHandler.web-8F_k2veo.js +0 -29
- package/dist/crashHandler.web-8F_k2veo.js.map +0 -1
- package/dist/crashHandler.web-CWmF56mJ.cjs +0 -2
- package/dist/crashHandler.web-CWmF56mJ.cjs.map +0 -1
- package/dist/crashHandlerNative.native-C2kSikDt.cjs +0 -2
- package/dist/crashHandlerNative.native-C2kSikDt.cjs.map +0 -1
- package/dist/crashHandlerNative.native-FupMnr1U.js.map +0 -1
- package/dist/deviceInfo.native-BJ-3Jj1T.js +0 -53
- package/dist/deviceInfo.native-BoeTZcD6.cjs +0 -2
- package/dist/frameTracker-CHG6sIx9.cjs +0 -2
- package/dist/frameTracker-CHG6sIx9.cjs.map +0 -1
- package/dist/frameTracker-DdB8W_kC.js.map +0 -1
- package/dist/index-BtLlV1HA.js +0 -57
- package/dist/index-BtLlV1HA.js.map +0 -1
- package/dist/index-C2XQ-EYw.js +0 -1122
- package/dist/index-C2XQ-EYw.js.map +0 -1
- package/dist/index-CXsVZY35.cjs +0 -2
- package/dist/index-CXsVZY35.cjs.map +0 -1
- package/dist/index-DLquF88M.cjs +0 -2
- package/dist/index-DLquF88M.cjs.map +0 -1
- package/dist/interactionWeb.web-Bl_cZlgh.cjs +0 -2
- package/dist/interceptFetchWeb.web-T88kO-bE.cjs +0 -2
- package/dist/interceptFetchWeb.web-T88kO-bE.cjs.map +0 -1
- package/dist/memoryNative.native-C42h9SjK.js.map +0 -1
- package/dist/memoryNative.native-CA-7w9w1.cjs +0 -2
- package/dist/memoryNative.native-CA-7w9w1.cjs.map +0 -1
- package/dist/memoryStore-BIGZmmfD.cjs +0 -2
- package/dist/memoryStore-BIGZmmfD.cjs.map +0 -1
- package/dist/memoryStore-F5I-GQKM.js +0 -193
- package/dist/memoryStore-F5I-GQKM.js.map +0 -1
- package/dist/nativeSender-CfQaRuDK.cjs +0 -2
- package/dist/nativeSender-CfQaRuDK.cjs.map +0 -1
- package/dist/nativeSender-pgVSIv-X.js +0 -59
- package/dist/nativeSender-pgVSIv-X.js.map +0 -1
- package/dist/navigationRef-BzYbs8cm.js +0 -28
- package/dist/navigationRef-BzYbs8cm.js.map +0 -1
- package/dist/navigationRef-C-_qhb43.cjs +0 -2
- package/dist/navigationRef-C-_qhb43.cjs.map +0 -1
- package/dist/navigationTracker-BmywA_Bg.js +0 -19
- package/dist/navigationTracker-BmywA_Bg.js.map +0 -1
- package/dist/navigationTracker-HkwVyywz.cjs +0 -2
- package/dist/navigationTracker-HkwVyywz.cjs.map +0 -1
- package/dist/navigationWeb.web-CW_z7Ca4.cjs +0 -2
- package/dist/navigationWeb.web-CW_z7Ca4.cjs.map +0 -1
- package/dist/navigationWeb.web-CcwgKuIZ.js +0 -55
- package/dist/navigationWeb.web-CcwgKuIZ.js.map +0 -1
- package/dist/networkChange-CUO1hRLj.cjs.map +0 -1
- package/dist/networkChange-D39hdSb0.js.map +0 -1
- package/dist/networkInfo.native-CGrx9cnH.js +0 -343
- package/dist/networkInfo.native-CGrx9cnH.js.map +0 -1
- package/dist/networkInfo.native-YVySdv3S.cjs +0 -2
- package/dist/networkInfo.native-YVySdv3S.cjs.map +0 -1
- package/dist/networkInfo.web-B2YlLNsI.js.map +0 -1
- package/dist/networkInfo.web-PltJTHsy.cjs.map +0 -1
- package/dist/runtimeReady.native-Bh7EcYmK.js +0 -14
- package/dist/runtimeReady.native-Bh7EcYmK.js.map +0 -1
- package/dist/runtimeReady.native-jUmuE1lV.cjs +0 -2
- package/dist/runtimeReady.native-jUmuE1lV.cjs.map +0 -1
- package/dist/seedRuntimeReady-BKwkBEAF.cjs +0 -2
- package/dist/src/adapters/navigationTracker.d.ts +0 -6
- package/dist/src/adapters/screenTiming.d.ts +0 -15
- package/dist/telemetry-ByDJIz_9.js +0 -1280
- package/dist/telemetry-ByDJIz_9.js.map +0 -1
- package/dist/telemetry-CrU7i1Jc.cjs +0 -2
- package/dist/telemetry-CrU7i1Jc.cjs.map +0 -1
- package/dist/uiInteraction-CdzvEI1p.cjs +0 -2
- package/dist/webSender-BIwslfpT.js +0 -63
- package/dist/webSender-BIwslfpT.js.map +0 -1
- package/dist/webSender-CVtE4sOF.cjs +0 -2
- package/dist/webSender-CVtE4sOF.cjs.map +0 -1
- package/dist/webVitals.web-CNIpsKlA.js.map +0 -1
- package/dist/webVitals.web-DpWJ-iYp.cjs +0 -2
- package/dist/webVitals.web-DpWJ-iYp.cjs.map +0 -1
- package/dist/xhrIntercept-BADex6Cq.cjs +0 -2
- package/dist/xhrIntercept-BADex6Cq.cjs.map +0 -1
- package/dist/xhrIntercept-BNiA41Mj.js.map +0 -1
package/dist/{crashHandlerNative.native-FupMnr1U.js → crashHandlerNative.native-DsCRd-oN.js}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
class
|
|
1
|
+
import { i as n, b as s, c } from "./react-urNtDGTL.js";
|
|
2
|
+
class u {
|
|
3
3
|
constructor(l) {
|
|
4
4
|
this.telemetry = l;
|
|
5
5
|
}
|
|
@@ -7,33 +7,33 @@ class f {
|
|
|
7
7
|
// `app.error` and console.warn a breadcrumb, both opt-in (default off). §4.7, #100
|
|
8
8
|
attach(l = {}) {
|
|
9
9
|
const { captureConsole: o = !1 } = l;
|
|
10
|
-
return new Promise((
|
|
10
|
+
return new Promise((i, d) => {
|
|
11
11
|
try {
|
|
12
12
|
if (typeof ErrorUtils < "u" && ErrorUtils.setGlobalHandler) {
|
|
13
13
|
const e = ErrorUtils.getGlobalHandler?.();
|
|
14
|
-
ErrorUtils.setGlobalHandler((
|
|
15
|
-
this.telemetry.log("app.crash",
|
|
16
|
-
fatal: !!
|
|
17
|
-
})), e && e(
|
|
14
|
+
ErrorUtils.setGlobalHandler((r, a) => {
|
|
15
|
+
n(r) || this.telemetry.log("app.crash", s("global_handler", r, {
|
|
16
|
+
fatal: !!a
|
|
17
|
+
})), e && e(r, a);
|
|
18
18
|
});
|
|
19
19
|
}
|
|
20
20
|
const t = (e) => {
|
|
21
|
-
this.telemetry.log("app.crash",
|
|
21
|
+
n(e?.reason) || this.telemetry.log("app.crash", s("unhandled_rejection", e?.reason, {
|
|
22
22
|
fallbackMessage: "Unhandled Promise Rejection",
|
|
23
23
|
fatal: !1
|
|
24
24
|
}));
|
|
25
25
|
};
|
|
26
26
|
globalThis.addEventListener ? globalThis.addEventListener("unhandledrejection", t) : require("promise/setimmediate/rejection-tracking").enable({
|
|
27
27
|
allRejections: !0,
|
|
28
|
-
onUnhandled: (
|
|
29
|
-
}), o && c(this.telemetry),
|
|
28
|
+
onUnhandled: (r, a) => t({ reason: a })
|
|
29
|
+
}), o && c(this.telemetry), i();
|
|
30
30
|
} catch (t) {
|
|
31
|
-
|
|
31
|
+
d(t);
|
|
32
32
|
}
|
|
33
33
|
});
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
export {
|
|
37
|
-
|
|
37
|
+
u as CrashHandlerNative
|
|
38
38
|
};
|
|
39
|
-
//# sourceMappingURL=crashHandlerNative.native-
|
|
39
|
+
//# sourceMappingURL=crashHandlerNative.native-DsCRd-oN.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crashHandlerNative.native-DsCRd-oN.js","sources":["../src/adapters/native/crashHandlerNative.native.ts"],"sourcesContent":["import { Telemetry } from \"../../core/telemetry\";\nimport { buildErrorAttributes, captureConsole, isBoundaryCaught } from \"../crashCapture\";\n\nexport type CrashHandlerOptions = { captureConsole?: boolean };\n\nexport class CrashHandlerNative {\n constructor(private telemetry: Telemetry) { }\n\n // JS errors and unhandled rejections become `app.crash`; console.error becomes\n // `app.error` and console.warn a breadcrumb, both opt-in (default off). §4.7, #100\n attach(options: CrashHandlerOptions = {}): Promise<void> {\n const { captureConsole: consoleEnabled = false } = options;\n return new Promise((resolve, reject) => {\n try {\n if (typeof ErrorUtils !== \"undefined\" && ErrorUtils.setGlobalHandler) {\n const defaultHandler = ErrorUtils.getGlobalHandler?.();\n ErrorUtils.setGlobalHandler((error: any, isFatal?: boolean) => {\n // `error.fatal` is native-only — the web build never passes it (§4.7).\n // A boundary-caught error is already a row (#166); RN's handler still runs.\n if (!isBoundaryCaught(error)) this.telemetry.log(\"app.crash\", buildErrorAttributes(\"global_handler\", error, {\n fatal: !!isFatal,\n }));\n if (defaultHandler) defaultHandler(error, isFatal); // keep RN red screen in dev\n });\n }\n\n const onRejection = (event: any) => {\n if (isBoundaryCaught(event?.reason)) return;\n this.telemetry.log(\"app.crash\", buildErrorAttributes(\"unhandled_rejection\", event?.reason, {\n fallbackMessage: \"Unhandled Promise Rejection\",\n fatal: false,\n }));\n };\n\n if (globalThis.addEventListener) {\n globalThis.addEventListener(\"unhandledrejection\", onRejection);\n } else {\n const tracking = require(\"promise/setimmediate/rejection-tracking\");\n tracking.enable({\n allRejections: true,\n onUnhandled: (_id: any, error: any) =>\n onRejection({ reason: error }),\n });\n }\n\n if (consoleEnabled) captureConsole(this.telemetry);\n\n resolve();\n } catch (error) {\n reject(error);\n }\n });\n }\n}\n"],"names":["CrashHandlerNative","telemetry","options","consoleEnabled","resolve","reject","defaultHandler","error","isFatal","isBoundaryCaught","buildErrorAttributes","onRejection","event","_id","captureConsole"],"mappings":";AAKO,MAAMA,EAAmB;AAAA,EAC5B,YAAoBC,GAAsB;AAAtB,SAAA,YAAAA;AAAA,EAAwB;AAAA;AAAA;AAAA,EAI5C,OAAOC,IAA+B,IAAmB;AACrD,UAAM,EAAE,gBAAgBC,IAAiB,GAAA,IAAUD;AACnD,WAAO,IAAI,QAAQ,CAACE,GAASC,MAAW;AACpC,UAAI;AACA,YAAI,OAAO,aAAe,OAAe,WAAW,kBAAkB;AAClE,gBAAMC,IAAiB,WAAW,mBAAA;AAClC,qBAAW,iBAAiB,CAACC,GAAYC,MAAsB;AAG3D,YAAKC,EAAiBF,CAAK,KAAG,KAAK,UAAU,IAAI,aAAaG,EAAqB,kBAAkBH,GAAO;AAAA,cACxG,OAAO,CAAC,CAACC;AAAA,YAAA,CACZ,CAAC,GACEF,KAAgBA,EAAeC,GAAOC,CAAO;AAAA,UACrD,CAAC;AAAA,QACL;AAEA,cAAMG,IAAc,CAACC,MAAe;AAChC,UAAIH,EAAiBG,GAAO,MAAM,KAClC,KAAK,UAAU,IAAI,aAAaF,EAAqB,uBAAuBE,GAAO,QAAQ;AAAA,YACvF,iBAAiB;AAAA,YACjB,OAAO;AAAA,UAAA,CACV,CAAC;AAAA,QACN;AAEA,QAAI,WAAW,mBACX,WAAW,iBAAiB,sBAAsBD,CAAW,IAE5C,QAAQ,yCAAyC,EACzD,OAAO;AAAA,UACZ,eAAe;AAAA,UACf,aAAa,CAACE,GAAUN,MACpBI,EAAY,EAAE,QAAQJ,GAAO;AAAA,QAAA,CACpC,GAGDJ,KAAgBW,EAAe,KAAK,SAAS,GAEjDV,EAAA;AAAA,MACJ,SAASG,GAAO;AACZ,QAAAF,EAAOE,CAAK;AAAA,MAChB;AAAA,IACJ,CAAC;AAAA,EACL;AACJ;"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react-native"),e=require("react-native-device-info"),N=require("./viewport-9JcVIXYF.cjs");class S{constructor(){}async collect(){const o=await e.getApplicationName()||"UnknownApp",n=await e.getVersion()||"0.0.0",r=await e.getBuildNumber()||"0",s=await e.getBundleId()||"unknown.package",c=await e.getBrand(),d=await e.getManufacturer()||"",m=await e.getModel()||"",i=await e.getSystemVersion()||"",l=await e.getSystemName()||"",a=t.Platform.OS==="android"?await e.getApiLevel():void 0,w=t.Platform.OS==="android"?await e.getHardware?.():void 0,p=t.Platform.OS==="android"?await e.getProduct?.():void 0,u=t.Platform.OS==="ios"?l:void 0,v=(await e.supportedAbis?.())?.[0],g=await e.isLowRamDevice?.(),{width:f,height:b}=t.Dimensions.get("window"),y=N.viewportKeys(f,b,t.PixelRatio.get());return{app:{name:o,version:n,build_number:r,package_name:s},device:{platform:t.Platform.OS,platform_version:i,model:m,manufacturer:d,brand:c,android_sdk:typeof a=="number"&&a>0?a:void 0,android_release:t.Platform.OS==="android"?i:void 0,hardware:w,product:p,cpu_abi:v,low_ram:g,system_name:u,...y}}}async start(o){}}exports.DeviceInfoTrackerNative=S;
|
|
2
|
+
//# sourceMappingURL=deviceInfo.native-D5gNBG7m.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deviceInfo.native-
|
|
1
|
+
{"version":3,"file":"deviceInfo.native-D5gNBG7m.cjs","sources":["../src/adapters/native/deviceInfo.native.ts"],"sourcesContent":["// adapters/native/deviceInfoNative.native.ts\nimport { Dimensions, PixelRatio, Platform } from \"react-native\";\nimport DeviceInfoLib from \"react-native-device-info\";\nimport { Telemetry } from \"../../core/telemetry\";\nimport { DeviceInfo } from \"../../core/telemetry\";\nimport { viewportKeys } from \"../viewport\";\n\nexport class DeviceInfoTrackerNative {\n // private telemetry: Telemetry;\n\n // constructor(telemetry?: Telemetry) {\n // this.telemetry = telemetry || new Telemetry();\n // }\n\n constructor() {\n }\n\n // device.id is NOT collected here (#91): it is self-minted and persisted by core.\n // getUniqueId() carries two lifetimes on RN alone — ANDROID_ID survives reinstall,\n // identifierForVendor does not — so one identity column would mean two things.\n async collect(): Promise<DeviceInfo> {\n // 🔹 App metadata\n const appName = (await DeviceInfoLib.getApplicationName()) || \"UnknownApp\";\n const appVersion = (await DeviceInfoLib.getVersion()) || \"0.0.0\";\n const buildNumber = (await DeviceInfoLib.getBuildNumber()) || \"0\";\n const packageName = (await DeviceInfoLib.getBundleId()) || \"unknown.package\";\n\n // 🔹 Common Device metadata\n const brand = await DeviceInfoLib.getBrand();\n const manufacturer = (await DeviceInfoLib.getManufacturer()) || \"\";\n const model = (await DeviceInfoLib.getModel()) || \"\";\n const systemVersion = (await DeviceInfoLib.getSystemVersion()) || \"\";\n const systemName = (await DeviceInfoLib.getSystemName()) || \"\"; // iOS: \"iOS\", Android: \"Android\"\n\n // 🔹 Android-only fields\n const sdk = Platform.OS === \"android\" ? await DeviceInfoLib.getApiLevel() : undefined;\n const hardware = Platform.OS === \"android\" ? await DeviceInfoLib.getHardware?.() : undefined;\n const product = Platform.OS === \"android\" ? await DeviceInfoLib.getProduct?.() : undefined;\n\n // 🔹 iOS-only fields\n // ⚠ `getDeviceName()` — the user's own name for their phone — is deliberately NOT\n // read any more (§3.4): real PII, no column, no reader. `getFingerprint()` went with\n // it — a build string that merges handsets, which *repairs* device identity (§1.2).\n const iosSystemName = Platform.OS === \"ios\" ? systemName : undefined;\n\n // 🔹 §3.3 ✱ — device capability (native only) and viewport (both builds).\n const cpuAbi = (await DeviceInfoLib.supportedAbis?.())?.[0];\n const lowRam = await DeviceInfoLib.isLowRamDevice?.();\n\n // Read on every collect(), not cached: a device rotates mid-session, and §3.1 puts\n // `device.orientation` and device state on the log-time side of the freeze. The\n // *shaping* is shared with web (`adapters/viewport.ts`) so one column cannot come to\n // mean physical pixels on one build and dp on the other.\n const { width, height } = Dimensions.get(\"window\");\n const viewport = viewportKeys(width, height, PixelRatio.get());\n\n const info: DeviceInfo = {\n app: {\n name: appName,\n version: appVersion,\n build_number: buildNumber,\n package_name: packageName,\n },\n device: {\n platform: Platform.OS,\n platform_version: systemVersion,\n model,\n manufacturer,\n brand,\n\n // Android fields\n android_sdk: typeof sdk === \"number\" && sdk > 0 ? sdk : undefined,\n android_release: Platform.OS === \"android\" ? systemVersion : undefined,\n hardware,\n product,\n cpu_abi: cpuAbi,\n low_ram: lowRam,\n\n // iOS fields\n system_name: iosSystemName,\n\n // Viewport — both builds, never null (§3.3)\n ...viewport,\n },\n };\n\n return info;\n }\n\n /**\n * Context-only adapter. collect() feeds the Context block on every event;\n * start() emits no standalone device_info event (ADR-0002).\n */\n async start(_telemetry: Telemetry): Promise<void> {\n // no-op: device metadata rides as attributes on every event\n }\n}\n"],"names":["DeviceInfoTrackerNative","appName","DeviceInfoLib","appVersion","buildNumber","packageName","brand","manufacturer","model","systemVersion","systemName","sdk","Platform","hardware","product","iosSystemName","cpuAbi","lowRam","width","height","D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,EACA,QAASE,EACT,QAASC,EAGT,YAAaF,EAGb,GAAGM,CAAA,CACP,CAIR,CAMA,MAAM,MAAMG,EAAsC,CAElD,CACJ"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { Platform as a, Dimensions as N, PixelRatio as S } from "react-native";
|
|
2
|
+
import t from "react-native-device-info";
|
|
3
|
+
import { v as _ } from "./viewport-GWTEBt2K.js";
|
|
4
|
+
class V {
|
|
5
|
+
// private telemetry: Telemetry;
|
|
6
|
+
// constructor(telemetry?: Telemetry) {
|
|
7
|
+
// this.telemetry = telemetry || new Telemetry();
|
|
8
|
+
// }
|
|
9
|
+
constructor() {
|
|
10
|
+
}
|
|
11
|
+
// device.id is NOT collected here (#91): it is self-minted and persisted by core.
|
|
12
|
+
// getUniqueId() carries two lifetimes on RN alone — ANDROID_ID survives reinstall,
|
|
13
|
+
// identifierForVendor does not — so one identity column would mean two things.
|
|
14
|
+
async collect() {
|
|
15
|
+
const o = await t.getApplicationName() || "UnknownApp", n = await t.getVersion() || "0.0.0", r = await t.getBuildNumber() || "0", s = await t.getBundleId() || "unknown.package", c = await t.getBrand(), d = await t.getManufacturer() || "", m = await t.getModel() || "", i = await t.getSystemVersion() || "", p = await t.getSystemName() || "", e = a.OS === "android" ? await t.getApiLevel() : void 0, w = a.OS === "android" ? await t.getHardware?.() : void 0, u = a.OS === "android" ? await t.getProduct?.() : void 0, l = a.OS === "ios" ? p : void 0, g = (await t.supportedAbis?.())?.[0], v = await t.isLowRamDevice?.(), { width: f, height: b } = N.get("window"), y = _(f, b, S.get());
|
|
16
|
+
return {
|
|
17
|
+
app: {
|
|
18
|
+
name: o,
|
|
19
|
+
version: n,
|
|
20
|
+
build_number: r,
|
|
21
|
+
package_name: s
|
|
22
|
+
},
|
|
23
|
+
device: {
|
|
24
|
+
platform: a.OS,
|
|
25
|
+
platform_version: i,
|
|
26
|
+
model: m,
|
|
27
|
+
manufacturer: d,
|
|
28
|
+
brand: c,
|
|
29
|
+
// Android fields
|
|
30
|
+
android_sdk: typeof e == "number" && e > 0 ? e : void 0,
|
|
31
|
+
android_release: a.OS === "android" ? i : void 0,
|
|
32
|
+
hardware: w,
|
|
33
|
+
product: u,
|
|
34
|
+
cpu_abi: g,
|
|
35
|
+
low_ram: v,
|
|
36
|
+
// iOS fields
|
|
37
|
+
system_name: l,
|
|
38
|
+
// Viewport — both builds, never null (§3.3)
|
|
39
|
+
...y
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Context-only adapter. collect() feeds the Context block on every event;
|
|
45
|
+
* start() emits no standalone device_info event (ADR-0002).
|
|
46
|
+
*/
|
|
47
|
+
async start(o) {
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
export {
|
|
51
|
+
V as DeviceInfoTrackerNative
|
|
52
|
+
};
|
|
53
|
+
//# sourceMappingURL=deviceInfo.native-DiiHrnI3.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deviceInfo.native-
|
|
1
|
+
{"version":3,"file":"deviceInfo.native-DiiHrnI3.js","sources":["../src/adapters/native/deviceInfo.native.ts"],"sourcesContent":["// adapters/native/deviceInfoNative.native.ts\nimport { Dimensions, PixelRatio, Platform } from \"react-native\";\nimport DeviceInfoLib from \"react-native-device-info\";\nimport { Telemetry } from \"../../core/telemetry\";\nimport { DeviceInfo } from \"../../core/telemetry\";\nimport { viewportKeys } from \"../viewport\";\n\nexport class DeviceInfoTrackerNative {\n // private telemetry: Telemetry;\n\n // constructor(telemetry?: Telemetry) {\n // this.telemetry = telemetry || new Telemetry();\n // }\n\n constructor() {\n }\n\n // device.id is NOT collected here (#91): it is self-minted and persisted by core.\n // getUniqueId() carries two lifetimes on RN alone — ANDROID_ID survives reinstall,\n // identifierForVendor does not — so one identity column would mean two things.\n async collect(): Promise<DeviceInfo> {\n // 🔹 App metadata\n const appName = (await DeviceInfoLib.getApplicationName()) || \"UnknownApp\";\n const appVersion = (await DeviceInfoLib.getVersion()) || \"0.0.0\";\n const buildNumber = (await DeviceInfoLib.getBuildNumber()) || \"0\";\n const packageName = (await DeviceInfoLib.getBundleId()) || \"unknown.package\";\n\n // 🔹 Common Device metadata\n const brand = await DeviceInfoLib.getBrand();\n const manufacturer = (await DeviceInfoLib.getManufacturer()) || \"\";\n const model = (await DeviceInfoLib.getModel()) || \"\";\n const systemVersion = (await DeviceInfoLib.getSystemVersion()) || \"\";\n const systemName = (await DeviceInfoLib.getSystemName()) || \"\"; // iOS: \"iOS\", Android: \"Android\"\n\n // 🔹 Android-only fields\n const sdk = Platform.OS === \"android\" ? await DeviceInfoLib.getApiLevel() : undefined;\n const hardware = Platform.OS === \"android\" ? await DeviceInfoLib.getHardware?.() : undefined;\n const product = Platform.OS === \"android\" ? await DeviceInfoLib.getProduct?.() : undefined;\n\n // 🔹 iOS-only fields\n // ⚠ `getDeviceName()` — the user's own name for their phone — is deliberately NOT\n // read any more (§3.4): real PII, no column, no reader. `getFingerprint()` went with\n // it — a build string that merges handsets, which *repairs* device identity (§1.2).\n const iosSystemName = Platform.OS === \"ios\" ? systemName : undefined;\n\n // 🔹 §3.3 ✱ — device capability (native only) and viewport (both builds).\n const cpuAbi = (await DeviceInfoLib.supportedAbis?.())?.[0];\n const lowRam = await DeviceInfoLib.isLowRamDevice?.();\n\n // Read on every collect(), not cached: a device rotates mid-session, and §3.1 puts\n // `device.orientation` and device state on the log-time side of the freeze. The\n // *shaping* is shared with web (`adapters/viewport.ts`) so one column cannot come to\n // mean physical pixels on one build and dp on the other.\n const { width, height } = Dimensions.get(\"window\");\n const viewport = viewportKeys(width, height, PixelRatio.get());\n\n const info: DeviceInfo = {\n app: {\n name: appName,\n version: appVersion,\n build_number: buildNumber,\n package_name: packageName,\n },\n device: {\n platform: Platform.OS,\n platform_version: systemVersion,\n model,\n manufacturer,\n brand,\n\n // Android fields\n android_sdk: typeof sdk === \"number\" && sdk > 0 ? sdk : undefined,\n android_release: Platform.OS === \"android\" ? systemVersion : undefined,\n hardware,\n product,\n cpu_abi: cpuAbi,\n low_ram: lowRam,\n\n // iOS fields\n system_name: iosSystemName,\n\n // Viewport — both builds, never null (§3.3)\n ...viewport,\n },\n };\n\n return info;\n }\n\n /**\n * Context-only adapter. collect() feeds the Context block on every event;\n * start() emits no standalone device_info event (ADR-0002).\n */\n async start(_telemetry: Telemetry): Promise<void> {\n // no-op: device metadata rides as attributes on every event\n }\n}\n"],"names":["DeviceInfoTrackerNative","appName","DeviceInfoLib","appVersion","buildNumber","packageName","brand","manufacturer","model","systemVersion","systemName","sdk","Platform","hardware","product","iosSystemName","cpuAbi","lowRam","width","height","Dimensions","viewport","viewportKeys","PixelRatio","_telemetry"],"mappings":";;;AAOO,MAAMA,EAAwB;AAAA;AAAA;AAAA;AAAA;AAAA,EAOjC,cAAc;AAAA,EACd;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,UAA+B;AAEjC,UAAMC,IAAW,MAAMC,EAAc,mBAAA,KAAyB,cACxDC,IAAc,MAAMD,EAAc,WAAA,KAAiB,SACnDE,IAAe,MAAMF,EAAc,eAAA,KAAqB,KACxDG,IAAe,MAAMH,EAAc,YAAA,KAAkB,mBAGrDI,IAAQ,MAAMJ,EAAc,SAAA,GAC5BK,IAAgB,MAAML,EAAc,gBAAA,KAAsB,IAC1DM,IAAS,MAAMN,EAAc,SAAA,KAAe,IAC5CO,IAAiB,MAAMP,EAAc,iBAAA,KAAuB,IAC5DQ,IAAc,MAAMR,EAAc,cAAA,KAAoB,IAGtDS,IAAMC,EAAS,OAAO,YAAY,MAAMV,EAAc,gBAAgB,QACtEW,IAAWD,EAAS,OAAO,YAAY,MAAMV,EAAc,kBAAkB,QAC7EY,IAAUF,EAAS,OAAO,YAAY,MAAMV,EAAc,iBAAiB,QAM3Ea,IAAgBH,EAAS,OAAO,QAAQF,IAAa,QAGrDM,KAAU,MAAMd,EAAc,gBAAA,KAAqB,CAAC,GACpDe,IAAS,MAAMf,EAAc,iBAAA,GAM7B,EAAE,OAAAgB,GAAO,QAAAC,EAAA,IAAWC,EAAW,IAAI,QAAQ,GAC3CC,IAAWC,EAAaJ,GAAOC,GAAQI,EAAW,KAAK;AAgC7D,WA9ByB;AAAA,MACrB,KAAK;AAAA,QACD,MAAMtB;AAAA,QACN,SAASE;AAAA,QACT,cAAcC;AAAA,QACd,cAAcC;AAAA,MAAA;AAAA,MAElB,QAAQ;AAAA,QACJ,UAAUO,EAAS;AAAA,QACnB,kBAAkBH;AAAA,QAClB,OAAAD;AAAA,QACA,cAAAD;AAAA,QACA,OAAAD;AAAA;AAAA,QAGA,aAAa,OAAOK,KAAQ,YAAYA,IAAM,IAAIA,IAAM;AAAA,QACxD,iBAAiBC,EAAS,OAAO,YAAYH,IAAgB;AAAA,QAC7D,UAAAI;AAAA,QACA,SAAAC;AAAA,QACA,SAASE;AAAA,QACT,SAASC;AAAA;AAAA,QAGT,aAAaF;AAAA;AAAA,QAGb,GAAGM;AAAA,MAAA;AAAA,IACP;AAAA,EAIR;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,MAAM,MAAMG,GAAsC;AAAA,EAElD;AACJ;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { v as n } from "./viewport-
|
|
1
|
+
import { v as n } from "./viewport-GWTEBt2K.js";
|
|
2
2
|
class a {
|
|
3
3
|
constructor() {
|
|
4
4
|
}
|
|
@@ -24,7 +24,7 @@ class a {
|
|
|
24
24
|
hardware: void 0,
|
|
25
25
|
product: void 0,
|
|
26
26
|
// iOS placeholders
|
|
27
|
-
|
|
27
|
+
system_name: void 0,
|
|
28
28
|
// `cpu_abi` / `low_ram` are native-only (§3.3's `N`) — a browser exposes
|
|
29
29
|
// neither, and a fabricated value is worse than an absent key.
|
|
30
30
|
...r
|
|
@@ -38,4 +38,4 @@ class a {
|
|
|
38
38
|
export {
|
|
39
39
|
a as DeviceInfoTrackerWeb
|
|
40
40
|
};
|
|
41
|
-
//# sourceMappingURL=deviceInfo.web-
|
|
41
|
+
//# sourceMappingURL=deviceInfo.web-BHsjVveq.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deviceInfo.web-
|
|
1
|
+
{"version":3,"file":"deviceInfo.web-BHsjVveq.js","sources":["../src/adapters/web/deviceInfo.web.ts"],"sourcesContent":["// adapters/web/deviceInfoWeb.web.ts\nimport { DeviceInfo, Telemetry } from \"../../core/telemetry\";\nimport { viewportKeys } from \"../viewport\";\n\nexport class DeviceInfoTrackerWeb {\n private telemetry?: Telemetry;\n\n\n constructor() {\n }\n // device.id is NOT collected here (#91): core self-mints and persists it via the Store.\n async collect(): Promise<DeviceInfo> {\n const ua = navigator.userAgent;\n\n // §3.3 ✱ — viewport, read on every collect() because a browser window resizes and a\n // phone rotates; §3.1 keeps device state on the log-time side of the freeze. The\n // *viewport*, not `screen.*`: that is the quantity CLS and LCP scale with. Shaped by\n // the shared `adapters/viewport.ts`, so the key means the same thing native ships.\n const dpr = typeof devicePixelRatio === \"number\" ? devicePixelRatio : 1;\n const viewport = viewportKeys(window.innerWidth ?? 0, window.innerHeight ?? 0, dpr);\n\n return {\n app: {\n name: document.title || \"WebApp\",\n version: process.env.APP_VERSION || \"1.0.0\",\n build_number: process.env.BUILD_NUMBER,\n package_name: window.location.hostname,\n },\n device: {\n platform: \"web\",\n platform_version: navigator.appVersion,\n model: ua,\n manufacturer: \"browser\",\n brand: navigator.vendor || \"unknown\",\n\n // Android placeholders\n android_sdk: undefined,\n android_release: undefined,\n hardware: undefined,\n product: undefined,\n\n // iOS placeholders\n system_name: undefined,\n\n // `cpu_abi` / `low_ram` are native-only (§3.3's `N`) — a browser exposes\n // neither, and a fabricated value is worse than an absent key.\n ...viewport,\n },\n };\n }\n\n async start(telemetry: Telemetry): Promise<void> {\n // context-only adapter — collect() feeds the Context block on every event;\n // no standalone device_info event (ADR-0002)\n this.telemetry = telemetry;\n }\n}\n"],"names":["DeviceInfoTrackerWeb","ua","dpr","viewport","viewportKeys","telemetry"],"mappings":";AAIO,MAAMA,EAAqB;AAAA,EAI9B,cAAc;AAAA,EACd;AAAA;AAAA,EAEA,MAAM,UAA+B;AACjC,UAAMC,IAAK,UAAU,WAMfC,IAAM,OAAO,oBAAqB,WAAW,mBAAmB,GAChEC,IAAWC,EAAa,OAAO,cAAc,GAAG,OAAO,eAAe,GAAGF,CAAG;AAElF,WAAO;AAAA,MACH,KAAK;AAAA,QACD,MAAM,SAAS,SAAS;AAAA,QACxB,SAAS,QAAQ,IAAI,eAAe;AAAA,QACpC,cAAc,QAAQ,IAAI;AAAA,QAC1B,cAAc,OAAO,SAAS;AAAA,MAAA;AAAA,MAElC,QAAQ;AAAA,QACJ,UAAU;AAAA,QACV,kBAAkB,UAAU;AAAA,QAC5B,OAAOD;AAAA,QACP,cAAc;AAAA,QACd,OAAO,UAAU,UAAU;AAAA;AAAA,QAG3B,aAAa;AAAA,QACb,iBAAiB;AAAA,QACjB,UAAU;AAAA,QACV,SAAS;AAAA;AAAA,QAGT,aAAa;AAAA;AAAA;AAAA,QAIb,GAAGE;AAAA,MAAA;AAAA,IACP;AAAA,EAER;AAAA,EAEA,MAAM,MAAME,GAAqC;AAG7C,SAAK,YAAYA;AAAA,EACrB;AACJ;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./viewport-
|
|
2
|
-
//# sourceMappingURL=deviceInfo.web-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("./viewport-9JcVIXYF.cjs");class t{constructor(){}async collect(){const e=navigator.userAgent,o=typeof devicePixelRatio=="number"?devicePixelRatio:1,r=n.viewportKeys(window.innerWidth??0,window.innerHeight??0,o);return{app:{name:document.title||"WebApp",version:process.env.APP_VERSION||"1.0.0",build_number:process.env.BUILD_NUMBER,package_name:window.location.hostname},device:{platform:"web",platform_version:navigator.appVersion,model:e,manufacturer:"browser",brand:navigator.vendor||"unknown",android_sdk:void 0,android_release:void 0,hardware:void 0,product:void 0,system_name:void 0,...r}}}async start(e){this.telemetry=e}}exports.DeviceInfoTrackerWeb=t;
|
|
2
|
+
//# sourceMappingURL=deviceInfo.web-DGCUHAnv.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deviceInfo.web-
|
|
1
|
+
{"version":3,"file":"deviceInfo.web-DGCUHAnv.cjs","sources":["../src/adapters/web/deviceInfo.web.ts"],"sourcesContent":["// adapters/web/deviceInfoWeb.web.ts\nimport { DeviceInfo, Telemetry } from \"../../core/telemetry\";\nimport { viewportKeys } from \"../viewport\";\n\nexport class DeviceInfoTrackerWeb {\n private telemetry?: Telemetry;\n\n\n constructor() {\n }\n // device.id is NOT collected here (#91): core self-mints and persists it via the Store.\n async collect(): Promise<DeviceInfo> {\n const ua = navigator.userAgent;\n\n // §3.3 ✱ — viewport, read on every collect() because a browser window resizes and a\n // phone rotates; §3.1 keeps device state on the log-time side of the freeze. The\n // *viewport*, not `screen.*`: that is the quantity CLS and LCP scale with. Shaped by\n // the shared `adapters/viewport.ts`, so the key means the same thing native ships.\n const dpr = typeof devicePixelRatio === \"number\" ? devicePixelRatio : 1;\n const viewport = viewportKeys(window.innerWidth ?? 0, window.innerHeight ?? 0, dpr);\n\n return {\n app: {\n name: document.title || \"WebApp\",\n version: process.env.APP_VERSION || \"1.0.0\",\n build_number: process.env.BUILD_NUMBER,\n package_name: window.location.hostname,\n },\n device: {\n platform: \"web\",\n platform_version: navigator.appVersion,\n model: ua,\n manufacturer: \"browser\",\n brand: navigator.vendor || \"unknown\",\n\n // Android placeholders\n android_sdk: undefined,\n android_release: undefined,\n hardware: undefined,\n product: undefined,\n\n // iOS placeholders\n system_name: undefined,\n\n // `cpu_abi` / `low_ram` are native-only (§3.3's `N`) — a browser exposes\n // neither, and a fabricated value is worse than an absent key.\n ...viewport,\n },\n };\n }\n\n async start(telemetry: Telemetry): Promise<void> {\n // context-only adapter — collect() feeds the Context block on every event;\n // no standalone device_info event (ADR-0002)\n this.telemetry = telemetry;\n }\n}\n"],"names":["DeviceInfoTrackerWeb","ua","dpr","viewport","viewportKeys","telemetry"],"mappings":"2HAIO,MAAMA,CAAqB,CAI9B,aAAc,CACd,CAEA,MAAM,SAA+B,CACjC,MAAMC,EAAK,UAAU,UAMfC,EAAM,OAAO,kBAAqB,SAAW,iBAAmB,EAChEC,EAAWC,eAAa,OAAO,YAAc,EAAG,OAAO,aAAe,EAAGF,CAAG,EAElF,MAAO,CACH,IAAK,CACD,KAAM,SAAS,OAAS,SACxB,QAAS,QAAQ,IAAI,aAAe,QACpC,aAAc,QAAQ,IAAI,aAC1B,aAAc,OAAO,SAAS,QAAA,EAElC,OAAQ,CACJ,SAAU,MACV,iBAAkB,UAAU,WAC5B,MAAOD,EACP,aAAc,UACd,MAAO,UAAU,QAAU,UAG3B,YAAa,OACb,gBAAiB,OACjB,SAAU,OACV,QAAS,OAGT,YAAa,OAIb,GAAGE,CAAA,CACP,CAER,CAEA,MAAM,MAAME,EAAqC,CAG7C,KAAK,UAAYA,CACrB,CACJ"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { AccessibilityInfo as l, PixelRatio as d } from "react-native";
|
|
2
|
+
import u from "react-native-device-info";
|
|
3
|
+
import { d as f } from "./react-urNtDGTL.js";
|
|
4
|
+
function b(t, e, i) {
|
|
5
|
+
const r = {};
|
|
6
|
+
return typeof t == "number" && Number.isFinite(t) && t >= 0 && t <= 1 && (r["device.battery_level"] = Math.round(t * 100)), typeof e == "boolean" && (r["device.battery_charging"] = e), typeof i == "boolean" && (r["device.power_save"] = i), r;
|
|
7
|
+
}
|
|
8
|
+
async function o(t, e) {
|
|
9
|
+
try {
|
|
10
|
+
const i = await t();
|
|
11
|
+
return e(i) ? i : void 0;
|
|
12
|
+
} catch {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
const a = (t) => typeof t == "boolean", s = (t) => typeof t == "number" && Number.isFinite(t), h = 6e4;
|
|
17
|
+
class p {
|
|
18
|
+
constructor() {
|
|
19
|
+
this.cached = {}, this.timer = null;
|
|
20
|
+
}
|
|
21
|
+
battery() {
|
|
22
|
+
return this.cached;
|
|
23
|
+
}
|
|
24
|
+
async refresh() {
|
|
25
|
+
const e = u, [i, r, n] = await Promise.all([
|
|
26
|
+
o(() => e?.getBatteryLevel?.(), s),
|
|
27
|
+
o(() => e?.isBatteryCharging?.(), a),
|
|
28
|
+
o(() => e?.getPowerState?.(), (c) => typeof c == "object" && c !== null)
|
|
29
|
+
]);
|
|
30
|
+
this.cached = b(i, r, n?.lowPowerMode);
|
|
31
|
+
}
|
|
32
|
+
start() {
|
|
33
|
+
if (this.timer !== null) return;
|
|
34
|
+
const e = () => {
|
|
35
|
+
this.refresh().catch((i) => f.warn("battery refresh failed:", i));
|
|
36
|
+
};
|
|
37
|
+
e(), this.timer = setInterval(e, h);
|
|
38
|
+
}
|
|
39
|
+
stop() {
|
|
40
|
+
this.timer !== null && clearInterval(this.timer), this.timer = null;
|
|
41
|
+
}
|
|
42
|
+
async accessibility() {
|
|
43
|
+
const e = l, [i, r, n] = await Promise.all([
|
|
44
|
+
o(() => e?.isScreenReaderEnabled?.(), a),
|
|
45
|
+
o(() => e?.isReduceMotionEnabled?.(), a),
|
|
46
|
+
o(() => d?.getFontScale?.(), s)
|
|
47
|
+
]);
|
|
48
|
+
return {
|
|
49
|
+
...i === void 0 ? {} : { "device.screen_reader": i },
|
|
50
|
+
...r === void 0 ? {} : { "device.reduce_motion": r },
|
|
51
|
+
...n === void 0 ? {} : { "device.font_scale": n }
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
export {
|
|
56
|
+
p as DeviceStateNative
|
|
57
|
+
};
|
|
58
|
+
//# sourceMappingURL=deviceState.native-BEysbZ6O.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deviceState.native-BEysbZ6O.js","sources":["../src/adapters/deviceState.ts","../src/adapters/native/deviceState.native.ts"],"sourcesContent":["// #173's device state (decision #149) — the pure half, shared by both builds: what counts as a\n// real reading. Each build's adapter only does the platform reads.\n\n/** A failure row's battery keys, or none. `-1` (simulator), non-finite or out of range → omitted. */\nexport function batteryAttributes(level: unknown, charging: unknown, powerSave: unknown): Record<string, number | boolean> {\n const out: Record<string, number | boolean> = {};\n if (typeof level === \"number\" && Number.isFinite(level) && level >= 0 && level <= 1) {\n out[\"device.battery_level\"] = Math.round(level * 100);\n }\n if (typeof charging === \"boolean\") out[\"device.battery_charging\"] = charging;\n if (typeof powerSave === \"boolean\") out[\"device.power_save\"] = powerSave;\n return out;\n}\n\n/**\n * One read, settled to a value or `undefined` — a throw, a rejection, a missing method or a\n * non-boolean/non-finite answer all omit that one key, never the others.\n */\nexport async function readOr<T>(read: () => T | Promise<T>, valid: (v: unknown) => boolean): Promise<T | undefined> {\n try {\n const v = await read();\n return valid(v) ? v : undefined;\n } catch {\n return undefined;\n }\n}\n\nexport const isBool = (v: unknown) => typeof v === \"boolean\";\nexport const isFiniteNumber = (v: unknown) => typeof v === \"number\" && Number.isFinite(v);\n","import { AccessibilityInfo, PixelRatio } from \"react-native\";\nimport DeviceInfoLib from \"react-native-device-info\";\nimport { debug } from \"../../core/debug\";\nimport type { DeviceStateHandler } from \"../../core/telemetry\";\nimport { batteryAttributes, isBool, isFiniteNumber, readOr } from \"../deviceState\";\n\n/** Refresh cadence of the cached battery read (#173). Internal. */\nconst BATTERY_REFRESH_MS = 60000;\n\n/**\n * #173, native. Battery is a **cached** read — refreshed at start, on foreground and every 60 s —\n * so a failure row never awaits a native call. `react-native-device-info` is an optional peer and\n * an older one lacks these methods, so every read is optional-chained and guarded.\n */\nexport class DeviceStateNative implements DeviceStateHandler {\n private cached: Record<string, number | boolean> = {};\n private timer: ReturnType<typeof setInterval> | null = null;\n\n battery(): Record<string, number | boolean> {\n return this.cached;\n }\n\n async refresh(): Promise<void> {\n const lib = DeviceInfoLib as any;\n const [level, charging, power] = await Promise.all([\n readOr(() => lib?.getBatteryLevel?.(), isFiniteNumber),\n readOr(() => lib?.isBatteryCharging?.(), isBool),\n readOr(() => lib?.getPowerState?.(), (v) => typeof v === \"object\" && v !== null),\n ]);\n this.cached = batteryAttributes(level, charging, (power as any)?.lowPowerMode);\n }\n\n start(): void {\n if (this.timer !== null) return;\n const refresh = () => { this.refresh().catch((err) => debug.warn(\"battery refresh failed:\", err)); };\n refresh();\n this.timer = setInterval(refresh, BATTERY_REFRESH_MS);\n }\n\n stop(): void {\n if (this.timer !== null) clearInterval(this.timer);\n this.timer = null;\n }\n\n async accessibility(): Promise<Record<string, number | boolean>> {\n const a11y = AccessibilityInfo as any;\n const [screenReader, reduceMotion, fontScale] = await Promise.all([\n readOr(() => a11y?.isScreenReaderEnabled?.(), isBool),\n readOr(() => a11y?.isReduceMotionEnabled?.(), isBool),\n readOr(() => (PixelRatio as any)?.getFontScale?.(), isFiniteNumber),\n ]);\n return {\n ...(screenReader === undefined ? {} : { \"device.screen_reader\": screenReader as boolean }),\n ...(reduceMotion === undefined ? {} : { \"device.reduce_motion\": reduceMotion as boolean }),\n ...(fontScale === undefined ? {} : { \"device.font_scale\": fontScale as number }),\n };\n }\n}\n"],"names":["batteryAttributes","level","charging","powerSave","out","readOr","read","valid","v","isBool","isFiniteNumber","BATTERY_REFRESH_MS","DeviceStateNative","lib","DeviceInfoLib","power","refresh","err","debug","a11y","AccessibilityInfo","screenReader","reduceMotion","fontScale","PixelRatio"],"mappings":";;;AAIO,SAASA,EAAkBC,GAAgBC,GAAmBC,GAAsD;AACvH,QAAMC,IAAwC,CAAA;AAC9C,SAAI,OAAOH,KAAU,YAAY,OAAO,SAASA,CAAK,KAAKA,KAAS,KAAKA,KAAS,MAC9EG,EAAI,sBAAsB,IAAI,KAAK,MAAMH,IAAQ,GAAG,IAEpD,OAAOC,KAAa,cAAWE,EAAI,yBAAyB,IAAIF,IAChE,OAAOC,KAAc,cAAWC,EAAI,mBAAmB,IAAID,IACxDC;AACX;A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,MAAM,QAAQ,IAAI;AAAA,MAC9DlB,EAAO,MAAMc,GAAM,wBAAA,GAA2BV,CAAM;AAAA,MACpDJ,EAAO,MAAMc,GAAM,wBAAA,GAA2BV,CAAM;AAAA,MACpDJ,EAAO,MAAOmB,GAAoB,eAAA,GAAkBd,CAAc;AAAA,IAAA,CACrE;AACD,WAAO;AAAA,MACH,GAAIW,MAAiB,SAAY,CAAA,IAAK,EAAE,wBAAwBA,EAAA;AAAA,MAChE,GAAIC,MAAiB,SAAY,CAAA,IAAK,EAAE,wBAAwBA,EAAA;AAAA,MAChE,GAAIC,MAAc,SAAY,KAAK,EAAE,qBAAqBA,EAAA;AAAA,IAAoB;AAAA,EAEtF;AACJ;"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react-native"),u=require("react-native-device-info"),d=require("./react-bqe7KPOf.cjs");function b(t,e,i){const r={};return typeof t=="number"&&Number.isFinite(t)&&t>=0&&t<=1&&(r["device.battery_level"]=Math.round(t*100)),typeof e=="boolean"&&(r["device.battery_charging"]=e),typeof i=="boolean"&&(r["device.power_save"]=i),r}async function o(t,e){try{const i=await t();return e(i)?i:void 0}catch{return}}const c=t=>typeof t=="boolean",l=t=>typeof t=="number"&&Number.isFinite(t),f=6e4;class h{constructor(){this.cached={},this.timer=null}battery(){return this.cached}async refresh(){const e=u,[i,r,n]=await Promise.all([o(()=>e?.getBatteryLevel?.(),l),o(()=>e?.isBatteryCharging?.(),c),o(()=>e?.getPowerState?.(),a=>typeof a=="object"&&a!==null)]);this.cached=b(i,r,n?.lowPowerMode)}start(){if(this.timer!==null)return;const e=()=>{this.refresh().catch(i=>d.debug.warn("battery refresh failed:",i))};e(),this.timer=setInterval(e,f)}stop(){this.timer!==null&&clearInterval(this.timer),this.timer=null}async accessibility(){const e=s.AccessibilityInfo,[i,r,n]=await Promise.all([o(()=>e?.isScreenReaderEnabled?.(),c),o(()=>e?.isReduceMotionEnabled?.(),c),o(()=>s.PixelRatio?.getFontScale?.(),l)]);return{...i===void 0?{}:{"device.screen_reader":i},...r===void 0?{}:{"device.reduce_motion":r},...n===void 0?{}:{"device.font_scale":n}}}}exports.DeviceStateNative=h;
|
|
2
|
+
//# sourceMappingURL=deviceState.native-CrQMy11_.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deviceState.native-CrQMy11_.cjs","sources":["../src/adapters/deviceState.ts","../src/adapters/native/deviceState.native.ts"],"sourcesContent":["// #173's device state (decision #149) — the pure half, shared by both builds: what counts as a\n// real reading. Each build's adapter only does the platform reads.\n\n/** A failure row's battery keys, or none. `-1` (simulator), non-finite or out of range → omitted. */\nexport function batteryAttributes(level: unknown, charging: unknown, powerSave: unknown): Record<string, number | boolean> {\n const out: Record<string, number | boolean> = {};\n if (typeof level === \"number\" && Number.isFinite(level) && level >= 0 && level <= 1) {\n out[\"device.battery_level\"] = Math.round(level * 100);\n }\n if (typeof charging === \"boolean\") out[\"device.battery_charging\"] = charging;\n if (typeof powerSave === \"boolean\") out[\"device.power_save\"] = powerSave;\n return out;\n}\n\n/**\n * One read, settled to a value or `undefined` — a throw, a rejection, a missing method or a\n * non-boolean/non-finite answer all omit that one key, never the others.\n */\nexport async function readOr<T>(read: () => T | Promise<T>, valid: (v: unknown) => boolean): Promise<T | undefined> {\n try {\n const v = await read();\n return valid(v) ? v : undefined;\n } catch {\n return undefined;\n }\n}\n\nexport const isBool = (v: unknown) => typeof v === \"boolean\";\nexport const isFiniteNumber = (v: unknown) => typeof v === \"number\" && Number.isFinite(v);\n","import { AccessibilityInfo, PixelRatio } from \"react-native\";\nimport DeviceInfoLib from \"react-native-device-info\";\nimport { debug } from \"../../core/debug\";\nimport type { DeviceStateHandler } from \"../../core/telemetry\";\nimport { batteryAttributes, isBool, isFiniteNumber, readOr } from \"../deviceState\";\n\n/** Refresh cadence of the cached battery read (#173). Internal. */\nconst BATTERY_REFRESH_MS = 60000;\n\n/**\n * #173, native. Battery is a **cached** read — refreshed at start, on foreground and every 60 s —\n * so a failure row never awaits a native call. `react-native-device-info` is an optional peer and\n * an older one lacks these methods, so every read is optional-chained and guarded.\n */\nexport class DeviceStateNative implements DeviceStateHandler {\n private cached: Record<string, number | boolean> = {};\n private timer: ReturnType<typeof setInterval> | null = null;\n\n battery(): Record<string, number | boolean> {\n return this.cached;\n }\n\n async refresh(): Promise<void> {\n const lib = DeviceInfoLib as any;\n const [level, charging, power] = await Promise.all([\n readOr(() => lib?.getBatteryLevel?.(), isFiniteNumber),\n readOr(() => lib?.isBatteryCharging?.(), isBool),\n readOr(() => lib?.getPowerState?.(), (v) => typeof v === \"object\" && v !== null),\n ]);\n this.cached = batteryAttributes(level, charging, (power as any)?.lowPowerMode);\n }\n\n start(): void {\n if (this.timer !== null) return;\n const refresh = () => { this.refresh().catch((err) => debug.warn(\"battery refresh failed:\", err)); };\n refresh();\n this.timer = setInterval(refresh, BATTERY_REFRESH_MS);\n }\n\n stop(): void {\n if (this.timer !== null) clearInterval(this.timer);\n this.timer = null;\n }\n\n async accessibility(): Promise<Record<string, number | boolean>> {\n const a11y = AccessibilityInfo as any;\n const [screenReader, reduceMotion, fontScale] = await Promise.all([\n readOr(() => a11y?.isScreenReaderEnabled?.(), isBool),\n readOr(() => a11y?.isReduceMotionEnabled?.(), isBool),\n readOr(() => (PixelRatio as any)?.getFontScale?.(), isFiniteNumber),\n ]);\n return {\n ...(screenReader === undefined ? {} : { \"device.screen_reader\": screenReader as boolean }),\n ...(reduceMotion === undefined ? {} : { \"device.reduce_motion\": reduceMotion as boolean }),\n ...(fontScale === undefined ? {} : { \"device.font_scale\": fontScale as number }),\n };\n }\n}\n"],"names":["batteryAttributes","level","charging","powerSave","out","readOr","read","valid","v","isBool","isFiniteNumber","BATTERY_REFRESH_MS","DeviceStateNative","lib","DeviceInfoLib","power","refresh","err","debug","a11y","AccessibilityInfo","screenReader","reduceMotion","fontScale","PixelRatio"],"mappings":"wLAIO,SA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,CAAkB,CACxD,CAEA,MAAa,CACL,KAAK,QAAU,MAAM,cAAc,KAAK,KAAK,EACjD,KAAK,MAAQ,IACjB,CAEA,MAAM,eAA2D,CAC7D,MAAMQ,EAAOC,EAAAA,kBACP,CAACC,EAAcC,EAAcC,CAAS,EAAI,MAAM,QAAQ,IAAI,CAC9DlB,EAAO,IAAMc,GAAM,wBAAA,EAA2BV,CAAM,EACpDJ,EAAO,IAAMc,GAAM,wBAAA,EAA2BV,CAAM,EACpDJ,EAAO,IAAOmB,EAAAA,YAAoB,eAAA,EAAkBd,CAAc,CAAA,CACrE,EACD,MAAO,CACH,GAAIW,IAAiB,OAAY,CAAA,EAAK,CAAE,uBAAwBA,CAAA,EAChE,GAAIC,IAAiB,OAAY,CAAA,EAAK,CAAE,uBAAwBA,CAAA,EAChE,GAAIC,IAAc,OAAY,GAAK,CAAE,oBAAqBA,CAAA,CAAoB,CAEtF,CACJ"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
class c {
|
|
2
|
+
async accessibility() {
|
|
3
|
+
try {
|
|
4
|
+
const e = typeof matchMedia == "function" ? matchMedia("(prefers-reduced-motion: reduce)") : void 0;
|
|
5
|
+
return typeof e?.matches == "boolean" ? { "device.reduce_motion": e.matches } : {};
|
|
6
|
+
} catch {
|
|
7
|
+
return {};
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
export {
|
|
12
|
+
c as DeviceStateWeb
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=deviceState.web-ByaQm9Ry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deviceState.web-ByaQm9Ry.js","sources":["../src/adapters/web/deviceState.web.ts"],"sourcesContent":["import type { DeviceStateHandler } from \"../../core/telemetry\";\n\n/**\n * #173, web. Only `device.reduce_motion`, via `matchMedia`. No battery — `navigator.getBattery`\n * is Chromium-only, a browser-detection signal wearing a battery label (§5.2's defect) — and no\n * screen reader or font scale: RN-Web answers both with constants, and a fake value is worse\n * than none.\n */\nexport class DeviceStateWeb implements DeviceStateHandler {\n async accessibility(): Promise<Record<string, boolean>> {\n try {\n const mq = typeof matchMedia === \"function\" ? matchMedia(\"(prefers-reduced-motion: reduce)\") : undefined;\n return typeof mq?.matches === \"boolean\" ? { \"device.reduce_motion\": mq.matches } : {};\n } catch {\n return {};\n }\n }\n}\n"],"names":["DeviceStateWeb","mq"],"mappings":"AAQO,MAAMA,EAA6C;AAAA,EACtD,MAAM,gBAAkD;AACpD,QAAI;AACA,YAAMC,IAAK,OAAO,cAAe,aAAa,WAAW,kCAAkC,IAAI;AAC/F,aAAO,OAAOA,GAAI,WAAY,YAAY,EAAE,wBAAwBA,EAAG,QAAA,IAAY,CAAA;AAAA,IACvF,QAAQ;AACJ,aAAO,CAAA;AAAA,IACX;AAAA,EACJ;AACJ;"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});class t{async accessibility(){try{const e=typeof matchMedia=="function"?matchMedia("(prefers-reduced-motion: reduce)"):void 0;return typeof e?.matches=="boolean"?{"device.reduce_motion":e.matches}:{}}catch{return{}}}}exports.DeviceStateWeb=t;
|
|
2
|
+
//# sourceMappingURL=deviceState.web-CSfUgHDU.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deviceState.web-CSfUgHDU.cjs","sources":["../src/adapters/web/deviceState.web.ts"],"sourcesContent":["import type { DeviceStateHandler } from \"../../core/telemetry\";\n\n/**\n * #173, web. Only `device.reduce_motion`, via `matchMedia`. No battery — `navigator.getBattery`\n * is Chromium-only, a browser-detection signal wearing a battery label (§5.2's defect) — and no\n * screen reader or font scale: RN-Web answers both with constants, and a fake value is worse\n * than none.\n */\nexport class DeviceStateWeb implements DeviceStateHandler {\n async accessibility(): Promise<Record<string, boolean>> {\n try {\n const mq = typeof matchMedia === \"function\" ? matchMedia(\"(prefers-reduced-motion: reduce)\") : undefined;\n return typeof mq?.matches === \"boolean\" ? { \"device.reduce_motion\": mq.matches } : {};\n } catch {\n return {};\n }\n }\n}\n"],"names":["DeviceStateWeb","mq"],"mappings":"gFAQO,MAAMA,CAA6C,CACtD,MAAM,eAAkD,CACpD,GAAI,CACA,MAAMC,EAAK,OAAO,YAAe,WAAa,WAAW,kCAAkC,EAAI,OAC/F,OAAO,OAAOA,GAAI,SAAY,UAAY,CAAE,uBAAwBA,EAAG,OAAA,EAAY,CAAA,CACvF,MAAQ,CACJ,MAAO,CAAA,CACX,CACJ,CACJ"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=700,h=[60,90,120];function l(s){const t=s.filter(a=>a>0);if(t.length===0)return 60;const r=1e3/(t[Math.ceil(.05*t.length)-1]??t[0]);return h.reduce((a,o)=>Math.abs(o-r)<Math.abs(a-r)?o:a)}function f(s,t,e){const r=[...s].sort((i,n)=>i-n),a=l(r),o=1e3/a;return{"frame.total_frames":s.length,"frame.slow_frames":s.filter(i=>i>o*2).length,"frame.frozen_frames":s.filter(i=>i>=m).length,"frame.max_total_duration_ms":r[r.length-1],"frame.p95_ms":r[Math.ceil(.95*r.length)-1],"display.refresh_rate":a,"frame.window_duration_ms":Math.round(Math.max(0,t)),"frame.source":e}}class c{constructor(t,e=1e4){this.telemetry=t,this.windowMs=e,this.lastFrameTime=performance.now(),this.windowStart=this.lastFrameTime,this.deltas=[],this.started=!1}start(){if(this.started)return Promise.resolve();this.started=!0,this.telemetry.views.onBoundary(()=>this.emitWindow(performance.now()));const t=()=>{const e=performance.now();this.deltas.push(e-this.lastFrameTime),this.lastFrameTime=e,e-this.windowStart>=this.windowMs&&this.emitWindow(e),requestAnimationFrame(t)};return requestAnimationFrame(t),Promise.resolve()}async emitWindow(t){const e=t-this.windowStart;if(this.windowStart=t,this.deltas.length===0)return;const r=f(this.deltas,e,"requestAnimationFrame");this.deltas=[],await this.telemetry.log("frame.summary",r)}}exports.FrameDropTracker=c;
|
|
2
|
+
//# sourceMappingURL=frameTracker-9j0en6Zm.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"frameTracker-9j0en6Zm.cjs","sources":["../src/adapters/frameAggregate.ts","../src/adapters/frameTracker.ts"],"sourcesContent":["// Aggregate a window of frame deltas (ms) into one `frame.summary` window (§5.1, #179 — catalogue\n// frames_memory.yaml). Shared by both builds so the percentile math and the refresh-rate\n// measurement live once. The SDK classifies; analytics only sums.\n\n/** A frame at or over this is frozen (catalogue #33), whatever the refresh rate. */\nconst FROZEN_MS = 700;\n\nexport type FrameWindow = {\n \"frame.total_frames\": number;\n \"frame.slow_frames\": number; // frames slower than 2x the measured budget\n \"frame.frozen_frames\": number; // >= 700 ms\n \"frame.max_total_duration_ms\": number;\n \"frame.p95_ms\": number; // bag only\n \"display.refresh_rate\": number;\n \"frame.window_duration_ms\": number;\n \"frame.source\": string;\n};\n\n/**\n * §5.1 fixes the domain at three values. A 144 Hz panel therefore snaps to 120 — the\n * point of the key is the dropped-frame budget, not a display census.\n */\nconst REFRESH_RATES = [60, 90, 120];\n\n/**\n * The refresh rate, **measured** rather than assumed (§5.1). rAF cannot fire faster than the\n * display, so the floor of the window's deltas *is* the refresh interval — no new platform\n * API is involved.\n *\n * ⚠ The floor is the **5th percentile, not the minimum**. A single spurious short delta — a\n * double-dispatched callback, a clock adjustment — would snap a 60 Hz device to 120 and double\n * its `frame.dropped_count`, reintroducing the wrong-budget defect this key exists to fix. A\n * real 120 Hz display produces short deltas by the hundred, so p5 finds them and one artefact\n * cannot. Snapping to the three-value domain absorbs whatever jitter is left.\n *\n * ponytail: a window with no positive delta falls back to 60, which is also v3's constant.\n */\nfunction measureTargetFps(sorted: number[]): number {\n const positive = sorted.filter((d) => d > 0);\n if (positive.length === 0) return 60;\n const floor = positive[Math.ceil(0.05 * positive.length) - 1] ?? positive[0];\n const fps = 1000 / floor;\n return REFRESH_RATES.reduce((a, b) => (Math.abs(b - fps) < Math.abs(a - fps) ? b : a));\n}\n\n/**\n * `deltas` must be non-empty. Percentile is nearest-rank on the sorted deltas.\n * `windowMs` is the *actual* elapsed window — variable-length since §5.1's view-boundary\n * reset, which is exactly why `frame.window_duration_ms` rides every window.\n *\n * A rAF delta is a vsync interval, quantized to the budget: \"slow\" is a missed vsync, read as\n * over twice the budget so jitter around one interval never counts.\n */\nexport function aggregateFrames(deltas: number[], windowMs: number, source: string): FrameWindow {\n const sorted = [...deltas].sort((a, b) => a - b);\n const targetFps = measureTargetFps(sorted);\n const budget = 1000 / targetFps;\n return {\n \"frame.total_frames\": deltas.length,\n \"frame.slow_frames\": deltas.filter((d) => d > budget * 2).length,\n \"frame.frozen_frames\": deltas.filter((d) => d >= FROZEN_MS).length,\n \"frame.max_total_duration_ms\": sorted[sorted.length - 1],\n \"frame.p95_ms\": sorted[Math.ceil(0.95 * sorted.length) - 1],\n \"display.refresh_rate\": targetFps,\n \"frame.window_duration_ms\": Math.round(Math.max(0, windowMs)),\n \"frame.source\": source,\n };\n}\n","// The rAF sampling loop behind `frame.summary` (§5.1, #179), shared by both builds: rAF and\n// `performance.now()` are globals RN polyfills and the browser ships, so there is nothing\n// platform-specific left to split. Web and native therefore cannot drift on window length,\n// on the refresh-rate measurement or on the boundary reset.\n\nimport { aggregateFrames } from \"./frameAggregate\";\n\n/**\n * All this tracker needs of core. Structural, so it is testable without a `Telemetry`.\n */\ntype FrameEmitter = {\n log(name: string, data?: Record<string, any>): unknown;\n views: { onBoundary(fn: () => unknown): () => void };\n};\n\nexport class FrameDropTracker {\n private lastFrameTime = performance.now();\n private windowStart = this.lastFrameTime;\n private deltas: number[] = [];\n private started = false;\n\n constructor(private telemetry: FrameEmitter, private windowMs = 10000) { }\n\n /** Idempotent in full: a second call must not start a second rAF loop double-counting frames. */\n start(): Promise<void> {\n if (this.started) return Promise.resolve();\n this.started = true;\n this.telemetry.views.onBoundary(() => this.emitWindow(performance.now()));\n\n const loop = () => {\n const now = performance.now();\n this.deltas.push(now - this.lastFrameTime);\n this.lastFrameTime = now;\n // ponytail: first window includes the startup delta; acceptable noise, not worth gating.\n if (now - this.windowStart >= this.windowMs) void this.emitWindow(now);\n requestAnimationFrame(loop);\n };\n\n requestAnimationFrame(loop);\n return Promise.resolve();\n }\n\n /**\n * Close the open window and ship it. `ViewManager` **awaits** this at a boundary and\n * before the successor mints, which is what lands a route change's dropped frames on the\n * departing `view.id` rather than the arriving one (§5.1).\n *\n * An empty window emits nothing — a p95 over no samples is not a number — but it still\n * resets the clock, so `frame.window_duration_ms` always describes the samples it carries.\n */\n private async emitWindow(now: number): Promise<void> {\n const elapsed = now - this.windowStart;\n this.windowStart = now;\n if (this.deltas.length === 0) return;\n\n const window = aggregateFrames(this.deltas, elapsed, \"requestAnimationFrame\");\n this.deltas = [];\n await this.telemetry.log(\"frame.summary\", window);\n }\n}\n"],"names":["FROZEN_MS","REFRESH_RATES","measureTargetFps","sorted","positive","d","fps","b","aggregateFrames","deltas","windowMs","source","a","targetFps","budget","FrameDropTracker","telemetry","loop","now","elapsed","window"],"mappings":"gFAKA,MAAMA,EAAY,IAiBZC,EAAgB,CAAC,GAAI,GAAI,GAAG,EAelC,SAASC,EAAiBC,EAA0B,CAChD,MAAMC,EAAWD,EAAO,OAAQE,GAAMA,EAAI,CAAC,EAC3C,GAAID,EAAS,SAAW,EAAG,MAAO,IAElC,MAAME,EAAM,KADEF,EAAS,KAAK,KAAK,IAAOA,EAAS,MAAM,EAAI,CAAC,GAAKA,EAAS,CAAC,GAE3E,OAAOH,EAAc,OAAO,CAAC,EAAGM,IAAO,KAAK,IAAIA,EAAID,CAAG,EAAI,KAAK,IAAI,EAAIA,CAAG,EAAIC,EAAI,CAAE,CACzF,CAUO,SAASC,EAAgBC,EAAkBC,EAAkBC,EAA6B,CAC7F,MAAMR,EAAS,CAAC,GAAGM,CAAM,EAAE,KAAK,CAACG,EAAGL,IAAMK,EAAIL,CAAC,EACzCM,EAAYX,EAAiBC,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C,CAAM,CACpD,CACJ"}
|
|
@@ -1,22 +1,21 @@
|
|
|
1
|
-
const
|
|
2
|
-
function
|
|
3
|
-
const t =
|
|
1
|
+
const m = [60, 90, 120];
|
|
2
|
+
function h(s) {
|
|
3
|
+
const t = s.filter((a) => a > 0);
|
|
4
4
|
if (t.length === 0) return 60;
|
|
5
|
-
const
|
|
6
|
-
return
|
|
5
|
+
const r = 1e3 / (t[Math.ceil(0.05 * t.length) - 1] ?? t[0]);
|
|
6
|
+
return m.reduce((a, o) => Math.abs(o - r) < Math.abs(a - r) ? o : a);
|
|
7
7
|
}
|
|
8
|
-
function
|
|
9
|
-
const
|
|
8
|
+
function l(s, t, e) {
|
|
9
|
+
const r = [...s].sort((i, n) => i - n), a = h(r), o = 1e3 / a;
|
|
10
10
|
return {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
11
|
+
"frame.total_frames": s.length,
|
|
12
|
+
"frame.slow_frames": s.filter((i) => i > o * 2).length,
|
|
13
|
+
"frame.frozen_frames": s.filter((i) => i >= 700).length,
|
|
14
|
+
"frame.max_total_duration_ms": r[r.length - 1],
|
|
15
|
+
"frame.p95_ms": r[Math.ceil(0.95 * r.length) - 1],
|
|
16
|
+
"display.refresh_rate": a,
|
|
17
|
+
"frame.window_duration_ms": Math.round(Math.max(0, t)),
|
|
18
|
+
"frame.source": e
|
|
20
19
|
};
|
|
21
20
|
}
|
|
22
21
|
class f {
|
|
@@ -44,11 +43,11 @@ class f {
|
|
|
44
43
|
async emitWindow(t) {
|
|
45
44
|
const e = t - this.windowStart;
|
|
46
45
|
if (this.windowStart = t, this.deltas.length === 0) return;
|
|
47
|
-
const
|
|
48
|
-
this.deltas = [], await this.telemetry.
|
|
46
|
+
const r = l(this.deltas, e, "requestAnimationFrame");
|
|
47
|
+
this.deltas = [], await this.telemetry.log("frame.summary", r);
|
|
49
48
|
}
|
|
50
49
|
}
|
|
51
50
|
export {
|
|
52
51
|
f as FrameDropTracker
|
|
53
52
|
};
|
|
54
|
-
//# sourceMappingURL=frameTracker-
|
|
53
|
+
//# sourceMappingURL=frameTracker-BzXnxSkb.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"frameTracker-BzXnxSkb.js","sources":["../src/adapters/frameAggregate.ts","../src/adapters/frameTracker.ts"],"sourcesContent":["// Aggregate a window of frame deltas (ms) into one `frame.summary` window (§5.1, #179 — catalogue\n// frames_memory.yaml). Shared by both builds so the percentile math and the refresh-rate\n// measurement live once. The SDK classifies; analytics only sums.\n\n/** A frame at or over this is frozen (catalogue #33), whatever the refresh rate. */\nconst FROZEN_MS = 700;\n\nexport type FrameWindow = {\n \"frame.total_frames\": number;\n \"frame.slow_frames\": number; // frames slower than 2x the measured budget\n \"frame.frozen_frames\": number; // >= 700 ms\n \"frame.max_total_duration_ms\": number;\n \"frame.p95_ms\": number; // bag only\n \"display.refresh_rate\": number;\n \"frame.window_duration_ms\": number;\n \"frame.source\": string;\n};\n\n/**\n * §5.1 fixes the domain at three values. A 144 Hz panel therefore snaps to 120 — the\n * point of the key is the dropped-frame budget, not a display census.\n */\nconst REFRESH_RATES = [60, 90, 120];\n\n/**\n * The refresh rate, **measured** rather than assumed (§5.1). rAF cannot fire faster than the\n * display, so the floor of the window's deltas *is* the refresh interval — no new platform\n * API is involved.\n *\n * ⚠ The floor is the **5th percentile, not the minimum**. A single spurious short delta — a\n * double-dispatched callback, a clock adjustment — would snap a 60 Hz device to 120 and double\n * its `frame.dropped_count`, reintroducing the wrong-budget defect this key exists to fix. A\n * real 120 Hz display produces short deltas by the hundred, so p5 finds them and one artefact\n * cannot. Snapping to the three-value domain absorbs whatever jitter is left.\n *\n * ponytail: a window with no positive delta falls back to 60, which is also v3's constant.\n */\nfunction measureTargetFps(sorted: number[]): number {\n const positive = sorted.filter((d) => d > 0);\n if (positive.length === 0) return 60;\n const floor = positive[Math.ceil(0.05 * positive.length) - 1] ?? positive[0];\n const fps = 1000 / floor;\n return REFRESH_RATES.reduce((a, b) => (Math.abs(b - fps) < Math.abs(a - fps) ? b : a));\n}\n\n/**\n * `deltas` must be non-empty. Percentile is nearest-rank on the sorted deltas.\n * `windowMs` is the *actual* elapsed window — variable-length since §5.1's view-boundary\n * reset, which is exactly why `frame.window_duration_ms` rides every window.\n *\n * A rAF delta is a vsync interval, quantized to the budget: \"slow\" is a missed vsync, read as\n * over twice the budget so jitter around one interval never counts.\n */\nexport function aggregateFrames(deltas: number[], windowMs: number, source: string): FrameWindow {\n const sorted = [...deltas].sort((a, b) => a - b);\n const targetFps = measureTargetFps(sorted);\n const budget = 1000 / targetFps;\n return {\n \"frame.total_frames\": deltas.length,\n \"frame.slow_frames\": deltas.filter((d) => d > budget * 2).length,\n \"frame.frozen_frames\": deltas.filter((d) => d >= FROZEN_MS).length,\n \"frame.max_total_duration_ms\": sorted[sorted.length - 1],\n \"frame.p95_ms\": sorted[Math.ceil(0.95 * sorted.length) - 1],\n \"display.refresh_rate\": targetFps,\n \"frame.window_duration_ms\": Math.round(Math.max(0, windowMs)),\n \"frame.source\": source,\n };\n}\n","// The rAF sampling loop behind `frame.summary` (§5.1, #179), shared by both builds: rAF and\n// `performance.now()` are globals RN polyfills and the browser ships, so there is nothing\n// platform-specific left to split. Web and native therefore cannot drift on window length,\n// on the refresh-rate measurement or on the boundary reset.\n\nimport { aggregateFrames } from \"./frameAggregate\";\n\n/**\n * All this tracker needs of core. Structural, so it is testable without a `Telemetry`.\n */\ntype FrameEmitter = {\n log(name: string, data?: Record<string, any>): unknown;\n views: { onBoundary(fn: () => unknown): () => void };\n};\n\nexport class FrameDropTracker {\n private lastFrameTime = performance.now();\n private windowStart = this.lastFrameTime;\n private deltas: number[] = [];\n private started = false;\n\n constructor(private telemetry: FrameEmitter, private windowMs = 10000) { }\n\n /** Idempotent in full: a second call must not start a second rAF loop double-counting frames. */\n start(): Promise<void> {\n if (this.started) return Promise.resolve();\n this.started = true;\n this.telemetry.views.onBoundary(() => this.emitWindow(performance.now()));\n\n const loop = () => {\n const now = performance.now();\n this.deltas.push(now - this.lastFrameTime);\n this.lastFrameTime = now;\n // ponytail: first window includes the startup delta; acceptable noise, not worth gating.\n if (now - this.windowStart >= this.windowMs) void this.emitWindow(now);\n requestAnimationFrame(loop);\n };\n\n requestAnimationFrame(loop);\n return Promise.resolve();\n }\n\n /**\n * Close the open window and ship it. `ViewManager` **awaits** this at a boundary and\n * before the successor mints, which is what lands a route change's dropped frames on the\n * departing `view.id` rather than the arriving one (§5.1).\n *\n * An empty window emits nothing — a p95 over no samples is not a number — but it still\n * resets the clock, so `frame.window_duration_ms` always describes the samples it carries.\n */\n private async emitWindow(now: number): Promise<void> {\n const elapsed = now - this.windowStart;\n this.windowStart = now;\n if (this.deltas.length === 0) return;\n\n const window = aggregateFrames(this.deltas, elapsed, \"requestAnimationFrame\");\n this.deltas = [];\n await this.telemetry.log(\"frame.summary\", window);\n }\n}\n"],"names":["REFRESH_RATES","measureTargetFps","sorted","positive","d","fps","b","aggregateFrames","deltas","windowMs","source","a","targetFps","budget","FrameDropTracker","telemetry","loop","now","elapsed","window"],"mappings":"AAsBA,MAAMA,IAAgB,CAAC,IAAI,IAAI,GAAG;AAelC,SAASC,EAAiBC,GAA0B;AAChD,QAAMC,IAAWD,EAAO,OAAO,CAACE,MAAMA,IAAI,CAAC;AAC3C,MAAID,EAAS,WAAW,EAAG,QAAO;AAElC,QAAME,IAAM,OADEF,EAAS,KAAK,KAAK,OAAOA,EAAS,MAAM,IAAI,CAAC,KAAKA,EAAS,CAAC;AAE3E,SAAOH,EAAc,OAAO,CAAC,GAAGM,MAAO,KAAK,IAAIA,IAAID,CAAG,IAAI,KAAK,IAAI,IAAIA,CAAG,IAAIC,IAAI,CAAE;AACzF;AAUO,SAASC,EAAgBC,GAAkBC,GAAkBC,GAA6B;AAC7F,QAAMR,IAAS,CAAC,GAAGM,CAAM,EAAE,KAAK,CAACG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AA4B;AACjD,UAAMC,IAAUD,IAAM,KAAK;AAE3B,QADA,KAAK,cAAcA,GACf,KAAK,OAAO,WAAW,EAAG;AAE9B,UAAME,IAASZ,EAAgB,KAAK,QAAQW,GAAS,uBAAuB;AAC5E,SAAK,SAAS,CAAA,GACd,MAAM,KAAK,UAAU,IAAI,iBAAiBC,CAAM;AAAA,EACpD;AACJ;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"httpAttributes-
|
|
1
|
+
{"version":3,"file":"httpAttributes-BWXOr4eP.js","sources":["../src/adapters/httpAttributes.ts"],"sourcesContent":["// Shared http.request attribute builder — the single source of truth so the web fetch patch\n// and the shared XHR patch stay in lockstep on the v4 wire contract (§4.4, #95).\n//\n// `http.url` and `http.path` are gone outright (§9.1): the identifier lives in the path, so\n// query-stripping would not have addressed the threat. `http.host` + `http.route` replace them,\n// and the route template is normalized here, SDK-side — nothing raw ever leaves the device.\n\nconst MAX_ROUTE_DEPTH = 6;\n\n// contract §4.4.1, verbatim. This is the decision, not an illustration — do not \"improve\" it.\nfunction isVariable(s: string): boolean {\n if (/^v\\d+$/i.test(s)) return false; // version carve-out: /v2/ survives\n if (/\\d/.test(s)) return true; // any digit\n return s.length >= 32; // opaque all-alpha token / dashless UUID\n}\n\n/**\n * Path → route template. `/` stays `/`, no case folding, trailing slash dropped, depth capped\n * at 6 segments with a trailing `/…`. No cardinality guard: a client-side rolling collapse\n * would make one row mean different things on different phones.\n */\nexport function normalizeRoute(path: string): string {\n const segments = path.split(\"/\").filter((s) => s !== \"\");\n if (segments.length === 0) return \"/\";\n const kept = segments.slice(0, MAX_ROUTE_DEPTH).map((s) => (isVariable(s) ? \"{id}\" : s));\n const route = \"/\" + kept.join(\"/\");\n return segments.length > MAX_ROUTE_DEPTH ? route + \"/…\" : route;\n}\n\n/** UTF-8 byte length. v3 shipped `String.length` — UTF-16 code units, 2-3× short on non-ASCII. */\nexport function utf8Bytes(s: string): number {\n let n = 0;\n for (let i = 0; i < s.length; i++) {\n const c = s.charCodeAt(i);\n if (c < 0x80) n += 1;\n else if (c < 0x800) n += 2;\n else if (c >= 0xd800 && c <= 0xdbff && i + 1 < s.length) {\n const lo = s.charCodeAt(i + 1);\n if (lo >= 0xdc00 && lo <= 0xdfff) { n += 4; i++; } else n += 3; // lone surrogate → U+FFFD\n } else n += 3;\n }\n return n;\n}\n\n/**\n * Body size for every type measurable **without consuming the body**. `FormData` and streams\n * return undefined and the key is omitted — draining a consumer's request body is a far worse\n * bug than a missing key.\n */\nexport function requestBodySize(body: unknown): number | undefined {\n if (typeof body === \"string\") return utf8Bytes(body);\n if (body instanceof ArrayBuffer) return body.byteLength;\n if (ArrayBuffer.isView(body)) return body.byteLength; // TypedArray | DataView\n if (typeof Blob !== \"undefined\" && body instanceof Blob) return body.size;\n if (typeof URLSearchParams !== \"undefined\" && body instanceof URLSearchParams) {\n return utf8Bytes(body.toString()); // serialising a copy, not draining the body\n }\n return undefined;\n}\n\n// host keeps the port, deliberately unlike §6.4's trace gate. §4.4 omits it on a *native*\n// relative URL specifically: a browser resolves `/api/x` against the page, and RN has no\n// `location` to resolve against — a capability check, not a platform branch.\nfunction splitUrl(url: string): { host?: string; path: string } {\n const base = (globalThis as any).location?.href;\n try {\n const u = base ? new URL(url, base) : new URL(url);\n return { host: u.host, path: u.pathname };\n } catch {\n // native relative URL: no host to report, but the path is still routable\n const path = url.split(\"#\")[0].split(\"?\")[0];\n return { path: path.startsWith(\"/\") ? path : \"/\" + path };\n }\n}\n\n/** `content-length` → a response size. Absent or unparseable → undefined, so the key is omitted. */\nexport function contentLengthSize(header: string | null | undefined): number | undefined {\n if (header == null || header === \"\") return undefined;\n const n = Number(header);\n return Number.isFinite(n) ? n : undefined;\n}\n\n/** The #95 invariant, in one place: an `http.request` never describes the collector POST. */\nexport function isCollectorUrl(url: string, endpoint: string | undefined): boolean {\n return !!endpoint && url.startsWith(endpoint);\n}\n\nexport function buildHttpAttributes(args: {\n url: string;\n method: string;\n statusCode: number;\n durationMs: number;\n error?: unknown;\n requestBody?: unknown;\n responseSize?: number;\n}): Record<string, any> {\n const { url, method, statusCode, durationMs, error, requestBody, responseSize } = args;\n const { host, path } = splitUrl(url);\n\n const attrs: Record<string, any> = {\n // uppercased here, reporting-only — the forwarded request is never touched (§9.5).\n // Not defaulted: §9.5 authorises a case change, never inventing a verb. `fetch`'s own\n // GET default is applied by its caller, where it is a real observation.\n \"http.method\": String(method).toUpperCase(),\n \"http.status_code\": statusCode, // 0 = never got a response: DNS/TLS/timeout/abort\n \"http.duration_ms\": durationMs,\n \"http.success\": !error && statusCode >= 200 && statusCode < 400,\n \"http.route\": normalizeRoute(path),\n };\n if (host) attrs[\"http.host\"] = host;\n\n // §4.4's two null disciplines differ on purpose, so do not unify them:\n // request_size is \"omitted when unmeasurable, never 0\"; response_size ships a real 0.\n const reqSize = requestBodySize(requestBody);\n if (reqSize) attrs[\"http.request_size\"] = reqSize;\n if (typeof responseSize === \"number\" && Number.isFinite(responseSize)) {\n attrs[\"http.response_size\"] = responseSize;\n }\n\n return attrs;\n}\n"],"names":["isVariable","s","normalizeRoute","path","segments","route","utf8Bytes","n","i","c","lo","requestBodySize","body","splitUrl","url","base","u","contentLengthSize","header","isCollectorUrl","endpoint","buildHttpAttributes","args","method","statusCode","durationMs","error","requestBody","responseSize","host","attrs","reqSize"],"mappings":"AAUA,SAASA,EAAWC,GAAoB;AACpC,SAAI,UAAU,KAAKA,CAAC,IAAU,KAC1B,KAAK,KAAKA,CAAC,IAAU,KAClBA,EAAE,UAAU;AACvB;AAOO,SAASC,EAAeC,GAAsB;AACjD,QAAMC,IAAWD,EAAK,MAAM,GAAG,EAAE,OAAO,CAACF,MAAMA,MAAM,EAAE;AACvD,MAAIG,EAAS,WAAW,EAAG,QAAO;AAElC,QAAMC,IAAQ,MADDD,EAAS,MAAM,GAAG,CAAe,EAAE,IAAI,CAACH,MAAOD,EAAWC,CAAC,IAAI,SAASA,CAAE,EAC9D,KAAK,GAAG;AACjC,S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ACrC,QAAMX,IAAI,OAAOW,CAAM;AACvB,SAAO,OAAO,SAASX,CAAC,IAAIA,IAAI;AACpC;AAGO,SAASY,EAAeL,GAAaM,GAAuC;AAC/E,SAAO,CAAC,CAACA,KAAYN,EAAI,WAAWM,CAAQ;AAChD;AAEO,SAASC,EAAoBC,GAQZ;AACpB,QAAM,EAAE,KAAAR,GAAK,QAAAS,GAAQ,YAAAC,GAAY,YAAAC,GAAY,OAAAC,GAAO,aAAAC,GAAa,cAAAC,MAAiBN,GAC5E,EAAE,MAAAO,GAAM,MAAA1B,MAASU,EAASC,CAAG,GAE7BgB,IAA6B;AAAA;AAAA;AAAA;AAAA,IAI/B,eAAe,OAAOP,CAAM,EAAE,YAAA;AAAA,IAC9B,oBAAoBC;AAAA;AAAA,IACpB,oBAAoBC;AAAA,IACpB,gBAAgB,CAACC,KAASF,KAAc,OAAOA,IAAa;AAAA,IAC5D,cAActB,EAAeC,CAAI;AAAA,EAAA;AAErC,EAAI0B,MAAMC,EAAM,WAAW,IAAID;AAI/B,QAAME,IAAUpB,EAAgBgB,CAAW;AAC3C,SAAII,MAASD,EAAM,mBAAmB,IAAIC,IACtC,OAAOH,KAAiB,YAAY,OAAO,SAASA,CAAY,MAChEE,EAAM,oBAAoB,IAAIF,IAG3BE;AACX;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use strict";function g(t){return/^v\d+$/i.test(t)?!1:/\d/.test(t)?!0:t.length>=32}function l(t){const e=t.split("/").filter(i=>i!=="");if(e.length===0)return"/";const r="/"+e.slice(0,6).map(i=>g(i)?"{id}":i).join("/");return e.length>6?r+"/…":r}function f(t){let e=0;for(let n=0;n<t.length;n++){const r=t.charCodeAt(n);if(r<128)e+=1;else if(r<2048)e+=2;else if(r>=55296&&r<=56319&&n+1<t.length){const i=t.charCodeAt(n+1);i>=56320&&i<=57343?(e+=4,n++):e+=3}else e+=3}return e}function m(t){if(typeof t=="string")return f(t);if(t instanceof ArrayBuffer||ArrayBuffer.isView(t))return t.byteLength;if(typeof Blob<"u"&&t instanceof Blob)return t.size;if(typeof URLSearchParams<"u"&&t instanceof URLSearchParams)return f(t.toString())}function U(t){const e=globalThis.location?.href;try{const n=e?new URL(t,e):new URL(t);return{host:n.host,path:n.pathname}}catch{const n=t.split("#")[0].split("?")[0];return{path:n.startsWith("/")?n:"/"+n}}}function d(t){if(t==null||t==="")return;const e=Number(t);return Number.isFinite(e)?e:void 0}function z(t,e){return!!e&&t.startsWith(e)}function _(t){const{url:e,method:n,statusCode:r,durationMs:i,error:a,requestBody:h,responseSize:o}=t,{host:u,path:p}=U(e),s={"http.method":String(n).toUpperCase(),"http.status_code":r,"http.duration_ms":i,"http.success":!a&&r>=200&&r<400,"http.route":l(p)};u&&(s["http.host"]=u);const c=m(h);return c&&(s["http.request_size"]=c),typeof o=="number"&&Number.isFinite(o)&&(s["http.response_size"]=o),s}exports.buildHttpAttributes=_;exports.contentLengthSize=d;exports.isCollectorUrl=z;exports.normalizeRoute=l;
|
|
2
|
-
//# sourceMappingURL=httpAttributes-
|
|
2
|
+
//# sourceMappingURL=httpAttributes-COY0_kiF.cjs.map
|