reactjrx 1.141.5 → 1.141.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.
@@ -0,0 +1,26 @@
1
+ import { UseMutationOptions } from '@tanstack/react-query';
2
+ import { Observable } from 'rxjs';
3
+ /**
4
+ * Resolves the public `mutationFn` option — an Observable or a function
5
+ * returning one — to its source Observable for the given variables.
6
+ */
7
+ export declare function resolveMutationFnSource<TData, TVariables>(mutationFn: ((variables: TVariables) => Observable<TData>) | Observable<TData>, variables: TVariables): Observable<TData>;
8
+ type MutationCallbacks<TData, TError, TVariables, TOnMutateResult> = Pick<UseMutationOptions<TData, TError, TVariables, TOnMutateResult>, "onMutate" | "onSuccess" | "onError" | "onSettled">;
9
+ /**
10
+ * Same callbacks, but keyed as required so that spreading the adapted
11
+ * callbacks after `...options` overrides (rather than unions with) the
12
+ * raw-variables callbacks still present in `options`.
13
+ */
14
+ type AdaptedMutationCallbacks<TData, TError, TVariables, TOnMutateResult> = {
15
+ [K in "onMutate" | "onSuccess" | "onError" | "onSettled"]: MutationCallbacks<TData, TError, {
16
+ variables: TVariables;
17
+ }, TOnMutateResult>[K] | undefined;
18
+ };
19
+ /**
20
+ * Hooks built on top of `useMutation$` (`useSwitchMutation$`,
21
+ * `useConcatMutation$`) run their inner mutation with the user variables
22
+ * wrapped in an envelope (`{ variables, ... }`). This adapts the user-facing
23
+ * callbacks, which expect the raw variables, to that envelope.
24
+ */
25
+ export declare function adaptCallbacksToWrappedVariables<TData, TError, TVariables, TOnMutateResult>({ onMutate, onSuccess, onError, onSettled, }: MutationCallbacks<TData, TError, TVariables, TOnMutateResult>): AdaptedMutationCallbacks<TData, TError, TVariables, TOnMutateResult>;
26
+ export {};
@@ -1,7 +1,7 @@
1
1
  import { DefaultError, MutationKey, QueryClient } from '@tanstack/react-query';
2
2
  import { BehaviorSubject, Subject } from 'rxjs';
3
3
  import { UseMutation$Options } from './useMutation$';
4
- export declare function useConcatMutation$<TData = unknown, TError = DefaultError, TVariables = void, TContext = unknown>({ onMutate, ...options }: UseMutation$Options<TData | null, TError, TVariables, TContext> & {
4
+ export declare function useConcatMutation$<TData = unknown, TError = DefaultError, TVariables = void, TContext = unknown>(options: UseMutation$Options<TData | null, TError, TVariables, TContext> & {
5
5
  mutationKey: MutationKey;
6
6
  }, queryClient?: QueryClient): {
7
7
  mutate: (variables: TVariables) => void;
@@ -3,7 +3,7 @@ import { UseMutation$Options } from './useMutation$';
3
3
  export declare class SwitchMutationCancelError extends Error {
4
4
  constructor(message?: string);
5
5
  }
6
- export declare function useSwitchMutation$<TData = unknown, TError = DefaultError, TVariables = void, TOnMutateResult = unknown>({ mutationFn, onMutate, onError, onSettled, ...options }: UseMutation$Options<TData | null, TError, TVariables, TOnMutateResult>, queryClient?: QueryClient): {
6
+ export declare function useSwitchMutation$<TData = unknown, TError = DefaultError, TVariables = void, TOnMutateResult = unknown>({ mutationFn, ...options }: UseMutation$Options<TData | null, TError, TVariables, TOnMutateResult>, queryClient?: QueryClient): {
7
7
  mutate: (variables: TVariables) => void;
8
8
  mutateAsync: (variables: TVariables) => Promise<TData | null>;
9
9
  state$: import('rxjs').BehaviorSubject<Pick<import('@tanstack/react-query').UseMutationResult<TData | null, TError, {
@@ -1,6 +1,5 @@
1
1
  import { QueryClient } from '@tanstack/react-query';
2
2
  import { default as React } from 'react';
3
- export declare function isDefined<T>(value: T | undefined | null): value is T;
4
3
  export declare function createQueryClient(): QueryClient;
5
4
  export declare const liveQueryOptions: {
6
5
  networkMode: "always";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "reactjrx",
3
3
  "private": false,
4
- "version": "1.141.5",
4
+ "version": "1.141.6",
5
5
  "type": "module",
6
6
  "files": [
7
7
  "dist"