@refinedev/core 4.45.1 → 4.46.1

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 (55) hide show
  1. package/CHANGELOG.md +114 -0
  2. package/README.md +61 -77
  3. package/dist/components/authenticated/index.d.ts +34 -0
  4. package/dist/components/authenticated/index.d.ts.map +1 -1
  5. package/dist/components/pages/auth/components/login/index.d.ts.map +1 -1
  6. package/dist/components/pages/auth/components/register/index.d.ts.map +1 -1
  7. package/dist/components/pages/welcome/index.d.ts.map +1 -1
  8. package/dist/esm/index.js +6 -6
  9. package/dist/esm/index.js.map +1 -1
  10. package/dist/hooks/data/useDelete.d.ts.map +1 -1
  11. package/dist/hooks/data/useDeleteMany.d.ts.map +1 -1
  12. package/dist/hooks/data/useMany.d.ts +1 -1
  13. package/dist/hooks/data/useMany.d.ts.map +1 -1
  14. package/dist/hooks/data/useOne.d.ts +1 -1
  15. package/dist/hooks/data/useOne.d.ts.map +1 -1
  16. package/dist/hooks/data/useUpdate.d.ts.map +1 -1
  17. package/dist/hooks/data/useUpdateMany.d.ts.map +1 -1
  18. package/dist/hooks/form/useForm.d.ts +1 -1
  19. package/dist/hooks/form/useForm.d.ts.map +1 -1
  20. package/dist/hooks/show/useShow.d.ts +3 -3
  21. package/dist/hooks/show/useShow.d.ts.map +1 -1
  22. package/dist/hooks/useMeta/index.d.ts +2 -0
  23. package/dist/hooks/useMeta/index.d.ts.map +1 -1
  24. package/dist/hooks/useSelect/index.d.ts +3 -3
  25. package/dist/hooks/useSelect/index.d.ts.map +1 -1
  26. package/dist/iife/index.js +6 -6
  27. package/dist/iife/index.js.map +1 -1
  28. package/dist/index.js +6 -6
  29. package/dist/index.js.map +1 -1
  30. package/dist/interfaces/auth.d.ts +12 -0
  31. package/dist/interfaces/auth.d.ts.map +1 -1
  32. package/dist/interfaces/metaData/graphqlQueryOptions.d.ts +6 -0
  33. package/dist/interfaces/metaData/graphqlQueryOptions.d.ts.map +1 -0
  34. package/dist/interfaces/metaData/metaQuery.d.ts +2 -1
  35. package/dist/interfaces/metaData/metaQuery.d.ts.map +1 -1
  36. package/package.json +2 -1
  37. package/src/components/authenticated/index.tsx +118 -139
  38. package/src/components/pages/auth/components/login/index.tsx +110 -84
  39. package/src/components/pages/auth/components/register/index.tsx +88 -65
  40. package/src/components/pages/welcome/index.tsx +125 -124
  41. package/src/hooks/auth/useLogin/index.ts +4 -4
  42. package/src/hooks/auth/useLogout/index.ts +4 -4
  43. package/src/hooks/auth/useRegister/index.ts +5 -4
  44. package/src/hooks/data/useDelete.ts +5 -1
  45. package/src/hooks/data/useDeleteMany.ts +5 -1
  46. package/src/hooks/data/useMany.ts +1 -1
  47. package/src/hooks/data/useOne.ts +1 -1
  48. package/src/hooks/data/useUpdate.ts +5 -1
  49. package/src/hooks/data/useUpdateMany.ts +7 -2
  50. package/src/hooks/form/useForm.ts +1 -1
  51. package/src/hooks/show/useShow.ts +3 -3
  52. package/src/hooks/useSelect/index.ts +3 -2
  53. package/src/interfaces/auth.tsx +12 -0
  54. package/src/interfaces/metaData/graphqlQueryOptions.ts +6 -0
  55. package/src/interfaces/metaData/metaQuery.ts +3 -1
@@ -290,12 +290,17 @@ export const useUpdateMany = <
290
290
  optimisticUpdateMap = { list: true, many: true, detail: true },
291
291
  }) => {
292
292
  const { identifier } = select(resourceName);
293
- const preferredMeta = pickNotDeprecated(meta, metaData);
293
+
294
+ const {
295
+ gqlMutation: _,
296
+ gqlQuery: __,
297
+ ...preferredMeta
298
+ } = pickNotDeprecated(meta, metaData) ?? {};
294
299
 
295
300
  const queryKey = queryKeysReplacement(preferLegacyKeys)(
296
301
  identifier,
297
302
  pickDataProvider(identifier, dataProviderName, resources),
298
- pickNotDeprecated(meta, metaData),
303
+ preferredMeta,
299
304
  );
300
305
 
301
306
  const resourceKeys = keys()
@@ -206,7 +206,7 @@ export type UseFormReturnType<
206
206
  > = {
207
207
  id?: BaseKey;
208
208
  setId: Dispatch<SetStateAction<BaseKey | undefined>>;
209
- queryResult?: QueryObserverResult<GetOneResponse<TData>>;
209
+ queryResult?: QueryObserverResult<GetOneResponse<TData>, TError>;
210
210
  mutationResult:
211
211
  | UseUpdateReturnType<TResponse, TResponseError, TVariables>
212
212
  | UseCreateReturnType<TResponse, TResponseError, TVariables>;
@@ -22,8 +22,8 @@ import {
22
22
  UseLoadingOvertimeReturnType,
23
23
  } from "../useLoadingOvertime";
24
24
 
25
- export type useShowReturnType<TData extends BaseRecord = BaseRecord> = {
26
- queryResult: QueryObserverResult<GetOneResponse<TData>>;
25
+ export type useShowReturnType<TData extends BaseRecord = BaseRecord, TError extends HttpError = HttpError> = {
26
+ queryResult: QueryObserverResult<GetOneResponse<TData>, TError>;
27
27
  showId?: BaseKey;
28
28
  setShowId: React.Dispatch<React.SetStateAction<BaseKey | undefined>>;
29
29
  } & UseLoadingOvertimeReturnType;
@@ -106,7 +106,7 @@ export const useShow = <
106
106
  TQueryFnData,
107
107
  TError,
108
108
  TData
109
- > = {}): useShowReturnType<TData> => {
109
+ > = {}): useShowReturnType<TData, TError> => {
110
110
  const {
111
111
  resource,
112
112
  id: idFromRoute,
@@ -137,9 +137,10 @@ export type UseSelectProps<TQueryFnData, TError, TData> = {
137
137
 
138
138
  export type UseSelectReturnType<
139
139
  TData extends BaseRecord = BaseRecord,
140
+ TError extends HttpError = HttpError,
140
141
  TOption extends BaseOption = BaseOption,
141
142
  > = {
142
- queryResult: QueryObserverResult<GetListResponse<TData>>;
143
+ queryResult: QueryObserverResult<GetListResponse<TData>, TError>;
143
144
  defaultValueQueryResult: QueryObserverResult<GetManyResponse<TData>>;
144
145
  onSearch: (value: string) => void;
145
146
  options: TOption[];
@@ -166,7 +167,7 @@ export const useSelect = <
166
167
  TOption extends BaseOption = BaseOption,
167
168
  >(
168
169
  props: UseSelectProps<TQueryFnData, TError, TData>,
169
- ): UseSelectReturnType<TData, TOption> => {
170
+ ): UseSelectReturnType<TData, TError, TOption> => {
170
171
  const [search, setSearch] = useState<CrudFilters>([]);
171
172
  const [options, setOptions] = useState<TOption[]>([]);
172
173
  const [selectedOptions, setSelectedOptions] = useState<TOption[]>([]);
@@ -73,6 +73,11 @@ export type AuthPageProps<
73
73
  * @optional
74
74
  */
75
75
  rememberMe?: React.ReactNode;
76
+ /**
77
+ * @description Can be used to hide the form components
78
+ * @optional
79
+ */
80
+ hideForm?: boolean;
76
81
  }>
77
82
  | PropsWithChildren<{
78
83
  /**
@@ -85,6 +90,11 @@ export type AuthPageProps<
85
90
  * @optional
86
91
  */
87
92
  providers?: OAuthProvider[];
93
+ /**
94
+ * @description Can be used to hide the form components
95
+ * @optional
96
+ */
97
+ hideForm?: boolean;
88
98
  }>
89
99
  | PropsWithChildren<{
90
100
  /**
@@ -156,6 +166,7 @@ export type LoginPageProps<
156
166
  contentProps?: TContentProps;
157
167
  formProps?: TFormProps;
158
168
  title?: React.ReactNode;
169
+ hideForm?: boolean;
159
170
  }>;
160
171
 
161
172
  /**
@@ -176,6 +187,7 @@ export type RegisterPageProps<
176
187
  contentProps?: TContentProps;
177
188
  formProps?: TFormProps;
178
189
  title?: React.ReactNode;
190
+ hideForm?: boolean;
179
191
  }>;
180
192
 
181
193
  /**
@@ -0,0 +1,6 @@
1
+ import type { DocumentNode } from "graphql";
2
+
3
+ export type GraphQLQueryOptions = {
4
+ gqlQuery?: DocumentNode;
5
+ gqlMutation?: DocumentNode;
6
+ };
@@ -1,7 +1,9 @@
1
1
  import { QueryFunctionContext } from "@tanstack/react-query";
2
2
  import { QueryBuilderOptions } from "./queryBuilderOptions";
3
+ import { GraphQLQueryOptions } from "./graphqlQueryOptions";
3
4
 
4
5
  export type MetaQuery = {
5
6
  [k: string]: any;
6
7
  queryContext?: Omit<QueryFunctionContext, "meta">;
7
- } & QueryBuilderOptions;
8
+ } & QueryBuilderOptions &
9
+ GraphQLQueryOptions;