@simpleapps-com/augur-server 0.2.6 → 0.2.7

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.
package/dist/index.js CHANGED
@@ -573,6 +573,9 @@ function createOrderActions(api, config = {}) {
573
573
  }
574
574
 
575
575
  // src/actions/search.ts
576
+ function getOpenSearch(api) {
577
+ return "openSearch" in api ? api.openSearch : api.opensearch;
578
+ }
576
579
  function createSearchActions(api, config = {}) {
577
580
  const {
578
581
  cachePrefix = "",
@@ -580,6 +583,7 @@ function createSearchActions(api, config = {}) {
580
583
  redisTtl = 3600,
581
584
  defaultSourceFields = "display_desc"
582
585
  } = config;
586
+ const openSearch = getOpenSearch(api);
583
587
  async function getSearchAttributes(q) {
584
588
  const params = { q, edgeCache };
585
589
  return withServerCache(
@@ -587,7 +591,7 @@ function createSearchActions(api, config = {}) {
587
591
  redisTtl,
588
592
  "openSearch.itemSearch.attributes.list",
589
593
  async () => {
590
- const response = await api.openSearch.itemSearch.attributes.list(params);
594
+ const response = await openSearch.itemSearch.attributes.list(params);
591
595
  return response.data.attributes;
592
596
  },
593
597
  q
@@ -602,7 +606,7 @@ function createSearchActions(api, config = {}) {
602
606
  redisTtl,
603
607
  "openSearch.suggestions.suggest.list",
604
608
  async () => {
605
- const response = await api.openSearch.suggestions.suggest.list(params);
609
+ const response = await openSearch.suggestions.suggest.list(params);
606
610
  return response.data;
607
611
  },
608
612
  q
@@ -625,7 +629,7 @@ function createSearchActions(api, config = {}) {
625
629
  redisTtl,
626
630
  "openSearch.itemSearch.list",
627
631
  async () => {
628
- const response = await api.openSearch.itemSearch.list(params);
632
+ const response = await openSearch.itemSearch.list(params);
629
633
  return response.data;
630
634
  },
631
635
  filters,
@@ -649,7 +653,7 @@ function createSearchActions(api, config = {}) {
649
653
  redisTtl,
650
654
  "openSearch.itemSearch.list",
651
655
  async () => {
652
- const response = await api.openSearch.itemSearch.list(params);
656
+ const response = await openSearch.itemSearch.list(params);
653
657
  const { items, totalResults } = response.data;
654
658
  const nextOffset = pageParam + filters.limit;
655
659
  return {
@@ -736,19 +740,1331 @@ function createJoomlaActions(api, config = {}) {
736
740
  }
737
741
  return { getJoomlaContent, getJoomlaContentList };
738
742
  }
743
+
744
+ // src/actions/legacy.ts
745
+ function createLegacyActions(api, config = {}) {
746
+ const {
747
+ cachePrefix = "",
748
+ edgeCache = 1,
749
+ longEdgeCache = 8,
750
+ redisTtl = 3600,
751
+ longRedisTtl = 28800
752
+ } = config;
753
+ async function getItemWebDesc(invMastUid) {
754
+ return withServerCache(
755
+ cachePrefix,
756
+ redisTtl,
757
+ "legacy.invMast.webDesc.list",
758
+ async () => {
759
+ const response = await api.legacy.invMast.webDesc.list(invMastUid, {
760
+ edgeCache
761
+ });
762
+ return response.data[0];
763
+ },
764
+ invMastUid
765
+ );
766
+ }
767
+ async function getAlsoBoughtItems(invMastUid) {
768
+ return withServerCache(
769
+ cachePrefix,
770
+ redisTtl,
771
+ "legacy.invMast.alsoBought.list",
772
+ async () => {
773
+ const response = await api.legacy.invMast.alsoBought.list(
774
+ invMastUid,
775
+ { edgeCache }
776
+ );
777
+ return response.data;
778
+ },
779
+ invMastUid
780
+ );
781
+ }
782
+ async function getItemTags(invMastUid) {
783
+ return withServerCache(
784
+ cachePrefix,
785
+ redisTtl,
786
+ "legacy.invMast.tags.list",
787
+ async () => {
788
+ const response = await api.legacy.invMast.tags.list(invMastUid, {
789
+ edgeCache
790
+ });
791
+ return response.data;
792
+ },
793
+ invMastUid
794
+ );
795
+ }
796
+ async function getStates(params) {
797
+ return withServerCache(
798
+ cachePrefix,
799
+ longRedisTtl,
800
+ "legacy.legacy.state.list",
801
+ async () => {
802
+ const response = await api.legacy.legacy.state.list({
803
+ ...params,
804
+ edgeCache: longEdgeCache
805
+ });
806
+ return response.data;
807
+ },
808
+ params?.twoLetterCode
809
+ );
810
+ }
811
+ return {
812
+ getItemWebDesc,
813
+ getAlsoBoughtItems,
814
+ getItemTags,
815
+ getStates
816
+ };
817
+ }
818
+
819
+ // src/actions/customers.ts
820
+ function createCustomersActions(api, config = {}) {
821
+ const { cachePrefix = "", edgeCache = 1, redisTtl = 3600 } = config;
822
+ async function getCustomer(customerId) {
823
+ return withServerCache(
824
+ cachePrefix,
825
+ redisTtl,
826
+ "customers.customer.get",
827
+ async () => {
828
+ const response = await api.customers.customer.get(customerId, {
829
+ edgeCache
830
+ });
831
+ return response.data;
832
+ },
833
+ customerId
834
+ );
835
+ }
836
+ async function customerLookup(params) {
837
+ return withServerCache(
838
+ cachePrefix,
839
+ redisTtl,
840
+ "customers.customer.lookup.get",
841
+ async () => {
842
+ const response = await api.customers.customer.lookup.get({
843
+ ...params,
844
+ edgeCache
845
+ });
846
+ return response.data;
847
+ },
848
+ params
849
+ );
850
+ }
851
+ async function getCustomerDoc(customerId) {
852
+ return withServerCache(
853
+ cachePrefix,
854
+ redisTtl,
855
+ "customers.customer.doc.list",
856
+ async () => {
857
+ const response = await api.customers.customer.doc.list(customerId, {
858
+ edgeCache
859
+ });
860
+ return response.data;
861
+ },
862
+ customerId
863
+ );
864
+ }
865
+ async function getCustomerOrders(customerId, params) {
866
+ return withServerCache(
867
+ cachePrefix,
868
+ redisTtl,
869
+ "customers.customer.orders.list",
870
+ async () => {
871
+ const response = await api.customers.customer.orders.list(customerId, {
872
+ ...params,
873
+ edgeCache
874
+ });
875
+ return response.data;
876
+ },
877
+ customerId,
878
+ params
879
+ );
880
+ }
881
+ async function getContacts(params) {
882
+ return withServerCache(
883
+ cachePrefix,
884
+ redisTtl,
885
+ "customers.contacts.list",
886
+ async () => {
887
+ const response = await api.customers.contacts.list({
888
+ ...params,
889
+ edgeCache
890
+ });
891
+ return response.data;
892
+ },
893
+ params
894
+ );
895
+ }
896
+ async function getShipToAddresses(customerId) {
897
+ return withServerCache(
898
+ cachePrefix,
899
+ redisTtl,
900
+ "customers.customer.shipTo.list",
901
+ async () => {
902
+ const response = await api.customers.customer.shipTo.list(customerId, {
903
+ edgeCache
904
+ });
905
+ return response.data;
906
+ },
907
+ customerId
908
+ );
909
+ }
910
+ return {
911
+ getCustomer,
912
+ customerLookup,
913
+ getCustomerDoc,
914
+ getCustomerOrders,
915
+ getContacts,
916
+ getShipToAddresses
917
+ };
918
+ }
919
+
920
+ // src/actions/smarty-streets.ts
921
+ function createSmartyStreetsActions(api, config = {}) {
922
+ const { cachePrefix: _cachePrefix = "" } = config;
923
+ async function validateAddress(params) {
924
+ const response = await api.smartyStreets.us.lookup.get(params);
925
+ return response.data;
926
+ }
927
+ return {
928
+ validateAddress
929
+ };
930
+ }
931
+
932
+ // src/actions/p21-pim.ts
933
+ function createP21PimActions(api, config = {}) {
934
+ const { cachePrefix = "", edgeCache = 1, redisTtl = 3600 } = config;
935
+ async function getInvMastExt(invMastUid) {
936
+ return withServerCache(
937
+ cachePrefix,
938
+ redisTtl,
939
+ "p21Pim.invMastExt.get",
940
+ async () => {
941
+ const response = await api.p21Pim.invMastExt.get(invMastUid, {
942
+ edgeCache
943
+ });
944
+ return response.data;
945
+ },
946
+ invMastUid
947
+ );
948
+ }
949
+ async function listInvMastExt(params) {
950
+ return withServerCache(
951
+ cachePrefix,
952
+ redisTtl,
953
+ "p21Pim.invMastExt.list",
954
+ async () => {
955
+ const response = await api.p21Pim.invMastExt.list({
956
+ ...params,
957
+ edgeCache
958
+ });
959
+ return response.data;
960
+ },
961
+ params
962
+ );
963
+ }
964
+ return {
965
+ getInvMastExt,
966
+ listInvMastExt
967
+ };
968
+ }
969
+
970
+ // src/actions/agr-site.ts
971
+ function createAgrSiteActions(api, config = {}) {
972
+ const {
973
+ cachePrefix = "",
974
+ longEdgeCache = 8,
975
+ longRedisTtl = 28800
976
+ } = config;
977
+ async function getSettings(serviceName) {
978
+ return withServerCache(
979
+ cachePrefix,
980
+ longRedisTtl,
981
+ "agrSite.settings.list",
982
+ async () => {
983
+ const response = await api.agrSite.settings.list({
984
+ ...serviceName ? { serviceName } : {},
985
+ edgeCache: longEdgeCache
986
+ });
987
+ return response.data;
988
+ },
989
+ serviceName
990
+ );
991
+ }
992
+ async function getMetaFiles(params) {
993
+ return withServerCache(
994
+ cachePrefix,
995
+ longRedisTtl,
996
+ "agrSite.metaFiles.list",
997
+ async () => {
998
+ const response = await api.agrSite.metaFiles.list({
999
+ ...params,
1000
+ edgeCache: longEdgeCache
1001
+ });
1002
+ return response.data;
1003
+ },
1004
+ params
1005
+ );
1006
+ }
1007
+ return {
1008
+ getSettings,
1009
+ getMetaFiles
1010
+ };
1011
+ }
1012
+
1013
+ // src/actions/avalara.ts
1014
+ function createAvalaraActions(api, config = {}) {
1015
+ const { cachePrefix: _cachePrefix = "" } = config;
1016
+ async function calculateTax(data) {
1017
+ const response = await api.avalara.rates.create(data);
1018
+ return response.data;
1019
+ }
1020
+ return {
1021
+ calculateTax
1022
+ };
1023
+ }
1024
+
1025
+ // src/actions/payments.ts
1026
+ function createPaymentsActions(api, config = {}) {
1027
+ const { cachePrefix: _cachePrefix = "" } = config;
1028
+ async function transactionSetup(params) {
1029
+ try {
1030
+ const response = await api.payments.unified.transactionSetup.get(params);
1031
+ return response.data;
1032
+ } catch {
1033
+ return void 0;
1034
+ }
1035
+ }
1036
+ async function accountQuery(params) {
1037
+ try {
1038
+ const response = await api.payments.unified.accountQuery.get(params);
1039
+ return response.data;
1040
+ } catch {
1041
+ return void 0;
1042
+ }
1043
+ }
1044
+ async function getSurcharge(params) {
1045
+ try {
1046
+ const response = await api.payments.unified.surcharge.get(params);
1047
+ return response.data;
1048
+ } catch {
1049
+ return void 0;
1050
+ }
1051
+ }
1052
+ return {
1053
+ transactionSetup,
1054
+ accountQuery,
1055
+ getSurcharge
1056
+ };
1057
+ }
1058
+
1059
+ // src/actions/ups.ts
1060
+ function createUpsActions(api, config = {}) {
1061
+ const { cachePrefix: _cachePrefix = "" } = config;
1062
+ async function getRates(params) {
1063
+ try {
1064
+ const response = await api.ups.ratesShop.get(params);
1065
+ return response.data;
1066
+ } catch {
1067
+ return void 0;
1068
+ }
1069
+ }
1070
+ return {
1071
+ getRates
1072
+ };
1073
+ }
1074
+
1075
+ // src/actions/logistics.ts
1076
+ function createLogisticsActions(api, config = {}) {
1077
+ const {
1078
+ cachePrefix = "",
1079
+ longEdgeCache = 8,
1080
+ longRedisTtl = 28800
1081
+ } = config;
1082
+ async function getFreightRates(params) {
1083
+ try {
1084
+ const response = await api.logistics.speedship.freight.get(params);
1085
+ return response.data;
1086
+ } catch {
1087
+ return void 0;
1088
+ }
1089
+ }
1090
+ async function getShipVia(params) {
1091
+ return withServerCache(
1092
+ cachePrefix,
1093
+ longRedisTtl,
1094
+ "logistics.shipvia.rates.list",
1095
+ async () => {
1096
+ const response = await api.logistics.shipvia.rates.list({
1097
+ ...params,
1098
+ edgeCache: longEdgeCache
1099
+ });
1100
+ return response.data;
1101
+ },
1102
+ params ? JSON.stringify(params) : void 0
1103
+ );
1104
+ }
1105
+ return {
1106
+ getFreightRates,
1107
+ getShipVia
1108
+ };
1109
+ }
1110
+
1111
+ // src/actions/nexus.ts
1112
+ function createNexusActions(api, config = {}) {
1113
+ const {
1114
+ cachePrefix = "",
1115
+ edgeCache = 1,
1116
+ redisTtl = 3600
1117
+ } = config;
1118
+ async function createBinTransfer(data) {
1119
+ try {
1120
+ const response = await api.nexus.binTransfer.create(data);
1121
+ return response.data;
1122
+ } catch {
1123
+ return void 0;
1124
+ }
1125
+ }
1126
+ async function createReceiving(data) {
1127
+ try {
1128
+ const response = await api.nexus.receiving.create(data);
1129
+ return response.data;
1130
+ } catch {
1131
+ return void 0;
1132
+ }
1133
+ }
1134
+ async function createTransfer(data) {
1135
+ try {
1136
+ const response = await api.nexus.transfer.create(data);
1137
+ return response.data;
1138
+ } catch {
1139
+ return void 0;
1140
+ }
1141
+ }
1142
+ async function getPurchaseOrderReceipts(params) {
1143
+ return withServerCache(
1144
+ cachePrefix,
1145
+ redisTtl,
1146
+ "nexus.purchaseOrderReceipt.list",
1147
+ async () => {
1148
+ const response = await api.nexus.purchaseOrderReceipt.list({
1149
+ ...params,
1150
+ edgeCache
1151
+ });
1152
+ return response.data;
1153
+ },
1154
+ params ? JSON.stringify(params) : void 0
1155
+ );
1156
+ }
1157
+ async function getTransferReceipts(params) {
1158
+ return withServerCache(
1159
+ cachePrefix,
1160
+ redisTtl,
1161
+ "nexus.transferReceipt.list",
1162
+ async () => {
1163
+ const response = await api.nexus.transferReceipt.list({
1164
+ ...params,
1165
+ edgeCache
1166
+ });
1167
+ return response.data;
1168
+ },
1169
+ params ? JSON.stringify(params) : void 0
1170
+ );
1171
+ }
1172
+ async function getTransferShipping(params) {
1173
+ return withServerCache(
1174
+ cachePrefix,
1175
+ redisTtl,
1176
+ "nexus.transferShipping.list",
1177
+ async () => {
1178
+ const response = await api.nexus.transferShipping.list({
1179
+ ...params,
1180
+ edgeCache
1181
+ });
1182
+ return response.data;
1183
+ },
1184
+ params ? JSON.stringify(params) : void 0
1185
+ );
1186
+ }
1187
+ return {
1188
+ createBinTransfer,
1189
+ createReceiving,
1190
+ createTransfer,
1191
+ getPurchaseOrderReceipts,
1192
+ getTransferReceipts,
1193
+ getTransferShipping
1194
+ };
1195
+ }
1196
+
1197
+ // src/actions/vmi.ts
1198
+ function createVmiActions(api, config = {}) {
1199
+ const {
1200
+ cachePrefix = "",
1201
+ edgeCache = 1,
1202
+ redisTtl = 3600,
1203
+ shortRedisTtl = 300
1204
+ } = config;
1205
+ async function getWarehouses(params) {
1206
+ return withServerCache(
1207
+ cachePrefix,
1208
+ redisTtl,
1209
+ "vmi.warehouse.list",
1210
+ async () => {
1211
+ const response = await api.vmi.warehouse.list({
1212
+ ...params,
1213
+ edgeCache
1214
+ });
1215
+ return response.data;
1216
+ },
1217
+ params ? JSON.stringify(params) : void 0
1218
+ );
1219
+ }
1220
+ async function getWarehouseAvailability(warehouseUid, params) {
1221
+ return withServerCache(
1222
+ cachePrefix,
1223
+ shortRedisTtl,
1224
+ "vmi.warehouse.availability.get",
1225
+ async () => {
1226
+ const response = await api.vmi.warehouse.availability.get(
1227
+ warehouseUid,
1228
+ { ...params, edgeCache }
1229
+ );
1230
+ return response.data;
1231
+ },
1232
+ warehouseUid,
1233
+ params ? JSON.stringify(params) : void 0
1234
+ );
1235
+ }
1236
+ async function getDistributors(params) {
1237
+ return withServerCache(
1238
+ cachePrefix,
1239
+ redisTtl,
1240
+ "vmi.distributors.list",
1241
+ async () => {
1242
+ const response = await api.vmi.distributors.list({
1243
+ ...params,
1244
+ edgeCache
1245
+ });
1246
+ return response.data;
1247
+ },
1248
+ params ? JSON.stringify(params) : void 0
1249
+ );
1250
+ }
1251
+ async function getProducts(params) {
1252
+ return withServerCache(
1253
+ cachePrefix,
1254
+ redisTtl,
1255
+ "vmi.products.list",
1256
+ async () => {
1257
+ const response = await api.vmi.products.list({
1258
+ ...params,
1259
+ edgeCache
1260
+ });
1261
+ return response.data;
1262
+ },
1263
+ params ? JSON.stringify(params) : void 0
1264
+ );
1265
+ }
1266
+ async function getInventoryProfiles(params) {
1267
+ return withServerCache(
1268
+ cachePrefix,
1269
+ redisTtl,
1270
+ "vmi.invProfileHdr.list",
1271
+ async () => {
1272
+ const response = await api.vmi.invProfileHdr.list({
1273
+ ...params,
1274
+ edgeCache
1275
+ });
1276
+ return response.data;
1277
+ },
1278
+ params ? JSON.stringify(params) : void 0
1279
+ );
1280
+ }
1281
+ async function getRestockHeaders(params) {
1282
+ return withServerCache(
1283
+ cachePrefix,
1284
+ redisTtl,
1285
+ "vmi.restockHdr.list",
1286
+ async () => {
1287
+ const response = await api.vmi.restockHdr.list({
1288
+ ...params,
1289
+ edgeCache
1290
+ });
1291
+ return response.data;
1292
+ },
1293
+ params ? JSON.stringify(params) : void 0
1294
+ );
1295
+ }
1296
+ async function getSections(params) {
1297
+ return withServerCache(
1298
+ cachePrefix,
1299
+ redisTtl,
1300
+ "vmi.sections.list",
1301
+ async () => {
1302
+ const response = await api.vmi.sections.list({
1303
+ ...params,
1304
+ edgeCache
1305
+ });
1306
+ return response.data;
1307
+ },
1308
+ params ? JSON.stringify(params) : void 0
1309
+ );
1310
+ }
1311
+ return {
1312
+ getWarehouses,
1313
+ getWarehouseAvailability,
1314
+ getDistributors,
1315
+ getProducts,
1316
+ getInventoryProfiles,
1317
+ getRestockHeaders,
1318
+ getSections
1319
+ };
1320
+ }
1321
+
1322
+ // src/actions/p21-core.ts
1323
+ function createP21CoreActions(api, config = {}) {
1324
+ const {
1325
+ cachePrefix = "",
1326
+ edgeCache = 1,
1327
+ longEdgeCache = 8,
1328
+ redisTtl = 3600,
1329
+ longRedisTtl = 28800
1330
+ } = config;
1331
+ async function getAddresses(params) {
1332
+ return withServerCache(
1333
+ cachePrefix,
1334
+ redisTtl,
1335
+ "p21Core.address.list",
1336
+ async () => {
1337
+ const response = await api.p21Core.address.list({
1338
+ ...params,
1339
+ edgeCache
1340
+ });
1341
+ return response.data;
1342
+ },
1343
+ params
1344
+ );
1345
+ }
1346
+ async function getCompanies(params) {
1347
+ return withServerCache(
1348
+ cachePrefix,
1349
+ longRedisTtl,
1350
+ "p21Core.company.list",
1351
+ async () => {
1352
+ const response = await api.p21Core.company.list({
1353
+ ...params,
1354
+ edgeCache: longEdgeCache
1355
+ });
1356
+ return response.data;
1357
+ },
1358
+ params
1359
+ );
1360
+ }
1361
+ async function getCompany(companyId) {
1362
+ return withServerCache(
1363
+ cachePrefix,
1364
+ longRedisTtl,
1365
+ "p21Core.company.get",
1366
+ async () => {
1367
+ const response = await api.p21Core.company.get({
1368
+ companyUid: companyId,
1369
+ edgeCache: longEdgeCache
1370
+ });
1371
+ return response.data;
1372
+ },
1373
+ companyId
1374
+ );
1375
+ }
1376
+ async function getLocations(params) {
1377
+ return withServerCache(
1378
+ cachePrefix,
1379
+ longRedisTtl,
1380
+ "p21Core.location.list",
1381
+ async () => {
1382
+ const response = await api.p21Core.location.list({
1383
+ ...params,
1384
+ edgeCache: longEdgeCache
1385
+ });
1386
+ return response.data;
1387
+ },
1388
+ params
1389
+ );
1390
+ }
1391
+ async function getPaymentTypes(params) {
1392
+ return withServerCache(
1393
+ cachePrefix,
1394
+ longRedisTtl,
1395
+ "p21Core.paymentTypes.list",
1396
+ async () => {
1397
+ const response = await api.p21Core.paymentTypes.list({
1398
+ ...params,
1399
+ edgeCache: longEdgeCache
1400
+ });
1401
+ return response.data;
1402
+ },
1403
+ params
1404
+ );
1405
+ }
1406
+ async function getCashDrawers(params) {
1407
+ return withServerCache(
1408
+ cachePrefix,
1409
+ redisTtl,
1410
+ "p21Core.cashDrawer.list",
1411
+ async () => {
1412
+ const response = await api.p21Core.cashDrawer.list({
1413
+ ...params,
1414
+ edgeCache
1415
+ });
1416
+ return response.data;
1417
+ },
1418
+ params
1419
+ );
1420
+ }
1421
+ async function getCodeP21(params) {
1422
+ return withServerCache(
1423
+ cachePrefix,
1424
+ longRedisTtl,
1425
+ "p21Core.codeP21.list",
1426
+ async () => {
1427
+ const response = await api.p21Core.codeP21.list({
1428
+ ...params,
1429
+ edgeCache: longEdgeCache
1430
+ });
1431
+ return response.data;
1432
+ },
1433
+ params
1434
+ );
1435
+ }
1436
+ return {
1437
+ getAddresses,
1438
+ getCompanies,
1439
+ getCompany,
1440
+ getLocations,
1441
+ getPaymentTypes,
1442
+ getCashDrawers,
1443
+ getCodeP21
1444
+ };
1445
+ }
1446
+
1447
+ // src/actions/p21-apis.ts
1448
+ function createP21ApisActions(api, config = {}) {
1449
+ const {
1450
+ cachePrefix = "",
1451
+ edgeCache = 1,
1452
+ redisTtl = 3600
1453
+ } = config;
1454
+ async function getCategories(params) {
1455
+ return withServerCache(
1456
+ cachePrefix,
1457
+ redisTtl,
1458
+ "p21Apis.transCategory.list",
1459
+ async () => {
1460
+ const response = await api.p21Apis.transCategory.list({
1461
+ ...params,
1462
+ edgeCache
1463
+ });
1464
+ return response.data;
1465
+ },
1466
+ params
1467
+ );
1468
+ }
1469
+ async function getCategoryDefaults(categoryId) {
1470
+ return withServerCache(
1471
+ cachePrefix,
1472
+ redisTtl,
1473
+ "p21Apis.transCategory.defaults.get",
1474
+ async () => {
1475
+ const response = await api.p21Apis.transCategory.defaults.get(
1476
+ categoryId,
1477
+ { edgeCache }
1478
+ );
1479
+ return response.data;
1480
+ },
1481
+ categoryId
1482
+ );
1483
+ }
1484
+ async function getCompanies(params) {
1485
+ return withServerCache(
1486
+ cachePrefix,
1487
+ redisTtl,
1488
+ "p21Apis.transCompany.list",
1489
+ async () => {
1490
+ const response = await api.p21Apis.transCompany.list({
1491
+ ...params,
1492
+ edgeCache
1493
+ });
1494
+ return response.data;
1495
+ },
1496
+ params
1497
+ );
1498
+ }
1499
+ async function getUsers(params) {
1500
+ return withServerCache(
1501
+ cachePrefix,
1502
+ redisTtl,
1503
+ "p21Apis.transUser.list",
1504
+ async () => {
1505
+ const response = await api.p21Apis.transUser.list({
1506
+ ...params,
1507
+ edgeCache
1508
+ });
1509
+ return response.data;
1510
+ },
1511
+ params
1512
+ );
1513
+ }
1514
+ async function getWebDisplayTypes(params) {
1515
+ return withServerCache(
1516
+ cachePrefix,
1517
+ redisTtl,
1518
+ "p21Apis.transWebDisplayType.list",
1519
+ async () => {
1520
+ const response = await api.p21Apis.transWebDisplayType.list({
1521
+ ...params,
1522
+ edgeCache
1523
+ });
1524
+ return response.data;
1525
+ },
1526
+ params
1527
+ );
1528
+ }
1529
+ async function getWebDisplayTypeDefaults(id) {
1530
+ return withServerCache(
1531
+ cachePrefix,
1532
+ redisTtl,
1533
+ "p21Apis.transWebDisplayType.defaults.get",
1534
+ async () => {
1535
+ const response = await api.p21Apis.transWebDisplayType.defaults.get({
1536
+ id,
1537
+ edgeCache
1538
+ });
1539
+ return response.data;
1540
+ },
1541
+ id
1542
+ );
1543
+ }
1544
+ async function refreshContacts(params) {
1545
+ try {
1546
+ const response = await api.p21Apis.entityContacts.refresh.create(params);
1547
+ return response.data;
1548
+ } catch {
1549
+ return void 0;
1550
+ }
1551
+ }
1552
+ async function refreshCustomers(params) {
1553
+ try {
1554
+ const response = await api.p21Apis.entityCustomers.refresh.create(params);
1555
+ return response.data;
1556
+ } catch {
1557
+ return void 0;
1558
+ }
1559
+ }
1560
+ return {
1561
+ getCategories,
1562
+ getCategoryDefaults,
1563
+ getCompanies,
1564
+ getUsers,
1565
+ getWebDisplayTypes,
1566
+ getWebDisplayTypeDefaults,
1567
+ refreshContacts,
1568
+ refreshCustomers
1569
+ };
1570
+ }
1571
+
1572
+ // src/actions/p21-sism.ts
1573
+ function createP21SismActions(api, config = {}) {
1574
+ const {
1575
+ cachePrefix = "",
1576
+ edgeCache = 1,
1577
+ redisTtl = 3600
1578
+ } = config;
1579
+ async function getRecentImports(params) {
1580
+ return withServerCache(
1581
+ cachePrefix,
1582
+ redisTtl,
1583
+ "p21Sism.import.recent.list",
1584
+ async () => {
1585
+ const response = await api.p21Sism.import.recent.list({
1586
+ ...params,
1587
+ edgeCache
1588
+ });
1589
+ return response.data;
1590
+ },
1591
+ params
1592
+ );
1593
+ }
1594
+ async function getImport(importId) {
1595
+ return withServerCache(
1596
+ cachePrefix,
1597
+ redisTtl,
1598
+ "p21Sism.import.get",
1599
+ async () => {
1600
+ const response = await api.p21Sism.import.get(importId);
1601
+ return response.data;
1602
+ },
1603
+ importId
1604
+ );
1605
+ }
1606
+ async function getImportLines(importId, params) {
1607
+ return withServerCache(
1608
+ cachePrefix,
1609
+ redisTtl,
1610
+ "p21Sism.impOeLine.list",
1611
+ async () => {
1612
+ const response = await api.p21Sism.impOeLine.list({
1613
+ ...params,
1614
+ importUid: importId,
1615
+ edgeCache
1616
+ });
1617
+ return response.data;
1618
+ },
1619
+ importId,
1620
+ params
1621
+ );
1622
+ }
1623
+ async function getScheduledImports(params) {
1624
+ return withServerCache(
1625
+ cachePrefix,
1626
+ redisTtl,
1627
+ "p21Sism.scheduledImportMaster.list",
1628
+ async () => {
1629
+ const response = await api.p21Sism.scheduledImportMaster.list({
1630
+ ...params,
1631
+ edgeCache
1632
+ });
1633
+ return response.data;
1634
+ },
1635
+ params
1636
+ );
1637
+ }
1638
+ return {
1639
+ getRecentImports,
1640
+ getImport,
1641
+ getImportLines,
1642
+ getScheduledImports
1643
+ };
1644
+ }
1645
+
1646
+ // src/actions/agr-work.ts
1647
+ function createAgrWorkActions(api, _config = {}) {
1648
+ async function healthCheck() {
1649
+ try {
1650
+ const response = await api.agrWork.healthCheck.get();
1651
+ return response.data;
1652
+ } catch {
1653
+ return void 0;
1654
+ }
1655
+ }
1656
+ async function ping() {
1657
+ try {
1658
+ const response = await api.agrWork.ping.get();
1659
+ return response.data;
1660
+ } catch {
1661
+ return void 0;
1662
+ }
1663
+ }
1664
+ return {
1665
+ healthCheck,
1666
+ ping
1667
+ };
1668
+ }
1669
+
1670
+ // src/actions/agr-info.ts
1671
+ function createAgrInfoActions(api, config = {}) {
1672
+ const {
1673
+ cachePrefix = "",
1674
+ edgeCache = 1,
1675
+ longEdgeCache = 8,
1676
+ redisTtl = 3600,
1677
+ longRedisTtl = 28800
1678
+ } = config;
1679
+ async function getContext(params) {
1680
+ return withServerCache(
1681
+ cachePrefix,
1682
+ redisTtl,
1683
+ "agrInfo.context.list",
1684
+ async () => {
1685
+ const siteId = params?.siteId ?? "";
1686
+ const response = await api.agrInfo.context.get(siteId, {
1687
+ ...params,
1688
+ edgeCache
1689
+ });
1690
+ return Array.isArray(response.data) ? response.data : [response.data];
1691
+ },
1692
+ params
1693
+ );
1694
+ }
1695
+ async function getRubrics(params) {
1696
+ return withServerCache(
1697
+ cachePrefix,
1698
+ redisTtl,
1699
+ "agrInfo.rubrics.list",
1700
+ async () => {
1701
+ const response = await api.agrInfo.rubrics.list({
1702
+ ...params,
1703
+ edgeCache
1704
+ });
1705
+ return response.data;
1706
+ },
1707
+ params
1708
+ );
1709
+ }
1710
+ async function getMicroservices(params) {
1711
+ return withServerCache(
1712
+ cachePrefix,
1713
+ longRedisTtl,
1714
+ "agrInfo.microservices.list",
1715
+ async () => {
1716
+ const response = await api.agrInfo.microservices.list({
1717
+ ...params,
1718
+ edgeCache: longEdgeCache
1719
+ });
1720
+ return response.data;
1721
+ },
1722
+ params
1723
+ );
1724
+ }
1725
+ async function generateAkasha(data) {
1726
+ try {
1727
+ const response = await api.agrInfo.akasha.generate.create(data);
1728
+ return response.data;
1729
+ } catch {
1730
+ return void 0;
1731
+ }
1732
+ }
1733
+ async function generateJoomla(data) {
1734
+ try {
1735
+ const response = await api.agrInfo.joomla.generate.create(data);
1736
+ return response.data;
1737
+ } catch {
1738
+ return void 0;
1739
+ }
1740
+ }
1741
+ return {
1742
+ getContext,
1743
+ getRubrics,
1744
+ getMicroservices,
1745
+ generateAkasha,
1746
+ generateJoomla
1747
+ };
1748
+ }
1749
+
1750
+ // src/actions/basecamp2.ts
1751
+ function createBasecamp2Actions(api, config = {}) {
1752
+ const {
1753
+ cachePrefix = "",
1754
+ edgeCache = 1,
1755
+ longEdgeCache = 8,
1756
+ redisTtl = 3600,
1757
+ longRedisTtl = 28800
1758
+ } = config;
1759
+ async function getTodos(params) {
1760
+ return withServerCache(
1761
+ cachePrefix,
1762
+ redisTtl,
1763
+ "basecamp2.todos.list",
1764
+ async () => {
1765
+ const response = await api.basecamp2.todos.list({
1766
+ ...params,
1767
+ edgeCache
1768
+ });
1769
+ return response.data;
1770
+ },
1771
+ params
1772
+ );
1773
+ }
1774
+ async function getTodo(todoId) {
1775
+ return withServerCache(
1776
+ cachePrefix,
1777
+ redisTtl,
1778
+ "basecamp2.todos.get",
1779
+ async () => {
1780
+ const response = await api.basecamp2.todos.get(todoId, { edgeCache });
1781
+ return response.data;
1782
+ },
1783
+ todoId
1784
+ );
1785
+ }
1786
+ async function getTodosSummary(params) {
1787
+ return withServerCache(
1788
+ cachePrefix,
1789
+ redisTtl,
1790
+ "basecamp2.todosSummary.list",
1791
+ async () => {
1792
+ const response = await api.basecamp2.todosSummary.list({
1793
+ ...params,
1794
+ edgeCache
1795
+ });
1796
+ return response.data;
1797
+ },
1798
+ params
1799
+ );
1800
+ }
1801
+ async function getComments(params) {
1802
+ return withServerCache(
1803
+ cachePrefix,
1804
+ redisTtl,
1805
+ "basecamp2.comments.list",
1806
+ async () => {
1807
+ const response = await api.basecamp2.comments.list({
1808
+ ...params,
1809
+ edgeCache
1810
+ });
1811
+ return response.data;
1812
+ },
1813
+ params
1814
+ );
1815
+ }
1816
+ async function getPeople(params) {
1817
+ return withServerCache(
1818
+ cachePrefix,
1819
+ longRedisTtl,
1820
+ "basecamp2.people.list",
1821
+ async () => {
1822
+ const response = await api.basecamp2.people.list({
1823
+ ...params,
1824
+ edgeCache: longEdgeCache
1825
+ });
1826
+ return response.data;
1827
+ },
1828
+ params
1829
+ );
1830
+ }
1831
+ async function getProjects(params) {
1832
+ return withServerCache(
1833
+ cachePrefix,
1834
+ redisTtl,
1835
+ "basecamp2.projects.list",
1836
+ async () => {
1837
+ const response = await api.basecamp2.projects.list({
1838
+ ...params,
1839
+ edgeCache
1840
+ });
1841
+ return response.data;
1842
+ },
1843
+ params
1844
+ );
1845
+ }
1846
+ async function getEvents(params) {
1847
+ return withServerCache(
1848
+ cachePrefix,
1849
+ redisTtl,
1850
+ "basecamp2.events.list",
1851
+ async () => {
1852
+ const response = await api.basecamp2.events.list({
1853
+ ...params,
1854
+ edgeCache
1855
+ });
1856
+ return response.data;
1857
+ },
1858
+ params
1859
+ );
1860
+ }
1861
+ async function getMetrics(params) {
1862
+ return withServerCache(
1863
+ cachePrefix,
1864
+ redisTtl,
1865
+ "basecamp2.metrics.list",
1866
+ async () => {
1867
+ const response = await api.basecamp2.metrics.list({
1868
+ ...params,
1869
+ edgeCache
1870
+ });
1871
+ return response.data;
1872
+ },
1873
+ params
1874
+ );
1875
+ }
1876
+ async function getTodolists(params) {
1877
+ return withServerCache(
1878
+ cachePrefix,
1879
+ redisTtl,
1880
+ "basecamp2.todolists.list",
1881
+ async () => {
1882
+ const response = await api.basecamp2.todolists.list({
1883
+ ...params,
1884
+ edgeCache
1885
+ });
1886
+ return response.data;
1887
+ },
1888
+ params
1889
+ );
1890
+ }
1891
+ return {
1892
+ getTodos,
1893
+ getTodo,
1894
+ getTodosSummary,
1895
+ getComments,
1896
+ getPeople,
1897
+ getProjects,
1898
+ getEvents,
1899
+ getMetrics,
1900
+ getTodolists
1901
+ };
1902
+ }
1903
+
1904
+ // src/actions/brand-folder.ts
1905
+ function createBrandFolderActions(api, config = {}) {
1906
+ const { cachePrefix = "", edgeCache = 1, redisTtl = 3600 } = config;
1907
+ async function getCategories(params) {
1908
+ return withServerCache(
1909
+ cachePrefix,
1910
+ redisTtl,
1911
+ "brandFolder.categories.list",
1912
+ async () => {
1913
+ const response = await api.brandFolder.categories.list({
1914
+ ...params,
1915
+ edgeCache
1916
+ });
1917
+ return response.data;
1918
+ },
1919
+ params
1920
+ );
1921
+ }
1922
+ async function getCategory(categoryId) {
1923
+ return withServerCache(
1924
+ cachePrefix,
1925
+ redisTtl,
1926
+ "brandFolder.categories.get",
1927
+ async () => {
1928
+ const response = await api.brandFolder.categories.get(categoryId, {
1929
+ edgeCache
1930
+ });
1931
+ return response.data;
1932
+ },
1933
+ categoryId
1934
+ );
1935
+ }
1936
+ async function createFocus(categoryId, data) {
1937
+ try {
1938
+ const response = await api.brandFolder.categories.focus.create({
1939
+ ...data,
1940
+ categoryId
1941
+ });
1942
+ return response.data;
1943
+ } catch {
1944
+ return void 0;
1945
+ }
1946
+ }
1947
+ return {
1948
+ getCategories,
1949
+ getCategory,
1950
+ createFocus
1951
+ };
1952
+ }
1953
+
1954
+ // src/actions/gregorovich.ts
1955
+ function createGregorovichActions(api, config = {}) {
1956
+ const { cachePrefix = "", edgeCache = 1, redisTtl = 3600 } = config;
1957
+ async function askChatGpt(params) {
1958
+ try {
1959
+ const response = await api.gregorovich.chatGpt.ask.get(params);
1960
+ return response.data;
1961
+ } catch {
1962
+ return void 0;
1963
+ }
1964
+ }
1965
+ async function getDocuments(params) {
1966
+ return withServerCache(
1967
+ cachePrefix,
1968
+ redisTtl,
1969
+ "gregorovich.documents.list",
1970
+ async () => {
1971
+ const response = await api.gregorovich.documents.list({
1972
+ ...params,
1973
+ edgeCache
1974
+ });
1975
+ return response.data;
1976
+ },
1977
+ params
1978
+ );
1979
+ }
1980
+ async function createDocument(data) {
1981
+ try {
1982
+ const response = await api.gregorovich.documents.create(data);
1983
+ return response.data;
1984
+ } catch {
1985
+ return void 0;
1986
+ }
1987
+ }
1988
+ async function generateOllama(data) {
1989
+ try {
1990
+ const response = await api.gregorovich.ollama.generate.create(data);
1991
+ return response.data;
1992
+ } catch {
1993
+ return void 0;
1994
+ }
1995
+ }
1996
+ return {
1997
+ askChatGpt,
1998
+ getDocuments,
1999
+ createDocument,
2000
+ generateOllama
2001
+ };
2002
+ }
2003
+
2004
+ // src/actions/slack.ts
2005
+ function createSlackActions(api, config = {}) {
2006
+ const { cachePrefix = "", edgeCache = 1, redisTtl = 3600 } = config;
2007
+ async function sendWebhook(data) {
2008
+ try {
2009
+ const response = await api.slack.webHook.create(data);
2010
+ return response.data;
2011
+ } catch {
2012
+ return void 0;
2013
+ }
2014
+ }
2015
+ async function getWebhooks(params) {
2016
+ return withServerCache(
2017
+ cachePrefix,
2018
+ redisTtl,
2019
+ "slack.webHook.list",
2020
+ async () => {
2021
+ const response = await api.slack.webHook.list({
2022
+ ...params,
2023
+ edgeCache
2024
+ });
2025
+ return response.data;
2026
+ },
2027
+ params
2028
+ );
2029
+ }
2030
+ return {
2031
+ sendWebhook,
2032
+ getWebhooks
2033
+ };
2034
+ }
739
2035
  export {
740
2036
  cacheGet,
741
2037
  cacheSet,
2038
+ createAgrInfoActions,
2039
+ createAgrSiteActions,
2040
+ createAgrWorkActions,
2041
+ createAvalaraActions,
2042
+ createBasecamp2Actions,
2043
+ createBrandFolderActions,
742
2044
  createCommerceActions,
2045
+ createCustomersActions,
2046
+ createGregorovichActions,
743
2047
  createItemActions,
744
2048
  createJoomlaActions,
2049
+ createLegacyActions,
2050
+ createLogisticsActions,
2051
+ createNexusActions,
745
2052
  createOrderActions,
2053
+ createP21ApisActions,
2054
+ createP21CoreActions,
2055
+ createP21PimActions,
2056
+ createP21SismActions,
2057
+ createPaymentsActions,
746
2058
  createPricingActions,
747
2059
  createQueryOptions,
748
2060
  createSearchActions,
749
2061
  createServerQueryClient,
750
2062
  createShippingActions,
2063
+ createSlackActions,
2064
+ createSmartyStreetsActions,
751
2065
  createSuspenseQueryOptions,
2066
+ createUpsActions,
2067
+ createVmiActions,
752
2068
  env,
753
2069
  getCircuitState,
754
2070
  getServerQueryClient,