@up42/up-components 5.7.1 → 5.8.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.
- package/dist/cjs/index.js +2 -2
- package/dist/cjs/types/index.d.ts +1 -0
- package/dist/cjs/types/utils/helpers/generateQueryKey.d.ts +17 -0
- package/dist/cjs/types/utils/helpers/generateQueryKey.test.d.ts +1 -0
- package/dist/esm/index.js +2 -2
- package/dist/esm/types/index.d.ts +1 -0
- package/dist/esm/types/utils/helpers/generateQueryKey.d.ts +17 -0
- package/dist/esm/types/utils/helpers/generateQueryKey.test.d.ts +1 -0
- package/dist/index.d.ts +18 -1
- package/package.json +1 -1
|
@@ -65,6 +65,7 @@ export { copyToClipboard } from './utils/helpers/copyToClipboard';
|
|
|
65
65
|
export { formatNumber } from './utils/helpers/formatNumber';
|
|
66
66
|
export { formatDate } from './utils/helpers/formatDate';
|
|
67
67
|
export { formatFileSize } from './utils/helpers/formatFileSize';
|
|
68
|
+
export { generateQueryKey } from './utils/helpers/generateQueryKey';
|
|
68
69
|
export { useQueryParams } from './utils/hooks/useQueryParams';
|
|
69
70
|
export { useRemotePagination, type PaginatedResponse } from './utils/hooks/useRemotePagination';
|
|
70
71
|
export { useCursorPagination, type CursorPaginatedResponse } from './utils/hooks/useCursorPagination';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
type Key = string | number | Record<string, unknown> | undefined;
|
|
2
|
+
type QueryKey = readonly unknown[];
|
|
3
|
+
/**
|
|
4
|
+
* Generates a consistent React Query key builder for a given domain.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* const queryKey = generateQueryKey('MY_DOMAIN')
|
|
8
|
+
* useQuery(queryKey('list')) // → ['MY_DOMAIN', 'list']
|
|
9
|
+
* useQuery(queryKey('details', id)) // → ['MY_DOMAIN', 'details', id]
|
|
10
|
+
*
|
|
11
|
+
* @param domain - The root domain for the query key (e.g. 'USER', 'DASHBOARD')
|
|
12
|
+
* @returns A function that builds query keys. Undefined values are filtered out.
|
|
13
|
+
*
|
|
14
|
+
* Documentation: https://up-components.up42.com/?path=/docs/utils--docs#generatequerykey
|
|
15
|
+
*/
|
|
16
|
+
export declare const generateQueryKey: <Domain extends string>(domain: Exclude<Domain, "">) => (service: string, ...keys: Key[]) => QueryKey;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|