@simpleapps-com/augur-server 1.0.2 → 1.0.3

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.
@@ -0,0 +1,2478 @@
1
+ import {
2
+ batchFetch
3
+ } from "./chunk-XGRQ53P2.js";
4
+
5
+ // src/environment.ts
6
+ function getEnvironment() {
7
+ const deploymentEnv = process.env.DEPLOYMENT_ENV;
8
+ if (deploymentEnv === "dev") return "staging";
9
+ if (deploymentEnv === "live") return "production";
10
+ if (typeof window === "undefined") {
11
+ if (process.env.NODE_ENV === "development") return "development";
12
+ return "production";
13
+ }
14
+ const host = window.location.hostname;
15
+ if (host.includes("localhost") || host.includes("127.0.0.1"))
16
+ return "development";
17
+ if (host.includes("agr-hosting.dev")) return "staging";
18
+ return "production";
19
+ }
20
+ var env = getEnvironment();
21
+ var isDev = env === "development";
22
+ var isStaging = env === "staging";
23
+ var isProduction = env === "production";
24
+
25
+ // src/cache/redis-client.ts
26
+ var CIRCUIT_BREAKER_THRESHOLD = 5;
27
+ var CIRCUIT_BREAKER_RESET_MS = 6e4;
28
+ var g = globalThis;
29
+ if (!g.__redisState) {
30
+ g.__redisState = {
31
+ client: null,
32
+ consecutiveFailures: 0,
33
+ circuitOpenUntil: 0
34
+ };
35
+ }
36
+ var state = g.__redisState;
37
+ var debugEnabled = isDev || isStaging;
38
+ function log(...args) {
39
+ if (debugEnabled) {
40
+ console.log("[Redis]", ...args);
41
+ }
42
+ }
43
+ function isCircuitOpen() {
44
+ if (state.circuitOpenUntil === 0) return false;
45
+ if (Date.now() >= state.circuitOpenUntil) {
46
+ state.circuitOpenUntil = 0;
47
+ state.consecutiveFailures = 0;
48
+ log("Circuit breaker reset -- retrying Redis");
49
+ return false;
50
+ }
51
+ return true;
52
+ }
53
+ function recordFailure() {
54
+ state.consecutiveFailures++;
55
+ if (state.consecutiveFailures >= CIRCUIT_BREAKER_THRESHOLD) {
56
+ state.circuitOpenUntil = Date.now() + CIRCUIT_BREAKER_RESET_MS;
57
+ log(
58
+ `Circuit breaker OPEN -- skipping Redis for ${CIRCUIT_BREAKER_RESET_MS / 1e3}s`
59
+ );
60
+ }
61
+ }
62
+ function recordSuccess() {
63
+ state.consecutiveFailures = 0;
64
+ }
65
+ function getRedisUrl() {
66
+ const containerRedis = process.env.REDIS_SERVERS;
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;
71
+ }
72
+ async function getClient() {
73
+ if (state.client) return state.client;
74
+ const url = getRedisUrl();
75
+ if (!url) {
76
+ log("No REDIS_URL -- cache disabled");
77
+ return null;
78
+ }
79
+ try {
80
+ const { default: IORedis } = await import("ioredis");
81
+ state.client = new IORedis(url, {
82
+ maxRetriesPerRequest: 1,
83
+ connectTimeout: 3e3,
84
+ lazyConnect: true,
85
+ enableOfflineQueue: false
86
+ });
87
+ state.client.on("error", (err) => {
88
+ log("Connection error:", err.message);
89
+ recordFailure();
90
+ });
91
+ state.client.on("connect", () => log("Connected"));
92
+ state.client.connect().catch(() => {
93
+ });
94
+ return state.client;
95
+ } catch {
96
+ log("Failed to create client (ioredis not installed?)");
97
+ return null;
98
+ }
99
+ }
100
+ async function cacheGet(key) {
101
+ if (isCircuitOpen()) return null;
102
+ const client = await getClient();
103
+ if (!client) return null;
104
+ try {
105
+ const value = await client.get(key);
106
+ recordSuccess();
107
+ return value;
108
+ } catch {
109
+ recordFailure();
110
+ return null;
111
+ }
112
+ }
113
+ async function cacheSet(key, value, ttlSeconds) {
114
+ if (isCircuitOpen()) return;
115
+ const client = await getClient();
116
+ if (!client) return;
117
+ try {
118
+ await client.setex(key, ttlSeconds, value);
119
+ recordSuccess();
120
+ } catch {
121
+ recordFailure();
122
+ }
123
+ }
124
+ function getCircuitState() {
125
+ return isCircuitOpen() ? "open" : "closed";
126
+ }
127
+ function isRedisConnected() {
128
+ return state.client?.status === "ready";
129
+ }
130
+
131
+ // src/cache/with-cache.ts
132
+ import { buildCacheKey } from "@simpleapps-com/augur-core";
133
+ async function withServerCache(prefix, redisTtl, methodPath, fn, ...keyArgs) {
134
+ if (!redisTtl) return fn();
135
+ const key = buildCacheKey(prefix, methodPath, keyArgs);
136
+ try {
137
+ const cached = await cacheGet(key);
138
+ if (cached != null) return JSON.parse(cached);
139
+ } catch {
140
+ }
141
+ const result = await fn();
142
+ try {
143
+ cacheSet(key, JSON.stringify(result), redisTtl).catch(() => {
144
+ });
145
+ } catch {
146
+ }
147
+ return result;
148
+ }
149
+
150
+ // src/actions/pricing.ts
151
+ function resolveCustomerId(explicit, fallback) {
152
+ const raw = explicit ?? fallback;
153
+ const num = Number(raw);
154
+ return num > 0 ? num : 0;
155
+ }
156
+ function createPricingActions(api, config = {}) {
157
+ const {
158
+ defaultCustomerId,
159
+ cachePrefix = "",
160
+ edgeCache = 2,
161
+ redisTtl = 3600,
162
+ taxRedisTtl = 1800
163
+ } = config;
164
+ async function getItemPrice(itemId, customerId, quantity = 1) {
165
+ const custId = resolveCustomerId(customerId, defaultCustomerId);
166
+ const params = { customerId: custId, itemId, quantity, edgeCache };
167
+ return withServerCache(
168
+ cachePrefix,
169
+ redisTtl,
170
+ "pricing.priceEngine.get",
171
+ async () => {
172
+ const response = await api.pricing.priceEngine.get(params);
173
+ return response.data;
174
+ },
175
+ params
176
+ );
177
+ }
178
+ async function batchGetItemPrices(itemIds, customerId, quantity = 1) {
179
+ return batchFetch(
180
+ itemIds,
181
+ (id) => getItemPrice(id, customerId, quantity),
182
+ (id) => id
183
+ );
184
+ }
185
+ async function getTaxEstimate(customerId, postalCode, items) {
186
+ const custId = resolveCustomerId(customerId, defaultCustomerId);
187
+ const params = { customerId: custId, postalCode, items };
188
+ return withServerCache(
189
+ cachePrefix,
190
+ taxRedisTtl,
191
+ "pricing.taxEngine.create",
192
+ async () => {
193
+ const response = await api.pricing.taxEngine.create(params);
194
+ return response.data;
195
+ },
196
+ params
197
+ );
198
+ }
199
+ return { getItemPrice, batchGetItemPrices, getTaxEstimate };
200
+ }
201
+
202
+ // src/actions/items.ts
203
+ function createItemActions(api, config = {}) {
204
+ const {
205
+ cachePrefix = "",
206
+ edgeCache = 1,
207
+ longEdgeCache = 8,
208
+ redisTtl = 3600,
209
+ longRedisTtl = 28800,
210
+ sortChildren = true,
211
+ sortByPrefix
212
+ } = config;
213
+ function sortCategoryChildren(children) {
214
+ if (!sortChildren) return children;
215
+ return [...children].sort((a, b) => a.sequenceNo - b.sequenceNo);
216
+ }
217
+ async function itemCategoryLookup(path) {
218
+ return withServerCache(
219
+ cachePrefix,
220
+ redisTtl,
221
+ "items.categories.lookup.get",
222
+ async () => {
223
+ const response = await api.items.categories.lookup.get({
224
+ path,
225
+ edgeCache
226
+ });
227
+ return response.data;
228
+ },
229
+ path
230
+ );
231
+ }
232
+ async function getItemCategory(uid, options) {
233
+ const category = await withServerCache(
234
+ cachePrefix,
235
+ redisTtl,
236
+ "items.categories.get",
237
+ async () => {
238
+ const response = await api.items.categories.get(uid, {
239
+ ...options,
240
+ edgeCache
241
+ });
242
+ return response.data;
243
+ },
244
+ uid,
245
+ options
246
+ );
247
+ const cat = category;
248
+ return {
249
+ ...cat,
250
+ children: sortCategoryChildren(cat.children)
251
+ };
252
+ }
253
+ async function getCategoryItems(uid, filters) {
254
+ const merged = { ...filters };
255
+ if (sortByPrefix && typeof merged.sortBy === "string" && merged.sortBy) {
256
+ merged.sortBy = `${sortByPrefix}${merged.sortBy}`;
257
+ }
258
+ return withServerCache(
259
+ cachePrefix,
260
+ redisTtl,
261
+ "items.categories.items.list",
262
+ async () => {
263
+ const response = await api.items.categories.items.list(uid, {
264
+ ...merged,
265
+ edgeCache
266
+ });
267
+ return response.data;
268
+ },
269
+ uid,
270
+ merged
271
+ );
272
+ }
273
+ async function getItemAttributes(categoryUid) {
274
+ return withServerCache(
275
+ cachePrefix,
276
+ redisTtl,
277
+ "items.categories.attributes.list",
278
+ async () => {
279
+ const response = await api.items.categories.attributes.list(
280
+ categoryUid,
281
+ { edgeCache }
282
+ );
283
+ return response.data.attributes;
284
+ },
285
+ categoryUid
286
+ );
287
+ }
288
+ async function getInvMast(uid) {
289
+ return withServerCache(
290
+ cachePrefix,
291
+ redisTtl,
292
+ "items.invMast.get",
293
+ async () => {
294
+ const response = await api.items.invMast.get(uid, { edgeCache: 4 });
295
+ return response.data;
296
+ },
297
+ uid
298
+ );
299
+ }
300
+ async function getInvMastDoc(params) {
301
+ return withServerCache(
302
+ cachePrefix,
303
+ redisTtl,
304
+ "items.invMast.doc.list",
305
+ async () => {
306
+ const response = await api.items.invMast.doc.list(
307
+ params.invMastUid ?? 0,
308
+ {
309
+ itemId: params.itemId,
310
+ includePricing: params.includePricing,
311
+ edgeCache: 4
312
+ }
313
+ );
314
+ return response.data;
315
+ },
316
+ params.invMastUid,
317
+ params.itemId,
318
+ params.includePricing
319
+ );
320
+ }
321
+ async function getStock(invMastUid) {
322
+ return withServerCache(
323
+ cachePrefix,
324
+ redisTtl,
325
+ "items.invMast.stock.list",
326
+ async () => {
327
+ const response = await api.items.invMast.stock.list(invMastUid, {
328
+ edgeCache
329
+ });
330
+ return response.data?.stockData;
331
+ },
332
+ invMastUid
333
+ );
334
+ }
335
+ async function getStockCompanySummary(invMastUid) {
336
+ return withServerCache(
337
+ cachePrefix,
338
+ redisTtl,
339
+ "items.invMast.stock.list.companySummary",
340
+ async () => {
341
+ const response = await api.items.invMast.stock.list(invMastUid, {
342
+ edgeCache
343
+ });
344
+ return response.data?.companySummary;
345
+ },
346
+ invMastUid
347
+ );
348
+ }
349
+ async function getItemFaqs(invMastUid) {
350
+ return withServerCache(
351
+ cachePrefix,
352
+ longRedisTtl,
353
+ "items.invMast.faq.list",
354
+ async () => {
355
+ const response = await api.items.invMast.faq.list(invMastUid, {
356
+ edgeCache: longEdgeCache
357
+ });
358
+ return response.data;
359
+ },
360
+ invMastUid
361
+ );
362
+ }
363
+ async function getItemSubstitutes(invMastUid) {
364
+ return withServerCache(
365
+ cachePrefix,
366
+ longRedisTtl,
367
+ "items.invMast.invSub.list",
368
+ async () => {
369
+ const response = await api.items.invMast.invSub.list(invMastUid, {
370
+ edgeCache: longEdgeCache
371
+ });
372
+ return response.data;
373
+ },
374
+ invMastUid
375
+ );
376
+ }
377
+ async function getItemAccessories(invMastUid) {
378
+ return withServerCache(
379
+ cachePrefix,
380
+ redisTtl,
381
+ "items.invMast.invAccessory.list",
382
+ async () => {
383
+ const response = await api.items.invMast.invAccessory.list(
384
+ invMastUid,
385
+ { edgeCache }
386
+ );
387
+ return response.data;
388
+ },
389
+ invMastUid
390
+ );
391
+ }
392
+ async function getSimilarItems(invMastUid) {
393
+ return withServerCache(
394
+ cachePrefix,
395
+ longRedisTtl,
396
+ "items.invMast.similar.list",
397
+ async () => {
398
+ const response = await api.items.invMast.similar.list(invMastUid, {
399
+ edgeCache: longEdgeCache
400
+ });
401
+ return response.data;
402
+ },
403
+ invMastUid
404
+ );
405
+ }
406
+ async function batchGetInvMastDocs(params) {
407
+ return batchFetch(
408
+ params,
409
+ (p) => getInvMastDoc(p),
410
+ (p) => p.itemId ?? String(p.invMastUid)
411
+ );
412
+ }
413
+ async function batchGetStockData(invMastUids) {
414
+ return batchFetch(invMastUids, (uid) => getStock(uid), (uid) => uid);
415
+ }
416
+ return {
417
+ itemCategoryLookup,
418
+ getItemCategory,
419
+ getCategoryItems,
420
+ getItemAttributes,
421
+ getInvMast,
422
+ getInvMastDoc,
423
+ getStock,
424
+ getStockCompanySummary,
425
+ getItemFaqs,
426
+ getItemSubstitutes,
427
+ getItemAccessories,
428
+ getSimilarItems,
429
+ batchGetInvMastDocs,
430
+ batchGetStockData
431
+ };
432
+ }
433
+
434
+ // src/actions/commerce.ts
435
+ function createCommerceActions(api, config = {}) {
436
+ const { defaultContactId, defaultCustomerId, convertUnitOfMeasure } = config;
437
+ async function cartHdrLookup(params) {
438
+ const lookupParams = { ...params };
439
+ if (lookupParams.contactId == null && defaultContactId != null) {
440
+ lookupParams.contactId = defaultContactId;
441
+ }
442
+ if (lookupParams.customerId == null && defaultCustomerId != null) {
443
+ lookupParams.customerId = defaultCustomerId;
444
+ }
445
+ const response = await api.commerce.cartHdr.lookup.get(lookupParams);
446
+ return response.data;
447
+ }
448
+ async function getCartLines(cartHdrUid) {
449
+ const response = await api.commerce.cartLine.get(cartHdrUid);
450
+ return response.data;
451
+ }
452
+ async function addToCart(cartHdrUid, items) {
453
+ try {
454
+ const mappedItems = items.map((item) => ({
455
+ ...item,
456
+ unitOfMeasure: convertUnitOfMeasure ? convertUnitOfMeasure(item.unitOfMeasure) : item.unitOfMeasure
457
+ }));
458
+ const response = await api.commerce.cartLine.add.create(
459
+ cartHdrUid,
460
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
461
+ { items: mappedItems }
462
+ );
463
+ return response.data;
464
+ } catch {
465
+ return void 0;
466
+ }
467
+ }
468
+ async function updateCartLines(cartHdrUid, lines) {
469
+ try {
470
+ const mappedLines = lines.map((line) => ({
471
+ ...line,
472
+ unitOfMeasure: convertUnitOfMeasure ? convertUnitOfMeasure(line.unitOfMeasure) : line.unitOfMeasure
473
+ }));
474
+ const response = await api.commerce.cartLine.update.create(
475
+ cartHdrUid,
476
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
477
+ { lines: mappedLines }
478
+ );
479
+ return response.data;
480
+ } catch {
481
+ return void 0;
482
+ }
483
+ }
484
+ async function deleteCartItems(cartHdrUid) {
485
+ try {
486
+ await api.commerce.cartLine.delete(cartHdrUid);
487
+ } catch {
488
+ }
489
+ }
490
+ async function getCartAlsoBought(cartHdrUid) {
491
+ const response = await api.commerce.cartHdr.alsoBought.get(cartHdrUid);
492
+ return response.data;
493
+ }
494
+ async function checkoutOrder(cartHdrUid, data) {
495
+ try {
496
+ const response = await api.commerce.checkout.create({
497
+ ...data,
498
+ cartHdrUid
499
+ });
500
+ return response.data;
501
+ } catch {
502
+ return void 0;
503
+ }
504
+ }
505
+ return {
506
+ cartHdrLookup,
507
+ getCartLines,
508
+ addToCart,
509
+ updateCartLines,
510
+ deleteCartItems,
511
+ getCartAlsoBought,
512
+ checkoutOrder
513
+ };
514
+ }
515
+
516
+ // src/actions/orders.ts
517
+ function createOrderActions(api, config = {}) {
518
+ const { cachePrefix = "", edgeCache = 1, redisTtl = 3600 } = config;
519
+ async function getOrderDoc(orderNo, postalCode) {
520
+ return withServerCache(
521
+ cachePrefix,
522
+ redisTtl,
523
+ "orders.oeHdr.doc.get",
524
+ async () => {
525
+ const response = await api.orders.oeHdr.doc.get(Number(orderNo), {
526
+ postalCode,
527
+ edgeCache
528
+ });
529
+ return response.data;
530
+ },
531
+ orderNo,
532
+ postalCode
533
+ );
534
+ }
535
+ return { getOrderDoc };
536
+ }
537
+
538
+ // src/actions/search.ts
539
+ function createSearchActions(api, config = {}) {
540
+ const {
541
+ cachePrefix = "",
542
+ edgeCache = 1,
543
+ redisTtl = 3600,
544
+ defaultSourceFields = "display_desc"
545
+ } = config;
546
+ const openSearch = api.opensearch;
547
+ async function getSearchAttributes(q) {
548
+ const params = { q, edgeCache };
549
+ return withServerCache(
550
+ cachePrefix,
551
+ redisTtl,
552
+ "openSearch.itemSearch.attributes.list",
553
+ async () => {
554
+ const response = (
555
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
556
+ await openSearch.itemSearch.attributes.list(params)
557
+ );
558
+ return response.data.attributes;
559
+ },
560
+ q
561
+ );
562
+ }
563
+ async function getSearchSuggestions(q, limit, offset) {
564
+ const params = { q, edgeCache };
565
+ if (limit !== void 0) params.size = limit;
566
+ if (offset !== void 0) params.from = offset;
567
+ return withServerCache(
568
+ cachePrefix,
569
+ redisTtl,
570
+ "openSearch.suggestions.suggest.list",
571
+ async () => {
572
+ const response = (
573
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
574
+ await openSearch.suggestions.suggest.list(params)
575
+ );
576
+ return response.data;
577
+ },
578
+ q
579
+ );
580
+ }
581
+ async function itemSearch(filters, itemCategoryUid) {
582
+ const params = {
583
+ q: filters.q,
584
+ searchType: "query",
585
+ size: filters.limit,
586
+ from: filters.offset,
587
+ sortBy: filters.sortBy,
588
+ classId5List: itemCategoryUid ? String(itemCategoryUid) : void 0,
589
+ filters: filters.filters?.length ? JSON.stringify(filters.filters) : void 0,
590
+ sourceFieldsList: defaultSourceFields,
591
+ edgeCache
592
+ };
593
+ return withServerCache(
594
+ cachePrefix,
595
+ redisTtl,
596
+ "openSearch.itemSearch.list",
597
+ async () => {
598
+ const response = await openSearch.itemSearch.list(params);
599
+ return response.data;
600
+ },
601
+ filters,
602
+ itemCategoryUid
603
+ );
604
+ }
605
+ async function itemSearchInfinite(filters, itemCategoryUid, pageParam = 0) {
606
+ const params = {
607
+ q: filters.q,
608
+ searchType: "query",
609
+ size: filters.limit,
610
+ from: pageParam,
611
+ sortBy: filters.sortBy,
612
+ classId5List: itemCategoryUid ? String(itemCategoryUid) : void 0,
613
+ filters: filters.filters?.length ? JSON.stringify(filters.filters) : void 0,
614
+ sourceFieldsList: defaultSourceFields,
615
+ edgeCache
616
+ };
617
+ return withServerCache(
618
+ cachePrefix,
619
+ redisTtl,
620
+ "openSearch.itemSearch.list",
621
+ async () => {
622
+ const response = await openSearch.itemSearch.list(params);
623
+ const { items, totalResults } = response.data;
624
+ const nextOffset = pageParam + filters.limit;
625
+ return {
626
+ data: items,
627
+ total: totalResults,
628
+ nextCursor: nextOffset < totalResults ? nextOffset : void 0
629
+ };
630
+ },
631
+ filters,
632
+ itemCategoryUid,
633
+ pageParam
634
+ );
635
+ }
636
+ return {
637
+ getSearchAttributes,
638
+ getSearchSuggestions,
639
+ itemSearch,
640
+ itemSearchInfinite
641
+ };
642
+ }
643
+
644
+ // src/actions/shipping.ts
645
+ function createShippingActions(api, config) {
646
+ const {
647
+ fromAddress,
648
+ defaultServiceCodes,
649
+ cachePrefix = "",
650
+ edgeCache = 1,
651
+ redisTtl = 3600
652
+ } = config;
653
+ async function getShippingRates(toAddress, weight, serviceCodes) {
654
+ const params = {
655
+ fromAddress,
656
+ toAddress: { ...toAddress, country: toAddress.country ?? "US" },
657
+ weight,
658
+ serviceCodes: serviceCodes ?? defaultServiceCodes,
659
+ edgeCache
660
+ };
661
+ return withServerCache(
662
+ cachePrefix,
663
+ redisTtl,
664
+ "ups.ratesShop.get",
665
+ async () => {
666
+ const response = await api.ups.ratesShop.get(params);
667
+ return response.data;
668
+ },
669
+ params
670
+ );
671
+ }
672
+ return { getShippingRates };
673
+ }
674
+
675
+ // src/actions/joomla.ts
676
+ function createJoomlaActions(api, config = {}) {
677
+ const { cachePrefix = "", edgeCache = 1, redisTtl = 3600 } = config;
678
+ async function getJoomlaContent(articleId) {
679
+ return withServerCache(
680
+ cachePrefix,
681
+ redisTtl,
682
+ "joomla.content.doc.get",
683
+ async () => {
684
+ const response = await api.joomla.content.doc.get(articleId, {
685
+ edgeCache
686
+ });
687
+ return response.data;
688
+ },
689
+ articleId
690
+ );
691
+ }
692
+ async function getJoomlaContentList(params) {
693
+ return withServerCache(
694
+ cachePrefix,
695
+ redisTtl,
696
+ "joomla.content.list",
697
+ async () => {
698
+ const response = await api.joomla.content.list({
699
+ ...params,
700
+ edgeCache
701
+ });
702
+ return response.data;
703
+ },
704
+ params
705
+ );
706
+ }
707
+ async function getJoomlaMenu(params) {
708
+ return withServerCache(
709
+ cachePrefix,
710
+ redisTtl,
711
+ "joomla.menu.list",
712
+ async () => {
713
+ const response = await api.joomla.menu.list({
714
+ ...params,
715
+ edgeCache
716
+ });
717
+ return response.data;
718
+ },
719
+ params
720
+ );
721
+ }
722
+ async function getJoomlaMenuDoc(menuId) {
723
+ return withServerCache(
724
+ cachePrefix,
725
+ redisTtl,
726
+ "joomla.menu.doc.get",
727
+ async () => {
728
+ const response = await api.joomla.menu.doc.get(String(menuId));
729
+ return response.data;
730
+ },
731
+ menuId
732
+ );
733
+ }
734
+ async function getUserProfile(userId) {
735
+ return withServerCache(
736
+ cachePrefix,
737
+ redisTtl,
738
+ "joomla.users.doc.get",
739
+ async () => {
740
+ const response = await api.joomla.users.doc.get(userId, {
741
+ edgeCache
742
+ });
743
+ const raw = response.data;
744
+ if (!raw) throw new Error("User not found");
745
+ const customerId = String(
746
+ raw.customerId ?? raw.customer_id ?? raw.p21_customer_id ?? ""
747
+ );
748
+ const groups = Array.isArray(raw.groups) ? raw.groups : [];
749
+ const permissions = groups.map(
750
+ (g2) => String(g2.title ?? g2.name ?? "")
751
+ ).filter(Boolean);
752
+ return {
753
+ id: String(raw.id ?? userId),
754
+ name: String(raw.name ?? ""),
755
+ email: String(raw.email ?? ""),
756
+ customerId,
757
+ permissions
758
+ };
759
+ },
760
+ userId
761
+ );
762
+ }
763
+ return { getJoomlaContent, getJoomlaContentList, getJoomlaMenu, getJoomlaMenuDoc, getUserProfile };
764
+ }
765
+
766
+ // src/actions/legacy.ts
767
+ function createLegacyActions(api, config = {}) {
768
+ const {
769
+ cachePrefix = "",
770
+ edgeCache = 1,
771
+ longEdgeCache = 8,
772
+ redisTtl = 3600,
773
+ longRedisTtl = 28800
774
+ } = config;
775
+ async function getItemWebDesc(invMastUid) {
776
+ return withServerCache(
777
+ cachePrefix,
778
+ redisTtl,
779
+ "legacy.invMast.webDesc.list",
780
+ async () => {
781
+ const response = await api.legacy.invMast.webDesc.list(invMastUid, {
782
+ edgeCache
783
+ });
784
+ return response.data[0];
785
+ },
786
+ invMastUid
787
+ );
788
+ }
789
+ async function getAlsoBoughtItems(invMastUid) {
790
+ return withServerCache(
791
+ cachePrefix,
792
+ redisTtl,
793
+ "legacy.invMast.alsoBought.list",
794
+ async () => {
795
+ const response = await api.legacy.invMast.alsoBought.list(
796
+ invMastUid,
797
+ { edgeCache }
798
+ );
799
+ return response.data;
800
+ },
801
+ invMastUid
802
+ );
803
+ }
804
+ async function getItemTags(invMastUid) {
805
+ return withServerCache(
806
+ cachePrefix,
807
+ redisTtl,
808
+ "legacy.invMast.tags.list",
809
+ async () => {
810
+ const response = await api.legacy.invMast.tags.list(invMastUid, {
811
+ edgeCache
812
+ });
813
+ return response.data;
814
+ },
815
+ invMastUid
816
+ );
817
+ }
818
+ async function getStates(params) {
819
+ return withServerCache(
820
+ cachePrefix,
821
+ longRedisTtl,
822
+ "legacy.legacy.state.list",
823
+ async () => {
824
+ const response = await api.legacy.legacy.state.list({
825
+ ...params,
826
+ edgeCache: longEdgeCache
827
+ });
828
+ return response.data;
829
+ },
830
+ params?.twoLetterCode
831
+ );
832
+ }
833
+ return {
834
+ getItemWebDesc,
835
+ getAlsoBoughtItems,
836
+ getItemTags,
837
+ getStates
838
+ };
839
+ }
840
+
841
+ // src/actions/customers.ts
842
+ function createCustomersActions(api, config = {}) {
843
+ const { cachePrefix = "", edgeCache = 1, redisTtl = 3600 } = config;
844
+ async function getCustomer(customerId) {
845
+ return withServerCache(
846
+ cachePrefix,
847
+ redisTtl,
848
+ "customers.customer.get",
849
+ async () => {
850
+ const response = await api.customers.customer.get(customerId, {
851
+ edgeCache
852
+ });
853
+ return response.data;
854
+ },
855
+ customerId
856
+ );
857
+ }
858
+ async function customerLookup(params) {
859
+ return withServerCache(
860
+ cachePrefix,
861
+ redisTtl,
862
+ "customers.customer.lookup.get",
863
+ async () => {
864
+ const response = await api.customers.customer.lookup.get({
865
+ ...params,
866
+ edgeCache
867
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
868
+ });
869
+ return response.data;
870
+ },
871
+ params
872
+ );
873
+ }
874
+ async function getCustomerDoc(customerId) {
875
+ return withServerCache(
876
+ cachePrefix,
877
+ redisTtl,
878
+ "customers.customer.doc.get",
879
+ async () => {
880
+ const response = await api.customers.customer.doc.get(customerId, {
881
+ edgeCache
882
+ });
883
+ return response.data;
884
+ },
885
+ customerId
886
+ );
887
+ }
888
+ async function getCustomerOrders(customerId, params) {
889
+ return withServerCache(
890
+ cachePrefix,
891
+ redisTtl,
892
+ "customers.customer.orders.list",
893
+ async () => {
894
+ const response = await api.customers.customer.orders.list(customerId, {
895
+ ...params,
896
+ edgeCache
897
+ });
898
+ return { data: response.data, total: response.total };
899
+ },
900
+ customerId,
901
+ params
902
+ );
903
+ }
904
+ async function getCustomerOrderDetail(customerId, orderId) {
905
+ return withServerCache(
906
+ cachePrefix,
907
+ redisTtl,
908
+ "customers.customer.orders.get",
909
+ async () => {
910
+ const response = await api.customers.customer.orders.get(
911
+ customerId,
912
+ orderId,
913
+ { edgeCache }
914
+ );
915
+ return response.data;
916
+ },
917
+ customerId,
918
+ orderId
919
+ );
920
+ }
921
+ async function getCustomerInvoices(customerId, params) {
922
+ return withServerCache(
923
+ cachePrefix,
924
+ redisTtl,
925
+ "customers.customer.invoices.list",
926
+ async () => {
927
+ const response = await api.customers.customer.invoices.list(
928
+ customerId,
929
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
930
+ { ...params, edgeCache }
931
+ );
932
+ return { data: response.data, total: response.total };
933
+ },
934
+ customerId,
935
+ params
936
+ );
937
+ }
938
+ async function getCustomerInvoiceDetail(customerId, invoiceNo) {
939
+ return withServerCache(
940
+ cachePrefix,
941
+ redisTtl,
942
+ "customers.customer.invoices.get",
943
+ async () => {
944
+ const response = await api.customers.customer.invoices.get(
945
+ customerId,
946
+ invoiceNo,
947
+ { edgeCache }
948
+ );
949
+ return response.data;
950
+ },
951
+ customerId,
952
+ invoiceNo
953
+ );
954
+ }
955
+ async function getCustomerQuotes(customerId, params) {
956
+ return withServerCache(
957
+ cachePrefix,
958
+ redisTtl,
959
+ "customers.customer.quotes.list",
960
+ async () => {
961
+ const response = await api.customers.customer.quotes.list(customerId, {
962
+ ...params,
963
+ edgeCache
964
+ });
965
+ return { data: response.data, total: response.total };
966
+ },
967
+ customerId,
968
+ params
969
+ );
970
+ }
971
+ async function getCustomerQuoteDetail(customerId, quoteNo) {
972
+ return withServerCache(
973
+ cachePrefix,
974
+ redisTtl,
975
+ "customers.customer.quotes.get",
976
+ async () => {
977
+ const response = await api.customers.customer.quotes.get(
978
+ customerId,
979
+ quoteNo,
980
+ { edgeCache }
981
+ );
982
+ return response.data;
983
+ },
984
+ customerId,
985
+ quoteNo
986
+ );
987
+ }
988
+ async function getContacts(params) {
989
+ return withServerCache(
990
+ cachePrefix,
991
+ redisTtl,
992
+ "customers.contacts.list",
993
+ async () => {
994
+ const response = await api.customers.contacts.list({
995
+ ...params,
996
+ edgeCache
997
+ });
998
+ return response.data;
999
+ },
1000
+ params
1001
+ );
1002
+ }
1003
+ async function getShipToAddresses(customerId) {
1004
+ return withServerCache(
1005
+ cachePrefix,
1006
+ redisTtl,
1007
+ "customers.customer.shipTo.list",
1008
+ async () => {
1009
+ const response = await api.customers.customer.shipTo.list(customerId, {
1010
+ edgeCache
1011
+ });
1012
+ return response.data;
1013
+ },
1014
+ customerId
1015
+ );
1016
+ }
1017
+ return {
1018
+ getCustomer,
1019
+ customerLookup,
1020
+ getCustomerDoc,
1021
+ getCustomerOrders,
1022
+ getCustomerOrderDetail,
1023
+ getCustomerInvoices,
1024
+ getCustomerInvoiceDetail,
1025
+ getCustomerQuotes,
1026
+ getCustomerQuoteDetail,
1027
+ getContacts,
1028
+ getShipToAddresses
1029
+ };
1030
+ }
1031
+
1032
+ // src/actions/smarty-streets.ts
1033
+ function createSmartyStreetsActions(api, config = {}) {
1034
+ const { cachePrefix: _cachePrefix = "" } = config;
1035
+ async function validateAddress(params) {
1036
+ try {
1037
+ const response = await api.smartyStreets.us.lookup.get(params);
1038
+ const data = response.data;
1039
+ if (data) {
1040
+ return { data, status: "success" };
1041
+ }
1042
+ return { data: void 0, status: "not_found" };
1043
+ } catch (e) {
1044
+ const message = e instanceof Error ? e.message : String(e);
1045
+ return { data: void 0, status: "error", error: { message } };
1046
+ }
1047
+ }
1048
+ return {
1049
+ validateAddress
1050
+ };
1051
+ }
1052
+
1053
+ // src/actions/p21-pim.ts
1054
+ function createP21PimActions(api, config = {}) {
1055
+ const { cachePrefix = "", edgeCache = 1, redisTtl = 3600 } = config;
1056
+ async function getInvMastExt(invMastUid) {
1057
+ return withServerCache(
1058
+ cachePrefix,
1059
+ redisTtl,
1060
+ "p21Pim.invMastExt.get",
1061
+ async () => {
1062
+ const response = await api.p21Pim.invMastExt.get(invMastUid);
1063
+ return response.data;
1064
+ },
1065
+ invMastUid
1066
+ );
1067
+ }
1068
+ async function listInvMastExt(params) {
1069
+ return withServerCache(
1070
+ cachePrefix,
1071
+ redisTtl,
1072
+ "p21Pim.invMastExt.list",
1073
+ async () => {
1074
+ const response = await api.p21Pim.invMastExt.list({
1075
+ ...params,
1076
+ edgeCache
1077
+ });
1078
+ return response.data;
1079
+ },
1080
+ params
1081
+ );
1082
+ }
1083
+ return {
1084
+ getInvMastExt,
1085
+ listInvMastExt
1086
+ };
1087
+ }
1088
+
1089
+ // src/actions/agr-site.ts
1090
+ function createAgrSiteActions(api, config = {}) {
1091
+ const {
1092
+ cachePrefix = "",
1093
+ longEdgeCache = 8,
1094
+ longRedisTtl = 28800
1095
+ } = config;
1096
+ async function getSettings(serviceName) {
1097
+ return withServerCache(
1098
+ cachePrefix,
1099
+ longRedisTtl,
1100
+ "agrSite.settings.list",
1101
+ async () => {
1102
+ const response = await api.agrSite.settings.list({
1103
+ ...serviceName ? { serviceName } : {},
1104
+ edgeCache: longEdgeCache
1105
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1106
+ });
1107
+ return response.data;
1108
+ },
1109
+ serviceName
1110
+ );
1111
+ }
1112
+ async function getMetaFiles(params) {
1113
+ return withServerCache(
1114
+ cachePrefix,
1115
+ longRedisTtl,
1116
+ "agrSite.metaFiles.list",
1117
+ async () => {
1118
+ const response = await api.agrSite.metaFiles.list({
1119
+ ...params,
1120
+ edgeCache: longEdgeCache
1121
+ });
1122
+ return response.data;
1123
+ },
1124
+ params
1125
+ );
1126
+ }
1127
+ return {
1128
+ getSettings,
1129
+ getMetaFiles
1130
+ };
1131
+ }
1132
+
1133
+ // src/actions/avalara.ts
1134
+ function createAvalaraActions(api, config = {}) {
1135
+ const { cachePrefix: _cachePrefix = "" } = config;
1136
+ async function calculateTax(data) {
1137
+ const response = await api.avalara.rates.create(data);
1138
+ return response.data;
1139
+ }
1140
+ return {
1141
+ calculateTax
1142
+ };
1143
+ }
1144
+
1145
+ // src/actions/payments.ts
1146
+ function createPaymentsActions(api, config = {}) {
1147
+ const { cachePrefix: _cachePrefix = "", mode = "live" } = config;
1148
+ function withMode(params) {
1149
+ return { mode, ...params };
1150
+ }
1151
+ async function transactionSetup(params) {
1152
+ try {
1153
+ const response = (
1154
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1155
+ await api.payments.unified.transactionSetup.get(withMode(params))
1156
+ );
1157
+ return response.data;
1158
+ } catch {
1159
+ return void 0;
1160
+ }
1161
+ }
1162
+ async function accountQuery(params) {
1163
+ try {
1164
+ const response = (
1165
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1166
+ await api.payments.unified.accountQuery.get(withMode(params))
1167
+ );
1168
+ return response.data;
1169
+ } catch {
1170
+ return void 0;
1171
+ }
1172
+ }
1173
+ async function getSurcharge(params) {
1174
+ try {
1175
+ const response = (
1176
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1177
+ await api.payments.unified.surcharge.get(withMode(params))
1178
+ );
1179
+ return response.data;
1180
+ } catch {
1181
+ return void 0;
1182
+ }
1183
+ }
1184
+ async function cardInfo(params) {
1185
+ try {
1186
+ const response = (
1187
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1188
+ await api.payments.unified.cardInfo.get(withMode(params))
1189
+ );
1190
+ return response.data;
1191
+ } catch {
1192
+ return void 0;
1193
+ }
1194
+ }
1195
+ async function billingUpdate(params) {
1196
+ try {
1197
+ const response = (
1198
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1199
+ await api.payments.unified.billingUpdate.get(withMode(params))
1200
+ );
1201
+ return response.data;
1202
+ } catch {
1203
+ return void 0;
1204
+ }
1205
+ }
1206
+ async function validatePayment(params) {
1207
+ try {
1208
+ const response = (
1209
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1210
+ await api.payments.unified.validate.get(withMode(params))
1211
+ );
1212
+ return response.data;
1213
+ } catch {
1214
+ return void 0;
1215
+ }
1216
+ }
1217
+ return {
1218
+ transactionSetup,
1219
+ accountQuery,
1220
+ getSurcharge,
1221
+ cardInfo,
1222
+ billingUpdate,
1223
+ validatePayment
1224
+ };
1225
+ }
1226
+
1227
+ // src/actions/ups.ts
1228
+ function createUpsActions(api, config = {}) {
1229
+ const { cachePrefix: _cachePrefix = "" } = config;
1230
+ async function getRates(params) {
1231
+ try {
1232
+ const response = await api.ups.ratesShop.get(params);
1233
+ return response.data;
1234
+ } catch {
1235
+ return void 0;
1236
+ }
1237
+ }
1238
+ return {
1239
+ getRates
1240
+ };
1241
+ }
1242
+
1243
+ // src/actions/logistics.ts
1244
+ function createLogisticsActions(api, config = {}) {
1245
+ const {
1246
+ cachePrefix = "",
1247
+ longEdgeCache = 8,
1248
+ longRedisTtl = 28800
1249
+ } = config;
1250
+ async function getFreightRates(params) {
1251
+ try {
1252
+ const response = await api.logistics.speedship.freight.get(params);
1253
+ return response.data;
1254
+ } catch {
1255
+ return void 0;
1256
+ }
1257
+ }
1258
+ async function getShipVia(params) {
1259
+ return withServerCache(
1260
+ cachePrefix,
1261
+ longRedisTtl,
1262
+ "logistics.shipvia.rates.list",
1263
+ async () => {
1264
+ const response = await api.logistics.shipvia.rates.list({
1265
+ ...params,
1266
+ edgeCache: longEdgeCache
1267
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1268
+ });
1269
+ return response.data;
1270
+ },
1271
+ params ? JSON.stringify(params) : void 0
1272
+ );
1273
+ }
1274
+ return {
1275
+ getFreightRates,
1276
+ getShipVia
1277
+ };
1278
+ }
1279
+
1280
+ // src/actions/nexus.ts
1281
+ function createNexusActions(api, config = {}) {
1282
+ const {
1283
+ cachePrefix = "",
1284
+ edgeCache = 1,
1285
+ redisTtl = 3600
1286
+ } = config;
1287
+ async function createBinTransfer(data) {
1288
+ try {
1289
+ const response = await api.nexus.binTransfer.create(data);
1290
+ return response.data;
1291
+ } catch {
1292
+ return void 0;
1293
+ }
1294
+ }
1295
+ async function createReceiving(data) {
1296
+ try {
1297
+ const response = await api.nexus.receiving.create(data);
1298
+ return response.data;
1299
+ } catch {
1300
+ return void 0;
1301
+ }
1302
+ }
1303
+ async function createTransfer(data) {
1304
+ try {
1305
+ const response = await api.nexus.transfer.create(data);
1306
+ return response.data;
1307
+ } catch {
1308
+ return void 0;
1309
+ }
1310
+ }
1311
+ async function getPurchaseOrderReceipts(params) {
1312
+ return withServerCache(
1313
+ cachePrefix,
1314
+ redisTtl,
1315
+ "nexus.purchaseOrderReceipt.list",
1316
+ async () => {
1317
+ const response = await api.nexus.purchaseOrderReceipt.list({
1318
+ ...params,
1319
+ edgeCache
1320
+ });
1321
+ return response.data;
1322
+ },
1323
+ params ? JSON.stringify(params) : void 0
1324
+ );
1325
+ }
1326
+ async function getTransferReceipts(params) {
1327
+ return withServerCache(
1328
+ cachePrefix,
1329
+ redisTtl,
1330
+ "nexus.transferReceipt.list",
1331
+ async () => {
1332
+ const response = await api.nexus.transferReceipt.list({
1333
+ ...params,
1334
+ edgeCache
1335
+ });
1336
+ return response.data;
1337
+ },
1338
+ params ? JSON.stringify(params) : void 0
1339
+ );
1340
+ }
1341
+ async function getTransferShipping(params) {
1342
+ return withServerCache(
1343
+ cachePrefix,
1344
+ redisTtl,
1345
+ "nexus.transferShipping.list",
1346
+ async () => {
1347
+ const response = await api.nexus.transferShipping.list({
1348
+ ...params,
1349
+ edgeCache
1350
+ });
1351
+ return response.data;
1352
+ },
1353
+ params ? JSON.stringify(params) : void 0
1354
+ );
1355
+ }
1356
+ return {
1357
+ createBinTransfer,
1358
+ createReceiving,
1359
+ createTransfer,
1360
+ getPurchaseOrderReceipts,
1361
+ getTransferReceipts,
1362
+ getTransferShipping
1363
+ };
1364
+ }
1365
+
1366
+ // src/actions/vmi.ts
1367
+ function createVmiActions(api, config = {}) {
1368
+ const {
1369
+ cachePrefix = "",
1370
+ edgeCache = 1,
1371
+ redisTtl = 3600,
1372
+ shortRedisTtl = 300
1373
+ } = config;
1374
+ async function getWarehouses(params) {
1375
+ return withServerCache(
1376
+ cachePrefix,
1377
+ redisTtl,
1378
+ "vmi.warehouse.list",
1379
+ async () => {
1380
+ const response = await api.vmi.warehouse.list({
1381
+ ...params,
1382
+ edgeCache
1383
+ });
1384
+ return response.data;
1385
+ },
1386
+ params ? JSON.stringify(params) : void 0
1387
+ );
1388
+ }
1389
+ async function getWarehouseAvailability(warehouseUid, params) {
1390
+ return withServerCache(
1391
+ cachePrefix,
1392
+ shortRedisTtl,
1393
+ "vmi.warehouse.availability.get",
1394
+ async () => {
1395
+ const response = await api.vmi.warehouse.availability.get(
1396
+ warehouseUid,
1397
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1398
+ { ...params, edgeCache }
1399
+ );
1400
+ return response.data;
1401
+ },
1402
+ warehouseUid,
1403
+ params ? JSON.stringify(params) : void 0
1404
+ );
1405
+ }
1406
+ async function getDistributors(params) {
1407
+ return withServerCache(
1408
+ cachePrefix,
1409
+ redisTtl,
1410
+ "vmi.distributors.list",
1411
+ async () => {
1412
+ const response = await api.vmi.distributors.list({
1413
+ ...params,
1414
+ edgeCache
1415
+ });
1416
+ return response.data;
1417
+ },
1418
+ params ? JSON.stringify(params) : void 0
1419
+ );
1420
+ }
1421
+ async function getProducts(params) {
1422
+ return withServerCache(
1423
+ cachePrefix,
1424
+ redisTtl,
1425
+ "vmi.products.list",
1426
+ async () => {
1427
+ const response = await api.vmi.products.list({
1428
+ ...params,
1429
+ edgeCache
1430
+ });
1431
+ return response.data;
1432
+ },
1433
+ params ? JSON.stringify(params) : void 0
1434
+ );
1435
+ }
1436
+ async function getInventoryProfiles(params) {
1437
+ return withServerCache(
1438
+ cachePrefix,
1439
+ redisTtl,
1440
+ "vmi.invProfileHdr.list",
1441
+ async () => {
1442
+ const response = await api.vmi.invProfileHdr.list({
1443
+ ...params,
1444
+ edgeCache
1445
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1446
+ });
1447
+ return response.data;
1448
+ },
1449
+ params ? JSON.stringify(params) : void 0
1450
+ );
1451
+ }
1452
+ async function getRestockHeaders(params) {
1453
+ return withServerCache(
1454
+ cachePrefix,
1455
+ redisTtl,
1456
+ "vmi.restockHdr.list",
1457
+ async () => {
1458
+ const response = await api.vmi.restockHdr.list({
1459
+ ...params,
1460
+ edgeCache
1461
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1462
+ });
1463
+ return response.data;
1464
+ },
1465
+ params ? JSON.stringify(params) : void 0
1466
+ );
1467
+ }
1468
+ async function getSections(params) {
1469
+ return withServerCache(
1470
+ cachePrefix,
1471
+ redisTtl,
1472
+ "vmi.sections.list",
1473
+ async () => {
1474
+ const response = await api.vmi.sections.list({
1475
+ ...params,
1476
+ edgeCache
1477
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1478
+ });
1479
+ return response.data;
1480
+ },
1481
+ params ? JSON.stringify(params) : void 0
1482
+ );
1483
+ }
1484
+ return {
1485
+ getWarehouses,
1486
+ getWarehouseAvailability,
1487
+ getDistributors,
1488
+ getProducts,
1489
+ getInventoryProfiles,
1490
+ getRestockHeaders,
1491
+ getSections
1492
+ };
1493
+ }
1494
+
1495
+ // src/actions/p21-core.ts
1496
+ function createP21CoreActions(api, config = {}) {
1497
+ const {
1498
+ cachePrefix = "",
1499
+ edgeCache = 1,
1500
+ longEdgeCache = 8,
1501
+ redisTtl = 3600,
1502
+ longRedisTtl = 28800
1503
+ } = config;
1504
+ async function getAddresses(params) {
1505
+ return withServerCache(
1506
+ cachePrefix,
1507
+ redisTtl,
1508
+ "p21Core.address.list",
1509
+ async () => {
1510
+ const response = await api.p21Core.address.list({
1511
+ ...params,
1512
+ edgeCache
1513
+ });
1514
+ return response.data;
1515
+ },
1516
+ params
1517
+ );
1518
+ }
1519
+ async function getCompanies(params) {
1520
+ return withServerCache(
1521
+ cachePrefix,
1522
+ longRedisTtl,
1523
+ "p21Core.company.list",
1524
+ async () => {
1525
+ const response = await api.p21Core.company.list({
1526
+ ...params,
1527
+ edgeCache: longEdgeCache
1528
+ });
1529
+ return response.data;
1530
+ },
1531
+ params
1532
+ );
1533
+ }
1534
+ async function getCompany(companyId) {
1535
+ return withServerCache(
1536
+ cachePrefix,
1537
+ longRedisTtl,
1538
+ "p21Core.company.get",
1539
+ async () => {
1540
+ const response = await api.p21Core.company.get({
1541
+ companyUid: companyId,
1542
+ edgeCache: longEdgeCache
1543
+ });
1544
+ return response.data;
1545
+ },
1546
+ companyId
1547
+ );
1548
+ }
1549
+ async function getLocations(params) {
1550
+ return withServerCache(
1551
+ cachePrefix,
1552
+ longRedisTtl,
1553
+ "p21Core.location.list",
1554
+ async () => {
1555
+ const response = await api.p21Core.location.list({
1556
+ ...params,
1557
+ edgeCache: longEdgeCache
1558
+ });
1559
+ return response.data;
1560
+ },
1561
+ params
1562
+ );
1563
+ }
1564
+ async function getPaymentTypes(params) {
1565
+ return withServerCache(
1566
+ cachePrefix,
1567
+ longRedisTtl,
1568
+ "p21Core.paymentTypes.list",
1569
+ async () => {
1570
+ const response = await api.p21Core.paymentTypes.list({
1571
+ ...params,
1572
+ edgeCache: longEdgeCache
1573
+ });
1574
+ return response.data;
1575
+ },
1576
+ params
1577
+ );
1578
+ }
1579
+ async function getCashDrawers(params) {
1580
+ return withServerCache(
1581
+ cachePrefix,
1582
+ redisTtl,
1583
+ "p21Core.cashDrawer.list",
1584
+ async () => {
1585
+ const response = await api.p21Core.cashDrawer.list({
1586
+ ...params,
1587
+ edgeCache
1588
+ });
1589
+ return response.data;
1590
+ },
1591
+ params
1592
+ );
1593
+ }
1594
+ async function getCodeP21(params) {
1595
+ return withServerCache(
1596
+ cachePrefix,
1597
+ longRedisTtl,
1598
+ "p21Core.codeP21.list",
1599
+ async () => {
1600
+ const response = await api.p21Core.codeP21.list({
1601
+ ...params,
1602
+ edgeCache: longEdgeCache
1603
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1604
+ });
1605
+ return response.data;
1606
+ },
1607
+ params
1608
+ );
1609
+ }
1610
+ return {
1611
+ getAddresses,
1612
+ getCompanies,
1613
+ getCompany,
1614
+ getLocations,
1615
+ getPaymentTypes,
1616
+ getCashDrawers,
1617
+ getCodeP21
1618
+ };
1619
+ }
1620
+
1621
+ // src/actions/p21-apis.ts
1622
+ function createP21ApisActions(api, config = {}) {
1623
+ const {
1624
+ cachePrefix = "",
1625
+ edgeCache = 1,
1626
+ redisTtl = 3600
1627
+ } = config;
1628
+ async function getCategories(params) {
1629
+ return withServerCache(
1630
+ cachePrefix,
1631
+ redisTtl,
1632
+ "p21Apis.transCategory.list",
1633
+ async () => {
1634
+ const response = await api.p21Apis.transCategory.list({
1635
+ ...params,
1636
+ edgeCache
1637
+ });
1638
+ return response.data;
1639
+ },
1640
+ params
1641
+ );
1642
+ }
1643
+ async function getCategoryDefaults(categoryId) {
1644
+ return withServerCache(
1645
+ cachePrefix,
1646
+ redisTtl,
1647
+ "p21Apis.transCategory.defaults.get",
1648
+ async () => {
1649
+ const response = await api.p21Apis.transCategory.defaults.get(
1650
+ categoryId,
1651
+ { edgeCache }
1652
+ );
1653
+ return response.data;
1654
+ },
1655
+ categoryId
1656
+ );
1657
+ }
1658
+ async function getCompanies(params) {
1659
+ return withServerCache(
1660
+ cachePrefix,
1661
+ redisTtl,
1662
+ "p21Apis.transCompany.list",
1663
+ async () => {
1664
+ const response = await api.p21Apis.transCompany.list({
1665
+ ...params,
1666
+ edgeCache
1667
+ });
1668
+ return response.data;
1669
+ },
1670
+ params
1671
+ );
1672
+ }
1673
+ async function getUsers(params) {
1674
+ return withServerCache(
1675
+ cachePrefix,
1676
+ redisTtl,
1677
+ "p21Apis.transUser.list",
1678
+ async () => {
1679
+ const response = await api.p21Apis.transUser.list({
1680
+ ...params,
1681
+ edgeCache
1682
+ });
1683
+ return response.data;
1684
+ },
1685
+ params
1686
+ );
1687
+ }
1688
+ async function getWebDisplayTypes(params) {
1689
+ return withServerCache(
1690
+ cachePrefix,
1691
+ redisTtl,
1692
+ "p21Apis.transWebDisplayType.list",
1693
+ async () => {
1694
+ const response = await api.p21Apis.transWebDisplayType.list({
1695
+ ...params,
1696
+ edgeCache
1697
+ });
1698
+ return response.data;
1699
+ },
1700
+ params
1701
+ );
1702
+ }
1703
+ async function getWebDisplayTypeDefaults(id) {
1704
+ return withServerCache(
1705
+ cachePrefix,
1706
+ redisTtl,
1707
+ "p21Apis.transWebDisplayType.defaults.get",
1708
+ async () => {
1709
+ const response = await api.p21Apis.transWebDisplayType.defaults.get({
1710
+ id,
1711
+ edgeCache
1712
+ });
1713
+ return response.data;
1714
+ },
1715
+ id
1716
+ );
1717
+ }
1718
+ async function refreshContacts(params) {
1719
+ try {
1720
+ const response = (
1721
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1722
+ await api.p21Apis.entityContacts.refresh.create(params)
1723
+ );
1724
+ return response.data;
1725
+ } catch {
1726
+ return void 0;
1727
+ }
1728
+ }
1729
+ async function refreshCustomers(params) {
1730
+ try {
1731
+ const response = (
1732
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1733
+ await api.p21Apis.entityCustomers.refresh.create(params)
1734
+ );
1735
+ return response.data;
1736
+ } catch {
1737
+ return void 0;
1738
+ }
1739
+ }
1740
+ return {
1741
+ getCategories,
1742
+ getCategoryDefaults,
1743
+ getCompanies,
1744
+ getUsers,
1745
+ getWebDisplayTypes,
1746
+ getWebDisplayTypeDefaults,
1747
+ refreshContacts,
1748
+ refreshCustomers
1749
+ };
1750
+ }
1751
+
1752
+ // src/actions/p21-sism.ts
1753
+ function createP21SismActions(api, config = {}) {
1754
+ const {
1755
+ cachePrefix = "",
1756
+ edgeCache = 1,
1757
+ redisTtl = 3600
1758
+ } = config;
1759
+ async function getRecentImports(params) {
1760
+ return withServerCache(
1761
+ cachePrefix,
1762
+ redisTtl,
1763
+ "p21Sism.import.recent.list",
1764
+ async () => {
1765
+ const response = await api.p21Sism.import.recent.list({
1766
+ ...params,
1767
+ edgeCache
1768
+ });
1769
+ return response.data;
1770
+ },
1771
+ params
1772
+ );
1773
+ }
1774
+ async function getImport(importId) {
1775
+ return withServerCache(
1776
+ cachePrefix,
1777
+ redisTtl,
1778
+ "p21Sism.import.get",
1779
+ async () => {
1780
+ const response = await api.p21Sism.import.get(importId);
1781
+ return response.data;
1782
+ },
1783
+ importId
1784
+ );
1785
+ }
1786
+ async function getImportLines(importId, params) {
1787
+ return withServerCache(
1788
+ cachePrefix,
1789
+ redisTtl,
1790
+ "p21Sism.impOeLine.list",
1791
+ async () => {
1792
+ const response = await api.p21Sism.impOeLine.list({
1793
+ ...params,
1794
+ importUid: importId,
1795
+ edgeCache
1796
+ });
1797
+ return response.data;
1798
+ },
1799
+ importId,
1800
+ params
1801
+ );
1802
+ }
1803
+ async function getScheduledImports(params) {
1804
+ return withServerCache(
1805
+ cachePrefix,
1806
+ redisTtl,
1807
+ "p21Sism.scheduledImportMaster.list",
1808
+ async () => {
1809
+ const response = await api.p21Sism.scheduledImportMaster.list({
1810
+ ...params,
1811
+ edgeCache
1812
+ });
1813
+ return response.data;
1814
+ },
1815
+ params
1816
+ );
1817
+ }
1818
+ return {
1819
+ getRecentImports,
1820
+ getImport,
1821
+ getImportLines,
1822
+ getScheduledImports
1823
+ };
1824
+ }
1825
+
1826
+ // src/actions/agr-work.ts
1827
+ function createAgrWorkActions(api, _config = {}) {
1828
+ async function healthCheck() {
1829
+ try {
1830
+ const response = await api.agrWork.healthCheck.get();
1831
+ return response.data;
1832
+ } catch {
1833
+ return void 0;
1834
+ }
1835
+ }
1836
+ async function ping() {
1837
+ try {
1838
+ const response = await api.agrWork.ping.get();
1839
+ return response.data;
1840
+ } catch {
1841
+ return void 0;
1842
+ }
1843
+ }
1844
+ return {
1845
+ healthCheck,
1846
+ ping
1847
+ };
1848
+ }
1849
+
1850
+ // src/actions/agr-info.ts
1851
+ function createAgrInfoActions(api, config = {}) {
1852
+ const {
1853
+ cachePrefix = "",
1854
+ edgeCache = 1,
1855
+ longEdgeCache = 8,
1856
+ redisTtl = 3600,
1857
+ longRedisTtl = 28800
1858
+ } = config;
1859
+ async function getContext(params) {
1860
+ return withServerCache(
1861
+ cachePrefix,
1862
+ redisTtl,
1863
+ "agrInfo.context.list",
1864
+ async () => {
1865
+ const siteId = params?.siteId ?? "";
1866
+ const response = await api.agrInfo.context.get(siteId, {
1867
+ ...params,
1868
+ edgeCache
1869
+ });
1870
+ return Array.isArray(response.data) ? response.data : [response.data];
1871
+ },
1872
+ params
1873
+ );
1874
+ }
1875
+ async function getRubrics(params) {
1876
+ return withServerCache(
1877
+ cachePrefix,
1878
+ redisTtl,
1879
+ "agrInfo.rubrics.list",
1880
+ async () => {
1881
+ const response = await api.agrInfo.rubrics.list({
1882
+ ...params,
1883
+ edgeCache
1884
+ });
1885
+ return response.data;
1886
+ },
1887
+ params
1888
+ );
1889
+ }
1890
+ async function getMicroservices(params) {
1891
+ return withServerCache(
1892
+ cachePrefix,
1893
+ longRedisTtl,
1894
+ "agrInfo.microservices.list",
1895
+ async () => {
1896
+ const response = await api.agrInfo.microservices.list({
1897
+ ...params,
1898
+ edgeCache: longEdgeCache
1899
+ });
1900
+ return response.data;
1901
+ },
1902
+ params
1903
+ );
1904
+ }
1905
+ async function generateAkasha(data) {
1906
+ try {
1907
+ const response = await api.agrInfo.akasha.generate.create(data);
1908
+ return response.data;
1909
+ } catch {
1910
+ return void 0;
1911
+ }
1912
+ }
1913
+ async function generateJoomla(data) {
1914
+ try {
1915
+ const response = await api.agrInfo.joomla.generate.create(data);
1916
+ return response.data;
1917
+ } catch {
1918
+ return void 0;
1919
+ }
1920
+ }
1921
+ return {
1922
+ getContext,
1923
+ getRubrics,
1924
+ getMicroservices,
1925
+ generateAkasha,
1926
+ generateJoomla
1927
+ };
1928
+ }
1929
+
1930
+ // src/actions/basecamp2.ts
1931
+ function createBasecamp2Actions(api, config = {}) {
1932
+ const {
1933
+ cachePrefix = "",
1934
+ edgeCache = 1,
1935
+ longEdgeCache = 8,
1936
+ redisTtl = 3600,
1937
+ longRedisTtl = 28800
1938
+ } = config;
1939
+ async function getTodos(params) {
1940
+ return withServerCache(
1941
+ cachePrefix,
1942
+ redisTtl,
1943
+ "basecamp2.todos.list",
1944
+ async () => {
1945
+ const response = await api.basecamp2.todos.list({
1946
+ ...params,
1947
+ edgeCache
1948
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1949
+ });
1950
+ return response.data;
1951
+ },
1952
+ params
1953
+ );
1954
+ }
1955
+ async function getTodo(todoId) {
1956
+ return withServerCache(
1957
+ cachePrefix,
1958
+ redisTtl,
1959
+ "basecamp2.todos.get",
1960
+ async () => {
1961
+ const response = await api.basecamp2.todos.get(todoId, { edgeCache });
1962
+ return response.data;
1963
+ },
1964
+ todoId
1965
+ );
1966
+ }
1967
+ async function getTodosSummary(params) {
1968
+ return withServerCache(
1969
+ cachePrefix,
1970
+ redisTtl,
1971
+ "basecamp2.todosSummary.list",
1972
+ async () => {
1973
+ const response = await api.basecamp2.todosSummary.list({
1974
+ ...params,
1975
+ edgeCache
1976
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1977
+ });
1978
+ return response.data;
1979
+ },
1980
+ params
1981
+ );
1982
+ }
1983
+ async function getComments(params) {
1984
+ return withServerCache(
1985
+ cachePrefix,
1986
+ redisTtl,
1987
+ "basecamp2.comments.list",
1988
+ async () => {
1989
+ const response = await api.basecamp2.comments.list({
1990
+ ...params,
1991
+ edgeCache
1992
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
1993
+ });
1994
+ return response.data;
1995
+ },
1996
+ params
1997
+ );
1998
+ }
1999
+ async function getPeople(params) {
2000
+ return withServerCache(
2001
+ cachePrefix,
2002
+ longRedisTtl,
2003
+ "basecamp2.people.list",
2004
+ async () => {
2005
+ const response = await api.basecamp2.people.list({
2006
+ ...params,
2007
+ edgeCache: longEdgeCache
2008
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
2009
+ });
2010
+ return response.data;
2011
+ },
2012
+ params
2013
+ );
2014
+ }
2015
+ async function getProjects(params) {
2016
+ return withServerCache(
2017
+ cachePrefix,
2018
+ redisTtl,
2019
+ "basecamp2.projects.list",
2020
+ async () => {
2021
+ const response = await api.basecamp2.projects.list({
2022
+ ...params,
2023
+ edgeCache
2024
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
2025
+ });
2026
+ return response.data;
2027
+ },
2028
+ params
2029
+ );
2030
+ }
2031
+ async function getEvents(params) {
2032
+ return withServerCache(
2033
+ cachePrefix,
2034
+ redisTtl,
2035
+ "basecamp2.events.list",
2036
+ async () => {
2037
+ const response = await api.basecamp2.events.list({
2038
+ ...params,
2039
+ edgeCache
2040
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
2041
+ });
2042
+ return response.data;
2043
+ },
2044
+ params
2045
+ );
2046
+ }
2047
+ async function getMetrics(params) {
2048
+ return withServerCache(
2049
+ cachePrefix,
2050
+ redisTtl,
2051
+ "basecamp2.metrics.list",
2052
+ async () => {
2053
+ const response = await api.basecamp2.metrics.list({
2054
+ ...params,
2055
+ edgeCache
2056
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
2057
+ });
2058
+ return response.data;
2059
+ },
2060
+ params
2061
+ );
2062
+ }
2063
+ async function getTodolists(params) {
2064
+ return withServerCache(
2065
+ cachePrefix,
2066
+ redisTtl,
2067
+ "basecamp2.todolists.list",
2068
+ async () => {
2069
+ const response = await api.basecamp2.todolists.list({
2070
+ ...params,
2071
+ edgeCache
2072
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
2073
+ });
2074
+ return response.data;
2075
+ },
2076
+ params
2077
+ );
2078
+ }
2079
+ return {
2080
+ getTodos,
2081
+ getTodo,
2082
+ getTodosSummary,
2083
+ getComments,
2084
+ getPeople,
2085
+ getProjects,
2086
+ getEvents,
2087
+ getMetrics,
2088
+ getTodolists
2089
+ };
2090
+ }
2091
+
2092
+ // src/actions/brand-folder.ts
2093
+ function createBrandFolderActions(api, config = {}) {
2094
+ const { cachePrefix = "", edgeCache = 1, redisTtl = 3600 } = config;
2095
+ async function getCategories(params) {
2096
+ return withServerCache(
2097
+ cachePrefix,
2098
+ redisTtl,
2099
+ "brandFolder.categories.list",
2100
+ async () => {
2101
+ const response = await api.brandFolder.categories.list({
2102
+ ...params,
2103
+ edgeCache
2104
+ });
2105
+ return response.data;
2106
+ },
2107
+ params
2108
+ );
2109
+ }
2110
+ async function getCategory(categoryId) {
2111
+ return withServerCache(
2112
+ cachePrefix,
2113
+ redisTtl,
2114
+ "brandFolder.categories.get",
2115
+ async () => {
2116
+ const response = await api.brandFolder.categories.get(categoryId, {
2117
+ edgeCache
2118
+ });
2119
+ return response.data;
2120
+ },
2121
+ categoryId
2122
+ );
2123
+ }
2124
+ async function createFocus(categoryId, data) {
2125
+ try {
2126
+ const response = await api.brandFolder.categories.focus.create({
2127
+ ...data,
2128
+ categoryId
2129
+ });
2130
+ return response.data;
2131
+ } catch {
2132
+ return void 0;
2133
+ }
2134
+ }
2135
+ return {
2136
+ getCategories,
2137
+ getCategory,
2138
+ createFocus
2139
+ };
2140
+ }
2141
+
2142
+ // src/actions/gregorovich.ts
2143
+ function createGregorovichActions(api, config = {}) {
2144
+ const { cachePrefix = "", redisTtl = 3600 } = config;
2145
+ async function askChatGpt(params) {
2146
+ try {
2147
+ const response = await api.gregorovich.chatGpt.ask.get(params);
2148
+ return response.data;
2149
+ } catch {
2150
+ return void 0;
2151
+ }
2152
+ }
2153
+ async function getDocuments(params) {
2154
+ return withServerCache(
2155
+ cachePrefix,
2156
+ redisTtl,
2157
+ "gregorovich.documents.list",
2158
+ async () => {
2159
+ const response = await api.gregorovich.documents.list();
2160
+ return response.data;
2161
+ },
2162
+ params
2163
+ );
2164
+ }
2165
+ async function createDocument(data) {
2166
+ try {
2167
+ const response = await api.gregorovich.documents.create(data);
2168
+ return response.data;
2169
+ } catch {
2170
+ return void 0;
2171
+ }
2172
+ }
2173
+ async function generateOllama(data) {
2174
+ try {
2175
+ const response = await api.gregorovich.ollama.generate.create(data);
2176
+ return response.data;
2177
+ } catch {
2178
+ return void 0;
2179
+ }
2180
+ }
2181
+ return {
2182
+ askChatGpt,
2183
+ getDocuments,
2184
+ createDocument,
2185
+ generateOllama
2186
+ };
2187
+ }
2188
+
2189
+ // src/actions/slack.ts
2190
+ function createSlackActions(api, config = {}) {
2191
+ const { cachePrefix = "", edgeCache = 1, redisTtl = 3600 } = config;
2192
+ async function sendWebhook(data) {
2193
+ try {
2194
+ const response = await api.slack.webHook.create(data);
2195
+ return response.data;
2196
+ } catch {
2197
+ return void 0;
2198
+ }
2199
+ }
2200
+ async function getWebhooks(params) {
2201
+ return withServerCache(
2202
+ cachePrefix,
2203
+ redisTtl,
2204
+ "slack.webHook.list",
2205
+ async () => {
2206
+ const response = await api.slack.webHook.list({
2207
+ ...params,
2208
+ edgeCache
2209
+ });
2210
+ return response.data;
2211
+ },
2212
+ params
2213
+ );
2214
+ }
2215
+ return {
2216
+ sendWebhook,
2217
+ getWebhooks
2218
+ };
2219
+ }
2220
+
2221
+ // src/actions/site.ts
2222
+ function createSiteActions(api, config = {}) {
2223
+ const {
2224
+ cachePrefix,
2225
+ edgeCache,
2226
+ redisTtl,
2227
+ longEdgeCache,
2228
+ longRedisTtl,
2229
+ defaultContactId,
2230
+ defaultCustomerId,
2231
+ convertUnitOfMeasure
2232
+ } = config;
2233
+ const cache = { cachePrefix, edgeCache, redisTtl };
2234
+ const longCache = { ...cache, longEdgeCache, longRedisTtl };
2235
+ function castApi() {
2236
+ return api;
2237
+ }
2238
+ function lazy(fn) {
2239
+ let instance;
2240
+ return {
2241
+ get() {
2242
+ if (instance === void 0) instance = fn();
2243
+ return instance;
2244
+ }
2245
+ };
2246
+ }
2247
+ const pricing = lazy(
2248
+ () => createPricingActions(castApi(), {
2249
+ ...cache,
2250
+ defaultCustomerId,
2251
+ ...config.pricing
2252
+ })
2253
+ );
2254
+ const items = lazy(
2255
+ () => createItemActions(castApi(), {
2256
+ ...longCache,
2257
+ ...config.items
2258
+ })
2259
+ );
2260
+ const commerce = lazy(
2261
+ () => createCommerceActions(castApi(), {
2262
+ defaultContactId,
2263
+ defaultCustomerId,
2264
+ convertUnitOfMeasure
2265
+ })
2266
+ );
2267
+ const search = lazy(
2268
+ () => createSearchActions(castApi(), {
2269
+ ...cache,
2270
+ ...config.search
2271
+ })
2272
+ );
2273
+ const orders = lazy(
2274
+ () => createOrderActions(castApi(), cache)
2275
+ );
2276
+ const shipping = lazy(
2277
+ () => createShippingActions(
2278
+ castApi(),
2279
+ { ...cache, ...config.shipping }
2280
+ )
2281
+ );
2282
+ const joomla = lazy(
2283
+ () => createJoomlaActions(castApi(), cache)
2284
+ );
2285
+ const legacy = lazy(
2286
+ () => createLegacyActions(castApi(), longCache)
2287
+ );
2288
+ const customers = lazy(
2289
+ () => createCustomersActions(castApi(), cache)
2290
+ );
2291
+ const smartyStreets = lazy(
2292
+ () => createSmartyStreetsActions(castApi(), {
2293
+ cachePrefix
2294
+ })
2295
+ );
2296
+ const p21Pim = lazy(
2297
+ () => createP21PimActions(castApi(), cache)
2298
+ );
2299
+ const agrSite = lazy(
2300
+ () => createAgrSiteActions(castApi(), {
2301
+ cachePrefix,
2302
+ longEdgeCache,
2303
+ longRedisTtl
2304
+ })
2305
+ );
2306
+ const avalara = lazy(
2307
+ () => createAvalaraActions(castApi(), { cachePrefix })
2308
+ );
2309
+ const payments = lazy(
2310
+ () => createPaymentsActions(castApi(), {
2311
+ cachePrefix,
2312
+ ...config.payments
2313
+ })
2314
+ );
2315
+ const ups = lazy(
2316
+ () => createUpsActions(castApi(), { cachePrefix })
2317
+ );
2318
+ const logistics = lazy(
2319
+ () => createLogisticsActions(castApi(), longCache)
2320
+ );
2321
+ const nexus = lazy(
2322
+ () => createNexusActions(castApi(), cache)
2323
+ );
2324
+ const vmi = lazy(
2325
+ () => createVmiActions(castApi(), { ...cache, ...config.vmi })
2326
+ );
2327
+ const p21Core = lazy(
2328
+ () => createP21CoreActions(castApi(), longCache)
2329
+ );
2330
+ const p21Apis = lazy(
2331
+ () => createP21ApisActions(castApi(), cache)
2332
+ );
2333
+ const p21Sism = lazy(
2334
+ () => createP21SismActions(castApi(), cache)
2335
+ );
2336
+ const agrWork = lazy(
2337
+ () => createAgrWorkActions(castApi(), { cachePrefix })
2338
+ );
2339
+ const agrInfo = lazy(
2340
+ () => createAgrInfoActions(castApi(), longCache)
2341
+ );
2342
+ const basecamp2 = lazy(
2343
+ () => createBasecamp2Actions(castApi(), longCache)
2344
+ );
2345
+ const brandFolder = lazy(
2346
+ () => createBrandFolderActions(castApi(), cache)
2347
+ );
2348
+ const gregorovich = lazy(
2349
+ () => createGregorovichActions(castApi(), cache)
2350
+ );
2351
+ const slack = lazy(
2352
+ () => createSlackActions(castApi(), cache)
2353
+ );
2354
+ return {
2355
+ get pricing() {
2356
+ return pricing.get();
2357
+ },
2358
+ get items() {
2359
+ return items.get();
2360
+ },
2361
+ get commerce() {
2362
+ return commerce.get();
2363
+ },
2364
+ get search() {
2365
+ return search.get();
2366
+ },
2367
+ get orders() {
2368
+ return orders.get();
2369
+ },
2370
+ get shipping() {
2371
+ return shipping.get();
2372
+ },
2373
+ get joomla() {
2374
+ return joomla.get();
2375
+ },
2376
+ get legacy() {
2377
+ return legacy.get();
2378
+ },
2379
+ get customers() {
2380
+ return customers.get();
2381
+ },
2382
+ get smartyStreets() {
2383
+ return smartyStreets.get();
2384
+ },
2385
+ get p21Pim() {
2386
+ return p21Pim.get();
2387
+ },
2388
+ get agrSite() {
2389
+ return agrSite.get();
2390
+ },
2391
+ get avalara() {
2392
+ return avalara.get();
2393
+ },
2394
+ get payments() {
2395
+ return payments.get();
2396
+ },
2397
+ get ups() {
2398
+ return ups.get();
2399
+ },
2400
+ get logistics() {
2401
+ return logistics.get();
2402
+ },
2403
+ get nexus() {
2404
+ return nexus.get();
2405
+ },
2406
+ get vmi() {
2407
+ return vmi.get();
2408
+ },
2409
+ get p21Core() {
2410
+ return p21Core.get();
2411
+ },
2412
+ get p21Apis() {
2413
+ return p21Apis.get();
2414
+ },
2415
+ get p21Sism() {
2416
+ return p21Sism.get();
2417
+ },
2418
+ get agrWork() {
2419
+ return agrWork.get();
2420
+ },
2421
+ get agrInfo() {
2422
+ return agrInfo.get();
2423
+ },
2424
+ get basecamp2() {
2425
+ return basecamp2.get();
2426
+ },
2427
+ get brandFolder() {
2428
+ return brandFolder.get();
2429
+ },
2430
+ get gregorovich() {
2431
+ return gregorovich.get();
2432
+ },
2433
+ get slack() {
2434
+ return slack.get();
2435
+ }
2436
+ };
2437
+ }
2438
+
2439
+ export {
2440
+ env,
2441
+ isDev,
2442
+ isStaging,
2443
+ isProduction,
2444
+ cacheGet,
2445
+ cacheSet,
2446
+ getCircuitState,
2447
+ isRedisConnected,
2448
+ withServerCache,
2449
+ createPricingActions,
2450
+ createItemActions,
2451
+ createCommerceActions,
2452
+ createOrderActions,
2453
+ createSearchActions,
2454
+ createShippingActions,
2455
+ createJoomlaActions,
2456
+ createLegacyActions,
2457
+ createCustomersActions,
2458
+ createSmartyStreetsActions,
2459
+ createP21PimActions,
2460
+ createAgrSiteActions,
2461
+ createAvalaraActions,
2462
+ createPaymentsActions,
2463
+ createUpsActions,
2464
+ createLogisticsActions,
2465
+ createNexusActions,
2466
+ createVmiActions,
2467
+ createP21CoreActions,
2468
+ createP21ApisActions,
2469
+ createP21SismActions,
2470
+ createAgrWorkActions,
2471
+ createAgrInfoActions,
2472
+ createBasecamp2Actions,
2473
+ createBrandFolderActions,
2474
+ createGregorovichActions,
2475
+ createSlackActions,
2476
+ createSiteActions
2477
+ };
2478
+ //# sourceMappingURL=chunk-7GPKSSS7.js.map