@vladimirdev635/gql-client-react 0.0.29 → 0.0.30
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/index.d.ts +1 -2
- package/index.js +1 -2
- package/package.json +1 -1
- package/useLazyOperation.d.ts +4 -5
- package/context.d.ts +0 -9
- package/context.jsx +0 -16
package/index.d.ts
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
export { createProviderAndHook } from './context.jsx';
|
|
2
1
|
export { type OperationLoadingState, type OperationSuccessState, type OperationFailureState, type OperationState, loadingState, useOperation, } from './useOperation.jsx';
|
|
3
|
-
export { LazyOperationInitialState, LazyOperationState, lazyInitialState, useLazyOperation } from './useLazyOperation.jsx';
|
|
2
|
+
export { type LazyOperationInitialState, type LazyOperationState, type UseLazyOperationReturnType, lazyInitialState, useLazyOperation, } from './useLazyOperation.jsx';
|
package/index.js
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
export { createProviderAndHook } from './context.jsx';
|
|
2
1
|
export { loadingState, useOperation, } from './useOperation.jsx';
|
|
3
|
-
export { lazyInitialState, useLazyOperation } from './useLazyOperation.jsx';
|
|
2
|
+
export { lazyInitialState, useLazyOperation, } from './useLazyOperation.jsx';
|
package/package.json
CHANGED
package/useLazyOperation.d.ts
CHANGED
|
@@ -8,10 +8,9 @@ export type LazyOperationState<TResult> = OperationState<TResult> | LazyOperatio
|
|
|
8
8
|
export declare const lazyInitialState: Readonly<{
|
|
9
9
|
readonly state: "initial";
|
|
10
10
|
}>;
|
|
11
|
-
interface UseLazyOperationReturnType<
|
|
12
|
-
execute: (variables:
|
|
13
|
-
state: LazyOperationState<
|
|
11
|
+
export interface UseLazyOperationReturnType<TVariables, TResult, TRequestContext extends RequestContext> {
|
|
12
|
+
execute: (variables: TVariables, requestContext: TRequestContext) => Promise<LazyOperationState<TResult>>;
|
|
13
|
+
state: LazyOperationState<TResult>;
|
|
14
14
|
reset: () => void;
|
|
15
15
|
}
|
|
16
|
-
export declare function useLazyOperation<T extends Operation, TRequestContext extends RequestContext>(executor: Executor<TRequestContext>, operation: T): UseLazyOperationReturnType<T
|
|
17
|
-
export {};
|
|
16
|
+
export declare function useLazyOperation<T extends Operation, TRequestContext extends RequestContext>(executor: Executor<TRequestContext>, operation: T): UseLazyOperationReturnType<z.infer<T['variablesSchema']>, z.infer<T['resultSchema']>, TRequestContext>;
|
package/context.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
2
|
-
import { Executor, RequestContext } from './types.js';
|
|
3
|
-
export declare function createProviderAndHook<TRequestContext extends RequestContext>(): {
|
|
4
|
-
useGQLExecutor: () => Executor<TRequestContext>;
|
|
5
|
-
GQLExecutorProvider: ({ children, executor }: {
|
|
6
|
-
children: ReactNode;
|
|
7
|
-
executor: Executor<TRequestContext>;
|
|
8
|
-
}) => import("react").JSX.Element;
|
|
9
|
-
};
|
package/context.jsx
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { createContext, useContext } from 'react';
|
|
2
|
-
export function createProviderAndHook() {
|
|
3
|
-
const context = createContext(undefined);
|
|
4
|
-
function Provider({ children, executor }) {
|
|
5
|
-
return (<context.Provider value={executor}>
|
|
6
|
-
{children}
|
|
7
|
-
</context.Provider>);
|
|
8
|
-
}
|
|
9
|
-
function useExecutor() {
|
|
10
|
-
return useContext(context);
|
|
11
|
-
}
|
|
12
|
-
return {
|
|
13
|
-
useGQLExecutor: useExecutor,
|
|
14
|
-
GQLExecutorProvider: Provider
|
|
15
|
-
};
|
|
16
|
-
}
|