@buoy-gg/network 7.0.12 → 7.0.14
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/lib/commonjs/index.js +52 -0
- package/lib/commonjs/network/components/NetworkDetailStepper.js +26 -14
- package/lib/commonjs/network/components/NetworkEventDetailView.js +86 -14
- package/lib/commonjs/network/components/NetworkEventItemCompact.js +4 -0
- package/lib/commonjs/network/components/NetworkHeaderLive.js +32 -7
- package/lib/commonjs/network/components/NetworkHeaderMenu.js +183 -0
- package/lib/commonjs/network/components/NetworkListScreen.js +134 -8
- package/lib/commonjs/network/components/NetworkModal.js +198 -51
- package/lib/commonjs/network/components/NetworkNumberPrompt.js +178 -0
- package/lib/commonjs/network/components/NetworkOverrideEditor.js +797 -0
- package/lib/commonjs/network/components/NetworkOverrideHeaderButton.js +102 -0
- package/lib/commonjs/network/components/NetworkOverridesButton.js +88 -0
- package/lib/commonjs/network/components/NetworkOverridesScreen.js +489 -0
- package/lib/commonjs/network/components/response-editor/Explorer.js +973 -0
- package/lib/commonjs/network/components/response-editor/deleteNestedDataByPath.js +56 -0
- package/lib/commonjs/network/components/response-editor/editorContext.js +33 -0
- package/lib/commonjs/network/components/response-editor/updateNestedDataByPath.js +61 -0
- package/lib/commonjs/network/hooks/useNetworkSelection.js +53 -0
- package/lib/commonjs/network/hooks/useOverrideRules.js +36 -0
- package/lib/commonjs/network/overrides/applyToFetch.js +80 -0
- package/lib/commonjs/network/overrides/applyToXhr.js +190 -0
- package/lib/commonjs/network/overrides/engine.js +70 -0
- package/lib/commonjs/network/overrides/matchRule.js +81 -0
- package/lib/commonjs/network/overrides/overrideRulesStore.js +550 -0
- package/lib/commonjs/network/overrides/presets.js +70 -0
- package/lib/commonjs/network/overrides/resolveOverride.js +158 -0
- package/lib/commonjs/network/overrides/types.js +85 -0
- package/lib/commonjs/network/sync/networkSyncAdapter.js +230 -1
- package/lib/commonjs/network/types/index.js +5 -1
- package/lib/commonjs/network/utils/networkEventStore.js +52 -6
- package/lib/commonjs/network/utils/networkListener.js +90 -10
- package/lib/commonjs/network/utils/networkSelectionStore.js +193 -0
- package/lib/commonjs/preset.js +11 -0
- package/lib/module/index.js +19 -0
- package/lib/module/network/components/NetworkDetailStepper.js +27 -15
- package/lib/module/network/components/NetworkEventDetailView.js +87 -15
- package/lib/module/network/components/NetworkEventItemCompact.js +5 -1
- package/lib/module/network/components/NetworkHeaderLive.js +32 -7
- package/lib/module/network/components/NetworkHeaderMenu.js +177 -0
- package/lib/module/network/components/NetworkListScreen.js +135 -9
- package/lib/module/network/components/NetworkModal.js +200 -53
- package/lib/module/network/components/NetworkNumberPrompt.js +174 -0
- package/lib/module/network/components/NetworkOverrideEditor.js +794 -0
- package/lib/module/network/components/NetworkOverrideHeaderButton.js +99 -0
- package/lib/module/network/components/NetworkOverridesButton.js +85 -0
- package/lib/module/network/components/NetworkOverridesScreen.js +485 -0
- package/lib/module/network/components/response-editor/Explorer.js +972 -0
- package/lib/module/network/components/response-editor/deleteNestedDataByPath.js +51 -0
- package/lib/module/network/components/response-editor/editorContext.js +29 -0
- package/lib/module/network/components/response-editor/updateNestedDataByPath.js +56 -0
- package/lib/module/network/hooks/useNetworkSelection.js +46 -0
- package/lib/module/network/hooks/useOverrideRules.js +32 -0
- package/lib/module/network/overrides/applyToFetch.js +72 -0
- package/lib/module/network/overrides/applyToXhr.js +185 -0
- package/lib/module/network/overrides/engine.js +64 -0
- package/lib/module/network/overrides/matchRule.js +75 -0
- package/lib/module/network/overrides/overrideRulesStore.js +547 -0
- package/lib/module/network/overrides/presets.js +65 -0
- package/lib/module/network/overrides/resolveOverride.js +152 -0
- package/lib/module/network/overrides/types.js +80 -0
- package/lib/module/network/sync/networkSyncAdapter.js +230 -1
- package/lib/module/network/types/index.js +3 -1
- package/lib/module/network/utils/networkEventStore.js +52 -6
- package/lib/module/network/utils/networkListener.js +91 -10
- package/lib/module/network/utils/networkSelectionStore.js +188 -0
- package/lib/module/preset.js +13 -1
- package/lib/typescript/index.d.ts +9 -0
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/network/components/NetworkDetailStepper.d.ts +8 -5
- package/lib/typescript/network/components/NetworkDetailStepper.d.ts.map +1 -1
- package/lib/typescript/network/components/NetworkEventDetailView.d.ts +36 -1
- package/lib/typescript/network/components/NetworkEventDetailView.d.ts.map +1 -1
- package/lib/typescript/network/components/NetworkEventItemCompact.d.ts +6 -0
- package/lib/typescript/network/components/NetworkEventItemCompact.d.ts.map +1 -1
- package/lib/typescript/network/components/NetworkHeaderLive.d.ts +13 -3
- package/lib/typescript/network/components/NetworkHeaderLive.d.ts.map +1 -1
- package/lib/typescript/network/components/NetworkHeaderMenu.d.ts +46 -0
- package/lib/typescript/network/components/NetworkHeaderMenu.d.ts.map +1 -0
- package/lib/typescript/network/components/NetworkListScreen.d.ts.map +1 -1
- package/lib/typescript/network/components/NetworkModal.d.ts.map +1 -1
- package/lib/typescript/network/components/NetworkNumberPrompt.d.ts +33 -0
- package/lib/typescript/network/components/NetworkNumberPrompt.d.ts.map +1 -0
- package/lib/typescript/network/components/NetworkOverrideEditor.d.ts +17 -0
- package/lib/typescript/network/components/NetworkOverrideEditor.d.ts.map +1 -0
- package/lib/typescript/network/components/NetworkOverrideHeaderButton.d.ts +27 -0
- package/lib/typescript/network/components/NetworkOverrideHeaderButton.d.ts.map +1 -0
- package/lib/typescript/network/components/NetworkOverridesButton.d.ts +17 -0
- package/lib/typescript/network/components/NetworkOverridesButton.d.ts.map +1 -0
- package/lib/typescript/network/components/NetworkOverridesScreen.d.ts +29 -0
- package/lib/typescript/network/components/NetworkOverridesScreen.d.ts.map +1 -0
- package/lib/typescript/network/components/response-editor/Explorer.d.ts +17 -0
- package/lib/typescript/network/components/response-editor/Explorer.d.ts.map +1 -0
- package/lib/typescript/network/components/response-editor/deleteNestedDataByPath.d.ts +9 -0
- package/lib/typescript/network/components/response-editor/deleteNestedDataByPath.d.ts.map +1 -0
- package/lib/typescript/network/components/response-editor/editorContext.d.ts +29 -0
- package/lib/typescript/network/components/response-editor/editorContext.d.ts.map +1 -0
- package/lib/typescript/network/components/response-editor/updateNestedDataByPath.d.ts +10 -0
- package/lib/typescript/network/components/response-editor/updateNestedDataByPath.d.ts.map +1 -0
- package/lib/typescript/network/hooks/useNetworkSelection.d.ts +26 -0
- package/lib/typescript/network/hooks/useNetworkSelection.d.ts.map +1 -0
- package/lib/typescript/network/hooks/useOverrideRules.d.ts +29 -0
- package/lib/typescript/network/hooks/useOverrideRules.d.ts.map +1 -0
- package/lib/typescript/network/overrides/__tests__/applyToFetch.test.d.ts +16 -0
- package/lib/typescript/network/overrides/__tests__/applyToFetch.test.d.ts.map +1 -0
- package/lib/typescript/network/overrides/__tests__/applyToXhr.test.d.ts +19 -0
- package/lib/typescript/network/overrides/__tests__/applyToXhr.test.d.ts.map +1 -0
- package/lib/typescript/network/overrides/__tests__/resolveOverride.test.d.ts +22 -0
- package/lib/typescript/network/overrides/__tests__/resolveOverride.test.d.ts.map +1 -0
- package/lib/typescript/network/overrides/applyToFetch.d.ts +50 -0
- package/lib/typescript/network/overrides/applyToFetch.d.ts.map +1 -0
- package/lib/typescript/network/overrides/applyToXhr.d.ts +43 -0
- package/lib/typescript/network/overrides/applyToXhr.d.ts.map +1 -0
- package/lib/typescript/network/overrides/engine.d.ts +47 -0
- package/lib/typescript/network/overrides/engine.d.ts.map +1 -0
- package/lib/typescript/network/overrides/matchRule.d.ts +22 -0
- package/lib/typescript/network/overrides/matchRule.d.ts.map +1 -0
- package/lib/typescript/network/overrides/overrideRulesStore.d.ts +205 -0
- package/lib/typescript/network/overrides/overrideRulesStore.d.ts.map +1 -0
- package/lib/typescript/network/overrides/presets.d.ts +38 -0
- package/lib/typescript/network/overrides/presets.d.ts.map +1 -0
- package/lib/typescript/network/overrides/resolveOverride.d.ts +46 -0
- package/lib/typescript/network/overrides/resolveOverride.d.ts.map +1 -0
- package/lib/typescript/network/overrides/types.d.ts +169 -0
- package/lib/typescript/network/overrides/types.d.ts.map +1 -0
- package/lib/typescript/network/sync/networkSyncAdapter.d.ts +73 -0
- package/lib/typescript/network/sync/networkSyncAdapter.d.ts.map +1 -1
- package/lib/typescript/network/types/index.d.ts +10 -0
- package/lib/typescript/network/types/index.d.ts.map +1 -1
- package/lib/typescript/network/utils/networkEventStore.d.ts +14 -0
- package/lib/typescript/network/utils/networkEventStore.d.ts.map +1 -1
- package/lib/typescript/network/utils/networkListener.d.ts +3 -0
- package/lib/typescript/network/utils/networkListener.d.ts.map +1 -1
- package/lib/typescript/network/utils/networkSelectionStore.d.ts +117 -0
- package/lib/typescript/network/utils/networkSelectionStore.d.ts.map +1 -0
- package/lib/typescript/preset.d.ts.map +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NetworkListScreen.d.ts","sourceRoot":"","sources":["../../../../src/network/components/NetworkListScreen.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH,OAAO,
|
|
1
|
+
{"version":3,"file":"NetworkListScreen.d.ts","sourceRoot":"","sources":["../../../../src/network/components/NetworkListScreen.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH,OAAO,EAML,KAAK,cAAc,EACpB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AA0J5D,UAAU,sBAAsB;IAC9B,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,OAAO,CAAC;IAChB,MAAM,EAAE,aAAa,CAAC;IACtB,eAAe,EAAE,SAAS,cAAc,EAAE,CAAC;IAC3C,KAAK,EAAE,OAAO,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,wEAAwE;IACxE,YAAY,EAAE,CAAC,KAAK,EAAE,YAAY,KAAK,IAAI,CAAC;IAC5C,cAAc,EAAE,MAAM,IAAI,CAAC;CAC5B;AAED,wBAAgB,iBAAiB,CAAC,EAChC,OAAO,EACP,MAAM,EACN,MAAM,EACN,eAAe,EACf,KAAK,EACL,UAAU,EACV,YAAY,EACZ,cAAc,GACf,EAAE,sBAAsB,sCAuJxB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NetworkModal.d.ts","sourceRoot":"","sources":["../../../../src/network/components/NetworkModal.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"NetworkModal.d.ts","sourceRoot":"","sources":["../../../../src/network/components/NetworkModal.tsx"],"names":[],"mappings":"AAqEA,UAAU,iBAAiB;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,UAAU,CAAC,EAAE,CAAC,UAAU,EAAE,GAAG,KAAK,IAAI,CAAC;IACvC,2BAA2B,CAAC,EAAE,OAAO,CAAC;IACtC;;;;;;;;OAQG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;;;;OAKG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;CAC5C;AAg1BD;;;GAGG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,+BAMpD;AAED,MAAM,WAAW,oBAAoB;IACnC,+EAA+E;IAC/E,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;CAC5C;AAED;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAAC,KAAK,GAAE,oBAAyB,+BAa/D"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Entering one number, without the keyboard eating the screen.
|
|
3
|
+
*
|
|
4
|
+
* The custom status / delay / times fields used to be inline inputs sitting
|
|
5
|
+
* mid-form. Focusing one raises the keyboard, which on a phone covers roughly
|
|
6
|
+
* the bottom half of the tool — including, depending on where you'd scrolled,
|
|
7
|
+
* the field you were typing into and the Save button you needed next.
|
|
8
|
+
*
|
|
9
|
+
* Pinning the panel to the TOP is the fix, and it's the same one
|
|
10
|
+
* `StorageValueEditModal` reached for: a centred panel gets shoved up or
|
|
11
|
+
* covered the moment the field focuses, and a bottom sheet is simply
|
|
12
|
+
* underneath it. At the top it stays put and stays readable.
|
|
13
|
+
*
|
|
14
|
+
* Deliberately not a reuse of that component — this asks for a number and
|
|
15
|
+
* nothing else. It has no type inference, no raw-JSON escape hatch and no
|
|
16
|
+
* shape-preservation rules, so borrowing 400 lines to avoid writing 100 would
|
|
17
|
+
* be the wrong trade.
|
|
18
|
+
*/
|
|
19
|
+
export interface NetworkNumberPromptProps {
|
|
20
|
+
title: string;
|
|
21
|
+
/** Shown under the field — the range or unit, never a sentence. */
|
|
22
|
+
hint?: string;
|
|
23
|
+
/** Current value, or empty when nothing custom is set yet. */
|
|
24
|
+
value?: number;
|
|
25
|
+
placeholder?: string;
|
|
26
|
+
min?: number;
|
|
27
|
+
max?: number;
|
|
28
|
+
/** `null` means "cleared" — the caller decides what that means. */
|
|
29
|
+
onSubmit: (value: number | null) => void;
|
|
30
|
+
onCancel: () => void;
|
|
31
|
+
}
|
|
32
|
+
export declare function NetworkNumberPrompt({ title, hint, value, placeholder, min, max, onSubmit, onCancel, }: NetworkNumberPromptProps): import("react").JSX.Element;
|
|
33
|
+
//# sourceMappingURL=NetworkNumberPrompt.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NetworkNumberPrompt.d.ts","sourceRoot":"","sources":["../../../../src/network/components/NetworkNumberPrompt.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;GAiBG;AAEH,MAAM,WAAW,wBAAwB;IACvC,KAAK,EAAE,MAAM,CAAC;IACd,mEAAmE;IACnE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,8DAA8D;IAC9D,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,mEAAmE;IACnE,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IACzC,QAAQ,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,wBAAgB,mBAAmB,CAAC,EAClC,KAAK,EACL,IAAI,EACJ,KAAK,EACL,WAAsB,EACtB,GAAG,EACH,GAAG,EACH,QAAQ,EACR,QAAQ,GACT,EAAE,wBAAwB,+BAoE1B"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { OverrideRuleDraft } from "../overrides/overrideRulesStore";
|
|
2
|
+
export interface NetworkOverrideEditorProps {
|
|
3
|
+
draft: OverrideRuleDraft;
|
|
4
|
+
onChange: (draft: OverrideRuleDraft) => void;
|
|
5
|
+
onSave: () => void;
|
|
6
|
+
onCancel: () => void;
|
|
7
|
+
saveLabel?: string;
|
|
8
|
+
/**
|
|
9
|
+
* Pad the footer clear of the home indicator.
|
|
10
|
+
*
|
|
11
|
+
* Only true in bottom-sheet mode — a floating window doesn't sit on it, and a
|
|
12
|
+
* desktop panel has no such thing. Same gating the detail stepper uses.
|
|
13
|
+
*/
|
|
14
|
+
applySafeAreaInset?: boolean;
|
|
15
|
+
}
|
|
16
|
+
export declare function NetworkOverrideEditor({ draft, onChange, onSave, onCancel, saveLabel, applySafeAreaInset, }: NetworkOverrideEditorProps): import("react").JSX.Element;
|
|
17
|
+
//# sourceMappingURL=NetworkOverrideEditor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NetworkOverrideEditor.d.ts","sourceRoot":"","sources":["../../../../src/network/components/NetworkOverrideEditor.tsx"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AA+NzE,MAAM,WAAW,0BAA0B;IACzC,KAAK,EAAE,iBAAiB,CAAC;IACzB,QAAQ,EAAE,CAAC,KAAK,EAAE,iBAAiB,KAAK,IAAI,CAAC;IAC7C,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;;OAKG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B;AAED,wBAAgB,qBAAqB,CAAC,EACpC,KAAK,EACL,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,SAAkB,EAClB,kBAA0B,GAC3B,EAAE,0BAA0B,+BAmZ5B"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { OverrideRuleDraft } from "../overrides/overrideRulesStore";
|
|
2
|
+
/**
|
|
3
|
+
* The Override action, in the request-detail header.
|
|
4
|
+
*
|
|
5
|
+
* A labelled word rather than an icon: every other control here is a glyph
|
|
6
|
+
* (back, pin, bookmark) and glyphs are fine for things you already know. This
|
|
7
|
+
* one is the least familiar action in the tool, and "Override" spelled out is
|
|
8
|
+
* the entire explanation.
|
|
9
|
+
*
|
|
10
|
+
* A self-subscribing leaf, for the same two reasons `NetworkDetailPinActions`
|
|
11
|
+
* is one: the modal root stays free of subscriptions, and the selected id is
|
|
12
|
+
* subscribed here so stepping between requests doesn't rebuild the header
|
|
13
|
+
* around a new prop.
|
|
14
|
+
*
|
|
15
|
+
* It lights up while a rule covers the request you're looking at — the same
|
|
16
|
+
* warning tint the OVERRIDDEN strip and the toolbar flask use, because "you are
|
|
17
|
+
* not seeing the truth" is one idea and should look like one.
|
|
18
|
+
*
|
|
19
|
+
* Tapping it goes straight to the Overrides screen with the rule open: a new
|
|
20
|
+
* one prefilled from this request, or the existing one if something already
|
|
21
|
+
* covers it. One destination, so there's never a question of where the thing
|
|
22
|
+
* you just made went.
|
|
23
|
+
*/
|
|
24
|
+
export declare function NetworkOverrideHeaderButton({ onOpen, }: {
|
|
25
|
+
onOpen: (draft: OverrideRuleDraft, ruleId?: string) => void;
|
|
26
|
+
}): import("react").JSX.Element;
|
|
27
|
+
//# sourceMappingURL=NetworkOverrideHeaderButton.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NetworkOverrideHeaderButton.d.ts","sourceRoot":"","sources":["../../../../src/network/components/NetworkOverrideHeaderButton.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AAIzE;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,2BAA2B,CAAC,EAC1C,MAAM,GACP,EAAE;IACD,MAAM,EAAE,CAAC,KAAK,EAAE,iBAAiB,EAAE,MAAM,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;CAC7D,+BA8CA"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Header button for the Overrides screen, and the always-visible "overrides
|
|
3
|
+
* are active" indicator.
|
|
4
|
+
*
|
|
5
|
+
* A self-subscribing LEAF, like the other live header pieces: the rule list
|
|
6
|
+
* changes on its own schedule (every hit bumps a counter) and the modal shell
|
|
7
|
+
* has no business re-rendering for it.
|
|
8
|
+
*
|
|
9
|
+
* The active tint is not decoration. A rule left enabled from yesterday makes
|
|
10
|
+
* the app behave wrongly in a way that looks exactly like a real bug, so the
|
|
11
|
+
* tool has to keep saying so from the top level — Chrome shows the same
|
|
12
|
+
* warning in its Overrides pane for the same reason.
|
|
13
|
+
*/
|
|
14
|
+
export declare function NetworkOverridesButton({ onPress }: {
|
|
15
|
+
onPress: () => void;
|
|
16
|
+
}): import("react").JSX.Element;
|
|
17
|
+
//# sourceMappingURL=NetworkOverridesButton.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NetworkOverridesButton.d.ts","sourceRoot":"","sources":["../../../../src/network/components/NetworkOverridesButton.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;GAYG;AACH,wBAAgB,sBAAsB,CAAC,EAAE,OAAO,EAAE,EAAE;IAAE,OAAO,EAAE,MAAM,IAAI,CAAA;CAAE,+BA4B1E"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { type OverrideRuleDraft } from "../overrides/overrideRulesStore";
|
|
2
|
+
export interface NetworkOverridesScreenProps {
|
|
3
|
+
visible: boolean;
|
|
4
|
+
isPro: boolean;
|
|
5
|
+
onUpgradePress: () => void;
|
|
6
|
+
/**
|
|
7
|
+
* A rule prefilled elsewhere (the request detail's Override action). Adopted
|
|
8
|
+
* once, then handed back via `onPendingConsumed` so re-entering the screen
|
|
9
|
+
* doesn't reopen a stale editor.
|
|
10
|
+
*/
|
|
11
|
+
pendingDraft?: (OverrideRuleDraft & {
|
|
12
|
+
id?: string;
|
|
13
|
+
}) | null;
|
|
14
|
+
onPendingConsumed?: () => void;
|
|
15
|
+
/** Bottom-sheet mode only — see the editor's footer. */
|
|
16
|
+
applySafeAreaInset?: boolean;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Stable-router gate.
|
|
20
|
+
*
|
|
21
|
+
* The screens in `NetworkModal` are rendered as permanent siblings, and the
|
|
22
|
+
* convention there is that a HIDDEN screen must not subscribe to anything.
|
|
23
|
+
* Splitting the body out is how this one honours that: `useOverrideRules`
|
|
24
|
+
* subscribes to a store that ticks while rules are firing, and a hidden screen
|
|
25
|
+
* re-rendering for that would be pure waste. (The header's overrides button is
|
|
26
|
+
* a deliberate exception — it's always visible and its whole job is to react.)
|
|
27
|
+
*/
|
|
28
|
+
export declare function NetworkOverridesScreen(props: NetworkOverridesScreenProps): import("react").JSX.Element | null;
|
|
29
|
+
//# sourceMappingURL=NetworkOverridesScreen.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NetworkOverridesScreen.d.ts","sourceRoot":"","sources":["../../../../src/network/components/NetworkOverridesScreen.tsx"],"names":[],"mappings":"AAWA,OAAO,EAEL,KAAK,iBAAiB,EACvB,MAAM,iCAAiC,CAAC;AAiJzC,MAAM,WAAW,2BAA2B;IAC1C,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,OAAO,CAAC;IACf,cAAc,EAAE,MAAM,IAAI,CAAC;IAC3B;;;;OAIG;IACH,YAAY,CAAC,EAAE,CAAC,iBAAiB,GAAG;QAAE,EAAE,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,GAAG,IAAI,CAAC;IAC5D,iBAAiB,CAAC,EAAE,MAAM,IAAI,CAAC;IAC/B,wDAAwD;IACxD,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B;AAED;;;;;;;;;GASG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,2BAA2B,sCAGxE"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type JsonValue } from "@buoy-gg/shared-ui/dataViewer";
|
|
2
|
+
type Props = {
|
|
3
|
+
editable?: boolean;
|
|
4
|
+
label: string;
|
|
5
|
+
value: JsonValue;
|
|
6
|
+
defaultExpanded?: string[];
|
|
7
|
+
dataPath?: string[];
|
|
8
|
+
itemsDeletable?: boolean;
|
|
9
|
+
dataVersion?: number;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Recursive data explorer component used for both editable and read-only JSON trees inside the
|
|
13
|
+
* React Query dev tools.
|
|
14
|
+
*/
|
|
15
|
+
export default function Explorer({ editable, label, value, defaultExpanded, dataPath, itemsDeletable, dataVersion, }: Props): import("react").JSX.Element;
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=Explorer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Explorer.d.ts","sourceRoot":"","sources":["../../../../../src/network/components/response-editor/Explorer.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAkB,KAAK,SAAS,EAAE,MAAM,+BAA+B,CAAC;AA+O/E,KAAK,KAAK,GAAG;IACX,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,SAAS,CAAC;IACjB,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;IAC3B,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,EAC/B,QAAQ,EACR,KAAK,EACL,KAAK,EACL,eAAe,EACf,QAAQ,EACR,cAAc,EACd,WAAe,GAChB,EAAE,KAAK,+BAwWP"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Deletes nested data by path
|
|
3
|
+
*
|
|
4
|
+
* @param {unknown} oldData Data to be updated
|
|
5
|
+
* @param {Array<string>} deletePath Path to the data to be deleted
|
|
6
|
+
* @returns newData without the deleted items by path
|
|
7
|
+
*/
|
|
8
|
+
export declare const deleteNestedDataByPath: (oldData: unknown, deletePath: string[]) => unknown;
|
|
9
|
+
//# sourceMappingURL=deleteNestedDataByPath.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deleteNestedDataByPath.d.ts","sourceRoot":"","sources":["../../../../../src/network/components/response-editor/deleteNestedDataByPath.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,eAAO,MAAM,sBAAsB,GACjC,SAAS,OAAO,EAChB,YAAY,MAAM,EAAE,KACnB,OAmDF,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { JsonValue } from "@buoy-gg/shared-ui/dataViewer";
|
|
2
|
+
/**
|
|
3
|
+
* What the ported Explorer needs in place of React Query's cache.
|
|
4
|
+
*
|
|
5
|
+
* In the original, every edit ends at
|
|
6
|
+
* `queryClient.setQueryData(activeQuery.queryKey, newData)` and `activeQuery`
|
|
7
|
+
* doubles as the "is this editable" gate — so the whole tree is wired to one
|
|
8
|
+
* specific store. Here that becomes two values in context: the ROOT document
|
|
9
|
+
* (every op rebuilds the whole thing from the root, so each row needs it) and a
|
|
10
|
+
* single `onChange`.
|
|
11
|
+
*
|
|
12
|
+
* Context rather than props because Explorer recurses per node and already
|
|
13
|
+
* threads `activeQuery` down every level; swapping one drilled prop for another
|
|
14
|
+
* would have meant the same plumbing at every call site, and a row deep in a
|
|
15
|
+
* response is exactly where you don't want a missed prop.
|
|
16
|
+
*/
|
|
17
|
+
export interface ResponseEditorContextValue {
|
|
18
|
+
/** The whole body. Ops are computed against this, not the node's own value. */
|
|
19
|
+
root: JsonValue;
|
|
20
|
+
/** Hand back the rebuilt document. */
|
|
21
|
+
onChange: (next: JsonValue) => void;
|
|
22
|
+
}
|
|
23
|
+
export declare const ResponseEditorContext: import("react").Context<ResponseEditorContextValue | null>;
|
|
24
|
+
/**
|
|
25
|
+
* Null outside a provider, which is how the tree stays READ-ONLY by default —
|
|
26
|
+
* the same role `activeQuery === undefined` played in the original.
|
|
27
|
+
*/
|
|
28
|
+
export declare function useResponseEditor(): ResponseEditorContextValue | null;
|
|
29
|
+
//# sourceMappingURL=editorContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"editorContext.d.ts","sourceRoot":"","sources":["../../../../../src/network/components/response-editor/editorContext.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAE/D;;;;;;;;;;;;;;GAcG;AACH,MAAM,WAAW,0BAA0B;IACzC,+EAA+E;IAC/E,IAAI,EAAE,SAAS,CAAC;IAChB,sCAAsC;IACtC,QAAQ,EAAE,CAAC,IAAI,EAAE,SAAS,KAAK,IAAI,CAAC;CACrC;AAED,eAAO,MAAM,qBAAqB,4DACsB,CAAC;AAEzD;;;GAGG;AACH,wBAAgB,iBAAiB,IAAI,0BAA0B,GAAG,IAAI,CAErE"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { JsonValue } from "@buoy-gg/shared-ui/dataViewer";
|
|
2
|
+
/**
|
|
3
|
+
* updates nested data by path
|
|
4
|
+
*
|
|
5
|
+
* @param {JsonValue} oldData Data to be updated
|
|
6
|
+
* @param {Array<string>} updatePath Path to the data to be updated
|
|
7
|
+
* @param {JsonValue} value New value
|
|
8
|
+
*/
|
|
9
|
+
export declare const updateNestedDataByPath: (oldData: JsonValue, updatePath: string[], value: JsonValue) => JsonValue;
|
|
10
|
+
//# sourceMappingURL=updateNestedDataByPath.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"updateNestedDataByPath.d.ts","sourceRoot":"","sources":["../../../../../src/network/components/response-editor/updateNestedDataByPath.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAE/D;;;;;;GAMG;AACH,eAAO,MAAM,sBAAsB,GACjC,SAAS,SAAS,EAClB,YAAY,MAAM,EAAE,EACpB,OAAO,SAAS,KACf,SAiEF,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Narrow subscriptions to the prev/next cursor (`networkSelectionStore`).
|
|
3
|
+
*
|
|
4
|
+
* One hook per consumer, each returning the SMALLEST value that consumer
|
|
5
|
+
* renders — that is the whole point of moving the cursor into a store. The
|
|
6
|
+
* modal root takes `useHasNetworkSelection()` (a boolean that flips twice a
|
|
7
|
+
* session), so a step no longer re-renders `JsModal`, the header and all five
|
|
8
|
+
* screens; the footer and the body take the parts that actually change.
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Is ANYTHING selected — i.e. is the detail screen up?
|
|
12
|
+
*
|
|
13
|
+
* `useSyncExternalStore` compares the selector's result, so the root only
|
|
14
|
+
* re-renders when this boolean flips, not on every step.
|
|
15
|
+
*/
|
|
16
|
+
export declare function useHasNetworkSelection(): boolean;
|
|
17
|
+
/** Where the USER is. Moves synchronously on tap — footer, header pin actions. */
|
|
18
|
+
export declare function useSelectedNetworkEventId(): string | null;
|
|
19
|
+
/** What the BODY may render. Lags `selectedId` — see networkSelectionStore. */
|
|
20
|
+
export declare function useNetworkBodyEventId(): string | null;
|
|
21
|
+
/** Cursor position + list length, for the "REQUEST n OF m" counter. */
|
|
22
|
+
export declare function useNetworkCursor(): {
|
|
23
|
+
index: number;
|
|
24
|
+
total: number;
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=useNetworkSelection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useNetworkSelection.d.ts","sourceRoot":"","sources":["../../../../src/network/hooks/useNetworkSelection.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAaH;;;;;GAKG;AACH,wBAAgB,sBAAsB,IAAI,OAAO,CAMhD;AAED,kFAAkF;AAClF,wBAAgB,yBAAyB,IAAI,MAAM,GAAG,IAAI,CAMzD;AAED,+EAA+E;AAC/E,wBAAgB,qBAAqB,IAAI,MAAM,GAAG,IAAI,CAMrD;AAED,uEAAuE;AACvE,wBAAgB,gBAAgB,IAAI;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAYnE"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { type OverrideRuleDraft, type OverrideRulesState } from "../overrides/overrideRulesStore";
|
|
2
|
+
import type { OverrideRule } from "../overrides/types";
|
|
3
|
+
export interface UseOverrideRulesResult extends OverrideRulesState {
|
|
4
|
+
/** Rules that would actually fire — what the "active" banner counts. */
|
|
5
|
+
activeCount: number;
|
|
6
|
+
setEnabled: (enabled: boolean) => void;
|
|
7
|
+
/**
|
|
8
|
+
* Create or replace a rule. The ONLY write path the UI uses — see
|
|
9
|
+
* `overrideRulesStore.upsertRule`: the add/update primitives don't forward to
|
|
10
|
+
* the device, so calling them from the dashboard would silently do nothing.
|
|
11
|
+
*/
|
|
12
|
+
upsertRule: (draft: OverrideRuleDraft & {
|
|
13
|
+
id?: string;
|
|
14
|
+
}) => OverrideRule | null;
|
|
15
|
+
setRuleEnabled: (id: string, enabled: boolean) => void;
|
|
16
|
+
removeRule: (id: string) => void;
|
|
17
|
+
clearRules: () => void;
|
|
18
|
+
/** Has this rule burned through its `times` budget? */
|
|
19
|
+
isRuleSpent: (rule: OverrideRule) => boolean;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Read + mutate the override rule list.
|
|
23
|
+
*
|
|
24
|
+
* `useSyncExternalStore` over the store's own subscribe/getState, which already
|
|
25
|
+
* hands out a stable state object per mutation (see `rebuild`) — so this can't
|
|
26
|
+
* tear and doesn't need a selector to stay cheap.
|
|
27
|
+
*/
|
|
28
|
+
export declare function useOverrideRules(): UseOverrideRulesResult;
|
|
29
|
+
//# sourceMappingURL=useOverrideRules.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useOverrideRules.d.ts","sourceRoot":"","sources":["../../../../src/network/hooks/useOverrideRules.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACxB,MAAM,iCAAiC,CAAC;AAEzC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEvD,MAAM,WAAW,sBAAuB,SAAQ,kBAAkB;IAChE,wEAAwE;IACxE,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IACvC;;;;OAIG;IACH,UAAU,EAAE,CAAC,KAAK,EAAE,iBAAiB,GAAG;QAAE,EAAE,CAAC,EAAE,MAAM,CAAA;KAAE,KAAK,YAAY,GAAG,IAAI,CAAC;IAChF,cAAc,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IACvD,UAAU,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IACjC,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB,uDAAuD;IACvD,WAAW,EAAE,CAAC,IAAI,EAAE,YAAY,KAAK,OAAO,CAAC;CAC9C;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,IAAI,sBAAsB,CAsCzD"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unit tests for the fetch-side synthesis.
|
|
3
|
+
*
|
|
4
|
+
* This layer exists because of a finding that only showed up on a real device:
|
|
5
|
+
* Expo replaces `globalThis.fetch` with a NATIVE `expo/fetch` (see
|
|
6
|
+
* `expo/src/winter/runtime.native.ts`), so those requests never construct an
|
|
7
|
+
* XMLHttpRequest and an XHR-only override silently does nothing. Verified on
|
|
8
|
+
* Expo SDK 56 / RN 0.85.3.
|
|
9
|
+
*
|
|
10
|
+
* Same self-contained harness as the other tests — see the run command in
|
|
11
|
+
* `resolveOverride.test.ts`. Excluded from the publish build by
|
|
12
|
+
* `tsconfig.build.json`.
|
|
13
|
+
*/
|
|
14
|
+
declare function main(): Promise<void>;
|
|
15
|
+
export { main as runApplyToFetchTests };
|
|
16
|
+
//# sourceMappingURL=applyToFetch.test.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"applyToFetch.test.d.ts","sourceRoot":"","sources":["../../../../../src/network/overrides/__tests__/applyToFetch.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AA2KH,iBAAe,IAAI,kBAsBlB;AAaD,OAAO,EAAE,IAAI,IAAI,oBAAoB,EAAE,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unit tests for the XHR response synthesis, against a faithful clone of React
|
|
3
|
+
* Native's XMLHttpRequest state machine.
|
|
4
|
+
*
|
|
5
|
+
* WHY A CLONE RATHER THAN A MOCK: the interesting behaviour is not "did we set
|
|
6
|
+
* some fields", it's whether RN's own `setReadyState` / `abort` branches then
|
|
7
|
+
* do the right thing — which terminal event fires, and what `abort()` does when
|
|
8
|
+
* `_sent` is or isn't claimed. A mock that just records calls would pass while
|
|
9
|
+
* the real thing hung the app's fetch promise. `FakeRNXhr` below is transcribed
|
|
10
|
+
* from `react-native/Libraries/Network/XMLHttpRequest.js` (verified identical on
|
|
11
|
+
* RN 0.81.4 and 0.85.3), so these assertions are about real semantics.
|
|
12
|
+
*
|
|
13
|
+
* Same self-contained harness as the other tests — see the run command in
|
|
14
|
+
* `resolveOverride.test.ts`. Excluded from the publish build by
|
|
15
|
+
* `tsconfig.build.json`.
|
|
16
|
+
*/
|
|
17
|
+
declare function main(): Promise<void>;
|
|
18
|
+
export { main as runApplyToXhrTests };
|
|
19
|
+
//# sourceMappingURL=applyToXhr.test.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"applyToXhr.test.d.ts","sourceRoot":"","sources":["../../../../../src/network/overrides/__tests__/applyToXhr.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAqYH,iBAAe,IAAI,kBAuBlB;AAaD,OAAO,EAAE,IAAI,IAAI,kBAAkB,EAAE,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unit tests for the override matcher + resolver — the pure half of the
|
|
3
|
+
* feature, and the half worth testing without a device.
|
|
4
|
+
*
|
|
5
|
+
* The glob cases mirror Chrome DevTools' own `escapeRegex` behaviour
|
|
6
|
+
* (`NetworkPersistenceManager.ts:1051`), because these patterns are the same
|
|
7
|
+
* syntax a developer already uses in Chrome's "Override headers" `applyTo`
|
|
8
|
+
* field and must not quietly mean something different here.
|
|
9
|
+
*
|
|
10
|
+
* Same self-contained harness as the perf-monitor tests (no Jest wired up yet);
|
|
11
|
+
* renames to Jest globals later. There is no `tsx` in this repo, so run it with
|
|
12
|
+
* the esbuild that is already here, from the repo root:
|
|
13
|
+
*
|
|
14
|
+
* node_modules/.bin/esbuild <this file> --bundle --platform=node \
|
|
15
|
+
* --format=cjs --outfile=/tmp/t.cjs && node /tmp/t.cjs
|
|
16
|
+
*
|
|
17
|
+
* `__tests__` is excluded from the publish build via `tsconfig.build.json`,
|
|
18
|
+
* so this file ships nowhere — it's developer infrastructure.
|
|
19
|
+
*/
|
|
20
|
+
declare function main(): Promise<void>;
|
|
21
|
+
export { main as runResolveOverrideTests };
|
|
22
|
+
//# sourceMappingURL=resolveOverride.test.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolveOverride.test.d.ts","sourceRoot":"","sources":["../../../../../src/network/overrides/__tests__/resolveOverride.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AA0XH,iBAAe,IAAI,kBAuBlB;AAeD,OAAO,EAAE,IAAI,IAAI,uBAAuB,EAAE,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Perform an override outcome against `fetch`.
|
|
3
|
+
*
|
|
4
|
+
* WHY THIS EXISTS — and why "XHR is the single choke point" is WRONG:
|
|
5
|
+
*
|
|
6
|
+
* In bare React Native, `Libraries/Network/fetch.js` is `require('whatwg-fetch')`,
|
|
7
|
+
* so `fetch` really is a polyfill over XMLHttpRequest and hooking XHR alone
|
|
8
|
+
* would cover everything. But **Expo replaces it**: `expo/src/winter/runtime.native.ts`
|
|
9
|
+
* installs `expo/fetch` — a NATIVE fetch over `ExpoFetchModule` — as
|
|
10
|
+
* `globalThis.fetch` unless `EXPO_PUBLIC_USE_RN_FETCH=1`. Those requests never
|
|
11
|
+
* construct an XMLHttpRequest, so an XHR-only override silently does nothing on
|
|
12
|
+
* the majority of real apps.
|
|
13
|
+
*
|
|
14
|
+
* Verified the hard way on Expo SDK 56 / RN 0.85.3: rule matched, engine
|
|
15
|
+
* healthy, interceptor installed, and the request still came back a real 200.
|
|
16
|
+
*
|
|
17
|
+
* So overrides hook BOTH layers. `axios` still needs the XHR path (it uses
|
|
18
|
+
* XMLHttpRequest on every platform), and this covers `fetch` on both flavours.
|
|
19
|
+
*/
|
|
20
|
+
import type { OverrideOutcome } from "./types";
|
|
21
|
+
export declare const sleep: (ms: number) => Promise<void>;
|
|
22
|
+
/**
|
|
23
|
+
* Can we build a `Response` in this runtime?
|
|
24
|
+
*
|
|
25
|
+
* React Native installs the whatwg-fetch `Response` global via `setUpXHR`, and
|
|
26
|
+
* Expo deliberately keeps it (it only swaps `fetch`). Feature-detected anyway:
|
|
27
|
+
* without it, the honest thing is to let the request run for real.
|
|
28
|
+
*/
|
|
29
|
+
export declare function canSynthesizeResponse(): boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Build the fake `Response` an overridden `fetch` resolves with.
|
|
32
|
+
*
|
|
33
|
+
* Note the status range: whatwg-fetch's `Response` constructor THROWS
|
|
34
|
+
* `RangeError` outside [200, 599], which would crash the caller instead of
|
|
35
|
+
* overriding it. `resolveOverride` clamps before we ever get here.
|
|
36
|
+
*/
|
|
37
|
+
export declare function synthesizeResponse(url: string, outcome: Extract<OverrideOutcome, {
|
|
38
|
+
kind: "respond";
|
|
39
|
+
}>): Response;
|
|
40
|
+
/**
|
|
41
|
+
* The error a failed `fetch` rejects with.
|
|
42
|
+
*
|
|
43
|
+
* These are the exact messages whatwg-fetch produces for a dead connection and
|
|
44
|
+
* a timeout, so app code that string-matches on them (plenty does) behaves the
|
|
45
|
+
* same way it would against a real failure.
|
|
46
|
+
*/
|
|
47
|
+
export declare function synthesizeFetchError(outcome: Extract<OverrideOutcome, {
|
|
48
|
+
kind: "fail";
|
|
49
|
+
}>): Error;
|
|
50
|
+
//# sourceMappingURL=applyToFetch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"applyToFetch.d.ts","sourceRoot":"","sources":["../../../../src/network/overrides/applyToFetch.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE/C,eAAO,MAAM,KAAK,GAAI,IAAI,MAAM,KAAG,OAAO,CAAC,IAAI,CAGxB,CAAC;AAExB;;;;;;GAMG;AACH,wBAAgB,qBAAqB,IAAI,OAAO,CAE/C;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAChC,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,OAAO,CAAC,eAAe,EAAE;IAAE,IAAI,EAAE,SAAS,CAAA;CAAE,CAAC,GACrD,QAAQ,CAeV;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,OAAO,CAAC,eAAe,EAAE;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,GAClD,KAAK,CAMP"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Perform an override outcome against a React Native XMLHttpRequest.
|
|
3
|
+
*
|
|
4
|
+
* WHY THIS IS POSSIBLE AT ALL: React Native's XMLHttpRequest
|
|
5
|
+
* (`react-native/Libraries/Network/XMLHttpRequest.js`) is pure JavaScript.
|
|
6
|
+
* `readyState`, `status`, `responseHeaders` and `responseURL` are plain
|
|
7
|
+
* writable fields, and `setResponseHeaders()` / `setReadyState()` are real
|
|
8
|
+
* methods — `setReadyState(DONE)` dispatches the correct terminal event off
|
|
9
|
+
* internal flags (`_aborted` → abort, `_hasError` + `_timedOut` → timeout,
|
|
10
|
+
* `_hasError` → error, otherwise load; always loadend). So a response can be
|
|
11
|
+
* synthesized end to end without touching native code.
|
|
12
|
+
*
|
|
13
|
+
* WHY XHR IS THE ONLY PLACE WE HOOK: `react-native/Libraries/Network/fetch.js`
|
|
14
|
+
* is `require('whatwg-fetch')` — RN's `fetch` IS the polyfill over
|
|
15
|
+
* XMLHttpRequest. Overriding here therefore covers `fetch`, `axios` and raw
|
|
16
|
+
* XHR through one code path, and the fake response flows back up through the
|
|
17
|
+
* polyfill so the tool records it without any extra plumbing.
|
|
18
|
+
*
|
|
19
|
+
* Verified field-for-field on React Native 0.81.4 and 0.85.3.
|
|
20
|
+
*
|
|
21
|
+
* Four non-obvious behaviours are handled below; each one is a real bug if you
|
|
22
|
+
* skip it, and each is commented at the line that fixes it.
|
|
23
|
+
*/
|
|
24
|
+
import type { OverrideOutcome } from "./types";
|
|
25
|
+
/**
|
|
26
|
+
* Can this XMLHttpRequest be driven by hand?
|
|
27
|
+
*
|
|
28
|
+
* The whole technique rests on RN internals, so it is feature-detected rather
|
|
29
|
+
* than assumed: on a browser XMLHttpRequest (react-native-web) these methods
|
|
30
|
+
* don't exist and `status` is a read-only getter. There, overrides no-op and
|
|
31
|
+
* the request goes out for real — degraded, but never broken.
|
|
32
|
+
*/
|
|
33
|
+
export declare function canSynthesize(xhr: XMLHttpRequest): boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Apply an outcome to a request that has NOT been sent yet.
|
|
36
|
+
*
|
|
37
|
+
* Returns `false` when this environment can't be driven by hand, in which case
|
|
38
|
+
* the caller must send the request normally.
|
|
39
|
+
*
|
|
40
|
+
* @param passThrough Sends the real request. Only used by `kind: "delay"`.
|
|
41
|
+
*/
|
|
42
|
+
export declare function runOverride(xhr: XMLHttpRequest, url: string, outcome: OverrideOutcome, passThrough: () => void): boolean;
|
|
43
|
+
//# sourceMappingURL=applyToXhr.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"applyToXhr.d.ts","sourceRoot":"","sources":["../../../../src/network/overrides/applyToXhr.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAkC/C;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAM1D;AA+ED;;;;;;;GAOG;AACH,wBAAgB,WAAW,CACzB,GAAG,EAAE,cAAc,EACnB,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,eAAe,EACxB,WAAW,EAAE,MAAM,IAAI,GACtB,OAAO,CAiET"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The seam between the interceptor and the rule store.
|
|
3
|
+
*
|
|
4
|
+
* It exists to keep the import graph acyclic: `networkListener` needs rules,
|
|
5
|
+
* and the rule store needs the listener (to keep the swizzle installed while a
|
|
6
|
+
* rule is active). Rather than have them import each other, the store REGISTERS
|
|
7
|
+
* itself here and the listener asks here. Both sides import only this leaf.
|
|
8
|
+
*
|
|
9
|
+
* It's also the single place the production gate lives — see `overrideForRequest`.
|
|
10
|
+
*/
|
|
11
|
+
import type { OverrideOutcome, OverrideRule } from "./types";
|
|
12
|
+
export interface OverrideHooks {
|
|
13
|
+
getRules: () => readonly OverrideRule[];
|
|
14
|
+
/** The rule APPLIED to a request. */
|
|
15
|
+
recordHit: (ruleId: string) => void;
|
|
16
|
+
/**
|
|
17
|
+
* The rule MATCHED a request, whether or not it applied.
|
|
18
|
+
*
|
|
19
|
+
* `alternate` needs this: a rule that only counted the requests it overrode
|
|
20
|
+
* would never advance past its off phase, so it would skip forever.
|
|
21
|
+
*/
|
|
22
|
+
recordMatch: (ruleId: string) => void;
|
|
23
|
+
}
|
|
24
|
+
export declare function setOverrideHooks(next: OverrideHooks | null): void;
|
|
25
|
+
/**
|
|
26
|
+
* Diagnostics for the sync adapter's `debugOverrides` action.
|
|
27
|
+
*
|
|
28
|
+
* Reads the engine's own view of the world — crucially `hooks`, which is
|
|
29
|
+
* MODULE state here: if the interceptor and the rule store ever ended up with
|
|
30
|
+
* separate copies of this file, this is the only place that shows it.
|
|
31
|
+
*/
|
|
32
|
+
export declare function inspectEngine(url: string, method: string): {
|
|
33
|
+
hooksInstalled: boolean;
|
|
34
|
+
devFlag: string | boolean;
|
|
35
|
+
ruleCount: number;
|
|
36
|
+
matches: boolean;
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Resolve an override for one outgoing request, recording the hit.
|
|
40
|
+
*
|
|
41
|
+
* NEVER ACTIVE IN A PRODUCTION BUILD. A shipped app that synthesizes 500s or
|
|
42
|
+
* silently swallows requests is a catastrophe of a different order than a
|
|
43
|
+
* broken dev tool, so the gate is here — at the single entry point — rather
|
|
44
|
+
* than trusted to every call site.
|
|
45
|
+
*/
|
|
46
|
+
export declare function overrideForRequest(url: string, method: string): OverrideOutcome | null;
|
|
47
|
+
//# sourceMappingURL=engine.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"engine.d.ts","sourceRoot":"","sources":["../../../../src/network/overrides/engine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAOH,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE7D,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,MAAM,SAAS,YAAY,EAAE,CAAC;IACxC,qCAAqC;IACrC,SAAS,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACpC;;;;;OAKG;IACH,WAAW,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;CACvC;AAID,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,aAAa,GAAG,IAAI,GAAG,IAAI,CAEjE;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;;;;;EAWxD;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAChC,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,MAAM,GACb,eAAe,GAAG,IAAI,CAqBxB"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Glob matching for override rules — a faithful port of Chrome DevTools'.
|
|
3
|
+
*
|
|
4
|
+
* Ported from `NetworkPersistenceManager.ts:1051` + `StringUtilities.ts:9` in
|
|
5
|
+
* the devtools-frontend source. Ported rather than reinvented on purpose: `*`
|
|
6
|
+
* globs are the syntax developers already have in their fingers from Chrome's
|
|
7
|
+
* "Override headers" `applyTo` field, and a pattern that behaves differently
|
|
8
|
+
* here than it does in the browser would be a quiet trap.
|
|
9
|
+
*/
|
|
10
|
+
import type { OverrideRule } from "./types";
|
|
11
|
+
/**
|
|
12
|
+
* Escape a glob into regex source: neutralize regex metacharacters, then
|
|
13
|
+
* promote `*` to `.*`.
|
|
14
|
+
*
|
|
15
|
+
* `split`/`join` rather than `replaceAll` — same result, no reliance on how
|
|
16
|
+
* complete a given Hermes build's ES2021 surface is.
|
|
17
|
+
*/
|
|
18
|
+
export declare function escapeRegex(pattern: string): string;
|
|
19
|
+
export declare function compilePattern(pattern: string): RegExp;
|
|
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;
|
|
22
|
+
//# sourceMappingURL=matchRule.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"matchRule.d.ts","sourceRoot":"","sources":["../../../../src/network/overrides/matchRule.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAU5C;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAUnD;AAWD,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAatD;AAED,kFAAkF;AAClF,wBAAgB,WAAW,CACzB,IAAI,EAAE,YAAY,EAClB,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,MAAM,GACb,OAAO,CAWT"}
|