@simpleapps-com/augur-server 0.2.6 → 0.2.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { QueryClient } from '@tanstack/react-query';
2
2
  export { QueryOptionsConfig, createQueryOptions, createSuspenseQueryOptions } from './query.js';
3
- import { TPriceData, TTaxItem, TTax, TCategory, TAttribute, TInvMast, TInvMastDoc, TStockData, TItemAccessory, TStock, TCartLookUp, TCartLine, TProductItem } from '@simpleapps-com/augur-utils';
3
+ import { TPriceData, TTaxItem, TTax, TCategory, TAttribute, TInvMast, TInvMastDoc, TStockData, TItemAccessory, TStock, TCartLookUp, TCartLine, TProductItem, TWebDesc } from '@simpleapps-com/augur-utils';
4
4
 
5
5
  declare const env: "development" | "staging" | "production";
6
6
  declare const isDev: boolean;
@@ -307,7 +307,8 @@ interface CommerceActions {
307
307
  }) => Promise<TCartLookUp>;
308
308
  getCartLines: (cartHdrUid: number) => Promise<TCartLine[]>;
309
309
  addToCart: (cartHdrUid: number, items: {
310
- itemId: string;
310
+ itemId?: string;
311
+ invMastUid?: number;
311
312
  quantity: number;
312
313
  unitOfMeasure: string;
313
314
  }[]) => Promise<unknown>;
@@ -393,40 +394,45 @@ interface OrderActions {
393
394
  */
394
395
  declare function createOrderActions(api: OrderApiClient, config?: OrderActionsConfig): OrderActions;
395
396
 
396
- /**
397
- * The subset of augur-api used by search actions.
398
- * Avoids importing the full SDK type so augur-server stays lightweight.
399
- */
400
- interface SearchApiClient {
401
- openSearch: {
402
- itemSearch: {
397
+ /** Shape of the openSearch service used by search actions. */
398
+ interface OpenSearchService {
399
+ itemSearch: {
400
+ list: (params: Record<string, unknown>) => Promise<{
401
+ data: {
402
+ items: TProductItem[];
403
+ totalResults: number;
404
+ };
405
+ }>;
406
+ attributes: {
403
407
  list: (params: Record<string, unknown>) => Promise<{
404
408
  data: {
405
- items: TProductItem[];
406
- totalResults: number;
409
+ attributes: TAttribute[];
407
410
  };
408
411
  }>;
409
- attributes: {
410
- list: (params: Record<string, unknown>) => Promise<{
411
- data: {
412
- attributes: TAttribute[];
413
- };
414
- }>;
415
- };
416
412
  };
417
- suggestions: {
418
- suggest: {
419
- list: (params: Record<string, unknown>) => Promise<{
420
- data: {
421
- data: unknown[];
422
- total: number;
423
- totalResults: number;
424
- };
425
- }>;
426
- };
413
+ };
414
+ suggestions: {
415
+ suggest: {
416
+ list: (params: Record<string, unknown>) => Promise<{
417
+ data: {
418
+ data: unknown[];
419
+ total: number;
420
+ totalResults: number;
421
+ };
422
+ }>;
427
423
  };
428
424
  };
429
425
  }
426
+ /**
427
+ * The subset of augur-api used by search actions.
428
+ * Accepts both `openSearch` (camelCase) and `opensearch` (lowercase)
429
+ * to match SDK v0.9.x which exposes `api.opensearch`.
430
+ */
431
+ type SearchApiClient = {
432
+ openSearch: OpenSearchService;
433
+ } | {
434
+ opensearch: OpenSearchService;
435
+ };
430
436
  interface SearchActionsConfig {
431
437
  /** Cache key prefix (e.g. "ampro:"). Default: "". */
432
438
  cachePrefix?: string;
@@ -467,27 +473,6 @@ interface SearchActions {
467
473
  filters?: [string, string][];
468
474
  }, itemCategoryUid?: number | string, pageParam?: number) => Promise<SearchPage>;
469
475
  }
470
- /**
471
- * Creates server-side search actions with Redis caching and edge cache support.
472
- *
473
- * Uses `withServerCache` which produces cache keys compatible with augur-hooks'
474
- * `withCache`, so server-prefetched data is shared with client-side hooks.
475
- *
476
- * @example
477
- * ```ts
478
- * // lib/search-actions.ts
479
- * import { createSearchActions } from "@simpleapps-com/augur-server";
480
- * import { getAugurClient } from "./augur-client";
481
- *
482
- * export const searchActions = createSearchActions(getAugurClient(), {
483
- * cachePrefix: "ampro:",
484
- * });
485
- *
486
- * // In a server component:
487
- * const attrs = await searchActions.getSearchAttributes("widget");
488
- * const results = await searchActions.itemSearch({ q: "widget", limit: 20, offset: 0 });
489
- * ```
490
- */
491
476
  declare function createSearchActions(api: SearchApiClient, config?: SearchActionsConfig): SearchActions;
492
477
 
493
478
  interface ShippingAddress {
@@ -608,4 +593,1285 @@ interface JoomlaActions {
608
593
  */
609
594
  declare function createJoomlaActions(api: JoomlaApiClient, config?: JoomlaActionsConfig): JoomlaActions;
610
595
 
611
- export { type CommerceActions, type CommerceActionsConfig, type CommerceApiClient, type ItemActions, type ItemActionsConfig, type ItemsApiClient, type JoomlaActions, type JoomlaActionsConfig, type JoomlaApiClient, type OrderActions, type OrderActionsConfig, type OrderApiClient, type PricingActions, type PricingActionsConfig, type PricingApiClient, type SearchActions, type SearchActionsConfig, type SearchApiClient, type SearchPage, type ShippingActions, type ShippingActionsConfig, type ShippingAddress, type ShippingApiClient, cacheGet, cacheSet, createCommerceActions, createItemActions, createJoomlaActions, createOrderActions, createPricingActions, createSearchActions, createServerQueryClient, createShippingActions, env, getCircuitState, getServerQueryClient, isDev, isProduction, isRedisConnected, isStaging, sdkCall, withServerCache };
596
+ /**
597
+ * The subset of augur-api used by legacy actions.
598
+ * Matches `api.legacy` from the SDK.
599
+ */
600
+ interface LegacyApiClient {
601
+ legacy: {
602
+ invMast: {
603
+ webDesc: {
604
+ list: (invMastUid: number, params?: Record<string, unknown>) => Promise<{
605
+ data: TWebDesc[];
606
+ }>;
607
+ };
608
+ alsoBought: {
609
+ list: (invMastUid: number, params?: Record<string, unknown>) => Promise<{
610
+ data: unknown[];
611
+ }>;
612
+ };
613
+ tags: {
614
+ list: (invMastUid: number, params?: Record<string, unknown>) => Promise<{
615
+ data: unknown[];
616
+ }>;
617
+ };
618
+ };
619
+ legacy: {
620
+ state: {
621
+ list: (params?: Record<string, unknown>) => Promise<{
622
+ data: unknown[];
623
+ }>;
624
+ };
625
+ };
626
+ };
627
+ }
628
+ interface LegacyActionsConfig {
629
+ /** Cache key prefix (e.g. "ampro:"). Default: "". */
630
+ cachePrefix?: string;
631
+ /** CDN edge cache value passed to SDK. Default: 1 (hour). */
632
+ edgeCache?: number;
633
+ /** CDN edge cache for rarely-changing data like states. Default: 8 (hours). */
634
+ longEdgeCache?: number;
635
+ /** Redis TTL in seconds. Default: 3600 (1 hour). */
636
+ redisTtl?: number;
637
+ /** Redis TTL for rarely-changing data in seconds. Default: 28800 (8 hours). */
638
+ longRedisTtl?: number;
639
+ }
640
+ interface LegacyActions {
641
+ getItemWebDesc: (invMastUid: number) => Promise<TWebDesc | undefined>;
642
+ getAlsoBoughtItems: (invMastUid: number) => Promise<unknown[]>;
643
+ getItemTags: (invMastUid: number) => Promise<unknown[]>;
644
+ getStates: (params?: {
645
+ twoLetterCode?: string;
646
+ }) => Promise<unknown[]>;
647
+ }
648
+ /**
649
+ * Creates server-side legacy actions with Redis caching and edge cache support.
650
+ *
651
+ * Covers the legacy microservice endpoints used by ecommerce sites:
652
+ * webDesc, alsoBought, tags, and states.
653
+ *
654
+ * @example
655
+ * ```ts
656
+ * import { createLegacyActions } from "@simpleapps-com/augur-server";
657
+ * import { getAugurClient } from "./augur-client";
658
+ *
659
+ * export const legacyActions = createLegacyActions(getAugurClient(), {
660
+ * cachePrefix: "ampro:",
661
+ * });
662
+ *
663
+ * const webDesc = await legacyActions.getItemWebDesc(12345);
664
+ * const states = await legacyActions.getStates();
665
+ * ```
666
+ */
667
+ declare function createLegacyActions(api: LegacyApiClient, config?: LegacyActionsConfig): LegacyActions;
668
+
669
+ /**
670
+ * The subset of augur-api used by customer actions.
671
+ * Matches `api.customers` from the SDK.
672
+ */
673
+ interface CustomersApiClient {
674
+ customers: {
675
+ customer: {
676
+ get: (customerId: number, params?: Record<string, unknown>) => Promise<{
677
+ data: unknown;
678
+ }>;
679
+ lookup: {
680
+ get: (params: Record<string, unknown>) => Promise<{
681
+ data: unknown[];
682
+ }>;
683
+ };
684
+ doc: {
685
+ list: (customerId: number, params?: Record<string, unknown>) => Promise<{
686
+ data: unknown;
687
+ }>;
688
+ };
689
+ orders: {
690
+ list: (customerId: number, params?: Record<string, unknown>) => Promise<{
691
+ data: unknown[];
692
+ }>;
693
+ };
694
+ shipTo: {
695
+ list: (customerId: number, params?: Record<string, unknown>) => Promise<{
696
+ data: unknown[];
697
+ }>;
698
+ };
699
+ };
700
+ contacts: {
701
+ list: (params?: Record<string, unknown>) => Promise<{
702
+ data: unknown[];
703
+ }>;
704
+ };
705
+ };
706
+ }
707
+ interface CustomersActionsConfig {
708
+ /** Cache key prefix (e.g. "ampro:"). Default: "". */
709
+ cachePrefix?: string;
710
+ /** CDN edge cache value passed to SDK. Default: 1 (hour). */
711
+ edgeCache?: number;
712
+ /** Redis TTL in seconds. Default: 3600 (1 hour). */
713
+ redisTtl?: number;
714
+ }
715
+ interface CustomersActions {
716
+ getCustomer: (customerId: number) => Promise<unknown>;
717
+ customerLookup: (params: Record<string, unknown>) => Promise<unknown[]>;
718
+ getCustomerDoc: (customerId: number) => Promise<unknown>;
719
+ getCustomerOrders: (customerId: number, params?: Record<string, unknown>) => Promise<unknown[]>;
720
+ getContacts: (params?: Record<string, unknown>) => Promise<unknown[]>;
721
+ getShipToAddresses: (customerId: number) => Promise<unknown[]>;
722
+ }
723
+ /**
724
+ * Creates server-side customer actions with Redis caching and edge cache support.
725
+ *
726
+ * Covers the customers microservice endpoints used by ecommerce sites:
727
+ * customer get, lookup, doc, orders, contacts, and ship-to addresses.
728
+ *
729
+ * @example
730
+ * ```ts
731
+ * import { createCustomersActions } from "@simpleapps-com/augur-server";
732
+ * import { getAugurClient } from "./augur-client";
733
+ *
734
+ * export const customersActions = createCustomersActions(getAugurClient(), {
735
+ * cachePrefix: "ampro:",
736
+ * });
737
+ *
738
+ * const customer = await customersActions.getCustomer(123);
739
+ * const orders = await customersActions.getCustomerOrders(123);
740
+ * ```
741
+ */
742
+ declare function createCustomersActions(api: CustomersApiClient, config?: CustomersActionsConfig): CustomersActions;
743
+
744
+ /**
745
+ * The subset of augur-api used by SmartyStreets actions.
746
+ * Matches `api.smartyStreets` from the SDK.
747
+ */
748
+ interface SmartyStreetsApiClient {
749
+ smartyStreets: {
750
+ us: {
751
+ lookup: {
752
+ get: (params: Record<string, unknown>) => Promise<{
753
+ data: unknown;
754
+ }>;
755
+ };
756
+ };
757
+ };
758
+ }
759
+ interface SmartyStreetsActionsConfig {
760
+ /** Cache key prefix (e.g. "ampro:"). Default: "". */
761
+ cachePrefix?: string;
762
+ }
763
+ interface SmartyStreetsActions {
764
+ validateAddress: (params: Record<string, unknown>) => Promise<unknown>;
765
+ }
766
+ /**
767
+ * Creates server-side SmartyStreets actions for address validation.
768
+ *
769
+ * Note: Address validation is a real-time operation and does NOT use caching.
770
+ * Each call hits the SmartyStreets API directly to ensure up-to-date results.
771
+ *
772
+ * @example
773
+ * ```ts
774
+ * import { createSmartyStreetsActions } from "@simpleapps-com/augur-server";
775
+ * import { getAugurClient } from "./augur-client";
776
+ *
777
+ * export const smartyStreetsActions = createSmartyStreetsActions(getAugurClient());
778
+ *
779
+ * const result = await smartyStreetsActions.validateAddress({
780
+ * address1: "123 Main St",
781
+ * city: "Provo",
782
+ * state: "UT",
783
+ * postalCode: "84606",
784
+ * });
785
+ * ```
786
+ */
787
+ declare function createSmartyStreetsActions(api: SmartyStreetsApiClient, config?: SmartyStreetsActionsConfig): SmartyStreetsActions;
788
+
789
+ /**
790
+ * The subset of augur-api used by P21 PIM actions.
791
+ * Matches `api.p21Pim` from the SDK.
792
+ */
793
+ interface P21PimApiClient {
794
+ p21Pim: {
795
+ invMastExt: {
796
+ get: (invMastUid: number, params?: Record<string, unknown>) => Promise<{
797
+ data: unknown;
798
+ }>;
799
+ list: (params?: Record<string, unknown>) => Promise<{
800
+ data: unknown[];
801
+ }>;
802
+ };
803
+ };
804
+ }
805
+ interface P21PimActionsConfig {
806
+ /** Cache key prefix (e.g. "ampro:"). Default: "". */
807
+ cachePrefix?: string;
808
+ /** CDN edge cache value passed to SDK. Default: 1 (hour). */
809
+ edgeCache?: number;
810
+ /** Redis TTL in seconds. Default: 3600 (1 hour). */
811
+ redisTtl?: number;
812
+ }
813
+ interface P21PimActions {
814
+ getInvMastExt: (invMastUid: number) => Promise<unknown>;
815
+ listInvMastExt: (params?: Record<string, unknown>) => Promise<unknown[]>;
816
+ }
817
+ /**
818
+ * Creates server-side P21 PIM actions with Redis caching and edge cache support.
819
+ *
820
+ * Covers the P21 PIM microservice endpoints for extended inventory data
821
+ * including UPC/EAN codes, brand information, and SEO metadata.
822
+ *
823
+ * @example
824
+ * ```ts
825
+ * import { createP21PimActions } from "@simpleapps-com/augur-server";
826
+ * import { getAugurClient } from "./augur-client";
827
+ *
828
+ * export const p21PimActions = createP21PimActions(getAugurClient(), {
829
+ * cachePrefix: "ampro:",
830
+ * });
831
+ *
832
+ * const ext = await p21PimActions.getInvMastExt(12345);
833
+ * const list = await p21PimActions.listInvMastExt({ limit: 20 });
834
+ * ```
835
+ */
836
+ declare function createP21PimActions(api: P21PimApiClient, config?: P21PimActionsConfig): P21PimActions;
837
+
838
+ /**
839
+ * The subset of augur-api used by AGR Site actions.
840
+ * Matches `api.agrSite` from the SDK.
841
+ */
842
+ interface AgrSiteApiClient {
843
+ agrSite: {
844
+ settings: {
845
+ list: (params?: Record<string, unknown>) => Promise<{
846
+ data: unknown[];
847
+ }>;
848
+ };
849
+ metaFiles: {
850
+ list: (params?: Record<string, unknown>) => Promise<{
851
+ data: unknown[];
852
+ }>;
853
+ };
854
+ };
855
+ }
856
+ interface AgrSiteActionsConfig {
857
+ /** Cache key prefix (e.g. "ampro:"). Default: "". */
858
+ cachePrefix?: string;
859
+ /** CDN edge cache value for rarely-changing data. Default: 8 (hours). */
860
+ longEdgeCache?: number;
861
+ /** Redis TTL for rarely-changing data in seconds. Default: 28800 (8 hours). */
862
+ longRedisTtl?: number;
863
+ }
864
+ interface AgrSiteActions {
865
+ getSettings: (serviceName?: string) => Promise<unknown[]>;
866
+ getMetaFiles: (params?: Record<string, unknown>) => Promise<unknown[]>;
867
+ }
868
+ /**
869
+ * Creates server-side AGR Site actions with Redis caching and edge cache support.
870
+ *
871
+ * Covers the AGR Site microservice endpoints for site configuration settings
872
+ * and meta file management (robots.txt, etc.). Both endpoints use long TTLs
873
+ * since site settings and meta files rarely change.
874
+ *
875
+ * @example
876
+ * ```ts
877
+ * import { createAgrSiteActions } from "@simpleapps-com/augur-server";
878
+ * import { getAugurClient } from "./augur-client";
879
+ *
880
+ * export const agrSiteActions = createAgrSiteActions(getAugurClient(), {
881
+ * cachePrefix: "ampro:",
882
+ * });
883
+ *
884
+ * const settings = await agrSiteActions.getSettings("my-service");
885
+ * const metaFiles = await agrSiteActions.getMetaFiles();
886
+ * ```
887
+ */
888
+ declare function createAgrSiteActions(api: AgrSiteApiClient, config?: AgrSiteActionsConfig): AgrSiteActions;
889
+
890
+ /**
891
+ * The subset of augur-api used by Avalara actions.
892
+ * Matches `api.avalara` from the SDK.
893
+ */
894
+ interface AvalaraApiClient {
895
+ avalara: {
896
+ rates: {
897
+ create: (data: Record<string, unknown>) => Promise<{
898
+ data: unknown;
899
+ }>;
900
+ };
901
+ };
902
+ }
903
+ interface AvalaraActionsConfig {
904
+ /** Cache key prefix (e.g. "ampro:"). Default: "". */
905
+ cachePrefix?: string;
906
+ }
907
+ interface AvalaraActions {
908
+ calculateTax: (data: Record<string, unknown>) => Promise<unknown>;
909
+ }
910
+ /**
911
+ * Creates server-side Avalara actions for real-time tax calculation.
912
+ *
913
+ * Note: Tax calculation is a real-time operation and does NOT use caching.
914
+ * Each call hits the Avalara API directly to ensure up-to-date tax rates.
915
+ *
916
+ * @example
917
+ * ```ts
918
+ * import { createAvalaraActions } from "@simpleapps-com/augur-server";
919
+ * import { getAugurClient } from "./augur-client";
920
+ *
921
+ * export const avalaraActions = createAvalaraActions(getAugurClient());
922
+ *
923
+ * const taxResult = await avalaraActions.calculateTax({
924
+ * lines: [{ amount: 100.00, description: "Widget" }],
925
+ * addresses: {
926
+ * shipTo: {
927
+ * line1: "123 Main St",
928
+ * city: "Irvine",
929
+ * region: "CA",
930
+ * country: "US",
931
+ * postalCode: "92602",
932
+ * },
933
+ * },
934
+ * type: "SalesOrder",
935
+ * });
936
+ * ```
937
+ */
938
+ declare function createAvalaraActions(api: AvalaraApiClient, config?: AvalaraActionsConfig): AvalaraActions;
939
+
940
+ /**
941
+ * The subset of augur-api used by payment actions.
942
+ * Matches `api.payments` from the SDK.
943
+ */
944
+ interface PaymentsApiClient {
945
+ payments: {
946
+ unified: {
947
+ transactionSetup: {
948
+ get: (params: Record<string, unknown>) => Promise<{
949
+ data: unknown;
950
+ }>;
951
+ };
952
+ accountQuery: {
953
+ get: (params: Record<string, unknown>) => Promise<{
954
+ data: unknown;
955
+ }>;
956
+ };
957
+ surcharge: {
958
+ get: (params: Record<string, unknown>) => Promise<{
959
+ data: unknown;
960
+ }>;
961
+ };
962
+ };
963
+ };
964
+ }
965
+ interface PaymentsActionsConfig {
966
+ /** Cache key prefix (e.g. "ampro:"). Default: "". */
967
+ cachePrefix?: string;
968
+ }
969
+ interface PaymentsActions {
970
+ transactionSetup: (params: Record<string, unknown>) => Promise<unknown>;
971
+ accountQuery: (params: Record<string, unknown>) => Promise<unknown>;
972
+ getSurcharge: (params: Record<string, unknown>) => Promise<unknown>;
973
+ }
974
+ /**
975
+ * Creates server-side payment actions.
976
+ *
977
+ * Payment actions do NOT use caching because every call deals with
978
+ * real-time payment processing that must always reflect current state.
979
+ *
980
+ * @example
981
+ * ```ts
982
+ * import { createPaymentsActions } from "@simpleapps-com/augur-server";
983
+ * import { getAugurClient } from "./augur-client";
984
+ *
985
+ * export const paymentsActions = createPaymentsActions(getAugurClient());
986
+ *
987
+ * const setup = await paymentsActions.transactionSetup({ customerId: "123" });
988
+ * const account = await paymentsActions.accountQuery({ transactionSetupId: "abc" });
989
+ * const surcharge = await paymentsActions.getSurcharge({ amount: 100 });
990
+ * ```
991
+ */
992
+ declare function createPaymentsActions(api: PaymentsApiClient, config?: PaymentsActionsConfig): PaymentsActions;
993
+
994
+ /**
995
+ * The subset of augur-api used by UPS actions.
996
+ * Matches `api.ups` from the SDK.
997
+ */
998
+ interface UpsApiClient {
999
+ ups: {
1000
+ ratesShop: {
1001
+ get: (params: Record<string, unknown>) => Promise<{
1002
+ data: unknown;
1003
+ }>;
1004
+ };
1005
+ };
1006
+ }
1007
+ interface UpsActionsConfig {
1008
+ /** Cache key prefix (e.g. "ampro:"). Default: "". */
1009
+ cachePrefix?: string;
1010
+ }
1011
+ interface UpsActions {
1012
+ getRates: (params: Record<string, unknown>) => Promise<unknown>;
1013
+ }
1014
+ /**
1015
+ * Creates server-side UPS shipping actions.
1016
+ *
1017
+ * UPS rate actions do NOT use caching because rate quotes are real-time
1018
+ * and must always reflect current carrier pricing.
1019
+ *
1020
+ * @example
1021
+ * ```ts
1022
+ * import { createUpsActions } from "@simpleapps-com/augur-server";
1023
+ * import { getAugurClient } from "./augur-client";
1024
+ *
1025
+ * export const upsActions = createUpsActions(getAugurClient());
1026
+ *
1027
+ * const rates = await upsActions.getRates({
1028
+ * fromPostalCode: "90210",
1029
+ * toPostalCode: "10001",
1030
+ * weight: 5,
1031
+ * });
1032
+ * ```
1033
+ */
1034
+ declare function createUpsActions(api: UpsApiClient, config?: UpsActionsConfig): UpsActions;
1035
+
1036
+ /**
1037
+ * The subset of augur-api used by logistics actions.
1038
+ * Matches `api.logistics` from the SDK.
1039
+ */
1040
+ interface LogisticsApiClient {
1041
+ logistics: {
1042
+ speedship: {
1043
+ freight: {
1044
+ get: (params: Record<string, unknown>) => Promise<{
1045
+ data: unknown;
1046
+ }>;
1047
+ };
1048
+ };
1049
+ shipvia: {
1050
+ rates: {
1051
+ list: (params?: Record<string, unknown>) => Promise<{
1052
+ data: unknown[];
1053
+ }>;
1054
+ };
1055
+ };
1056
+ };
1057
+ }
1058
+ interface LogisticsActionsConfig {
1059
+ /** Cache key prefix (e.g. "ampro:"). Default: "". */
1060
+ cachePrefix?: string;
1061
+ /** CDN edge cache value passed to SDK. Default: 1 (hour). */
1062
+ edgeCache?: number;
1063
+ /** CDN edge cache for rarely-changing data like ship-via options. Default: 8 (hours). */
1064
+ longEdgeCache?: number;
1065
+ /** Redis TTL in seconds. Default: 3600 (1 hour). */
1066
+ redisTtl?: number;
1067
+ /** Redis TTL for rarely-changing data in seconds. Default: 28800 (8 hours). */
1068
+ longRedisTtl?: number;
1069
+ }
1070
+ interface LogisticsActions {
1071
+ getFreightRates: (params: Record<string, unknown>) => Promise<unknown>;
1072
+ getShipVia: (params?: Record<string, unknown>) => Promise<unknown[]>;
1073
+ }
1074
+ /**
1075
+ * Creates server-side logistics actions with selective Redis caching.
1076
+ *
1077
+ * Freight rate lookups are real-time and NOT cached.
1078
+ * Ship-via carrier options rarely change and ARE cached with long TTL.
1079
+ *
1080
+ * @example
1081
+ * ```ts
1082
+ * import { createLogisticsActions } from "@simpleapps-com/augur-server";
1083
+ * import { getAugurClient } from "./augur-client";
1084
+ *
1085
+ * export const logisticsActions = createLogisticsActions(getAugurClient(), {
1086
+ * cachePrefix: "ampro:",
1087
+ * });
1088
+ *
1089
+ * const rates = await logisticsActions.getFreightRates({ fromPostalCode: "90210" });
1090
+ * const carriers = await logisticsActions.getShipVia();
1091
+ * ```
1092
+ */
1093
+ declare function createLogisticsActions(api: LogisticsApiClient, config?: LogisticsActionsConfig): LogisticsActions;
1094
+
1095
+ /**
1096
+ * The subset of augur-api used by nexus actions.
1097
+ * Matches `api.nexus` from the SDK.
1098
+ */
1099
+ interface NexusApiClient {
1100
+ nexus: {
1101
+ binTransfer: {
1102
+ create: (data: Record<string, unknown>) => Promise<{
1103
+ data: unknown;
1104
+ }>;
1105
+ };
1106
+ receiving: {
1107
+ create: (data: Record<string, unknown>) => Promise<{
1108
+ data: unknown;
1109
+ }>;
1110
+ };
1111
+ transfer: {
1112
+ create: (data: Record<string, unknown>) => Promise<{
1113
+ data: unknown;
1114
+ }>;
1115
+ };
1116
+ purchaseOrderReceipt: {
1117
+ list: (params?: Record<string, unknown>) => Promise<{
1118
+ data: unknown[];
1119
+ }>;
1120
+ };
1121
+ transferReceipt: {
1122
+ list: (params?: Record<string, unknown>) => Promise<{
1123
+ data: unknown[];
1124
+ }>;
1125
+ };
1126
+ transferShipping: {
1127
+ list: (params?: Record<string, unknown>) => Promise<{
1128
+ data: unknown[];
1129
+ }>;
1130
+ };
1131
+ };
1132
+ }
1133
+ interface NexusActionsConfig {
1134
+ /** Cache key prefix (e.g. "ampro:"). Default: "". */
1135
+ cachePrefix?: string;
1136
+ /** CDN edge cache value passed to SDK. Default: 1 (hour). */
1137
+ edgeCache?: number;
1138
+ /** Redis TTL in seconds. Default: 3600 (1 hour). */
1139
+ redisTtl?: number;
1140
+ }
1141
+ interface NexusActions {
1142
+ createBinTransfer: (data: Record<string, unknown>) => Promise<unknown>;
1143
+ createReceiving: (data: Record<string, unknown>) => Promise<unknown>;
1144
+ createTransfer: (data: Record<string, unknown>) => Promise<unknown>;
1145
+ getPurchaseOrderReceipts: (params?: Record<string, unknown>) => Promise<unknown[]>;
1146
+ getTransferReceipts: (params?: Record<string, unknown>) => Promise<unknown[]>;
1147
+ getTransferShipping: (params?: Record<string, unknown>) => Promise<unknown[]>;
1148
+ }
1149
+ /**
1150
+ * Creates server-side nexus (warehouse management) actions with selective caching.
1151
+ *
1152
+ * Write operations (bin transfer, receiving, transfer) do NOT use caching.
1153
+ * Read/list operations (receipts, shipping) ARE cached with standard TTL.
1154
+ *
1155
+ * @example
1156
+ * ```ts
1157
+ * import { createNexusActions } from "@simpleapps-com/augur-server";
1158
+ * import { getAugurClient } from "./augur-client";
1159
+ *
1160
+ * export const nexusActions = createNexusActions(getAugurClient(), {
1161
+ * cachePrefix: "ampro:",
1162
+ * });
1163
+ *
1164
+ * const transfer = await nexusActions.createBinTransfer({ locationId: 5, transfers: [] });
1165
+ * const receipts = await nexusActions.getPurchaseOrderReceipts();
1166
+ * ```
1167
+ */
1168
+ declare function createNexusActions(api: NexusApiClient, config?: NexusActionsConfig): NexusActions;
1169
+
1170
+ /**
1171
+ * The subset of augur-api used by VMI actions.
1172
+ * Matches `api.vmi` from the SDK.
1173
+ */
1174
+ interface VmiApiClient {
1175
+ vmi: {
1176
+ warehouse: {
1177
+ list: (params?: Record<string, unknown>) => Promise<{
1178
+ data: unknown[];
1179
+ }>;
1180
+ availability: {
1181
+ get: (warehouseUid: number, params: Record<string, unknown>) => Promise<{
1182
+ data: unknown[];
1183
+ }>;
1184
+ };
1185
+ };
1186
+ distributors: {
1187
+ list: (params?: Record<string, unknown>) => Promise<{
1188
+ data: unknown[];
1189
+ }>;
1190
+ };
1191
+ products: {
1192
+ list: (params?: Record<string, unknown>) => Promise<{
1193
+ data: unknown[];
1194
+ }>;
1195
+ };
1196
+ invProfileHdr: {
1197
+ list: (params?: Record<string, unknown>) => Promise<{
1198
+ data: unknown[];
1199
+ }>;
1200
+ };
1201
+ restockHdr: {
1202
+ list: (params?: Record<string, unknown>) => Promise<{
1203
+ data: unknown[];
1204
+ }>;
1205
+ };
1206
+ sections: {
1207
+ list: (params?: Record<string, unknown>) => Promise<{
1208
+ data: unknown[];
1209
+ }>;
1210
+ };
1211
+ };
1212
+ }
1213
+ interface VmiActionsConfig {
1214
+ /** Cache key prefix (e.g. "ampro:"). Default: "". */
1215
+ cachePrefix?: string;
1216
+ /** CDN edge cache value passed to SDK. Default: 1 (hour). */
1217
+ edgeCache?: number;
1218
+ /** Redis TTL in seconds. Default: 3600 (1 hour). */
1219
+ redisTtl?: number;
1220
+ /** Redis TTL for short-lived data like availability. Default: 300 (5 min). */
1221
+ shortRedisTtl?: number;
1222
+ }
1223
+ interface VmiActions {
1224
+ getWarehouses: (params?: Record<string, unknown>) => Promise<unknown[]>;
1225
+ getWarehouseAvailability: (warehouseUid: number, params?: Record<string, unknown>) => Promise<unknown[]>;
1226
+ getDistributors: (params?: Record<string, unknown>) => Promise<unknown[]>;
1227
+ getProducts: (params?: Record<string, unknown>) => Promise<unknown[]>;
1228
+ getInventoryProfiles: (params?: Record<string, unknown>) => Promise<unknown[]>;
1229
+ getRestockHeaders: (params?: Record<string, unknown>) => Promise<unknown[]>;
1230
+ getSections: (params?: Record<string, unknown>) => Promise<unknown[]>;
1231
+ }
1232
+ /**
1233
+ * Creates server-side VMI (Vendor Managed Inventory) actions with Redis caching.
1234
+ *
1235
+ * All VMI read operations are cached. Warehouse availability uses a shorter TTL
1236
+ * because inventory levels change more frequently than configuration data.
1237
+ *
1238
+ * @example
1239
+ * ```ts
1240
+ * import { createVmiActions } from "@simpleapps-com/augur-server";
1241
+ * import { getAugurClient } from "./augur-client";
1242
+ *
1243
+ * export const vmiActions = createVmiActions(getAugurClient(), {
1244
+ * cachePrefix: "ampro:",
1245
+ * });
1246
+ *
1247
+ * const warehouses = await vmiActions.getWarehouses({ customerId: 12345 });
1248
+ * const availability = await vmiActions.getWarehouseAvailability(123);
1249
+ * const distributors = await vmiActions.getDistributors({ customerId: 12345 });
1250
+ * ```
1251
+ */
1252
+ declare function createVmiActions(api: VmiApiClient, config?: VmiActionsConfig): VmiActions;
1253
+
1254
+ /**
1255
+ * The subset of augur-api used by p21-core actions.
1256
+ * Matches `api.p21Core` from the SDK.
1257
+ */
1258
+ interface P21CoreApiClient {
1259
+ p21Core: {
1260
+ address: {
1261
+ list: (params?: Record<string, unknown>) => Promise<{
1262
+ data: unknown[];
1263
+ }>;
1264
+ };
1265
+ company: {
1266
+ list: (params?: Record<string, unknown>) => Promise<{
1267
+ data: unknown[];
1268
+ }>;
1269
+ get: (params: Record<string, unknown>) => Promise<{
1270
+ data: unknown;
1271
+ }>;
1272
+ };
1273
+ location: {
1274
+ list: (params?: Record<string, unknown>) => Promise<{
1275
+ data: unknown[];
1276
+ }>;
1277
+ };
1278
+ paymentTypes: {
1279
+ list: (params?: Record<string, unknown>) => Promise<{
1280
+ data: unknown[];
1281
+ }>;
1282
+ };
1283
+ cashDrawer: {
1284
+ list: (params?: Record<string, unknown>) => Promise<{
1285
+ data: unknown[];
1286
+ }>;
1287
+ };
1288
+ codeP21: {
1289
+ list: (params?: Record<string, unknown>) => Promise<{
1290
+ data: unknown[];
1291
+ }>;
1292
+ };
1293
+ };
1294
+ }
1295
+ interface P21CoreActionsConfig {
1296
+ /** Cache key prefix (e.g. "ampro:"). Default: "". */
1297
+ cachePrefix?: string;
1298
+ /** CDN edge cache value passed to SDK. Default: 1 (hour). */
1299
+ edgeCache?: number;
1300
+ /** CDN edge cache for rarely-changing data. Default: 8 (hours). */
1301
+ longEdgeCache?: number;
1302
+ /** Redis TTL in seconds. Default: 3600 (1 hour). */
1303
+ redisTtl?: number;
1304
+ /** Redis TTL for rarely-changing data in seconds. Default: 28800 (8 hours). */
1305
+ longRedisTtl?: number;
1306
+ }
1307
+ interface P21CoreActions {
1308
+ getAddresses: (params?: Record<string, unknown>) => Promise<unknown[]>;
1309
+ getCompanies: (params?: Record<string, unknown>) => Promise<unknown[]>;
1310
+ getCompany: (companyId: number) => Promise<unknown | undefined>;
1311
+ getLocations: (params?: Record<string, unknown>) => Promise<unknown[]>;
1312
+ getPaymentTypes: (params?: Record<string, unknown>) => Promise<unknown[]>;
1313
+ getCashDrawers: (params?: Record<string, unknown>) => Promise<unknown[]>;
1314
+ getCodeP21: (params?: Record<string, unknown>) => Promise<unknown[]>;
1315
+ }
1316
+ /**
1317
+ * Creates server-side P21 Core actions with Redis caching and edge cache support.
1318
+ *
1319
+ * Covers the P21 Core microservice endpoints: addresses, companies,
1320
+ * locations, payment types, cash drawers, and P21 codes.
1321
+ *
1322
+ * @example
1323
+ * ```ts
1324
+ * import { createP21CoreActions } from "@simpleapps-com/augur-server";
1325
+ * import { getAugurClient } from "./augur-client";
1326
+ *
1327
+ * export const p21CoreActions = createP21CoreActions(getAugurClient(), {
1328
+ * cachePrefix: "ampro:",
1329
+ * });
1330
+ *
1331
+ * const companies = await p21CoreActions.getCompanies();
1332
+ * const company = await p21CoreActions.getCompany(123);
1333
+ * ```
1334
+ */
1335
+ declare function createP21CoreActions(api: P21CoreApiClient, config?: P21CoreActionsConfig): P21CoreActions;
1336
+
1337
+ /**
1338
+ * The subset of augur-api used by p21-apis actions.
1339
+ * Matches `api.p21Apis` from the SDK.
1340
+ */
1341
+ interface P21ApisApiClient {
1342
+ p21Apis: {
1343
+ transCategory: {
1344
+ list: (params?: Record<string, unknown>) => Promise<{
1345
+ data: unknown[];
1346
+ }>;
1347
+ defaults: {
1348
+ get: (categoryUid: number, params?: Record<string, unknown>) => Promise<{
1349
+ data: unknown;
1350
+ }>;
1351
+ };
1352
+ };
1353
+ transCompany: {
1354
+ list: (params?: Record<string, unknown>) => Promise<{
1355
+ data: unknown[];
1356
+ }>;
1357
+ };
1358
+ transUser: {
1359
+ list: (params?: Record<string, unknown>) => Promise<{
1360
+ data: unknown[];
1361
+ }>;
1362
+ };
1363
+ transWebDisplayType: {
1364
+ list: (params?: Record<string, unknown>) => Promise<{
1365
+ data: unknown[];
1366
+ }>;
1367
+ defaults: {
1368
+ get: (params?: Record<string, unknown>) => Promise<{
1369
+ data: unknown;
1370
+ }>;
1371
+ };
1372
+ };
1373
+ entityContacts: {
1374
+ refresh: {
1375
+ create: (params?: Record<string, unknown>) => Promise<{
1376
+ data: unknown;
1377
+ }>;
1378
+ };
1379
+ };
1380
+ entityCustomers: {
1381
+ refresh: {
1382
+ create: (params?: Record<string, unknown>) => Promise<{
1383
+ data: unknown;
1384
+ }>;
1385
+ };
1386
+ };
1387
+ };
1388
+ }
1389
+ interface P21ApisActionsConfig {
1390
+ /** Cache key prefix (e.g. "ampro:"). Default: "". */
1391
+ cachePrefix?: string;
1392
+ /** CDN edge cache value passed to SDK. Default: 1 (hour). */
1393
+ edgeCache?: number;
1394
+ /** Redis TTL in seconds. Default: 3600 (1 hour). */
1395
+ redisTtl?: number;
1396
+ }
1397
+ interface P21ApisActions {
1398
+ getCategories: (params?: Record<string, unknown>) => Promise<unknown[]>;
1399
+ getCategoryDefaults: (categoryId: number) => Promise<unknown | undefined>;
1400
+ getCompanies: (params?: Record<string, unknown>) => Promise<unknown[]>;
1401
+ getUsers: (params?: Record<string, unknown>) => Promise<unknown[]>;
1402
+ getWebDisplayTypes: (params?: Record<string, unknown>) => Promise<unknown[]>;
1403
+ getWebDisplayTypeDefaults: (id?: number) => Promise<unknown | undefined>;
1404
+ refreshContacts: (params?: Record<string, unknown>) => Promise<unknown | undefined>;
1405
+ refreshCustomers: (params?: Record<string, unknown>) => Promise<unknown | undefined>;
1406
+ }
1407
+ /**
1408
+ * Creates server-side P21 APIs actions with Redis caching and edge cache support.
1409
+ *
1410
+ * Covers the P21 APIs microservice endpoints: transaction categories,
1411
+ * companies, users, web display types, and entity refresh operations.
1412
+ *
1413
+ * @example
1414
+ * ```ts
1415
+ * import { createP21ApisActions } from "@simpleapps-com/augur-server";
1416
+ * import { getAugurClient } from "./augur-client";
1417
+ *
1418
+ * export const p21ApisActions = createP21ApisActions(getAugurClient(), {
1419
+ * cachePrefix: "ampro:",
1420
+ * });
1421
+ *
1422
+ * const categories = await p21ApisActions.getCategories();
1423
+ * await p21ApisActions.refreshContacts();
1424
+ * ```
1425
+ */
1426
+ declare function createP21ApisActions(api: P21ApisApiClient, config?: P21ApisActionsConfig): P21ApisActions;
1427
+
1428
+ /**
1429
+ * The subset of augur-api used by p21-sism actions.
1430
+ * Matches `api.p21Sism` from the SDK.
1431
+ */
1432
+ interface P21SismApiClient {
1433
+ p21Sism: {
1434
+ import: {
1435
+ recent: {
1436
+ list: (params?: Record<string, unknown>) => Promise<{
1437
+ data: unknown[];
1438
+ }>;
1439
+ };
1440
+ get: (importUid: string) => Promise<{
1441
+ data: unknown;
1442
+ }>;
1443
+ };
1444
+ impOeLine: {
1445
+ list: (params?: Record<string, unknown>) => Promise<{
1446
+ data: unknown[];
1447
+ }>;
1448
+ };
1449
+ scheduledImportMaster: {
1450
+ list: (params?: Record<string, unknown>) => Promise<{
1451
+ data: unknown[];
1452
+ }>;
1453
+ };
1454
+ };
1455
+ }
1456
+ interface P21SismActionsConfig {
1457
+ /** Cache key prefix (e.g. "ampro:"). Default: "". */
1458
+ cachePrefix?: string;
1459
+ /** CDN edge cache value passed to SDK. Default: 1 (hour). */
1460
+ edgeCache?: number;
1461
+ /** Redis TTL in seconds. Default: 3600 (1 hour). */
1462
+ redisTtl?: number;
1463
+ }
1464
+ interface P21SismActions {
1465
+ getRecentImports: (params?: Record<string, unknown>) => Promise<unknown[]>;
1466
+ getImport: (importId: string) => Promise<unknown | undefined>;
1467
+ getImportLines: (importId: number, params?: Record<string, unknown>) => Promise<unknown[]>;
1468
+ getScheduledImports: (params?: Record<string, unknown>) => Promise<unknown[]>;
1469
+ }
1470
+ /**
1471
+ * Creates server-side P21 SISM actions with Redis caching and edge cache support.
1472
+ *
1473
+ * Covers the P21 SISM (System Integration & Storage Management) endpoints:
1474
+ * imports, import lines, and scheduled import masters.
1475
+ *
1476
+ * @example
1477
+ * ```ts
1478
+ * import { createP21SismActions } from "@simpleapps-com/augur-server";
1479
+ * import { getAugurClient } from "./augur-client";
1480
+ *
1481
+ * export const p21SismActions = createP21SismActions(getAugurClient(), {
1482
+ * cachePrefix: "ampro:",
1483
+ * });
1484
+ *
1485
+ * const recentImports = await p21SismActions.getRecentImports({ hours: 24 });
1486
+ * const importDetail = await p21SismActions.getImport("12345");
1487
+ * ```
1488
+ */
1489
+ declare function createP21SismActions(api: P21SismApiClient, config?: P21SismActionsConfig): P21SismActions;
1490
+
1491
+ /**
1492
+ * The subset of augur-api used by agr-work actions.
1493
+ * Matches `api.agrWork` from the SDK.
1494
+ */
1495
+ interface AgrWorkApiClient {
1496
+ agrWork: {
1497
+ healthCheck: {
1498
+ get: () => Promise<{
1499
+ data: string;
1500
+ }>;
1501
+ };
1502
+ ping: {
1503
+ get: () => Promise<{
1504
+ data: string;
1505
+ }>;
1506
+ };
1507
+ };
1508
+ }
1509
+ interface AgrWorkActionsConfig {
1510
+ /** Cache key prefix (e.g. "ampro:"). Default: "". */
1511
+ cachePrefix?: string;
1512
+ }
1513
+ interface AgrWorkActions {
1514
+ healthCheck: () => Promise<string | undefined>;
1515
+ ping: () => Promise<string | undefined>;
1516
+ }
1517
+ /**
1518
+ * Creates server-side AGR Work actions for health monitoring and connectivity.
1519
+ *
1520
+ * Covers the AGR Work microservice endpoints: healthCheck and ping.
1521
+ * These are real-time operations and do not use caching.
1522
+ *
1523
+ * @example
1524
+ * ```ts
1525
+ * import { createAgrWorkActions } from "@simpleapps-com/augur-server";
1526
+ * import { getAugurClient } from "./augur-client";
1527
+ *
1528
+ * export const agrWorkActions = createAgrWorkActions(getAugurClient());
1529
+ *
1530
+ * const health = await agrWorkActions.healthCheck();
1531
+ * const pong = await agrWorkActions.ping();
1532
+ * ```
1533
+ */
1534
+ declare function createAgrWorkActions(api: AgrWorkApiClient, _config?: AgrWorkActionsConfig): AgrWorkActions;
1535
+
1536
+ /**
1537
+ * The subset of augur-api used by agr-info actions.
1538
+ * Matches `api.agrInfo` from the SDK.
1539
+ */
1540
+ interface AgrInfoApiClient {
1541
+ agrInfo: {
1542
+ context: {
1543
+ get: (siteId: string, params?: Record<string, unknown>) => Promise<{
1544
+ data: unknown;
1545
+ }>;
1546
+ };
1547
+ rubrics: {
1548
+ list: (params?: Record<string, unknown>) => Promise<{
1549
+ data: unknown[];
1550
+ }>;
1551
+ };
1552
+ microservices: {
1553
+ list: (params?: Record<string, unknown>) => Promise<{
1554
+ data: unknown[];
1555
+ }>;
1556
+ };
1557
+ akasha: {
1558
+ generate: {
1559
+ create: (params?: Record<string, unknown>) => Promise<{
1560
+ data: unknown;
1561
+ }>;
1562
+ };
1563
+ };
1564
+ joomla: {
1565
+ generate: {
1566
+ create: (params?: Record<string, unknown>) => Promise<{
1567
+ data: unknown;
1568
+ }>;
1569
+ };
1570
+ };
1571
+ };
1572
+ }
1573
+ interface AgrInfoActionsConfig {
1574
+ /** Cache key prefix (e.g. "ampro:"). Default: "". */
1575
+ cachePrefix?: string;
1576
+ /** CDN edge cache value passed to SDK. Default: 1 (hour). */
1577
+ edgeCache?: number;
1578
+ /** CDN edge cache for rarely-changing data. Default: 8 (hours). */
1579
+ longEdgeCache?: number;
1580
+ /** Redis TTL in seconds. Default: 3600 (1 hour). */
1581
+ redisTtl?: number;
1582
+ /** Redis TTL for rarely-changing data in seconds. Default: 28800 (8 hours). */
1583
+ longRedisTtl?: number;
1584
+ }
1585
+ interface AgrInfoActions {
1586
+ getContext: (params?: Record<string, unknown>) => Promise<unknown[]>;
1587
+ getRubrics: (params?: Record<string, unknown>) => Promise<unknown[]>;
1588
+ getMicroservices: (params?: Record<string, unknown>) => Promise<unknown[]>;
1589
+ generateAkasha: (data?: Record<string, unknown>) => Promise<unknown | undefined>;
1590
+ generateJoomla: (data?: Record<string, unknown>) => Promise<unknown | undefined>;
1591
+ }
1592
+ /**
1593
+ * Creates server-side AGR Info actions with Redis caching and edge cache support.
1594
+ *
1595
+ * Covers the AGR Info microservice endpoints: context, rubrics,
1596
+ * microservices, and AI generation (akasha/joomla).
1597
+ *
1598
+ * @example
1599
+ * ```ts
1600
+ * import { createAgrInfoActions } from "@simpleapps-com/augur-server";
1601
+ * import { getAugurClient } from "./augur-client";
1602
+ *
1603
+ * export const agrInfoActions = createAgrInfoActions(getAugurClient(), {
1604
+ * cachePrefix: "ampro:",
1605
+ * });
1606
+ *
1607
+ * const rubrics = await agrInfoActions.getRubrics();
1608
+ * const result = await agrInfoActions.generateAkasha({ prompt: "Hello" });
1609
+ * ```
1610
+ */
1611
+ declare function createAgrInfoActions(api: AgrInfoApiClient, config?: AgrInfoActionsConfig): AgrInfoActions;
1612
+
1613
+ /**
1614
+ * The subset of augur-api used by basecamp2 actions.
1615
+ * Matches `api.basecamp2` from the SDK.
1616
+ */
1617
+ interface Basecamp2ApiClient {
1618
+ basecamp2: {
1619
+ todos: {
1620
+ list: (params?: Record<string, unknown>) => Promise<{
1621
+ data: unknown[];
1622
+ }>;
1623
+ get: (todoId: number, params?: Record<string, unknown>) => Promise<{
1624
+ data: unknown;
1625
+ }>;
1626
+ };
1627
+ todosSummary: {
1628
+ list: (params?: Record<string, unknown>) => Promise<{
1629
+ data: unknown[];
1630
+ }>;
1631
+ };
1632
+ comments: {
1633
+ list: (params?: Record<string, unknown>) => Promise<{
1634
+ data: unknown[];
1635
+ }>;
1636
+ };
1637
+ people: {
1638
+ list: (params?: Record<string, unknown>) => Promise<{
1639
+ data: unknown[];
1640
+ }>;
1641
+ };
1642
+ projects: {
1643
+ list: (params?: Record<string, unknown>) => Promise<{
1644
+ data: unknown[];
1645
+ }>;
1646
+ };
1647
+ events: {
1648
+ list: (params?: Record<string, unknown>) => Promise<{
1649
+ data: unknown[];
1650
+ }>;
1651
+ };
1652
+ metrics: {
1653
+ list: (params?: Record<string, unknown>) => Promise<{
1654
+ data: unknown[];
1655
+ }>;
1656
+ };
1657
+ todolists: {
1658
+ list: (params?: Record<string, unknown>) => Promise<{
1659
+ data: unknown[];
1660
+ }>;
1661
+ };
1662
+ };
1663
+ }
1664
+ interface Basecamp2ActionsConfig {
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
+ /** CDN edge cache for rarely-changing data like people. Default: 8 (hours). */
1670
+ longEdgeCache?: number;
1671
+ /** Redis TTL in seconds. Default: 3600 (1 hour). */
1672
+ redisTtl?: number;
1673
+ /** Redis TTL for rarely-changing data in seconds. Default: 28800 (8 hours). */
1674
+ longRedisTtl?: number;
1675
+ }
1676
+ interface Basecamp2Actions {
1677
+ getTodos: (params?: Record<string, unknown>) => Promise<unknown[]>;
1678
+ getTodo: (todoId: number) => Promise<unknown>;
1679
+ getTodosSummary: (params?: Record<string, unknown>) => Promise<unknown[]>;
1680
+ getComments: (params?: Record<string, unknown>) => Promise<unknown[]>;
1681
+ getPeople: (params?: Record<string, unknown>) => Promise<unknown[]>;
1682
+ getProjects: (params?: Record<string, unknown>) => Promise<unknown[]>;
1683
+ getEvents: (params?: Record<string, unknown>) => Promise<unknown[]>;
1684
+ getMetrics: (params?: Record<string, unknown>) => Promise<unknown[]>;
1685
+ getTodolists: (params?: Record<string, unknown>) => Promise<unknown[]>;
1686
+ }
1687
+ /**
1688
+ * Creates server-side basecamp2 actions with Redis caching and edge cache support.
1689
+ *
1690
+ * Covers the Basecamp2 project management endpoints: todos, todo summaries,
1691
+ * comments, people, projects, events, metrics, and todolists.
1692
+ *
1693
+ * @example
1694
+ * ```ts
1695
+ * import { createBasecamp2Actions } from "@simpleapps-com/augur-server";
1696
+ * import { getAugurClient } from "./augur-client";
1697
+ *
1698
+ * export const basecamp2Actions = createBasecamp2Actions(getAugurClient(), {
1699
+ * cachePrefix: "ampro:",
1700
+ * });
1701
+ *
1702
+ * const todos = await basecamp2Actions.getTodos();
1703
+ * const people = await basecamp2Actions.getPeople();
1704
+ * ```
1705
+ */
1706
+ declare function createBasecamp2Actions(api: Basecamp2ApiClient, config?: Basecamp2ActionsConfig): Basecamp2Actions;
1707
+
1708
+ /**
1709
+ * The subset of augur-api used by brand-folder actions.
1710
+ * Matches `api.brandFolder` from the SDK.
1711
+ */
1712
+ interface BrandFolderApiClient {
1713
+ brandFolder: {
1714
+ categories: {
1715
+ list: (params?: Record<string, unknown>) => Promise<{
1716
+ data: unknown[];
1717
+ }>;
1718
+ get: (categoryId: string, params?: Record<string, unknown>) => Promise<{
1719
+ data: unknown;
1720
+ }>;
1721
+ focus: {
1722
+ create: (params: Record<string, unknown>) => Promise<{
1723
+ data: unknown;
1724
+ }>;
1725
+ };
1726
+ };
1727
+ };
1728
+ }
1729
+ interface BrandFolderActionsConfig {
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 BrandFolderActions {
1738
+ getCategories: (params?: Record<string, unknown>) => Promise<unknown[]>;
1739
+ getCategory: (categoryId: string) => Promise<unknown>;
1740
+ createFocus: (categoryId: string, data: Record<string, unknown>) => Promise<unknown | undefined>;
1741
+ }
1742
+ /**
1743
+ * Creates server-side brand-folder actions with Redis caching and edge cache support.
1744
+ *
1745
+ * Covers the Brand Folder service endpoints: category listing, category detail,
1746
+ * and category focus creation.
1747
+ *
1748
+ * @example
1749
+ * ```ts
1750
+ * import { createBrandFolderActions } from "@simpleapps-com/augur-server";
1751
+ * import { getAugurClient } from "./augur-client";
1752
+ *
1753
+ * export const brandFolderActions = createBrandFolderActions(getAugurClient(), {
1754
+ * cachePrefix: "ampro:",
1755
+ * });
1756
+ *
1757
+ * const categories = await brandFolderActions.getCategories();
1758
+ * const category = await brandFolderActions.getCategory("cat-123");
1759
+ * const focus = await brandFolderActions.createFocus("cat-123", { focusLevel: "primary" });
1760
+ * ```
1761
+ */
1762
+ declare function createBrandFolderActions(api: BrandFolderApiClient, config?: BrandFolderActionsConfig): BrandFolderActions;
1763
+
1764
+ /**
1765
+ * The subset of augur-api used by gregorovich actions.
1766
+ * Matches `api.gregorovich` from the SDK.
1767
+ */
1768
+ interface GregorovichApiClient {
1769
+ gregorovich: {
1770
+ chatGpt: {
1771
+ ask: {
1772
+ get: (params: Record<string, unknown>) => Promise<{
1773
+ data: unknown;
1774
+ }>;
1775
+ };
1776
+ };
1777
+ documents: {
1778
+ list: (params?: Record<string, unknown>) => Promise<{
1779
+ data: unknown[];
1780
+ }>;
1781
+ create: (data: Record<string, unknown>) => Promise<{
1782
+ data: unknown;
1783
+ }>;
1784
+ };
1785
+ ollama: {
1786
+ generate: {
1787
+ create: (data: Record<string, unknown>) => Promise<{
1788
+ data: unknown;
1789
+ }>;
1790
+ };
1791
+ };
1792
+ };
1793
+ }
1794
+ interface GregorovichActionsConfig {
1795
+ /** Cache key prefix (e.g. "ampro:"). Default: "". */
1796
+ cachePrefix?: string;
1797
+ /** CDN edge cache value passed to SDK. Default: 1 (hour). */
1798
+ edgeCache?: number;
1799
+ /** Redis TTL in seconds. Default: 3600 (1 hour). */
1800
+ redisTtl?: number;
1801
+ }
1802
+ interface GregorovichActions {
1803
+ askChatGpt: (params: Record<string, unknown>) => Promise<unknown | undefined>;
1804
+ getDocuments: (params?: Record<string, unknown>) => Promise<unknown[]>;
1805
+ createDocument: (data: Record<string, unknown>) => Promise<unknown | undefined>;
1806
+ generateOllama: (data: Record<string, unknown>) => Promise<unknown | undefined>;
1807
+ }
1808
+ /**
1809
+ * Creates server-side gregorovich actions with Redis caching and edge cache support.
1810
+ *
1811
+ * Covers the Gregorovich AI service endpoints: ChatGPT ask, document listing,
1812
+ * document creation, and Ollama generation.
1813
+ *
1814
+ * @example
1815
+ * ```ts
1816
+ * import { createGregorovichActions } from "@simpleapps-com/augur-server";
1817
+ * import { getAugurClient } from "./augur-client";
1818
+ *
1819
+ * export const gregorovichActions = createGregorovichActions(getAugurClient(), {
1820
+ * cachePrefix: "ampro:",
1821
+ * });
1822
+ *
1823
+ * const answer = await gregorovichActions.askChatGpt({ question: "What is AI?" });
1824
+ * const docs = await gregorovichActions.getDocuments();
1825
+ * ```
1826
+ */
1827
+ declare function createGregorovichActions(api: GregorovichApiClient, config?: GregorovichActionsConfig): GregorovichActions;
1828
+
1829
+ /**
1830
+ * The subset of augur-api used by slack actions.
1831
+ * Matches `api.slack` from the SDK.
1832
+ */
1833
+ interface SlackApiClient {
1834
+ slack: {
1835
+ webHook: {
1836
+ create: (data: Record<string, unknown>) => Promise<{
1837
+ data: unknown;
1838
+ }>;
1839
+ list: (params?: Record<string, unknown>) => Promise<{
1840
+ data: unknown[];
1841
+ }>;
1842
+ };
1843
+ };
1844
+ }
1845
+ interface SlackActionsConfig {
1846
+ /** Cache key prefix (e.g. "ampro:"). Default: "". */
1847
+ cachePrefix?: string;
1848
+ /** CDN edge cache value passed to SDK. Default: 1 (hour). */
1849
+ edgeCache?: number;
1850
+ /** Redis TTL in seconds. Default: 3600 (1 hour). */
1851
+ redisTtl?: number;
1852
+ }
1853
+ interface SlackActions {
1854
+ sendWebhook: (data: Record<string, unknown>) => Promise<unknown | undefined>;
1855
+ getWebhooks: (params?: Record<string, unknown>) => Promise<unknown[]>;
1856
+ }
1857
+ /**
1858
+ * Creates server-side slack actions with Redis caching and edge cache support.
1859
+ *
1860
+ * Covers the Slack integration endpoints: webhook sending and webhook listing.
1861
+ *
1862
+ * @example
1863
+ * ```ts
1864
+ * import { createSlackActions } from "@simpleapps-com/augur-server";
1865
+ * import { getAugurClient } from "./augur-client";
1866
+ *
1867
+ * export const slackActions = createSlackActions(getAugurClient(), {
1868
+ * cachePrefix: "ampro:",
1869
+ * });
1870
+ *
1871
+ * const result = await slackActions.sendWebhook({ text: "Hello!" });
1872
+ * const webhooks = await slackActions.getWebhooks();
1873
+ * ```
1874
+ */
1875
+ declare function createSlackActions(api: SlackApiClient, config?: SlackActionsConfig): SlackActions;
1876
+
1877
+ export { type AgrInfoActions, type AgrInfoActionsConfig, type AgrInfoApiClient, type AgrSiteActions, type AgrSiteActionsConfig, type AgrSiteApiClient, type AgrWorkActions, type AgrWorkActionsConfig, type AgrWorkApiClient, type AvalaraActions, type AvalaraActionsConfig, type AvalaraApiClient, type Basecamp2Actions, type Basecamp2ActionsConfig, type Basecamp2ApiClient, type BrandFolderActions, type BrandFolderActionsConfig, type BrandFolderApiClient, type CommerceActions, type CommerceActionsConfig, type CommerceApiClient, type CustomersActions, type CustomersActionsConfig, type CustomersApiClient, type GregorovichActions, type GregorovichActionsConfig, type GregorovichApiClient, type ItemActions, type ItemActionsConfig, type ItemsApiClient, type JoomlaActions, type JoomlaActionsConfig, type JoomlaApiClient, type LegacyActions, type LegacyActionsConfig, type LegacyApiClient, type LogisticsActions, type LogisticsActionsConfig, type LogisticsApiClient, type NexusActions, type NexusActionsConfig, type NexusApiClient, type OrderActions, type OrderActionsConfig, type OrderApiClient, type P21ApisActions, type P21ApisActionsConfig, type P21ApisApiClient, type P21CoreActions, type P21CoreActionsConfig, type P21CoreApiClient, type P21PimActions, type P21PimActionsConfig, type P21PimApiClient, type P21SismActions, type P21SismActionsConfig, type P21SismApiClient, type PaymentsActions, type PaymentsActionsConfig, type PaymentsApiClient, type PricingActions, type PricingActionsConfig, type PricingApiClient, type SearchActions, type SearchActionsConfig, type SearchApiClient, type SearchPage, type ShippingActions, type ShippingActionsConfig, type ShippingAddress, type ShippingApiClient, type SlackActions, type SlackActionsConfig, type SlackApiClient, type SmartyStreetsActions, type SmartyStreetsActionsConfig, type SmartyStreetsApiClient, type UpsActions, type UpsActionsConfig, type UpsApiClient, type VmiActions, type VmiActionsConfig, type VmiApiClient, cacheGet, cacheSet, createAgrInfoActions, createAgrSiteActions, createAgrWorkActions, createAvalaraActions, createBasecamp2Actions, createBrandFolderActions, createCommerceActions, createCustomersActions, createGregorovichActions, createItemActions, createJoomlaActions, createLegacyActions, createLogisticsActions, createNexusActions, createOrderActions, createP21ApisActions, createP21CoreActions, createP21PimActions, createP21SismActions, createPaymentsActions, createPricingActions, createSearchActions, createServerQueryClient, createShippingActions, createSlackActions, createSmartyStreetsActions, createUpsActions, createVmiActions, env, getCircuitState, getServerQueryClient, isDev, isProduction, isRedisConnected, isStaging, sdkCall, withServerCache };