@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 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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vladimirdev635/gql-client-react",
3
- "version": "0.0.29",
3
+ "version": "0.0.30",
4
4
  "type": "module",
5
5
  "main": "./index.js",
6
6
  "types": "./index.d.ts",
@@ -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<T extends Operation, TRequestContext extends RequestContext> {
12
- execute: (variables: z.infer<T['variablesSchema']>, requestContext: TRequestContext) => Promise<LazyOperationState<z.infer<T['resultSchema']>>>;
13
- state: LazyOperationState<z.infer<T['resultSchema']>>;
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, TRequestContext>;
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
- }