@simpleapps-com/augur-server 2.0.3 → 2.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/dist/actions.d.ts +72 -71
  2. package/dist/actions.js +51 -159
  3. package/dist/actions.js.map +1 -1
  4. package/dist/auth.d.ts +1 -1
  5. package/dist/auth.js +1 -1
  6. package/dist/{chunk-XHI7OYKV.js → chunk-3YLC52GL.js} +174 -246
  7. package/dist/chunk-3YLC52GL.js.map +1 -0
  8. package/dist/{chunk-I7EWYSPA.js → chunk-DCBWABAP.js} +2 -4
  9. package/dist/{chunk-I7EWYSPA.js.map → chunk-DCBWABAP.js.map} +1 -1
  10. package/dist/{chunk-GYZT5Q2K.js → chunk-OHXPJ225.js} +12 -1
  11. package/dist/chunk-OHXPJ225.js.map +1 -0
  12. package/dist/{chunk-Z7QWERHW.js → chunk-R3XT54FD.js} +8 -10
  13. package/dist/chunk-R3XT54FD.js.map +1 -0
  14. package/dist/{chunk-I26RJDRF.js → chunk-TQP67TGL.js} +1 -1
  15. package/dist/chunk-TQP67TGL.js.map +1 -0
  16. package/dist/index.d.ts +6 -6
  17. package/dist/index.js +8 -11
  18. package/dist/index.js.map +1 -1
  19. package/dist/prefetch.d.ts +3 -4
  20. package/dist/prefetch.js +3 -13
  21. package/dist/prefetch.js.map +1 -1
  22. package/dist/query.js +1 -1
  23. package/dist/{server-site-registry-RvjtgbHN.d.ts → server-site-registry-BtBMmWYF.d.ts} +1 -1
  24. package/dist/{site-CjgTIpnT.d.ts → site-C1raVxkq.d.ts} +107 -59
  25. package/dist/site.d.ts +2 -2
  26. package/dist/site.js +3 -2
  27. package/dist/site.js.map +1 -1
  28. package/dist/{smarty-streets-xASjXqym.d.ts → smarty-streets-DshoLeug.d.ts} +19 -69
  29. package/dist/testing.d.ts +3 -3
  30. package/dist/testing.js +5 -31
  31. package/dist/testing.js.map +1 -1
  32. package/package.json +8 -8
  33. package/dist/chunk-GYZT5Q2K.js.map +0 -1
  34. package/dist/chunk-I26RJDRF.js.map +0 -1
  35. package/dist/chunk-XHI7OYKV.js.map +0 -1
  36. package/dist/chunk-Z7QWERHW.js.map +0 -1
@@ -1,19 +1,21 @@
1
1
  import {
2
2
  batchFetch
3
3
  } from "./chunk-XGRQ53P2.js";
4
+ import {
5
+ toListResult
6
+ } from "./chunk-OHXPJ225.js";
4
7
 
5
8
  // src/environment.ts
6
9
  function getEnvironment() {
7
- const deploymentEnv = process.env.DEPLOYMENT_ENV;
10
+ const deploymentEnv = process.env["DEPLOYMENT_ENV"];
8
11
  if (deploymentEnv === "dev") return "staging";
9
12
  if (deploymentEnv === "live") return "production";
10
13
  if (typeof window === "undefined") {
11
- if (process.env.NODE_ENV === "development") return "development";
14
+ if (process.env["NODE_ENV"] === "development") return "development";
12
15
  return "production";
13
16
  }
14
17
  const host = window.location.hostname;
15
- if (host.includes("localhost") || host.includes("127.0.0.1"))
16
- return "development";
18
+ if (host.includes("localhost") || host.includes("127.0.0.1")) return "development";
17
19
  if (host.includes("agr-hosting.dev")) return "staging";
18
20
  return "production";
19
21
  }
@@ -54,20 +56,18 @@ function recordFailure() {
54
56
  state.consecutiveFailures++;
55
57
  if (state.consecutiveFailures >= CIRCUIT_BREAKER_THRESHOLD) {
56
58
  state.circuitOpenUntil = Date.now() + CIRCUIT_BREAKER_RESET_MS;
57
- log(
58
- `Circuit breaker OPEN -- skipping Redis for ${CIRCUIT_BREAKER_RESET_MS / 1e3}s`
59
- );
59
+ log(`Circuit breaker OPEN -- skipping Redis for ${CIRCUIT_BREAKER_RESET_MS / 1e3}s`);
60
60
  }
61
61
  }
62
62
  function recordSuccess() {
63
63
  state.consecutiveFailures = 0;
64
64
  }
65
65
  function getRedisUrl() {
66
- const containerRedis = process.env.REDIS_SERVERS;
66
+ const containerRedis = process.env["REDIS_SERVERS"];
67
67
  if (containerRedis) return `redis://${containerRedis}`;
68
- if (isDev) return process.env.REDIS_URL_DEV;
69
- if (isStaging) return process.env.REDIS_URL_STAGING;
70
- return process.env.REDIS_URL_PROD;
68
+ if (isDev) return process.env["REDIS_URL_DEV"];
69
+ if (isStaging) return process.env["REDIS_URL_STAGING"];
70
+ return process.env["REDIS_URL_PROD"];
71
71
  }
72
72
  async function getClient() {
73
73
  if (state.client) return state.client;
@@ -196,7 +196,7 @@ function createPricingActions(api, config = {}) {
196
196
  }
197
197
  async function getTaxEstimate(customerId, postalCode, items = []) {
198
198
  const custId = resolveCustomerId(customerId, defaultCustomerId);
199
- const params = { customerId: custId, postalCode: postalCode ?? "", items };
199
+ const params = { customerId: custId, postalCode: postalCode ?? "", items, edgeCache };
200
200
  return withServerCache(
201
201
  cachePrefix,
202
202
  taxRedisTtl,
@@ -244,7 +244,7 @@ function createItemActions(api, config = {}) {
244
244
  async function getItemCategory(uid, options) {
245
245
  const sdkParams = { ...options, edgeCache };
246
246
  if (options?.filters) {
247
- sdkParams.filters = JSON.stringify(options.filters);
247
+ sdkParams["filters"] = JSON.stringify(options.filters);
248
248
  }
249
249
  const category = await withServerCache(
250
250
  cachePrefix,
@@ -260,23 +260,25 @@ function createItemActions(api, config = {}) {
260
260
  const cat = category;
261
261
  return {
262
262
  ...cat,
263
+ // Normalize PHP-style `false` to `null` for categoryImage
264
+ categoryImage: cat.categoryImage || null,
263
265
  children: sortCategoryChildren(cat.children)
264
266
  };
265
267
  }
266
268
  function buildCategoryParams(itemsFilters, overrides) {
267
269
  const params = { includeStock: "Y" };
268
270
  if (itemsFilters) {
269
- params.filters = JSON.stringify(itemsFilters.filters);
270
- params.limit = overrides?.limit ?? itemsFilters.limit;
271
- params.offset = overrides?.offset ?? itemsFilters.offset;
272
- params.q = itemsFilters.q;
273
- params.sortBy = itemsFilters.sortBy;
271
+ params["filters"] = JSON.stringify(itemsFilters.filters);
272
+ params["limit"] = overrides?.limit ?? itemsFilters.limit;
273
+ params["offset"] = overrides?.offset ?? itemsFilters.offset;
274
+ params["q"] = itemsFilters.q;
275
+ params["sortBy"] = itemsFilters.sortBy;
274
276
  } else {
275
- params.filters = JSON.stringify([]);
276
- params.q = "";
277
- params.sortBy = "desc";
278
- if (overrides?.limit !== void 0) params.limit = overrides.limit;
279
- if (overrides?.offset !== void 0) params.offset = overrides.offset;
277
+ params["filters"] = JSON.stringify([]);
278
+ params["q"] = "";
279
+ params["sortBy"] = "desc";
280
+ if (overrides?.limit !== void 0) params["limit"] = overrides.limit;
281
+ if (overrides?.offset !== void 0) params["offset"] = overrides.offset;
280
282
  }
281
283
  return params;
282
284
  }
@@ -285,8 +287,8 @@ function createItemActions(api, config = {}) {
285
287
  }
286
288
  async function getCategoryItems(uid, filters) {
287
289
  const merged = isItemsFilters(filters) ? buildCategoryParams(filters) : { ...filters };
288
- if (sortByPrefix && typeof merged.sortBy === "string" && merged.sortBy) {
289
- merged.sortBy = `${sortByPrefix}${merged.sortBy}`;
290
+ if (sortByPrefix && typeof merged["sortBy"] === "string" && merged["sortBy"]) {
291
+ merged["sortBy"] = `${sortByPrefix}${merged["sortBy"]}`;
290
292
  }
291
293
  return withServerCache(
292
294
  cachePrefix,
@@ -307,8 +309,8 @@ function createItemActions(api, config = {}) {
307
309
  const limit = itemsFilters?.limit || 24;
308
310
  const offset = pageParam * limit;
309
311
  const merged = buildCategoryParams(itemsFilters, { limit, offset });
310
- if (sortByPrefix && typeof merged.sortBy === "string" && merged.sortBy) {
311
- merged.sortBy = `${sortByPrefix}${merged.sortBy}`;
312
+ if (sortByPrefix && typeof merged["sortBy"] === "string" && merged["sortBy"]) {
313
+ merged["sortBy"] = `${sortByPrefix}${merged["sortBy"]}`;
312
314
  }
313
315
  const result = await withServerCache(
314
316
  cachePrefix,
@@ -334,11 +336,8 @@ function createItemActions(api, config = {}) {
334
336
  redisTtl,
335
337
  "items.categories.attributes.list",
336
338
  async () => {
337
- const response = await api.items.categories.attributes.list(
338
- categoryUid,
339
- { edgeCache }
340
- );
341
- return response.data.attributes;
339
+ const response = await api.items.categories.attributes.list(categoryUid, { edgeCache });
340
+ return { attributes: response.data.attributes };
342
341
  },
343
342
  categoryUid
344
343
  );
@@ -362,23 +361,18 @@ function createItemActions(api, config = {}) {
362
361
  includePricing: includePricingArg
363
362
  } : paramsOrUid;
364
363
  if (!params.invMastUid && !params.itemId) {
365
- throw new Error(
366
- "Either invMastUid must be positive or itemId must be provided"
367
- );
364
+ throw new Error("Either invMastUid must be positive or itemId must be provided");
368
365
  }
369
366
  return withServerCache(
370
367
  cachePrefix,
371
368
  redisTtl,
372
369
  "items.invMast.doc.list",
373
370
  async () => {
374
- const response = await api.items.invMast.doc.list(
375
- params.invMastUid ?? 0,
376
- {
377
- itemId: params.itemId,
378
- includePricing: params.includePricing,
379
- edgeCache: 4
380
- }
381
- );
371
+ const response = await api.items.invMast.doc.list(params.invMastUid ?? 0, {
372
+ itemId: params.itemId,
373
+ includePricing: params.includePricing,
374
+ edgeCache: 4
375
+ });
382
376
  return response.data;
383
377
  },
384
378
  params.invMastUid,
@@ -395,7 +389,7 @@ function createItemActions(api, config = {}) {
395
389
  const response = await api.items.invMast.stock.get(invMastUid, {
396
390
  edgeCache
397
391
  });
398
- return response.data?.stockData ?? [];
392
+ return response.data ?? { stockData: [], companySummary: {} };
399
393
  },
400
394
  invMastUid
401
395
  );
@@ -409,7 +403,7 @@ function createItemActions(api, config = {}) {
409
403
  const response = await api.items.invMast.stock.get(invMastUid, {
410
404
  edgeCache
411
405
  });
412
- return response.data?.companySummary ?? {};
406
+ return response.data?.["companySummary"] ?? {};
413
407
  },
414
408
  invMastUid
415
409
  );
@@ -423,7 +417,7 @@ function createItemActions(api, config = {}) {
423
417
  const response = await api.items.invMast.faq.list(invMastUid, {
424
418
  edgeCache: longEdgeCache
425
419
  });
426
- return response.data;
420
+ return toListResult(response);
427
421
  },
428
422
  invMastUid
429
423
  );
@@ -437,7 +431,7 @@ function createItemActions(api, config = {}) {
437
431
  const response = await api.items.invMast.invSub.list(invMastUid, {
438
432
  edgeCache: longEdgeCache
439
433
  });
440
- return response.data;
434
+ return toListResult(response);
441
435
  },
442
436
  invMastUid
443
437
  );
@@ -448,11 +442,8 @@ function createItemActions(api, config = {}) {
448
442
  redisTtl,
449
443
  "items.invMast.invAccessory.list",
450
444
  async () => {
451
- const response = await api.items.invMast.invAccessory.list(
452
- invMastUid,
453
- { edgeCache }
454
- );
455
- return response.data;
445
+ const response = await api.items.invMast.invAccessory.list(invMastUid, { edgeCache });
446
+ return toListResult(response);
456
447
  },
457
448
  invMastUid
458
449
  );
@@ -466,7 +457,7 @@ function createItemActions(api, config = {}) {
466
457
  const response = await api.items.invMast.similar.list(invMastUid, {
467
458
  edgeCache: longEdgeCache
468
459
  });
469
- return response.data;
460
+ return toListResult(response);
470
461
  },
471
462
  invMastUid
472
463
  );
@@ -479,7 +470,11 @@ function createItemActions(api, config = {}) {
479
470
  );
480
471
  }
481
472
  async function batchGetStockData(invMastUids) {
482
- return batchFetch(invMastUids, (uid) => getStock(uid), (uid) => uid);
473
+ return batchFetch(
474
+ invMastUids,
475
+ (uid) => getStock(uid),
476
+ (uid) => uid
477
+ );
483
478
  }
484
479
  return {
485
480
  itemCategoryLookup,
@@ -505,18 +500,18 @@ function createCommerceActions(api, config = {}) {
505
500
  const { defaultContactId, defaultCustomerId, convertUnitOfMeasure } = config;
506
501
  async function cartHdrLookup(params) {
507
502
  const lookupParams = { ...params };
508
- if (lookupParams.contactId == null && defaultContactId != null) {
509
- lookupParams.contactId = defaultContactId;
503
+ if (lookupParams["contactId"] == null && defaultContactId != null) {
504
+ lookupParams["contactId"] = defaultContactId;
510
505
  }
511
- if (lookupParams.customerId == null && defaultCustomerId != null) {
512
- lookupParams.customerId = defaultCustomerId;
506
+ if (lookupParams["customerId"] == null && defaultCustomerId != null) {
507
+ lookupParams["customerId"] = defaultCustomerId;
513
508
  }
514
509
  const response = await api.commerce.cartHdr.lookup.get(lookupParams);
515
510
  return response.data;
516
511
  }
517
512
  async function getCartLines(cartHdrUid) {
518
513
  const response = await api.commerce.cartLine.get(cartHdrUid);
519
- return response.data;
514
+ return toListResult(response);
520
515
  }
521
516
  async function addToCart(cartHdrUid, items) {
522
517
  try {
@@ -556,7 +551,7 @@ function createCommerceActions(api, config = {}) {
556
551
  }
557
552
  async function getCartAlsoBought(cartHdrUid) {
558
553
  const response = await api.commerce.cartHdr.alsoBought.get(cartHdrUid);
559
- return response.data;
554
+ return toListResult(response);
560
555
  }
561
556
  async function checkoutOrder(cartHdrUid, data) {
562
557
  try {
@@ -622,15 +617,15 @@ function createSearchActions(api, config = {}) {
622
617
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
623
618
  await openSearch.itemSearch.attributes.list(params)
624
619
  );
625
- return response.data.attributes;
620
+ return { attributes: response.data.attributes };
626
621
  },
627
622
  q
628
623
  );
629
624
  }
630
625
  async function getSearchSuggestions(q, limit, offset) {
631
626
  const params = { q, edgeCache };
632
- if (limit !== void 0) params.size = limit;
633
- if (offset !== void 0) params.from = offset;
627
+ if (limit !== void 0) params["size"] = limit;
628
+ if (offset !== void 0) params["from"] = offset;
634
629
  return withServerCache(
635
630
  cachePrefix,
636
631
  redisTtl,
@@ -739,7 +734,7 @@ function createShippingActions(api, config) {
739
734
  "ups.ratesShop.get",
740
735
  async () => {
741
736
  const response = await api.ups.ratesShop.get(params);
742
- return response.data;
737
+ return toListResult(response);
743
738
  },
744
739
  params
745
740
  );
@@ -792,7 +787,7 @@ function createJoomlaActions(api, config = {}) {
792
787
  ...params,
793
788
  edgeCache
794
789
  });
795
- return response.data;
790
+ return toListResult(response);
796
791
  },
797
792
  params
798
793
  );
@@ -806,7 +801,7 @@ function createJoomlaActions(api, config = {}) {
806
801
  published: 1,
807
802
  limit: 100
808
803
  };
809
- const items = await withServerCache(
804
+ const result = await withServerCache(
810
805
  cachePrefix,
811
806
  redisTtl,
812
807
  "joomla.menu.list",
@@ -815,12 +810,13 @@ function createJoomlaActions(api, config = {}) {
815
810
  ...sdkParams,
816
811
  edgeCache
817
812
  });
818
- return response.data;
813
+ return toListResult(response);
819
814
  },
820
815
  sdkParams
821
816
  );
822
817
  const pid = String(parentId);
823
- return items.filter((item) => String(item.parent_id) === pid);
818
+ const filtered = result.data.filter((item) => String(item.parentId) === pid);
819
+ return { ...result, data: filtered, total: filtered.length };
824
820
  }
825
821
  return withServerCache(
826
822
  cachePrefix,
@@ -831,7 +827,7 @@ function createJoomlaActions(api, config = {}) {
831
827
  ...paramsOrParentId,
832
828
  edgeCache
833
829
  });
834
- return response.data;
830
+ return toListResult(response);
835
831
  },
836
832
  paramsOrParentId
837
833
  );
@@ -860,12 +856,10 @@ function createJoomlaActions(api, config = {}) {
860
856
  const raw = response.data;
861
857
  if (!raw) throw new Error("User not found");
862
858
  const customerId = String(
863
- raw.customerId ?? raw.customer_id ?? raw.p21_customer_id ?? ""
859
+ raw.customerId ?? raw["customer_id"] ?? raw["p21_customer_id"] ?? ""
864
860
  );
865
861
  const groups = Array.isArray(raw.groups) ? raw.groups : [];
866
- const permissions = groups.map(
867
- (g2) => String(g2.title ?? g2.name ?? "")
868
- ).filter(Boolean);
862
+ const permissions = groups.map((g2) => String(g2["title"] ?? g2["name"] ?? "")).filter(Boolean);
869
863
  return {
870
864
  id: String(raw.id ?? userId),
871
865
  name: String(raw.name ?? ""),
@@ -884,7 +878,14 @@ function createJoomlaActions(api, config = {}) {
884
878
  });
885
879
  return response.data;
886
880
  }
887
- return { getJoomlaContent, getJoomlaContentList, getJoomlaMenu, getJoomlaMenuDoc, getUserProfile, verifyPassword };
881
+ return {
882
+ getJoomlaContent,
883
+ getJoomlaContentList,
884
+ getJoomlaMenu,
885
+ getJoomlaMenuDoc,
886
+ getUserProfile,
887
+ verifyPassword
888
+ };
888
889
  }
889
890
 
890
891
  // src/actions/legacy.ts
@@ -916,11 +917,8 @@ function createLegacyActions(api, config = {}) {
916
917
  redisTtl,
917
918
  "legacy.invMast.alsoBought.list",
918
919
  async () => {
919
- const response = await api.legacy.invMast.alsoBought.list(
920
- invMastUid,
921
- { edgeCache }
922
- );
923
- return response.data;
920
+ const response = await api.legacy.invMast.alsoBought.list(invMastUid, { edgeCache });
921
+ return toListResult(response);
924
922
  },
925
923
  invMastUid
926
924
  );
@@ -934,7 +932,7 @@ function createLegacyActions(api, config = {}) {
934
932
  const response = await api.legacy.invMast.tags.list(invMastUid, {
935
933
  edgeCache
936
934
  });
937
- return response.data;
935
+ return toListResult(response);
938
936
  },
939
937
  invMastUid
940
938
  );
@@ -949,7 +947,7 @@ function createLegacyActions(api, config = {}) {
949
947
  ...params,
950
948
  edgeCache: longEdgeCache
951
949
  });
952
- return response.data;
950
+ return toListResult(response);
953
951
  },
954
952
  params?.twoLetterCode
955
953
  );
@@ -990,7 +988,7 @@ function createCustomersActions(api, config = {}) {
990
988
  edgeCache
991
989
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
992
990
  });
993
- return response.data;
991
+ return toListResult(response);
994
992
  },
995
993
  params
996
994
  );
@@ -1019,7 +1017,7 @@ function createCustomersActions(api, config = {}) {
1019
1017
  ...params,
1020
1018
  edgeCache
1021
1019
  });
1022
- return { data: response.data, total: response.total };
1020
+ return toListResult(response);
1023
1021
  },
1024
1022
  customerId,
1025
1023
  params
@@ -1031,11 +1029,9 @@ function createCustomersActions(api, config = {}) {
1031
1029
  redisTtl,
1032
1030
  "customers.customer.orders.get",
1033
1031
  async () => {
1034
- const response = await api.customers.customer.orders.get(
1035
- customerId,
1036
- orderId,
1037
- { edgeCache }
1038
- );
1032
+ const response = await api.customers.customer.orders.get(customerId, orderId, {
1033
+ edgeCache
1034
+ });
1039
1035
  return response.data;
1040
1036
  },
1041
1037
  customerId,
@@ -1053,7 +1049,7 @@ function createCustomersActions(api, config = {}) {
1053
1049
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
1054
1050
  { ...params, edgeCache }
1055
1051
  );
1056
- return { data: response.data, total: response.total };
1052
+ return toListResult(response);
1057
1053
  },
1058
1054
  customerId,
1059
1055
  params
@@ -1065,11 +1061,9 @@ function createCustomersActions(api, config = {}) {
1065
1061
  redisTtl,
1066
1062
  "customers.customer.invoices.get",
1067
1063
  async () => {
1068
- const response = await api.customers.customer.invoices.get(
1069
- customerId,
1070
- invoiceNo,
1071
- { edgeCache }
1072
- );
1064
+ const response = await api.customers.customer.invoices.get(customerId, invoiceNo, {
1065
+ edgeCache
1066
+ });
1073
1067
  return response.data;
1074
1068
  },
1075
1069
  customerId,
@@ -1086,7 +1080,7 @@ function createCustomersActions(api, config = {}) {
1086
1080
  ...params,
1087
1081
  edgeCache
1088
1082
  });
1089
- return { data: response.data, total: response.total };
1083
+ return toListResult(response);
1090
1084
  },
1091
1085
  customerId,
1092
1086
  params
@@ -1098,11 +1092,9 @@ function createCustomersActions(api, config = {}) {
1098
1092
  redisTtl,
1099
1093
  "customers.customer.quotes.get",
1100
1094
  async () => {
1101
- const response = await api.customers.customer.quotes.get(
1102
- customerId,
1103
- quoteNo,
1104
- { edgeCache }
1105
- );
1095
+ const response = await api.customers.customer.quotes.get(customerId, quoteNo, {
1096
+ edgeCache
1097
+ });
1106
1098
  return response.data;
1107
1099
  },
1108
1100
  customerId,
@@ -1119,7 +1111,7 @@ function createCustomersActions(api, config = {}) {
1119
1111
  ...params,
1120
1112
  edgeCache
1121
1113
  });
1122
- return response.data;
1114
+ return toListResult(response);
1123
1115
  },
1124
1116
  params
1125
1117
  );
@@ -1133,7 +1125,7 @@ function createCustomersActions(api, config = {}) {
1133
1125
  const response = await api.customers.customer.shipTo.list(customerId, {
1134
1126
  edgeCache
1135
1127
  });
1136
- return response.data;
1128
+ return toListResult(response);
1137
1129
  },
1138
1130
  customerId
1139
1131
  );
@@ -1199,7 +1191,7 @@ function createP21PimActions(api, config = {}) {
1199
1191
  ...params,
1200
1192
  edgeCache
1201
1193
  });
1202
- return response.data;
1194
+ return toListResult(response);
1203
1195
  },
1204
1196
  params
1205
1197
  );
@@ -1212,11 +1204,7 @@ function createP21PimActions(api, config = {}) {
1212
1204
 
1213
1205
  // src/actions/agr-site.ts
1214
1206
  function createAgrSiteActions(api, config = {}) {
1215
- const {
1216
- cachePrefix = "",
1217
- longEdgeCache = 8,
1218
- longRedisTtl = 28800
1219
- } = config;
1207
+ const { cachePrefix = "", longEdgeCache = 8, longRedisTtl = 28800 } = config;
1220
1208
  async function getSettings(serviceName) {
1221
1209
  return withServerCache(
1222
1210
  cachePrefix,
@@ -1228,7 +1216,7 @@ function createAgrSiteActions(api, config = {}) {
1228
1216
  edgeCache: longEdgeCache
1229
1217
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
1230
1218
  });
1231
- return response.data;
1219
+ return toListResult(response);
1232
1220
  },
1233
1221
  serviceName
1234
1222
  );
@@ -1243,7 +1231,7 @@ function createAgrSiteActions(api, config = {}) {
1243
1231
  ...params,
1244
1232
  edgeCache: longEdgeCache
1245
1233
  });
1246
- return response.data;
1234
+ return toListResult(response);
1247
1235
  },
1248
1236
  params
1249
1237
  );
@@ -1354,7 +1342,7 @@ function createUpsActions(api, config = {}) {
1354
1342
  async function getRates(params) {
1355
1343
  try {
1356
1344
  const response = await api.ups.ratesShop.get(params);
1357
- return response.data;
1345
+ return toListResult(response);
1358
1346
  } catch {
1359
1347
  return void 0;
1360
1348
  }
@@ -1366,11 +1354,7 @@ function createUpsActions(api, config = {}) {
1366
1354
 
1367
1355
  // src/actions/logistics.ts
1368
1356
  function createLogisticsActions(api, config = {}) {
1369
- const {
1370
- cachePrefix = "",
1371
- longEdgeCache = 8,
1372
- longRedisTtl = 28800
1373
- } = config;
1357
+ const { cachePrefix = "", longEdgeCache = 8, longRedisTtl = 28800 } = config;
1374
1358
  async function getFreightRates(params) {
1375
1359
  try {
1376
1360
  const response = await api.logistics.speedship.freight.get(params);
@@ -1390,7 +1374,7 @@ function createLogisticsActions(api, config = {}) {
1390
1374
  edgeCache: longEdgeCache
1391
1375
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
1392
1376
  });
1393
- return response.data;
1377
+ return toListResult(response);
1394
1378
  },
1395
1379
  params ? JSON.stringify(params) : void 0
1396
1380
  );
@@ -1403,11 +1387,7 @@ function createLogisticsActions(api, config = {}) {
1403
1387
 
1404
1388
  // src/actions/nexus.ts
1405
1389
  function createNexusActions(api, config = {}) {
1406
- const {
1407
- cachePrefix = "",
1408
- edgeCache = 1,
1409
- redisTtl = 3600
1410
- } = config;
1390
+ const { cachePrefix = "", edgeCache = 1, redisTtl = 3600 } = config;
1411
1391
  async function createBinTransfer(data) {
1412
1392
  try {
1413
1393
  const response = await api.nexus.binTransfer.create(data);
@@ -1442,7 +1422,7 @@ function createNexusActions(api, config = {}) {
1442
1422
  ...params,
1443
1423
  edgeCache
1444
1424
  });
1445
- return response.data;
1425
+ return toListResult(response);
1446
1426
  },
1447
1427
  params ? JSON.stringify(params) : void 0
1448
1428
  );
@@ -1457,7 +1437,7 @@ function createNexusActions(api, config = {}) {
1457
1437
  ...params,
1458
1438
  edgeCache
1459
1439
  });
1460
- return response.data;
1440
+ return toListResult(response);
1461
1441
  },
1462
1442
  params ? JSON.stringify(params) : void 0
1463
1443
  );
@@ -1472,7 +1452,7 @@ function createNexusActions(api, config = {}) {
1472
1452
  ...params,
1473
1453
  edgeCache
1474
1454
  });
1475
- return response.data;
1455
+ return toListResult(response);
1476
1456
  },
1477
1457
  params ? JSON.stringify(params) : void 0
1478
1458
  );
@@ -1489,12 +1469,7 @@ function createNexusActions(api, config = {}) {
1489
1469
 
1490
1470
  // src/actions/vmi.ts
1491
1471
  function createVmiActions(api, config = {}) {
1492
- const {
1493
- cachePrefix = "",
1494
- edgeCache = 1,
1495
- redisTtl = 3600,
1496
- shortRedisTtl = 300
1497
- } = config;
1472
+ const { cachePrefix = "", edgeCache = 1, redisTtl = 3600, shortRedisTtl = 300 } = config;
1498
1473
  async function getWarehouses(params) {
1499
1474
  return withServerCache(
1500
1475
  cachePrefix,
@@ -1505,7 +1480,7 @@ function createVmiActions(api, config = {}) {
1505
1480
  ...params,
1506
1481
  edgeCache
1507
1482
  });
1508
- return response.data;
1483
+ return toListResult(response);
1509
1484
  },
1510
1485
  params ? JSON.stringify(params) : void 0
1511
1486
  );
@@ -1521,7 +1496,7 @@ function createVmiActions(api, config = {}) {
1521
1496
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
1522
1497
  { ...params, edgeCache }
1523
1498
  );
1524
- return response.data;
1499
+ return toListResult(response);
1525
1500
  },
1526
1501
  warehouseUid,
1527
1502
  params ? JSON.stringify(params) : void 0
@@ -1537,7 +1512,7 @@ function createVmiActions(api, config = {}) {
1537
1512
  ...params,
1538
1513
  edgeCache
1539
1514
  });
1540
- return response.data;
1515
+ return toListResult(response);
1541
1516
  },
1542
1517
  params ? JSON.stringify(params) : void 0
1543
1518
  );
@@ -1552,7 +1527,7 @@ function createVmiActions(api, config = {}) {
1552
1527
  ...params,
1553
1528
  edgeCache
1554
1529
  });
1555
- return response.data;
1530
+ return toListResult(response);
1556
1531
  },
1557
1532
  params ? JSON.stringify(params) : void 0
1558
1533
  );
@@ -1568,7 +1543,7 @@ function createVmiActions(api, config = {}) {
1568
1543
  edgeCache
1569
1544
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
1570
1545
  });
1571
- return response.data;
1546
+ return toListResult(response);
1572
1547
  },
1573
1548
  params ? JSON.stringify(params) : void 0
1574
1549
  );
@@ -1584,7 +1559,7 @@ function createVmiActions(api, config = {}) {
1584
1559
  edgeCache
1585
1560
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
1586
1561
  });
1587
- return response.data;
1562
+ return toListResult(response);
1588
1563
  },
1589
1564
  params ? JSON.stringify(params) : void 0
1590
1565
  );
@@ -1600,7 +1575,7 @@ function createVmiActions(api, config = {}) {
1600
1575
  edgeCache
1601
1576
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
1602
1577
  });
1603
- return response.data;
1578
+ return toListResult(response);
1604
1579
  },
1605
1580
  params ? JSON.stringify(params) : void 0
1606
1581
  );
@@ -1635,7 +1610,7 @@ function createP21CoreActions(api, config = {}) {
1635
1610
  ...params,
1636
1611
  edgeCache
1637
1612
  });
1638
- return response.data;
1613
+ return toListResult(response);
1639
1614
  },
1640
1615
  params
1641
1616
  );
@@ -1650,7 +1625,7 @@ function createP21CoreActions(api, config = {}) {
1650
1625
  ...params,
1651
1626
  edgeCache: longEdgeCache
1652
1627
  });
1653
- return response.data;
1628
+ return toListResult(response);
1654
1629
  },
1655
1630
  params
1656
1631
  );
@@ -1680,7 +1655,7 @@ function createP21CoreActions(api, config = {}) {
1680
1655
  ...params,
1681
1656
  edgeCache: longEdgeCache
1682
1657
  });
1683
- return response.data;
1658
+ return toListResult(response);
1684
1659
  },
1685
1660
  params
1686
1661
  );
@@ -1695,7 +1670,7 @@ function createP21CoreActions(api, config = {}) {
1695
1670
  ...params,
1696
1671
  edgeCache: longEdgeCache
1697
1672
  });
1698
- return response.data;
1673
+ return toListResult(response);
1699
1674
  },
1700
1675
  params
1701
1676
  );
@@ -1710,7 +1685,7 @@ function createP21CoreActions(api, config = {}) {
1710
1685
  ...params,
1711
1686
  edgeCache
1712
1687
  });
1713
- return response.data;
1688
+ return toListResult(response);
1714
1689
  },
1715
1690
  params
1716
1691
  );
@@ -1726,7 +1701,7 @@ function createP21CoreActions(api, config = {}) {
1726
1701
  edgeCache: longEdgeCache
1727
1702
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
1728
1703
  });
1729
- return response.data;
1704
+ return toListResult(response);
1730
1705
  },
1731
1706
  params
1732
1707
  );
@@ -1744,11 +1719,7 @@ function createP21CoreActions(api, config = {}) {
1744
1719
 
1745
1720
  // src/actions/p21-apis.ts
1746
1721
  function createP21ApisActions(api, config = {}) {
1747
- const {
1748
- cachePrefix = "",
1749
- edgeCache = 1,
1750
- redisTtl = 3600
1751
- } = config;
1722
+ const { cachePrefix = "", edgeCache = 1, redisTtl = 3600 } = config;
1752
1723
  async function getCategories(params) {
1753
1724
  return withServerCache(
1754
1725
  cachePrefix,
@@ -1759,7 +1730,7 @@ function createP21ApisActions(api, config = {}) {
1759
1730
  ...params,
1760
1731
  edgeCache
1761
1732
  });
1762
- return response.data;
1733
+ return toListResult(response);
1763
1734
  },
1764
1735
  params
1765
1736
  );
@@ -1770,10 +1741,9 @@ function createP21ApisActions(api, config = {}) {
1770
1741
  redisTtl,
1771
1742
  "p21Apis.transCategory.defaults.get",
1772
1743
  async () => {
1773
- const response = await api.p21Apis.transCategory.defaults.get(
1774
- categoryId,
1775
- { edgeCache }
1776
- );
1744
+ const response = await api.p21Apis.transCategory.defaults.get(categoryId, {
1745
+ edgeCache
1746
+ });
1777
1747
  return response.data;
1778
1748
  },
1779
1749
  categoryId
@@ -1789,7 +1759,7 @@ function createP21ApisActions(api, config = {}) {
1789
1759
  ...params,
1790
1760
  edgeCache
1791
1761
  });
1792
- return response.data;
1762
+ return toListResult(response);
1793
1763
  },
1794
1764
  params
1795
1765
  );
@@ -1804,7 +1774,7 @@ function createP21ApisActions(api, config = {}) {
1804
1774
  ...params,
1805
1775
  edgeCache
1806
1776
  });
1807
- return response.data;
1777
+ return toListResult(response);
1808
1778
  },
1809
1779
  params
1810
1780
  );
@@ -1819,7 +1789,7 @@ function createP21ApisActions(api, config = {}) {
1819
1789
  ...params,
1820
1790
  edgeCache
1821
1791
  });
1822
- return response.data;
1792
+ return toListResult(response);
1823
1793
  },
1824
1794
  params
1825
1795
  );
@@ -1875,11 +1845,7 @@ function createP21ApisActions(api, config = {}) {
1875
1845
 
1876
1846
  // src/actions/p21-sism.ts
1877
1847
  function createP21SismActions(api, config = {}) {
1878
- const {
1879
- cachePrefix = "",
1880
- edgeCache = 1,
1881
- redisTtl = 3600
1882
- } = config;
1848
+ const { cachePrefix = "", edgeCache = 1, redisTtl = 3600 } = config;
1883
1849
  async function getRecentImports(params) {
1884
1850
  return withServerCache(
1885
1851
  cachePrefix,
@@ -1890,7 +1856,7 @@ function createP21SismActions(api, config = {}) {
1890
1856
  ...params,
1891
1857
  edgeCache
1892
1858
  });
1893
- return response.data;
1859
+ return toListResult(response);
1894
1860
  },
1895
1861
  params
1896
1862
  );
@@ -1918,7 +1884,7 @@ function createP21SismActions(api, config = {}) {
1918
1884
  importUid: importId,
1919
1885
  edgeCache
1920
1886
  });
1921
- return response.data;
1887
+ return toListResult(response);
1922
1888
  },
1923
1889
  importId,
1924
1890
  params
@@ -1934,7 +1900,7 @@ function createP21SismActions(api, config = {}) {
1934
1900
  ...params,
1935
1901
  edgeCache
1936
1902
  });
1937
- return response.data;
1903
+ return toListResult(response);
1938
1904
  },
1939
1905
  params
1940
1906
  );
@@ -1986,12 +1952,12 @@ function createAgrInfoActions(api, config = {}) {
1986
1952
  redisTtl,
1987
1953
  "agrInfo.context.list",
1988
1954
  async () => {
1989
- const siteId = params?.siteId ?? "";
1955
+ const siteId = params?.["siteId"] ?? "";
1990
1956
  const response = await api.agrInfo.context.get(siteId, {
1991
1957
  ...params,
1992
1958
  edgeCache
1993
1959
  });
1994
- return Array.isArray(response.data) ? response.data : [response.data];
1960
+ return toListResult(response);
1995
1961
  },
1996
1962
  params
1997
1963
  );
@@ -2006,7 +1972,7 @@ function createAgrInfoActions(api, config = {}) {
2006
1972
  ...params,
2007
1973
  edgeCache
2008
1974
  });
2009
- return response.data;
1975
+ return toListResult(response);
2010
1976
  },
2011
1977
  params
2012
1978
  );
@@ -2021,7 +1987,7 @@ function createAgrInfoActions(api, config = {}) {
2021
1987
  ...params,
2022
1988
  edgeCache: longEdgeCache
2023
1989
  });
2024
- return response.data;
1990
+ return toListResult(response);
2025
1991
  },
2026
1992
  params
2027
1993
  );
@@ -2071,7 +2037,7 @@ function createBasecamp2Actions(api, config = {}) {
2071
2037
  edgeCache
2072
2038
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
2073
2039
  });
2074
- return response.data;
2040
+ return toListResult(response);
2075
2041
  },
2076
2042
  params
2077
2043
  );
@@ -2099,7 +2065,7 @@ function createBasecamp2Actions(api, config = {}) {
2099
2065
  edgeCache
2100
2066
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
2101
2067
  });
2102
- return response.data;
2068
+ return toListResult(response);
2103
2069
  },
2104
2070
  params
2105
2071
  );
@@ -2115,7 +2081,7 @@ function createBasecamp2Actions(api, config = {}) {
2115
2081
  edgeCache
2116
2082
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
2117
2083
  });
2118
- return response.data;
2084
+ return toListResult(response);
2119
2085
  },
2120
2086
  params
2121
2087
  );
@@ -2131,7 +2097,7 @@ function createBasecamp2Actions(api, config = {}) {
2131
2097
  edgeCache: longEdgeCache
2132
2098
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
2133
2099
  });
2134
- return response.data;
2100
+ return toListResult(response);
2135
2101
  },
2136
2102
  params
2137
2103
  );
@@ -2147,7 +2113,7 @@ function createBasecamp2Actions(api, config = {}) {
2147
2113
  edgeCache
2148
2114
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
2149
2115
  });
2150
- return response.data;
2116
+ return toListResult(response);
2151
2117
  },
2152
2118
  params
2153
2119
  );
@@ -2163,7 +2129,7 @@ function createBasecamp2Actions(api, config = {}) {
2163
2129
  edgeCache
2164
2130
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
2165
2131
  });
2166
- return response.data;
2132
+ return toListResult(response);
2167
2133
  },
2168
2134
  params
2169
2135
  );
@@ -2179,7 +2145,7 @@ function createBasecamp2Actions(api, config = {}) {
2179
2145
  edgeCache
2180
2146
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
2181
2147
  });
2182
- return response.data;
2148
+ return toListResult(response);
2183
2149
  },
2184
2150
  params
2185
2151
  );
@@ -2195,7 +2161,7 @@ function createBasecamp2Actions(api, config = {}) {
2195
2161
  edgeCache
2196
2162
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
2197
2163
  });
2198
- return response.data;
2164
+ return toListResult(response);
2199
2165
  },
2200
2166
  params
2201
2167
  );
@@ -2226,7 +2192,7 @@ function createBrandFolderActions(api, config = {}) {
2226
2192
  ...params,
2227
2193
  edgeCache
2228
2194
  });
2229
- return response.data;
2195
+ return toListResult(response);
2230
2196
  },
2231
2197
  params
2232
2198
  );
@@ -2281,7 +2247,7 @@ function createGregorovichActions(api, config = {}) {
2281
2247
  "gregorovich.documents.list",
2282
2248
  async () => {
2283
2249
  const response = await api.gregorovich.documents.list();
2284
- return response.data;
2250
+ return toListResult(response);
2285
2251
  },
2286
2252
  params
2287
2253
  );
@@ -2331,7 +2297,7 @@ function createSlackActions(api, config = {}) {
2331
2297
  ...params,
2332
2298
  edgeCache
2333
2299
  });
2334
- return response.data;
2300
+ return toListResult(response);
2335
2301
  },
2336
2302
  params
2337
2303
  );
@@ -2352,8 +2318,9 @@ function createSiteActions(api, config = {}) {
2352
2318
  redisTtl,
2353
2319
  longEdgeCache,
2354
2320
  longRedisTtl,
2355
- defaultContactId,
2356
- defaultCustomerId,
2321
+ defaultContactId = process.env["DEFAULT_CONTACT_ID"],
2322
+ defaultCustomerId = process.env["DEFAULT_CUSTOMER_ID"],
2323
+ defaultCompanyId: _defaultCompanyId = process.env["DEFAULT_COMPANY_ID"],
2357
2324
  convertUnitOfMeasure
2358
2325
  } = config;
2359
2326
  const cache = { cachePrefix, edgeCache, redisTtl };
@@ -2396,32 +2363,22 @@ function createSiteActions(api, config = {}) {
2396
2363
  ...config.search
2397
2364
  })
2398
2365
  );
2399
- const orders = lazy(
2400
- () => createOrderActions(castApi(), cache)
2401
- );
2366
+ const orders = lazy(() => createOrderActions(castApi(), cache));
2402
2367
  const shipping = lazy(
2403
- () => createShippingActions(
2404
- castApi(),
2405
- { ...cache, ...config.shipping }
2406
- )
2407
- );
2408
- const joomla = lazy(
2409
- () => createJoomlaActions(castApi(), cache)
2410
- );
2411
- const legacy = lazy(
2412
- () => createLegacyActions(castApi(), longCache)
2413
- );
2414
- const customers = lazy(
2415
- () => createCustomersActions(castApi(), cache)
2368
+ () => createShippingActions(castApi(), {
2369
+ ...cache,
2370
+ ...config.shipping
2371
+ })
2416
2372
  );
2373
+ const joomla = lazy(() => createJoomlaActions(castApi(), cache));
2374
+ const legacy = lazy(() => createLegacyActions(castApi(), longCache));
2375
+ const customers = lazy(() => createCustomersActions(castApi(), cache));
2417
2376
  const smartyStreets = lazy(
2418
2377
  () => createSmartyStreetsActions(castApi(), {
2419
2378
  cachePrefix
2420
2379
  })
2421
2380
  );
2422
- const p21Pim = lazy(
2423
- () => createP21PimActions(castApi(), cache)
2424
- );
2381
+ const p21Pim = lazy(() => createP21PimActions(castApi(), cache));
2425
2382
  const agrSite = lazy(
2426
2383
  () => createAgrSiteActions(castApi(), {
2427
2384
  cachePrefix,
@@ -2429,54 +2386,26 @@ function createSiteActions(api, config = {}) {
2429
2386
  longRedisTtl
2430
2387
  })
2431
2388
  );
2432
- const avalara = lazy(
2433
- () => createAvalaraActions(castApi(), { cachePrefix })
2434
- );
2389
+ const avalara = lazy(() => createAvalaraActions(castApi(), { cachePrefix }));
2435
2390
  const payments = lazy(
2436
2391
  () => createPaymentsActions(castApi(), {
2437
2392
  cachePrefix,
2438
2393
  ...config.payments
2439
2394
  })
2440
2395
  );
2441
- const ups = lazy(
2442
- () => createUpsActions(castApi(), { cachePrefix })
2443
- );
2444
- const logistics = lazy(
2445
- () => createLogisticsActions(castApi(), longCache)
2446
- );
2447
- const nexus = lazy(
2448
- () => createNexusActions(castApi(), cache)
2449
- );
2450
- const vmi = lazy(
2451
- () => createVmiActions(castApi(), { ...cache, ...config.vmi })
2452
- );
2453
- const p21Core = lazy(
2454
- () => createP21CoreActions(castApi(), longCache)
2455
- );
2456
- const p21Apis = lazy(
2457
- () => createP21ApisActions(castApi(), cache)
2458
- );
2459
- const p21Sism = lazy(
2460
- () => createP21SismActions(castApi(), cache)
2461
- );
2462
- const agrWork = lazy(
2463
- () => createAgrWorkActions(castApi(), { cachePrefix })
2464
- );
2465
- const agrInfo = lazy(
2466
- () => createAgrInfoActions(castApi(), longCache)
2467
- );
2468
- const basecamp2 = lazy(
2469
- () => createBasecamp2Actions(castApi(), longCache)
2470
- );
2471
- const brandFolder = lazy(
2472
- () => createBrandFolderActions(castApi(), cache)
2473
- );
2474
- const gregorovich = lazy(
2475
- () => createGregorovichActions(castApi(), cache)
2476
- );
2477
- const slack = lazy(
2478
- () => createSlackActions(castApi(), cache)
2479
- );
2396
+ const ups = lazy(() => createUpsActions(castApi(), { cachePrefix }));
2397
+ const logistics = lazy(() => createLogisticsActions(castApi(), longCache));
2398
+ const nexus = lazy(() => createNexusActions(castApi(), cache));
2399
+ const vmi = lazy(() => createVmiActions(castApi(), { ...cache, ...config.vmi }));
2400
+ const p21Core = lazy(() => createP21CoreActions(castApi(), longCache));
2401
+ const p21Apis = lazy(() => createP21ApisActions(castApi(), cache));
2402
+ const p21Sism = lazy(() => createP21SismActions(castApi(), cache));
2403
+ const agrWork = lazy(() => createAgrWorkActions(castApi(), { cachePrefix }));
2404
+ const agrInfo = lazy(() => createAgrInfoActions(castApi(), longCache));
2405
+ const basecamp2 = lazy(() => createBasecamp2Actions(castApi(), longCache));
2406
+ const brandFolder = lazy(() => createBrandFolderActions(castApi(), cache));
2407
+ const gregorovich = lazy(() => createGregorovichActions(castApi(), cache));
2408
+ const slack = lazy(() => createSlackActions(castApi(), cache));
2480
2409
  const legacyServices = {
2481
2410
  get pricing() {
2482
2411
  return pricing.get();
@@ -2589,8 +2518,7 @@ function createSiteActions(api, config = {}) {
2589
2518
  const wrapped = new Proxy(legacySvc, {
2590
2519
  get(svc, method) {
2591
2520
  if (typeof method === "symbol") return void 0;
2592
- if (method in svc)
2593
- return svc[method];
2521
+ if (method in svc) return svc[method];
2594
2522
  return proxyFallback[key]?.[method];
2595
2523
  }
2596
2524
  });
@@ -2645,4 +2573,4 @@ export {
2645
2573
  createSlackActions,
2646
2574
  createSiteActions
2647
2575
  };
2648
- //# sourceMappingURL=chunk-XHI7OYKV.js.map
2576
+ //# sourceMappingURL=chunk-3YLC52GL.js.map