@simpleapps-com/augur-hooks 0.4.2 → 0.4.4

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.
@@ -206,18 +206,86 @@ var getInvMastStockOptions = (api, invMastUid, cache) => {
206
206
  };
207
207
  };
208
208
 
209
+ // src/queries/batch-inv-mast-doc.ts
210
+ var getBatchInvMastDocKey = (params, includePricing) => {
211
+ const sorted = [...params].sort(
212
+ (a, b) => a.itemId.toUpperCase().localeCompare(b.itemId.toUpperCase())
213
+ );
214
+ return [
215
+ "batchInvMastDoc",
216
+ stableStringify(sorted.map((p) => ({ invMastUid: p.invMastUid, itemId: p.itemId.toUpperCase() }))),
217
+ includePricing
218
+ ];
219
+ };
220
+ var getBatchInvMastDocOptions = (api, params, includePricing, cache) => {
221
+ const tier = _optionalChain([cache, 'optionalAccess', _33 => _33.static]);
222
+ return {
223
+ queryKey: getBatchInvMastDocKey(params, includePricing),
224
+ queryFn: async () => {
225
+ const results = {};
226
+ const settled = await Promise.allSettled(
227
+ params.map(async (p) => {
228
+ const opts = getInvMastDocOptions(
229
+ api,
230
+ p.invMastUid,
231
+ p.itemId,
232
+ includePricing,
233
+ cache
234
+ );
235
+ const data = await opts.queryFn();
236
+ return { key: p.itemId.toUpperCase(), data };
237
+ })
238
+ );
239
+ for (const entry of settled) {
240
+ if (entry.status === "fulfilled") {
241
+ results[entry.value.key] = entry.value.data;
242
+ }
243
+ }
244
+ return results;
245
+ },
246
+ staleTime: _optionalChain([tier, 'optionalAccess', _34 => _34.staleTime]),
247
+ gcTime: _optionalChain([tier, 'optionalAccess', _35 => _35.gcTime])
248
+ };
249
+ };
250
+
251
+ // src/queries/batch-query.ts
252
+ async function executeBatchQuery(config) {
253
+ const { params, queryClient, getItemKey, getResultKey, fetchItems, getSeedKey } = config;
254
+ if (params.length === 0) {
255
+ return {};
256
+ }
257
+ const cached = {};
258
+ const uncached = [];
259
+ for (const param of params) {
260
+ const existing = queryClient.getQueryData(getItemKey(param));
261
+ if (existing !== void 0) {
262
+ cached[getResultKey(param)] = existing;
263
+ } else {
264
+ uncached.push(param);
265
+ }
266
+ }
267
+ if (uncached.length === 0) {
268
+ return cached;
269
+ }
270
+ const fetched = await fetchItems(uncached);
271
+ for (const [key, data] of Object.entries(fetched)) {
272
+ queryClient.setQueryData(getSeedKey(key, data), data);
273
+ }
274
+ return { ...cached, ...fetched };
275
+ }
276
+
209
277
  // src/queries/product-category.ts
210
278
  var getProductCategoryKey = (itemCategoryUid) => {
211
279
  return ["productCategory", itemCategoryUid];
212
280
  };
213
281
  var getProductCategoryOptions = (api, itemCategoryUid, cache) => {
214
- const tier = _optionalChain([cache, 'optionalAccess', _33 => _33.static]);
282
+ const tier = _optionalChain([cache, 'optionalAccess', _36 => _36.static]);
215
283
  return {
216
284
  queryKey: getProductCategoryKey(itemCategoryUid),
217
285
  queryFn: async () => {
218
- const edgeCache = _optionalChain([tier, 'optionalAccess', _34 => _34.edgeCache]);
286
+ const edgeCache = _optionalChain([tier, 'optionalAccess', _37 => _37.edgeCache]);
219
287
  return withCache(
220
- _optionalChain([cache, 'optionalAccess', _35 => _35.provider]),
288
+ _optionalChain([cache, 'optionalAccess', _38 => _38.provider]),
221
289
  tier,
222
290
  "items.categories.get",
223
291
  async () => {
@@ -229,8 +297,8 @@ var getProductCategoryOptions = (api, itemCategoryUid, cache) => {
229
297
  itemCategoryUid
230
298
  );
231
299
  },
232
- staleTime: _optionalChain([tier, 'optionalAccess', _36 => _36.staleTime]),
233
- gcTime: _optionalChain([tier, 'optionalAccess', _37 => _37.gcTime])
300
+ staleTime: _optionalChain([tier, 'optionalAccess', _39 => _39.staleTime]),
301
+ gcTime: _optionalChain([tier, 'optionalAccess', _40 => _40.gcTime])
234
302
  };
235
303
  };
236
304
 
@@ -240,13 +308,13 @@ var getItemDetailsKey = (itemId) => {
240
308
  return ["itemDetails", normalizedId];
241
309
  };
242
310
  var getItemDetailsOptions = (api, itemId, cache) => {
243
- const tier = _optionalChain([cache, 'optionalAccess', _38 => _38.static]);
311
+ const tier = _optionalChain([cache, 'optionalAccess', _41 => _41.static]);
244
312
  return {
245
313
  queryKey: getItemDetailsKey(itemId),
246
314
  queryFn: async () => {
247
- const edgeCache = _optionalChain([tier, 'optionalAccess', _39 => _39.edgeCache]);
315
+ const edgeCache = _optionalChain([tier, 'optionalAccess', _42 => _42.edgeCache]);
248
316
  return withCache(
249
- _optionalChain([cache, 'optionalAccess', _40 => _40.provider]),
317
+ _optionalChain([cache, 'optionalAccess', _43 => _43.provider]),
250
318
  tier,
251
319
  "items.invMast.doc.list",
252
320
  async () => {
@@ -259,8 +327,8 @@ var getItemDetailsOptions = (api, itemId, cache) => {
259
327
  itemId
260
328
  );
261
329
  },
262
- staleTime: _optionalChain([tier, 'optionalAccess', _41 => _41.staleTime]),
263
- gcTime: _optionalChain([tier, 'optionalAccess', _42 => _42.gcTime])
330
+ staleTime: _optionalChain([tier, 'optionalAccess', _44 => _44.staleTime]),
331
+ gcTime: _optionalChain([tier, 'optionalAccess', _45 => _45.gcTime])
264
332
  };
265
333
  };
266
334
 
@@ -269,13 +337,13 @@ var getItemAttributesKey = (itemCategoryUid) => {
269
337
  return ["itemAttributes", itemCategoryUid];
270
338
  };
271
339
  var getItemAttributesOptions = (api, itemCategoryUid, cache) => {
272
- const tier = _optionalChain([cache, 'optionalAccess', _43 => _43.static]);
340
+ const tier = _optionalChain([cache, 'optionalAccess', _46 => _46.static]);
273
341
  return {
274
342
  queryKey: getItemAttributesKey(itemCategoryUid),
275
343
  queryFn: async () => {
276
- const edgeCache = _optionalChain([tier, 'optionalAccess', _44 => _44.edgeCache]);
344
+ const edgeCache = _optionalChain([tier, 'optionalAccess', _47 => _47.edgeCache]);
277
345
  return withCache(
278
- _optionalChain([cache, 'optionalAccess', _45 => _45.provider]),
346
+ _optionalChain([cache, 'optionalAccess', _48 => _48.provider]),
279
347
  tier,
280
348
  "openSearch.itemSearch.attributes.list",
281
349
  async () => {
@@ -290,8 +358,8 @@ var getItemAttributesOptions = (api, itemCategoryUid, cache) => {
290
358
  itemCategoryUid
291
359
  );
292
360
  },
293
- staleTime: _optionalChain([tier, 'optionalAccess', _46 => _46.staleTime]),
294
- gcTime: _optionalChain([tier, 'optionalAccess', _47 => _47.gcTime])
361
+ staleTime: _optionalChain([tier, 'optionalAccess', _49 => _49.staleTime]),
362
+ gcTime: _optionalChain([tier, 'optionalAccess', _50 => _50.gcTime])
295
363
  };
296
364
  };
297
365
 
@@ -307,13 +375,13 @@ var getProductSearchKey = (pageData) => {
307
375
  ];
308
376
  };
309
377
  var getProductSearchOptions = (api, pageData, cache) => {
310
- const tier = _optionalChain([cache, 'optionalAccess', _48 => _48.semiStatic]);
378
+ const tier = _optionalChain([cache, 'optionalAccess', _51 => _51.semiStatic]);
311
379
  return {
312
380
  queryKey: getProductSearchKey(pageData),
313
381
  queryFn: async () => {
314
- const edgeCache = _optionalChain([tier, 'optionalAccess', _49 => _49.edgeCache]);
382
+ const edgeCache = _optionalChain([tier, 'optionalAccess', _52 => _52.edgeCache]);
315
383
  return withCache(
316
- _optionalChain([cache, 'optionalAccess', _50 => _50.provider]),
384
+ _optionalChain([cache, 'optionalAccess', _53 => _53.provider]),
317
385
  tier,
318
386
  "openSearch.itemSearch.list",
319
387
  async () => {
@@ -331,8 +399,8 @@ var getProductSearchOptions = (api, pageData, cache) => {
331
399
  pageData
332
400
  );
333
401
  },
334
- staleTime: _optionalChain([tier, 'optionalAccess', _51 => _51.staleTime]),
335
- gcTime: _optionalChain([tier, 'optionalAccess', _52 => _52.gcTime])
402
+ staleTime: _optionalChain([tier, 'optionalAccess', _54 => _54.staleTime]),
403
+ gcTime: _optionalChain([tier, 'optionalAccess', _55 => _55.gcTime])
336
404
  };
337
405
  };
338
406
 
@@ -341,13 +409,13 @@ var getSearchSuggestionsKey = (query, limit, offset) => {
341
409
  return ["searchSuggestions", query, limit, offset];
342
410
  };
343
411
  var getSearchSuggestionsOptions = (api, query, limit = 10, offset = 0, cache) => {
344
- const tier = _optionalChain([cache, 'optionalAccess', _53 => _53.static]);
412
+ const tier = _optionalChain([cache, 'optionalAccess', _56 => _56.static]);
345
413
  return {
346
414
  queryKey: getSearchSuggestionsKey(query, limit, offset),
347
415
  queryFn: async () => {
348
- const edgeCache = _optionalChain([tier, 'optionalAccess', _54 => _54.edgeCache]);
416
+ const edgeCache = _optionalChain([tier, 'optionalAccess', _57 => _57.edgeCache]);
349
417
  return withCache(
350
- _optionalChain([cache, 'optionalAccess', _55 => _55.provider]),
418
+ _optionalChain([cache, 'optionalAccess', _58 => _58.provider]),
351
419
  tier,
352
420
  "openSearch.suggestions.suggest.list",
353
421
  async () => {
@@ -364,8 +432,8 @@ var getSearchSuggestionsOptions = (api, query, limit = 10, offset = 0, cache) =>
364
432
  offset
365
433
  );
366
434
  },
367
- staleTime: _optionalChain([tier, 'optionalAccess', _56 => _56.staleTime]),
368
- gcTime: _optionalChain([tier, 'optionalAccess', _57 => _57.gcTime])
435
+ staleTime: _optionalChain([tier, 'optionalAccess', _59 => _59.staleTime]),
436
+ gcTime: _optionalChain([tier, 'optionalAccess', _60 => _60.gcTime])
369
437
  };
370
438
  };
371
439
 
@@ -386,15 +454,15 @@ var getCategoryItemsInfiniteKey = (itemCategoryUid, itemsFilters) => {
386
454
  ];
387
455
  };
388
456
  var getCategoryItemsInfiniteOptions = (api, itemCategoryUid, itemsFilters, cache) => {
389
- const tier = _optionalChain([cache, 'optionalAccess', _58 => _58.semiStatic]);
457
+ const tier = _optionalChain([cache, 'optionalAccess', _61 => _61.semiStatic]);
390
458
  return {
391
459
  queryKey: getCategoryItemsInfiniteKey(itemCategoryUid, itemsFilters),
392
460
  queryFn: async ({
393
461
  pageParam = 0
394
462
  }) => {
395
- const edgeCache = _optionalChain([tier, 'optionalAccess', _59 => _59.edgeCache]);
463
+ const edgeCache = _optionalChain([tier, 'optionalAccess', _62 => _62.edgeCache]);
396
464
  return withCache(
397
- _optionalChain([cache, 'optionalAccess', _60 => _60.provider]),
465
+ _optionalChain([cache, 'optionalAccess', _63 => _63.provider]),
398
466
  tier,
399
467
  "openSearch.itemSearch.list",
400
468
  async () => {
@@ -404,11 +472,11 @@ var getCategoryItemsInfiniteOptions = (api, itemCategoryUid, itemsFilters, cache
404
472
  size: itemsFilters.limit,
405
473
  from: pageParam,
406
474
  classId5List: String(itemCategoryUid),
407
- filters: _optionalChain([itemsFilters, 'access', _61 => _61.filters, 'optionalAccess', _62 => _62.length]) ? JSON.stringify(itemsFilters.filters) : void 0,
475
+ filters: _optionalChain([itemsFilters, 'access', _64 => _64.filters, 'optionalAccess', _65 => _65.length]) ? JSON.stringify(itemsFilters.filters) : void 0,
408
476
  ...edgeCache != null ? { edgeCache } : {}
409
477
  });
410
- const items = _nullishCoalesce(_optionalChain([response, 'access', _63 => _63.data, 'optionalAccess', _64 => _64.items]), () => ( []));
411
- const total = _nullishCoalesce(_optionalChain([response, 'access', _65 => _65.data, 'optionalAccess', _66 => _66.totalResults]), () => ( 0));
478
+ const items = _nullishCoalesce(_optionalChain([response, 'access', _66 => _66.data, 'optionalAccess', _67 => _67.items]), () => ( []));
479
+ const total = _nullishCoalesce(_optionalChain([response, 'access', _68 => _68.data, 'optionalAccess', _69 => _69.totalResults]), () => ( 0));
412
480
  const nextOffset = pageParam + itemsFilters.limit;
413
481
  return {
414
482
  data: items,
@@ -423,8 +491,8 @@ var getCategoryItemsInfiniteOptions = (api, itemCategoryUid, itemsFilters, cache
423
491
  },
424
492
  initialPageParam: 0,
425
493
  getNextPageParam: (lastPage) => lastPage.nextCursor,
426
- staleTime: _optionalChain([tier, 'optionalAccess', _67 => _67.staleTime]),
427
- gcTime: _optionalChain([tier, 'optionalAccess', _68 => _68.gcTime])
494
+ staleTime: _optionalChain([tier, 'optionalAccess', _70 => _70.staleTime]),
495
+ gcTime: _optionalChain([tier, 'optionalAccess', _71 => _71.gcTime])
428
496
  };
429
497
  };
430
498
 
@@ -437,15 +505,15 @@ var getItemSearchInfiniteKey = (itemsFilters, itemCategoryUid) => {
437
505
  ];
438
506
  };
439
507
  var getItemSearchInfiniteOptions = (api, itemsFilters, itemCategoryUid, cache) => {
440
- const tier = _optionalChain([cache, 'optionalAccess', _69 => _69.semiStatic]);
508
+ const tier = _optionalChain([cache, 'optionalAccess', _72 => _72.semiStatic]);
441
509
  return {
442
510
  queryKey: getItemSearchInfiniteKey(itemsFilters, itemCategoryUid),
443
511
  queryFn: async ({
444
512
  pageParam = 0
445
513
  }) => {
446
- const edgeCache = _optionalChain([tier, 'optionalAccess', _70 => _70.edgeCache]);
514
+ const edgeCache = _optionalChain([tier, 'optionalAccess', _73 => _73.edgeCache]);
447
515
  return withCache(
448
- _optionalChain([cache, 'optionalAccess', _71 => _71.provider]),
516
+ _optionalChain([cache, 'optionalAccess', _74 => _74.provider]),
449
517
  tier,
450
518
  "openSearch.itemSearch.list",
451
519
  async () => {
@@ -455,11 +523,11 @@ var getItemSearchInfiniteOptions = (api, itemsFilters, itemCategoryUid, cache) =
455
523
  size: itemsFilters.limit,
456
524
  from: pageParam,
457
525
  classId5List: itemCategoryUid ? String(itemCategoryUid) : void 0,
458
- filters: _optionalChain([itemsFilters, 'access', _72 => _72.filters, 'optionalAccess', _73 => _73.length]) ? JSON.stringify(itemsFilters.filters) : void 0,
526
+ filters: _optionalChain([itemsFilters, 'access', _75 => _75.filters, 'optionalAccess', _76 => _76.length]) ? JSON.stringify(itemsFilters.filters) : void 0,
459
527
  ...edgeCache != null ? { edgeCache } : {}
460
528
  });
461
- const items = _nullishCoalesce(_optionalChain([response, 'access', _74 => _74.data, 'optionalAccess', _75 => _75.items]), () => ( []));
462
- const total = _nullishCoalesce(_optionalChain([response, 'access', _76 => _76.data, 'optionalAccess', _77 => _77.totalResults]), () => ( 0));
529
+ const items = _nullishCoalesce(_optionalChain([response, 'access', _77 => _77.data, 'optionalAccess', _78 => _78.items]), () => ( []));
530
+ const total = _nullishCoalesce(_optionalChain([response, 'access', _79 => _79.data, 'optionalAccess', _80 => _80.totalResults]), () => ( 0));
463
531
  const nextOffset = pageParam + itemsFilters.limit;
464
532
  return {
465
533
  data: items,
@@ -474,8 +542,8 @@ var getItemSearchInfiniteOptions = (api, itemsFilters, itemCategoryUid, cache) =
474
542
  },
475
543
  initialPageParam: 0,
476
544
  getNextPageParam: (lastPage) => lastPage.nextCursor,
477
- staleTime: _optionalChain([tier, 'optionalAccess', _78 => _78.staleTime]),
478
- gcTime: _optionalChain([tier, 'optionalAccess', _79 => _79.gcTime]),
545
+ staleTime: _optionalChain([tier, 'optionalAccess', _81 => _81.staleTime]),
546
+ gcTime: _optionalChain([tier, 'optionalAccess', _82 => _82.gcTime]),
479
547
  meta: { persist: true }
480
548
  };
481
549
  };
@@ -485,13 +553,13 @@ var getJoomlaContentKey = (articleId) => {
485
553
  return ["joomlaContent", articleId];
486
554
  };
487
555
  var getJoomlaContentOptions = (api, articleId, cache) => {
488
- const tier = _optionalChain([cache, 'optionalAccess', _80 => _80.static]);
556
+ const tier = _optionalChain([cache, 'optionalAccess', _83 => _83.static]);
489
557
  return {
490
558
  queryKey: getJoomlaContentKey(articleId),
491
559
  queryFn: async () => {
492
- const edgeCache = _optionalChain([tier, 'optionalAccess', _81 => _81.edgeCache]);
560
+ const edgeCache = _optionalChain([tier, 'optionalAccess', _84 => _84.edgeCache]);
493
561
  return withCache(
494
- _optionalChain([cache, 'optionalAccess', _82 => _82.provider]),
562
+ _optionalChain([cache, 'optionalAccess', _85 => _85.provider]),
495
563
  tier,
496
564
  "joomla.content.doc.get",
497
565
  async () => {
@@ -504,8 +572,8 @@ var getJoomlaContentOptions = (api, articleId, cache) => {
504
572
  articleId
505
573
  );
506
574
  },
507
- staleTime: _optionalChain([tier, 'optionalAccess', _83 => _83.staleTime]),
508
- gcTime: _optionalChain([tier, 'optionalAccess', _84 => _84.gcTime])
575
+ staleTime: _optionalChain([tier, 'optionalAccess', _86 => _86.staleTime]),
576
+ gcTime: _optionalChain([tier, 'optionalAccess', _87 => _87.gcTime])
509
577
  };
510
578
  };
511
579
 
@@ -514,13 +582,13 @@ var getJoomlaContentListKey = (categoryId, filters) => {
514
582
  return ["joomlaContentList", categoryId, filters];
515
583
  };
516
584
  var getJoomlaContentListOptions = (api, categoryId, filters, cache) => {
517
- const tier = _optionalChain([cache, 'optionalAccess', _85 => _85.semiStatic]);
585
+ const tier = _optionalChain([cache, 'optionalAccess', _88 => _88.semiStatic]);
518
586
  return {
519
587
  queryKey: getJoomlaContentListKey(categoryId, filters),
520
588
  queryFn: async () => {
521
- const edgeCache = _optionalChain([tier, 'optionalAccess', _86 => _86.edgeCache]);
589
+ const edgeCache = _optionalChain([tier, 'optionalAccess', _89 => _89.edgeCache]);
522
590
  return withCache(
523
- _optionalChain([cache, 'optionalAccess', _87 => _87.provider]),
591
+ _optionalChain([cache, 'optionalAccess', _90 => _90.provider]),
524
592
  tier,
525
593
  "joomla.content.list",
526
594
  async () => {
@@ -535,8 +603,8 @@ var getJoomlaContentListOptions = (api, categoryId, filters, cache) => {
535
603
  filters
536
604
  );
537
605
  },
538
- staleTime: _optionalChain([tier, 'optionalAccess', _88 => _88.staleTime]),
539
- gcTime: _optionalChain([tier, 'optionalAccess', _89 => _89.gcTime])
606
+ staleTime: _optionalChain([tier, 'optionalAccess', _91 => _91.staleTime]),
607
+ gcTime: _optionalChain([tier, 'optionalAccess', _92 => _92.gcTime])
540
608
  };
541
609
  };
542
610
 
@@ -545,13 +613,13 @@ var getJoomlaMenuKey = (filters) => {
545
613
  return ["joomlaMenu", filters];
546
614
  };
547
615
  var getJoomlaMenuOptions = (api, filters, cache) => {
548
- const tier = _optionalChain([cache, 'optionalAccess', _90 => _90.semiStatic]);
616
+ const tier = _optionalChain([cache, 'optionalAccess', _93 => _93.semiStatic]);
549
617
  return {
550
618
  queryKey: getJoomlaMenuKey(filters),
551
619
  queryFn: async () => {
552
- const edgeCache = _optionalChain([tier, 'optionalAccess', _91 => _91.edgeCache]);
620
+ const edgeCache = _optionalChain([tier, 'optionalAccess', _94 => _94.edgeCache]);
553
621
  return withCache(
554
- _optionalChain([cache, 'optionalAccess', _92 => _92.provider]),
622
+ _optionalChain([cache, 'optionalAccess', _95 => _95.provider]),
555
623
  tier,
556
624
  "joomla.menu.list",
557
625
  async () => {
@@ -564,8 +632,8 @@ var getJoomlaMenuOptions = (api, filters, cache) => {
564
632
  filters
565
633
  );
566
634
  },
567
- staleTime: _optionalChain([tier, 'optionalAccess', _93 => _93.staleTime]),
568
- gcTime: _optionalChain([tier, 'optionalAccess', _94 => _94.gcTime])
635
+ staleTime: _optionalChain([tier, 'optionalAccess', _96 => _96.staleTime]),
636
+ gcTime: _optionalChain([tier, 'optionalAccess', _97 => _97.gcTime])
569
637
  };
570
638
  };
571
639
 
@@ -574,13 +642,13 @@ var getJoomlaMenuDocKey = (menuId) => {
574
642
  return ["joomlaMenuDoc", menuId];
575
643
  };
576
644
  var getJoomlaMenuDocOptions = (api, menuId, cache) => {
577
- const tier = _optionalChain([cache, 'optionalAccess', _95 => _95.static]);
645
+ const tier = _optionalChain([cache, 'optionalAccess', _98 => _98.static]);
578
646
  return {
579
647
  queryKey: getJoomlaMenuDocKey(menuId),
580
648
  queryFn: async () => {
581
- const edgeCache = _optionalChain([tier, 'optionalAccess', _96 => _96.edgeCache]);
649
+ const edgeCache = _optionalChain([tier, 'optionalAccess', _99 => _99.edgeCache]);
582
650
  return withCache(
583
- _optionalChain([cache, 'optionalAccess', _97 => _97.provider]),
651
+ _optionalChain([cache, 'optionalAccess', _100 => _100.provider]),
584
652
  tier,
585
653
  "joomla.menu.doc.get",
586
654
  async () => {
@@ -593,8 +661,8 @@ var getJoomlaMenuDocOptions = (api, menuId, cache) => {
593
661
  menuId
594
662
  );
595
663
  },
596
- staleTime: _optionalChain([tier, 'optionalAccess', _98 => _98.staleTime]),
597
- gcTime: _optionalChain([tier, 'optionalAccess', _99 => _99.gcTime])
664
+ staleTime: _optionalChain([tier, 'optionalAccess', _101 => _101.staleTime]),
665
+ gcTime: _optionalChain([tier, 'optionalAccess', _102 => _102.gcTime])
598
666
  };
599
667
  };
600
668
 
@@ -663,5 +731,8 @@ var getCustomerQuoteDetailKey = (customerId, quoteNo) => {
663
731
 
664
732
 
665
733
 
666
- exports.stableStringify = 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.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;
667
- //# sourceMappingURL=chunk-I3JHJMQ6.cjs.map
734
+
735
+
736
+
737
+ exports.stableStringify = 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.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;
738
+ //# sourceMappingURL=chunk-FKM6A6QW.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/home/runner/work/augur-packages/augur-packages/packages/augur-hooks/dist/chunk-FKM6A6QW.cjs","../src/queries/stable-stringify.ts","../src/queries/cache-helper.ts","../src/queries/item-price.ts","../src/queries/inv-mast-doc.ts","../src/queries/item-category.ts","../src/queries/inv-mast.ts","../src/queries/inv-mast-stock.ts","../src/queries/batch-inv-mast-doc.ts","../src/queries/batch-query.ts","../src/queries/product-category.ts","../src/queries/item-details.ts","../src/queries/item-attributes.ts","../src/queries/product-search.ts","../src/queries/search-suggestions.ts","../src/queries/cart-pricing.ts","../src/queries/category-items-infinite.ts","../src/queries/item-search-infinite.ts","../src/queries/joomla-content.ts","../src/queries/joomla-content-list.ts","../src/queries/joomla-menu.ts","../src/queries/joomla-menu-doc.ts","../src/queries/customer-orders.ts","../src/queries/customer-invoices.ts","../src/queries/customer-quotes.ts"],"names":[],"mappings":"AAAA;ACIO,SAAS,eAAA,CAAgB,KAAA,EAAwB;AACtD,EAAA,GAAA,CAAI,MAAA,IAAU,KAAA,GAAQ,MAAA,IAAU,KAAA,CAAA,EAAW,OAAO,IAAA,CAAK,SAAA,CAAU,KAAK,CAAA;AACtE,EAAA,GAAA,CAAI,OAAO,MAAA,IAAU,QAAA,EAAU,OAAO,IAAA,CAAK,SAAA,CA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F,IAAA;AACA,IAAA;AACQ,IAAA;AACV,EAAA;AACF;AlB8hBc;AACA;AmB3jBD;AAIH,EAAA;AACV;AAEa;AAML,EAAA;AACC,EAAA;AACK,IAAA;AACD,IAAA;AACD,MAAA;AACC,MAAA;AACL,wBAAA;AACA,QAAA;AACA,QAAA;AACA,QAAA;AACE,UAAA;AACE,YAAA;AACA,YAAA;AACA,YAAA;AACD,UAAA;AACD,UAAA;AACF,QAAA;AACA,QAAA;AAAY,QAAA;AACd,MAAA;AACF,IAAA;AACA,IAAA;AACQ,IAAA;AACV,EAAA;AACF;AnBqjBc;AACA;AoB7lBD;AAGH,EAAA;AACV;AAEa;AAKL,EAAA;AACC,EAAA;AACK,IAAA;AACD,IAAA;AACD,MAAA;AACC,MAAA;AACL,wBAAA;AACA,QAAA;AACA,QAAA;AACA,QAAA;AACE,UAAA;AACE,YAAA;AACA,YAAA;AACD,UAAA;AACD,UAAA;AACF,QAAA;AACA,QAAA;AACF,MAAA;AACF,IAAA;AACA,IAAA;AACQ,IAAA;AACV,EAAA;AACF;ApBwlBc;AACA;AqB1nBD;AACH,EAAA;AACV;AAEa;AAKL,EAAA;AACC,EAAA;AACK,IAAA;AACD,IAAA;AACD,MAAA;AACC,MAAA;AACL,wBAAA;AACA,QAAA;AACA,QAAA;AACA,QAAA;AACE,UAAA;AACE,YAAA;AACD,UAAA;AACG,UAAA;AACJ,UAAA;AACF,QAAA;AACA,QAAA;AACF,MAAA;AACF,IAAA;AACA,IAAA;AACQ,IAAA;AACV,EAAA;AACF;ArBunBc;AACA;AsB5pBD;AAIH,EAAA;AACV;AAEa;AAIH,EAAA;AACV;AtBupBc;AACA;AuBpqBD;AAIH,EAAA;AACV;AAEa;AAIH,EAAA;AACV;AvB+pBc;AACA;AwB5qBD;AAIH,EAAA;AACV;AAEa;AAIH,EAAA;AACV;AxBuqBc;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"/home/runner/work/augur-packages/augur-packages/packages/augur-hooks/dist/chunk-FKM6A6QW.cjs","sourcesContent":[null,"/**\n * JSON.stringify with sorted object keys for deterministic cache keys.\n * Ensures { a: 1, b: 2 } and { b: 2, a: 1 } produce the same string.\n */\nexport function stableStringify(value: unknown): string {\n if (value === null || value === undefined) return JSON.stringify(value);\n if (typeof value !== \"object\") return JSON.stringify(value);\n if (Array.isArray(value)) {\n return `[${value.map(stableStringify).join(\",\")}]`;\n }\n const obj = value as Record<string, unknown>;\n const keys = Object.keys(obj).sort();\n const entries = keys.map(\n (key) => `${JSON.stringify(key)}:${stableStringify(obj[key])}`,\n );\n return `{${entries.join(\",\")}}`;\n}\n","import type { CacheProvider, CacheTierConfig } from \"../types\";\nimport { stableStringify } from \"./stable-stringify\";\n\n/**\n * FNV-1a 32-bit hash. Fast, cross-platform (no Node crypto needed).\n */\nfunction fnv1a(str: string): string {\n let h = 0x811c9dc5;\n for (let i = 0; i < str.length; i++) {\n h ^= str.charCodeAt(i);\n h = Math.imul(h, 0x01000193);\n }\n return (h >>> 0).toString(16).padStart(8, \"0\");\n}\n\n/**\n * Wraps an async function with optional Redis caching.\n *\n * - When `provider` and `tier.redis` are both set, checks Redis before\n * calling `fn`, then caches the result on miss.\n * - When either is missing, calls `fn` directly (no-op passthrough).\n *\n * @param provider Redis-compatible get/set + prefix. Undefined = skip Redis.\n * @param tier Cache tier config. Undefined or missing `redis` = skip Redis.\n * @param methodPath Dot-separated SDK method path (used as cache key segment).\n * @param fn The async function to cache (typically the SDK call).\n * @param keyArgs Values to hash for the cache key (e.g. query params).\n */\nexport async function withCache<T>(\n provider: CacheProvider | undefined,\n tier: CacheTierConfig | undefined,\n methodPath: string,\n fn: () => Promise<T>,\n ...keyArgs: unknown[]\n): Promise<T> {\n const redisTtl = tier?.redis;\n if (!provider || !redisTtl) return fn();\n\n const key = `${provider.prefix}sdk:${methodPath}:${fnv1a(stableStringify(keyArgs))}`;\n\n try {\n const cached = await provider.get(key);\n if (cached != null) return JSON.parse(cached) as T;\n } catch {\n /* Redis read error — fall through to SDK call */\n }\n\n const result = await fn();\n\n try {\n provider.set(key, JSON.stringify(result), redisTtl).catch(() => {});\n } catch {\n /* Non-serializable or write error — skip caching */\n }\n\n return result;\n}\n","import type { TPriceData } from \"@simpleapps-com/augur-utils\";\nimport type { AugurApiClient } from \"../provider\";\nimport type { CacheConfig } from \"../types\";\nimport { withCache } from \"./cache-helper\";\n\n/**\n * Generates a consistent query key for item price queries.\n * Usable in both client hooks and server-side prefetch.\n */\nexport const getItemPriceKey = (\n itemId: string | undefined,\n customerId: string | number | undefined,\n quantity: number = 1,\n) => {\n return [\"price\", itemId?.toUpperCase() || \"\", customerId, quantity] as const;\n};\n\n/**\n * Query options for item price. Accepts the SDK instance so it works\n * in both client (via provider) and server (via direct construction).\n */\nexport const getItemPriceOptions = (\n api: AugurApiClient,\n itemId: string | undefined,\n customerId: string | number | undefined,\n quantity: number = 1,\n cache?: CacheConfig,\n) => {\n const tier = cache?.semiStatic;\n return {\n queryKey: getItemPriceKey(itemId, customerId, quantity),\n queryFn: async (): Promise<TPriceData> => {\n const edgeCache = tier?.edgeCache;\n return withCache(\n cache?.provider,\n tier,\n \"pricing.priceEngine.get\",\n async () => {\n const response = await api.pricing.priceEngine.get({\n itemId: itemId?.toUpperCase() || \"\",\n customerId: Number(customerId),\n quantity,\n ...(edgeCache != null ? { edgeCache } : {}),\n });\n return response.data;\n },\n itemId, customerId, quantity,\n );\n },\n staleTime: tier?.staleTime,\n gcTime: tier?.gcTime,\n refetchOnReconnect: true,\n refetchOnWindowFocus: false,\n meta: { persist: true },\n };\n};\n","import type { TInvMastDoc } from \"@simpleapps-com/augur-utils\";\nimport type { AugurApiClient } from \"../provider\";\nimport type { CacheConfig } from \"../types\";\nimport { withCache } from \"./cache-helper\";\n\n/**\n * Generates a consistent query key for inv mast doc queries.\n * Usable in both client hooks and server-side prefetch.\n */\nexport const getInvMastDocKey = (\n invMastUid: number,\n itemId: string,\n includePricing: \"Y\" | \"N\",\n) => {\n return [\n \"invMastDoc\",\n invMastUid,\n itemId.toUpperCase(),\n includePricing,\n ] as const;\n};\n\n/**\n * Query options for inv mast doc. Accepts the SDK instance so it works\n * in both client (via provider) and server (via direct construction).\n */\nexport const getInvMastDocOptions = (\n api: AugurApiClient,\n invMastUid: number,\n itemId: string,\n includePricing: \"Y\" | \"N\",\n cache?: CacheConfig,\n) => {\n const tier = cache?.static;\n return {\n queryKey: getInvMastDocKey(invMastUid, itemId, includePricing),\n queryFn: async (): Promise<TInvMastDoc> => {\n const edgeCache = tier?.edgeCache;\n return withCache(\n cache?.provider,\n tier,\n \"items.invMast.doc.list\",\n async () => {\n const response = await api.items.invMast.doc.list(invMastUid, {\n itemId: itemId.toUpperCase(),\n includePricing,\n ...(edgeCache != null ? { edgeCache } : {}),\n });\n if (!response.data) throw new Error(\"Item not found\");\n return response.data;\n },\n invMastUid,\n itemId,\n includePricing,\n );\n },\n staleTime: tier?.staleTime,\n gcTime: tier?.gcTime,\n };\n};\n","import type { TCategory } from \"@simpleapps-com/augur-utils\";\nimport type { AugurApiClient } from \"../provider\";\nimport type { CacheConfig, GetItemCategoryApiOptions } from \"../types\";\nimport { withCache } from \"./cache-helper\";\n\ntype ItemCategoryQueryKey = readonly [\n \"itemCategory\",\n number,\n GetItemCategoryApiOptions | undefined,\n];\n\n/**\n * Generates a consistent query key for item category queries.\n * Usable in both client hooks and server-side prefetch.\n */\nexport const getItemCategoryKey = (\n itemCategoryUid: number,\n apiOptions?: GetItemCategoryApiOptions,\n): ItemCategoryQueryKey => {\n return [\"itemCategory\", itemCategoryUid, apiOptions] as const;\n};\n\n/**\n * Query options for item category. Accepts the SDK instance so it works\n * in both client (via provider) and server (via direct construction).\n */\nexport const getItemCategoryOptions = (\n api: AugurApiClient,\n itemCategoryUid: number,\n apiOptions?: GetItemCategoryApiOptions,\n cache?: CacheConfig,\n) => {\n const tier = cache?.static;\n return {\n queryKey: getItemCategoryKey(itemCategoryUid, apiOptions),\n queryFn: async (): Promise<TCategory> => {\n const edgeCache = tier?.edgeCache;\n return withCache(\n cache?.provider,\n tier,\n \"items.categories.get\",\n async () => {\n const response = await api.items.categories.get(\n itemCategoryUid,\n { ...apiOptions, ...(edgeCache != null ? { edgeCache } : {}) },\n );\n if (!response.data) throw new Error(\"Item category not found\");\n return response.data;\n },\n itemCategoryUid,\n apiOptions,\n );\n },\n staleTime: tier?.staleTime,\n gcTime: tier?.gcTime,\n };\n};\n","import type { TItemDetails } from \"@simpleapps-com/augur-utils\";\nimport type { AugurApiClient } from \"../provider\";\nimport type { CacheConfig } from \"../types\";\nimport { withCache } from \"./cache-helper\";\n\nexport const getInvMastKey = (invMastUid: number, itemId: string) => {\n return [\"invMast\", invMastUid, itemId.toUpperCase()] as const;\n};\n\nexport const getInvMastOptions = (\n api: AugurApiClient,\n invMastUid: number,\n itemId: string,\n cache?: CacheConfig,\n) => {\n const tier = cache?.static;\n return {\n queryKey: getInvMastKey(invMastUid, itemId),\n queryFn: async (): Promise<TItemDetails> => {\n const edgeCache = tier?.edgeCache;\n return withCache(\n cache?.provider,\n tier,\n \"items.invMast.get\",\n async () => {\n const response = await api.items.invMast.get(invMastUid, {\n ...(edgeCache != null ? { edgeCache } : {}),\n });\n if (!response.data) throw new Error(\"Item not found\");\n return response.data;\n },\n invMastUid,\n );\n },\n staleTime: tier?.staleTime,\n gcTime: tier?.gcTime,\n };\n};\n","import type { TStockData } from \"@simpleapps-com/augur-utils\";\nimport type { AugurApiClient } from \"../provider\";\nimport type { CacheConfig } from \"../types\";\nimport { withCache } from \"./cache-helper\";\n\nexport const getInvMastStockKey = (invMastUid: number | string) => {\n return [\"invMastStock\", invMastUid] as const;\n};\n\nexport const getInvMastStockOptions = (\n api: AugurApiClient,\n invMastUid: number | string,\n cache?: CacheConfig,\n) => {\n const tier = cache?.semiStatic;\n return {\n queryKey: getInvMastStockKey(invMastUid),\n queryFn: async (): Promise<number> => {\n const edgeCache = tier?.edgeCache;\n return withCache(\n cache?.provider,\n tier,\n \"items.invMast.stock.list\",\n async () => {\n const response = await api.items.invMast.stock.list(Number(invMastUid), {\n ...(edgeCache != null ? { edgeCache } : {}),\n });\n const stockData: TStockData[] = response.data?.stockData ?? [];\n return stockData.reduce(\n (qty: number, stock: TStockData) => qty + stock.qtyOnHand,\n 0,\n );\n },\n invMastUid,\n );\n },\n staleTime: tier?.staleTime,\n gcTime: tier?.gcTime,\n };\n};\n","import type { TInvMastDoc } from \"@simpleapps-com/augur-utils\";\nimport type { AugurApiClient } from \"../provider\";\nimport type { CacheConfig } from \"../types\";\nimport { getInvMastDocOptions } from \"./inv-mast-doc\";\nimport { stableStringify } from \"./stable-stringify\";\n\nexport interface BatchInvMastDocParam {\n invMastUid: number;\n itemId: string;\n}\n\n/**\n * Generates a deterministic query key for a batch inv mast doc query.\n * Params are sorted by uppercased itemId to ensure stable keys\n * regardless of input order.\n */\nexport const getBatchInvMastDocKey = (\n params: BatchInvMastDocParam[],\n includePricing: \"Y\" | \"N\",\n) => {\n const sorted = [...params].sort((a, b) =>\n a.itemId.toUpperCase().localeCompare(b.itemId.toUpperCase()),\n );\n return [\n \"batchInvMastDoc\",\n stableStringify(sorted.map((p) => ({ invMastUid: p.invMastUid, itemId: p.itemId.toUpperCase() }))),\n includePricing,\n ] as const;\n};\n\n/**\n * Server-side query options for batch inv mast doc.\n * Uses Promise.all over individual getInvMastDocOptions queryFns\n * since queryClient is not available server-side.\n * Failed items are silently excluded from the result.\n */\nexport const getBatchInvMastDocOptions = (\n api: AugurApiClient,\n params: BatchInvMastDocParam[],\n includePricing: \"Y\" | \"N\",\n cache?: CacheConfig,\n) => {\n const tier = cache?.static;\n return {\n queryKey: getBatchInvMastDocKey(params, includePricing),\n queryFn: async (): Promise<Record<string, TInvMastDoc>> => {\n const results: Record<string, TInvMastDoc> = {};\n const settled = await Promise.allSettled(\n params.map(async (p) => {\n const opts = getInvMastDocOptions(\n api,\n p.invMastUid,\n p.itemId,\n includePricing,\n cache,\n );\n const data = await opts.queryFn();\n return { key: p.itemId.toUpperCase(), data };\n }),\n );\n for (const entry of settled) {\n if (entry.status === \"fulfilled\") {\n results[entry.value.key] = entry.value.data;\n }\n }\n return results;\n },\n staleTime: tier?.staleTime,\n gcTime: tier?.gcTime,\n };\n};\n","import type { QueryClient } from \"@tanstack/react-query\";\n\nexport interface BatchQueryConfig<TParam, TData> {\n params: TParam[];\n queryClient: QueryClient;\n /** Build individual cache key for a single param. */\n getItemKey: (param: TParam) => readonly unknown[];\n /** Build the string key for the result Record from a param. */\n getResultKey: (param: TParam) => string;\n /** Fetch only uncached items, return keyed Record. */\n fetchItems: (uncached: TParam[]) => Promise<Record<string, TData>>;\n /** Extract individual cache key from a fetched result entry (for seeding). */\n getSeedKey: (resultKey: string, data: TData) => readonly unknown[];\n}\n\n/**\n * Generic batch query executor.\n *\n * 1. Checks queryClient cache for each param\n * 2. Fetches only uncached items in a single batch call\n * 3. Seeds individual cache entries from the response\n * 4. Returns merged cached + fetched record\n */\nexport async function executeBatchQuery<TParam, TData>(\n config: BatchQueryConfig<TParam, TData>,\n): Promise<Record<string, TData>> {\n const { params, queryClient, getItemKey, getResultKey, fetchItems, getSeedKey } = config;\n\n if (params.length === 0) {\n return {};\n }\n\n const cached: Record<string, TData> = {};\n const uncached: TParam[] = [];\n\n for (const param of params) {\n const existing = queryClient.getQueryData<TData>(getItemKey(param));\n if (existing !== undefined) {\n cached[getResultKey(param)] = existing;\n } else {\n uncached.push(param);\n }\n }\n\n if (uncached.length === 0) {\n return cached;\n }\n\n const fetched = await fetchItems(uncached);\n\n for (const [key, data] of Object.entries(fetched)) {\n queryClient.setQueryData(getSeedKey(key, data as TData), data);\n }\n\n return { ...cached, ...fetched };\n}\n","import type { TProductCategory } from \"@simpleapps-com/augur-utils\";\nimport type { AugurApiClient } from \"../provider\";\nimport type { CacheConfig } from \"../types\";\nimport { withCache } from \"./cache-helper\";\n\ntype ProductCategoryResponse = {\n itemCategoryDesc: string;\n childrenTotal: number;\n children: TProductCategory[];\n categoryImage: string | null;\n};\n\nexport const getProductCategoryKey = (\n itemCategoryUid: number | string | null,\n) => {\n return [\"productCategory\", itemCategoryUid] as const;\n};\n\nexport const getProductCategoryOptions = (\n api: AugurApiClient,\n itemCategoryUid: number | string,\n cache?: CacheConfig,\n) => {\n const tier = cache?.static;\n return {\n queryKey: getProductCategoryKey(itemCategoryUid),\n queryFn: async (): Promise<ProductCategoryResponse> => {\n const edgeCache = tier?.edgeCache;\n return withCache(\n cache?.provider,\n tier,\n \"items.categories.get\",\n async () => {\n const response = await api.items.categories.get(Number(itemCategoryUid), {\n ...(edgeCache != null ? { edgeCache } : {}),\n });\n return response.data;\n },\n itemCategoryUid,\n );\n },\n staleTime: tier?.staleTime,\n gcTime: tier?.gcTime,\n };\n};\n","import type { TItemDetails } from \"@simpleapps-com/augur-utils\";\nimport type { AugurApiClient } from \"../provider\";\nimport type { CacheConfig } from \"../types\";\nimport { withCache } from \"./cache-helper\";\n\nexport const getItemDetailsKey = (itemId: number | string) => {\n const normalizedId = typeof itemId === \"string\" ? itemId.toUpperCase() : itemId;\n return [\"itemDetails\", normalizedId] as const;\n};\n\nexport const getItemDetailsOptions = (\n api: AugurApiClient,\n itemId: number | string,\n cache?: CacheConfig,\n) => {\n const tier = cache?.static;\n return {\n queryKey: getItemDetailsKey(itemId),\n queryFn: async (): Promise<TItemDetails> => {\n const edgeCache = tier?.edgeCache;\n return withCache(\n cache?.provider,\n tier,\n \"items.invMast.doc.list\",\n async () => {\n const response = await api.items.invMast.doc.list(Number(itemId), {\n ...(edgeCache != null ? { edgeCache } : {}),\n });\n if (!response.data) throw new Error(\"Item not found\");\n return response.data;\n },\n itemId,\n );\n },\n staleTime: tier?.staleTime,\n gcTime: tier?.gcTime,\n };\n};\n","import type { AugurApiClient } from \"../provider\";\nimport type { CacheConfig } from \"../types\";\nimport { withCache } from \"./cache-helper\";\n\nexport const getItemAttributesKey = (\n itemCategoryUid: number | string | null,\n) => {\n return [\"itemAttributes\", itemCategoryUid] as const;\n};\n\nexport const getItemAttributesOptions = (\n api: AugurApiClient,\n itemCategoryUid: number | string,\n cache?: CacheConfig,\n) => {\n const tier = cache?.static;\n return {\n queryKey: getItemAttributesKey(itemCategoryUid),\n queryFn: async () => {\n const edgeCache = tier?.edgeCache;\n return withCache(\n cache?.provider,\n tier,\n \"openSearch.itemSearch.attributes.list\",\n async () => {\n const response = await api.openSearch.itemSearch.attributes.list({\n q: \"\",\n searchType: \"query\",\n classId5List: String(itemCategoryUid),\n ...(edgeCache != null ? { edgeCache } : {}),\n });\n return response.data;\n },\n itemCategoryUid,\n );\n },\n staleTime: tier?.staleTime,\n gcTime: tier?.gcTime,\n };\n};\n","import type { TProductItem } from \"@simpleapps-com/augur-utils\";\nimport type { AugurApiClient } from \"../provider\";\nimport type { CacheConfig, PageData } from \"../types\";\nimport { withCache } from \"./cache-helper\";\n\ntype ProductSearchResponse = {\n items: TProductItem[];\n totalResults: number;\n};\n\n/**\n * Generates a consistent query key for product search queries.\n */\nexport const getProductSearchKey = (pageData: PageData) => {\n return [\n \"productSearch\",\n pageData.q,\n pageData.limit,\n pageData.offset,\n pageData.sortBy,\n pageData.itemCategoryUid,\n ] as const;\n};\n\n/**\n * Query options for product search. Accepts the SDK instance so it works\n * in both client (via provider) and server (via direct construction).\n */\nexport const getProductSearchOptions = (\n api: AugurApiClient,\n pageData: PageData,\n cache?: CacheConfig,\n) => {\n const tier = cache?.semiStatic;\n return {\n queryKey: getProductSearchKey(pageData),\n queryFn: async (): Promise<ProductSearchResponse> => {\n const edgeCache = tier?.edgeCache;\n return withCache(\n cache?.provider,\n tier,\n \"openSearch.itemSearch.list\",\n async () => {\n const response = await api.openSearch.itemSearch.list({\n q: pageData.q,\n searchType: \"query\",\n size: pageData.limit,\n from: pageData.offset,\n classId5List: pageData.itemCategoryUid\n ? String(pageData.itemCategoryUid)\n : undefined,\n filters: pageData.filters\n ? JSON.stringify(pageData.filters)\n : undefined,\n ...(edgeCache != null ? { edgeCache } : {}),\n });\n return response.data;\n },\n pageData,\n );\n },\n staleTime: tier?.staleTime,\n gcTime: tier?.gcTime,\n };\n};\n","import type { AugurApiClient } from \"../provider\";\nimport type { CacheConfig, SearchSuggestionsResponse } from \"../types\";\nimport { withCache } from \"./cache-helper\";\n\n/**\n * Generates a consistent query key for search suggestion queries.\n */\nexport const getSearchSuggestionsKey = (\n query: string,\n limit: number,\n offset: number,\n) => {\n return [\"searchSuggestions\", query, limit, offset] as const;\n};\n\n/**\n * Query options for search suggestions. Accepts the SDK instance so it works\n * in both client (via provider) and server (via direct construction).\n */\nexport const getSearchSuggestionsOptions = (\n api: AugurApiClient,\n query: string,\n limit: number = 10,\n offset: number = 0,\n cache?: CacheConfig,\n) => {\n const tier = cache?.static;\n return {\n queryKey: getSearchSuggestionsKey(query, limit, offset),\n queryFn: async (): Promise<SearchSuggestionsResponse> => {\n const edgeCache = tier?.edgeCache;\n return withCache(\n cache?.provider,\n tier,\n \"openSearch.suggestions.suggest.list\",\n async () => {\n const response = await api.openSearch.suggestions.suggest.list({\n q: query,\n size: limit,\n from: offset,\n ...(edgeCache != null ? { edgeCache } : {}),\n });\n return response.data;\n },\n query,\n limit,\n offset,\n );\n },\n staleTime: tier?.staleTime,\n gcTime: tier?.gcTime,\n };\n};\n","import type { AugurApiClient } from \"../provider\";\nimport type { CacheConfig } from \"../types\";\nimport { getItemPriceOptions } from \"./item-price\";\n\n/**\n * Get cart pricing query options for prefetching or parent components.\n */\nexport function getCartPricingQueryOptions(\n api: AugurApiClient,\n cartLines: Array<{ itemId: string; quantity: number }>,\n customerId: string | number | undefined,\n cache?: CacheConfig,\n) {\n return cartLines.map((line) => ({\n ...getItemPriceOptions(api, line.itemId, customerId, line.quantity, cache),\n enabled: !!customerId && !!line.itemId,\n }));\n}\n","import {\n type TItemsFilters,\n type TProductItem,\n} from \"@simpleapps-com/augur-utils\";\nimport type { AugurApiClient } from \"../provider\";\nimport type { InfiniteScrollPage } from \"../callbacks\";\nimport type { CacheConfig } from \"../types\";\nimport { withCache } from \"./cache-helper\";\n\nimport { stableStringify } from \"./stable-stringify\";\n\nexport const getCategoryItemsInfiniteKey = (\n itemCategoryUid: number,\n itemsFilters: TItemsFilters,\n) => {\n return [\n \"categoryItemsInfinite\",\n itemCategoryUid,\n stableStringify(itemsFilters),\n ] as const;\n};\n\n/**\n * Full infinite query options for category items.\n * Usable for server-side prefetch with `queryClient.prefetchInfiniteQuery()`.\n */\nexport const getCategoryItemsInfiniteOptions = (\n api: AugurApiClient,\n itemCategoryUid: number,\n itemsFilters: TItemsFilters,\n cache?: CacheConfig,\n) => {\n const tier = cache?.semiStatic;\n return {\n queryKey: getCategoryItemsInfiniteKey(itemCategoryUid, itemsFilters),\n queryFn: async ({\n pageParam = 0,\n }: {\n pageParam?: unknown;\n }): Promise<InfiniteScrollPage> => {\n const edgeCache = tier?.edgeCache;\n return withCache(\n cache?.provider,\n tier,\n \"openSearch.itemSearch.list\",\n async () => {\n const response = await api.openSearch.itemSearch.list({\n q: itemsFilters.q || \"\",\n searchType: \"query\",\n size: itemsFilters.limit,\n from: pageParam as number,\n classId5List: String(itemCategoryUid),\n filters: itemsFilters.filters?.length\n ? JSON.stringify(itemsFilters.filters)\n : undefined,\n ...(edgeCache != null ? { edgeCache } : {}),\n });\n const items: TProductItem[] = response.data?.items ?? [];\n const total: number = response.data?.totalResults ?? 0;\n const nextOffset = (pageParam as number) + itemsFilters.limit;\n return {\n data: items,\n total,\n nextCursor: nextOffset < total ? nextOffset : undefined,\n };\n },\n itemCategoryUid, itemsFilters, pageParam,\n );\n },\n initialPageParam: 0,\n getNextPageParam: (lastPage: InfiniteScrollPage) => lastPage.nextCursor,\n staleTime: tier?.staleTime,\n gcTime: tier?.gcTime,\n };\n};\n","import {\n type TItemsFilters,\n type TProductItem,\n} from \"@simpleapps-com/augur-utils\";\nimport type { AugurApiClient } from \"../provider\";\nimport type { InfiniteScrollPage } from \"../callbacks\";\nimport type { CacheConfig } from \"../types\";\nimport { withCache } from \"./cache-helper\";\n\nimport { stableStringify } from \"./stable-stringify\";\n\nexport const getItemSearchInfiniteKey = (\n itemsFilters: TItemsFilters,\n itemCategoryUid?: number | string,\n) => {\n return [\n \"itemSearchInfinite\",\n stableStringify(itemsFilters),\n itemCategoryUid,\n ] as const;\n};\n\n/**\n * Full infinite query options for item search.\n * Usable for server-side prefetch with `queryClient.prefetchInfiniteQuery()`.\n */\nexport const getItemSearchInfiniteOptions = (\n api: AugurApiClient,\n itemsFilters: TItemsFilters,\n itemCategoryUid?: number | string,\n cache?: CacheConfig,\n) => {\n const tier = cache?.semiStatic;\n return {\n queryKey: getItemSearchInfiniteKey(itemsFilters, itemCategoryUid),\n queryFn: async ({\n pageParam = 0,\n }: {\n pageParam?: unknown;\n }): Promise<InfiniteScrollPage> => {\n const edgeCache = tier?.edgeCache;\n return withCache(\n cache?.provider,\n tier,\n \"openSearch.itemSearch.list\",\n async () => {\n const response = await api.openSearch.itemSearch.list({\n q: itemsFilters.q,\n searchType: \"query\",\n size: itemsFilters.limit,\n from: pageParam as number,\n classId5List: itemCategoryUid ? String(itemCategoryUid) : undefined,\n filters: itemsFilters.filters?.length\n ? JSON.stringify(itemsFilters.filters)\n : undefined,\n ...(edgeCache != null ? { edgeCache } : {}),\n });\n const items: TProductItem[] = response.data?.items ?? [];\n const total: number = response.data?.totalResults ?? 0;\n const nextOffset = (pageParam as number) + itemsFilters.limit;\n return {\n data: items,\n total,\n nextCursor: nextOffset < total ? nextOffset : undefined,\n };\n },\n itemsFilters, itemCategoryUid, pageParam,\n );\n },\n initialPageParam: 0,\n getNextPageParam: (lastPage: InfiniteScrollPage) => lastPage.nextCursor,\n staleTime: tier?.staleTime,\n gcTime: tier?.gcTime,\n meta: { persist: true },\n };\n};\n","import type { TJoomlaContent } from \"@simpleapps-com/augur-utils\";\nimport type { AugurApiClient } from \"../provider\";\nimport type { CacheConfig } from \"../types\";\nimport { withCache } from \"./cache-helper\";\n\nexport const getJoomlaContentKey = (articleId: number | string) => {\n return [\"joomlaContent\", articleId] as const;\n};\n\nexport const getJoomlaContentOptions = (\n api: AugurApiClient,\n articleId: number | string,\n cache?: CacheConfig,\n) => {\n const tier = cache?.static;\n return {\n queryKey: getJoomlaContentKey(articleId),\n queryFn: async (): Promise<TJoomlaContent> => {\n const edgeCache = tier?.edgeCache;\n return withCache(\n cache?.provider,\n tier,\n \"joomla.content.doc.get\",\n async () => {\n const response = await api.joomla.content.doc.get(articleId, {\n ...(edgeCache != null ? { edgeCache } : {}),\n });\n if (!response.data) throw new Error(\"Article not found\");\n return response.data;\n },\n articleId,\n );\n },\n staleTime: tier?.staleTime,\n gcTime: tier?.gcTime,\n };\n};\n","import {\n type TJoomlaContent,\n type TJoomlaContentFilters,\n} from \"@simpleapps-com/augur-utils\";\nimport type { AugurApiClient } from \"../provider\";\nimport type { CacheConfig } from \"../types\";\nimport { withCache } from \"./cache-helper\";\n\nexport const getJoomlaContentListKey = (\n categoryId: number | string,\n filters?: Partial<TJoomlaContentFilters>,\n) => {\n return [\"joomlaContentList\", categoryId, filters] as const;\n};\n\nexport const getJoomlaContentListOptions = (\n api: AugurApiClient,\n categoryId: number | string,\n filters?: Partial<TJoomlaContentFilters>,\n cache?: CacheConfig,\n) => {\n const tier = cache?.semiStatic;\n return {\n queryKey: getJoomlaContentListKey(categoryId, filters),\n queryFn: async (): Promise<TJoomlaContent[]> => {\n const edgeCache = tier?.edgeCache;\n return withCache(\n cache?.provider,\n tier,\n \"joomla.content.list\",\n async () => {\n const response = await api.joomla.content.list({\n catid: categoryId,\n ...filters,\n ...(edgeCache != null ? { edgeCache } : {}),\n });\n return response.data ?? [];\n },\n categoryId, filters,\n );\n },\n staleTime: tier?.staleTime,\n gcTime: tier?.gcTime,\n };\n};\n","import type { MenuItem, TMenuFilters } from \"@simpleapps-com/augur-utils\";\nimport type { AugurApiClient } from \"../provider\";\nimport type { CacheConfig } from \"../types\";\nimport { withCache } from \"./cache-helper\";\n\nexport const getJoomlaMenuKey = (\n filters?: Partial<TMenuFilters>,\n) => {\n return [\"joomlaMenu\", filters] as const;\n};\n\nexport const getJoomlaMenuOptions = (\n api: AugurApiClient,\n filters?: Partial<TMenuFilters>,\n cache?: CacheConfig,\n) => {\n const tier = cache?.semiStatic;\n return {\n queryKey: getJoomlaMenuKey(filters),\n queryFn: async (): Promise<MenuItem[]> => {\n const edgeCache = tier?.edgeCache;\n return withCache(\n cache?.provider,\n tier,\n \"joomla.menu.list\",\n async () => {\n const response = await api.joomla.menu.list({\n ...filters,\n ...(edgeCache != null ? { edgeCache } : {}),\n });\n return response.data ?? [];\n },\n filters,\n );\n },\n staleTime: tier?.staleTime,\n gcTime: tier?.gcTime,\n };\n};\n","import type { MenuItem } from \"@simpleapps-com/augur-utils\";\nimport type { AugurApiClient } from \"../provider\";\nimport type { CacheConfig } from \"../types\";\nimport { withCache } from \"./cache-helper\";\n\nexport const getJoomlaMenuDocKey = (menuId: number | string) => {\n return [\"joomlaMenuDoc\", menuId] as const;\n};\n\nexport const getJoomlaMenuDocOptions = (\n api: AugurApiClient,\n menuId: number | string,\n cache?: CacheConfig,\n) => {\n const tier = cache?.static;\n return {\n queryKey: getJoomlaMenuDocKey(menuId),\n queryFn: async (): Promise<MenuItem> => {\n const edgeCache = tier?.edgeCache;\n return withCache(\n cache?.provider,\n tier,\n \"joomla.menu.doc.get\",\n async () => {\n const response = await api.joomla.menu.doc.get(menuId, {\n ...(edgeCache != null ? { edgeCache } : {}),\n });\n if (!response.data) throw new Error(\"Menu item not found\");\n return response.data;\n },\n menuId,\n );\n },\n staleTime: tier?.staleTime,\n gcTime: tier?.gcTime,\n };\n};\n","export const getCustomerOrdersKey = (\n customerId: number | string | undefined,\n params?: Record<string, unknown>,\n) => {\n return [\"customerOrders\", customerId, params] as const;\n};\n\nexport const getCustomerOrderDetailKey = (\n customerId: number | string | undefined,\n orderId: number | string | undefined,\n) => {\n return [\"customerOrderDetail\", customerId, orderId] as const;\n};\n","export const getCustomerInvoicesKey = (\n customerId: number | string | undefined,\n params?: Record<string, unknown>,\n) => {\n return [\"customerInvoices\", customerId, params] as const;\n};\n\nexport const getCustomerInvoiceDetailKey = (\n customerId: number | string | undefined,\n invoiceNo: number | string | undefined,\n) => {\n return [\"customerInvoiceDetail\", customerId, invoiceNo] as const;\n};\n","export const getCustomerQuotesKey = (\n customerId: number | string | undefined,\n params?: Record<string, unknown>,\n) => {\n return [\"customerQuotes\", customerId, params] as const;\n};\n\nexport const getCustomerQuoteDetailKey = (\n customerId: number | string | undefined,\n quoteNo: number | string | undefined,\n) => {\n return [\"customerQuoteDetail\", customerId, quoteNo] as const;\n};\n"]}
@@ -206,6 +206,74 @@ var getInvMastStockOptions = (api, invMastUid, cache) => {
206
206
  };
207
207
  };
208
208
 
209
+ // src/queries/batch-inv-mast-doc.ts
210
+ var getBatchInvMastDocKey = (params, includePricing) => {
211
+ const sorted = [...params].sort(
212
+ (a, b) => a.itemId.toUpperCase().localeCompare(b.itemId.toUpperCase())
213
+ );
214
+ return [
215
+ "batchInvMastDoc",
216
+ stableStringify(sorted.map((p) => ({ invMastUid: p.invMastUid, itemId: p.itemId.toUpperCase() }))),
217
+ includePricing
218
+ ];
219
+ };
220
+ var getBatchInvMastDocOptions = (api, params, includePricing, cache) => {
221
+ const tier = cache?.static;
222
+ return {
223
+ queryKey: getBatchInvMastDocKey(params, includePricing),
224
+ queryFn: async () => {
225
+ const results = {};
226
+ const settled = await Promise.allSettled(
227
+ params.map(async (p) => {
228
+ const opts = getInvMastDocOptions(
229
+ api,
230
+ p.invMastUid,
231
+ p.itemId,
232
+ includePricing,
233
+ cache
234
+ );
235
+ const data = await opts.queryFn();
236
+ return { key: p.itemId.toUpperCase(), data };
237
+ })
238
+ );
239
+ for (const entry of settled) {
240
+ if (entry.status === "fulfilled") {
241
+ results[entry.value.key] = entry.value.data;
242
+ }
243
+ }
244
+ return results;
245
+ },
246
+ staleTime: tier?.staleTime,
247
+ gcTime: tier?.gcTime
248
+ };
249
+ };
250
+
251
+ // src/queries/batch-query.ts
252
+ async function executeBatchQuery(config) {
253
+ const { params, queryClient, getItemKey, getResultKey, fetchItems, getSeedKey } = config;
254
+ if (params.length === 0) {
255
+ return {};
256
+ }
257
+ const cached = {};
258
+ const uncached = [];
259
+ for (const param of params) {
260
+ const existing = queryClient.getQueryData(getItemKey(param));
261
+ if (existing !== void 0) {
262
+ cached[getResultKey(param)] = existing;
263
+ } else {
264
+ uncached.push(param);
265
+ }
266
+ }
267
+ if (uncached.length === 0) {
268
+ return cached;
269
+ }
270
+ const fetched = await fetchItems(uncached);
271
+ for (const [key, data] of Object.entries(fetched)) {
272
+ queryClient.setQueryData(getSeedKey(key, data), data);
273
+ }
274
+ return { ...cached, ...fetched };
275
+ }
276
+
209
277
  // src/queries/product-category.ts
210
278
  var getProductCategoryKey = (itemCategoryUid) => {
211
279
  return ["productCategory", itemCategoryUid];
@@ -634,6 +702,9 @@ export {
634
702
  getInvMastOptions,
635
703
  getInvMastStockKey,
636
704
  getInvMastStockOptions,
705
+ getBatchInvMastDocKey,
706
+ getBatchInvMastDocOptions,
707
+ executeBatchQuery,
637
708
  getProductCategoryKey,
638
709
  getProductCategoryOptions,
639
710
  getItemDetailsKey,
@@ -664,4 +735,4 @@ export {
664
735
  getCustomerQuotesKey,
665
736
  getCustomerQuoteDetailKey
666
737
  };
667
- //# sourceMappingURL=chunk-CL3XM5B5.js.map
738
+ //# sourceMappingURL=chunk-PZK7QARW.js.map