@codeleap/query 7.0.0 → 7.0.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 (45) hide show
  1. package/dist/factors/createQueryManager.js +37 -0
  2. package/dist/factors/createQueryManager.js.map +1 -0
  3. package/dist/factors/createQueryOperations.js +36 -0
  4. package/dist/factors/createQueryOperations.js.map +1 -0
  5. package/dist/factors/index.js +3 -0
  6. package/dist/factors/index.js.map +1 -0
  7. package/dist/index.js +4 -0
  8. package/dist/index.js.map +1 -0
  9. package/dist/lib/Mutations.js +235 -0
  10. package/dist/lib/Mutations.js.map +1 -0
  11. package/dist/lib/QueryClientEnhanced/index.js +195 -0
  12. package/dist/lib/QueryClientEnhanced/index.js.map +1 -0
  13. package/dist/lib/QueryClientEnhanced/types.js +2 -0
  14. package/dist/lib/QueryClientEnhanced/types.js.map +1 -0
  15. package/dist/lib/QueryKeys.js +313 -0
  16. package/dist/lib/QueryKeys.js.map +1 -0
  17. package/dist/lib/QueryManager.js +400 -0
  18. package/dist/lib/QueryManager.js.map +1 -0
  19. package/dist/lib/QueryOperations/index.js +284 -0
  20. package/dist/lib/QueryOperations/index.js.map +1 -0
  21. package/dist/lib/QueryOperations/types.js +2 -0
  22. package/dist/lib/QueryOperations/types.js.map +1 -0
  23. package/dist/lib/index.js +6 -0
  24. package/dist/lib/index.js.map +1 -0
  25. package/dist/types/core.js +2 -0
  26. package/dist/types/core.js.map +1 -0
  27. package/dist/types/create.js +2 -0
  28. package/dist/types/create.js.map +1 -0
  29. package/dist/types/delete.js +2 -0
  30. package/dist/types/delete.js.map +1 -0
  31. package/dist/types/index.js +8 -0
  32. package/dist/types/index.js.map +1 -0
  33. package/dist/types/list.js +2 -0
  34. package/dist/types/list.js.map +1 -0
  35. package/dist/types/retrieve.js +2 -0
  36. package/dist/types/retrieve.js.map +1 -0
  37. package/dist/types/update.js +2 -0
  38. package/dist/types/update.js.map +1 -0
  39. package/dist/types/utility.js +2 -0
  40. package/dist/types/utility.js.map +1 -0
  41. package/dist/utils/index.js +2 -0
  42. package/dist/utils/index.js.map +1 -0
  43. package/dist/utils/misc.js +35 -0
  44. package/dist/utils/misc.js.map +1 -0
  45. package/package.json +6 -6
@@ -0,0 +1,37 @@
1
+ import { QueryManager } from '../lib';
2
+ /**
3
+ * Factory function to create a new QueryManager instance
4
+ * @template T - The query item type that extends QueryItem
5
+ * @template F - The filter type used for list queries
6
+ * @param options - Configuration options for the query manager
7
+ * @returns New QueryManager instance
8
+ *
9
+ * @example
10
+ * ```typescript
11
+ * interface User extends QueryItem {
12
+ * name: string
13
+ * email: string
14
+ * status: 'active' | 'inactive'
15
+ * }
16
+ *
17
+ * interface UserFilters {
18
+ * status?: 'active' | 'inactive'
19
+ * search?: string
20
+ * }
21
+ *
22
+ * const userQueryManager = createQueryManager<User, UserFilters>({
23
+ * name: 'users',
24
+ * queryClient,
25
+ * listFn: (limit, offset, filters) => api.getUsers({ limit, offset, ...filters }),
26
+ * retrieveFn: (id) => api.getUser(id),
27
+ * createFn: (data) => api.createUser(data),
28
+ * updateFn: (data) => api.updateUser(data.id, data),
29
+ * deleteFn: (id) => api.deleteUser(id),
30
+ * listLimit: 20
31
+ * })
32
+ * ```
33
+ */
34
+ export const createQueryManager = (options) => {
35
+ return new QueryManager(options);
36
+ };
37
+ //# sourceMappingURL=createQueryManager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createQueryManager.js","sourceRoot":"","sources":["../../src/factors/createQueryManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAA;AAGrC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAA8B,OAAkC,EAAE,EAAE;IACpG,OAAO,IAAI,YAAY,CAAO,OAAO,CAAC,CAAA;AACxC,CAAC,CAAA"}
@@ -0,0 +1,36 @@
1
+ import { QueryOperations } from '../lib';
2
+ /**
3
+ * Factory function to create a new QueryOperations builder instance
4
+ * @param options - Configuration options including the QueryClient
5
+ * @returns New QueryOperations instance ready for operation registration
6
+ *
7
+ * @description
8
+ * This is the entry point for creating a new QueryOperations instance. Use this
9
+ * function to start building your collection of queries and mutations.
10
+ *
11
+ * @example
12
+ * ```typescript
13
+ * import { QueryClient } from '@tanstack/react-query'
14
+ *
15
+ * const queryClient = new QueryClient()
16
+ *
17
+ * const userOperations = createQueryOperations({ queryClient })
18
+ * .query('getUser', async (id: string) => fetchUser(id))
19
+ * .query('getUsers', async (filters?: UserFilters) => fetchUsers(filters))
20
+ * .mutation('createUser', async (data: CreateUserData) => createUser(data))
21
+ * .mutation('updateUser', async (data: UpdateUserData) => updateUser(data))
22
+ * .mutation('deleteUser', async (id: string) => deleteUser(id))
23
+ *
24
+ * // In components
25
+ * function UserList() {
26
+ * const usersQuery = userOperations.useQuery('getUsers', { active: true })
27
+ * const createMutation = userOperations.useMutation('createUser')
28
+ *
29
+ * // Both hooks are fully type-safe
30
+ * }
31
+ * ```
32
+ */
33
+ export function createQueryOperations(options) {
34
+ return new QueryOperations(options);
35
+ }
36
+ //# sourceMappingURL=createQueryOperations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createQueryOperations.js","sourceRoot":"","sources":["../../src/factors/createQueryOperations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAA;AAGxC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,MAAM,UAAU,qBAAqB,CAAC,OAA+B;IACnE,OAAO,IAAI,eAAe,CAAC,OAAO,CAAC,CAAA;AACrC,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from './createQueryManager';
2
+ export * from './createQueryOperations';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/factors/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAA;AACpC,cAAc,yBAAyB,CAAA"}
package/dist/index.js ADDED
@@ -0,0 +1,4 @@
1
+ export * from './lib';
2
+ export * from './types';
3
+ export * from './factors';
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAA;AACrB,cAAc,SAAS,CAAA;AACvB,cAAc,WAAW,CAAA"}
@@ -0,0 +1,235 @@
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
12
+ import deepEqual from 'fast-deep-equal';
13
+ import { TypeGuards } from '@codeleap/types';
14
+ /**
15
+ * Class for managing mutations and cache updates for React Query list data
16
+ * @template T - The query item type that extends QueryItem
17
+ * @template F - The filter type used for list queries
18
+ */
19
+ export class Mutations {
20
+ /**
21
+ * Creates a new Mutations instance
22
+ * @param queryKeys - The QueryKeys instance for managing query keys
23
+ * @param queryClient - The React Query client instance
24
+ * @param queryName - The name of the query used for identification
25
+ */
26
+ constructor(queryKeys, queryClient, queryName) {
27
+ this.queryKeys = queryKeys;
28
+ this.queryClient = queryClient;
29
+ this.queryName = queryName;
30
+ }
31
+ /**
32
+ * Adds a new item to the cached list data
33
+ * @param newItem - The new item to add to the list
34
+ * @param position - Where to add the item: 'start', 'end', or a RemovedItemMap for specific positions
35
+ * @param listFilters - Optional filters to target specific list queries
36
+ *
37
+ * @example
38
+ * ```typescript
39
+ * // Add item to the beginning
40
+ * mutations.addItem(newUser, 'start')
41
+ *
42
+ * // Add item to the end with filters
43
+ * mutations.addItem(newUser, 'end', { status: 'active' })
44
+ *
45
+ * // Add item to specific positions (restore from removed item map)
46
+ * mutations.addItem(newUser, removedItemMap)
47
+ * ```
48
+ */
49
+ _addItemAtKey(newItem, position, queryKey) {
50
+ const currentData = this.queryClient.getQueryData(queryKey);
51
+ if (!currentData) {
52
+ this.queryClient.setQueryData(queryKey, { pageParams: [0], pages: [[newItem]] });
53
+ return;
54
+ }
55
+ const updatedPages = [...currentData.pages];
56
+ if (position === 'start') {
57
+ updatedPages.length > 0
58
+ ? updatedPages[0] = [newItem, ...updatedPages[0]]
59
+ : updatedPages.push([newItem]);
60
+ }
61
+ else {
62
+ const last = updatedPages.length - 1;
63
+ updatedPages.length > 0
64
+ ? updatedPages[last] = [...updatedPages[last], newItem]
65
+ : updatedPages.push([newItem]);
66
+ }
67
+ this.queryClient.setQueryData(queryKey, Object.assign(Object.assign({}, currentData), { pages: updatedPages }));
68
+ }
69
+ addItem(newItem, position = 'start', listFilters) {
70
+ const isMultiQueryKeys = Array.isArray(position) && (position === null || position === void 0 ? void 0 : position.length) >= 1;
71
+ if (isMultiQueryKeys) {
72
+ for (const [queryKey, itemPosition] of position) {
73
+ const currentData = this.queryClient.getQueryData(queryKey);
74
+ const updatedPages = [...((currentData === null || currentData === void 0 ? void 0 : currentData.pages) || [])];
75
+ if (itemPosition.pageIndex < updatedPages.length) {
76
+ const targetPage = [...updatedPages[itemPosition.pageIndex]];
77
+ const insertIndex = Math.min(itemPosition.itemIndex, targetPage.length);
78
+ targetPage.splice(insertIndex, 0, newItem);
79
+ updatedPages[itemPosition.pageIndex] = targetPage;
80
+ }
81
+ else {
82
+ const lastPageIndex = updatedPages.length - 1;
83
+ if (lastPageIndex >= 0) {
84
+ updatedPages[lastPageIndex] = [...updatedPages[lastPageIndex], newItem];
85
+ }
86
+ else {
87
+ updatedPages.push([newItem]);
88
+ }
89
+ }
90
+ this.queryClient.setQueryData(queryKey, Object.assign(Object.assign({}, currentData), { pages: updatedPages }));
91
+ }
92
+ return;
93
+ }
94
+ this._addItemAtKey(newItem, position, this.queryKeys.listKeyWithFilters(listFilters));
95
+ }
96
+ addItemToQuery(newItem, position = 'start', query) {
97
+ this._addItemAtKey(newItem, position, query.queryKey);
98
+ }
99
+ /**
100
+ * Removes an item from all or specific cached list query and returns the positions where it was found
101
+ * @param itemId - The ID of the item to remove
102
+ * @param listFilters - Optional filters to target a specific list query. If omitted, removes from all list queries
103
+ * @returns A RemovedItemMap containing the query keys and positions where the item was found, or null if not found in any query
104
+ *
105
+ * @example
106
+ * ```typescript
107
+ * // Remove from all list queries
108
+ * const removedPositions = mutations.removeItem('user-123')
109
+ *
110
+ * // Remove from a specific filtered list
111
+ * const removedPositions = mutations.removeItem('user-123', { status: 'active' })
112
+ *
113
+ * // Later, restore the item to its original positions
114
+ * if (removedPositions) {
115
+ * mutations.addItem(restoredUser, removedPositions)
116
+ * }
117
+ * ```
118
+ */
119
+ removeItem(itemId, listFilters) {
120
+ var _a, _b, _c;
121
+ this.queryKeys.removeRetrieveQueryData(itemId);
122
+ const listQueries = TypeGuards.isNil(listFilters) ? this.queryKeys.getAllListQueries() : [this.queryKeys.getListQuery(listFilters)];
123
+ const removedItemMap = [];
124
+ for (const query of listQueries) {
125
+ const currentData = (_a = query.state) === null || _a === void 0 ? void 0 : _a.data;
126
+ const queryKey = query === null || query === void 0 ? void 0 : query.queryKey;
127
+ if (!currentData)
128
+ continue;
129
+ let removedItemPosition = null;
130
+ for (let pageIndex = 0; pageIndex < ((_b = currentData === null || currentData === void 0 ? void 0 : currentData.pages) === null || _b === void 0 ? void 0 : _b.length); pageIndex++) {
131
+ const page = currentData.pages[pageIndex];
132
+ const itemIndex = page.findIndex((item) => (item === null || item === void 0 ? void 0 : item.id) === itemId);
133
+ if (itemIndex !== -1) {
134
+ removedItemPosition = {
135
+ pageIndex,
136
+ itemIndex,
137
+ };
138
+ break;
139
+ }
140
+ }
141
+ if (!removedItemPosition)
142
+ continue;
143
+ removedItemMap.push([queryKey, removedItemPosition]);
144
+ const updatedPages = currentData.pages.map(page => page.filter((item) => (item === null || item === void 0 ? void 0 : item.id) !== itemId));
145
+ const filteredPages = updatedPages.filter(page => (page === null || page === void 0 ? void 0 : page.length) > 0);
146
+ const finalPages = (filteredPages === null || filteredPages === void 0 ? void 0 : filteredPages.length) > 0 ? filteredPages : [[]];
147
+ const newPageParams = (_c = currentData === null || currentData === void 0 ? void 0 : currentData.pageParams) === null || _c === void 0 ? void 0 : _c.slice(0, finalPages === null || finalPages === void 0 ? void 0 : finalPages.length);
148
+ const newData = Object.assign(Object.assign({}, currentData), { pages: finalPages, pageParams: newPageParams });
149
+ this.queryClient.setQueryData(queryKey, newData);
150
+ }
151
+ return removedItemMap;
152
+ }
153
+ /**
154
+ * Updates existing items in all cached list queries and individual retrieve queries
155
+ * @param data - Single item or array of items to update. Items can have tempId for temporary identification
156
+ *
157
+ * @description
158
+ * This method:
159
+ * - Finds items by their ID or tempId in all list queries
160
+ * - Updates the items only if the data has actually changed (uses deep equality check)
161
+ * - Updates both list cache and individual retrieve cache
162
+ * - Removes tempId from the final cached data
163
+ *
164
+ * @example
165
+ * ```typescript
166
+ * // Update single item
167
+ * mutations.updateItems({ id: 'user-123', name: 'Updated Name', tempId: 'temp-1' })
168
+ *
169
+ * // Update multiple items
170
+ * mutations.updateItems([
171
+ * { id: 'user-123', name: 'Updated Name' },
172
+ * { id: 'user-456', status: 'active' }
173
+ * ])
174
+ * ```
175
+ */
176
+ updateItems(data) {
177
+ var _a, _b, _c, _d;
178
+ const listQueries = this.queryKeys.getAllListQueries();
179
+ const dataArray = Array.isArray(data) ? data : [data];
180
+ for (const item of dataArray) {
181
+ const { tempId } = item, updateData = __rest(item, ["tempId"]);
182
+ const cachedQueryKey = this.queryKeys.keys.retrieve(updateData.id);
183
+ const cachedItemData = this.queryKeys.getRetrieveData(updateData.id);
184
+ if (!deepEqual(cachedItemData, updateData)) {
185
+ this.queryClient.setQueryData(cachedQueryKey, updateData);
186
+ }
187
+ }
188
+ const dataMap = Object.fromEntries(dataArray.map(item => { var _a; return [(_a = item === null || item === void 0 ? void 0 : item.tempId) !== null && _a !== void 0 ? _a : item === null || item === void 0 ? void 0 : item.id, item]; }));
189
+ for (const query of listQueries) {
190
+ const oldData = (_a = query.state) === null || _a === void 0 ? void 0 : _a.data;
191
+ const queryKey = query === null || query === void 0 ? void 0 : query.queryKey;
192
+ if (!(oldData === null || oldData === void 0 ? void 0 : oldData.pages) || !Array.isArray(oldData === null || oldData === void 0 ? void 0 : oldData.pages))
193
+ continue;
194
+ let hasChanges = false;
195
+ const updatedPages = (_d = (_c = ((_b = oldData === null || oldData === void 0 ? void 0 : oldData.pages) !== null && _b !== void 0 ? _b : [])) === null || _c === void 0 ? void 0 : _c.filter(Array.isArray)) === null || _d === void 0 ? void 0 : _d.map(page => {
196
+ let pageChanged = false;
197
+ const updatedPage = page.map((item) => {
198
+ if (dataMap === null || dataMap === void 0 ? void 0 : dataMap[item === null || item === void 0 ? void 0 : item.id]) {
199
+ const _a = dataMap === null || dataMap === void 0 ? void 0 : dataMap[item === null || item === void 0 ? void 0 : item.id], { tempId } = _a, updateData = __rest(_a, ["tempId"]);
200
+ const needsUpdate = !deepEqual(item, updateData);
201
+ if (needsUpdate) {
202
+ pageChanged = true;
203
+ hasChanges = true;
204
+ return updateData;
205
+ }
206
+ }
207
+ return item;
208
+ });
209
+ return pageChanged ? updatedPage : page;
210
+ });
211
+ if (hasChanges) {
212
+ this.queryClient.setQueryData(queryKey, Object.assign(Object.assign({}, oldData), { pages: updatedPages }));
213
+ }
214
+ }
215
+ }
216
+ }
217
+ /**
218
+ * Factory function to create a new Mutations instance
219
+ * @template T - The query item type that extends QueryItem
220
+ * @template F - The filter type used for list queries
221
+ * @param queryKeys - The QueryKeys instance for managing query keys
222
+ * @param queryClient - The React Query client instance
223
+ * @param queryName - The name of the query used for identification
224
+ * @returns New Mutations instance
225
+ *
226
+ * @example
227
+ * ```typescript
228
+ * const userQueryKeys = createQueryKeys<User, UserFilters>('users', queryClient)
229
+ * const userMutations = createMutations(userQueryKeys, queryClient, 'users')
230
+ * ```
231
+ */
232
+ export const createMutations = (queryKeys, queryClient, queryName) => {
233
+ return new Mutations(queryKeys, queryClient, queryName);
234
+ };
235
+ //# sourceMappingURL=Mutations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Mutations.js","sourceRoot":"","sources":["../../src/lib/Mutations.ts"],"names":[],"mappings":";;;;;;;;;;;AAGA,OAAO,SAAS,MAAM,iBAAiB,CAAA;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAE5C;;;;GAIG;AACH,MAAM,OAAO,SAAS;IACpB;;;;;OAKG;IACH,YACU,SAA0B,EAC1B,WAAwB,EACxB,SAAiB;QAFjB,cAAS,GAAT,SAAS,CAAiB;QAC1B,gBAAW,GAAX,WAAW,CAAa;QACxB,cAAS,GAAT,SAAS,CAAQ;IACvB,CAAC;IAEL;;;;;;;;;;;;;;;;;OAiBG;IACK,aAAa,CAAC,OAAU,EAAE,QAAyB,EAAE,QAAkB;QAC7E,MAAM,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC,YAAY,CAAqD,QAAQ,CAAC,CAAA;QAE/G,IAAI,CAAC,WAAW,EAAE,CAAC;YACjB,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,QAAQ,EAAE,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,CAAA;YAChF,OAAM;QACR,CAAC;QAED,MAAM,YAAY,GAAG,CAAC,GAAG,WAAW,CAAC,KAAK,CAAC,CAAA;QAE3C,IAAI,QAAQ,KAAK,OAAO,EAAE,CAAC;YACzB,YAAY,CAAC,MAAM,GAAG,CAAC;gBACrB,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,EAAE,GAAG,YAAY,CAAC,CAAC,CAAC,CAAC;gBACjD,CAAC,CA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MAAM,KAA4B,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAG,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,EAAE,CAAC,EAA/C,EAAE,MAAM,OAAuC,EAAlC,UAAU,cAAvB,UAAyB,CAAsB,CAAA;wBAErD,MAAM,WAAW,GAAG,CAAC,SAAS,CAAC,IAAI,EAAE,UAAU,CAAC,CAAA;wBAEhD,IAAI,WAAW,EAAE,CAAC;4BAChB,WAAW,GAAG,IAAI,CAAA;4BAClB,UAAU,GAAG,IAAI,CAAA;4BACjB,OAAO,UAAU,CAAA;wBACnB,CAAC;oBACH,CAAC;oBAED,OAAO,IAAI,CAAA;gBACb,CAAC,CAAC,CAAA;gBAEF,OAAO,WAAW,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,CAAA;YACzC,CAAC,CAAC,CAAA;YAEF,IAAI,UAAU,EAAE,CAAC;gBACf,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,QAAQ,kCACjC,OAAO,KACV,KAAK,EAAE,YAAY,IACnB,CAAA;YACJ,CAAC;QACH,CAAC;IACH,CAAC;CACF;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAyB,SAA0B,EAAE,WAAwB,EAAE,SAAiB,EAAE,EAAE;IACjI,OAAO,IAAI,SAAS,CAAO,SAAS,EAAE,WAAW,EAAE,SAAS,CAAC,CAAA;AAC/D,CAAC,CAAA"}
@@ -0,0 +1,195 @@
1
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
+ return new (P || (P = Promise))(function (resolve, reject) {
4
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
8
+ });
9
+ };
10
+ import { waitFor } from '@codeleap/utils';
11
+ import { Query, hashKey, matchQuery } from '@tanstack/react-query';
12
+ /**
13
+ * Thin wrapper around React Query's `QueryClient` that adds async primitives for polling, event listening, and proxy-based query handles.
14
+ * Pass an instance of this class wherever `QueryClient | QueryClientEnhanced` is accepted to unlock the enhanced API.
15
+ */
16
+ export class QueryClientEnhanced {
17
+ constructor(client) {
18
+ this.client = client;
19
+ }
20
+ /**
21
+ * Subscribes to cache events for a single query key.
22
+ * Returns the unsubscribe function, or `undefined` when the query is not yet in the cache.
23
+ */
24
+ listenToQuery(key, callback) {
25
+ const cache = this.client.getQueryCache();
26
+ const query = cache.find({ exact: true, queryKey: key });
27
+ if (!query) {
28
+ return;
29
+ }
30
+ const removeListener = cache.subscribe((e) => {
31
+ const matches = matchQuery({ exact: true, queryKey: key }, e.query);
32
+ if (matches) {
33
+ callback(e);
34
+ }
35
+ });
36
+ return removeListener;
37
+ }
38
+ /**
39
+ * Repeatedly refetches a query on a fixed `interval` until the `callback` returns `{ stop: true }`.
40
+ * Rejects immediately if the query key is not present in the cache when called.
41
+ */
42
+ pollQuery(key, options) {
43
+ return __awaiter(this, void 0, void 0, function* () {
44
+ const { interval, callback, initialData, leading = false } = options;
45
+ const cache = this.client.getQueryCache();
46
+ const initialQuery = cache.find({ exact: true, queryKey: key });
47
+ if (!initialQuery) {
48
+ return Promise.reject(new Error('Query not found'));
49
+ }
50
+ let count = 0;
51
+ let result = {
52
+ stop: false,
53
+ data: initialData,
54
+ };
55
+ while (!(result === null || result === void 0 ? void 0 : result.stop)) {
56
+ const shouldWait = count > 0 || leading;
57
+ if (shouldWait) {
58
+ yield waitFor(interval);
59
+ }
60
+ this.client.refetchQueries({
61
+ exact: true,
62
+ queryKey: key,
63
+ });
64
+ const newQuery = yield this.waitForRefresh(key);
65
+ const newResult = yield callback(newQuery, count, result === null || result === void 0 ? void 0 : result.data);
66
+ count += 1;
67
+ result = newResult;
68
+ }
69
+ return result === null || result === void 0 ? void 0 : result.data;
70
+ });
71
+ }
72
+ /**
73
+ * Returns an `EnhancedQuery<T>` Proxy for `key`.
74
+ * `getData` and `setData` work even when the query is not yet in the cache; all other members log a warning and return `undefined` when the query is absent.
75
+ */
76
+ queryProxy(key) {
77
+ const getClient = () => this;
78
+ return new Proxy({}, {
79
+ get(target, p, receiver) {
80
+ const client = getClient();
81
+ // these don't need the actual query
82
+ switch (p) {
83
+ case 'key':
84
+ return key;
85
+ case 'getData':
86
+ return () => {
87
+ return client.client.getQueryData(key);
88
+ };
89
+ case 'setData':
90
+ return (updater) => {
91
+ return client.client.setQueryData(key, updater);
92
+ };
93
+ default:
94
+ break;
95
+ }
96
+ const cache = client.client.getQueryCache();
97
+ const query = cache.find({ exact: true, queryKey: key });
98
+ if (!query) {
99
+ console.warn(`Attempt to access property ${String(p)} on undefined query with key`, key);
100
+ return undefined;
101
+ }
102
+ switch (p) {
103
+ case 'waitForRefresh':
104
+ return () => {
105
+ return client.waitForRefresh(key);
106
+ };
107
+ case 'listen':
108
+ return (callback) => {
109
+ return client.listenToQuery(key, callback);
110
+ };
111
+ case 'ensureData':
112
+ return (options) => {
113
+ return client.client.ensureQueryData(Object.assign({ queryKey: key }, options));
114
+ };
115
+ case 'refresh':
116
+ return () => __awaiter(this, void 0, void 0, function* () {
117
+ client.client.refetchQueries({
118
+ exact: true,
119
+ queryKey: key,
120
+ });
121
+ const newQuery = yield client.waitForRefresh(key);
122
+ return newQuery.state.data;
123
+ });
124
+ case 'poll':
125
+ return (options) => {
126
+ return client.pollQuery(key, options);
127
+ };
128
+ default:
129
+ return Reflect.get(query, p, query);
130
+ }
131
+ },
132
+ });
133
+ }
134
+ /**
135
+ * Resolves with the refreshed `Query` object once it reaches a settled `idle` state with a `dataUpdatedAt` or `errorUpdatedAt` timestamp newer than the moment of the call.
136
+ * Rejects when the query is absent from the cache or when the fetch results in an error.
137
+ */
138
+ waitForRefresh(key) {
139
+ const initialQuery = this.client.getQueryCache().find({ exact: true, queryKey: key });
140
+ if (!initialQuery) {
141
+ return Promise.reject(new Error('Query not found'));
142
+ }
143
+ const updateTime = initialQuery.state.dataUpdatedAt;
144
+ const errorTime = initialQuery.state.errorUpdatedAt;
145
+ return new Promise((resolve, reject) => {
146
+ const removeListener = this.listenToQuery(key, (e) => {
147
+ const query = e.query;
148
+ const isNewer = query.state.dataUpdatedAt > updateTime || query.state.errorUpdatedAt > errorTime;
149
+ const isIdle = query.state.fetchStatus === 'idle';
150
+ const isSuccess = query.state.status === 'success';
151
+ const isError = query.state.status === 'error';
152
+ const isResolved = isSuccess || isError;
153
+ if (isNewer && isIdle && isResolved) {
154
+ if (isSuccess) {
155
+ resolve(query);
156
+ }
157
+ else {
158
+ reject();
159
+ }
160
+ removeListener === null || removeListener === void 0 ? void 0 : removeListener();
161
+ }
162
+ });
163
+ });
164
+ }
165
+ /**
166
+ * Registers a static query key and returns an `EnhancedQuery<Data>` proxy for it.
167
+ * When `options` are provided they are applied as query defaults and the query is pre-seeded in the cache — useful for initialising queries outside of a React component.
168
+ */
169
+ queryKey(k, options) {
170
+ if (options) {
171
+ this.client.setQueryDefaults(k, options);
172
+ const cache = this.client.getQueryCache();
173
+ const q = new Query(Object.assign({ client: this.client, queryKey: k, queryHash: hashKey(k) }, options));
174
+ cache.add(q);
175
+ }
176
+ return this.queryProxy(k);
177
+ }
178
+ /**
179
+ * Returns a `DynamicEnhancedQuery` proxy whose every member is a function that accepts `BuilderArgs` to derive the final key before delegating.
180
+ * Use this when the query key depends on runtime parameters (e.g. `(id: string) => ['users', id]`).
181
+ */
182
+ dynamicQueryKey(k) {
183
+ const getClient = () => this;
184
+ return new Proxy({}, {
185
+ get(target, p, receiver) {
186
+ return (...params) => {
187
+ const key = k(...params);
188
+ const proxy = getClient().queryProxy(key);
189
+ return Reflect.get(proxy, p, proxy);
190
+ };
191
+ },
192
+ });
193
+ }
194
+ }
195
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
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AGG;IACH,eAAe,CAA0C,CAA+B;QACtF,MAAM,SAAS,GAAG,GAAG,EAAE,CAAC,IAAI,CAAA;QAE5B,OAAO,IAAI,KAAK,CAA0C,EAA6C,EAAE;YACvG,GAAG,CAAC,MAAM,EAAE,CAAC,EAAE,QAAQ;gBACrB,OAAO,CAAC,GAAG,MAAmB,EAAE,EAAE;oBAChC,MAAM,GAAG,GAAG,CAAC,CAAC,GAAG,MAAM,CAAC,CAAA;oBAExB,MAAM,KAAK,GAAG,SAAS,EAAE,CAAC,UAAU,CAAO,GAAG,CAAC,CAAA;oBAE/C,OAAO,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,EAAE,KAAK,CAAC,CAAA;gBACrC,CAAC,CAAA;YACH,CAAC;SACF,CAAC,CAAA;IACJ,CAAC;CACF"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/lib/QueryClientEnhanced/types.ts"],"names":[],"mappings":""}