@buoy-gg/redux 7.0.4 → 7.0.6

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.
Files changed (46) hide show
  1. package/README.md +21 -2
  2. package/lib/commonjs/index.js +44 -0
  3. package/lib/commonjs/redux/components/ReduxAutoInstrument.js +20 -0
  4. package/lib/commonjs/redux/components/ReduxModal.js +123 -68
  5. package/lib/commonjs/redux/components/index.js +8 -1
  6. package/lib/commonjs/redux/hooks/useAutoInstrumentRedux.js +32 -42
  7. package/lib/commonjs/redux/sync/reduxSyncAdapter.js +27 -8
  8. package/lib/commonjs/redux/utils/activeStoreRegistry.js +73 -0
  9. package/lib/commonjs/redux/utils/autoInstrument.js +88 -114
  10. package/lib/commonjs/redux/utils/buoyReduxMiddleware.js +20 -15
  11. package/lib/commonjs/redux/utils/devtoolsHook.js +137 -0
  12. package/lib/commonjs/redux/utils/index.js +32 -1
  13. package/lib/module/index.js +29 -4
  14. package/lib/module/redux/components/ReduxAutoInstrument.js +17 -0
  15. package/lib/module/redux/components/ReduxModal.js +122 -68
  16. package/lib/module/redux/components/index.js +2 -1
  17. package/lib/module/redux/hooks/useAutoInstrumentRedux.js +33 -43
  18. package/lib/module/redux/sync/reduxSyncAdapter.js +28 -9
  19. package/lib/module/redux/utils/activeStoreRegistry.js +63 -0
  20. package/lib/module/redux/utils/autoInstrument.js +82 -113
  21. package/lib/module/redux/utils/buoyReduxMiddleware.js +20 -15
  22. package/lib/module/redux/utils/devtoolsHook.js +130 -0
  23. package/lib/module/redux/utils/index.js +3 -1
  24. package/lib/typescript/index.d.ts +19 -5
  25. package/lib/typescript/index.d.ts.map +1 -1
  26. package/lib/typescript/redux/components/ReduxAutoInstrument.d.ts +11 -0
  27. package/lib/typescript/redux/components/ReduxAutoInstrument.d.ts.map +1 -0
  28. package/lib/typescript/redux/components/ReduxModal.d.ts +15 -1
  29. package/lib/typescript/redux/components/ReduxModal.d.ts.map +1 -1
  30. package/lib/typescript/redux/components/index.d.ts +1 -0
  31. package/lib/typescript/redux/components/index.d.ts.map +1 -1
  32. package/lib/typescript/redux/hooks/useAutoInstrumentRedux.d.ts +16 -28
  33. package/lib/typescript/redux/hooks/useAutoInstrumentRedux.d.ts.map +1 -1
  34. package/lib/typescript/redux/sync/reduxSyncAdapter.d.ts +18 -4
  35. package/lib/typescript/redux/sync/reduxSyncAdapter.d.ts.map +1 -1
  36. package/lib/typescript/redux/utils/activeStoreRegistry.d.ts +47 -0
  37. package/lib/typescript/redux/utils/activeStoreRegistry.d.ts.map +1 -0
  38. package/lib/typescript/redux/utils/autoInstrument.d.ts +46 -23
  39. package/lib/typescript/redux/utils/autoInstrument.d.ts.map +1 -1
  40. package/lib/typescript/redux/utils/buoyReduxMiddleware.d.ts +5 -1
  41. package/lib/typescript/redux/utils/buoyReduxMiddleware.d.ts.map +1 -1
  42. package/lib/typescript/redux/utils/devtoolsHook.d.ts +45 -0
  43. package/lib/typescript/redux/utils/devtoolsHook.d.ts.map +1 -0
  44. package/lib/typescript/redux/utils/index.d.ts +3 -2
  45. package/lib/typescript/redux/utils/index.d.ts.map +1 -1
  46. package/package.json +8 -5
@@ -1,29 +1,20 @@
1
1
  /**
2
2
  * React hook for auto-instrumenting Redux stores
3
3
  *
4
- * This hook automatically patches the Redux store when the component mounts,
5
- * providing zero-config action capture for the Redux DevTools.
4
+ * Mounted for the app's lifetime by FloatingDevTools (via ReduxAutoInstrument)
5
+ * and also called by the Redux modal. Binds Buoy to the store from react-redux
6
+ * context:
7
+ * - If the store was created through the devtools-hook enhancer, capture is
8
+ * already live — this just keeps the registry pointed at it.
9
+ * - Otherwise it applies the dispatch-patch fallback (top-level-only capture).
10
+ * - If react-redux is missing or there's no Provider above, it fails
11
+ * gracefully and records WHY (surfaced by the sync adapter / MCP).
6
12
  *
7
- * Usage:
8
- * - The hook attempts to use react-redux's useStore() to get the store
9
- * - If successful, it instruments the store automatically
10
- * - If react-redux is not available or not in a Provider, it fails gracefully
11
- *
12
- * @example
13
- * ```tsx
14
- * function ReduxDevTools() {
15
- * const { isInstrumented, error } = useAutoInstrumentRedux();
16
- *
17
- * if (error) {
18
- * return <Text>Redux not available: {error}</Text>;
19
- * }
20
- *
21
- * return <ReduxActionList />;
22
- * }
23
- * ```
13
+ * Re-instruments when the store INSTANCE changes (hosts that rebuild their
14
+ * store at runtime), so the registry never pins a dead store.
24
15
  */
25
16
  import type { Store } from "@reduxjs/toolkit";
26
- import { type AutoInstrumentOptions } from "../utils/autoInstrument";
17
+ import { type AutoInstrumentOptions, type CaptureMechanism } from "../utils/autoInstrument";
27
18
  export interface UseAutoInstrumentReduxOptions extends AutoInstrumentOptions {
28
19
  /** Whether to auto-start instrumentation (default: true) */
29
20
  autoStart?: boolean;
@@ -37,6 +28,11 @@ export interface UseAutoInstrumentReduxResult {
37
28
  error: string | null;
38
29
  /** Whether react-redux is available */
39
30
  isReactReduxAvailable: boolean;
31
+ /**
32
+ * Which capture path is live: 'enhancer' | 'middleware' (full capture) or
33
+ * 'patch' (top-level-only), null when nothing is bound yet.
34
+ */
35
+ captureMechanism: CaptureMechanism | null;
40
36
  /** Manually start instrumentation */
41
37
  startInstrumentation: () => void;
42
38
  /** Manually stop instrumentation */
@@ -44,14 +40,6 @@ export interface UseAutoInstrumentReduxResult {
44
40
  /** Reference to the instrumented store */
45
41
  store: Store | null;
46
42
  }
47
- /**
48
- * Hook to automatically instrument Redux store for DevTools
49
- *
50
- * This provides zero-config Redux action capture by:
51
- * 1. Using react-redux's useStore() to get the Redux store
52
- * 2. Automatically patching store.dispatch to capture actions
53
- * 3. Cleaning up when the component unmounts
54
- */
55
43
  export declare function useAutoInstrumentRedux(options?: UseAutoInstrumentReduxOptions): UseAutoInstrumentReduxResult;
56
44
  /**
57
45
  * Lightweight hook to just check if Redux is available
@@ -1 +1 @@
1
- {"version":3,"file":"useAutoInstrumentRedux.d.ts","sourceRoot":"","sources":["../../../../src/redux/hooks/useAutoInstrumentRedux.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAGH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAIL,KAAK,qBAAqB,EAC3B,MAAM,yBAAyB,CAAC;AAyBjC,MAAM,WAAW,6BAA8B,SAAQ,qBAAqB;IAC1E,4DAA4D;IAC5D,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,4BAA4B;IAC3C,kDAAkD;IAClD,cAAc,EAAE,OAAO,CAAC;IACxB,6CAA6C;IAC7C,SAAS,EAAE,OAAO,CAAC;IACnB,8CAA8C;IAC9C,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,uCAAuC;IACvC,qBAAqB,EAAE,OAAO,CAAC;IAC/B,qCAAqC;IACrC,oBAAoB,EAAE,MAAM,IAAI,CAAC;IACjC,oCAAoC;IACpC,mBAAmB,EAAE,MAAM,IAAI,CAAC;IAChC,0CAA0C;IAC1C,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;CACrB;AAMD;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CACpC,OAAO,GAAE,6BAAkC,GAC1C,4BAA4B,CA2G9B;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,IAAI;IACtC,WAAW,EAAE,OAAO,CAAC;IACrB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CACtB,CA0BA"}
1
+ {"version":3,"file":"useAutoInstrumentRedux.d.ts","sourceRoot":"","sources":["../../../../src/redux/hooks/useAutoInstrumentRedux.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAIL,KAAK,qBAAqB,EAC1B,KAAK,gBAAgB,EACtB,MAAM,yBAAyB,CAAC;AA0BjC,MAAM,WAAW,6BAA8B,SAAQ,qBAAqB;IAC1E,4DAA4D;IAC5D,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,4BAA4B;IAC3C,kDAAkD;IAClD,cAAc,EAAE,OAAO,CAAC;IACxB,6CAA6C;IAC7C,SAAS,EAAE,OAAO,CAAC;IACnB,8CAA8C;IAC9C,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,uCAAuC;IACvC,qBAAqB,EAAE,OAAO,CAAC;IAC/B;;;OAGG;IACH,gBAAgB,EAAE,gBAAgB,GAAG,IAAI,CAAC;IAC1C,qCAAqC;IACrC,oBAAoB,EAAE,MAAM,IAAI,CAAC;IACjC,oCAAoC;IACpC,mBAAmB,EAAE,MAAM,IAAI,CAAC;IAChC,0CAA0C;IAC1C,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;CACrB;AAMD,wBAAgB,sBAAsB,CACpC,OAAO,GAAE,6BAAkC,GAC1C,4BAA4B,CAkH9B;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,IAAI;IACtC,WAAW,EAAE,OAAO,CAAC;IACrB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CACtB,CA0BA"}
@@ -3,9 +3,11 @@
3
3
  * `useExternalSync` (structurally matches its ToolSyncAdapter interface so
4
4
  * this package doesn't need a dependency on it).
5
5
  *
6
- * Actions are captured by the auto-instrumentation middleware (installed when
7
- * FloatingDevTools mounts), independent of whether a dashboard is watching —
8
- * subscribing here only streams what the store already records.
6
+ * Actions are captured from app startup — by the store-creation enhancer or
7
+ * the explicit middleware (full capture), or by the dispatch-patch fallback
8
+ * mounted with FloatingDevTools (top-level-only) — independent of whether a
9
+ * dashboard is watching. Subscribing here only streams what's already
10
+ * recorded.
9
11
  *
10
12
  * `getState`/`dispatch` read & drive the live instrumented store (via
11
13
  * getActiveStore()) so a remote driver (MCP/LLM) can inspect current state and
@@ -23,12 +25,24 @@ export declare const reduxSyncAdapter: {
23
25
  * the full state tree only when `includeValues` is set (heavy).
24
26
  */
25
27
  getState: (params: unknown) => {
26
- state?: any;
28
+ available: false;
29
+ slices: string[];
30
+ /** 'no-react-redux' | 'no-provider' | 'not-instrumented' */
31
+ reason: string;
32
+ } | {
33
+ state?: unknown;
27
34
  available: boolean;
28
35
  slices: string[];
36
+ /** 'full' | 'top-level-only' — what the live capture mechanism sees. */
37
+ capture: "full" | "top-level-only" | "none";
38
+ mechanism: import("..").CaptureMechanism | null;
29
39
  };
30
40
  /** Dispatch a plain action object to the instrumented store. */
31
41
  dispatch: (params: unknown) => {
42
+ available: false;
43
+ slices: string[];
44
+ /** 'no-react-redux' | 'no-provider' | 'not-instrumented' */
45
+ reason: string;
32
46
  dispatched: boolean;
33
47
  type?: undefined;
34
48
  } | {
@@ -1 +1 @@
1
- {"version":3,"file":"reduxSyncAdapter.d.ts","sourceRoot":"","sources":["../../../../src/redux/sync/reduxSyncAdapter.ts"],"names":[],"mappings":"AAoBA;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,gBAAgB;;;0BAGL,MAAM,IAAI;;;QAK9B;;;WAGG;2BACgB,OAAO;;;;;QAc1B,gEAAgE;2BAC7C,OAAO;;;;;;;;CAU7B,CAAC"}
1
+ {"version":3,"file":"reduxSyncAdapter.d.ts","sourceRoot":"","sources":["../../../../src/redux/sync/reduxSyncAdapter.ts"],"names":[],"mappings":"AAsCA;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,gBAAgB;;;0BAGL,MAAM,IAAI;;;QAK9B;;;WAGG;2BACgB,OAAO;;oBAlCZ,MAAM,EAAE;YACtB,4DAA4D;;;;;;YA6CxD,wEAAwE;;;;QAM5E,gEAAgE;2BAC7C,OAAO;;oBArDZ,MAAM,EAAE;YACtB,4DAA4D;;;;;;;;;CA8D/D,CAAC"}
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Shared registry for the one live Redux store Buoy is bound to, plus how it
3
+ * got bound (the capture mechanism) and why binding failed when it did.
4
+ *
5
+ * Lives in its own module so the three capture paths (devtools-hook enhancer,
6
+ * explicit middleware, dispatch-patch fallback) and the sync adapter can all
7
+ * import it without cycles.
8
+ */
9
+ /** The minimum store surface Buoy needs (middleware storeApi satisfies this). */
10
+ export interface ActiveReduxStore {
11
+ getState: () => unknown;
12
+ dispatch: (action: any) => unknown;
13
+ }
14
+ /**
15
+ * How the store got instrumented:
16
+ * - `enhancer` — store-creation-time enhancer via the Redux DevTools global.
17
+ * FULL capture (thunk-internal & RTK Query actions included).
18
+ * - `middleware` — user-added buoyReduxMiddleware. FULL capture.
19
+ * - `patch` — store.dispatch patched after creation (auto-instrumentation
20
+ * fallback). TOP-LEVEL-ONLY capture: actions dispatched from
21
+ * inside middleware/thunks bypass the patch.
22
+ */
23
+ export type CaptureMechanism = "enhancer" | "middleware" | "patch";
24
+ /** Why there is no bound store, when there isn't one. */
25
+ export type ReduxDiagnostic = "no-react-redux" | "no-provider" | null;
26
+ /** Marks stores created through the Buoy devtools-hook enhancer. */
27
+ export declare const ENHANCER_SYMBOL: unique symbol;
28
+ export declare function registerActiveStore(store: ActiveReduxStore, mech: CaptureMechanism): void;
29
+ export declare function unregisterActiveStore(store: ActiveReduxStore): void;
30
+ export declare function getActiveStore(): ActiveReduxStore | null;
31
+ export declare function getCaptureMechanism(): CaptureMechanism | null;
32
+ /**
33
+ * Recorded by the auto-instrument hook so non-React surfaces (sync adapter,
34
+ * MCP) can report WHY there's no store instead of a generic failure.
35
+ */
36
+ export declare function setReduxDiagnostic(d: ReduxDiagnostic): void;
37
+ export interface InstrumentationStatus {
38
+ /** Which capture path bound the store, or null when none has. */
39
+ mechanism: CaptureMechanism | null;
40
+ /** What the bound mechanism can see. */
41
+ capture: "full" | "top-level-only" | "none";
42
+ hasStore: boolean;
43
+ /** Why there's no store, when known (from the auto-instrument hook). */
44
+ diagnostic: ReduxDiagnostic;
45
+ }
46
+ export declare function getInstrumentationStatus(): InstrumentationStatus;
47
+ //# sourceMappingURL=activeStoreRegistry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"activeStoreRegistry.d.ts","sourceRoot":"","sources":["../../../../src/redux/utils/activeStoreRegistry.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,iFAAiF;AACjF,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,MAAM,OAAO,CAAC;IAIxB,QAAQ,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,OAAO,CAAC;CACpC;AAED;;;;;;;;GAQG;AACH,MAAM,MAAM,gBAAgB,GAAG,UAAU,GAAG,YAAY,GAAG,OAAO,CAAC;AAEnE,yDAAyD;AACzD,MAAM,MAAM,eAAe,GAAG,gBAAgB,GAAG,aAAa,GAAG,IAAI,CAAC;AAEtE,oEAAoE;AACpE,eAAO,MAAM,eAAe,eAA4C,CAAC;AAMzE,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,gBAAgB,EACvB,IAAI,EAAE,gBAAgB,GACrB,IAAI,CAIN;AAED,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,gBAAgB,GAAG,IAAI,CAKnE;AAED,wBAAgB,cAAc,IAAI,gBAAgB,GAAG,IAAI,CAExD;AAED,wBAAgB,mBAAmB,IAAI,gBAAgB,GAAG,IAAI,CAE7D;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,eAAe,GAAG,IAAI,CAE3D;AAED,MAAM,WAAW,qBAAqB;IACpC,iEAAiE;IACjE,SAAS,EAAE,gBAAgB,GAAG,IAAI,CAAC;IACnC,wCAAwC;IACxC,OAAO,EAAE,MAAM,GAAG,gBAAgB,GAAG,MAAM,CAAC;IAC5C,QAAQ,EAAE,OAAO,CAAC;IAClB,wEAAwE;IACxE,UAAU,EAAE,eAAe,CAAC;CAC7B;AAED,wBAAgB,wBAAwB,IAAI,qBAAqB,CAYhE"}
@@ -1,16 +1,26 @@
1
1
  /**
2
- * Auto-instrumentation for Redux stores
2
+ * Fallback auto-instrumentation for Redux stores.
3
3
  *
4
- * This module provides zero-config Redux DevTools integration by automatically
5
- * patching the store's dispatch method when the DevTools component mounts.
4
+ * The PRIMARY capture path is the store-creation-time enhancer in
5
+ * devtoolsHook.ts (full capture, real time travel). This module is the
6
+ * fallback for stores created before our module loaded: it patches
7
+ * store.dispatch after the fact.
6
8
  *
7
- * Similar to how @buoy-gg/network patches globalThis.fetch, this patches
8
- * store.dispatch to capture all Redux actions without requiring manual
9
- * middleware configuration.
9
+ * Fallback limitation (inherent to patching, verified against redux 5.x):
10
+ * `middlewareAPI.dispatch` is a separate closure from `store.dispatch`, so
11
+ * actions dispatched from INSIDE middleware/thunks (RTK pending/fulfilled/
12
+ * rejected, RTK Query) bypass the patch. That's why this mechanism reports
13
+ * capture as "top-level-only" — see activeStoreRegistry.getInstrumentationStatus.
10
14
  */
11
15
  import type { Store, UnknownAction } from "@reduxjs/toolkit";
16
+ import { type ActiveReduxStore } from "./activeStoreRegistry";
17
+ export { getInstrumentationStatus, type InstrumentationStatus, type CaptureMechanism, } from "./activeStoreRegistry";
12
18
  export interface AutoInstrumentOptions {
13
- /** Enable time-travel support (requires replaceReducer) */
19
+ /**
20
+ * @deprecated No longer does anything. Time travel is real on the enhancer
21
+ * path (zero-config) and via `withBuoyDevTools` on the middleware path; the
22
+ * old patch-path implementation could corrupt host stores and was removed.
23
+ */
14
24
  enableTimeTravel?: boolean;
15
25
  /** Maximum number of actions to store */
16
26
  maxActions?: number;
@@ -18,29 +28,42 @@ export interface AutoInstrumentOptions {
18
28
  ignoreActions?: string[];
19
29
  }
20
30
  /**
21
- * Check if a store has already been instrumented
31
+ * Check if a store has already been instrumented (either mechanism)
22
32
  */
23
33
  export declare function isStoreInstrumented(store: Store): boolean;
24
34
  /**
25
- * Instrument a Redux store for action capture
35
+ * Instrument a Redux store for action capture (fallback path).
26
36
  *
27
- * This function patches store.dispatch to capture all actions without
28
- * requiring the user to configure middleware manually.
37
+ * Patches store.dispatch to capture top-level dispatches. No-ops (but still
38
+ * registers the store for getState/dispatch) when the enhancer or the
39
+ * explicit middleware is already capturing.
29
40
  *
30
- * @param store - The Redux store to instrument
31
- * @param options - Configuration options
32
41
  * @returns Cleanup function to restore original dispatch
33
42
  */
34
43
  export declare function instrumentStore(store: Store, options?: AutoInstrumentOptions): () => void;
35
44
  /**
36
- * Remove instrumentation from a store
45
+ * Remove dispatch-patch instrumentation from a store.
46
+ *
47
+ * Only restores the patched dispatch. (This used to also replaceReducer with a
48
+ * synthetic reducer that froze the host store permanently — that path is gone.)
49
+ * Enhancer-created stores are left untouched apart from the registry.
37
50
  */
38
51
  export declare function uninstrumentStore(store: Store): void;
39
52
  /**
40
- * Jump to a specific state (time-travel)
53
+ * Manually register a store with Buoy — the escape hatch for apps that can't
54
+ * render FloatingDevTools inside a react-redux Provider (or don't use
55
+ * react-redux at all). Instruments via the fallback dispatch patch.
56
+ *
57
+ * Prefer the zero-config paths; this exists so no app is ever stuck.
58
+ */
59
+ export declare function registerReduxStore(store: Store, options?: AutoInstrumentOptions): () => void;
60
+ /**
61
+ * Jump to a specific state (time-travel).
41
62
  *
42
- * For full time-travel support, users should use withBuoyDevTools.
43
- * This limited version attempts to work with auto-instrumentation.
63
+ * Real on the enhancer path (reducer is wrapped from creation) and on the
64
+ * middleware path when the app used `withBuoyDevTools`. On the bare patch
65
+ * path there's no reducer wrapper, so the jump action is ignored — we detect
66
+ * that and warn once instead of pretending it worked.
44
67
  */
45
68
  export declare function jumpToState(state: unknown): void;
46
69
  /**
@@ -48,15 +71,15 @@ export declare function jumpToState(state: unknown): void;
48
71
  */
49
72
  export declare function replayAction(action: UnknownAction): void;
50
73
  /**
51
- * Get the currently active (instrumented) store
74
+ * Get the currently active (instrumented) store.
75
+ *
76
+ * NOTE: on the middleware path this is the middleware `storeApi`
77
+ * ({getState, dispatch}) rather than the full Store object — every consumer
78
+ * in this package only needs those two.
52
79
  */
53
- export declare function getActiveStore(): Store | null;
80
+ export declare function getActiveStore(): ActiveReduxStore | null;
54
81
  /**
55
82
  * Check if auto-instrumentation is active
56
83
  */
57
84
  export declare function isAutoInstrumentActive(): boolean;
58
- /**
59
- * Check if time-travel support is enabled
60
- */
61
- export declare function isTimeTravelEnabled(): boolean;
62
85
  //# sourceMappingURL=autoInstrument.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"autoInstrument.d.ts","sourceRoot":"","sources":["../../../../src/redux/utils/autoInstrument.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,aAAa,EAAW,MAAM,kBAAkB,CAAC;AAiCtE,MAAM,WAAW,qBAAqB;IACpC,2DAA2D;IAC3D,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,yCAAyC;IACzC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,6BAA6B;IAC7B,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;CAC1B;AAMD;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAEzD;AAED;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAC7B,KAAK,EAAE,KAAK,EACZ,OAAO,GAAE,qBAA0B,GAClC,MAAM,IAAI,CAuFZ;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CA6BpD;AAwCD;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAMhD;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,aAAa,GAAG,IAAI,CAMxD;AAED;;GAEG;AACH,wBAAgB,cAAc,IAAI,KAAK,GAAG,IAAI,CAE7C;AAED;;GAEG;AACH,wBAAgB,sBAAsB,IAAI,OAAO,CAEhD;AAED;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,OAAO,CAE7C"}
1
+ {"version":3,"file":"autoInstrument.d.ts","sourceRoot":"","sources":["../../../../src/redux/utils/autoInstrument.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAG7D,OAAO,EAKL,KAAK,gBAAgB,EACtB,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EACL,wBAAwB,EACxB,KAAK,qBAAqB,EAC1B,KAAK,gBAAgB,GACtB,MAAM,uBAAuB,CAAC;AAsB/B,MAAM,WAAW,qBAAqB;IACpC;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,yCAAyC;IACzC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,6BAA6B;IAC7B,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;CAC1B;AAMD;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAGzD;AAED;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAC7B,KAAK,EAAE,KAAK,EACZ,OAAO,GAAE,qBAA0B,GAClC,MAAM,IAAI,CAuFZ;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAapD;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,KAAK,EACZ,OAAO,GAAE,qBAA0B,GAClC,MAAM,IAAI,CAEZ;AASD;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAoBhD;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,aAAa,GAAG,IAAI,CAOxD;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,IAAI,gBAAgB,GAAG,IAAI,CAExD;AAED;;GAEG;AACH,wBAAgB,sBAAsB,IAAI,OAAO,CAEhD"}
@@ -23,7 +23,11 @@ export declare function isMiddlewareActive(): boolean;
23
23
  export declare const BUOY_JUMP_TO_STATE = "@@buoy/JUMP_TO_STATE";
24
24
  export declare const BUOY_REPLAY_ACTION = "@@buoy/REPLAY_ACTION";
25
25
  /**
26
- * Jump to a specific state (time-travel)
26
+ * Jump to a specific state (time-travel).
27
+ *
28
+ * Registry-backed, so it works on EVERY capture path (enhancer, middleware,
29
+ * patch) — previously this only worked when the middleware was installed,
30
+ * which silently broke the modal's Jump button on the zero-config path.
27
31
  */
28
32
  export declare function jumpToState(state: unknown): void;
29
33
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"buoyReduxMiddleware.d.ts","sourceRoot":"","sources":["../../../../src/redux/utils/buoyReduxMiddleware.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAC3E,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,UAAU,CAAC;AAU3D;;;GAGG;AACH,wBAAgB,kBAAkB,IAAI,OAAO,CAE5C;AAMD,eAAO,MAAM,kBAAkB,yBAAyB,CAAC;AACzD,eAAO,MAAM,kBAAkB,yBAAyB,CAAC;AAiBzD;;GAEG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAMhD;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,aAAa,GAAG,IAAI,CAOxD;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAWnE;AAED;;GAEG;AACH,eAAO,MAAM,mBAAmB,EAAE,UA0BjC,CAAC;AAEF;;GAEG;AACH,wBAAgB,yBAAyB,CACvC,OAAO,GAAE,0BAA+B,GACvC,UAAU,CAoCZ"}
1
+ {"version":3,"file":"buoyReduxMiddleware.d.ts","sourceRoot":"","sources":["../../../../src/redux/utils/buoyReduxMiddleware.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAC3E,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,UAAU,CAAC;AAc3D;;;GAGG;AACH,wBAAgB,kBAAkB,IAAI,OAAO,CAE5C;AAMD,eAAO,MAAM,kBAAkB,yBAAyB,CAAC;AACzD,eAAO,MAAM,kBAAkB,yBAAyB,CAAC;AAczD;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAOhD;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,aAAa,GAAG,IAAI,CAOxD;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAWnE;AAED;;GAEG;AACH,eAAO,MAAM,mBAAmB,EAAE,UA4BjC,CAAC;AAEF;;GAEG;AACH,wBAAgB,yBAAyB,CACvC,OAAO,GAAE,0BAA+B,GACvC,UAAU,CAoCZ"}
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Store-creation-time capture via the OFFICIAL Redux DevTools hook.
3
+ *
4
+ * `configureStore` defaults `devTools: true` and, at RTK module-evaluation
5
+ * time, snapshots `window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__` if defined.
6
+ * That global doesn't exist in React Native — so Buoy claims it (dev builds
7
+ * only, and only when nothing else has). This makes Buoy a real store
8
+ * ENHANCER, present from the store's birth:
9
+ *
10
+ * - FULL capture: actions dispatched from inside middleware/thunks (RTK
11
+ * `pending`/`fulfilled`/`rejected`, RTK Query) hit our dispatch because the
12
+ * enhancer sits BELOW applyMiddleware in the compose chain.
13
+ * - Real time travel: we wrap the reducer, so BUOY_JUMP_TO_STATE actually
14
+ * jumps — and replaceReducer is re-wrapped, so hosts that inject reducers
15
+ * dynamically keep working.
16
+ * - Nothing is monkey-patched: this is the integration point Redux itself
17
+ * ships for devtools (same one react-native-debugger used).
18
+ *
19
+ * Race note: RTK snapshots the global when ITS module first evaluates, so this
20
+ * module must load before `@reduxjs/toolkit` does. `@buoy-gg/core` requires us
21
+ * at module scope, which usually wins; when it doesn't, the dispatch-patch
22
+ * fallback in autoInstrument.ts still binds at first mount. Apps that want a
23
+ * guarantee put `import '@buoy-gg/redux';` as the FIRST import of their entry.
24
+ */
25
+ type AnyReducer = (state: any, action: any) => any;
26
+ type AnyCreateStore = (reducer: AnyReducer, preloadedState?: unknown) => any;
27
+ /**
28
+ * The Buoy store enhancer. Innermost in the compose chain (below
29
+ * applyMiddleware), so every action that reaches the reducer — including ones
30
+ * dispatched from inside middleware and thunks — passes through here.
31
+ */
32
+ export declare const buoyDevtoolsEnhancer: (createStore: AnyCreateStore) => (reducer: AnyReducer, preloadedState?: unknown) => any;
33
+ /**
34
+ * Claim the DevTools globals — dev builds only, and never over an existing
35
+ * claimant (e.g. the real browser extension on web).
36
+ *
37
+ * Idempotent; runs at module scope so simply importing `@buoy-gg/redux` (which
38
+ * `@buoy-gg/core` does at module scope) performs the claim as early as
39
+ * possible.
40
+ */
41
+ export declare function claimDevtoolsHook(): boolean;
42
+ /** Whether Buoy owns the DevTools compose global (i.e. won the load race). */
43
+ export declare function isDevtoolsHookClaimed(): boolean;
44
+ export {};
45
+ //# sourceMappingURL=devtoolsHook.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"devtoolsHook.d.ts","sourceRoot":"","sources":["../../../../src/redux/utils/devtoolsHook.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAOH,KAAK,UAAU,GAAG,CAAC,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,KAAK,GAAG,CAAC;AACnD,KAAK,cAAc,GAAG,CAAC,OAAO,EAAE,UAAU,EAAE,cAAc,CAAC,EAAE,OAAO,KAAK,GAAG,CAAC;AA+B7E;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,GAC9B,aAAa,cAAc,MAC3B,SAAS,UAAU,EAAE,iBAAiB,OAAO,QAgC7C,CAAC;AAuBJ;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,IAAI,OAAO,CAc3C;AAED,8EAA8E;AAC9E,wBAAgB,qBAAqB,IAAI,OAAO,CAE/C"}
@@ -1,6 +1,7 @@
1
1
  export { reduxActionStore } from "./reduxActionStore";
2
2
  export { buoyReduxMiddleware, createBuoyReduxMiddleware, withBuoyDevTools, jumpToState, replayAction, BUOY_JUMP_TO_STATE, BUOY_REPLAY_ACTION, } from "./buoyReduxMiddleware";
3
3
  export { createReduxHistoryAdapter, reduxHistoryAdapter, type ReduxHistoryAdapterOptions, } from "./createReduxHistoryAdapter";
4
- export { instrumentStore, uninstrumentStore, isStoreInstrumented, isAutoInstrumentActive, getActiveStore, jumpToState as autoJumpToState, replayAction as autoReplayAction, } from "./autoInstrument";
5
- export type { AutoInstrumentOptions } from "./autoInstrument";
4
+ export { instrumentStore, uninstrumentStore, isStoreInstrumented, isAutoInstrumentActive, getActiveStore, getInstrumentationStatus, registerReduxStore, jumpToState as autoJumpToState, replayAction as autoReplayAction, } from "./autoInstrument";
5
+ export type { AutoInstrumentOptions, InstrumentationStatus, CaptureMechanism, } from "./autoInstrument";
6
+ export { buoyDevtoolsEnhancer, claimDevtoolsHook, isDevtoolsHookClaimed, } from "./devtoolsHook";
6
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/redux/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EACL,mBAAmB,EACnB,yBAAyB,EACzB,gBAAgB,EAChB,WAAW,EACX,YAAY,EACZ,kBAAkB,EAClB,kBAAkB,GACnB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,yBAAyB,EACzB,mBAAmB,EACnB,KAAK,0BAA0B,GAChC,MAAM,6BAA6B,CAAC;AAGrC,OAAO,EACL,eAAe,EACf,iBAAiB,EACjB,mBAAmB,EACnB,sBAAsB,EACtB,cAAc,EACd,WAAW,IAAI,eAAe,EAC9B,YAAY,IAAI,gBAAgB,GACjC,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/redux/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EACL,mBAAmB,EACnB,yBAAyB,EACzB,gBAAgB,EAChB,WAAW,EACX,YAAY,EACZ,kBAAkB,EAClB,kBAAkB,GACnB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,yBAAyB,EACzB,mBAAmB,EACnB,KAAK,0BAA0B,GAChC,MAAM,6BAA6B,CAAC;AAGrC,OAAO,EACL,eAAe,EACf,iBAAiB,EACjB,mBAAmB,EACnB,sBAAsB,EACtB,cAAc,EACd,wBAAwB,EACxB,kBAAkB,EAClB,WAAW,IAAI,eAAe,EAC9B,YAAY,IAAI,gBAAgB,GACjC,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EACV,qBAAqB,EACrB,qBAAqB,EACrB,gBAAgB,GACjB,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EACL,oBAAoB,EACpB,iBAAiB,EACjB,qBAAqB,GACtB,MAAM,gBAAgB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@buoy-gg/redux",
3
- "version": "7.0.4",
3
+ "version": "7.0.6",
4
4
  "description": "Redux DevTools inside your React Native app — action log, state diffs & time travel with zero store changes. Part of Buoy devtools.",
5
5
  "main": "lib/commonjs/index.js",
6
6
  "module": "lib/module/index.js",
@@ -24,11 +24,14 @@
24
24
  "files": [
25
25
  "lib"
26
26
  ],
27
- "sideEffects": false,
27
+ "sideEffects": [
28
+ "**/devtoolsHook.js",
29
+ "**/devtoolsHook.ts"
30
+ ],
28
31
  "dependencies": {
29
- "@buoy-gg/shared-ui": "7.0.4",
30
- "@buoy-gg/floating-tools-core": "7.0.4",
31
- "@buoy-gg/license": "7.0.4"
32
+ "@buoy-gg/shared-ui": "7.0.6",
33
+ "@buoy-gg/license": "7.0.6",
34
+ "@buoy-gg/floating-tools-core": "7.0.6"
32
35
  },
33
36
  "peerDependencies": {
34
37
  "@reduxjs/toolkit": ">=1.9.0",