@simpleapps-com/augur-server 2.0.2 → 2.0.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.
@@ -1,6 +1,9 @@
1
1
  import {
2
2
  batchFetch
3
3
  } from "./chunk-XGRQ53P2.js";
4
+ import {
5
+ toListResult
6
+ } from "./chunk-OHBOKJCW.js";
4
7
 
5
8
  // src/environment.ts
6
9
  function getEnvironment() {
@@ -149,10 +152,11 @@ async function withServerCache(prefix, redisTtl, methodPath, fn, ...keyArgs) {
149
152
 
150
153
  // src/pagination.ts
151
154
  function paginateOffset(items, pageParam, limit, total) {
152
- const hasMore = total !== void 0 ? (pageParam + 1) * limit < total : items.length === limit;
155
+ const resolvedTotal = total ?? 0;
156
+ const hasMore = total !== void 0 ? (pageParam + 1) * limit < resolvedTotal : items.length === limit;
153
157
  return {
154
158
  data: items,
155
- total,
159
+ total: resolvedTotal,
156
160
  nextCursor: hasMore ? pageParam + 1 : void 0,
157
161
  hasMore
158
162
  };
@@ -259,6 +263,8 @@ function createItemActions(api, config = {}) {
259
263
  const cat = category;
260
264
  return {
261
265
  ...cat,
266
+ // Normalize PHP-style `false` to `null` for categoryImage
267
+ categoryImage: cat.categoryImage || null,
262
268
  children: sortCategoryChildren(cat.children)
263
269
  };
264
270
  }
@@ -337,7 +343,7 @@ function createItemActions(api, config = {}) {
337
343
  categoryUid,
338
344
  { edgeCache }
339
345
  );
340
- return response.data.attributes;
346
+ return { attributes: response.data.attributes };
341
347
  },
342
348
  categoryUid
343
349
  );
@@ -394,7 +400,7 @@ function createItemActions(api, config = {}) {
394
400
  const response = await api.items.invMast.stock.get(invMastUid, {
395
401
  edgeCache
396
402
  });
397
- return response.data?.stockData ?? [];
403
+ return response.data ?? { stockData: [], companySummary: {} };
398
404
  },
399
405
  invMastUid
400
406
  );
@@ -422,7 +428,7 @@ function createItemActions(api, config = {}) {
422
428
  const response = await api.items.invMast.faq.list(invMastUid, {
423
429
  edgeCache: longEdgeCache
424
430
  });
425
- return response.data;
431
+ return toListResult(response);
426
432
  },
427
433
  invMastUid
428
434
  );
@@ -436,7 +442,7 @@ function createItemActions(api, config = {}) {
436
442
  const response = await api.items.invMast.invSub.list(invMastUid, {
437
443
  edgeCache: longEdgeCache
438
444
  });
439
- return response.data;
445
+ return toListResult(response);
440
446
  },
441
447
  invMastUid
442
448
  );
@@ -451,7 +457,7 @@ function createItemActions(api, config = {}) {
451
457
  invMastUid,
452
458
  { edgeCache }
453
459
  );
454
- return response.data;
460
+ return toListResult(response);
455
461
  },
456
462
  invMastUid
457
463
  );
@@ -465,7 +471,7 @@ function createItemActions(api, config = {}) {
465
471
  const response = await api.items.invMast.similar.list(invMastUid, {
466
472
  edgeCache: longEdgeCache
467
473
  });
468
- return response.data;
474
+ return toListResult(response);
469
475
  },
470
476
  invMastUid
471
477
  );
@@ -515,7 +521,7 @@ function createCommerceActions(api, config = {}) {
515
521
  }
516
522
  async function getCartLines(cartHdrUid) {
517
523
  const response = await api.commerce.cartLine.get(cartHdrUid);
518
- return response.data;
524
+ return toListResult(response);
519
525
  }
520
526
  async function addToCart(cartHdrUid, items) {
521
527
  try {
@@ -555,7 +561,7 @@ function createCommerceActions(api, config = {}) {
555
561
  }
556
562
  async function getCartAlsoBought(cartHdrUid) {
557
563
  const response = await api.commerce.cartHdr.alsoBought.get(cartHdrUid);
558
- return response.data;
564
+ return toListResult(response);
559
565
  }
560
566
  async function checkoutOrder(cartHdrUid, data) {
561
567
  try {
@@ -621,7 +627,7 @@ function createSearchActions(api, config = {}) {
621
627
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
622
628
  await openSearch.itemSearch.attributes.list(params)
623
629
  );
624
- return response.data.attributes;
630
+ return { attributes: response.data.attributes };
625
631
  },
626
632
  q
627
633
  );
@@ -738,7 +744,7 @@ function createShippingActions(api, config) {
738
744
  "ups.ratesShop.get",
739
745
  async () => {
740
746
  const response = await api.ups.ratesShop.get(params);
741
- return response.data;
747
+ return toListResult(response);
742
748
  },
743
749
  params
744
750
  );
@@ -791,7 +797,7 @@ function createJoomlaActions(api, config = {}) {
791
797
  ...params,
792
798
  edgeCache
793
799
  });
794
- return response.data;
800
+ return toListResult(response);
795
801
  },
796
802
  params
797
803
  );
@@ -805,7 +811,7 @@ function createJoomlaActions(api, config = {}) {
805
811
  published: 1,
806
812
  limit: 100
807
813
  };
808
- const items = await withServerCache(
814
+ const result = await withServerCache(
809
815
  cachePrefix,
810
816
  redisTtl,
811
817
  "joomla.menu.list",
@@ -814,12 +820,13 @@ function createJoomlaActions(api, config = {}) {
814
820
  ...sdkParams,
815
821
  edgeCache
816
822
  });
817
- return response.data;
823
+ return toListResult(response);
818
824
  },
819
825
  sdkParams
820
826
  );
821
827
  const pid = String(parentId);
822
- return items.filter((item) => String(item.parent_id) === pid);
828
+ const filtered = result.data.filter((item) => String(item.parent_id) === pid);
829
+ return { ...result, data: filtered, total: filtered.length };
823
830
  }
824
831
  return withServerCache(
825
832
  cachePrefix,
@@ -830,7 +837,7 @@ function createJoomlaActions(api, config = {}) {
830
837
  ...paramsOrParentId,
831
838
  edgeCache
832
839
  });
833
- return response.data;
840
+ return toListResult(response);
834
841
  },
835
842
  paramsOrParentId
836
843
  );
@@ -919,7 +926,7 @@ function createLegacyActions(api, config = {}) {
919
926
  invMastUid,
920
927
  { edgeCache }
921
928
  );
922
- return response.data;
929
+ return toListResult(response);
923
930
  },
924
931
  invMastUid
925
932
  );
@@ -933,7 +940,7 @@ function createLegacyActions(api, config = {}) {
933
940
  const response = await api.legacy.invMast.tags.list(invMastUid, {
934
941
  edgeCache
935
942
  });
936
- return response.data;
943
+ return toListResult(response);
937
944
  },
938
945
  invMastUid
939
946
  );
@@ -948,7 +955,7 @@ function createLegacyActions(api, config = {}) {
948
955
  ...params,
949
956
  edgeCache: longEdgeCache
950
957
  });
951
- return response.data;
958
+ return toListResult(response);
952
959
  },
953
960
  params?.twoLetterCode
954
961
  );
@@ -989,7 +996,7 @@ function createCustomersActions(api, config = {}) {
989
996
  edgeCache
990
997
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
991
998
  });
992
- return response.data;
999
+ return toListResult(response);
993
1000
  },
994
1001
  params
995
1002
  );
@@ -1018,7 +1025,7 @@ function createCustomersActions(api, config = {}) {
1018
1025
  ...params,
1019
1026
  edgeCache
1020
1027
  });
1021
- return { data: response.data, total: response.total };
1028
+ return toListResult(response);
1022
1029
  },
1023
1030
  customerId,
1024
1031
  params
@@ -1052,7 +1059,7 @@ function createCustomersActions(api, config = {}) {
1052
1059
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
1053
1060
  { ...params, edgeCache }
1054
1061
  );
1055
- return { data: response.data, total: response.total };
1062
+ return toListResult(response);
1056
1063
  },
1057
1064
  customerId,
1058
1065
  params
@@ -1085,7 +1092,7 @@ function createCustomersActions(api, config = {}) {
1085
1092
  ...params,
1086
1093
  edgeCache
1087
1094
  });
1088
- return { data: response.data, total: response.total };
1095
+ return toListResult(response);
1089
1096
  },
1090
1097
  customerId,
1091
1098
  params
@@ -1118,7 +1125,7 @@ function createCustomersActions(api, config = {}) {
1118
1125
  ...params,
1119
1126
  edgeCache
1120
1127
  });
1121
- return response.data;
1128
+ return toListResult(response);
1122
1129
  },
1123
1130
  params
1124
1131
  );
@@ -1132,7 +1139,7 @@ function createCustomersActions(api, config = {}) {
1132
1139
  const response = await api.customers.customer.shipTo.list(customerId, {
1133
1140
  edgeCache
1134
1141
  });
1135
- return response.data;
1142
+ return toListResult(response);
1136
1143
  },
1137
1144
  customerId
1138
1145
  );
@@ -1198,7 +1205,7 @@ function createP21PimActions(api, config = {}) {
1198
1205
  ...params,
1199
1206
  edgeCache
1200
1207
  });
1201
- return response.data;
1208
+ return toListResult(response);
1202
1209
  },
1203
1210
  params
1204
1211
  );
@@ -1227,7 +1234,7 @@ function createAgrSiteActions(api, config = {}) {
1227
1234
  edgeCache: longEdgeCache
1228
1235
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
1229
1236
  });
1230
- return response.data;
1237
+ return toListResult(response);
1231
1238
  },
1232
1239
  serviceName
1233
1240
  );
@@ -1242,7 +1249,7 @@ function createAgrSiteActions(api, config = {}) {
1242
1249
  ...params,
1243
1250
  edgeCache: longEdgeCache
1244
1251
  });
1245
- return response.data;
1252
+ return toListResult(response);
1246
1253
  },
1247
1254
  params
1248
1255
  );
@@ -1353,7 +1360,7 @@ function createUpsActions(api, config = {}) {
1353
1360
  async function getRates(params) {
1354
1361
  try {
1355
1362
  const response = await api.ups.ratesShop.get(params);
1356
- return response.data;
1363
+ return toListResult(response);
1357
1364
  } catch {
1358
1365
  return void 0;
1359
1366
  }
@@ -1389,7 +1396,7 @@ function createLogisticsActions(api, config = {}) {
1389
1396
  edgeCache: longEdgeCache
1390
1397
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
1391
1398
  });
1392
- return response.data;
1399
+ return toListResult(response);
1393
1400
  },
1394
1401
  params ? JSON.stringify(params) : void 0
1395
1402
  );
@@ -1441,7 +1448,7 @@ function createNexusActions(api, config = {}) {
1441
1448
  ...params,
1442
1449
  edgeCache
1443
1450
  });
1444
- return response.data;
1451
+ return toListResult(response);
1445
1452
  },
1446
1453
  params ? JSON.stringify(params) : void 0
1447
1454
  );
@@ -1456,7 +1463,7 @@ function createNexusActions(api, config = {}) {
1456
1463
  ...params,
1457
1464
  edgeCache
1458
1465
  });
1459
- return response.data;
1466
+ return toListResult(response);
1460
1467
  },
1461
1468
  params ? JSON.stringify(params) : void 0
1462
1469
  );
@@ -1471,7 +1478,7 @@ function createNexusActions(api, config = {}) {
1471
1478
  ...params,
1472
1479
  edgeCache
1473
1480
  });
1474
- return response.data;
1481
+ return toListResult(response);
1475
1482
  },
1476
1483
  params ? JSON.stringify(params) : void 0
1477
1484
  );
@@ -1504,7 +1511,7 @@ function createVmiActions(api, config = {}) {
1504
1511
  ...params,
1505
1512
  edgeCache
1506
1513
  });
1507
- return response.data;
1514
+ return toListResult(response);
1508
1515
  },
1509
1516
  params ? JSON.stringify(params) : void 0
1510
1517
  );
@@ -1520,7 +1527,7 @@ function createVmiActions(api, config = {}) {
1520
1527
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
1521
1528
  { ...params, edgeCache }
1522
1529
  );
1523
- return response.data;
1530
+ return toListResult(response);
1524
1531
  },
1525
1532
  warehouseUid,
1526
1533
  params ? JSON.stringify(params) : void 0
@@ -1536,7 +1543,7 @@ function createVmiActions(api, config = {}) {
1536
1543
  ...params,
1537
1544
  edgeCache
1538
1545
  });
1539
- return response.data;
1546
+ return toListResult(response);
1540
1547
  },
1541
1548
  params ? JSON.stringify(params) : void 0
1542
1549
  );
@@ -1551,7 +1558,7 @@ function createVmiActions(api, config = {}) {
1551
1558
  ...params,
1552
1559
  edgeCache
1553
1560
  });
1554
- return response.data;
1561
+ return toListResult(response);
1555
1562
  },
1556
1563
  params ? JSON.stringify(params) : void 0
1557
1564
  );
@@ -1567,7 +1574,7 @@ function createVmiActions(api, config = {}) {
1567
1574
  edgeCache
1568
1575
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
1569
1576
  });
1570
- return response.data;
1577
+ return toListResult(response);
1571
1578
  },
1572
1579
  params ? JSON.stringify(params) : void 0
1573
1580
  );
@@ -1583,7 +1590,7 @@ function createVmiActions(api, config = {}) {
1583
1590
  edgeCache
1584
1591
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
1585
1592
  });
1586
- return response.data;
1593
+ return toListResult(response);
1587
1594
  },
1588
1595
  params ? JSON.stringify(params) : void 0
1589
1596
  );
@@ -1599,7 +1606,7 @@ function createVmiActions(api, config = {}) {
1599
1606
  edgeCache
1600
1607
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
1601
1608
  });
1602
- return response.data;
1609
+ return toListResult(response);
1603
1610
  },
1604
1611
  params ? JSON.stringify(params) : void 0
1605
1612
  );
@@ -1634,7 +1641,7 @@ function createP21CoreActions(api, config = {}) {
1634
1641
  ...params,
1635
1642
  edgeCache
1636
1643
  });
1637
- return response.data;
1644
+ return toListResult(response);
1638
1645
  },
1639
1646
  params
1640
1647
  );
@@ -1649,7 +1656,7 @@ function createP21CoreActions(api, config = {}) {
1649
1656
  ...params,
1650
1657
  edgeCache: longEdgeCache
1651
1658
  });
1652
- return response.data;
1659
+ return toListResult(response);
1653
1660
  },
1654
1661
  params
1655
1662
  );
@@ -1679,7 +1686,7 @@ function createP21CoreActions(api, config = {}) {
1679
1686
  ...params,
1680
1687
  edgeCache: longEdgeCache
1681
1688
  });
1682
- return response.data;
1689
+ return toListResult(response);
1683
1690
  },
1684
1691
  params
1685
1692
  );
@@ -1694,7 +1701,7 @@ function createP21CoreActions(api, config = {}) {
1694
1701
  ...params,
1695
1702
  edgeCache: longEdgeCache
1696
1703
  });
1697
- return response.data;
1704
+ return toListResult(response);
1698
1705
  },
1699
1706
  params
1700
1707
  );
@@ -1709,7 +1716,7 @@ function createP21CoreActions(api, config = {}) {
1709
1716
  ...params,
1710
1717
  edgeCache
1711
1718
  });
1712
- return response.data;
1719
+ return toListResult(response);
1713
1720
  },
1714
1721
  params
1715
1722
  );
@@ -1725,7 +1732,7 @@ function createP21CoreActions(api, config = {}) {
1725
1732
  edgeCache: longEdgeCache
1726
1733
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
1727
1734
  });
1728
- return response.data;
1735
+ return toListResult(response);
1729
1736
  },
1730
1737
  params
1731
1738
  );
@@ -1758,7 +1765,7 @@ function createP21ApisActions(api, config = {}) {
1758
1765
  ...params,
1759
1766
  edgeCache
1760
1767
  });
1761
- return response.data;
1768
+ return toListResult(response);
1762
1769
  },
1763
1770
  params
1764
1771
  );
@@ -1788,7 +1795,7 @@ function createP21ApisActions(api, config = {}) {
1788
1795
  ...params,
1789
1796
  edgeCache
1790
1797
  });
1791
- return response.data;
1798
+ return toListResult(response);
1792
1799
  },
1793
1800
  params
1794
1801
  );
@@ -1803,7 +1810,7 @@ function createP21ApisActions(api, config = {}) {
1803
1810
  ...params,
1804
1811
  edgeCache
1805
1812
  });
1806
- return response.data;
1813
+ return toListResult(response);
1807
1814
  },
1808
1815
  params
1809
1816
  );
@@ -1818,7 +1825,7 @@ function createP21ApisActions(api, config = {}) {
1818
1825
  ...params,
1819
1826
  edgeCache
1820
1827
  });
1821
- return response.data;
1828
+ return toListResult(response);
1822
1829
  },
1823
1830
  params
1824
1831
  );
@@ -1889,7 +1896,7 @@ function createP21SismActions(api, config = {}) {
1889
1896
  ...params,
1890
1897
  edgeCache
1891
1898
  });
1892
- return response.data;
1899
+ return toListResult(response);
1893
1900
  },
1894
1901
  params
1895
1902
  );
@@ -1917,7 +1924,7 @@ function createP21SismActions(api, config = {}) {
1917
1924
  importUid: importId,
1918
1925
  edgeCache
1919
1926
  });
1920
- return response.data;
1927
+ return toListResult(response);
1921
1928
  },
1922
1929
  importId,
1923
1930
  params
@@ -1933,7 +1940,7 @@ function createP21SismActions(api, config = {}) {
1933
1940
  ...params,
1934
1941
  edgeCache
1935
1942
  });
1936
- return response.data;
1943
+ return toListResult(response);
1937
1944
  },
1938
1945
  params
1939
1946
  );
@@ -1990,7 +1997,7 @@ function createAgrInfoActions(api, config = {}) {
1990
1997
  ...params,
1991
1998
  edgeCache
1992
1999
  });
1993
- return Array.isArray(response.data) ? response.data : [response.data];
2000
+ return toListResult(response);
1994
2001
  },
1995
2002
  params
1996
2003
  );
@@ -2005,7 +2012,7 @@ function createAgrInfoActions(api, config = {}) {
2005
2012
  ...params,
2006
2013
  edgeCache
2007
2014
  });
2008
- return response.data;
2015
+ return toListResult(response);
2009
2016
  },
2010
2017
  params
2011
2018
  );
@@ -2020,7 +2027,7 @@ function createAgrInfoActions(api, config = {}) {
2020
2027
  ...params,
2021
2028
  edgeCache: longEdgeCache
2022
2029
  });
2023
- return response.data;
2030
+ return toListResult(response);
2024
2031
  },
2025
2032
  params
2026
2033
  );
@@ -2070,7 +2077,7 @@ function createBasecamp2Actions(api, config = {}) {
2070
2077
  edgeCache
2071
2078
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
2072
2079
  });
2073
- return response.data;
2080
+ return toListResult(response);
2074
2081
  },
2075
2082
  params
2076
2083
  );
@@ -2098,7 +2105,7 @@ function createBasecamp2Actions(api, config = {}) {
2098
2105
  edgeCache
2099
2106
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
2100
2107
  });
2101
- return response.data;
2108
+ return toListResult(response);
2102
2109
  },
2103
2110
  params
2104
2111
  );
@@ -2114,7 +2121,7 @@ function createBasecamp2Actions(api, config = {}) {
2114
2121
  edgeCache
2115
2122
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
2116
2123
  });
2117
- return response.data;
2124
+ return toListResult(response);
2118
2125
  },
2119
2126
  params
2120
2127
  );
@@ -2130,7 +2137,7 @@ function createBasecamp2Actions(api, config = {}) {
2130
2137
  edgeCache: longEdgeCache
2131
2138
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
2132
2139
  });
2133
- return response.data;
2140
+ return toListResult(response);
2134
2141
  },
2135
2142
  params
2136
2143
  );
@@ -2146,7 +2153,7 @@ function createBasecamp2Actions(api, config = {}) {
2146
2153
  edgeCache
2147
2154
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
2148
2155
  });
2149
- return response.data;
2156
+ return toListResult(response);
2150
2157
  },
2151
2158
  params
2152
2159
  );
@@ -2162,7 +2169,7 @@ function createBasecamp2Actions(api, config = {}) {
2162
2169
  edgeCache
2163
2170
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
2164
2171
  });
2165
- return response.data;
2172
+ return toListResult(response);
2166
2173
  },
2167
2174
  params
2168
2175
  );
@@ -2178,7 +2185,7 @@ function createBasecamp2Actions(api, config = {}) {
2178
2185
  edgeCache
2179
2186
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
2180
2187
  });
2181
- return response.data;
2188
+ return toListResult(response);
2182
2189
  },
2183
2190
  params
2184
2191
  );
@@ -2194,7 +2201,7 @@ function createBasecamp2Actions(api, config = {}) {
2194
2201
  edgeCache
2195
2202
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
2196
2203
  });
2197
- return response.data;
2204
+ return toListResult(response);
2198
2205
  },
2199
2206
  params
2200
2207
  );
@@ -2225,7 +2232,7 @@ function createBrandFolderActions(api, config = {}) {
2225
2232
  ...params,
2226
2233
  edgeCache
2227
2234
  });
2228
- return response.data;
2235
+ return toListResult(response);
2229
2236
  },
2230
2237
  params
2231
2238
  );
@@ -2280,7 +2287,7 @@ function createGregorovichActions(api, config = {}) {
2280
2287
  "gregorovich.documents.list",
2281
2288
  async () => {
2282
2289
  const response = await api.gregorovich.documents.list();
2283
- return response.data;
2290
+ return toListResult(response);
2284
2291
  },
2285
2292
  params
2286
2293
  );
@@ -2330,7 +2337,7 @@ function createSlackActions(api, config = {}) {
2330
2337
  ...params,
2331
2338
  edgeCache
2332
2339
  });
2333
- return response.data;
2340
+ return toListResult(response);
2334
2341
  },
2335
2342
  params
2336
2343
  );
@@ -2351,8 +2358,9 @@ function createSiteActions(api, config = {}) {
2351
2358
  redisTtl,
2352
2359
  longEdgeCache,
2353
2360
  longRedisTtl,
2354
- defaultContactId,
2355
- defaultCustomerId,
2361
+ defaultContactId = process.env.DEFAULT_CONTACT_ID,
2362
+ defaultCustomerId = process.env.DEFAULT_CUSTOMER_ID,
2363
+ defaultCompanyId: _defaultCompanyId = process.env.DEFAULT_COMPANY_ID,
2356
2364
  convertUnitOfMeasure
2357
2365
  } = config;
2358
2366
  const cache = { cachePrefix, edgeCache, redisTtl };
@@ -2644,4 +2652,4 @@ export {
2644
2652
  createSlackActions,
2645
2653
  createSiteActions
2646
2654
  };
2647
- //# sourceMappingURL=chunk-M4BTYIE4.js.map
2655
+ //# sourceMappingURL=chunk-PN526XCA.js.map