react-fate 1.0.2 → 1.1.0

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 (37) hide show
  1. package/README.md +354 -2
  2. package/docs/api/functions/FateClient.md +1 -1
  3. package/docs/api/functions/clientRoot.md +1 -1
  4. package/docs/api/functions/createClient.md +8 -4
  5. package/docs/api/functions/createGraphQLTransport.md +21 -0
  6. package/docs/api/functions/createHTTPTransport.md +1 -1
  7. package/docs/api/functions/createTRPCTransport.md +1 -1
  8. package/docs/api/functions/graphqlMutation.md +39 -0
  9. package/docs/api/functions/mutation.md +1 -1
  10. package/docs/api/functions/useFateClient.md +1 -1
  11. package/docs/api/functions/useListView.md +2 -2
  12. package/docs/api/functions/useLiveListView.md +2 -2
  13. package/docs/api/functions/useLiveView.md +1 -1
  14. package/docs/api/functions/useRequest.md +1 -1
  15. package/docs/api/functions/useView.md +1 -1
  16. package/docs/api/functions/view.md +1 -1
  17. package/docs/api/index.md +11 -0
  18. package/docs/api/type-aliases/ConnectionRef.md +2 -2
  19. package/docs/api/type-aliases/FateDehydratedState.md +11 -0
  20. package/docs/api/type-aliases/GraphQLMutationDefinition.md +19 -0
  21. package/docs/api/type-aliases/GraphQLMutationInput.md +11 -0
  22. package/docs/api/type-aliases/GraphQLMutationMap.md +11 -0
  23. package/docs/api/type-aliases/GraphQLMutationOutput.md +11 -0
  24. package/docs/api/type-aliases/GraphQLTransportOptions.md +119 -0
  25. package/docs/api/type-aliases/HydrateOptions.md +7 -0
  26. package/docs/api/type-aliases/HydrationLimits.md +7 -0
  27. package/docs/api/type-aliases/InferFateAPI.md +1 -1
  28. package/docs/api/type-aliases/Pagination.md +39 -0
  29. package/docs/api/type-aliases/ViewRef.md +1 -1
  30. package/docs/api/variables/toEntityId.md +1 -1
  31. package/docs/guide/getting-started.md +1 -1
  32. package/docs/guide/graphql-integration.md +298 -0
  33. package/docs/guide/requests.md +52 -0
  34. package/docs/guide/server-integration.md +2 -1
  35. package/lib/index.d.mts +7 -9
  36. package/lib/index.mjs +2 -2
  37. package/package.json +5 -5
package/lib/index.d.mts CHANGED
@@ -1,10 +1,8 @@
1
- import { ConnectionRef, FateClient as FateClient$1, FateMutations, FateRoots, InferFateAPI, Pagination, Request, RequestOptions, RequestResult, View, ViewData, ViewEntity, ViewEntityName, ViewRef, ViewRef as ViewRef$1, ViewSelection, clientRoot, createClient, createHTTPTransport, createTRPCTransport, mutation, toEntityId, view } from "@nkzw/fate";
1
+ import { ConnectionRef, FateClient as FateClient$1, FateDehydratedState, FateMutations, FateRoots, GraphQLMutationDefinition, GraphQLMutationInput, GraphQLMutationMap, GraphQLMutationOutput, GraphQLTransportOptions, HydrateOptions, HydrationLimits, InferFateAPI, Pagination, Pagination as Pagination$1, Request, RequestOptions, RequestResult, View, ViewData, ViewEntity, ViewEntityName, ViewRef, ViewRef as ViewRef$1, ViewSelection, clientRoot, createClient, createGraphQLTransport, createHTTPTransport, createTRPCTransport, graphqlMutation, mutation, toEntityId, view } from "@nkzw/fate";
2
2
  import { ReactNode } from "react";
3
- import * as _$react_jsx_runtime0 from "react/jsx-runtime";
4
- import * as _$react_fate_client0 from "react-fate/client";
5
3
 
6
4
  //#region src/useRequest.d.ts
7
- type GeneratedFateClient$1 = ReturnType<typeof _$react_fate_client0.createFateClient>;
5
+ type GeneratedFateClient$1 = ReturnType<typeof import('react-fate/client').createFateClient>;
8
6
  type Roots = [GeneratedFateClient$1] extends [never] ? FateRoots : GeneratedFateClient$1 extends FateClient$1<infer R, any> ? R : FateRoots;
9
7
  /**
10
8
  * Declares the data a screen needs and kicks off fetching, suspending while the
@@ -16,7 +14,7 @@ type Roots = [GeneratedFateClient$1] extends [never] ? FateRoots : GeneratedFate
16
14
  declare function useRequest<R extends Request, O extends FateRoots = Roots>(request: R, options?: RequestOptions): RequestResult<O, R>;
17
15
  //#endregion
18
16
  //#region src/context.d.ts
19
- type GeneratedFateClient = ReturnType<typeof _$react_fate_client0.createFateClient>;
17
+ type GeneratedFateClient = ReturnType<typeof import('react-fate/client').createFateClient>;
20
18
  type Mutations = [GeneratedFateClient] extends [never] ? FateMutations : GeneratedFateClient extends FateClient$1<any, infer M> ? M : FateMutations;
21
19
  /**
22
20
  * Provider component that supplies a configured `FateClient` to React hooks.
@@ -27,7 +25,7 @@ declare function FateClient({
27
25
  }: {
28
26
  children: ReactNode;
29
27
  client: FateClient$1<any, any>;
30
- }): _$react_jsx_runtime0.JSX.Element;
28
+ }): import("react").JSX.Element;
31
29
  /**
32
30
  * Returns the nearest `FateClient` from context.
33
31
  */
@@ -64,7 +62,7 @@ type ConnectionSelection = {
64
62
  */
65
63
  declare function useLiveListView<C extends {
66
64
  items?: ReadonlyArray<any>;
67
- pagination?: Pagination;
65
+ pagination?: Pagination$1;
68
66
  } | null | undefined>(selection: ConnectionSelection, connection: C): [ConnectionItems<NonNullable<C>>, LoadMoreFn | null, LoadMoreFn | null];
69
67
  //#endregion
70
68
  //#region src/useView.d.ts
@@ -86,7 +84,7 @@ declare function useView<V extends View<any, any>, R extends ViewRef$1<ViewEntit
86
84
  */
87
85
  declare function useListView<C extends {
88
86
  items?: ReadonlyArray<any>;
89
- pagination?: Pagination;
87
+ pagination?: Pagination$1;
90
88
  } | null | undefined>(selection: ConnectionSelection, connection: C): [ConnectionItems<NonNullable<C>>, LoadMoreFn | null, LoadMoreFn | null];
91
89
  //#endregion
92
- export { type ConnectionRef, FateClient, type InferFateAPI, type ViewRef, clientRoot, createClient, createHTTPTransport, createTRPCTransport, mutation, toEntityId, useFateClient, useListView, useLiveListView, useLiveView, useRequest, useView, view };
90
+ export { type ConnectionRef, FateClient, type FateDehydratedState, type GraphQLMutationDefinition, type GraphQLMutationInput, type GraphQLMutationMap, type GraphQLMutationOutput, type GraphQLTransportOptions, type HydrateOptions, type HydrationLimits, type InferFateAPI, type Pagination, type ViewRef, clientRoot, createClient, createGraphQLTransport, createHTTPTransport, createTRPCTransport, graphqlMutation, mutation, toEntityId, useFateClient, useListView, useLiveListView, useLiveView, useRequest, useView, view };
package/lib/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { ConnectionTag, clientRoot, createClient, createHTTPTransport, createTRPCTransport, isViewTag, mutation, toEntityId, view } from "@nkzw/fate";
1
+ import { ConnectionTag, clientRoot, createClient, createGraphQLTransport, createHTTPTransport, createTRPCTransport, graphqlMutation, isViewTag, mutation, toEntityId, view } from "@nkzw/fate";
2
2
  import { createContext, use, useCallback, useDeferredValue, useEffect, useEffectEvent, useMemo, useRef, useSyncExternalStore } from "react";
3
3
  import { jsx } from "react/jsx-runtime";
4
4
  import { getListEntries } from "@nkzw/fate/list";
@@ -233,4 +233,4 @@ function useRequest(request, options) {
233
233
  return use(useDeferredValue(promise));
234
234
  }
235
235
  //#endregion
236
- export { FateClient, clientRoot, createClient, createHTTPTransport, createTRPCTransport, mutation, toEntityId, useFateClient, useListView, useLiveListView, useLiveView, useRequest, useView, view };
236
+ export { FateClient, clientRoot, createClient, createGraphQLTransport, createHTTPTransport, createTRPCTransport, graphqlMutation, mutation, toEntityId, useFateClient, useListView, useLiveListView, useLiveView, useRequest, useView, view };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-fate",
3
- "version": "1.0.2",
3
+ "version": "1.1.0",
4
4
  "description": "fate is a modern data client for React.",
5
5
  "homepage": "https://github.com/nkzw-tech/fate",
6
6
  "license": "MIT",
@@ -40,13 +40,13 @@
40
40
  }
41
41
  },
42
42
  "dependencies": {
43
- "@nkzw/fate": "^1.0.2"
43
+ "@nkzw/fate": "^1.1.0"
44
44
  },
45
45
  "devDependencies": {
46
- "@types/react": "^19.2.14",
46
+ "@types/react": "^19.2.16",
47
47
  "@types/react-dom": "^19.2.3",
48
- "react": "^19.2.6",
49
- "react-dom": "^19.2.6"
48
+ "react": "^19.2.7",
49
+ "react-dom": "^19.2.7"
50
50
  },
51
51
  "peerDependencies": {
52
52
  "react": "^19.2.0",