@codeleap/query 7.0.0 → 7.0.2

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 (48) hide show
  1. package/dist/factors/createQueryManager.js +41 -0
  2. package/dist/factors/createQueryManager.js.map +1 -0
  3. package/dist/factors/createQueryOperations.js +39 -0
  4. package/dist/factors/createQueryOperations.js.map +1 -0
  5. package/dist/factors/index.js +19 -0
  6. package/dist/factors/index.js.map +1 -0
  7. package/dist/index.js +20 -0
  8. package/dist/index.js.map +1 -0
  9. package/dist/lib/Mutations.js +243 -0
  10. package/dist/lib/Mutations.js.map +1 -0
  11. package/dist/lib/QueryClientEnhanced/index.js +199 -0
  12. package/dist/lib/QueryClientEnhanced/index.js.map +1 -0
  13. package/dist/lib/QueryClientEnhanced/types.js +3 -0
  14. package/dist/lib/QueryClientEnhanced/types.js.map +1 -0
  15. package/dist/lib/QueryKeys.js +321 -0
  16. package/dist/lib/QueryKeys.js.map +1 -0
  17. package/dist/lib/QueryManager.d.ts +3 -3
  18. package/dist/lib/QueryManager.js +404 -0
  19. package/dist/lib/QueryManager.js.map +1 -0
  20. package/dist/lib/QueryOperations/index.d.ts +2 -2
  21. package/dist/lib/QueryOperations/index.d.ts.map +1 -1
  22. package/dist/lib/QueryOperations/index.js +288 -0
  23. package/dist/lib/QueryOperations/index.js.map +1 -0
  24. package/dist/lib/QueryOperations/types.js +3 -0
  25. package/dist/lib/QueryOperations/types.js.map +1 -0
  26. package/dist/lib/index.js +22 -0
  27. package/dist/lib/index.js.map +1 -0
  28. package/dist/types/core.js +3 -0
  29. package/dist/types/core.js.map +1 -0
  30. package/dist/types/create.js +3 -0
  31. package/dist/types/create.js.map +1 -0
  32. package/dist/types/delete.js +3 -0
  33. package/dist/types/delete.js.map +1 -0
  34. package/dist/types/index.js +24 -0
  35. package/dist/types/index.js.map +1 -0
  36. package/dist/types/list.js +3 -0
  37. package/dist/types/list.js.map +1 -0
  38. package/dist/types/retrieve.js +3 -0
  39. package/dist/types/retrieve.js.map +1 -0
  40. package/dist/types/update.js +3 -0
  41. package/dist/types/update.js.map +1 -0
  42. package/dist/types/utility.js +3 -0
  43. package/dist/types/utility.js.map +1 -0
  44. package/dist/utils/index.js +18 -0
  45. package/dist/utils/index.js.map +1 -0
  46. package/dist/utils/misc.js +39 -0
  47. package/dist/utils/misc.js.map +1 -0
  48. package/package.json +6 -6
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createQueryManager = void 0;
4
+ const lib_1 = require("../lib");
5
+ /**
6
+ * Factory function to create a new QueryManager instance
7
+ * @template T - The query item type that extends QueryItem
8
+ * @template F - The filter type used for list queries
9
+ * @param options - Configuration options for the query manager
10
+ * @returns New QueryManager instance
11
+ *
12
+ * @example
13
+ * ```typescript
14
+ * interface User extends QueryItem {
15
+ * name: string
16
+ * email: string
17
+ * status: 'active' | 'inactive'
18
+ * }
19
+ *
20
+ * interface UserFilters {
21
+ * status?: 'active' | 'inactive'
22
+ * search?: string
23
+ * }
24
+ *
25
+ * const userQueryManager = createQueryManager<User, UserFilters>({
26
+ * name: 'users',
27
+ * queryClient,
28
+ * listFn: (limit, offset, filters) => api.getUsers({ limit, offset, ...filters }),
29
+ * retrieveFn: (id) => api.getUser(id),
30
+ * createFn: (data) => api.createUser(data),
31
+ * updateFn: (data) => api.updateUser(data.id, data),
32
+ * deleteFn: (id) => api.deleteUser(id),
33
+ * listLimit: 20
34
+ * })
35
+ * ```
36
+ */
37
+ const createQueryManager = (options) => {
38
+ return new lib_1.QueryManager(options);
39
+ };
40
+ exports.createQueryManager = createQueryManager;
41
+ //# sourceMappingURL=createQueryManager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createQueryManager.js","sourceRoot":"","sources":["../../src/factors/createQueryManager.ts"],"names":[],"mappings":";;;AAAA,gCAAqC;AAGrC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACI,MAAM,kBAAkB,GAAG,CAA8B,OAAkC,EAAE,EAAE;IACpG,OAAO,IAAI,kBAAY,CAAO,OAAO,CAAC,CAAA;AACxC,CAAC,CAAA;AAFY,QAAA,kBAAkB,sBAE9B"}
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createQueryOperations = createQueryOperations;
4
+ const lib_1 = require("../lib");
5
+ /**
6
+ * Factory function to create a new QueryOperations builder instance
7
+ * @param options - Configuration options including the QueryClient
8
+ * @returns New QueryOperations instance ready for operation registration
9
+ *
10
+ * @description
11
+ * This is the entry point for creating a new QueryOperations instance. Use this
12
+ * function to start building your collection of queries and mutations.
13
+ *
14
+ * @example
15
+ * ```typescript
16
+ * import { QueryClient } from '@tanstack/react-query'
17
+ *
18
+ * const queryClient = new QueryClient()
19
+ *
20
+ * const userOperations = createQueryOperations({ queryClient })
21
+ * .query('getUser', async (id: string) => fetchUser(id))
22
+ * .query('getUsers', async (filters?: UserFilters) => fetchUsers(filters))
23
+ * .mutation('createUser', async (data: CreateUserData) => createUser(data))
24
+ * .mutation('updateUser', async (data: UpdateUserData) => updateUser(data))
25
+ * .mutation('deleteUser', async (id: string) => deleteUser(id))
26
+ *
27
+ * // In components
28
+ * function UserList() {
29
+ * const usersQuery = userOperations.useQuery('getUsers', { active: true })
30
+ * const createMutation = userOperations.useMutation('createUser')
31
+ *
32
+ * // Both hooks are fully type-safe
33
+ * }
34
+ * ```
35
+ */
36
+ function createQueryOperations(options) {
37
+ return new lib_1.QueryOperations(options);
38
+ }
39
+ //# sourceMappingURL=createQueryOperations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createQueryOperations.js","sourceRoot":"","sources":["../../src/factors/createQueryOperations.ts"],"names":[],"mappings":";;AAkCA,sDAEC;AApCD,gCAAwC;AAGxC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,SAAgB,qBAAqB,CAAC,OAA+B;IACnE,OAAO,IAAI,qBAAe,CAAC,OAAO,CAAC,CAAA;AACrC,CAAC"}
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./createQueryManager"), exports);
18
+ __exportStar(require("./createQueryOperations"), exports);
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/factors/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uDAAoC;AACpC,0DAAuC"}
package/dist/index.js ADDED
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./lib"), exports);
18
+ __exportStar(require("./types"), exports);
19
+ __exportStar(require("./factors"), exports);
20
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wCAAqB;AACrB,0CAAuB;AACvB,4CAAyB"}
@@ -0,0 +1,243 @@
1
+ "use strict";
2
+ var __rest = (this && this.__rest) || function (s, e) {
3
+ var t = {};
4
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
5
+ t[p] = s[p];
6
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
7
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
8
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
9
+ t[p[i]] = s[p[i]];
10
+ }
11
+ return t;
12
+ };
13
+ var __importDefault = (this && this.__importDefault) || function (mod) {
14
+ return (mod && mod.__esModule) ? mod : { "default": mod };
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.createMutations = exports.Mutations = void 0;
18
+ const fast_deep_equal_1 = __importDefault(require("fast-deep-equal"));
19
+ const types_1 = require("@codeleap/types");
20
+ /**
21
+ * Class for managing mutations and cache updates for React Query list data
22
+ * @template T - The query item type that extends QueryItem
23
+ * @template F - The filter type used for list queries
24
+ */
25
+ class Mutations {
26
+ /**
27
+ * Creates a new Mutations instance
28
+ * @param queryKeys - The QueryKeys instance for managing query keys
29
+ * @param queryClient - The React Query client instance
30
+ * @param queryName - The name of the query used for identification
31
+ */
32
+ constructor(queryKeys, queryClient, queryName) {
33
+ this.queryKeys = queryKeys;
34
+ this.queryClient = queryClient;
35
+ this.queryName = queryName;
36
+ }
37
+ /**
38
+ * Adds a new item to the cached list data
39
+ * @param newItem - The new item to add to the list
40
+ * @param position - Where to add the item: 'start', 'end', or a RemovedItemMap for specific positions
41
+ * @param listFilters - Optional filters to target specific list queries
42
+ *
43
+ * @example
44
+ * ```typescript
45
+ * // Add item to the beginning
46
+ * mutations.addItem(newUser, 'start')
47
+ *
48
+ * // Add item to the end with filters
49
+ * mutations.addItem(newUser, 'end', { status: 'active' })
50
+ *
51
+ * // Add item to specific positions (restore from removed item map)
52
+ * mutations.addItem(newUser, removedItemMap)
53
+ * ```
54
+ */
55
+ _addItemAtKey(newItem, position, queryKey) {
56
+ const currentData = this.queryClient.getQueryData(queryKey);
57
+ if (!currentData) {
58
+ this.queryClient.setQueryData(queryKey, { pageParams: [0], pages: [[newItem]] });
59
+ return;
60
+ }
61
+ const updatedPages = [...currentData.pages];
62
+ if (position === 'start') {
63
+ updatedPages.length > 0
64
+ ? updatedPages[0] = [newItem, ...updatedPages[0]]
65
+ : updatedPages.push([newItem]);
66
+ }
67
+ else {
68
+ const last = updatedPages.length - 1;
69
+ updatedPages.length > 0
70
+ ? updatedPages[last] = [...updatedPages[last], newItem]
71
+ : updatedPages.push([newItem]);
72
+ }
73
+ this.queryClient.setQueryData(queryKey, Object.assign(Object.assign({}, currentData), { pages: updatedPages }));
74
+ }
75
+ addItem(newItem, position = 'start', listFilters) {
76
+ const isMultiQueryKeys = Array.isArray(position) && (position === null || position === void 0 ? void 0 : position.length) >= 1;
77
+ if (isMultiQueryKeys) {
78
+ for (const [queryKey, itemPosition] of position) {
79
+ const currentData = this.queryClient.getQueryData(queryKey);
80
+ const updatedPages = [...((currentData === null || currentData === void 0 ? void 0 : currentData.pages) || [])];
81
+ if (itemPosition.pageIndex < updatedPages.length) {
82
+ const targetPage = [...updatedPages[itemPosition.pageIndex]];
83
+ const insertIndex = Math.min(itemPosition.itemIndex, targetPage.length);
84
+ targetPage.splice(insertIndex, 0, newItem);
85
+ updatedPages[itemPosition.pageIndex] = targetPage;
86
+ }
87
+ else {
88
+ const lastPageIndex = updatedPages.length - 1;
89
+ if (lastPageIndex >= 0) {
90
+ updatedPages[lastPageIndex] = [...updatedPages[lastPageIndex], newItem];
91
+ }
92
+ else {
93
+ updatedPages.push([newItem]);
94
+ }
95
+ }
96
+ this.queryClient.setQueryData(queryKey, Object.assign(Object.assign({}, currentData), { pages: updatedPages }));
97
+ }
98
+ return;
99
+ }
100
+ this._addItemAtKey(newItem, position, this.queryKeys.listKeyWithFilters(listFilters));
101
+ }
102
+ addItemToQuery(newItem, position = 'start', query) {
103
+ this._addItemAtKey(newItem, position, query.queryKey);
104
+ }
105
+ /**
106
+ * Removes an item from all or specific cached list query and returns the positions where it was found
107
+ * @param itemId - The ID of the item to remove
108
+ * @param listFilters - Optional filters to target a specific list query. If omitted, removes from all list queries
109
+ * @returns A RemovedItemMap containing the query keys and positions where the item was found, or null if not found in any query
110
+ *
111
+ * @example
112
+ * ```typescript
113
+ * // Remove from all list queries
114
+ * const removedPositions = mutations.removeItem('user-123')
115
+ *
116
+ * // Remove from a specific filtered list
117
+ * const removedPositions = mutations.removeItem('user-123', { status: 'active' })
118
+ *
119
+ * // Later, restore the item to its original positions
120
+ * if (removedPositions) {
121
+ * mutations.addItem(restoredUser, removedPositions)
122
+ * }
123
+ * ```
124
+ */
125
+ removeItem(itemId, listFilters) {
126
+ var _a, _b, _c;
127
+ this.queryKeys.removeRetrieveQueryData(itemId);
128
+ const listQueries = types_1.TypeGuards.isNil(listFilters) ? this.queryKeys.getAllListQueries() : [this.queryKeys.getListQuery(listFilters)];
129
+ const removedItemMap = [];
130
+ for (const query of listQueries) {
131
+ const currentData = (_a = query.state) === null || _a === void 0 ? void 0 : _a.data;
132
+ const queryKey = query === null || query === void 0 ? void 0 : query.queryKey;
133
+ if (!currentData)
134
+ continue;
135
+ let removedItemPosition = null;
136
+ for (let pageIndex = 0; pageIndex < ((_b = currentData === null || currentData === void 0 ? void 0 : currentData.pages) === null || _b === void 0 ? void 0 : _b.length); pageIndex++) {
137
+ const page = currentData.pages[pageIndex];
138
+ const itemIndex = page.findIndex((item) => (item === null || item === void 0 ? void 0 : item.id) === itemId);
139
+ if (itemIndex !== -1) {
140
+ removedItemPosition = {
141
+ pageIndex,
142
+ itemIndex,
143
+ };
144
+ break;
145
+ }
146
+ }
147
+ if (!removedItemPosition)
148
+ continue;
149
+ removedItemMap.push([queryKey, removedItemPosition]);
150
+ const updatedPages = currentData.pages.map(page => page.filter((item) => (item === null || item === void 0 ? void 0 : item.id) !== itemId));
151
+ const filteredPages = updatedPages.filter(page => (page === null || page === void 0 ? void 0 : page.length) > 0);
152
+ const finalPages = (filteredPages === null || filteredPages === void 0 ? void 0 : filteredPages.length) > 0 ? filteredPages : [[]];
153
+ 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);
154
+ const newData = Object.assign(Object.assign({}, currentData), { pages: finalPages, pageParams: newPageParams });
155
+ this.queryClient.setQueryData(queryKey, newData);
156
+ }
157
+ return removedItemMap;
158
+ }
159
+ /**
160
+ * Updates existing items in all cached list queries and individual retrieve queries
161
+ * @param data - Single item or array of items to update. Items can have tempId for temporary identification
162
+ *
163
+ * @description
164
+ * This method:
165
+ * - Finds items by their ID or tempId in all list queries
166
+ * - Updates the items only if the data has actually changed (uses deep equality check)
167
+ * - Updates both list cache and individual retrieve cache
168
+ * - Removes tempId from the final cached data
169
+ *
170
+ * @example
171
+ * ```typescript
172
+ * // Update single item
173
+ * mutations.updateItems({ id: 'user-123', name: 'Updated Name', tempId: 'temp-1' })
174
+ *
175
+ * // Update multiple items
176
+ * mutations.updateItems([
177
+ * { id: 'user-123', name: 'Updated Name' },
178
+ * { id: 'user-456', status: 'active' }
179
+ * ])
180
+ * ```
181
+ */
182
+ updateItems(data) {
183
+ var _a, _b, _c, _d;
184
+ const listQueries = this.queryKeys.getAllListQueries();
185
+ const dataArray = Array.isArray(data) ? data : [data];
186
+ for (const item of dataArray) {
187
+ const { tempId } = item, updateData = __rest(item, ["tempId"]);
188
+ const cachedQueryKey = this.queryKeys.keys.retrieve(updateData.id);
189
+ const cachedItemData = this.queryKeys.getRetrieveData(updateData.id);
190
+ if (!(0, fast_deep_equal_1.default)(cachedItemData, updateData)) {
191
+ this.queryClient.setQueryData(cachedQueryKey, updateData);
192
+ }
193
+ }
194
+ 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]; }));
195
+ for (const query of listQueries) {
196
+ const oldData = (_a = query.state) === null || _a === void 0 ? void 0 : _a.data;
197
+ const queryKey = query === null || query === void 0 ? void 0 : query.queryKey;
198
+ if (!(oldData === null || oldData === void 0 ? void 0 : oldData.pages) || !Array.isArray(oldData === null || oldData === void 0 ? void 0 : oldData.pages))
199
+ continue;
200
+ let hasChanges = false;
201
+ 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 => {
202
+ let pageChanged = false;
203
+ const updatedPage = page.map((item) => {
204
+ if (dataMap === null || dataMap === void 0 ? void 0 : dataMap[item === null || item === void 0 ? void 0 : item.id]) {
205
+ 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"]);
206
+ const needsUpdate = !(0, fast_deep_equal_1.default)(item, updateData);
207
+ if (needsUpdate) {
208
+ pageChanged = true;
209
+ hasChanges = true;
210
+ return updateData;
211
+ }
212
+ }
213
+ return item;
214
+ });
215
+ return pageChanged ? updatedPage : page;
216
+ });
217
+ if (hasChanges) {
218
+ this.queryClient.setQueryData(queryKey, Object.assign(Object.assign({}, oldData), { pages: updatedPages }));
219
+ }
220
+ }
221
+ }
222
+ }
223
+ exports.Mutations = Mutations;
224
+ /**
225
+ * Factory function to create a new Mutations instance
226
+ * @template T - The query item type that extends QueryItem
227
+ * @template F - The filter type used for list queries
228
+ * @param queryKeys - The QueryKeys instance for managing query keys
229
+ * @param queryClient - The React Query client instance
230
+ * @param queryName - The name of the query used for identification
231
+ * @returns New Mutations instance
232
+ *
233
+ * @example
234
+ * ```typescript
235
+ * const userQueryKeys = createQueryKeys<User, UserFilters>('users', queryClient)
236
+ * const userMutations = createMutations(userQueryKeys, queryClient, 'users')
237
+ * ```
238
+ */
239
+ const createMutations = (queryKeys, queryClient, queryName) => {
240
+ return new Mutations(queryKeys, queryClient, queryName);
241
+ };
242
+ exports.createMutations = createMutations;
243
+ //# sourceMappingURL=Mutations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Mutations.js","sourceRoot":"","sources":["../../src/lib/Mutations.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAGA,sEAAuC;AACvC,2CAA4C;AAE5C;;;;GAIG;AACH,MAAa,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,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MAAM,WAAW,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;oBACpC,IAAI,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAG,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,EAAE,CAAC,EAAE,CAAC;wBACxB,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,IAAA,yBAAS,EAAC,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;AAjPD,8BAiPC;AAED;;;;;;;;;;;;;;GAcG;AACI,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;AAFY,QAAA,eAAe,mBAE3B"}
@@ -0,0 +1,199 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.QueryClientEnhanced = void 0;
13
+ const utils_1 = require("@codeleap/utils");
14
+ const react_query_1 = require("@tanstack/react-query");
15
+ /**
16
+ * Thin wrapper around React Query's `QueryClient` that adds async primitives for polling, event listening, and proxy-based query handles.
17
+ * Pass an instance of this class wherever `QueryClient | QueryClientEnhanced` is accepted to unlock the enhanced API.
18
+ */
19
+ class QueryClientEnhanced {
20
+ constructor(client) {
21
+ this.client = client;
22
+ }
23
+ /**
24
+ * Subscribes to cache events for a single query key.
25
+ * Returns the unsubscribe function, or `undefined` when the query is not yet in the cache.
26
+ */
27
+ listenToQuery(key, callback) {
28
+ const cache = this.client.getQueryCache();
29
+ const query = cache.find({ exact: true, queryKey: key });
30
+ if (!query) {
31
+ return;
32
+ }
33
+ const removeListener = cache.subscribe((e) => {
34
+ const matches = (0, react_query_1.matchQuery)({ exact: true, queryKey: key }, e.query);
35
+ if (matches) {
36
+ callback(e);
37
+ }
38
+ });
39
+ return removeListener;
40
+ }
41
+ /**
42
+ * Repeatedly refetches a query on a fixed `interval` until the `callback` returns `{ stop: true }`.
43
+ * Rejects immediately if the query key is not present in the cache when called.
44
+ */
45
+ pollQuery(key, options) {
46
+ return __awaiter(this, void 0, void 0, function* () {
47
+ const { interval, callback, initialData, leading = false } = options;
48
+ const cache = this.client.getQueryCache();
49
+ const initialQuery = cache.find({ exact: true, queryKey: key });
50
+ if (!initialQuery) {
51
+ return Promise.reject(new Error('Query not found'));
52
+ }
53
+ let count = 0;
54
+ let result = {
55
+ stop: false,
56
+ data: initialData,
57
+ };
58
+ while (!(result === null || result === void 0 ? void 0 : result.stop)) {
59
+ const shouldWait = count > 0 || leading;
60
+ if (shouldWait) {
61
+ yield (0, utils_1.waitFor)(interval);
62
+ }
63
+ this.client.refetchQueries({
64
+ exact: true,
65
+ queryKey: key,
66
+ });
67
+ const newQuery = yield this.waitForRefresh(key);
68
+ const newResult = yield callback(newQuery, count, result === null || result === void 0 ? void 0 : result.data);
69
+ count += 1;
70
+ result = newResult;
71
+ }
72
+ return result === null || result === void 0 ? void 0 : result.data;
73
+ });
74
+ }
75
+ /**
76
+ * Returns an `EnhancedQuery<T>` Proxy for `key`.
77
+ * `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.
78
+ */
79
+ queryProxy(key) {
80
+ const getClient = () => this;
81
+ return new Proxy({}, {
82
+ get(target, p, receiver) {
83
+ const client = getClient();
84
+ // these don't need the actual query
85
+ switch (p) {
86
+ case 'key':
87
+ return key;
88
+ case 'getData':
89
+ return () => {
90
+ return client.client.getQueryData(key);
91
+ };
92
+ case 'setData':
93
+ return (updater) => {
94
+ return client.client.setQueryData(key, updater);
95
+ };
96
+ default:
97
+ break;
98
+ }
99
+ const cache = client.client.getQueryCache();
100
+ const query = cache.find({ exact: true, queryKey: key });
101
+ if (!query) {
102
+ console.warn(`Attempt to access property ${String(p)} on undefined query with key`, key);
103
+ return undefined;
104
+ }
105
+ switch (p) {
106
+ case 'waitForRefresh':
107
+ return () => {
108
+ return client.waitForRefresh(key);
109
+ };
110
+ case 'listen':
111
+ return (callback) => {
112
+ return client.listenToQuery(key, callback);
113
+ };
114
+ case 'ensureData':
115
+ return (options) => {
116
+ return client.client.ensureQueryData(Object.assign({ queryKey: key }, options));
117
+ };
118
+ case 'refresh':
119
+ return () => __awaiter(this, void 0, void 0, function* () {
120
+ client.client.refetchQueries({
121
+ exact: true,
122
+ queryKey: key,
123
+ });
124
+ const newQuery = yield client.waitForRefresh(key);
125
+ return newQuery.state.data;
126
+ });
127
+ case 'poll':
128
+ return (options) => {
129
+ return client.pollQuery(key, options);
130
+ };
131
+ default:
132
+ return Reflect.get(query, p, query);
133
+ }
134
+ },
135
+ });
136
+ }
137
+ /**
138
+ * 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.
139
+ * Rejects when the query is absent from the cache or when the fetch results in an error.
140
+ */
141
+ waitForRefresh(key) {
142
+ const initialQuery = this.client.getQueryCache().find({ exact: true, queryKey: key });
143
+ if (!initialQuery) {
144
+ return Promise.reject(new Error('Query not found'));
145
+ }
146
+ const updateTime = initialQuery.state.dataUpdatedAt;
147
+ const errorTime = initialQuery.state.errorUpdatedAt;
148
+ return new Promise((resolve, reject) => {
149
+ const removeListener = this.listenToQuery(key, (e) => {
150
+ const query = e.query;
151
+ const isNewer = query.state.dataUpdatedAt > updateTime || query.state.errorUpdatedAt > errorTime;
152
+ const isIdle = query.state.fetchStatus === 'idle';
153
+ const isSuccess = query.state.status === 'success';
154
+ const isError = query.state.status === 'error';
155
+ const isResolved = isSuccess || isError;
156
+ if (isNewer && isIdle && isResolved) {
157
+ if (isSuccess) {
158
+ resolve(query);
159
+ }
160
+ else {
161
+ reject();
162
+ }
163
+ removeListener === null || removeListener === void 0 ? void 0 : removeListener();
164
+ }
165
+ });
166
+ });
167
+ }
168
+ /**
169
+ * Registers a static query key and returns an `EnhancedQuery<Data>` proxy for it.
170
+ * 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.
171
+ */
172
+ queryKey(k, options) {
173
+ if (options) {
174
+ this.client.setQueryDefaults(k, options);
175
+ const cache = this.client.getQueryCache();
176
+ const q = new react_query_1.Query(Object.assign({ client: this.client, queryKey: k, queryHash: (0, react_query_1.hashKey)(k) }, options));
177
+ cache.add(q);
178
+ }
179
+ return this.queryProxy(k);
180
+ }
181
+ /**
182
+ * Returns a `DynamicEnhancedQuery` proxy whose every member is a function that accepts `BuilderArgs` to derive the final key before delegating.
183
+ * Use this when the query key depends on runtime parameters (e.g. `(id: string) => ['users', id]`).
184
+ */
185
+ dynamicQueryKey(k) {
186
+ const getClient = () => this;
187
+ return new Proxy({}, {
188
+ get(target, p, receiver) {
189
+ return (...params) => {
190
+ const key = k(...params);
191
+ const proxy = getClient().queryProxy(key);
192
+ return Reflect.get(proxy, p, proxy);
193
+ };
194
+ },
195
+ });
196
+ }
197
+ }
198
+ exports.QueryClientEnhanced = QueryClientEnhanced;
199
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/lib/QueryClientEnhanced/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAAyC;AACzC,uDAA8H;AAG9H;;;GAGG;AACH,MAAa,mBAAmB;IAC9B,YAAmB,MAAmB;QAAnB,WAAM,GAAN,MAAM,CAAa;IAAI,CAAC;IAE3C;;;OAGG;IACH,aAAa,CAAC,GAAa,EAAE,QAA4C;QACvE,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,aAAa,EAAE,CAAA;QAEzC,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,CAAA;QAExD,IAAI,CAAC,KAAK,EAAE,CAAC;YACX,OAAM;QACR,CAAC;QAED,MAAM,cAAc,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE;YAC3C,MAAM,OAAO,GAAG,IAAA,wBAAU,EAAC,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,CAAA;YAEnE,IAAI,OAAO,EAAE,CAAC;gBACZ,QAAQ,CAAC,CAAC,CAAC,CAAA;YAEb,CAAC;QACH,CAAC,CAAC,CAAA;QAEF,OAAO,cAAc,CAAA;IACvB,CAAC;IAED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GAAG,IAAI,mBAAK,iBACjB,MAAM,EAAE,IAAI,CAAC,MAAM,EACnB,QAAQ,EAAE,CAAC,EACX,SAAS,EAAE,IAAA,qBAAO,EAAC,CAAC,CAAC,IAClB,OAAO,EACV,CAAA;YAEF,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAA;QACd,CAAC;QAED,OAAO,IAAI,CAAC,UAAU,CAAO,CAAC,CAAC,CAAA;IACjC,CAAC;IAED;;;OAGG;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;AA9OD,kDA8OC"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/lib/QueryClientEnhanced/types.ts"],"names":[],"mappings":""}