@buoy-gg/network 7.0.40 → 7.0.42
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/README.md +11 -79
- package/lib/commonjs/index.js +1 -325
- package/lib/commonjs/index.web.js +1 -420
- package/lib/commonjs/network/components/DataViewer.web.js +1 -879
- package/lib/commonjs/network/components/NetworkCopyScreen.web.js +1 -48
- package/lib/commonjs/network/components/NetworkCopySettingsView.js +27 -755
- package/lib/commonjs/network/components/NetworkCopySettingsView.web.js +14 -1242
- package/lib/commonjs/network/components/NetworkDetailScreen.web.js +1 -101
- package/lib/commonjs/network/components/NetworkDetailStepper.js +1 -108
- package/lib/commonjs/network/components/NetworkDetailStepper.web.js +1 -298
- package/lib/commonjs/network/components/NetworkEventDetailView.js +15 -1130
- package/lib/commonjs/network/components/NetworkEventDetailView.web.js +15 -1484
- package/lib/commonjs/network/components/NetworkEventItemCompact.js +2 -401
- package/lib/commonjs/network/components/NetworkEventItemCompact.web.js +2 -820
- package/lib/commonjs/network/components/NetworkFilterScreen.web.js +1 -55
- package/lib/commonjs/network/components/NetworkFilterViewV3.js +1 -442
- package/lib/commonjs/network/components/NetworkFilterViewV3.web.js +1 -1310
- package/lib/commonjs/network/components/NetworkHeaderLive.js +1 -375
- package/lib/commonjs/network/components/NetworkHeaderLive.web.js +1 -623
- package/lib/commonjs/network/components/NetworkHeaderMenu.js +1 -190
- package/lib/commonjs/network/components/NetworkListScreen.js +1 -404
- package/lib/commonjs/network/components/NetworkListScreen.web.js +1 -625
- package/lib/commonjs/network/components/NetworkModal.js +1 -786
- package/lib/commonjs/network/components/NetworkNumberPrompt.js +1 -178
- package/lib/commonjs/network/components/NetworkNumberPrompt.web.js +1 -232
- package/lib/commonjs/network/components/NetworkOverrideEditor.js +1 -814
- package/lib/commonjs/network/components/NetworkOverrideEditor.web.js +1 -942
- package/lib/commonjs/network/components/NetworkOverrideHeaderButton.js +1 -107
- package/lib/commonjs/network/components/NetworkOverrideHeaderButton.web.js +1 -133
- package/lib/commonjs/network/components/NetworkOverridesButton.js +1 -90
- package/lib/commonjs/network/components/NetworkOverridesButton.web.js +1 -143
- package/lib/commonjs/network/components/NetworkOverridesScreen.js +1 -543
- package/lib/commonjs/network/components/NetworkOverridesScreen.web.js +1 -830
- package/lib/commonjs/network/components/NetworkSavedScreen.js +1 -226
- package/lib/commonjs/network/components/NetworkSavedScreen.web.js +1 -463
- package/lib/commonjs/network/components/NetworkUpgradeBanner.js +1 -76
- package/lib/commonjs/network/components/response-editor/Explorer.js +1 -973
- package/lib/commonjs/network/components/response-editor/Explorer.web.js +1 -1136
- package/lib/commonjs/network/components/response-editor/deleteNestedDataByPath.js +1 -56
- package/lib/commonjs/network/components/response-editor/editorContext.js +1 -33
- package/lib/commonjs/network/components/response-editor/updateNestedDataByPath.js +1 -61
- package/lib/commonjs/network/conditions/NetworkConditionsControl.js +1 -235
- package/lib/commonjs/network/conditions/NetworkConditionsControl.test.js +1 -136
- package/lib/commonjs/network/conditions/NetworkConditionsIcon.js +1 -33
- package/lib/commonjs/network/conditions/NetworkFloatingTool.js +1 -310
- package/lib/commonjs/network/conditions/NetworkFloatingTool.test.js +1 -219
- package/lib/commonjs/network/conditions/store.js +1 -75
- package/lib/commonjs/network/conditions/wait.js +1 -43
- package/lib/commonjs/network/conditions/xhr.js +1 -110
- package/lib/commonjs/network/hooks/useLiveNetworkEvent.js +1 -62
- package/lib/commonjs/network/hooks/useNetworkBadgeCounts.js +1 -83
- package/lib/commonjs/network/hooks/useNetworkEventList.js +1 -108
- package/lib/commonjs/network/hooks/useNetworkEvents.js +1 -318
- package/lib/commonjs/network/hooks/useNetworkHasMatches.js +1 -56
- package/lib/commonjs/network/hooks/useNetworkSaved.js +1 -38
- package/lib/commonjs/network/hooks/useNetworkSelection.js +1 -53
- package/lib/commonjs/network/hooks/useOverrideRules.js +1 -36
- package/lib/commonjs/network/hooks/useTickEveryMinute.js +1 -21
- package/lib/commonjs/network/overrides/applyToFetch.js +1 -80
- package/lib/commonjs/network/overrides/applyToXhr.js +2 -453
- package/lib/commonjs/network/overrides/engine.js +1 -93
- package/lib/commonjs/network/overrides/matchRule.js +1 -81
- package/lib/commonjs/network/overrides/overriddenRows.js +1 -0
- package/lib/commonjs/network/overrides/overrideRulesStore.js +1 -550
- package/lib/commonjs/network/overrides/presets.js +1 -70
- package/lib/commonjs/network/overrides/resolveOverride.js +1 -158
- package/lib/commonjs/network/overrides/types.js +1 -90
- package/lib/commonjs/network/sync/networkBodyResolver.js +1 -39
- package/lib/commonjs/network/sync/networkSyncAdapter.js +1 -882
- package/lib/commonjs/network/sync/overrideHonesty.release.test.js +1 -36
- package/lib/commonjs/network/types/index.js +1 -5
- package/lib/commonjs/network/utils/extractOperationName.js +1 -80
- package/lib/commonjs/network/utils/filterNetworkEvents.js +1 -96
- package/lib/commonjs/network/utils/formatGraphQLVariables.js +1 -219
- package/lib/commonjs/network/utils/formatting.js +1 -30
- package/lib/commonjs/network/utils/generateCurl.js +2 -71
- package/lib/commonjs/network/utils/generateNetworkCopyText.js +37 -166
- package/lib/commonjs/network/utils/httpCompletion.js +1 -37
- package/lib/commonjs/network/utils/networkEventStore.js +1 -393
- package/lib/commonjs/network/utils/networkListener.js +4 -1259
- package/lib/commonjs/network/utils/networkSavedStore.js +3 -577
- package/lib/commonjs/network/utils/networkSelectionStore.js +1 -193
- package/lib/commonjs/network/utils/realNow.js +1 -0
- package/lib/commonjs/network/utils/requestId.js +1 -0
- package/lib/commonjs/network/utils/resolveRequestUrl.js +1 -0
- package/lib/commonjs/network/utils/selectSavedEvents.js +1 -39
- package/lib/commonjs/network/utils/startNetworkCapture.js +1 -0
- package/lib/commonjs/network/utils/withPinnedFirst.js +1 -32
- package/lib/commonjs/preset.js +1 -102
- package/lib/module/index.js +1 -103
- package/lib/module/index.web.js +1 -82
- package/lib/module/network/components/DataViewer.web.js +1 -875
- package/lib/module/network/components/NetworkCopyScreen.web.js +1 -44
- package/lib/module/network/components/NetworkCopySettingsView.js +27 -750
- package/lib/module/network/components/NetworkCopySettingsView.web.js +14 -1237
- package/lib/module/network/components/NetworkDetailScreen.web.js +1 -97
- package/lib/module/network/components/NetworkDetailStepper.js +1 -104
- package/lib/module/network/components/NetworkDetailStepper.web.js +1 -296
- package/lib/module/network/components/NetworkEventDetailView.js +15 -1129
- package/lib/module/network/components/NetworkEventDetailView.web.js +15 -1482
- package/lib/module/network/components/NetworkEventItemCompact.js +2 -398
- package/lib/module/network/components/NetworkEventItemCompact.web.js +2 -818
- package/lib/module/network/components/NetworkFilterScreen.web.js +1 -51
- package/lib/module/network/components/NetworkFilterViewV3.js +1 -438
- package/lib/module/network/components/NetworkFilterViewV3.web.js +1 -1306
- package/lib/module/network/components/NetworkHeaderLive.js +1 -366
- package/lib/module/network/components/NetworkHeaderLive.web.js +1 -617
- package/lib/module/network/components/NetworkHeaderMenu.js +1 -184
- package/lib/module/network/components/NetworkListScreen.js +1 -400
- package/lib/module/network/components/NetworkListScreen.web.js +1 -623
- package/lib/module/network/components/NetworkModal.js +1 -781
- package/lib/module/network/components/NetworkNumberPrompt.js +1 -174
- package/lib/module/network/components/NetworkNumberPrompt.web.js +1 -230
- package/lib/module/network/components/NetworkOverrideEditor.js +1 -811
- package/lib/module/network/components/NetworkOverrideEditor.web.js +1 -939
- package/lib/module/network/components/NetworkOverrideHeaderButton.js +1 -104
- package/lib/module/network/components/NetworkOverrideHeaderButton.web.js +1 -131
- package/lib/module/network/components/NetworkOverridesButton.js +1 -87
- package/lib/module/network/components/NetworkOverridesButton.web.js +1 -141
- package/lib/module/network/components/NetworkOverridesScreen.js +1 -539
- package/lib/module/network/components/NetworkOverridesScreen.web.js +1 -826
- package/lib/module/network/components/NetworkSavedScreen.js +1 -222
- package/lib/module/network/components/NetworkSavedScreen.web.js +1 -461
- package/lib/module/network/components/NetworkUpgradeBanner.js +1 -72
- package/lib/module/network/components/response-editor/Explorer.js +1 -972
- package/lib/module/network/components/response-editor/Explorer.web.js +1 -1133
- package/lib/module/network/components/response-editor/deleteNestedDataByPath.js +1 -51
- package/lib/module/network/components/response-editor/editorContext.js +1 -29
- package/lib/module/network/components/response-editor/updateNestedDataByPath.js +1 -56
- package/lib/module/network/conditions/NetworkConditionsControl.js +1 -231
- package/lib/module/network/conditions/NetworkConditionsControl.test.js +1 -135
- package/lib/module/network/conditions/NetworkConditionsIcon.js +1 -29
- package/lib/module/network/conditions/NetworkFloatingTool.js +1 -304
- package/lib/module/network/conditions/NetworkFloatingTool.test.js +1 -218
- package/lib/module/network/conditions/store.js +1 -65
- package/lib/module/network/conditions/wait.js +1 -38
- package/lib/module/network/conditions/xhr.js +1 -106
- package/lib/module/network/hooks/useLiveNetworkEvent.js +1 -58
- package/lib/module/network/hooks/useNetworkBadgeCounts.js +1 -79
- package/lib/module/network/hooks/useNetworkEventList.js +1 -104
- package/lib/module/network/hooks/useNetworkEvents.js +1 -314
- package/lib/module/network/hooks/useNetworkHasMatches.js +1 -52
- package/lib/module/network/hooks/useNetworkSaved.js +1 -34
- package/lib/module/network/hooks/useNetworkSelection.js +1 -46
- package/lib/module/network/hooks/useOverrideRules.js +1 -32
- package/lib/module/network/hooks/useTickEveryMinute.js +1 -11
- package/lib/module/network/overrides/applyToFetch.js +1 -72
- package/lib/module/network/overrides/applyToXhr.js +2 -446
- package/lib/module/network/overrides/engine.js +1 -85
- package/lib/module/network/overrides/matchRule.js +1 -75
- package/lib/module/network/overrides/overriddenRows.js +1 -0
- package/lib/module/network/overrides/overrideRulesStore.js +1 -547
- package/lib/module/network/overrides/presets.js +1 -65
- package/lib/module/network/overrides/resolveOverride.js +1 -152
- package/lib/module/network/overrides/types.js +1 -86
- package/lib/module/network/sync/networkBodyResolver.js +1 -34
- package/lib/module/network/sync/networkSyncAdapter.js +1 -880
- package/lib/module/network/sync/overrideHonesty.release.test.js +1 -35
- package/lib/module/network/types/index.js +1 -3
- package/lib/module/network/utils/extractOperationName.js +1 -76
- package/lib/module/network/utils/filterNetworkEvents.js +1 -92
- package/lib/module/network/utils/formatGraphQLVariables.js +1 -213
- package/lib/module/network/utils/formatting.js +1 -9
- package/lib/module/network/utils/generateCurl.js +2 -67
- package/lib/module/network/utils/generateNetworkCopyText.js +37 -162
- package/lib/module/network/utils/httpCompletion.js +1 -32
- package/lib/module/network/utils/networkEventStore.js +1 -391
- package/lib/module/network/utils/networkListener.js +4 -1249
- package/lib/module/network/utils/networkSavedStore.js +3 -572
- package/lib/module/network/utils/networkSelectionStore.js +1 -188
- package/lib/module/network/utils/realNow.js +1 -0
- package/lib/module/network/utils/requestId.js +1 -0
- package/lib/module/network/utils/resolveRequestUrl.js +1 -0
- package/lib/module/network/utils/selectSavedEvents.js +1 -35
- package/lib/module/network/utils/startNetworkCapture.js +1 -0
- package/lib/module/network/utils/withPinnedFirst.js +1 -28
- package/lib/module/preset.js +1 -100
- package/lib/typescript/index.d.ts +1 -0
- package/lib/typescript/network/overrides/applyToXhr.d.ts +1 -0
- package/lib/typescript/network/overrides/engine.d.ts +1 -1
- package/lib/typescript/network/overrides/matchRule.d.ts +1 -1
- package/lib/typescript/network/overrides/overriddenRows.d.ts +16 -0
- package/lib/typescript/network/overrides/resolveOverride.d.ts +2 -2
- package/lib/typescript/network/overrides/types.d.ts +9 -0
- package/lib/typescript/network/utils/networkListener.d.ts +14 -4
- package/lib/typescript/network/utils/networkSavedStore.d.ts +4 -4
- package/lib/typescript/network/utils/realNow.d.ts +18 -0
- package/lib/typescript/network/utils/requestId.d.ts +2 -0
- package/lib/typescript/network/utils/resolveRequestUrl.d.ts +3 -0
- package/lib/typescript/network/utils/startNetworkCapture.d.ts +6 -0
- package/lib/web/index.mjs +145 -0
- package/package.json +32 -10
- package/lib/typescript/index.d.ts.map +0 -1
- package/lib/typescript/index.web.d.ts.map +0 -1
- package/lib/typescript/network/components/DataViewer.web.d.ts.map +0 -1
- package/lib/typescript/network/components/NetworkCopyScreen.web.d.ts.map +0 -1
- package/lib/typescript/network/components/NetworkCopySettingsView.d.ts.map +0 -1
- package/lib/typescript/network/components/NetworkCopySettingsView.web.d.ts.map +0 -1
- package/lib/typescript/network/components/NetworkDetailScreen.web.d.ts.map +0 -1
- package/lib/typescript/network/components/NetworkDetailStepper.d.ts.map +0 -1
- package/lib/typescript/network/components/NetworkDetailStepper.web.d.ts.map +0 -1
- package/lib/typescript/network/components/NetworkEventDetailView.d.ts.map +0 -1
- package/lib/typescript/network/components/NetworkEventDetailView.web.d.ts.map +0 -1
- package/lib/typescript/network/components/NetworkEventItemCompact.d.ts.map +0 -1
- package/lib/typescript/network/components/NetworkEventItemCompact.web.d.ts.map +0 -1
- package/lib/typescript/network/components/NetworkFilterScreen.web.d.ts.map +0 -1
- package/lib/typescript/network/components/NetworkFilterViewV3.d.ts.map +0 -1
- package/lib/typescript/network/components/NetworkFilterViewV3.web.d.ts.map +0 -1
- package/lib/typescript/network/components/NetworkHeaderLive.d.ts.map +0 -1
- package/lib/typescript/network/components/NetworkHeaderLive.web.d.ts.map +0 -1
- package/lib/typescript/network/components/NetworkHeaderMenu.d.ts.map +0 -1
- package/lib/typescript/network/components/NetworkListScreen.d.ts.map +0 -1
- package/lib/typescript/network/components/NetworkListScreen.web.d.ts.map +0 -1
- package/lib/typescript/network/components/NetworkModal.d.ts.map +0 -1
- package/lib/typescript/network/components/NetworkNumberPrompt.d.ts.map +0 -1
- package/lib/typescript/network/components/NetworkNumberPrompt.web.d.ts.map +0 -1
- package/lib/typescript/network/components/NetworkOverrideEditor.d.ts.map +0 -1
- package/lib/typescript/network/components/NetworkOverrideEditor.web.d.ts.map +0 -1
- package/lib/typescript/network/components/NetworkOverrideHeaderButton.d.ts.map +0 -1
- package/lib/typescript/network/components/NetworkOverrideHeaderButton.web.d.ts.map +0 -1
- package/lib/typescript/network/components/NetworkOverridesButton.d.ts.map +0 -1
- package/lib/typescript/network/components/NetworkOverridesButton.web.d.ts.map +0 -1
- package/lib/typescript/network/components/NetworkOverridesScreen.d.ts.map +0 -1
- package/lib/typescript/network/components/NetworkOverridesScreen.web.d.ts.map +0 -1
- package/lib/typescript/network/components/NetworkSavedScreen.d.ts.map +0 -1
- package/lib/typescript/network/components/NetworkSavedScreen.web.d.ts.map +0 -1
- package/lib/typescript/network/components/NetworkUpgradeBanner.d.ts.map +0 -1
- package/lib/typescript/network/components/response-editor/Explorer.d.ts.map +0 -1
- package/lib/typescript/network/components/response-editor/Explorer.web.d.ts.map +0 -1
- package/lib/typescript/network/components/response-editor/deleteNestedDataByPath.d.ts.map +0 -1
- package/lib/typescript/network/components/response-editor/editorContext.d.ts.map +0 -1
- package/lib/typescript/network/components/response-editor/updateNestedDataByPath.d.ts.map +0 -1
- package/lib/typescript/network/conditions/NetworkConditionsControl.d.ts.map +0 -1
- package/lib/typescript/network/conditions/NetworkConditionsControl.test.d.ts.map +0 -1
- package/lib/typescript/network/conditions/NetworkConditionsIcon.d.ts.map +0 -1
- package/lib/typescript/network/conditions/NetworkFloatingTool.d.ts.map +0 -1
- package/lib/typescript/network/conditions/NetworkFloatingTool.test.d.ts.map +0 -1
- package/lib/typescript/network/conditions/store.d.ts.map +0 -1
- package/lib/typescript/network/conditions/wait.d.ts.map +0 -1
- package/lib/typescript/network/conditions/xhr.d.ts.map +0 -1
- package/lib/typescript/network/hooks/useLiveNetworkEvent.d.ts.map +0 -1
- package/lib/typescript/network/hooks/useNetworkBadgeCounts.d.ts.map +0 -1
- package/lib/typescript/network/hooks/useNetworkEventList.d.ts.map +0 -1
- package/lib/typescript/network/hooks/useNetworkEvents.d.ts.map +0 -1
- package/lib/typescript/network/hooks/useNetworkHasMatches.d.ts.map +0 -1
- package/lib/typescript/network/hooks/useNetworkSaved.d.ts.map +0 -1
- package/lib/typescript/network/hooks/useNetworkSelection.d.ts.map +0 -1
- package/lib/typescript/network/hooks/useOverrideRules.d.ts.map +0 -1
- package/lib/typescript/network/hooks/useTickEveryMinute.d.ts.map +0 -1
- package/lib/typescript/network/overrides/applyToFetch.d.ts.map +0 -1
- package/lib/typescript/network/overrides/applyToXhr.d.ts.map +0 -1
- package/lib/typescript/network/overrides/engine.d.ts.map +0 -1
- package/lib/typescript/network/overrides/matchRule.d.ts.map +0 -1
- package/lib/typescript/network/overrides/overrideRulesStore.d.ts.map +0 -1
- package/lib/typescript/network/overrides/presets.d.ts.map +0 -1
- package/lib/typescript/network/overrides/resolveOverride.d.ts.map +0 -1
- package/lib/typescript/network/overrides/types.d.ts.map +0 -1
- package/lib/typescript/network/sync/networkBodyResolver.d.ts.map +0 -1
- package/lib/typescript/network/sync/networkSyncAdapter.d.ts.map +0 -1
- package/lib/typescript/network/sync/overrideHonesty.release.test.d.ts.map +0 -1
- package/lib/typescript/network/types/index.d.ts.map +0 -1
- package/lib/typescript/network/utils/extractOperationName.d.ts.map +0 -1
- package/lib/typescript/network/utils/filterNetworkEvents.d.ts.map +0 -1
- package/lib/typescript/network/utils/formatGraphQLVariables.d.ts.map +0 -1
- package/lib/typescript/network/utils/formatting.d.ts.map +0 -1
- package/lib/typescript/network/utils/generateCurl.d.ts.map +0 -1
- package/lib/typescript/network/utils/generateNetworkCopyText.d.ts.map +0 -1
- package/lib/typescript/network/utils/httpCompletion.d.ts.map +0 -1
- package/lib/typescript/network/utils/networkEventStore.d.ts.map +0 -1
- package/lib/typescript/network/utils/networkListener.d.ts.map +0 -1
- package/lib/typescript/network/utils/networkSavedStore.d.ts.map +0 -1
- package/lib/typescript/network/utils/networkSelectionStore.d.ts.map +0 -1
- package/lib/typescript/network/utils/selectSavedEvents.d.ts.map +0 -1
- package/lib/typescript/network/utils/withPinnedFirst.d.ts.map +0 -1
- package/lib/typescript/preset.d.ts.map +0 -1
|
@@ -1,188 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Which request the detail view is showing, and where it sits in the list —
|
|
5
|
-
* the prev/next CURSOR.
|
|
6
|
-
*
|
|
7
|
-
* ## Why this is a store and not `useState` in the modal
|
|
8
|
-
*
|
|
9
|
-
* It used to be `useState` in `NetworkModalInner`. Every tap on Previous/Next
|
|
10
|
-
* therefore dirtied the modal ROOT, which re-rendered `JsModal` (1833 lines,
|
|
11
|
-
* nine useStates, animations/gestures/persistence — and it can never bail out,
|
|
12
|
-
* because its `header` prop is a fresh object literal every render), the whole
|
|
13
|
-
* header, and all five screens. None of them care which request is selected;
|
|
14
|
-
* they only care THAT one is.
|
|
15
|
-
*
|
|
16
|
-
* This is the same argument `NetworkModal`'s own header comment already makes
|
|
17
|
-
* about network events ("with the subscription here, 15 events re-rendered
|
|
18
|
-
* JsModal + every header button 15×"). Stepping is that same class of
|
|
19
|
-
* high-frequency churn, and it was sitting in the same wrong place. Now the
|
|
20
|
-
* root subscribes to `hasSelection` — a boolean that flips twice a session —
|
|
21
|
-
* while the footer, the body and the header's pin actions subscribe to the
|
|
22
|
-
* parts they actually render.
|
|
23
|
-
*
|
|
24
|
-
* ## The three cursors
|
|
25
|
-
*
|
|
26
|
-
* `selectedId` is where the USER is. It moves on the tap, synchronously.
|
|
27
|
-
*
|
|
28
|
-
* `bodyId` is what the detail body is allowed to render, and it deliberately
|
|
29
|
-
* LAGS: drawing a request means handing its payload to the virtualized data
|
|
30
|
-
* viewer to flatten, and that has no business blocking the next tap. It
|
|
31
|
-
* catches up only once the selection has held still for `settleMs`, so a
|
|
32
|
-
* burst of taps renders the request you land on and none of the ones you flew
|
|
33
|
-
* past. (`useDeferredValue` was tried here first and is the wrong tool — it
|
|
34
|
-
* lowers the priority of that work without preventing it, so every settled
|
|
35
|
-
* step still queued a flatten and each one delayed the touch behind it.)
|
|
36
|
-
*
|
|
37
|
-
* `renderedId` is what actually made it to the screen, reported by the detail
|
|
38
|
-
* screen after commit. Nothing in the product reads it; it exists so the
|
|
39
|
-
* benchmark harness can measure "time until request N was really painted"
|
|
40
|
-
* separately from "time until the cursor reached N".
|
|
41
|
-
*/
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* How long the selection must hold still before the body renders it. Short
|
|
45
|
-
* enough that a single step reads as immediate (the footer and header have
|
|
46
|
-
* already moved), long enough that a burst collapses to one render.
|
|
47
|
-
*/
|
|
48
|
-
export const DEFAULT_SETTLE_MS = 120;
|
|
49
|
-
class NetworkSelectionStore {
|
|
50
|
-
ids = [];
|
|
51
|
-
index = -1;
|
|
52
|
-
selectedId = null;
|
|
53
|
-
bodyId = null;
|
|
54
|
-
renderedId = null;
|
|
55
|
-
settleMs = DEFAULT_SETTLE_MS;
|
|
56
|
-
settleTimer = null;
|
|
57
|
-
subscribers = new Set();
|
|
58
|
-
snapshot = this.buildSnapshot();
|
|
59
|
-
buildSnapshot() {
|
|
60
|
-
return {
|
|
61
|
-
ids: this.ids,
|
|
62
|
-
index: this.index,
|
|
63
|
-
selectedId: this.selectedId,
|
|
64
|
-
bodyId: this.bodyId,
|
|
65
|
-
renderedId: this.renderedId
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* One immutable snapshot per mutation, so subscribers can identity-compare
|
|
71
|
-
* and `useSyncExternalStore` stays happy.
|
|
72
|
-
*/
|
|
73
|
-
emit() {
|
|
74
|
-
this.snapshot = this.buildSnapshot();
|
|
75
|
-
for (const subscriber of this.subscribers) subscriber(this.snapshot);
|
|
76
|
-
}
|
|
77
|
-
getState() {
|
|
78
|
-
return this.snapshot;
|
|
79
|
-
}
|
|
80
|
-
subscribe(subscriber) {
|
|
81
|
-
this.subscribers.add(subscriber);
|
|
82
|
-
return () => {
|
|
83
|
-
this.subscribers.delete(subscriber);
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
/**
|
|
88
|
-
* Publish the navigable order. Called by the stepper whenever its derived
|
|
89
|
-
* list changes (filter, search, pins, new requests arriving).
|
|
90
|
-
*
|
|
91
|
-
* The cursor is re-anchored BY ID, not by position: the live list is
|
|
92
|
-
* newest-first and new requests are prepended, so holding an index would
|
|
93
|
-
* silently slide the selection onto a different request every time one
|
|
94
|
-
* landed.
|
|
95
|
-
*/
|
|
96
|
-
setIds(ids) {
|
|
97
|
-
const sameIds = ids.length === this.ids.length && ids.every((id, i) => id === this.ids[i]);
|
|
98
|
-
if (sameIds) return;
|
|
99
|
-
this.ids = ids;
|
|
100
|
-
this.index = this.selectedId == null ? -1 : ids.indexOf(this.selectedId);
|
|
101
|
-
this.emit();
|
|
102
|
-
}
|
|
103
|
-
select(id) {
|
|
104
|
-
if (id === this.selectedId) return;
|
|
105
|
-
this.selectedId = id;
|
|
106
|
-
this.index = id == null ? -1 : this.ids.indexOf(id);
|
|
107
|
-
this.scheduleBody(id);
|
|
108
|
-
this.emit();
|
|
109
|
-
}
|
|
110
|
-
clear() {
|
|
111
|
-
this.select(null);
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
/**
|
|
115
|
-
* Move the cursor. O(1) — the whole reason `index` is stored rather than
|
|
116
|
-
* re-derived with a `findIndex` on every render.
|
|
117
|
-
*
|
|
118
|
-
* Returns the id it landed on, or null if the move was out of bounds (the
|
|
119
|
-
* footer disables its arrows at the ends, but the benchmark driver calls
|
|
120
|
-
* this directly and needs to know when it has run off the end).
|
|
121
|
-
*/
|
|
122
|
-
step(delta) {
|
|
123
|
-
if (this.index < 0) return null;
|
|
124
|
-
const next = this.index + delta;
|
|
125
|
-
if (next < 0 || next >= this.ids.length) return null;
|
|
126
|
-
const id = this.ids[next];
|
|
127
|
-
this.selectedId = id;
|
|
128
|
-
this.index = next;
|
|
129
|
-
this.scheduleBody(id);
|
|
130
|
-
this.emit();
|
|
131
|
-
return id;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
/**
|
|
135
|
-
* Opening and closing skip the settle delay: there is no in-flight render to
|
|
136
|
-
* protect on a null↔id transition, and waiting there just reads as a hang.
|
|
137
|
-
* Only id → id steps debounce.
|
|
138
|
-
*/
|
|
139
|
-
scheduleBody(id) {
|
|
140
|
-
if (this.settleTimer != null) {
|
|
141
|
-
clearTimeout(this.settleTimer);
|
|
142
|
-
this.settleTimer = null;
|
|
143
|
-
}
|
|
144
|
-
if (id == null || this.bodyId == null || this.settleMs <= 0) {
|
|
145
|
-
this.bodyId = id;
|
|
146
|
-
return;
|
|
147
|
-
}
|
|
148
|
-
this.settleTimer = setTimeout(() => {
|
|
149
|
-
this.settleTimer = null;
|
|
150
|
-
if (this.bodyId === this.selectedId) return;
|
|
151
|
-
this.bodyId = this.selectedId;
|
|
152
|
-
this.emit();
|
|
153
|
-
}, this.settleMs);
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
/** Benchmark toggle — `?settle=0` measures the gate's contribution. */
|
|
157
|
-
setSettleMs(ms) {
|
|
158
|
-
this.settleMs = Math.max(0, ms);
|
|
159
|
-
}
|
|
160
|
-
getSettleMs() {
|
|
161
|
-
return this.settleMs;
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
/** Reported by the detail screen after commit. Instrumentation only. */
|
|
165
|
-
reportRendered(id) {
|
|
166
|
-
if (id === this.renderedId) return;
|
|
167
|
-
this.renderedId = id;
|
|
168
|
-
this.emit();
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
/** Test/bench helper — drop all cursor state without touching the events. */
|
|
172
|
-
reset() {
|
|
173
|
-
if (this.settleTimer != null) clearTimeout(this.settleTimer);
|
|
174
|
-
this.settleTimer = null;
|
|
175
|
-
this.ids = [];
|
|
176
|
-
this.index = -1;
|
|
177
|
-
this.selectedId = null;
|
|
178
|
-
this.bodyId = null;
|
|
179
|
-
this.renderedId = null;
|
|
180
|
-
this.emit();
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
export const networkSelectionStore = new NetworkSelectionStore();
|
|
184
|
-
|
|
185
|
-
/** Convenience for publishing an event list as the navigable order. */
|
|
186
|
-
export function toSelectionIds(events) {
|
|
187
|
-
return events.map(event => event.id);
|
|
188
|
-
}
|
|
1
|
+
"use strict";export const DEFAULT_SETTLE_MS=120;class l{ids=[];index=-1;selectedId=null;bodyId=null;renderedId=null;settleMs=DEFAULT_SETTLE_MS;settleTimer=null;subscribers=new Set;snapshot=this.buildSnapshot();buildSnapshot(){return{ids:this.ids,index:this.index,selectedId:this.selectedId,bodyId:this.bodyId,renderedId:this.renderedId}}emit(){this.snapshot=this.buildSnapshot();for(const e of this.subscribers)e(this.snapshot)}getState(){return this.snapshot}subscribe(e){this.subscribers.add(e);return()=>{this.subscribers.delete(e)}}setIds(e){const t=e.length===this.ids.length&&e.every((s,d)=>s===this.ids[d]);if(t)return;this.ids=e;this.index=this.selectedId==null?-1:e.indexOf(this.selectedId);this.emit()}select(e){if(e===this.selectedId)return;this.selectedId=e;this.index=e==null?-1:this.ids.indexOf(e);this.scheduleBody(e);this.emit()}clear(){this.select(null)}step(e){if(this.index<0)return null;const t=this.index+e;if(t<0||t>=this.ids.length)return null;const s=this.ids[t];this.selectedId=s;this.index=t;this.scheduleBody(s);this.emit();return s}scheduleBody(e){if(this.settleTimer!=null){clearTimeout(this.settleTimer);this.settleTimer=null}if(e==null||this.bodyId==null||this.settleMs<=0){this.bodyId=e;return}this.settleTimer=setTimeout(()=>{this.settleTimer=null;if(this.bodyId===this.selectedId)return;this.bodyId=this.selectedId;this.emit()},this.settleMs)}setSettleMs(e){this.settleMs=Math.max(0,e)}getSettleMs(){return this.settleMs}reportRendered(e){if(e===this.renderedId)return;this.renderedId=e;this.emit()}reset(){if(this.settleTimer!=null)clearTimeout(this.settleTimer);this.settleTimer=null;this.ids=[];this.index=-1;this.selectedId=null;this.bodyId=null;this.renderedId=null;this.emit()}}export const networkSelectionStore=new l;export function toSelectionIds(i){return i.map(e=>e.id)}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";export function realNow(){const e=globalThis.__buoyRealNow;return typeof e==="function"?e():Date.now()}function t(){const e=globalThis.__buoyRealTimers;return e??globalThis}export function realSetTimeout(e,o){return t().setTimeout(e,o)}export function realClearTimeout(e){t().clearTimeout(e)}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const n=globalThis;export function nextRequestId(e){const t=n.__BUOY_NETWORK_REQUEST_SEQUENCE__??={session:`${Date.now().toString(36)}-${Math.random().toString(36).slice(2)}`,next:0};return`${e}_${t.session}_${++t.next}`}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";export function resolveRequestUrl(e){if(typeof document==="undefined")return e;try{return new URL(e,document.baseURI).href}catch{return e}}
|
|
@@ -1,35 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* The SAVED screen's visible list, as a pure function.
|
|
5
|
-
*
|
|
6
|
-
* Two places need the exact same list: the screen that renders it
|
|
7
|
-
* (`NetworkSavedScreen`) and the detail footer that steps through it
|
|
8
|
-
* (`NetworkDetailStepper`). If they derived it independently, "Next" would
|
|
9
|
-
* eventually disagree with the row below — the same drift `withPinnedFirst`
|
|
10
|
-
* exists to prevent for the live list.
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
import { filterNetworkEvents } from "./filterNetworkEvents";
|
|
14
|
-
import { MAX_SAVED } from "./networkSavedStore";
|
|
15
|
-
export function selectSavedEvents(savedRecords,
|
|
16
|
-
/**
|
|
17
|
-
* How many saves this tier may see — `useLimit("network.saved")`. Takes a
|
|
18
|
-
* number rather than `isPro` because Pro's cap is 50, not unlimited, and a
|
|
19
|
-
* boolean cannot express that.
|
|
20
|
-
*/
|
|
21
|
-
limit, search) {
|
|
22
|
-
/**
|
|
23
|
-
* A downgrade (or a limit change) can leave a user holding more saves than
|
|
24
|
-
* their tier allows. Rather than deleting their data, the overflow is
|
|
25
|
-
* LOCKED — oldest first, so the newest saves stay reachable.
|
|
26
|
-
*/
|
|
27
|
-
const unlocked = savedRecords.slice(0, Math.min(limit, MAX_SAVED));
|
|
28
|
-
const events = unlocked.map(record => record.event);
|
|
29
|
-
return {
|
|
30
|
-
events: search ? filterNetworkEvents(events, {
|
|
31
|
-
searchText: search
|
|
32
|
-
}) : events,
|
|
33
|
-
lockedCount: savedRecords.length - unlocked.length
|
|
34
|
-
};
|
|
35
|
-
}
|
|
1
|
+
"use strict";import{filterNetworkEvents as c}from"./filterNetworkEvents";import{MAX_SAVED as i}from"./networkSavedStore";export function selectSavedEvents(t,r,e){const n=t.slice(0,Math.min(r,i));const o=n.map(s=>s.event);return{events:e?c(o,{searchText:e}):o,lockedCount:t.length-n.length}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";import{networkEventStore as o}from"./networkEventStore";import{overrideRulesStore as n}from"../overrides/overrideRulesStore";export function startNetworkCapture(){const t=typeof navigator!=="undefined"&&navigator.product==="ReactNative";if(!t&&(typeof window==="undefined"||typeof document==="undefined"))return()=>{};void n.ensureLoaded();const r=o.subscribeToEvents(()=>{});let e=false;return()=>{if(e)return;e=true;r()}}
|
|
@@ -1,28 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Split a filtered event list into its PINNED section and the rest.
|
|
5
|
-
*
|
|
6
|
-
* Lives as a pure function because there are TWO list implementations — the
|
|
7
|
-
* mobile modal's `NetworkListScreen` and the desktop dashboard's hand-mirrored
|
|
8
|
-
* `NetworkInline` — and pin ordering silently diverging between them is
|
|
9
|
-
* exactly the drift `buoy.tools.json` exists to prevent.
|
|
10
|
-
*
|
|
11
|
-
* Pins are deliberately NOT filtered: they come straight from the saved store,
|
|
12
|
-
* so a pinned request stays visible no matter what the search box or the
|
|
13
|
-
* status chips say. The only thing the filtered list contributes is the
|
|
14
|
-
* dedupe — a pinned request that is still live must not render twice.
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
const EMPTY = [];
|
|
18
|
-
export function splitPinned(filtered, pinnedEvents, /** Live IDs pinned in THIS session — from `networkSavedStore.getState()`. */
|
|
19
|
-
pinnedLiveIds) {
|
|
20
|
-
if (pinnedEvents.length === 0) return {
|
|
21
|
-
pinned: EMPTY,
|
|
22
|
-
rest: filtered
|
|
23
|
-
};
|
|
24
|
-
return {
|
|
25
|
-
pinned: pinnedEvents,
|
|
26
|
-
rest: pinnedLiveIds.size === 0 ? filtered : filtered.filter(event => !pinnedLiveIds.has(event.id))
|
|
27
|
-
};
|
|
28
|
-
}
|
|
1
|
+
"use strict";const i=[];export function splitPinned(t,n,r){if(n.length===0)return{pinned:i,rest:t};return{pinned:n,rest:r.size===0?t:t.filter(s=>!r.has(s.id))}}
|
package/lib/module/preset.js
CHANGED
|
@@ -1,100 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import { NetworkConditionsIcon } from "./network/conditions/NetworkConditionsIcon";
|
|
4
|
-
/**
|
|
5
|
-
* Pre-configured network monitoring tool for FloatingDevTools
|
|
6
|
-
*
|
|
7
|
-
* This preset provides a zero-config way to add network request monitoring to your dev tools.
|
|
8
|
-
* Just import and add it to your apps array!
|
|
9
|
-
*
|
|
10
|
-
* @example
|
|
11
|
-
* ```tsx
|
|
12
|
-
* import { networkToolPreset } from '@buoy-gg/network';
|
|
13
|
-
*
|
|
14
|
-
* const installedApps = [
|
|
15
|
-
* networkToolPreset, // That's it!
|
|
16
|
-
* // ...other tools
|
|
17
|
-
* ];
|
|
18
|
-
* ```
|
|
19
|
-
*/
|
|
20
|
-
|
|
21
|
-
import { createToolFactory, defineToolPreset } from "@buoy-gg/shared-ui";
|
|
22
|
-
import { NetworkModal } from "./network/components/NetworkModal";
|
|
23
|
-
import { overrideRulesStore } from "./network/overrides/overrideRulesStore";
|
|
24
|
-
import { networkEventStore } from "./network/utils/networkEventStore";
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Load persisted response-override rules as soon as the tool is registered.
|
|
28
|
-
*
|
|
29
|
-
* Deliberately at import time rather than when the Network modal mounts: an
|
|
30
|
-
* override has to fire from app boot, with the tool closed and nothing
|
|
31
|
-
* capturing — that is the whole point of persisting rules ("force this endpoint
|
|
32
|
-
* to 500, then restart and watch the boot path"). Hydrating also re-installs
|
|
33
|
-
* the interceptor if any rule is still active. One storage read, dev-only.
|
|
34
|
-
*/
|
|
35
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
36
|
-
void overrideRulesStore.ensureLoaded();
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Install interception at IMPORT time and buffer boot traffic.
|
|
40
|
-
*
|
|
41
|
-
* Capture used to start with the first subscriber (Network modal open,
|
|
42
|
-
* dashboard/MCP watch) — long after the app's startup requests (module-scope
|
|
43
|
-
* fetches, session bootstrap, the first query) had fired, so boot traffic was
|
|
44
|
-
* permanently invisible. The boot buffer holds those raw events until the
|
|
45
|
-
* first consumer subscribes, then flushes them into the store; if nothing
|
|
46
|
-
* ever subscribes, nothing is flushed (see startBootCapture).
|
|
47
|
-
*
|
|
48
|
-
* Guards:
|
|
49
|
-
* - `navigator.product === "ReactNative"` — a real RN runtime only. The
|
|
50
|
-
* desktop dashboard and web mirrors also evaluate this module and must
|
|
51
|
-
* never intercept their OWN process's traffic.
|
|
52
|
-
* - Dev-only, like the rest of the automatic capture behavior.
|
|
53
|
-
*/
|
|
54
|
-
const isReactNativeRuntime = typeof navigator !== "undefined" && navigator.product === "ReactNative";
|
|
55
|
-
if (isReactNativeRuntime && typeof __DEV__ !== "undefined" && __DEV__) {
|
|
56
|
-
networkEventStore.startBootCapture();
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* Pre-configured network monitoring tool for FloatingDevTools.
|
|
61
|
-
* Includes:
|
|
62
|
-
* - Live network request monitoring
|
|
63
|
-
* - Request/response inspection
|
|
64
|
-
* - Filter by status, method, URL
|
|
65
|
-
* - Timing information
|
|
66
|
-
*/
|
|
67
|
-
export const networkToolPreset = defineToolPreset({
|
|
68
|
-
id: "network",
|
|
69
|
-
name: "NET",
|
|
70
|
-
description: "Network request logger",
|
|
71
|
-
slot: "both",
|
|
72
|
-
icon: ({
|
|
73
|
-
size
|
|
74
|
-
}) => /*#__PURE__*/_jsx(NetworkConditionsIcon, {
|
|
75
|
-
size: size
|
|
76
|
-
}),
|
|
77
|
-
component: NetworkModal,
|
|
78
|
-
props: {
|
|
79
|
-
enableSharedModalDimensions: false
|
|
80
|
-
}
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
* Create a custom network monitoring tool configuration.
|
|
85
|
-
* Use this if you want to override default settings.
|
|
86
|
-
*
|
|
87
|
-
* @example
|
|
88
|
-
* ```tsx
|
|
89
|
-
* import { createNetworkTool } from '@buoy-gg/network';
|
|
90
|
-
*
|
|
91
|
-
* const myNetworkTool = createNetworkTool({
|
|
92
|
-
* name: "REQUESTS",
|
|
93
|
-
* iconColor: "#9945FF", // Purple color
|
|
94
|
-
* enableSharedModalDimensions: true,
|
|
95
|
-
* });
|
|
96
|
-
* ```
|
|
97
|
-
*/
|
|
98
|
-
export const createNetworkTool = createToolFactory(networkToolPreset, options => ({
|
|
99
|
-
enableSharedModalDimensions: options.enableSharedModalDimensions ?? false
|
|
100
|
-
}));
|
|
1
|
+
"use strict";import{NetworkConditionsIcon as t}from"./network/conditions/NetworkConditionsIcon";import{createToolFactory as r,defineToolPreset as i}from"@buoy-gg/shared-ui";import{NetworkModal as n}from"./network/components/NetworkModal";import{overrideRulesStore as a}from"./network/overrides/overrideRulesStore";import{networkEventStore as s}from"./network/utils/networkEventStore";import{jsx as d}from"react/jsx-runtime";const e=typeof navigator!=="undefined"&&navigator.product==="ReactNative";if(e)void a.ensureLoaded();if(e&&typeof __DEV__!=="undefined"&&__DEV__){s.startBootCapture()}export const networkToolPreset=i({id:"network",name:"NET",description:"Network request logger",slot:"both",icon:({size:o})=>d(t,{size:o}),component:n,props:{enableSharedModalDimensions:false}});export const createNetworkTool=r(networkToolPreset,o=>({enableSharedModalDimensions:o.enableSharedModalDimensions??false}));
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
* bypassing the tool's intended usage patterns.
|
|
9
9
|
*/
|
|
10
10
|
export { networkToolPreset, createNetworkTool } from "./preset";
|
|
11
|
+
export { startNetworkCapture } from "./network/utils/startNetworkCapture";
|
|
11
12
|
export { NetworkModal, NetworkToolView } from "./network/components/NetworkModal";
|
|
12
13
|
export type { NetworkToolViewProps } from "./network/components/NetworkModal";
|
|
13
14
|
export { NetworkEventDetailView } from "./network/components/NetworkEventDetailView";
|
|
@@ -57,6 +57,7 @@ export declare function canSynthesize(xhr: XMLHttpRequest): boolean;
|
|
|
57
57
|
* rules out half-mocks that could take the branch and then leak listeners.
|
|
58
58
|
*/
|
|
59
59
|
export declare function canSynthesizeStandard(xhr: XMLHttpRequest): boolean;
|
|
60
|
+
export declare function hasPendingStandardRequest(xhr: XMLHttpRequest): boolean;
|
|
60
61
|
/**
|
|
61
62
|
* Apply an outcome to a request that has NOT been sent yet.
|
|
62
63
|
*
|
|
@@ -50,5 +50,5 @@ export declare function inspectEngine(url: string, method: string): {
|
|
|
50
50
|
* broken dev tool, so the gate is here — at the single entry point — rather
|
|
51
51
|
* than trusted to every call site.
|
|
52
52
|
*/
|
|
53
|
-
export declare function overrideForRequest(url: string, method: string): OverrideOutcome | null;
|
|
53
|
+
export declare function overrideForRequest(url: string, method: string, headers?: Record<string, string>): OverrideOutcome | null;
|
|
54
54
|
//# sourceMappingURL=engine.d.ts.map
|
|
@@ -18,5 +18,5 @@ import type { OverrideRule } from "./types";
|
|
|
18
18
|
export declare function escapeRegex(pattern: string): string;
|
|
19
19
|
export declare function compilePattern(pattern: string): RegExp;
|
|
20
20
|
/** Does this rule apply to this request? Ignores `enabled` — callers check it. */
|
|
21
|
-
export declare function ruleMatches(rule: OverrideRule, url: string, method: string): boolean;
|
|
21
|
+
export declare function ruleMatches(rule: OverrideRule, url: string, method: string, headers?: Record<string, string>): boolean;
|
|
22
22
|
//# sourceMappingURL=matchRule.d.ts.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { NetworkEvent } from "../types";
|
|
2
|
+
import type { OverrideRule } from "./types";
|
|
3
|
+
/**
|
|
4
|
+
* Which captured requests belong in the list's OVERRIDDEN strip.
|
|
5
|
+
*
|
|
6
|
+
* A row belongs there when an active rule actually changed it (it carries the
|
|
7
|
+
* rule's override mark) or matched it after the rule existed (while overrides
|
|
8
|
+
* are paused those pass through, and the strip is how you find the rule again).
|
|
9
|
+
* Before a rule existed nothing overrode anything, so older matching requests
|
|
10
|
+
* are real server responses and stay in the list, with one exception: the
|
|
11
|
+
* newest of them, which is the request the rule was built from. That one hoists
|
|
12
|
+
* right away, so creating a rule shows where it points without waiting for the
|
|
13
|
+
* endpoint to be called again.
|
|
14
|
+
*/
|
|
15
|
+
export declare function overriddenEvents(events: NetworkEvent[], activeRules: OverrideRule[]): NetworkEvent[];
|
|
16
|
+
//# sourceMappingURL=overriddenRows.d.ts.map
|
|
@@ -28,7 +28,7 @@ export declare function shouldApply(rule: OverrideRule): boolean;
|
|
|
28
28
|
* its phase on the requests it deliberately skips — the caller needs the rule
|
|
29
29
|
* back even when the answer is "not this time".
|
|
30
30
|
*/
|
|
31
|
-
export declare function findMatchingRule(url: string, method: string, rules: readonly OverrideRule[]): OverrideRule | null;
|
|
31
|
+
export declare function findMatchingRule(url: string, method: string, rules: readonly OverrideRule[], headers?: Record<string, string>): OverrideRule | null;
|
|
32
32
|
/**
|
|
33
33
|
* First ENABLED matching rule wins outright — no merging across rules.
|
|
34
34
|
*
|
|
@@ -41,6 +41,6 @@ export declare function findMatchingRule(url: string, method: string, rules: rea
|
|
|
41
41
|
* @param method HTTP method as the caller sent it (case-insensitive).
|
|
42
42
|
* @param rules Ordered rule list; earlier entries win.
|
|
43
43
|
*/
|
|
44
|
-
export declare function resolveOverride(url: string, method: string, rules: readonly OverrideRule[]): OverrideOutcome | null;
|
|
44
|
+
export declare function resolveOverride(url: string, method: string, rules: readonly OverrideRule[], headers?: Record<string, string>): OverrideOutcome | null;
|
|
45
45
|
export { toOutcome };
|
|
46
46
|
//# sourceMappingURL=resolveOverride.d.ts.map
|
|
@@ -72,6 +72,15 @@ export interface OverrideRule {
|
|
|
72
72
|
urlPattern: string;
|
|
73
73
|
/** Uppercase methods. Absent or empty means "any method". */
|
|
74
74
|
methods?: string[];
|
|
75
|
+
/**
|
|
76
|
+
* Only requests that SEND this header (name, case-insensitive). Absent
|
|
77
|
+
* means any request.
|
|
78
|
+
*
|
|
79
|
+
* For failures aimed at an authenticated call: the Clock tool's "fail the
|
|
80
|
+
* next request" sets `authorization`, so the 401 lands on a request that
|
|
81
|
+
* carried the token and never on the app's own token request.
|
|
82
|
+
*/
|
|
83
|
+
requireHeader?: string;
|
|
75
84
|
kind: OverrideRuleKind;
|
|
76
85
|
/** `respond` only. Clamped to [STATUS_MIN, STATUS_MAX]. Defaults to 200. */
|
|
77
86
|
status?: number;
|
|
@@ -6,7 +6,7 @@ import { type NetworkConditionStamp } from "../conditions/store";
|
|
|
6
6
|
import type { NetworkTimings } from "../types";
|
|
7
7
|
import { type NetworkOverrideMark } from "../overrides/types";
|
|
8
8
|
export interface NetworkingEvent {
|
|
9
|
-
type: "request" | "response" | "error";
|
|
9
|
+
type: "request" | "request-body" | "response" | "error";
|
|
10
10
|
timestamp: Date;
|
|
11
11
|
/** Total: request start → body fully received. */
|
|
12
12
|
duration?: number;
|
|
@@ -52,7 +52,6 @@ export declare const BUOY_XHR_INTERCEPTOR_FLAG = "__buoyNetworkXhrIntercepted";
|
|
|
52
52
|
declare class NetworkListener {
|
|
53
53
|
private listeners;
|
|
54
54
|
private isListening;
|
|
55
|
-
private requestCounter;
|
|
56
55
|
private originalFetch;
|
|
57
56
|
private originalXHROpen;
|
|
58
57
|
private originalXHRSend;
|
|
@@ -164,6 +163,17 @@ declare class NetworkListener {
|
|
|
164
163
|
* effectively disabling network monitoring.
|
|
165
164
|
*/
|
|
166
165
|
stopListening(): void;
|
|
166
|
+
/**
|
|
167
|
+
* Take over the requests `@buoy-gg/core/web/register` recorded before this
|
|
168
|
+
* listener existed, so the page's startup traffic shows up. Finished requests
|
|
169
|
+
* are emitted now, with their real start time and duration. Requests still
|
|
170
|
+
* in flight are emitted when they finish. The recorder stops recording on
|
|
171
|
+
* the first call, so each request is reported once. See
|
|
172
|
+
* core/src/earlyNetwork.ts for the record shapes.
|
|
173
|
+
*/
|
|
174
|
+
adoptEarlyRequests(): void;
|
|
175
|
+
private adoptEarlyFetch;
|
|
176
|
+
private adoptEarlyXhr;
|
|
167
177
|
/**
|
|
168
178
|
* Add a listener for network events
|
|
169
179
|
*
|
|
@@ -194,7 +204,7 @@ export declare const startNetworkListener: () => void;
|
|
|
194
204
|
/**
|
|
195
205
|
* Stop network traffic monitoring
|
|
196
206
|
*/
|
|
197
|
-
export declare const stopNetworkListener: () => void;
|
|
207
|
+
export declare const stopNetworkListener: () => void | undefined;
|
|
198
208
|
/**
|
|
199
209
|
* Add a listener for network events
|
|
200
210
|
*
|
|
@@ -215,7 +225,7 @@ export declare const addNetworkListener: (listener: NetworkingEventListener) =>
|
|
|
215
225
|
/**
|
|
216
226
|
* Remove all registered network event listeners
|
|
217
227
|
*/
|
|
218
|
-
export declare const removeAllNetworkListeners: () => void;
|
|
228
|
+
export declare const removeAllNetworkListeners: () => void | undefined;
|
|
219
229
|
/**
|
|
220
230
|
* Check if network monitoring is currently active
|
|
221
231
|
*
|
|
@@ -13,10 +13,10 @@
|
|
|
13
13
|
* A record exists while either flag is true and is dropped when both go false,
|
|
14
14
|
* so all four states fall out without special cases.
|
|
15
15
|
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
16
|
+
* Request IDs include a runtime session and a counter. Saved records also
|
|
17
|
+
* track their owning session because live rows disappear on app reload.
|
|
18
|
+
* Records use a generated `key`, carry the `sessionId` that captured them,
|
|
19
|
+
* and only trust `liveId` while that
|
|
20
20
|
* session is the current one. Snapshots restored from an earlier session get
|
|
21
21
|
* their event `id` rewritten to `saved:<key>` so a restored pin can never
|
|
22
22
|
* resolve to (or dedupe against) an unrelated live request.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The device's real clock.
|
|
3
|
+
*
|
|
4
|
+
* @buoy-gg/clock can override the APP's clock (Date.now, new Date). Buoy's
|
|
5
|
+
* own bookkeeping must keep real time regardless: license expiry, sync
|
|
6
|
+
* throttles and request deadlines would otherwise lock tools or stall when
|
|
7
|
+
* someone travels a month ahead. The clock package publishes the real clock
|
|
8
|
+
* on `globalThis.__buoyRealNow`; without it, Date.now is already real.
|
|
9
|
+
*/
|
|
10
|
+
export declare function realNow(): number;
|
|
11
|
+
/**
|
|
12
|
+
* setTimeout that a clock jump never fires early. @buoy-gg/clock tracks the
|
|
13
|
+
* app's timers so a jump ahead can run the ones that come due; Buoy's own
|
|
14
|
+
* deadlines and heartbeats must not be among them.
|
|
15
|
+
*/
|
|
16
|
+
export declare function realSetTimeout(callback: () => void, ms: number): ReturnType<typeof setTimeout>;
|
|
17
|
+
export declare function realClearTimeout(handle: unknown): void;
|
|
18
|
+
//# sourceMappingURL=realNow.d.ts.map
|