diff --git a/src/createSatchel.ts b/src/createSatchel.ts index ec8c7f3..a70b68b 100644 --- a/src/createSatchel.ts +++ b/src/createSatchel.ts @@ -100,6 +100,12 @@ export function createSatchelInternal(options: SatchelOptions = {}): SatchelInte satchel.__createStoreAction(key, initialState); return () => satchel.getRootStore().get(key); }, + getSubscriptions: () => { + return satchel.__subscriptions; + }, + getCurrentMutator: () => { + return satchel.__currentMutator; + }, // Private functions __createActionId: (): string => { return (satchel.__nextActionId++).toString(); diff --git a/src/interfaces/Satchel.ts b/src/interfaces/Satchel.ts index f6c91c0..c43d455 100644 --- a/src/interfaces/Satchel.ts +++ b/src/interfaces/Satchel.ts @@ -5,6 +5,7 @@ import type Mutator from './Mutator'; import type MutatorFunction from './MutatorFunction'; import type Orchestrator from './Orchestrator'; import type OrchestratorFunction from './OrchestratorFunction'; +import SatchelState from './SatchelState'; type Satchel = { /** @@ -68,5 +69,14 @@ type Satchel = { * @returns {boolean} True if the action creator has subscribers, false otherwise. */ hasSubscribers: (actionCreator: ActionCreator) => boolean; + + /** + * Utility function to get the current mutator being executed. + */ + getCurrentMutator: () => SatchelState['__currentMutator']; + /** + * Utility function to get the current subscriptions. + */ + getSubscriptions: () => SatchelState['__subscriptions']; }; export default Satchel;