@simpleapps-com/augur-server 0.2.7 → 0.2.9

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,1912 @@
1
+ import { TPriceData, TTaxItem, TTax, TCategory, TAttribute, TInvMast, TInvMastDoc, TStockData, TItemAccessory, TStock, TCartLookUp, TCartLine, TProductItem, TWebDesc } from '@simpleapps-com/augur-utils';
2
+
3
+ /**
4
+ * The subset of augur-api used by pricing actions.
5
+ * Avoids importing the full SDK type so augur-server stays lightweight.
6
+ */
7
+ interface PricingApiClient {
8
+ pricing: {
9
+ priceEngine: {
10
+ get: (params: Record<string, unknown>) => Promise<{
11
+ data: TPriceData;
12
+ }>;
13
+ };
14
+ taxEngine: {
15
+ create: (params: Record<string, unknown>) => Promise<{
16
+ data: TTax;
17
+ }>;
18
+ };
19
+ };
20
+ }
21
+ interface PricingActionsConfig {
22
+ /** Default customer ID when none is provided by the caller. */
23
+ defaultCustomerId?: string | number;
24
+ /** Cache key prefix (e.g. "ampro:"). Default: "". */
25
+ cachePrefix?: string;
26
+ /** CDN edge cache value passed to SDK. Default: 2 (hours). */
27
+ edgeCache?: number;
28
+ /** Redis TTL for price lookups in seconds. Default: 3600 (1 hour). */
29
+ redisTtl?: number;
30
+ /** Redis TTL for tax lookups in seconds. Default: 1800 (30 min). */
31
+ taxRedisTtl?: number;
32
+ }
33
+ interface PricingActions {
34
+ getItemPrice: (itemId: string, customerId?: string | number, quantity?: number) => Promise<TPriceData>;
35
+ batchGetItemPrices: (itemIds: string[], customerId?: string | number, quantity?: number) => Promise<Record<string, TPriceData>>;
36
+ getTaxEstimate: (customerId: string | number, postalCode: string, items: TTaxItem[]) => Promise<TTax>;
37
+ }
38
+ /**
39
+ * Creates server-side pricing actions with Redis caching and edge cache support.
40
+ *
41
+ * Uses `withServerCache` which produces cache keys compatible with augur-hooks'
42
+ * `withCache`, so server-prefetched data is shared with client-side hooks.
43
+ *
44
+ * @example
45
+ * ```ts
46
+ * // lib/pricing-actions.ts
47
+ * import { createPricingActions } from "@simpleapps-com/augur-server";
48
+ * import { getAugurClient } from "./augur-client";
49
+ *
50
+ * export const pricingActions = createPricingActions(getAugurClient(), {
51
+ * defaultCustomerId: process.env.NEXT_PUBLIC_DEFAULT_CUSTOMER_ID,
52
+ * cachePrefix: "ampro:",
53
+ * });
54
+ *
55
+ * // In a server component:
56
+ * const price = await pricingActions.getItemPrice("ITEM-1");
57
+ * const prices = await pricingActions.batchGetItemPrices(["ITEM-1", "ITEM-2"]);
58
+ * ```
59
+ */
60
+ declare function createPricingActions(api: PricingApiClient, config?: PricingActionsConfig): PricingActions;
61
+
62
+ /**
63
+ * The subset of augur-api used by item actions.
64
+ * Avoids importing the full SDK type so augur-server stays lightweight.
65
+ */
66
+ interface ItemsApiClient {
67
+ items: {
68
+ categories: {
69
+ get: (uid: number, params?: Record<string, unknown>) => Promise<{
70
+ data: TCategory;
71
+ }>;
72
+ lookup: {
73
+ get: (params: Record<string, unknown>) => Promise<{
74
+ data: unknown;
75
+ }>;
76
+ };
77
+ items: {
78
+ list: (params: Record<string, unknown>) => Promise<{
79
+ data: unknown;
80
+ }>;
81
+ };
82
+ attributes: {
83
+ list: (uid: number, params?: Record<string, unknown>) => Promise<{
84
+ data: {
85
+ attributes: TAttribute[];
86
+ };
87
+ }>;
88
+ };
89
+ };
90
+ invMast: {
91
+ get: (uid: number, params?: Record<string, unknown>) => Promise<{
92
+ data: TInvMast;
93
+ }>;
94
+ doc: {
95
+ list: (uid: number, params?: Record<string, unknown>) => Promise<{
96
+ data: TInvMastDoc;
97
+ }>;
98
+ };
99
+ stock: {
100
+ list: (uid: number, params?: Record<string, unknown>) => Promise<{
101
+ data: TStock;
102
+ }>;
103
+ };
104
+ faq: {
105
+ list: (uid: number, params?: Record<string, unknown>) => Promise<{
106
+ data: unknown[];
107
+ }>;
108
+ };
109
+ invSub: {
110
+ list: (uid: number, params?: Record<string, unknown>) => Promise<{
111
+ data: unknown[];
112
+ }>;
113
+ };
114
+ invAccessory: {
115
+ list: (uid: number, params?: Record<string, unknown>) => Promise<{
116
+ data: TItemAccessory[];
117
+ }>;
118
+ };
119
+ similar: {
120
+ list: (uid: number, params?: Record<string, unknown>) => Promise<{
121
+ data: unknown[];
122
+ }>;
123
+ };
124
+ };
125
+ };
126
+ }
127
+ interface ItemActionsConfig {
128
+ /** Cache key prefix (e.g. "ampro:"). Default: "". */
129
+ cachePrefix?: string;
130
+ /** CDN edge cache value for most calls. Default: 1 (hour). */
131
+ edgeCache?: number;
132
+ /** CDN edge cache for rarely-changing data like FAQs. Default: 8 (hours). */
133
+ longEdgeCache?: number;
134
+ /** Redis TTL for most calls in seconds. Default: 3600 (1 hour). */
135
+ redisTtl?: number;
136
+ /** Redis TTL for rarely-changing data in seconds. Default: 28800 (8 hours). */
137
+ longRedisTtl?: number;
138
+ /** Sort category children by sequenceNo. Default: true. */
139
+ sortChildren?: boolean;
140
+ }
141
+ interface ItemActions {
142
+ itemCategoryLookup: (path: string) => Promise<unknown>;
143
+ getItemCategory: (uid: number, options?: Record<string, unknown>) => Promise<TCategory>;
144
+ getCategoryItems: (uid: number, filters: Record<string, unknown>) => Promise<unknown>;
145
+ getItemAttributes: (categoryUid: number) => Promise<TAttribute[]>;
146
+ getInvMast: (uid: number) => Promise<TInvMast>;
147
+ getInvMastDoc: (params: {
148
+ invMastUid?: number;
149
+ itemId?: string;
150
+ includePricing?: "Y" | "N";
151
+ }) => Promise<TInvMastDoc>;
152
+ getStock: (invMastUid: number) => Promise<TStockData[]>;
153
+ getStockCompanySummary: (invMastUid: number) => Promise<Record<string, number>>;
154
+ getItemFaqs: (invMastUid: number) => Promise<unknown[]>;
155
+ getItemSubstitutes: (invMastUid: number) => Promise<unknown[]>;
156
+ getItemAccessories: (invMastUid: number) => Promise<TItemAccessory[]>;
157
+ getSimilarItems: (invMastUid: number) => Promise<unknown[]>;
158
+ batchGetInvMastDocs: (params: {
159
+ invMastUid?: number;
160
+ itemId?: string;
161
+ }[]) => Promise<Record<string, TInvMastDoc>>;
162
+ batchGetStockData: (invMastUids: number[]) => Promise<Record<number, TStockData[]>>;
163
+ }
164
+ /**
165
+ * Creates server-side item actions with Redis caching and edge cache support.
166
+ *
167
+ * Uses `withServerCache` which produces cache keys compatible with augur-hooks'
168
+ * `withCache`, so server-prefetched data is shared with client-side hooks.
169
+ *
170
+ * @example
171
+ * ```ts
172
+ * // lib/item-actions.ts
173
+ * import { createItemActions } from "@simpleapps-com/augur-server";
174
+ * import { getAugurClient } from "./augur-client";
175
+ *
176
+ * export const itemActions = createItemActions(getAugurClient(), {
177
+ * cachePrefix: "ampro:",
178
+ * });
179
+ *
180
+ * // In a server component:
181
+ * const category = await itemActions.getItemCategory(123);
182
+ * const doc = await itemActions.getInvMastDoc({ itemId: "ITEM-1" });
183
+ * ```
184
+ */
185
+ declare function createItemActions(api: ItemsApiClient, config?: ItemActionsConfig): ItemActions;
186
+
187
+ /**
188
+ * The subset of augur-api used by commerce actions.
189
+ * Avoids importing the full SDK type so augur-server stays lightweight.
190
+ */
191
+ interface CommerceApiClient {
192
+ commerce: {
193
+ cartHdr: {
194
+ lookup: {
195
+ get: (params: Record<string, unknown>) => Promise<{
196
+ data: TCartLookUp;
197
+ }>;
198
+ };
199
+ alsoBought: {
200
+ get: (cartHdrUid: number, params?: Record<string, unknown>) => Promise<{
201
+ data: unknown[];
202
+ }>;
203
+ };
204
+ };
205
+ cartLine: {
206
+ get: (cartHdrUid: number) => Promise<{
207
+ data: TCartLine[];
208
+ }>;
209
+ add: {
210
+ create: (cartHdrUid: number, params: Record<string, unknown>) => Promise<{
211
+ data: unknown;
212
+ }>;
213
+ };
214
+ update: {
215
+ create: (cartHdrUid: number, params: Record<string, unknown>) => Promise<{
216
+ data: unknown;
217
+ }>;
218
+ };
219
+ delete: (cartHdrUid: number) => Promise<{
220
+ data: unknown;
221
+ }>;
222
+ };
223
+ checkout: {
224
+ create: (params: Record<string, unknown>) => Promise<{
225
+ data: unknown;
226
+ }>;
227
+ };
228
+ };
229
+ }
230
+ interface CommerceActionsConfig {
231
+ defaultContactId?: string | number;
232
+ defaultCustomerId?: string | number;
233
+ /** Optional UOM conversion function. E.g. (uom) => uom === "EA" ? "EACH" : uom */
234
+ convertUnitOfMeasure?: (uom: string) => string;
235
+ }
236
+ interface CommerceActions {
237
+ cartHdrLookup: (params: {
238
+ userId?: string | number;
239
+ cartToken?: string;
240
+ contactId?: string | number;
241
+ customerId?: string | number;
242
+ }) => Promise<TCartLookUp>;
243
+ getCartLines: (cartHdrUid: number) => Promise<TCartLine[]>;
244
+ addToCart: (cartHdrUid: number, items: {
245
+ itemId?: string;
246
+ invMastUid?: number;
247
+ quantity: number;
248
+ unitOfMeasure: string;
249
+ }[]) => Promise<unknown>;
250
+ updateCartLines: (cartHdrUid: number, lines: {
251
+ lineNo: number;
252
+ quantity: number;
253
+ unitOfMeasure: string;
254
+ }[]) => Promise<unknown>;
255
+ deleteCartItems: (cartHdrUid: number) => Promise<void>;
256
+ getCartAlsoBought: (cartHdrUid: number) => Promise<unknown[]>;
257
+ checkoutOrder: (cartHdrUid: number, data: Record<string, unknown>) => Promise<unknown>;
258
+ }
259
+ /**
260
+ * Creates server-side commerce actions for cart operations.
261
+ *
262
+ * Unlike pricing actions, commerce actions do NOT use caching because
263
+ * cart operations are real-time and must always reflect current state.
264
+ *
265
+ * @example
266
+ * ```ts
267
+ * // lib/commerce-actions.ts
268
+ * import { createCommerceActions } from "@simpleapps-com/augur-server";
269
+ * import { getAugurClient } from "./augur-client";
270
+ *
271
+ * export const commerceActions = createCommerceActions(getAugurClient(), {
272
+ * defaultContactId: process.env.NEXT_PUBLIC_DEFAULT_CONTACT_ID,
273
+ * defaultCustomerId: process.env.NEXT_PUBLIC_DEFAULT_CUSTOMER_ID,
274
+ * convertUnitOfMeasure: (uom) => uom === "EA" ? "EACH" : uom,
275
+ * });
276
+ *
277
+ * // In a server action:
278
+ * const cart = await commerceActions.cartHdrLookup({ userId: 123 });
279
+ * const lines = await commerceActions.getCartLines(cart.cartHdrUid);
280
+ * ```
281
+ */
282
+ declare function createCommerceActions(api: CommerceApiClient, config?: CommerceActionsConfig): CommerceActions;
283
+
284
+ /**
285
+ * The subset of augur-api used by order actions.
286
+ * Avoids importing the full SDK type so augur-server stays lightweight.
287
+ */
288
+ interface OrderApiClient {
289
+ orders: {
290
+ oeHdr: {
291
+ doc: {
292
+ get: (params: Record<string, unknown>) => Promise<{
293
+ data: unknown;
294
+ }>;
295
+ };
296
+ };
297
+ };
298
+ }
299
+ interface OrderActionsConfig {
300
+ /** Cache key prefix (e.g. "ampro:"). Default: "". */
301
+ cachePrefix?: string;
302
+ /** CDN edge cache value passed to SDK. Default: 1 (hour). */
303
+ edgeCache?: number;
304
+ /** Redis TTL for order doc lookups in seconds. Default: 3600 (1 hour). */
305
+ redisTtl?: number;
306
+ }
307
+ interface OrderActions {
308
+ getOrderDoc: (orderNo: string, zipCode: string) => Promise<unknown>;
309
+ }
310
+ /**
311
+ * Creates server-side order actions with Redis caching and edge cache support.
312
+ *
313
+ * Uses `withServerCache` which produces cache keys compatible with augur-hooks'
314
+ * `withCache`, so server-prefetched data is shared with client-side hooks.
315
+ *
316
+ * @example
317
+ * ```ts
318
+ * // lib/order-actions.ts
319
+ * import { createOrderActions } from "@simpleapps-com/augur-server";
320
+ * import { getAugurClient } from "./augur-client";
321
+ *
322
+ * export const orderActions = createOrderActions(getAugurClient(), {
323
+ * cachePrefix: "ampro:",
324
+ * });
325
+ *
326
+ * // In a server component:
327
+ * const doc = await orderActions.getOrderDoc("12345", "90210");
328
+ * ```
329
+ */
330
+ declare function createOrderActions(api: OrderApiClient, config?: OrderActionsConfig): OrderActions;
331
+
332
+ /** Shape of the openSearch service used by search actions. */
333
+ interface OpenSearchService {
334
+ itemSearch: {
335
+ list: (params: Record<string, unknown>) => Promise<{
336
+ data: {
337
+ items: TProductItem[];
338
+ totalResults: number;
339
+ };
340
+ }>;
341
+ attributes: {
342
+ list: (params: Record<string, unknown>) => Promise<{
343
+ data: {
344
+ attributes: TAttribute[];
345
+ };
346
+ }>;
347
+ };
348
+ };
349
+ suggestions: {
350
+ suggest: {
351
+ list: (params: Record<string, unknown>) => Promise<{
352
+ data: {
353
+ data: unknown[];
354
+ total: number;
355
+ totalResults: number;
356
+ };
357
+ }>;
358
+ };
359
+ };
360
+ }
361
+ /**
362
+ * The subset of augur-api used by search actions.
363
+ * Accepts both `openSearch` (camelCase) and `opensearch` (lowercase)
364
+ * to match SDK v0.9.x which exposes `api.opensearch`.
365
+ */
366
+ type SearchApiClient = {
367
+ openSearch: OpenSearchService;
368
+ } | {
369
+ opensearch: OpenSearchService;
370
+ };
371
+ interface SearchActionsConfig {
372
+ /** Cache key prefix (e.g. "ampro:"). Default: "". */
373
+ cachePrefix?: string;
374
+ /** CDN edge cache value passed to SDK. Default: 1 (hour). */
375
+ edgeCache?: number;
376
+ /** Redis TTL for search lookups in seconds. Default: 3600 (1 hour). */
377
+ redisTtl?: number;
378
+ /** Default source fields for item search. Default: "display_desc". */
379
+ defaultSourceFields?: string;
380
+ }
381
+ /** Paginated response for infinite scroll. */
382
+ interface SearchPage {
383
+ data: TProductItem[];
384
+ total: number;
385
+ nextCursor?: number;
386
+ }
387
+ interface SearchActions {
388
+ getSearchAttributes: (q: string) => Promise<TAttribute[]>;
389
+ getSearchSuggestions: (q: string, limit?: number, offset?: number) => Promise<{
390
+ data: unknown[];
391
+ total: number;
392
+ totalResults: number;
393
+ }>;
394
+ itemSearch: (filters: {
395
+ q: string;
396
+ limit: number;
397
+ offset: number;
398
+ sortBy?: string;
399
+ filters?: [string, string][];
400
+ }, itemCategoryUid?: number | string) => Promise<{
401
+ items: TProductItem[];
402
+ totalResults: number;
403
+ }>;
404
+ itemSearchInfinite: (filters: {
405
+ q: string;
406
+ limit: number;
407
+ sortBy?: string;
408
+ filters?: [string, string][];
409
+ }, itemCategoryUid?: number | string, pageParam?: number) => Promise<SearchPage>;
410
+ }
411
+ declare function createSearchActions(api: SearchApiClient, config?: SearchActionsConfig): SearchActions;
412
+
413
+ interface ShippingAddress {
414
+ address1: string;
415
+ city: string;
416
+ state: string;
417
+ postalCode: string;
418
+ country?: string;
419
+ }
420
+ /**
421
+ * The subset of augur-api used by shipping actions.
422
+ * Avoids importing the full SDK type so augur-server stays lightweight.
423
+ */
424
+ interface ShippingApiClient {
425
+ ups: {
426
+ ratesShop: {
427
+ get: (params: Record<string, unknown>) => Promise<{
428
+ data: unknown;
429
+ }>;
430
+ };
431
+ };
432
+ }
433
+ interface ShippingActionsConfig {
434
+ /** Warehouse/origin address for rate calculations. */
435
+ fromAddress: ShippingAddress;
436
+ /** UPS service codes to filter results. Default: undefined (return all). */
437
+ defaultServiceCodes?: string[];
438
+ /** Cache key prefix (e.g. "ampro:"). Default: "". */
439
+ cachePrefix?: string;
440
+ /** CDN edge cache value passed to SDK. Default: 1 (hour). */
441
+ edgeCache?: number;
442
+ /** Redis TTL for shipping rate lookups in seconds. Default: 3600 (1 hour). */
443
+ redisTtl?: number;
444
+ }
445
+ interface ShippingActions {
446
+ getShippingRates: (toAddress: ShippingAddress, weight: number, serviceCodes?: string[]) => Promise<unknown>;
447
+ }
448
+ /**
449
+ * Creates server-side shipping actions with Redis caching and edge cache support.
450
+ *
451
+ * Uses `withServerCache` which produces cache keys compatible with augur-hooks'
452
+ * `withCache`, so server-prefetched data is shared with client-side hooks.
453
+ *
454
+ * @example
455
+ * ```ts
456
+ * // lib/shipping-actions.ts
457
+ * import { createShippingActions } from "@simpleapps-com/augur-server";
458
+ * import { getAugurClient } from "./augur-client";
459
+ *
460
+ * export const shippingActions = createShippingActions(getAugurClient(), {
461
+ * fromAddress: {
462
+ * address1: "123 Warehouse Ln",
463
+ * city: "Chicago",
464
+ * state: "IL",
465
+ * postalCode: "60601",
466
+ * },
467
+ * });
468
+ *
469
+ * // In a server component:
470
+ * const rates = await shippingActions.getShippingRates(
471
+ * { address1: "456 Main St", city: "Denver", state: "CO", postalCode: "80202" },
472
+ * 5.0,
473
+ * );
474
+ * ```
475
+ */
476
+ declare function createShippingActions(api: ShippingApiClient, config: ShippingActionsConfig): ShippingActions;
477
+
478
+ /**
479
+ * The subset of augur-api used by Joomla content actions.
480
+ * Avoids importing the full SDK type so augur-server stays lightweight.
481
+ */
482
+ interface JoomlaApiClient {
483
+ joomla: {
484
+ content: {
485
+ doc: {
486
+ get: (articleId: number, params?: Record<string, unknown>) => Promise<{
487
+ data: unknown;
488
+ }>;
489
+ };
490
+ list: (params?: Record<string, unknown>) => Promise<{
491
+ data: unknown[];
492
+ }>;
493
+ };
494
+ };
495
+ }
496
+ interface JoomlaActionsConfig {
497
+ /** Cache key prefix (e.g. "ampro:"). Default: "". */
498
+ cachePrefix?: string;
499
+ /** CDN edge cache value passed to SDK. Default: 1 (hour). */
500
+ edgeCache?: number;
501
+ /** Redis TTL for Joomla lookups in seconds. Default: 3600 (1 hour). */
502
+ redisTtl?: number;
503
+ }
504
+ interface JoomlaActions {
505
+ getJoomlaContent: (articleId: number) => Promise<unknown>;
506
+ getJoomlaContentList: (params?: Record<string, unknown>) => Promise<unknown[]>;
507
+ }
508
+ /**
509
+ * Creates server-side Joomla content actions with Redis caching and edge cache support.
510
+ *
511
+ * Uses `withServerCache` which produces cache keys compatible with augur-hooks'
512
+ * `withCache`, so server-prefetched data is shared with client-side hooks.
513
+ *
514
+ * @example
515
+ * ```ts
516
+ * // lib/joomla-actions.ts
517
+ * import { createJoomlaActions } from "@simpleapps-com/augur-server";
518
+ * import { getAugurClient } from "./augur-client";
519
+ *
520
+ * export const joomlaActions = createJoomlaActions(getAugurClient(), {
521
+ * cachePrefix: "ampro:",
522
+ * });
523
+ *
524
+ * // In a server component:
525
+ * const article = await joomlaActions.getJoomlaContent(42);
526
+ * const articles = await joomlaActions.getJoomlaContentList({ catid: 5 });
527
+ * ```
528
+ */
529
+ declare function createJoomlaActions(api: JoomlaApiClient, config?: JoomlaActionsConfig): JoomlaActions;
530
+
531
+ /**
532
+ * The subset of augur-api used by legacy actions.
533
+ * Matches `api.legacy` from the SDK.
534
+ */
535
+ interface LegacyApiClient {
536
+ legacy: {
537
+ invMast: {
538
+ webDesc: {
539
+ list: (invMastUid: number, params?: Record<string, unknown>) => Promise<{
540
+ data: TWebDesc[];
541
+ }>;
542
+ };
543
+ alsoBought: {
544
+ list: (invMastUid: number, params?: Record<string, unknown>) => Promise<{
545
+ data: unknown[];
546
+ }>;
547
+ };
548
+ tags: {
549
+ list: (invMastUid: number, params?: Record<string, unknown>) => Promise<{
550
+ data: unknown[];
551
+ }>;
552
+ };
553
+ };
554
+ legacy: {
555
+ state: {
556
+ list: (params?: Record<string, unknown>) => Promise<{
557
+ data: unknown[];
558
+ }>;
559
+ };
560
+ };
561
+ };
562
+ }
563
+ interface LegacyActionsConfig {
564
+ /** Cache key prefix (e.g. "ampro:"). Default: "". */
565
+ cachePrefix?: string;
566
+ /** CDN edge cache value passed to SDK. Default: 1 (hour). */
567
+ edgeCache?: number;
568
+ /** CDN edge cache for rarely-changing data like states. Default: 8 (hours). */
569
+ longEdgeCache?: number;
570
+ /** Redis TTL in seconds. Default: 3600 (1 hour). */
571
+ redisTtl?: number;
572
+ /** Redis TTL for rarely-changing data in seconds. Default: 28800 (8 hours). */
573
+ longRedisTtl?: number;
574
+ }
575
+ interface LegacyActions {
576
+ getItemWebDesc: (invMastUid: number) => Promise<TWebDesc | undefined>;
577
+ getAlsoBoughtItems: (invMastUid: number) => Promise<unknown[]>;
578
+ getItemTags: (invMastUid: number) => Promise<unknown[]>;
579
+ getStates: (params?: {
580
+ twoLetterCode?: string;
581
+ }) => Promise<unknown[]>;
582
+ }
583
+ /**
584
+ * Creates server-side legacy actions with Redis caching and edge cache support.
585
+ *
586
+ * Covers the legacy microservice endpoints used by ecommerce sites:
587
+ * webDesc, alsoBought, tags, and states.
588
+ *
589
+ * @example
590
+ * ```ts
591
+ * import { createLegacyActions } from "@simpleapps-com/augur-server";
592
+ * import { getAugurClient } from "./augur-client";
593
+ *
594
+ * export const legacyActions = createLegacyActions(getAugurClient(), {
595
+ * cachePrefix: "ampro:",
596
+ * });
597
+ *
598
+ * const webDesc = await legacyActions.getItemWebDesc(12345);
599
+ * const states = await legacyActions.getStates();
600
+ * ```
601
+ */
602
+ declare function createLegacyActions(api: LegacyApiClient, config?: LegacyActionsConfig): LegacyActions;
603
+
604
+ /**
605
+ * The subset of augur-api used by customer actions.
606
+ * Matches `api.customers` from the SDK.
607
+ */
608
+ interface CustomersApiClient {
609
+ customers: {
610
+ customer: {
611
+ get: (customerId: number, params?: Record<string, unknown>) => Promise<{
612
+ data: unknown;
613
+ }>;
614
+ lookup: {
615
+ get: (params: Record<string, unknown>) => Promise<{
616
+ data: unknown[];
617
+ }>;
618
+ };
619
+ doc: {
620
+ list: (customerId: number, params?: Record<string, unknown>) => Promise<{
621
+ data: unknown;
622
+ }>;
623
+ };
624
+ orders: {
625
+ list: (customerId: number, params?: Record<string, unknown>) => Promise<{
626
+ data: unknown[];
627
+ }>;
628
+ };
629
+ shipTo: {
630
+ list: (customerId: number, params?: Record<string, unknown>) => Promise<{
631
+ data: unknown[];
632
+ }>;
633
+ };
634
+ };
635
+ contacts: {
636
+ list: (params?: Record<string, unknown>) => Promise<{
637
+ data: unknown[];
638
+ }>;
639
+ };
640
+ };
641
+ }
642
+ interface CustomersActionsConfig {
643
+ /** Cache key prefix (e.g. "ampro:"). Default: "". */
644
+ cachePrefix?: string;
645
+ /** CDN edge cache value passed to SDK. Default: 1 (hour). */
646
+ edgeCache?: number;
647
+ /** Redis TTL in seconds. Default: 3600 (1 hour). */
648
+ redisTtl?: number;
649
+ }
650
+ interface CustomersActions {
651
+ getCustomer: (customerId: number) => Promise<unknown>;
652
+ customerLookup: (params: Record<string, unknown>) => Promise<unknown[]>;
653
+ getCustomerDoc: (customerId: number) => Promise<unknown>;
654
+ getCustomerOrders: (customerId: number, params?: Record<string, unknown>) => Promise<unknown[]>;
655
+ getContacts: (params?: Record<string, unknown>) => Promise<unknown[]>;
656
+ getShipToAddresses: (customerId: number) => Promise<unknown[]>;
657
+ }
658
+ /**
659
+ * Creates server-side customer actions with Redis caching and edge cache support.
660
+ *
661
+ * Covers the customers microservice endpoints used by ecommerce sites:
662
+ * customer get, lookup, doc, orders, contacts, and ship-to addresses.
663
+ *
664
+ * @example
665
+ * ```ts
666
+ * import { createCustomersActions } from "@simpleapps-com/augur-server";
667
+ * import { getAugurClient } from "./augur-client";
668
+ *
669
+ * export const customersActions = createCustomersActions(getAugurClient(), {
670
+ * cachePrefix: "ampro:",
671
+ * });
672
+ *
673
+ * const customer = await customersActions.getCustomer(123);
674
+ * const orders = await customersActions.getCustomerOrders(123);
675
+ * ```
676
+ */
677
+ declare function createCustomersActions(api: CustomersApiClient, config?: CustomersActionsConfig): CustomersActions;
678
+
679
+ /**
680
+ * The subset of augur-api used by SmartyStreets actions.
681
+ * Matches `api.smartyStreets` from the SDK.
682
+ */
683
+ interface SmartyStreetsApiClient {
684
+ smartyStreets: {
685
+ us: {
686
+ lookup: {
687
+ get: (params: Record<string, unknown>) => Promise<{
688
+ data: unknown;
689
+ }>;
690
+ };
691
+ };
692
+ };
693
+ }
694
+ interface SmartyStreetsActionsConfig {
695
+ /** Cache key prefix (e.g. "ampro:"). Default: "". */
696
+ cachePrefix?: string;
697
+ }
698
+ interface SmartyStreetsActions {
699
+ validateAddress: (params: Record<string, unknown>) => Promise<unknown>;
700
+ }
701
+ /**
702
+ * Creates server-side SmartyStreets actions for address validation.
703
+ *
704
+ * Note: Address validation is a real-time operation and does NOT use caching.
705
+ * Each call hits the SmartyStreets API directly to ensure up-to-date results.
706
+ *
707
+ * @example
708
+ * ```ts
709
+ * import { createSmartyStreetsActions } from "@simpleapps-com/augur-server";
710
+ * import { getAugurClient } from "./augur-client";
711
+ *
712
+ * export const smartyStreetsActions = createSmartyStreetsActions(getAugurClient());
713
+ *
714
+ * const result = await smartyStreetsActions.validateAddress({
715
+ * address1: "123 Main St",
716
+ * city: "Provo",
717
+ * state: "UT",
718
+ * postalCode: "84606",
719
+ * });
720
+ * ```
721
+ */
722
+ declare function createSmartyStreetsActions(api: SmartyStreetsApiClient, config?: SmartyStreetsActionsConfig): SmartyStreetsActions;
723
+
724
+ /**
725
+ * The subset of augur-api used by P21 PIM actions.
726
+ * Matches `api.p21Pim` from the SDK.
727
+ */
728
+ interface P21PimApiClient {
729
+ p21Pim: {
730
+ invMastExt: {
731
+ get: (invMastUid: number, params?: Record<string, unknown>) => Promise<{
732
+ data: unknown;
733
+ }>;
734
+ list: (params?: Record<string, unknown>) => Promise<{
735
+ data: unknown[];
736
+ }>;
737
+ };
738
+ };
739
+ }
740
+ interface P21PimActionsConfig {
741
+ /** Cache key prefix (e.g. "ampro:"). Default: "". */
742
+ cachePrefix?: string;
743
+ /** CDN edge cache value passed to SDK. Default: 1 (hour). */
744
+ edgeCache?: number;
745
+ /** Redis TTL in seconds. Default: 3600 (1 hour). */
746
+ redisTtl?: number;
747
+ }
748
+ interface P21PimActions {
749
+ getInvMastExt: (invMastUid: number) => Promise<unknown>;
750
+ listInvMastExt: (params?: Record<string, unknown>) => Promise<unknown[]>;
751
+ }
752
+ /**
753
+ * Creates server-side P21 PIM actions with Redis caching and edge cache support.
754
+ *
755
+ * Covers the P21 PIM microservice endpoints for extended inventory data
756
+ * including UPC/EAN codes, brand information, and SEO metadata.
757
+ *
758
+ * @example
759
+ * ```ts
760
+ * import { createP21PimActions } from "@simpleapps-com/augur-server";
761
+ * import { getAugurClient } from "./augur-client";
762
+ *
763
+ * export const p21PimActions = createP21PimActions(getAugurClient(), {
764
+ * cachePrefix: "ampro:",
765
+ * });
766
+ *
767
+ * const ext = await p21PimActions.getInvMastExt(12345);
768
+ * const list = await p21PimActions.listInvMastExt({ limit: 20 });
769
+ * ```
770
+ */
771
+ declare function createP21PimActions(api: P21PimApiClient, config?: P21PimActionsConfig): P21PimActions;
772
+
773
+ /**
774
+ * The subset of augur-api used by AGR Site actions.
775
+ * Matches `api.agrSite` from the SDK.
776
+ */
777
+ interface AgrSiteApiClient {
778
+ agrSite: {
779
+ settings: {
780
+ list: (params?: Record<string, unknown>) => Promise<{
781
+ data: unknown[];
782
+ }>;
783
+ };
784
+ metaFiles: {
785
+ list: (params?: Record<string, unknown>) => Promise<{
786
+ data: unknown[];
787
+ }>;
788
+ };
789
+ };
790
+ }
791
+ interface AgrSiteActionsConfig {
792
+ /** Cache key prefix (e.g. "ampro:"). Default: "". */
793
+ cachePrefix?: string;
794
+ /** CDN edge cache value for rarely-changing data. Default: 8 (hours). */
795
+ longEdgeCache?: number;
796
+ /** Redis TTL for rarely-changing data in seconds. Default: 28800 (8 hours). */
797
+ longRedisTtl?: number;
798
+ }
799
+ interface AgrSiteActions {
800
+ getSettings: (serviceName?: string) => Promise<unknown[]>;
801
+ getMetaFiles: (params?: Record<string, unknown>) => Promise<unknown[]>;
802
+ }
803
+ /**
804
+ * Creates server-side AGR Site actions with Redis caching and edge cache support.
805
+ *
806
+ * Covers the AGR Site microservice endpoints for site configuration settings
807
+ * and meta file management (robots.txt, etc.). Both endpoints use long TTLs
808
+ * since site settings and meta files rarely change.
809
+ *
810
+ * @example
811
+ * ```ts
812
+ * import { createAgrSiteActions } from "@simpleapps-com/augur-server";
813
+ * import { getAugurClient } from "./augur-client";
814
+ *
815
+ * export const agrSiteActions = createAgrSiteActions(getAugurClient(), {
816
+ * cachePrefix: "ampro:",
817
+ * });
818
+ *
819
+ * const settings = await agrSiteActions.getSettings("my-service");
820
+ * const metaFiles = await agrSiteActions.getMetaFiles();
821
+ * ```
822
+ */
823
+ declare function createAgrSiteActions(api: AgrSiteApiClient, config?: AgrSiteActionsConfig): AgrSiteActions;
824
+
825
+ /**
826
+ * The subset of augur-api used by Avalara actions.
827
+ * Matches `api.avalara` from the SDK.
828
+ */
829
+ interface AvalaraApiClient {
830
+ avalara: {
831
+ rates: {
832
+ create: (data: Record<string, unknown>) => Promise<{
833
+ data: unknown;
834
+ }>;
835
+ };
836
+ };
837
+ }
838
+ interface AvalaraActionsConfig {
839
+ /** Cache key prefix (e.g. "ampro:"). Default: "". */
840
+ cachePrefix?: string;
841
+ }
842
+ interface AvalaraActions {
843
+ calculateTax: (data: Record<string, unknown>) => Promise<unknown>;
844
+ }
845
+ /**
846
+ * Creates server-side Avalara actions for real-time tax calculation.
847
+ *
848
+ * Note: Tax calculation is a real-time operation and does NOT use caching.
849
+ * Each call hits the Avalara API directly to ensure up-to-date tax rates.
850
+ *
851
+ * @example
852
+ * ```ts
853
+ * import { createAvalaraActions } from "@simpleapps-com/augur-server";
854
+ * import { getAugurClient } from "./augur-client";
855
+ *
856
+ * export const avalaraActions = createAvalaraActions(getAugurClient());
857
+ *
858
+ * const taxResult = await avalaraActions.calculateTax({
859
+ * lines: [{ amount: 100.00, description: "Widget" }],
860
+ * addresses: {
861
+ * shipTo: {
862
+ * line1: "123 Main St",
863
+ * city: "Irvine",
864
+ * region: "CA",
865
+ * country: "US",
866
+ * postalCode: "92602",
867
+ * },
868
+ * },
869
+ * type: "SalesOrder",
870
+ * });
871
+ * ```
872
+ */
873
+ declare function createAvalaraActions(api: AvalaraApiClient, config?: AvalaraActionsConfig): AvalaraActions;
874
+
875
+ /**
876
+ * The subset of augur-api used by payment actions.
877
+ * Matches `api.payments` from the SDK.
878
+ */
879
+ interface PaymentsApiClient {
880
+ payments: {
881
+ unified: {
882
+ transactionSetup: {
883
+ get: (params: Record<string, unknown>) => Promise<{
884
+ data: unknown;
885
+ }>;
886
+ };
887
+ accountQuery: {
888
+ get: (params: Record<string, unknown>) => Promise<{
889
+ data: unknown;
890
+ }>;
891
+ };
892
+ surcharge: {
893
+ get: (params: Record<string, unknown>) => Promise<{
894
+ data: unknown;
895
+ }>;
896
+ };
897
+ };
898
+ };
899
+ }
900
+ interface PaymentsActionsConfig {
901
+ /** Cache key prefix (e.g. "ampro:"). Default: "". */
902
+ cachePrefix?: string;
903
+ }
904
+ interface PaymentsActions {
905
+ transactionSetup: (params: Record<string, unknown>) => Promise<unknown>;
906
+ accountQuery: (params: Record<string, unknown>) => Promise<unknown>;
907
+ getSurcharge: (params: Record<string, unknown>) => Promise<unknown>;
908
+ }
909
+ /**
910
+ * Creates server-side payment actions.
911
+ *
912
+ * Payment actions do NOT use caching because every call deals with
913
+ * real-time payment processing that must always reflect current state.
914
+ *
915
+ * @example
916
+ * ```ts
917
+ * import { createPaymentsActions } from "@simpleapps-com/augur-server";
918
+ * import { getAugurClient } from "./augur-client";
919
+ *
920
+ * export const paymentsActions = createPaymentsActions(getAugurClient());
921
+ *
922
+ * const setup = await paymentsActions.transactionSetup({ customerId: "123" });
923
+ * const account = await paymentsActions.accountQuery({ transactionSetupId: "abc" });
924
+ * const surcharge = await paymentsActions.getSurcharge({ amount: 100 });
925
+ * ```
926
+ */
927
+ declare function createPaymentsActions(api: PaymentsApiClient, config?: PaymentsActionsConfig): PaymentsActions;
928
+
929
+ /**
930
+ * The subset of augur-api used by UPS actions.
931
+ * Matches `api.ups` from the SDK.
932
+ */
933
+ interface UpsApiClient {
934
+ ups: {
935
+ ratesShop: {
936
+ get: (params: Record<string, unknown>) => Promise<{
937
+ data: unknown;
938
+ }>;
939
+ };
940
+ };
941
+ }
942
+ interface UpsActionsConfig {
943
+ /** Cache key prefix (e.g. "ampro:"). Default: "". */
944
+ cachePrefix?: string;
945
+ }
946
+ interface UpsActions {
947
+ getRates: (params: Record<string, unknown>) => Promise<unknown>;
948
+ }
949
+ /**
950
+ * Creates server-side UPS shipping actions.
951
+ *
952
+ * UPS rate actions do NOT use caching because rate quotes are real-time
953
+ * and must always reflect current carrier pricing.
954
+ *
955
+ * @example
956
+ * ```ts
957
+ * import { createUpsActions } from "@simpleapps-com/augur-server";
958
+ * import { getAugurClient } from "./augur-client";
959
+ *
960
+ * export const upsActions = createUpsActions(getAugurClient());
961
+ *
962
+ * const rates = await upsActions.getRates({
963
+ * fromPostalCode: "90210",
964
+ * toPostalCode: "10001",
965
+ * weight: 5,
966
+ * });
967
+ * ```
968
+ */
969
+ declare function createUpsActions(api: UpsApiClient, config?: UpsActionsConfig): UpsActions;
970
+
971
+ /**
972
+ * The subset of augur-api used by logistics actions.
973
+ * Matches `api.logistics` from the SDK.
974
+ */
975
+ interface LogisticsApiClient {
976
+ logistics: {
977
+ speedship: {
978
+ freight: {
979
+ get: (params: Record<string, unknown>) => Promise<{
980
+ data: unknown;
981
+ }>;
982
+ };
983
+ };
984
+ shipvia: {
985
+ rates: {
986
+ list: (params?: Record<string, unknown>) => Promise<{
987
+ data: unknown[];
988
+ }>;
989
+ };
990
+ };
991
+ };
992
+ }
993
+ interface LogisticsActionsConfig {
994
+ /** Cache key prefix (e.g. "ampro:"). Default: "". */
995
+ cachePrefix?: string;
996
+ /** CDN edge cache value passed to SDK. Default: 1 (hour). */
997
+ edgeCache?: number;
998
+ /** CDN edge cache for rarely-changing data like ship-via options. Default: 8 (hours). */
999
+ longEdgeCache?: number;
1000
+ /** Redis TTL in seconds. Default: 3600 (1 hour). */
1001
+ redisTtl?: number;
1002
+ /** Redis TTL for rarely-changing data in seconds. Default: 28800 (8 hours). */
1003
+ longRedisTtl?: number;
1004
+ }
1005
+ interface LogisticsActions {
1006
+ getFreightRates: (params: Record<string, unknown>) => Promise<unknown>;
1007
+ getShipVia: (params?: Record<string, unknown>) => Promise<unknown[]>;
1008
+ }
1009
+ /**
1010
+ * Creates server-side logistics actions with selective Redis caching.
1011
+ *
1012
+ * Freight rate lookups are real-time and NOT cached.
1013
+ * Ship-via carrier options rarely change and ARE cached with long TTL.
1014
+ *
1015
+ * @example
1016
+ * ```ts
1017
+ * import { createLogisticsActions } from "@simpleapps-com/augur-server";
1018
+ * import { getAugurClient } from "./augur-client";
1019
+ *
1020
+ * export const logisticsActions = createLogisticsActions(getAugurClient(), {
1021
+ * cachePrefix: "ampro:",
1022
+ * });
1023
+ *
1024
+ * const rates = await logisticsActions.getFreightRates({ fromPostalCode: "90210" });
1025
+ * const carriers = await logisticsActions.getShipVia();
1026
+ * ```
1027
+ */
1028
+ declare function createLogisticsActions(api: LogisticsApiClient, config?: LogisticsActionsConfig): LogisticsActions;
1029
+
1030
+ /**
1031
+ * The subset of augur-api used by nexus actions.
1032
+ * Matches `api.nexus` from the SDK.
1033
+ */
1034
+ interface NexusApiClient {
1035
+ nexus: {
1036
+ binTransfer: {
1037
+ create: (data: Record<string, unknown>) => Promise<{
1038
+ data: unknown;
1039
+ }>;
1040
+ };
1041
+ receiving: {
1042
+ create: (data: Record<string, unknown>) => Promise<{
1043
+ data: unknown;
1044
+ }>;
1045
+ };
1046
+ transfer: {
1047
+ create: (data: Record<string, unknown>) => Promise<{
1048
+ data: unknown;
1049
+ }>;
1050
+ };
1051
+ purchaseOrderReceipt: {
1052
+ list: (params?: Record<string, unknown>) => Promise<{
1053
+ data: unknown[];
1054
+ }>;
1055
+ };
1056
+ transferReceipt: {
1057
+ list: (params?: Record<string, unknown>) => Promise<{
1058
+ data: unknown[];
1059
+ }>;
1060
+ };
1061
+ transferShipping: {
1062
+ list: (params?: Record<string, unknown>) => Promise<{
1063
+ data: unknown[];
1064
+ }>;
1065
+ };
1066
+ };
1067
+ }
1068
+ interface NexusActionsConfig {
1069
+ /** Cache key prefix (e.g. "ampro:"). Default: "". */
1070
+ cachePrefix?: string;
1071
+ /** CDN edge cache value passed to SDK. Default: 1 (hour). */
1072
+ edgeCache?: number;
1073
+ /** Redis TTL in seconds. Default: 3600 (1 hour). */
1074
+ redisTtl?: number;
1075
+ }
1076
+ interface NexusActions {
1077
+ createBinTransfer: (data: Record<string, unknown>) => Promise<unknown>;
1078
+ createReceiving: (data: Record<string, unknown>) => Promise<unknown>;
1079
+ createTransfer: (data: Record<string, unknown>) => Promise<unknown>;
1080
+ getPurchaseOrderReceipts: (params?: Record<string, unknown>) => Promise<unknown[]>;
1081
+ getTransferReceipts: (params?: Record<string, unknown>) => Promise<unknown[]>;
1082
+ getTransferShipping: (params?: Record<string, unknown>) => Promise<unknown[]>;
1083
+ }
1084
+ /**
1085
+ * Creates server-side nexus (warehouse management) actions with selective caching.
1086
+ *
1087
+ * Write operations (bin transfer, receiving, transfer) do NOT use caching.
1088
+ * Read/list operations (receipts, shipping) ARE cached with standard TTL.
1089
+ *
1090
+ * @example
1091
+ * ```ts
1092
+ * import { createNexusActions } from "@simpleapps-com/augur-server";
1093
+ * import { getAugurClient } from "./augur-client";
1094
+ *
1095
+ * export const nexusActions = createNexusActions(getAugurClient(), {
1096
+ * cachePrefix: "ampro:",
1097
+ * });
1098
+ *
1099
+ * const transfer = await nexusActions.createBinTransfer({ locationId: 5, transfers: [] });
1100
+ * const receipts = await nexusActions.getPurchaseOrderReceipts();
1101
+ * ```
1102
+ */
1103
+ declare function createNexusActions(api: NexusApiClient, config?: NexusActionsConfig): NexusActions;
1104
+
1105
+ /**
1106
+ * The subset of augur-api used by VMI actions.
1107
+ * Matches `api.vmi` from the SDK.
1108
+ */
1109
+ interface VmiApiClient {
1110
+ vmi: {
1111
+ warehouse: {
1112
+ list: (params?: Record<string, unknown>) => Promise<{
1113
+ data: unknown[];
1114
+ }>;
1115
+ availability: {
1116
+ get: (warehouseUid: number, params: Record<string, unknown>) => Promise<{
1117
+ data: unknown[];
1118
+ }>;
1119
+ };
1120
+ };
1121
+ distributors: {
1122
+ list: (params?: Record<string, unknown>) => Promise<{
1123
+ data: unknown[];
1124
+ }>;
1125
+ };
1126
+ products: {
1127
+ list: (params?: Record<string, unknown>) => Promise<{
1128
+ data: unknown[];
1129
+ }>;
1130
+ };
1131
+ invProfileHdr: {
1132
+ list: (params?: Record<string, unknown>) => Promise<{
1133
+ data: unknown[];
1134
+ }>;
1135
+ };
1136
+ restockHdr: {
1137
+ list: (params?: Record<string, unknown>) => Promise<{
1138
+ data: unknown[];
1139
+ }>;
1140
+ };
1141
+ sections: {
1142
+ list: (params?: Record<string, unknown>) => Promise<{
1143
+ data: unknown[];
1144
+ }>;
1145
+ };
1146
+ };
1147
+ }
1148
+ interface VmiActionsConfig {
1149
+ /** Cache key prefix (e.g. "ampro:"). Default: "". */
1150
+ cachePrefix?: string;
1151
+ /** CDN edge cache value passed to SDK. Default: 1 (hour). */
1152
+ edgeCache?: number;
1153
+ /** Redis TTL in seconds. Default: 3600 (1 hour). */
1154
+ redisTtl?: number;
1155
+ /** Redis TTL for short-lived data like availability. Default: 300 (5 min). */
1156
+ shortRedisTtl?: number;
1157
+ }
1158
+ interface VmiActions {
1159
+ getWarehouses: (params?: Record<string, unknown>) => Promise<unknown[]>;
1160
+ getWarehouseAvailability: (warehouseUid: number, params?: Record<string, unknown>) => Promise<unknown[]>;
1161
+ getDistributors: (params?: Record<string, unknown>) => Promise<unknown[]>;
1162
+ getProducts: (params?: Record<string, unknown>) => Promise<unknown[]>;
1163
+ getInventoryProfiles: (params?: Record<string, unknown>) => Promise<unknown[]>;
1164
+ getRestockHeaders: (params?: Record<string, unknown>) => Promise<unknown[]>;
1165
+ getSections: (params?: Record<string, unknown>) => Promise<unknown[]>;
1166
+ }
1167
+ /**
1168
+ * Creates server-side VMI (Vendor Managed Inventory) actions with Redis caching.
1169
+ *
1170
+ * All VMI read operations are cached. Warehouse availability uses a shorter TTL
1171
+ * because inventory levels change more frequently than configuration data.
1172
+ *
1173
+ * @example
1174
+ * ```ts
1175
+ * import { createVmiActions } from "@simpleapps-com/augur-server";
1176
+ * import { getAugurClient } from "./augur-client";
1177
+ *
1178
+ * export const vmiActions = createVmiActions(getAugurClient(), {
1179
+ * cachePrefix: "ampro:",
1180
+ * });
1181
+ *
1182
+ * const warehouses = await vmiActions.getWarehouses({ customerId: 12345 });
1183
+ * const availability = await vmiActions.getWarehouseAvailability(123);
1184
+ * const distributors = await vmiActions.getDistributors({ customerId: 12345 });
1185
+ * ```
1186
+ */
1187
+ declare function createVmiActions(api: VmiApiClient, config?: VmiActionsConfig): VmiActions;
1188
+
1189
+ /**
1190
+ * The subset of augur-api used by p21-core actions.
1191
+ * Matches `api.p21Core` from the SDK.
1192
+ */
1193
+ interface P21CoreApiClient {
1194
+ p21Core: {
1195
+ address: {
1196
+ list: (params?: Record<string, unknown>) => Promise<{
1197
+ data: unknown[];
1198
+ }>;
1199
+ };
1200
+ company: {
1201
+ list: (params?: Record<string, unknown>) => Promise<{
1202
+ data: unknown[];
1203
+ }>;
1204
+ get: (params: Record<string, unknown>) => Promise<{
1205
+ data: unknown;
1206
+ }>;
1207
+ };
1208
+ location: {
1209
+ list: (params?: Record<string, unknown>) => Promise<{
1210
+ data: unknown[];
1211
+ }>;
1212
+ };
1213
+ paymentTypes: {
1214
+ list: (params?: Record<string, unknown>) => Promise<{
1215
+ data: unknown[];
1216
+ }>;
1217
+ };
1218
+ cashDrawer: {
1219
+ list: (params?: Record<string, unknown>) => Promise<{
1220
+ data: unknown[];
1221
+ }>;
1222
+ };
1223
+ codeP21: {
1224
+ list: (params?: Record<string, unknown>) => Promise<{
1225
+ data: unknown[];
1226
+ }>;
1227
+ };
1228
+ };
1229
+ }
1230
+ interface P21CoreActionsConfig {
1231
+ /** Cache key prefix (e.g. "ampro:"). Default: "". */
1232
+ cachePrefix?: string;
1233
+ /** CDN edge cache value passed to SDK. Default: 1 (hour). */
1234
+ edgeCache?: number;
1235
+ /** CDN edge cache for rarely-changing data. Default: 8 (hours). */
1236
+ longEdgeCache?: number;
1237
+ /** Redis TTL in seconds. Default: 3600 (1 hour). */
1238
+ redisTtl?: number;
1239
+ /** Redis TTL for rarely-changing data in seconds. Default: 28800 (8 hours). */
1240
+ longRedisTtl?: number;
1241
+ }
1242
+ interface P21CoreActions {
1243
+ getAddresses: (params?: Record<string, unknown>) => Promise<unknown[]>;
1244
+ getCompanies: (params?: Record<string, unknown>) => Promise<unknown[]>;
1245
+ getCompany: (companyId: number) => Promise<unknown | undefined>;
1246
+ getLocations: (params?: Record<string, unknown>) => Promise<unknown[]>;
1247
+ getPaymentTypes: (params?: Record<string, unknown>) => Promise<unknown[]>;
1248
+ getCashDrawers: (params?: Record<string, unknown>) => Promise<unknown[]>;
1249
+ getCodeP21: (params?: Record<string, unknown>) => Promise<unknown[]>;
1250
+ }
1251
+ /**
1252
+ * Creates server-side P21 Core actions with Redis caching and edge cache support.
1253
+ *
1254
+ * Covers the P21 Core microservice endpoints: addresses, companies,
1255
+ * locations, payment types, cash drawers, and P21 codes.
1256
+ *
1257
+ * @example
1258
+ * ```ts
1259
+ * import { createP21CoreActions } from "@simpleapps-com/augur-server";
1260
+ * import { getAugurClient } from "./augur-client";
1261
+ *
1262
+ * export const p21CoreActions = createP21CoreActions(getAugurClient(), {
1263
+ * cachePrefix: "ampro:",
1264
+ * });
1265
+ *
1266
+ * const companies = await p21CoreActions.getCompanies();
1267
+ * const company = await p21CoreActions.getCompany(123);
1268
+ * ```
1269
+ */
1270
+ declare function createP21CoreActions(api: P21CoreApiClient, config?: P21CoreActionsConfig): P21CoreActions;
1271
+
1272
+ /**
1273
+ * The subset of augur-api used by p21-apis actions.
1274
+ * Matches `api.p21Apis` from the SDK.
1275
+ */
1276
+ interface P21ApisApiClient {
1277
+ p21Apis: {
1278
+ transCategory: {
1279
+ list: (params?: Record<string, unknown>) => Promise<{
1280
+ data: unknown[];
1281
+ }>;
1282
+ defaults: {
1283
+ get: (categoryUid: number, params?: Record<string, unknown>) => Promise<{
1284
+ data: unknown;
1285
+ }>;
1286
+ };
1287
+ };
1288
+ transCompany: {
1289
+ list: (params?: Record<string, unknown>) => Promise<{
1290
+ data: unknown[];
1291
+ }>;
1292
+ };
1293
+ transUser: {
1294
+ list: (params?: Record<string, unknown>) => Promise<{
1295
+ data: unknown[];
1296
+ }>;
1297
+ };
1298
+ transWebDisplayType: {
1299
+ list: (params?: Record<string, unknown>) => Promise<{
1300
+ data: unknown[];
1301
+ }>;
1302
+ defaults: {
1303
+ get: (params?: Record<string, unknown>) => Promise<{
1304
+ data: unknown;
1305
+ }>;
1306
+ };
1307
+ };
1308
+ entityContacts: {
1309
+ refresh: {
1310
+ create: (params?: Record<string, unknown>) => Promise<{
1311
+ data: unknown;
1312
+ }>;
1313
+ };
1314
+ };
1315
+ entityCustomers: {
1316
+ refresh: {
1317
+ create: (params?: Record<string, unknown>) => Promise<{
1318
+ data: unknown;
1319
+ }>;
1320
+ };
1321
+ };
1322
+ };
1323
+ }
1324
+ interface P21ApisActionsConfig {
1325
+ /** Cache key prefix (e.g. "ampro:"). Default: "". */
1326
+ cachePrefix?: string;
1327
+ /** CDN edge cache value passed to SDK. Default: 1 (hour). */
1328
+ edgeCache?: number;
1329
+ /** Redis TTL in seconds. Default: 3600 (1 hour). */
1330
+ redisTtl?: number;
1331
+ }
1332
+ interface P21ApisActions {
1333
+ getCategories: (params?: Record<string, unknown>) => Promise<unknown[]>;
1334
+ getCategoryDefaults: (categoryId: number) => Promise<unknown | undefined>;
1335
+ getCompanies: (params?: Record<string, unknown>) => Promise<unknown[]>;
1336
+ getUsers: (params?: Record<string, unknown>) => Promise<unknown[]>;
1337
+ getWebDisplayTypes: (params?: Record<string, unknown>) => Promise<unknown[]>;
1338
+ getWebDisplayTypeDefaults: (id?: number) => Promise<unknown | undefined>;
1339
+ refreshContacts: (params?: Record<string, unknown>) => Promise<unknown | undefined>;
1340
+ refreshCustomers: (params?: Record<string, unknown>) => Promise<unknown | undefined>;
1341
+ }
1342
+ /**
1343
+ * Creates server-side P21 APIs actions with Redis caching and edge cache support.
1344
+ *
1345
+ * Covers the P21 APIs microservice endpoints: transaction categories,
1346
+ * companies, users, web display types, and entity refresh operations.
1347
+ *
1348
+ * @example
1349
+ * ```ts
1350
+ * import { createP21ApisActions } from "@simpleapps-com/augur-server";
1351
+ * import { getAugurClient } from "./augur-client";
1352
+ *
1353
+ * export const p21ApisActions = createP21ApisActions(getAugurClient(), {
1354
+ * cachePrefix: "ampro:",
1355
+ * });
1356
+ *
1357
+ * const categories = await p21ApisActions.getCategories();
1358
+ * await p21ApisActions.refreshContacts();
1359
+ * ```
1360
+ */
1361
+ declare function createP21ApisActions(api: P21ApisApiClient, config?: P21ApisActionsConfig): P21ApisActions;
1362
+
1363
+ /**
1364
+ * The subset of augur-api used by p21-sism actions.
1365
+ * Matches `api.p21Sism` from the SDK.
1366
+ */
1367
+ interface P21SismApiClient {
1368
+ p21Sism: {
1369
+ import: {
1370
+ recent: {
1371
+ list: (params?: Record<string, unknown>) => Promise<{
1372
+ data: unknown[];
1373
+ }>;
1374
+ };
1375
+ get: (importUid: string) => Promise<{
1376
+ data: unknown;
1377
+ }>;
1378
+ };
1379
+ impOeLine: {
1380
+ list: (params?: Record<string, unknown>) => Promise<{
1381
+ data: unknown[];
1382
+ }>;
1383
+ };
1384
+ scheduledImportMaster: {
1385
+ list: (params?: Record<string, unknown>) => Promise<{
1386
+ data: unknown[];
1387
+ }>;
1388
+ };
1389
+ };
1390
+ }
1391
+ interface P21SismActionsConfig {
1392
+ /** Cache key prefix (e.g. "ampro:"). Default: "". */
1393
+ cachePrefix?: string;
1394
+ /** CDN edge cache value passed to SDK. Default: 1 (hour). */
1395
+ edgeCache?: number;
1396
+ /** Redis TTL in seconds. Default: 3600 (1 hour). */
1397
+ redisTtl?: number;
1398
+ }
1399
+ interface P21SismActions {
1400
+ getRecentImports: (params?: Record<string, unknown>) => Promise<unknown[]>;
1401
+ getImport: (importId: string) => Promise<unknown | undefined>;
1402
+ getImportLines: (importId: number, params?: Record<string, unknown>) => Promise<unknown[]>;
1403
+ getScheduledImports: (params?: Record<string, unknown>) => Promise<unknown[]>;
1404
+ }
1405
+ /**
1406
+ * Creates server-side P21 SISM actions with Redis caching and edge cache support.
1407
+ *
1408
+ * Covers the P21 SISM (System Integration & Storage Management) endpoints:
1409
+ * imports, import lines, and scheduled import masters.
1410
+ *
1411
+ * @example
1412
+ * ```ts
1413
+ * import { createP21SismActions } from "@simpleapps-com/augur-server";
1414
+ * import { getAugurClient } from "./augur-client";
1415
+ *
1416
+ * export const p21SismActions = createP21SismActions(getAugurClient(), {
1417
+ * cachePrefix: "ampro:",
1418
+ * });
1419
+ *
1420
+ * const recentImports = await p21SismActions.getRecentImports({ hours: 24 });
1421
+ * const importDetail = await p21SismActions.getImport("12345");
1422
+ * ```
1423
+ */
1424
+ declare function createP21SismActions(api: P21SismApiClient, config?: P21SismActionsConfig): P21SismActions;
1425
+
1426
+ /**
1427
+ * The subset of augur-api used by agr-work actions.
1428
+ * Matches `api.agrWork` from the SDK.
1429
+ */
1430
+ interface AgrWorkApiClient {
1431
+ agrWork: {
1432
+ healthCheck: {
1433
+ get: () => Promise<{
1434
+ data: string;
1435
+ }>;
1436
+ };
1437
+ ping: {
1438
+ get: () => Promise<{
1439
+ data: string;
1440
+ }>;
1441
+ };
1442
+ };
1443
+ }
1444
+ interface AgrWorkActionsConfig {
1445
+ /** Cache key prefix (e.g. "ampro:"). Default: "". */
1446
+ cachePrefix?: string;
1447
+ }
1448
+ interface AgrWorkActions {
1449
+ healthCheck: () => Promise<string | undefined>;
1450
+ ping: () => Promise<string | undefined>;
1451
+ }
1452
+ /**
1453
+ * Creates server-side AGR Work actions for health monitoring and connectivity.
1454
+ *
1455
+ * Covers the AGR Work microservice endpoints: healthCheck and ping.
1456
+ * These are real-time operations and do not use caching.
1457
+ *
1458
+ * @example
1459
+ * ```ts
1460
+ * import { createAgrWorkActions } from "@simpleapps-com/augur-server";
1461
+ * import { getAugurClient } from "./augur-client";
1462
+ *
1463
+ * export const agrWorkActions = createAgrWorkActions(getAugurClient());
1464
+ *
1465
+ * const health = await agrWorkActions.healthCheck();
1466
+ * const pong = await agrWorkActions.ping();
1467
+ * ```
1468
+ */
1469
+ declare function createAgrWorkActions(api: AgrWorkApiClient, _config?: AgrWorkActionsConfig): AgrWorkActions;
1470
+
1471
+ /**
1472
+ * The subset of augur-api used by agr-info actions.
1473
+ * Matches `api.agrInfo` from the SDK.
1474
+ */
1475
+ interface AgrInfoApiClient {
1476
+ agrInfo: {
1477
+ context: {
1478
+ get: (siteId: string, params?: Record<string, unknown>) => Promise<{
1479
+ data: unknown;
1480
+ }>;
1481
+ };
1482
+ rubrics: {
1483
+ list: (params?: Record<string, unknown>) => Promise<{
1484
+ data: unknown[];
1485
+ }>;
1486
+ };
1487
+ microservices: {
1488
+ list: (params?: Record<string, unknown>) => Promise<{
1489
+ data: unknown[];
1490
+ }>;
1491
+ };
1492
+ akasha: {
1493
+ generate: {
1494
+ create: (params?: Record<string, unknown>) => Promise<{
1495
+ data: unknown;
1496
+ }>;
1497
+ };
1498
+ };
1499
+ joomla: {
1500
+ generate: {
1501
+ create: (params?: Record<string, unknown>) => Promise<{
1502
+ data: unknown;
1503
+ }>;
1504
+ };
1505
+ };
1506
+ };
1507
+ }
1508
+ interface AgrInfoActionsConfig {
1509
+ /** Cache key prefix (e.g. "ampro:"). Default: "". */
1510
+ cachePrefix?: string;
1511
+ /** CDN edge cache value passed to SDK. Default: 1 (hour). */
1512
+ edgeCache?: number;
1513
+ /** CDN edge cache for rarely-changing data. Default: 8 (hours). */
1514
+ longEdgeCache?: number;
1515
+ /** Redis TTL in seconds. Default: 3600 (1 hour). */
1516
+ redisTtl?: number;
1517
+ /** Redis TTL for rarely-changing data in seconds. Default: 28800 (8 hours). */
1518
+ longRedisTtl?: number;
1519
+ }
1520
+ interface AgrInfoActions {
1521
+ getContext: (params?: Record<string, unknown>) => Promise<unknown[]>;
1522
+ getRubrics: (params?: Record<string, unknown>) => Promise<unknown[]>;
1523
+ getMicroservices: (params?: Record<string, unknown>) => Promise<unknown[]>;
1524
+ generateAkasha: (data?: Record<string, unknown>) => Promise<unknown | undefined>;
1525
+ generateJoomla: (data?: Record<string, unknown>) => Promise<unknown | undefined>;
1526
+ }
1527
+ /**
1528
+ * Creates server-side AGR Info actions with Redis caching and edge cache support.
1529
+ *
1530
+ * Covers the AGR Info microservice endpoints: context, rubrics,
1531
+ * microservices, and AI generation (akasha/joomla).
1532
+ *
1533
+ * @example
1534
+ * ```ts
1535
+ * import { createAgrInfoActions } from "@simpleapps-com/augur-server";
1536
+ * import { getAugurClient } from "./augur-client";
1537
+ *
1538
+ * export const agrInfoActions = createAgrInfoActions(getAugurClient(), {
1539
+ * cachePrefix: "ampro:",
1540
+ * });
1541
+ *
1542
+ * const rubrics = await agrInfoActions.getRubrics();
1543
+ * const result = await agrInfoActions.generateAkasha({ prompt: "Hello" });
1544
+ * ```
1545
+ */
1546
+ declare function createAgrInfoActions(api: AgrInfoApiClient, config?: AgrInfoActionsConfig): AgrInfoActions;
1547
+
1548
+ /**
1549
+ * The subset of augur-api used by basecamp2 actions.
1550
+ * Matches `api.basecamp2` from the SDK.
1551
+ */
1552
+ interface Basecamp2ApiClient {
1553
+ basecamp2: {
1554
+ todos: {
1555
+ list: (params?: Record<string, unknown>) => Promise<{
1556
+ data: unknown[];
1557
+ }>;
1558
+ get: (todoId: number, params?: Record<string, unknown>) => Promise<{
1559
+ data: unknown;
1560
+ }>;
1561
+ };
1562
+ todosSummary: {
1563
+ list: (params?: Record<string, unknown>) => Promise<{
1564
+ data: unknown[];
1565
+ }>;
1566
+ };
1567
+ comments: {
1568
+ list: (params?: Record<string, unknown>) => Promise<{
1569
+ data: unknown[];
1570
+ }>;
1571
+ };
1572
+ people: {
1573
+ list: (params?: Record<string, unknown>) => Promise<{
1574
+ data: unknown[];
1575
+ }>;
1576
+ };
1577
+ projects: {
1578
+ list: (params?: Record<string, unknown>) => Promise<{
1579
+ data: unknown[];
1580
+ }>;
1581
+ };
1582
+ events: {
1583
+ list: (params?: Record<string, unknown>) => Promise<{
1584
+ data: unknown[];
1585
+ }>;
1586
+ };
1587
+ metrics: {
1588
+ list: (params?: Record<string, unknown>) => Promise<{
1589
+ data: unknown[];
1590
+ }>;
1591
+ };
1592
+ todolists: {
1593
+ list: (params?: Record<string, unknown>) => Promise<{
1594
+ data: unknown[];
1595
+ }>;
1596
+ };
1597
+ };
1598
+ }
1599
+ interface Basecamp2ActionsConfig {
1600
+ /** Cache key prefix (e.g. "ampro:"). Default: "". */
1601
+ cachePrefix?: string;
1602
+ /** CDN edge cache value passed to SDK. Default: 1 (hour). */
1603
+ edgeCache?: number;
1604
+ /** CDN edge cache for rarely-changing data like people. Default: 8 (hours). */
1605
+ longEdgeCache?: number;
1606
+ /** Redis TTL in seconds. Default: 3600 (1 hour). */
1607
+ redisTtl?: number;
1608
+ /** Redis TTL for rarely-changing data in seconds. Default: 28800 (8 hours). */
1609
+ longRedisTtl?: number;
1610
+ }
1611
+ interface Basecamp2Actions {
1612
+ getTodos: (params?: Record<string, unknown>) => Promise<unknown[]>;
1613
+ getTodo: (todoId: number) => Promise<unknown>;
1614
+ getTodosSummary: (params?: Record<string, unknown>) => Promise<unknown[]>;
1615
+ getComments: (params?: Record<string, unknown>) => Promise<unknown[]>;
1616
+ getPeople: (params?: Record<string, unknown>) => Promise<unknown[]>;
1617
+ getProjects: (params?: Record<string, unknown>) => Promise<unknown[]>;
1618
+ getEvents: (params?: Record<string, unknown>) => Promise<unknown[]>;
1619
+ getMetrics: (params?: Record<string, unknown>) => Promise<unknown[]>;
1620
+ getTodolists: (params?: Record<string, unknown>) => Promise<unknown[]>;
1621
+ }
1622
+ /**
1623
+ * Creates server-side basecamp2 actions with Redis caching and edge cache support.
1624
+ *
1625
+ * Covers the Basecamp2 project management endpoints: todos, todo summaries,
1626
+ * comments, people, projects, events, metrics, and todolists.
1627
+ *
1628
+ * @example
1629
+ * ```ts
1630
+ * import { createBasecamp2Actions } from "@simpleapps-com/augur-server";
1631
+ * import { getAugurClient } from "./augur-client";
1632
+ *
1633
+ * export const basecamp2Actions = createBasecamp2Actions(getAugurClient(), {
1634
+ * cachePrefix: "ampro:",
1635
+ * });
1636
+ *
1637
+ * const todos = await basecamp2Actions.getTodos();
1638
+ * const people = await basecamp2Actions.getPeople();
1639
+ * ```
1640
+ */
1641
+ declare function createBasecamp2Actions(api: Basecamp2ApiClient, config?: Basecamp2ActionsConfig): Basecamp2Actions;
1642
+
1643
+ /**
1644
+ * The subset of augur-api used by brand-folder actions.
1645
+ * Matches `api.brandFolder` from the SDK.
1646
+ */
1647
+ interface BrandFolderApiClient {
1648
+ brandFolder: {
1649
+ categories: {
1650
+ list: (params?: Record<string, unknown>) => Promise<{
1651
+ data: unknown[];
1652
+ }>;
1653
+ get: (categoryId: string, params?: Record<string, unknown>) => Promise<{
1654
+ data: unknown;
1655
+ }>;
1656
+ focus: {
1657
+ create: (params: Record<string, unknown>) => Promise<{
1658
+ data: unknown;
1659
+ }>;
1660
+ };
1661
+ };
1662
+ };
1663
+ }
1664
+ interface BrandFolderActionsConfig {
1665
+ /** Cache key prefix (e.g. "ampro:"). Default: "". */
1666
+ cachePrefix?: string;
1667
+ /** CDN edge cache value passed to SDK. Default: 1 (hour). */
1668
+ edgeCache?: number;
1669
+ /** Redis TTL in seconds. Default: 3600 (1 hour). */
1670
+ redisTtl?: number;
1671
+ }
1672
+ interface BrandFolderActions {
1673
+ getCategories: (params?: Record<string, unknown>) => Promise<unknown[]>;
1674
+ getCategory: (categoryId: string) => Promise<unknown>;
1675
+ createFocus: (categoryId: string, data: Record<string, unknown>) => Promise<unknown | undefined>;
1676
+ }
1677
+ /**
1678
+ * Creates server-side brand-folder actions with Redis caching and edge cache support.
1679
+ *
1680
+ * Covers the Brand Folder service endpoints: category listing, category detail,
1681
+ * and category focus creation.
1682
+ *
1683
+ * @example
1684
+ * ```ts
1685
+ * import { createBrandFolderActions } from "@simpleapps-com/augur-server";
1686
+ * import { getAugurClient } from "./augur-client";
1687
+ *
1688
+ * export const brandFolderActions = createBrandFolderActions(getAugurClient(), {
1689
+ * cachePrefix: "ampro:",
1690
+ * });
1691
+ *
1692
+ * const categories = await brandFolderActions.getCategories();
1693
+ * const category = await brandFolderActions.getCategory("cat-123");
1694
+ * const focus = await brandFolderActions.createFocus("cat-123", { focusLevel: "primary" });
1695
+ * ```
1696
+ */
1697
+ declare function createBrandFolderActions(api: BrandFolderApiClient, config?: BrandFolderActionsConfig): BrandFolderActions;
1698
+
1699
+ /**
1700
+ * The subset of augur-api used by gregorovich actions.
1701
+ * Matches `api.gregorovich` from the SDK.
1702
+ */
1703
+ interface GregorovichApiClient {
1704
+ gregorovich: {
1705
+ chatGpt: {
1706
+ ask: {
1707
+ get: (params: Record<string, unknown>) => Promise<{
1708
+ data: unknown;
1709
+ }>;
1710
+ };
1711
+ };
1712
+ documents: {
1713
+ list: (params?: Record<string, unknown>) => Promise<{
1714
+ data: unknown[];
1715
+ }>;
1716
+ create: (data: Record<string, unknown>) => Promise<{
1717
+ data: unknown;
1718
+ }>;
1719
+ };
1720
+ ollama: {
1721
+ generate: {
1722
+ create: (data: Record<string, unknown>) => Promise<{
1723
+ data: unknown;
1724
+ }>;
1725
+ };
1726
+ };
1727
+ };
1728
+ }
1729
+ interface GregorovichActionsConfig {
1730
+ /** Cache key prefix (e.g. "ampro:"). Default: "". */
1731
+ cachePrefix?: string;
1732
+ /** CDN edge cache value passed to SDK. Default: 1 (hour). */
1733
+ edgeCache?: number;
1734
+ /** Redis TTL in seconds. Default: 3600 (1 hour). */
1735
+ redisTtl?: number;
1736
+ }
1737
+ interface GregorovichActions {
1738
+ askChatGpt: (params: Record<string, unknown>) => Promise<unknown | undefined>;
1739
+ getDocuments: (params?: Record<string, unknown>) => Promise<unknown[]>;
1740
+ createDocument: (data: Record<string, unknown>) => Promise<unknown | undefined>;
1741
+ generateOllama: (data: Record<string, unknown>) => Promise<unknown | undefined>;
1742
+ }
1743
+ /**
1744
+ * Creates server-side gregorovich actions with Redis caching and edge cache support.
1745
+ *
1746
+ * Covers the Gregorovich AI service endpoints: ChatGPT ask, document listing,
1747
+ * document creation, and Ollama generation.
1748
+ *
1749
+ * @example
1750
+ * ```ts
1751
+ * import { createGregorovichActions } from "@simpleapps-com/augur-server";
1752
+ * import { getAugurClient } from "./augur-client";
1753
+ *
1754
+ * export const gregorovichActions = createGregorovichActions(getAugurClient(), {
1755
+ * cachePrefix: "ampro:",
1756
+ * });
1757
+ *
1758
+ * const answer = await gregorovichActions.askChatGpt({ question: "What is AI?" });
1759
+ * const docs = await gregorovichActions.getDocuments();
1760
+ * ```
1761
+ */
1762
+ declare function createGregorovichActions(api: GregorovichApiClient, config?: GregorovichActionsConfig): GregorovichActions;
1763
+
1764
+ /**
1765
+ * The subset of augur-api used by slack actions.
1766
+ * Matches `api.slack` from the SDK.
1767
+ */
1768
+ interface SlackApiClient {
1769
+ slack: {
1770
+ webHook: {
1771
+ create: (data: Record<string, unknown>) => Promise<{
1772
+ data: unknown;
1773
+ }>;
1774
+ list: (params?: Record<string, unknown>) => Promise<{
1775
+ data: unknown[];
1776
+ }>;
1777
+ };
1778
+ };
1779
+ }
1780
+ interface SlackActionsConfig {
1781
+ /** Cache key prefix (e.g. "ampro:"). Default: "". */
1782
+ cachePrefix?: string;
1783
+ /** CDN edge cache value passed to SDK. Default: 1 (hour). */
1784
+ edgeCache?: number;
1785
+ /** Redis TTL in seconds. Default: 3600 (1 hour). */
1786
+ redisTtl?: number;
1787
+ }
1788
+ interface SlackActions {
1789
+ sendWebhook: (data: Record<string, unknown>) => Promise<unknown | undefined>;
1790
+ getWebhooks: (params?: Record<string, unknown>) => Promise<unknown[]>;
1791
+ }
1792
+ /**
1793
+ * Creates server-side slack actions with Redis caching and edge cache support.
1794
+ *
1795
+ * Covers the Slack integration endpoints: webhook sending and webhook listing.
1796
+ *
1797
+ * @example
1798
+ * ```ts
1799
+ * import { createSlackActions } from "@simpleapps-com/augur-server";
1800
+ * import { getAugurClient } from "./augur-client";
1801
+ *
1802
+ * export const slackActions = createSlackActions(getAugurClient(), {
1803
+ * cachePrefix: "ampro:",
1804
+ * });
1805
+ *
1806
+ * const result = await slackActions.sendWebhook({ text: "Hello!" });
1807
+ * const webhooks = await slackActions.getWebhooks();
1808
+ * ```
1809
+ */
1810
+ declare function createSlackActions(api: SlackApiClient, config?: SlackActionsConfig): SlackActions;
1811
+
1812
+ interface SiteActionsConfig {
1813
+ /** Cache key prefix shared across all services (e.g. "ampro:") */
1814
+ cachePrefix?: string;
1815
+ /** Default edge cache TTL in seconds */
1816
+ edgeCache?: number;
1817
+ /** Default Redis TTL in seconds */
1818
+ redisTtl?: number;
1819
+ /** Long-lived edge cache TTL for rarely-changing data */
1820
+ longEdgeCache?: number;
1821
+ /** Long-lived Redis TTL for rarely-changing data */
1822
+ longRedisTtl?: number;
1823
+ /** Default contact ID for commerce operations */
1824
+ defaultContactId?: string | number;
1825
+ /** Default customer ID for pricing and commerce */
1826
+ defaultCustomerId?: string | number;
1827
+ /** UOM conversion function for commerce (e.g. "EA" → "EACH") */
1828
+ convertUnitOfMeasure?: (uom: string) => string;
1829
+ /** Pricing-specific overrides */
1830
+ pricing?: {
1831
+ taxRedisTtl?: number;
1832
+ };
1833
+ /** Items-specific overrides */
1834
+ items?: {
1835
+ sortChildren?: boolean;
1836
+ };
1837
+ /** Search-specific overrides */
1838
+ search?: {
1839
+ defaultSourceFields?: string;
1840
+ };
1841
+ /** Shipping config — fromAddress is required for shipping to work */
1842
+ shipping?: {
1843
+ fromAddress: ShippingAddress;
1844
+ defaultServiceCodes?: string[];
1845
+ };
1846
+ /** VMI-specific overrides */
1847
+ vmi?: {
1848
+ shortRedisTtl?: number;
1849
+ };
1850
+ }
1851
+ interface SiteActions {
1852
+ pricing: PricingActions;
1853
+ items: ItemActions;
1854
+ commerce: CommerceActions;
1855
+ search: SearchActions;
1856
+ orders: OrderActions;
1857
+ shipping: ShippingActions;
1858
+ joomla: JoomlaActions;
1859
+ legacy: LegacyActions;
1860
+ customers: CustomersActions;
1861
+ smartyStreets: SmartyStreetsActions;
1862
+ p21Pim: P21PimActions;
1863
+ agrSite: AgrSiteActions;
1864
+ avalara: AvalaraActions;
1865
+ payments: PaymentsActions;
1866
+ ups: UpsActions;
1867
+ logistics: LogisticsActions;
1868
+ nexus: NexusActions;
1869
+ vmi: VmiActions;
1870
+ p21Core: P21CoreActions;
1871
+ p21Apis: P21ApisActions;
1872
+ p21Sism: P21SismActions;
1873
+ agrWork: AgrWorkActions;
1874
+ agrInfo: AgrInfoActions;
1875
+ basecamp2: Basecamp2Actions;
1876
+ brandFolder: BrandFolderActions;
1877
+ gregorovich: GregorovichActions;
1878
+ slack: SlackActions;
1879
+ }
1880
+ /**
1881
+ * Creates a unified site actions object with all service factories.
1882
+ *
1883
+ * Shared config (cachePrefix, edgeCache, redisTtl, etc.) is passed to all
1884
+ * services automatically. Per-service overrides are available for services
1885
+ * with additional configuration.
1886
+ *
1887
+ * @example
1888
+ * ```ts
1889
+ * import { createSiteActions } from "@simpleapps-com/augur-server";
1890
+ * import { getAugurClient } from "./augur-client";
1891
+ *
1892
+ * export const actions = createSiteActions(getAugurClient(), {
1893
+ * cachePrefix: "ampro:",
1894
+ * defaultCustomerId: process.env.NEXT_PUBLIC_DEFAULT_CUSTOMER_ID,
1895
+ * defaultContactId: process.env.NEXT_PUBLIC_DEFAULT_CONTACT_ID,
1896
+ * convertUnitOfMeasure: (uom) => uom === "EA" ? "EACH" : uom,
1897
+ * items: { sortChildren: true },
1898
+ * shipping: {
1899
+ * fromAddress: { address1: "123 Main", city: "Provo", state: "UT", postalCode: "84606" },
1900
+ * defaultServiceCodes: ["03"],
1901
+ * },
1902
+ * });
1903
+ *
1904
+ * // Usage:
1905
+ * const price = await actions.pricing.getItemPrice("ITEM-1");
1906
+ * const doc = await actions.items.getInvMastDoc("ITEM-1");
1907
+ * const cart = await actions.commerce.cartHdrLookup({ userId: 123 });
1908
+ * ```
1909
+ */
1910
+ declare function createSiteActions<TApi extends object>(api: TApi, config?: SiteActionsConfig): SiteActions;
1911
+
1912
+ export { type P21PimApiClient as $, type AgrInfoActions as A, type Basecamp2Actions as B, type CommerceActions as C, type JoomlaApiClient as D, type LegacyActionsConfig as E, type LegacyApiClient as F, type GregorovichActions as G, type LogisticsActions as H, type ItemActions as I, type JoomlaActions as J, type LogisticsActionsConfig as K, type LegacyActions as L, type LogisticsApiClient as M, type NexusActions as N, type NexusActionsConfig as O, type NexusApiClient as P, type OrderActions as Q, type OrderActionsConfig as R, type OrderApiClient as S, type P21ApisActions as T, type P21ApisActionsConfig as U, type P21ApisApiClient as V, type P21CoreActions as W, type P21CoreActionsConfig as X, type P21CoreApiClient as Y, type P21PimActions as Z, type P21PimActionsConfig as _, type AgrInfoActionsConfig as a, type P21SismActions as a0, type P21SismActionsConfig as a1, type P21SismApiClient as a2, type PaymentsActions as a3, type PaymentsActionsConfig as a4, type PaymentsApiClient as a5, type PricingActions as a6, type PricingActionsConfig as a7, type PricingApiClient as a8, type SearchActions as a9, createBrandFolderActions as aA, createCommerceActions as aB, createCustomersActions as aC, createGregorovichActions as aD, createItemActions as aE, createJoomlaActions as aF, createLegacyActions as aG, createLogisticsActions as aH, createNexusActions as aI, createOrderActions as aJ, createP21ApisActions as aK, createP21CoreActions as aL, createP21PimActions as aM, createP21SismActions as aN, createPaymentsActions as aO, createPricingActions as aP, createSearchActions as aQ, createShippingActions as aR, createSiteActions as aS, createSlackActions as aT, createSmartyStreetsActions as aU, createUpsActions as aV, createVmiActions as aW, type SearchActionsConfig as aa, type SearchApiClient as ab, type SearchPage as ac, type ShippingActions as ad, type ShippingActionsConfig as ae, type ShippingAddress as af, type ShippingApiClient as ag, type SiteActions as ah, type SiteActionsConfig as ai, type SlackActions as aj, type SlackActionsConfig as ak, type SlackApiClient as al, type SmartyStreetsActions as am, type SmartyStreetsActionsConfig as an, type SmartyStreetsApiClient as ao, type UpsActions as ap, type UpsActionsConfig as aq, type UpsApiClient as ar, type VmiActions as as, type VmiActionsConfig as at, type VmiApiClient as au, createAgrInfoActions as av, createAgrSiteActions as aw, createAgrWorkActions as ax, createAvalaraActions as ay, createBasecamp2Actions as az, type AgrInfoApiClient as b, type AgrSiteActions as c, type AgrSiteActionsConfig as d, type AgrSiteApiClient as e, type AgrWorkActions as f, type AgrWorkActionsConfig as g, type AgrWorkApiClient as h, type AvalaraActions as i, type AvalaraActionsConfig as j, type AvalaraApiClient as k, type Basecamp2ActionsConfig as l, type Basecamp2ApiClient as m, type BrandFolderActions as n, type BrandFolderActionsConfig as o, type BrandFolderApiClient as p, type CommerceActionsConfig as q, type CommerceApiClient as r, type CustomersActions as s, type CustomersActionsConfig as t, type CustomersApiClient as u, type GregorovichActionsConfig as v, type GregorovichApiClient as w, type ItemActionsConfig as x, type ItemsApiClient as y, type JoomlaActionsConfig as z };