@simpleapps-com/augur-hooks 2.0.22 → 2.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.
@@ -1,748 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }// src/queries/stable-stringify.ts
2
- var _augurcore = require('@simpleapps-com/augur-core');
3
-
4
- // src/queries/cache-helper.ts
5
- function fnv1a(str) {
6
- let h = 2166136261;
7
- for (let i = 0; i < str.length; i++) {
8
- h ^= str.charCodeAt(i);
9
- h = Math.imul(h, 16777619);
10
- }
11
- return (h >>> 0).toString(16).padStart(8, "0");
12
- }
13
- async function withCache(provider, tier, methodPath, fn, ...keyArgs) {
14
- const redisTtl = _optionalChain([tier, 'optionalAccess', _ => _.redis]);
15
- if (!provider || !redisTtl) return fn();
16
- const key = `${provider.prefix}sdk:${methodPath}:${fnv1a(_augurcore.stableStringify.call(void 0, keyArgs))}`;
17
- try {
18
- const cached = await provider.get(key);
19
- if (cached != null) return JSON.parse(cached);
20
- } catch (e) {
21
- }
22
- const result = await fn();
23
- try {
24
- provider.set(key, JSON.stringify(result), redisTtl).catch(() => {
25
- });
26
- } catch (e2) {
27
- }
28
- return result;
29
- }
30
-
31
- // src/queries/item-price.ts
32
- var getItemPriceKey = (itemId, customerId, quantity = 1) => {
33
- return ["price", _optionalChain([itemId, 'optionalAccess', _2 => _2.toUpperCase, 'call', _3 => _3()]) || "", customerId, quantity];
34
- };
35
- var getItemPriceOptions = (api, itemId, customerId, quantity = 1, cache) => {
36
- const tier = _optionalChain([cache, 'optionalAccess', _4 => _4.semiStatic]);
37
- return {
38
- queryKey: getItemPriceKey(itemId, customerId, quantity),
39
- queryFn: async () => {
40
- const edgeCache = _optionalChain([tier, 'optionalAccess', _5 => _5.edgeCache]);
41
- return withCache(
42
- _optionalChain([cache, 'optionalAccess', _6 => _6.provider]),
43
- tier,
44
- "pricing.priceEngine.get",
45
- async () => {
46
- const response = await api.pricing.priceEngine.get({
47
- itemId: _optionalChain([itemId, 'optionalAccess', _7 => _7.toUpperCase, 'call', _8 => _8()]) || "",
48
- customerId: Number(customerId),
49
- quantity,
50
- ...edgeCache != null ? { edgeCache } : {}
51
- });
52
- return response.data;
53
- },
54
- itemId,
55
- customerId,
56
- quantity
57
- );
58
- },
59
- staleTime: _optionalChain([tier, 'optionalAccess', _9 => _9.staleTime]),
60
- gcTime: _optionalChain([tier, 'optionalAccess', _10 => _10.gcTime]),
61
- refetchOnReconnect: true,
62
- refetchOnWindowFocus: false,
63
- meta: { persist: true }
64
- };
65
- };
66
-
67
- // src/queries/inv-mast-doc.ts
68
- var getInvMastDocKey = (invMastUid, itemId, includePricing) => {
69
- return ["invMastDoc", invMastUid, itemId.toUpperCase(), includePricing];
70
- };
71
- var getInvMastDocOptions = (api, invMastUid, itemId, includePricing, cache) => {
72
- const tier = _optionalChain([cache, 'optionalAccess', _11 => _11.static]);
73
- return {
74
- queryKey: getInvMastDocKey(invMastUid, itemId, includePricing),
75
- queryFn: async () => {
76
- const edgeCache = _optionalChain([tier, 'optionalAccess', _12 => _12.edgeCache]);
77
- return withCache(
78
- _optionalChain([cache, 'optionalAccess', _13 => _13.provider]),
79
- tier,
80
- "items.invMast.doc.list",
81
- async () => {
82
- const response = await api.items.invMast.doc.list(invMastUid, {
83
- itemId: itemId.toUpperCase(),
84
- includePricing,
85
- ...edgeCache != null ? { edgeCache } : {}
86
- });
87
- if (!response.data) throw new Error("Item not found");
88
- return response.data;
89
- },
90
- invMastUid,
91
- itemId,
92
- includePricing
93
- );
94
- },
95
- staleTime: _optionalChain([tier, 'optionalAccess', _14 => _14.staleTime]),
96
- gcTime: _optionalChain([tier, 'optionalAccess', _15 => _15.gcTime])
97
- };
98
- };
99
-
100
- // src/queries/item-category.ts
101
- var getItemCategoryKey = (itemCategoryUid, apiOptions) => {
102
- return ["itemCategory", itemCategoryUid, apiOptions];
103
- };
104
- var getItemCategoryOptions = (api, itemCategoryUid, apiOptions, cache) => {
105
- const tier = _optionalChain([cache, 'optionalAccess', _16 => _16.static]);
106
- return {
107
- queryKey: getItemCategoryKey(itemCategoryUid, apiOptions),
108
- queryFn: async () => {
109
- const edgeCache = _optionalChain([tier, 'optionalAccess', _17 => _17.edgeCache]);
110
- return withCache(
111
- _optionalChain([cache, 'optionalAccess', _18 => _18.provider]),
112
- tier,
113
- "items.categories.get",
114
- async () => {
115
- const response = await api.items.categories.get(itemCategoryUid, {
116
- ...apiOptions,
117
- ...edgeCache != null ? { edgeCache } : {}
118
- });
119
- if (!response.data) throw new Error("Item category not found");
120
- return response.data;
121
- },
122
- itemCategoryUid,
123
- apiOptions
124
- );
125
- },
126
- staleTime: _optionalChain([tier, 'optionalAccess', _19 => _19.staleTime]),
127
- gcTime: _optionalChain([tier, 'optionalAccess', _20 => _20.gcTime])
128
- };
129
- };
130
-
131
- // src/queries/inv-mast.ts
132
- var getInvMastKey = (invMastUid, itemId) => {
133
- return ["invMast", invMastUid, itemId.toUpperCase()];
134
- };
135
- var getInvMastOptions = (api, invMastUid, itemId, cache) => {
136
- const tier = _optionalChain([cache, 'optionalAccess', _21 => _21.static]);
137
- return {
138
- queryKey: getInvMastKey(invMastUid, itemId),
139
- queryFn: async () => {
140
- const edgeCache = _optionalChain([tier, 'optionalAccess', _22 => _22.edgeCache]);
141
- return withCache(
142
- _optionalChain([cache, 'optionalAccess', _23 => _23.provider]),
143
- tier,
144
- "items.invMast.get",
145
- async () => {
146
- const response = await api.items.invMast.get(invMastUid, {
147
- ...edgeCache != null ? { edgeCache } : {}
148
- });
149
- if (!response.data) throw new Error("Item not found");
150
- return response.data;
151
- },
152
- invMastUid
153
- );
154
- },
155
- staleTime: _optionalChain([tier, 'optionalAccess', _24 => _24.staleTime]),
156
- gcTime: _optionalChain([tier, 'optionalAccess', _25 => _25.gcTime])
157
- };
158
- };
159
-
160
- // src/queries/inv-mast-stock.ts
161
- var getInvMastStockKey = (invMastUid) => {
162
- return ["invMastStock", invMastUid];
163
- };
164
- var getInvMastStockOptions = (api, invMastUid, cache) => {
165
- const tier = _optionalChain([cache, 'optionalAccess', _26 => _26.semiStatic]);
166
- return {
167
- queryKey: getInvMastStockKey(invMastUid),
168
- queryFn: async () => {
169
- const edgeCache = _optionalChain([tier, 'optionalAccess', _27 => _27.edgeCache]);
170
- return withCache(
171
- _optionalChain([cache, 'optionalAccess', _28 => _28.provider]),
172
- tier,
173
- "items.invMast.stock.get",
174
- async () => {
175
- const response = await api.items.invMast.stock.get(Number(invMastUid), {
176
- ...edgeCache != null ? { edgeCache } : {}
177
- });
178
- const stockData = _nullishCoalesce(_optionalChain([response, 'access', _29 => _29.data, 'optionalAccess', _30 => _30.stockData]), () => ( []));
179
- return stockData.reduce((qty, stock) => qty + stock.qtyOnHand, 0);
180
- },
181
- invMastUid
182
- );
183
- },
184
- staleTime: _optionalChain([tier, 'optionalAccess', _31 => _31.staleTime]),
185
- gcTime: _optionalChain([tier, 'optionalAccess', _32 => _32.gcTime])
186
- };
187
- };
188
-
189
- // src/queries/stock.ts
190
- var getStockKey = (invMastUid) => {
191
- return ["stock", invMastUid];
192
- };
193
- var getStockOptions = (api, invMastUid, cache) => {
194
- const tier = _optionalChain([cache, 'optionalAccess', _33 => _33.semiStatic]);
195
- return {
196
- queryKey: getStockKey(invMastUid),
197
- queryFn: async () => {
198
- const edgeCache = _optionalChain([tier, 'optionalAccess', _34 => _34.edgeCache]);
199
- return withCache(
200
- _optionalChain([cache, 'optionalAccess', _35 => _35.provider]),
201
- tier,
202
- "items.invMast.stock.get",
203
- async () => {
204
- const response = await api.items.invMast.stock.get(Number(invMastUid), {
205
- ...edgeCache != null ? { edgeCache } : {}
206
- });
207
- const stockData = _nullishCoalesce(_optionalChain([response, 'access', _36 => _36.data, 'optionalAccess', _37 => _37.stockData]), () => ( []));
208
- const companySummary = _nullishCoalesce(_optionalChain([response, 'access', _38 => _38.data, 'optionalAccess', _39 => _39.companySummary]), () => ( {}));
209
- return { stockData, companySummary };
210
- },
211
- invMastUid
212
- );
213
- },
214
- staleTime: _optionalChain([tier, 'optionalAccess', _40 => _40.staleTime]),
215
- gcTime: _optionalChain([tier, 'optionalAccess', _41 => _41.gcTime])
216
- };
217
- };
218
-
219
- // src/queries/batch-inv-mast-doc.ts
220
- var getBatchInvMastDocKey = (params, includePricing) => {
221
- const sorted = [...params].sort(
222
- (a, b) => a.itemId.toUpperCase().localeCompare(b.itemId.toUpperCase())
223
- );
224
- return [
225
- "batchInvMastDoc",
226
- _augurcore.stableStringify.call(void 0,
227
- sorted.map((p) => ({ invMastUid: p.invMastUid, itemId: p.itemId.toUpperCase() }))
228
- ),
229
- includePricing
230
- ];
231
- };
232
- var getBatchInvMastDocOptions = (api, params, includePricing, cache) => {
233
- const tier = _optionalChain([cache, 'optionalAccess', _42 => _42.static]);
234
- return {
235
- queryKey: getBatchInvMastDocKey(params, includePricing),
236
- queryFn: async () => {
237
- const results = {};
238
- const settled = await Promise.allSettled(
239
- params.map(async (p) => {
240
- const opts = getInvMastDocOptions(api, p.invMastUid, p.itemId, includePricing, cache);
241
- const data = await opts.queryFn();
242
- return { key: p.itemId.toUpperCase(), data };
243
- })
244
- );
245
- for (const entry of settled) {
246
- if (entry.status === "fulfilled") {
247
- results[entry.value.key] = entry.value.data;
248
- }
249
- }
250
- return results;
251
- },
252
- staleTime: _optionalChain([tier, 'optionalAccess', _43 => _43.staleTime]),
253
- gcTime: _optionalChain([tier, 'optionalAccess', _44 => _44.gcTime])
254
- };
255
- };
256
-
257
- // src/queries/batch-query.ts
258
- async function executeBatchQuery(config) {
259
- const { params, queryClient, getItemKey, getResultKey, fetchItems, getSeedKey } = config;
260
- if (params.length === 0) {
261
- return {};
262
- }
263
- const cached = {};
264
- const uncached = [];
265
- for (const param of params) {
266
- const existing = queryClient.getQueryData(getItemKey(param));
267
- if (existing !== void 0) {
268
- cached[getResultKey(param)] = existing;
269
- } else {
270
- uncached.push(param);
271
- }
272
- }
273
- if (uncached.length === 0) {
274
- return cached;
275
- }
276
- const fetched = await fetchItems(uncached);
277
- for (const [key, data] of Object.entries(fetched)) {
278
- queryClient.setQueryData(getSeedKey(key, data), data);
279
- }
280
- return { ...cached, ...fetched };
281
- }
282
-
283
- // src/queries/product-category.ts
284
- var getProductCategoryKey = (itemCategoryUid) => {
285
- return ["productCategory", itemCategoryUid];
286
- };
287
- var getProductCategoryOptions = (api, itemCategoryUid, cache) => {
288
- const tier = _optionalChain([cache, 'optionalAccess', _45 => _45.static]);
289
- return {
290
- queryKey: getProductCategoryKey(itemCategoryUid),
291
- queryFn: async () => {
292
- const edgeCache = _optionalChain([tier, 'optionalAccess', _46 => _46.edgeCache]);
293
- return withCache(
294
- _optionalChain([cache, 'optionalAccess', _47 => _47.provider]),
295
- tier,
296
- "items.categories.get",
297
- async () => {
298
- const response = await api.items.categories.get(Number(itemCategoryUid), {
299
- ...edgeCache != null ? { edgeCache } : {}
300
- });
301
- return response.data;
302
- },
303
- itemCategoryUid
304
- );
305
- },
306
- staleTime: _optionalChain([tier, 'optionalAccess', _48 => _48.staleTime]),
307
- gcTime: _optionalChain([tier, 'optionalAccess', _49 => _49.gcTime])
308
- };
309
- };
310
-
311
- // src/queries/item-details.ts
312
- var getItemDetailsKey = (itemId) => {
313
- const normalizedId = typeof itemId === "string" ? itemId.toUpperCase() : itemId;
314
- return ["itemDetails", normalizedId];
315
- };
316
- var getItemDetailsOptions = (api, itemId, cache) => {
317
- const tier = _optionalChain([cache, 'optionalAccess', _50 => _50.static]);
318
- return {
319
- queryKey: getItemDetailsKey(itemId),
320
- queryFn: async () => {
321
- const edgeCache = _optionalChain([tier, 'optionalAccess', _51 => _51.edgeCache]);
322
- return withCache(
323
- _optionalChain([cache, 'optionalAccess', _52 => _52.provider]),
324
- tier,
325
- "items.invMast.doc.list",
326
- async () => {
327
- const response = await api.items.invMast.doc.list(Number(itemId), {
328
- ...edgeCache != null ? { edgeCache } : {}
329
- });
330
- if (!response.data) throw new Error("Item not found");
331
- return response.data;
332
- },
333
- itemId
334
- );
335
- },
336
- staleTime: _optionalChain([tier, 'optionalAccess', _53 => _53.staleTime]),
337
- gcTime: _optionalChain([tier, 'optionalAccess', _54 => _54.gcTime])
338
- };
339
- };
340
-
341
- // src/queries/item-attributes.ts
342
- var getItemAttributesKey = (itemCategoryUid) => {
343
- return ["itemAttributes", itemCategoryUid];
344
- };
345
- var getItemAttributesOptions = (api, itemCategoryUid, cache) => {
346
- const tier = _optionalChain([cache, 'optionalAccess', _55 => _55.static]);
347
- return {
348
- queryKey: getItemAttributesKey(itemCategoryUid),
349
- queryFn: async () => {
350
- const edgeCache = _optionalChain([tier, 'optionalAccess', _56 => _56.edgeCache]);
351
- return withCache(
352
- _optionalChain([cache, 'optionalAccess', _57 => _57.provider]),
353
- tier,
354
- "openSearch.itemSearch.attributes.list",
355
- async () => {
356
- const response = await api.openSearch.itemSearch.attributes.list({
357
- q: "",
358
- searchType: "query",
359
- classId5List: String(itemCategoryUid),
360
- ...edgeCache != null ? { edgeCache } : {}
361
- });
362
- return response.data;
363
- },
364
- itemCategoryUid
365
- );
366
- },
367
- staleTime: _optionalChain([tier, 'optionalAccess', _58 => _58.staleTime]),
368
- gcTime: _optionalChain([tier, 'optionalAccess', _59 => _59.gcTime])
369
- };
370
- };
371
-
372
- // src/queries/product-search.ts
373
- var getProductSearchKey = (pageData) => {
374
- return [
375
- "productSearch",
376
- pageData.q,
377
- pageData.limit,
378
- pageData.offset,
379
- pageData.sortBy,
380
- pageData.itemCategoryUid
381
- ];
382
- };
383
- var getProductSearchOptions = (api, pageData, cache) => {
384
- const tier = _optionalChain([cache, 'optionalAccess', _60 => _60.semiStatic]);
385
- return {
386
- queryKey: getProductSearchKey(pageData),
387
- queryFn: async () => {
388
- const edgeCache = _optionalChain([tier, 'optionalAccess', _61 => _61.edgeCache]);
389
- return withCache(
390
- _optionalChain([cache, 'optionalAccess', _62 => _62.provider]),
391
- tier,
392
- "openSearch.itemSearch.list",
393
- async () => {
394
- const response = await api.openSearch.itemSearch.list({
395
- q: pageData.q,
396
- searchType: "query",
397
- size: pageData.limit,
398
- from: pageData.offset,
399
- classId5List: pageData.itemCategoryUid ? String(pageData.itemCategoryUid) : void 0,
400
- filters: pageData.filters ? JSON.stringify(pageData.filters) : void 0,
401
- ...edgeCache != null ? { edgeCache } : {}
402
- });
403
- return response.data;
404
- },
405
- pageData
406
- );
407
- },
408
- staleTime: _optionalChain([tier, 'optionalAccess', _63 => _63.staleTime]),
409
- gcTime: _optionalChain([tier, 'optionalAccess', _64 => _64.gcTime])
410
- };
411
- };
412
-
413
- // src/queries/search-suggestions.ts
414
- var getSearchSuggestionsKey = (query, limit, offset) => {
415
- return ["searchSuggestions", query, limit, offset];
416
- };
417
- var getSearchSuggestionsOptions = (api, query, limit = 10, offset = 0, cache) => {
418
- const tier = _optionalChain([cache, 'optionalAccess', _65 => _65.static]);
419
- return {
420
- queryKey: getSearchSuggestionsKey(query, limit, offset),
421
- queryFn: async () => {
422
- const edgeCache = _optionalChain([tier, 'optionalAccess', _66 => _66.edgeCache]);
423
- return withCache(
424
- _optionalChain([cache, 'optionalAccess', _67 => _67.provider]),
425
- tier,
426
- "openSearch.suggestions.suggest.list",
427
- async () => {
428
- const response = await api.openSearch.suggestions.suggest.list({
429
- q: query,
430
- size: limit,
431
- from: offset,
432
- ...edgeCache != null ? { edgeCache } : {}
433
- });
434
- return response.data;
435
- },
436
- query,
437
- limit,
438
- offset
439
- );
440
- },
441
- staleTime: _optionalChain([tier, 'optionalAccess', _68 => _68.staleTime]),
442
- gcTime: _optionalChain([tier, 'optionalAccess', _69 => _69.gcTime])
443
- };
444
- };
445
-
446
- // src/queries/cart-pricing.ts
447
- function getCartPricingQueryOptions(api, cartLines, customerId, cache) {
448
- return cartLines.map((line) => ({
449
- ...getItemPriceOptions(api, line.itemId, customerId, line.quantity, cache),
450
- enabled: !!customerId && !!line.itemId
451
- }));
452
- }
453
-
454
- // src/queries/category-items-infinite.ts
455
- var getCategoryItemsInfiniteKey = (itemCategoryUid, itemsFilters) => {
456
- return ["categoryItemsInfinite", itemCategoryUid, _augurcore.stableStringify.call(void 0, itemsFilters)];
457
- };
458
- var getCategoryItemsInfiniteOptions = (api, itemCategoryUid, itemsFilters, cache) => {
459
- const tier = _optionalChain([cache, 'optionalAccess', _70 => _70.semiStatic]);
460
- return {
461
- queryKey: getCategoryItemsInfiniteKey(itemCategoryUid, itemsFilters),
462
- queryFn: async ({ pageParam = 0 }) => {
463
- const edgeCache = _optionalChain([tier, 'optionalAccess', _71 => _71.edgeCache]);
464
- return withCache(
465
- _optionalChain([cache, 'optionalAccess', _72 => _72.provider]),
466
- tier,
467
- "openSearch.itemSearch.list",
468
- async () => {
469
- const response = await api.openSearch.itemSearch.list({
470
- q: itemsFilters.q || "",
471
- searchType: "query",
472
- size: itemsFilters.limit,
473
- from: pageParam,
474
- classId5List: String(itemCategoryUid),
475
- filters: _optionalChain([itemsFilters, 'access', _73 => _73.filters, 'optionalAccess', _74 => _74.length]) ? JSON.stringify(itemsFilters.filters) : void 0,
476
- ...edgeCache != null ? { edgeCache } : {}
477
- });
478
- const items = _nullishCoalesce(_optionalChain([response, 'access', _75 => _75.data, 'optionalAccess', _76 => _76.items]), () => ( []));
479
- const total = _nullishCoalesce(_optionalChain([response, 'access', _77 => _77.data, 'optionalAccess', _78 => _78.totalResults]), () => ( 0));
480
- const nextOffset = pageParam + itemsFilters.limit;
481
- return {
482
- data: items,
483
- total,
484
- nextCursor: nextOffset < total ? nextOffset : void 0
485
- };
486
- },
487
- itemCategoryUid,
488
- itemsFilters,
489
- pageParam
490
- );
491
- },
492
- initialPageParam: 0,
493
- getNextPageParam: (lastPage) => lastPage.nextCursor,
494
- staleTime: _optionalChain([tier, 'optionalAccess', _79 => _79.staleTime]),
495
- gcTime: _optionalChain([tier, 'optionalAccess', _80 => _80.gcTime])
496
- };
497
- };
498
-
499
- // src/queries/item-search-infinite.ts
500
- var getItemSearchInfiniteKey = (itemsFilters, itemCategoryUid) => {
501
- return ["itemSearchInfinite", _augurcore.stableStringify.call(void 0, itemsFilters), itemCategoryUid];
502
- };
503
- var getItemSearchInfiniteOptions = (api, itemsFilters, itemCategoryUid, cache) => {
504
- const tier = _optionalChain([cache, 'optionalAccess', _81 => _81.semiStatic]);
505
- return {
506
- queryKey: getItemSearchInfiniteKey(itemsFilters, itemCategoryUid),
507
- queryFn: async ({ pageParam = 0 }) => {
508
- const edgeCache = _optionalChain([tier, 'optionalAccess', _82 => _82.edgeCache]);
509
- return withCache(
510
- _optionalChain([cache, 'optionalAccess', _83 => _83.provider]),
511
- tier,
512
- "openSearch.itemSearch.list",
513
- async () => {
514
- const response = await api.openSearch.itemSearch.list({
515
- q: itemsFilters.q,
516
- searchType: "query",
517
- size: itemsFilters.limit,
518
- from: pageParam,
519
- classId5List: itemCategoryUid ? String(itemCategoryUid) : void 0,
520
- filters: _optionalChain([itemsFilters, 'access', _84 => _84.filters, 'optionalAccess', _85 => _85.length]) ? JSON.stringify(itemsFilters.filters) : void 0,
521
- ...edgeCache != null ? { edgeCache } : {}
522
- });
523
- const items = _nullishCoalesce(_optionalChain([response, 'access', _86 => _86.data, 'optionalAccess', _87 => _87.items]), () => ( []));
524
- const total = _nullishCoalesce(_optionalChain([response, 'access', _88 => _88.data, 'optionalAccess', _89 => _89.totalResults]), () => ( 0));
525
- const nextOffset = pageParam + itemsFilters.limit;
526
- return {
527
- data: items,
528
- total,
529
- nextCursor: nextOffset < total ? nextOffset : void 0
530
- };
531
- },
532
- itemsFilters,
533
- itemCategoryUid,
534
- pageParam
535
- );
536
- },
537
- initialPageParam: 0,
538
- getNextPageParam: (lastPage) => lastPage.nextCursor,
539
- staleTime: _optionalChain([tier, 'optionalAccess', _90 => _90.staleTime]),
540
- gcTime: _optionalChain([tier, 'optionalAccess', _91 => _91.gcTime]),
541
- meta: { persist: true }
542
- };
543
- };
544
-
545
- // src/queries/joomla-content.ts
546
- var getJoomlaContentKey = (articleId) => {
547
- return ["joomlaContent", articleId];
548
- };
549
- var getJoomlaContentOptions = (api, articleId, cache) => {
550
- const tier = _optionalChain([cache, 'optionalAccess', _92 => _92.static]);
551
- return {
552
- queryKey: getJoomlaContentKey(articleId),
553
- queryFn: async () => {
554
- const edgeCache = _optionalChain([tier, 'optionalAccess', _93 => _93.edgeCache]);
555
- return withCache(
556
- _optionalChain([cache, 'optionalAccess', _94 => _94.provider]),
557
- tier,
558
- "joomla.content.doc.get",
559
- async () => {
560
- const response = await api.joomla.content.doc.get(articleId, {
561
- ...edgeCache != null ? { edgeCache } : {}
562
- });
563
- if (!response.data) throw new Error("Article not found");
564
- return response.data;
565
- },
566
- articleId
567
- );
568
- },
569
- staleTime: _optionalChain([tier, 'optionalAccess', _95 => _95.staleTime]),
570
- gcTime: _optionalChain([tier, 'optionalAccess', _96 => _96.gcTime])
571
- };
572
- };
573
-
574
- // src/queries/joomla-content-list.ts
575
- var getJoomlaContentListKey = (categoryId, filters) => {
576
- return ["joomlaContentList", categoryId, filters];
577
- };
578
- var getJoomlaContentListOptions = (api, categoryId, filters, cache) => {
579
- const tier = _optionalChain([cache, 'optionalAccess', _97 => _97.semiStatic]);
580
- return {
581
- queryKey: getJoomlaContentListKey(categoryId, filters),
582
- queryFn: async () => {
583
- const edgeCache = _optionalChain([tier, 'optionalAccess', _98 => _98.edgeCache]);
584
- return withCache(
585
- _optionalChain([cache, 'optionalAccess', _99 => _99.provider]),
586
- tier,
587
- "joomla.content.list",
588
- async () => {
589
- const response = await api.joomla.content.list({
590
- catid: categoryId,
591
- ...filters,
592
- ...edgeCache != null ? { edgeCache } : {}
593
- });
594
- return {
595
- data: _nullishCoalesce(response.data, () => ( [])),
596
- total: _nullishCoalesce(response.total, () => ( 0)),
597
- count: response.count,
598
- totalResults: response.totalResults,
599
- message: response.message,
600
- status: response.status
601
- };
602
- },
603
- categoryId,
604
- filters
605
- );
606
- },
607
- staleTime: _optionalChain([tier, 'optionalAccess', _100 => _100.staleTime]),
608
- gcTime: _optionalChain([tier, 'optionalAccess', _101 => _101.gcTime])
609
- };
610
- };
611
-
612
- // src/queries/joomla-menu.ts
613
- var getJoomlaMenuKey = (filters) => {
614
- return ["joomlaMenu", filters];
615
- };
616
- var getJoomlaMenuOptions = (api, filters, cache) => {
617
- const tier = _optionalChain([cache, 'optionalAccess', _102 => _102.semiStatic]);
618
- return {
619
- queryKey: getJoomlaMenuKey(filters),
620
- queryFn: async () => {
621
- const edgeCache = _optionalChain([tier, 'optionalAccess', _103 => _103.edgeCache]);
622
- return withCache(
623
- _optionalChain([cache, 'optionalAccess', _104 => _104.provider]),
624
- tier,
625
- "joomla.menu.list",
626
- async () => {
627
- const response = await api.joomla.menu.list({
628
- ...filters,
629
- ...edgeCache != null ? { edgeCache } : {}
630
- });
631
- return {
632
- data: _nullishCoalesce(response.data, () => ( [])),
633
- total: _nullishCoalesce(response.total, () => ( 0)),
634
- count: response.count,
635
- totalResults: response.totalResults,
636
- message: response.message,
637
- status: response.status
638
- };
639
- },
640
- filters
641
- );
642
- },
643
- staleTime: _optionalChain([tier, 'optionalAccess', _105 => _105.staleTime]),
644
- gcTime: _optionalChain([tier, 'optionalAccess', _106 => _106.gcTime])
645
- };
646
- };
647
-
648
- // src/queries/joomla-menu-doc.ts
649
- var getJoomlaMenuDocKey = (menuId) => {
650
- return ["joomlaMenuDoc", menuId];
651
- };
652
- var getJoomlaMenuDocOptions = (api, menuId, cache) => {
653
- const tier = _optionalChain([cache, 'optionalAccess', _107 => _107.static]);
654
- return {
655
- queryKey: getJoomlaMenuDocKey(menuId),
656
- queryFn: async () => {
657
- const edgeCache = _optionalChain([tier, 'optionalAccess', _108 => _108.edgeCache]);
658
- return withCache(
659
- _optionalChain([cache, 'optionalAccess', _109 => _109.provider]),
660
- tier,
661
- "joomla.menu.doc.get",
662
- async () => {
663
- const response = await api.joomla.menu.doc.get(menuId, {
664
- ...edgeCache != null ? { edgeCache } : {}
665
- });
666
- if (!response.data) throw new Error("Menu item not found");
667
- return response.data;
668
- },
669
- menuId
670
- );
671
- },
672
- staleTime: _optionalChain([tier, 'optionalAccess', _110 => _110.staleTime]),
673
- gcTime: _optionalChain([tier, 'optionalAccess', _111 => _111.gcTime])
674
- };
675
- };
676
-
677
- // src/queries/customer-orders.ts
678
- var getCustomerOrdersKey = (customerId, params) => {
679
- return ["customerOrders", customerId, params];
680
- };
681
- var getCustomerOrderDetailKey = (customerId, orderId) => {
682
- return ["customerOrderDetail", customerId, orderId];
683
- };
684
-
685
- // src/queries/customer-invoices.ts
686
- var getCustomerInvoicesKey = (customerId, params) => {
687
- return ["customerInvoices", customerId, params];
688
- };
689
- var getCustomerInvoiceDetailKey = (customerId, invoiceNo) => {
690
- return ["customerInvoiceDetail", customerId, invoiceNo];
691
- };
692
-
693
- // src/queries/customer-quotes.ts
694
- var getCustomerQuotesKey = (customerId, params) => {
695
- return ["customerQuotes", customerId, params];
696
- };
697
- var getCustomerQuoteDetailKey = (customerId, quoteNo) => {
698
- return ["customerQuoteDetail", customerId, quoteNo];
699
- };
700
-
701
-
702
-
703
-
704
-
705
-
706
-
707
-
708
-
709
-
710
-
711
-
712
-
713
-
714
-
715
-
716
-
717
-
718
-
719
-
720
-
721
-
722
-
723
-
724
-
725
-
726
-
727
-
728
-
729
-
730
-
731
-
732
-
733
-
734
-
735
-
736
-
737
-
738
-
739
-
740
-
741
-
742
-
743
-
744
-
745
-
746
-
747
- exports.stableStringify = _augurcore.stableStringify; exports.getItemPriceKey = getItemPriceKey; exports.getItemPriceOptions = getItemPriceOptions; exports.getInvMastDocKey = getInvMastDocKey; exports.getInvMastDocOptions = getInvMastDocOptions; exports.getItemCategoryKey = getItemCategoryKey; exports.getItemCategoryOptions = getItemCategoryOptions; exports.getInvMastKey = getInvMastKey; exports.getInvMastOptions = getInvMastOptions; exports.getInvMastStockKey = getInvMastStockKey; exports.getInvMastStockOptions = getInvMastStockOptions; exports.getStockKey = getStockKey; exports.getStockOptions = getStockOptions; exports.getBatchInvMastDocKey = getBatchInvMastDocKey; exports.getBatchInvMastDocOptions = getBatchInvMastDocOptions; exports.executeBatchQuery = executeBatchQuery; exports.getProductCategoryKey = getProductCategoryKey; exports.getProductCategoryOptions = getProductCategoryOptions; exports.getItemDetailsKey = getItemDetailsKey; exports.getItemDetailsOptions = getItemDetailsOptions; exports.getItemAttributesKey = getItemAttributesKey; exports.getItemAttributesOptions = getItemAttributesOptions; exports.getProductSearchKey = getProductSearchKey; exports.getProductSearchOptions = getProductSearchOptions; exports.getSearchSuggestionsKey = getSearchSuggestionsKey; exports.getSearchSuggestionsOptions = getSearchSuggestionsOptions; exports.getCartPricingQueryOptions = getCartPricingQueryOptions; exports.getCategoryItemsInfiniteKey = getCategoryItemsInfiniteKey; exports.getCategoryItemsInfiniteOptions = getCategoryItemsInfiniteOptions; exports.getItemSearchInfiniteKey = getItemSearchInfiniteKey; exports.getItemSearchInfiniteOptions = getItemSearchInfiniteOptions; exports.getJoomlaContentKey = getJoomlaContentKey; exports.getJoomlaContentOptions = getJoomlaContentOptions; exports.getJoomlaContentListKey = getJoomlaContentListKey; exports.getJoomlaContentListOptions = getJoomlaContentListOptions; exports.getJoomlaMenuKey = getJoomlaMenuKey; exports.getJoomlaMenuOptions = getJoomlaMenuOptions; exports.getJoomlaMenuDocKey = getJoomlaMenuDocKey; exports.getJoomlaMenuDocOptions = getJoomlaMenuDocOptions; exports.getCustomerOrdersKey = getCustomerOrdersKey; exports.getCustomerOrderDetailKey = getCustomerOrderDetailKey; exports.getCustomerInvoicesKey = getCustomerInvoicesKey; exports.getCustomerInvoiceDetailKey = getCustomerInvoiceDetailKey; exports.getCustomerQuotesKey = getCustomerQuotesKey; exports.getCustomerQuoteDetailKey = getCustomerQuoteDetailKey;
748
- //# sourceMappingURL=chunk-H7OXSAHP.cjs.map