@simpleapps-com/augur-server 2.4.0 → 2026.11.1
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/EXPORTS.md +29 -72
- package/README.md +29 -198
- package/dist/actions/agr-info.d.ts +43 -0
- package/dist/actions/agr-info.d.ts.map +1 -0
- package/dist/actions/agr-site.d.ts +37 -0
- package/dist/actions/agr-site.d.ts.map +1 -0
- package/dist/actions/agr-work.d.ts +29 -0
- package/dist/actions/agr-work.d.ts.map +1 -0
- package/dist/actions/avalara.d.ts +38 -0
- package/dist/actions/avalara.d.ts.map +1 -0
- package/dist/actions/basecamp2.d.ts +47 -0
- package/dist/actions/basecamp2.d.ts.map +1 -0
- package/dist/actions/brand-folder.d.ts +38 -0
- package/dist/actions/brand-folder.d.ts.map +1 -0
- package/dist/actions/commerce.d.ts +58 -0
- package/dist/actions/commerce.d.ts.map +1 -0
- package/dist/actions/customers.d.ts +44 -0
- package/dist/actions/customers.d.ts.map +1 -0
- package/dist/actions/favorites.d.ts +20 -0
- package/dist/actions/favorites.d.ts.map +1 -0
- package/dist/actions/gregorovich.d.ts +34 -0
- package/dist/actions/gregorovich.d.ts.map +1 -0
- package/dist/actions/items.d.ts +80 -0
- package/dist/actions/items.d.ts.map +1 -0
- package/dist/actions/joomla.d.ts +59 -0
- package/dist/actions/joomla.d.ts.map +1 -0
- package/dist/actions/legacy.d.ts +45 -0
- package/dist/actions/legacy.d.ts.map +1 -0
- package/dist/actions/logistics.d.ts +40 -0
- package/dist/actions/logistics.d.ts.map +1 -0
- package/dist/actions/orders.d.ts +36 -0
- package/dist/actions/orders.d.ts.map +1 -0
- package/dist/actions/p21-apis.d.ts +33 -0
- package/dist/actions/p21-apis.d.ts.map +1 -0
- package/dist/actions/p21-core.d.ts +46 -0
- package/dist/actions/p21-core.d.ts.map +1 -0
- package/dist/actions/p21-pim.d.ts +36 -0
- package/dist/actions/p21-pim.d.ts.map +1 -0
- package/dist/actions/p21-sism.d.ts +37 -0
- package/dist/actions/p21-sism.d.ts.map +1 -0
- package/dist/actions/payments.d.ts +39 -0
- package/dist/actions/payments.d.ts.map +1 -0
- package/dist/actions/pricing.d.ts +45 -0
- package/dist/actions/pricing.d.ts.map +1 -0
- package/dist/actions/search.d.ts +61 -0
- package/dist/actions/search.d.ts.map +1 -0
- package/dist/actions/shipping.d.ts +56 -0
- package/dist/actions/shipping.d.ts.map +1 -0
- package/dist/actions/site.d.ts +141 -0
- package/dist/actions/site.d.ts.map +1 -0
- package/dist/actions/smarty-streets.d.ts +45 -0
- package/dist/actions/smarty-streets.d.ts.map +1 -0
- package/dist/actions/vmi.d.ts +44 -0
- package/dist/actions/vmi.d.ts.map +1 -0
- package/dist/actions/wishlists.d.ts +28 -0
- package/dist/actions/wishlists.d.ts.map +1 -0
- package/dist/api-handler.d.ts +25 -0
- package/dist/api-handler.d.ts.map +1 -0
- package/dist/api.d.ts +2 -26
- package/dist/api.d.ts.map +1 -0
- package/dist/api.js +19 -14
- package/dist/api.js.map +1 -1
- package/dist/auth.d.ts +10 -12
- package/dist/auth.d.ts.map +1 -0
- package/dist/auth.js +2 -2
- package/dist/cache/redis-client.d.ts +16 -0
- package/dist/cache/redis-client.d.ts.map +1 -0
- package/dist/cache/with-cache.d.ts +18 -0
- package/dist/cache/with-cache.d.ts.map +1 -0
- package/dist/{chunk-2NL4QKJN.js → chunk-FWO6Q43T.js} +31 -30
- package/dist/chunk-FWO6Q43T.js.map +1 -0
- package/dist/{chunk-ALTIINP6.js → chunk-NTUPTNOI.js} +30 -6
- package/dist/chunk-NTUPTNOI.js.map +1 -0
- package/dist/{chunk-26WZBC4F.js → chunk-PFYEMJTQ.js} +203 -631
- package/dist/chunk-PFYEMJTQ.js.map +1 -0
- package/dist/{chunk-KHFEDL47.js → chunk-SXXWBSTX.js} +18 -12
- package/dist/chunk-SXXWBSTX.js.map +1 -0
- package/dist/chunk-TVH5EONP.js +178 -0
- package/dist/chunk-TVH5EONP.js.map +1 -0
- package/dist/{chunk-PIYHMA6F.js → chunk-U2BKHRJC.js} +10 -13
- package/dist/chunk-U2BKHRJC.js.map +1 -0
- package/dist/environment.d.ts +10 -0
- package/dist/environment.d.ts.map +1 -0
- package/dist/hooks.d.ts +8 -10
- package/dist/hooks.d.ts.map +1 -0
- package/dist/hooks.js +3 -3
- package/dist/hooks.js.map +1 -1
- package/dist/index.d.ts +16 -125
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +9 -7
- package/dist/index.js.map +1 -1
- package/dist/pagination.d.ts +32 -0
- package/dist/pagination.d.ts.map +1 -0
- package/dist/query-action.d.ts +15 -117
- package/dist/query-action.d.ts.map +1 -0
- package/dist/query-action.js +3 -3
- package/dist/{query.d.ts → query-options-helper.d.ts} +5 -7
- package/dist/query-options-helper.d.ts.map +1 -0
- package/dist/query.js +1 -2
- package/dist/recaptcha.d.ts +6 -0
- package/dist/recaptcha.d.ts.map +1 -0
- package/dist/rules.d.ts +221 -0
- package/dist/rules.d.ts.map +1 -0
- package/dist/scoped-client-key.d.ts +9 -0
- package/dist/scoped-client-key.d.ts.map +1 -0
- package/dist/sdk-call.d.ts +66 -0
- package/dist/sdk-call.d.ts.map +1 -0
- package/dist/sdk-client-store.d.ts +250 -0
- package/dist/sdk-client-store.d.ts.map +1 -0
- package/dist/server-actions.d.ts +2 -0
- package/dist/server-actions.d.ts.map +1 -0
- package/dist/server-query-client.d.ts +19 -0
- package/dist/server-query-client.d.ts.map +1 -0
- package/dist/{server-site-registry-CdBfczOj.d.ts → server-site-registry.d.ts} +7 -9
- package/dist/server-site-registry.d.ts.map +1 -0
- package/dist/{site.d.ts → server-site.d.ts} +11 -16
- package/dist/server-site.d.ts.map +1 -0
- package/dist/site-actions-store.d.ts +27 -0
- package/dist/site-actions-store.d.ts.map +1 -0
- package/dist/site.js +10 -10
- package/dist/site.js.map +1 -1
- package/dist/testing.d.ts +9 -12
- package/dist/testing.d.ts.map +1 -0
- package/dist/testing.js +7 -27
- package/dist/testing.js.map +1 -1
- package/dist/utils/batch-fetch.d.ts +7 -0
- package/dist/utils/batch-fetch.d.ts.map +1 -0
- package/llms.txt +71 -50
- package/package.json +29 -20
- package/dist/actions.d.ts +0 -2
- package/dist/chunk-26WZBC4F.js.map +0 -1
- package/dist/chunk-2NL4QKJN.js.map +0 -1
- package/dist/chunk-ALTIINP6.js.map +0 -1
- package/dist/chunk-DGUM43GV.js +0 -11
- package/dist/chunk-DGUM43GV.js.map +0 -1
- package/dist/chunk-KHFEDL47.js.map +0 -1
- package/dist/chunk-PIYHMA6F.js.map +0 -1
- package/dist/site-BjSFqufX.d.ts +0 -469
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { AugurAPI } from "@simpleapps-com/augur-api";
|
|
2
|
+
import type { EdgeCacheValue, ListResult } from "../sdk-call";
|
|
3
|
+
/** Derived from augur-api SDK — keeps types in sync automatically. */
|
|
4
|
+
export type P21PimApiClient = Pick<AugurAPI, "p21Pim">;
|
|
5
|
+
export interface P21PimActionsConfig {
|
|
6
|
+
/** Cache key prefix (e.g. "example:"). Default: "". */
|
|
7
|
+
cachePrefix?: string;
|
|
8
|
+
/** CDN edge cache value passed to SDK. Default: 1 (hour). */
|
|
9
|
+
edgeCache?: EdgeCacheValue;
|
|
10
|
+
/** Redis TTL in seconds. Default: 3600 (1 hour). */
|
|
11
|
+
redisTtl?: number;
|
|
12
|
+
}
|
|
13
|
+
export interface P21PimActions {
|
|
14
|
+
getInvMastExt: (invMastUid: number) => Promise<unknown>;
|
|
15
|
+
listInvMastExt: (params?: Record<string, unknown>) => Promise<ListResult>;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Creates server-side P21 PIM actions with Redis caching and edge cache support.
|
|
19
|
+
*
|
|
20
|
+
* Covers the P21 PIM microservice endpoints for extended inventory data
|
|
21
|
+
* including UPC/EAN codes, brand information, and SEO metadata.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```ts
|
|
25
|
+
* import { createP21PimActions } from "@simpleapps-com/augur-server";
|
|
26
|
+
* import { getAugurClient } from "./augur-client";
|
|
27
|
+
*
|
|
28
|
+
* export const p21PimActions = createP21PimActions(getAugurClient(), {
|
|
29
|
+
* cachePrefix: "example:",
|
|
30
|
+
* });
|
|
31
|
+
*
|
|
32
|
+
* const ext = await p21PimActions.getInvMastExt(12345);
|
|
33
|
+
* const list = await p21PimActions.listInvMastExt({ limit: 20 });
|
|
34
|
+
* ``` */
|
|
35
|
+
export declare function createP21PimActions(api: P21PimApiClient, config?: P21PimActionsConfig): P21PimActions;
|
|
36
|
+
//# sourceMappingURL=p21-pim.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"p21-pim.d.ts","sourceRoot":"","sources":["../../src/actions/p21-pim.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAI9D,sEAAsE;AACtE,MAAM,MAAM,eAAe,GAAG,IAAI,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;AAEvD,MAAM,WAAW,mBAAmB;IAClC,uDAAuD;IACvD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,6DAA6D;IAC7D,SAAS,CAAC,EAAE,cAAc,CAAC;IAC3B,oDAAoD;IACpD,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,aAAa;IAC5B,aAAa,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IACxD,cAAc,EAAE,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,CAAC,UAAU,CAAC,CAAC;CAC3E;AAED;;;;;;;;;;;;;;;;;SAiBS;AACT,wBAAgB,mBAAmB,CACjC,GAAG,EAAE,eAAe,EACpB,MAAM,GAAE,mBAAwB,GAC/B,aAAa,CAoCf"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { AugurAPI, P21SismTypes } from "@simpleapps-com/augur-api";
|
|
2
|
+
import type { EdgeCacheValue, ListResult } from "../sdk-call";
|
|
3
|
+
/** Derived from augur-api SDK — keeps types in sync automatically. */
|
|
4
|
+
export type P21SismApiClient = Pick<AugurAPI, "p21Sism">;
|
|
5
|
+
export interface P21SismActionsConfig {
|
|
6
|
+
/** Cache key prefix (e.g. "example:"). Default: "". */
|
|
7
|
+
cachePrefix?: string;
|
|
8
|
+
/** CDN edge cache value passed to SDK. Default: 1 (hour). */
|
|
9
|
+
edgeCache?: EdgeCacheValue;
|
|
10
|
+
/** Redis TTL in seconds. Default: 3600 (1 hour). */
|
|
11
|
+
redisTtl?: number;
|
|
12
|
+
}
|
|
13
|
+
export interface P21SismActions {
|
|
14
|
+
getRecentImports: (params?: Record<string, unknown>) => Promise<ListResult>;
|
|
15
|
+
getImport: (importUid: number) => Promise<unknown | undefined>;
|
|
16
|
+
getScheduledImports: (params?: P21SismTypes.ScheduledImportMasterListParams) => Promise<ListResult>;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Creates server-side P21 SISM actions with Redis caching and edge cache support.
|
|
20
|
+
*
|
|
21
|
+
* Covers the P21 SISM (System Integration & Storage Management) endpoints:
|
|
22
|
+
* imports and scheduled import masters.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```ts
|
|
26
|
+
* import { createP21SismActions } from "@simpleapps-com/augur-server";
|
|
27
|
+
* import { getAugurClient } from "./augur-client";
|
|
28
|
+
*
|
|
29
|
+
* export const p21SismActions = createP21SismActions(getAugurClient(), {
|
|
30
|
+
* cachePrefix: "example:",
|
|
31
|
+
* });
|
|
32
|
+
*
|
|
33
|
+
* const recentImports = await p21SismActions.getRecentImports({ hours: 24 });
|
|
34
|
+
* const importDetail = await p21SismActions.getImport(12345);
|
|
35
|
+
* ``` */
|
|
36
|
+
export declare function createP21SismActions(api: P21SismApiClient, config?: P21SismActionsConfig): P21SismActions;
|
|
37
|
+
//# sourceMappingURL=p21-sism.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"p21-sism.d.ts","sourceRoot":"","sources":["../../src/actions/p21-sism.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACxE,OAAO,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAI9D,sEAAsE;AACtE,MAAM,MAAM,gBAAgB,GAAG,IAAI,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;AAEzD,MAAM,WAAW,oBAAoB;IACnC,uDAAuD;IACvD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,6DAA6D;IAC7D,SAAS,CAAC,EAAE,cAAc,CAAC;IAC3B,oDAAoD;IACpD,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,cAAc;IAC7B,gBAAgB,EAAE,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,CAAC,UAAU,CAAC,CAAC;IAC5E,SAAS,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,GAAG,SAAS,CAAC,CAAC;IAC/D,mBAAmB,EAAE,CACnB,MAAM,CAAC,EAAE,YAAY,CAAC,+BAA+B,KAClD,OAAO,CAAC,UAAU,CAAC,CAAC;CAC1B;AAED;;;;;;;;;;;;;;;;;SAiBS;AACT,wBAAgB,oBAAoB,CAClC,GAAG,EAAE,gBAAgB,EACrB,MAAM,GAAE,oBAAyB,GAChC,cAAc,CAuDhB"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { AugurAPI, PaymentsTypes } from "@simpleapps-com/augur-api";
|
|
2
|
+
import type { TAccountQuery, TBillingUpdate, TCardInfo, TPaymentValidation, TSurcharge, TTransactionSetup } from "@simpleapps-com/augur-utils";
|
|
3
|
+
/** Derived from augur-api SDK — keeps types in sync automatically. */
|
|
4
|
+
export type PaymentsApiClient = Pick<AugurAPI, "payments">;
|
|
5
|
+
export interface PaymentsActionsConfig {
|
|
6
|
+
/** Cache key prefix (e.g. "example:"). Default: "". */
|
|
7
|
+
cachePrefix?: string;
|
|
8
|
+
/** Payment environment mode. Default: "live". */
|
|
9
|
+
mode?: string;
|
|
10
|
+
}
|
|
11
|
+
export interface PaymentsActions {
|
|
12
|
+
transactionSetup: (params: PaymentsTypes.UnifiedTransactionSetupListParams) => Promise<TTransactionSetup | undefined>;
|
|
13
|
+
accountQuery: (params: PaymentsTypes.UnifiedAccountQueryListParams) => Promise<TAccountQuery | undefined>;
|
|
14
|
+
getSurcharge: (params: PaymentsTypes.UnifiedSurchargeListParams) => Promise<TSurcharge | undefined>;
|
|
15
|
+
cardInfo: (params: PaymentsTypes.UnifiedCardInfoListParams) => Promise<TCardInfo | undefined>;
|
|
16
|
+
billingUpdate: (params: PaymentsTypes.UnifiedBillingUpdateListParams) => Promise<TBillingUpdate | undefined>;
|
|
17
|
+
validatePayment: (params: PaymentsTypes.UnifiedValidateListParams) => Promise<TPaymentValidation | undefined>;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Creates server-side payment actions.
|
|
21
|
+
*
|
|
22
|
+
* Payment actions do NOT use caching because every call deals with
|
|
23
|
+
* real-time payment processing that must always reflect current state.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```ts
|
|
27
|
+
* import { createPaymentsActions } from "@simpleapps-com/augur-server";
|
|
28
|
+
* import { getAugurClient } from "./augur-client";
|
|
29
|
+
*
|
|
30
|
+
* export const paymentsActions = createPaymentsActions(getAugurClient());
|
|
31
|
+
*
|
|
32
|
+
* const setup = await paymentsActions.transactionSetup({ customerId: "123" });
|
|
33
|
+
* const account = await paymentsActions.accountQuery({
|
|
34
|
+
* customerId: "123",
|
|
35
|
+
* transactionSetupId: "abc",
|
|
36
|
+
* });
|
|
37
|
+
* ``` */
|
|
38
|
+
export declare function createPaymentsActions(api: PaymentsApiClient, config?: PaymentsActionsConfig): PaymentsActions;
|
|
39
|
+
//# sourceMappingURL=payments.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payments.d.ts","sourceRoot":"","sources":["../../src/actions/payments.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AACzE,OAAO,KAAK,EACV,aAAa,EACb,cAAc,EACd,SAAS,EACT,kBAAkB,EAClB,UAAU,EACV,iBAAiB,EAClB,MAAM,6BAA6B,CAAC;AAGrC,sEAAsE;AACtE,MAAM,MAAM,iBAAiB,GAAG,IAAI,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;AAE3D,MAAM,WAAW,qBAAqB;IACpC,uDAAuD;IACvD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iDAAiD;IACjD,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,eAAe;IAC9B,gBAAgB,EAAE,CAChB,MAAM,EAAE,aAAa,CAAC,iCAAiC,KACpD,OAAO,CAAC,iBAAiB,GAAG,SAAS,CAAC,CAAC;IAC5C,YAAY,EAAE,CACZ,MAAM,EAAE,aAAa,CAAC,6BAA6B,KAChD,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC,CAAC;IACxC,YAAY,EAAE,CACZ,MAAM,EAAE,aAAa,CAAC,0BAA0B,KAC7C,OAAO,CAAC,UAAU,GAAG,SAAS,CAAC,CAAC;IACrC,QAAQ,EAAE,CAAC,MAAM,EAAE,aAAa,CAAC,yBAAyB,KAAK,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC,CAAC;IAC9F,aAAa,EAAE,CACb,MAAM,EAAE,aAAa,CAAC,8BAA8B,KACjD,OAAO,CAAC,cAAc,GAAG,SAAS,CAAC,CAAC;IACzC,eAAe,EAAE,CACf,MAAM,EAAE,aAAa,CAAC,yBAAyB,KAC5C,OAAO,CAAC,kBAAkB,GAAG,SAAS,CAAC,CAAC;CAC9C;AAED;;;;;;;;;;;;;;;;;;SAkBS;AACT,wBAAgB,qBAAqB,CACnC,GAAG,EAAE,iBAAiB,EACtB,MAAM,GAAE,qBAA0B,GACjC,eAAe,CAkFjB"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { AugurAPI } from "@simpleapps-com/augur-api";
|
|
2
|
+
import type { EdgeCacheValue } from "../sdk-call";
|
|
3
|
+
import type { TPriceData, TTax, TTaxItem } from "@simpleapps-com/augur-utils";
|
|
4
|
+
/** Derived from augur-api SDK — keeps types in sync automatically. */
|
|
5
|
+
export type PricingApiClient = Pick<AugurAPI, "pricing">;
|
|
6
|
+
export interface PricingActionsConfig {
|
|
7
|
+
/** Default customer ID when none is provided by the caller. */
|
|
8
|
+
defaultCustomerId?: string | number;
|
|
9
|
+
/** Cache key prefix (e.g. "example:"). Default: "". */
|
|
10
|
+
cachePrefix?: string;
|
|
11
|
+
/** CDN edge cache value passed to SDK. Default: 2 (hours). */
|
|
12
|
+
edgeCache?: EdgeCacheValue;
|
|
13
|
+
/** Redis TTL for price lookups in seconds. Default: 3600 (1 hour). */
|
|
14
|
+
redisTtl?: number;
|
|
15
|
+
/** Redis TTL for tax lookups in seconds. Default: 1800 (30 min). */
|
|
16
|
+
taxRedisTtl?: number;
|
|
17
|
+
}
|
|
18
|
+
export interface PricingActions {
|
|
19
|
+
getItemPrice: (itemId: string, customerId?: string | number, quantity?: number) => Promise<TPriceData>;
|
|
20
|
+
batchGetItemPrices: (itemIds: string[], customerId?: string | number, quantity?: number) => Promise<Record<string, TPriceData>>;
|
|
21
|
+
getTaxEstimate: (customerId?: string | number, postalCode?: string, items?: TTaxItem[]) => Promise<TTax>;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Creates server-side pricing actions with Redis caching and edge cache support.
|
|
25
|
+
*
|
|
26
|
+
* Uses `withServerCache` which produces cache keys compatible with augur-hooks'
|
|
27
|
+
* `withCache`, so server-prefetched data is shared with client-side hooks.
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```ts
|
|
31
|
+
* // lib/pricing-actions.ts
|
|
32
|
+
* import { createPricingActions } from "@simpleapps-com/augur-server";
|
|
33
|
+
* import { getAugurClient } from "./augur-client";
|
|
34
|
+
*
|
|
35
|
+
* export const pricingActions = createPricingActions(getAugurClient(), {
|
|
36
|
+
* // defaultCustomerId falls back to DEFAULT_CUSTOMER_ID env var automatically
|
|
37
|
+
* cachePrefix: "example:",
|
|
38
|
+
* });
|
|
39
|
+
*
|
|
40
|
+
* // In a server component:
|
|
41
|
+
* const price = await pricingActions.getItemPrice("ITEM-1");
|
|
42
|
+
* const prices = await pricingActions.batchGetItemPrices(["ITEM-1", "ITEM-2"]);
|
|
43
|
+
* ``` */
|
|
44
|
+
export declare function createPricingActions(api: PricingApiClient, config?: PricingActionsConfig): PricingActions;
|
|
45
|
+
//# sourceMappingURL=pricing.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pricing.d.ts","sourceRoot":"","sources":["../../src/actions/pricing.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAgB,MAAM,2BAA2B,CAAC;AACxE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAK9E,sEAAsE;AACtE,MAAM,MAAM,gBAAgB,GAAG,IAAI,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;AAEzD,MAAM,WAAW,oBAAoB;IACnC,+DAA+D;IAC/D,iBAAiB,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACpC,uDAAuD;IACvD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,8DAA8D;IAC9D,SAAS,CAAC,EAAE,cAAc,CAAC;IAC3B,sEAAsE;IACtE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,oEAAoE;IACpE,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,cAAc;IAC7B,YAAY,EAAE,CACZ,MAAM,EAAE,MAAM,EACd,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,EAC5B,QAAQ,CAAC,EAAE,MAAM,KACd,OAAO,CAAC,UAAU,CAAC,CAAC;IAEzB,kBAAkB,EAAE,CAClB,OAAO,EAAE,MAAM,EAAE,EACjB,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,EAC5B,QAAQ,CAAC,EAAE,MAAM,KACd,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC;IAEzC,cAAc,EAAE,CACd,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,EAC5B,UAAU,CAAC,EAAE,MAAM,EACnB,KAAK,CAAC,EAAE,QAAQ,EAAE,KACf,OAAO,CAAC,IAAI,CAAC,CAAC;CACpB;AAUD;;;;;;;;;;;;;;;;;;;;SAoBS;AACT,wBAAgB,oBAAoB,CAClC,GAAG,EAAE,gBAAgB,EACrB,MAAM,GAAE,oBAAyB,GAChC,cAAc,CAmEhB"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import type { AugurAPI, OpenSearchTypes } from "@simpleapps-com/augur-api";
|
|
2
|
+
import type { EdgeCacheValue } from "../sdk-call";
|
|
3
|
+
import type { TSearchSuggestionsResponse } from "@simpleapps-com/augur-utils";
|
|
4
|
+
/** Derived from augur-api SDK — keeps types in sync automatically. */
|
|
5
|
+
export type SearchApiClient = Pick<AugurAPI, "openSearch">;
|
|
6
|
+
export interface SearchActionsConfig {
|
|
7
|
+
/** Cache key prefix (e.g. "example:"). Default: "". */
|
|
8
|
+
cachePrefix?: string;
|
|
9
|
+
/** CDN edge cache value passed to SDK. Default: 1 (hour). */
|
|
10
|
+
edgeCache?: EdgeCacheValue;
|
|
11
|
+
/** Redis TTL for search lookups in seconds. Default: 3600 (1 hour). */
|
|
12
|
+
redisTtl?: number;
|
|
13
|
+
/** Default source fields for item search. Default: "display_desc". */
|
|
14
|
+
defaultSourceFields?: string;
|
|
15
|
+
}
|
|
16
|
+
/** Paginated response for infinite scroll. */
|
|
17
|
+
interface SearchPage {
|
|
18
|
+
data: OpenSearchTypes.ItemSearchListDataItemsItem[];
|
|
19
|
+
total: number;
|
|
20
|
+
nextCursor?: number;
|
|
21
|
+
}
|
|
22
|
+
export interface SearchActions {
|
|
23
|
+
getSearchAttributes: (q: string) => Promise<OpenSearchTypes.ItemSearchAttributesListData>;
|
|
24
|
+
getSearchSuggestions: (q: string, limit?: number, offset?: number) => Promise<TSearchSuggestionsResponse>;
|
|
25
|
+
itemSearch: (filters: {
|
|
26
|
+
q: string;
|
|
27
|
+
limit: number;
|
|
28
|
+
offset: number;
|
|
29
|
+
sortBy?: string;
|
|
30
|
+
filters?: [string, string][];
|
|
31
|
+
}, itemCategoryUid?: number | string) => Promise<OpenSearchTypes.ItemSearchListData>;
|
|
32
|
+
itemSearchInfinite: (filters: {
|
|
33
|
+
q: string;
|
|
34
|
+
limit: number;
|
|
35
|
+
sortBy?: string;
|
|
36
|
+
filters?: [string, string][];
|
|
37
|
+
}, itemCategoryUid?: number | string, pageParam?: number) => Promise<SearchPage>;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Creates server-side search actions with Redis caching and edge cache support.
|
|
41
|
+
*
|
|
42
|
+
* Uses `withServerCache` which produces cache keys compatible with augur-hooks'
|
|
43
|
+
* `withCache`, so server-prefetched data is shared with client-side hooks.
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* ```ts
|
|
47
|
+
* // lib/search-actions.ts
|
|
48
|
+
* import { createSearchActions } from "@simpleapps-com/augur-server";
|
|
49
|
+
* import { getAugurClient } from "./augur-client";
|
|
50
|
+
*
|
|
51
|
+
* export const searchActions = createSearchActions(getAugurClient(), {
|
|
52
|
+
* cachePrefix: "example:",
|
|
53
|
+
* });
|
|
54
|
+
*
|
|
55
|
+
* // In a server component:
|
|
56
|
+
* const attrs = await searchActions.getSearchAttributes("widget");
|
|
57
|
+
* const results = await searchActions.itemSearch({ q: "widget", limit: 20, offset: 0 });
|
|
58
|
+
* ``` */
|
|
59
|
+
export declare function createSearchActions(api: SearchApiClient, config?: SearchActionsConfig): SearchActions;
|
|
60
|
+
export {};
|
|
61
|
+
//# sourceMappingURL=search.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../src/actions/search.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAC3E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD,OAAO,KAAK,EAAqB,0BAA0B,EAAE,MAAM,6BAA6B,CAAC;AAGjG,sEAAsE;AACtE,MAAM,MAAM,eAAe,GAAG,IAAI,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;AAE3D,MAAM,WAAW,mBAAmB;IAClC,uDAAuD;IACvD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,6DAA6D;IAC7D,SAAS,CAAC,EAAE,cAAc,CAAC;IAC3B,uEAAuE;IACvE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,sEAAsE;IACtE,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B;AAED,8CAA8C;AAC9C,UAAU,UAAU;IAClB,IAAI,EAAE,eAAe,CAAC,2BAA2B,EAAE,CAAC;IACpD,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,aAAa;IAC5B,mBAAmB,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,eAAe,CAAC,4BAA4B,CAAC,CAAC;IAE1F,oBAAoB,EAAE,CACpB,CAAC,EAAE,MAAM,EACT,KAAK,CAAC,EAAE,MAAM,EACd,MAAM,CAAC,EAAE,MAAM,KACZ,OAAO,CAAC,0BAA0B,CAAC,CAAC;IAEzC,UAAU,EAAE,CACV,OAAO,EAAE;QACP,CAAC,EAAE,MAAM,CAAC;QACV,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,CAAC;QACf,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC;KAC9B,EACD,eAAe,CAAC,EAAE,MAAM,GAAG,MAAM,KAC9B,OAAO,CAAC,eAAe,CAAC,kBAAkB,CAAC,CAAC;IAEjD,kBAAkB,EAAE,CAClB,OAAO,EAAE;QACP,CAAC,EAAE,MAAM,CAAC;QACV,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC;KAC9B,EACD,eAAe,CAAC,EAAE,MAAM,GAAG,MAAM,EACjC,SAAS,CAAC,EAAE,MAAM,KACf,OAAO,CAAC,UAAU,CAAC,CAAC;CAC1B;AAED;;;;;;;;;;;;;;;;;;;SAmBS;AACT,wBAAgB,mBAAmB,CACjC,GAAG,EAAE,eAAe,EACpB,MAAM,GAAE,mBAAwB,GAC/B,aAAa,CAuIf"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { AugurAPI } from "@simpleapps-com/augur-api";
|
|
2
|
+
import type { TShippingMethod } from "@simpleapps-com/augur-utils";
|
|
3
|
+
import type { EdgeCacheValue, ListResult } from "../sdk-call";
|
|
4
|
+
export interface ShippingAddress {
|
|
5
|
+
address1: string;
|
|
6
|
+
city: string;
|
|
7
|
+
state: string;
|
|
8
|
+
postalCode: string;
|
|
9
|
+
country?: string;
|
|
10
|
+
}
|
|
11
|
+
/** Derived from augur-api SDK — keeps types in sync automatically. */
|
|
12
|
+
export type ShippingApiClient = Pick<AugurAPI, "logistics">;
|
|
13
|
+
export interface ShippingActionsConfig {
|
|
14
|
+
/** Warehouse/origin address for rate calculations. */
|
|
15
|
+
fromAddress: ShippingAddress;
|
|
16
|
+
/** UPS service codes to filter results. Default: undefined (return all). */
|
|
17
|
+
defaultServiceCodes?: string[];
|
|
18
|
+
/** Cache key prefix (e.g. "example:"). Default: "". */
|
|
19
|
+
cachePrefix?: string;
|
|
20
|
+
/** CDN edge cache value passed to SDK. Default: 1 (hour). */
|
|
21
|
+
edgeCache?: EdgeCacheValue;
|
|
22
|
+
/** Redis TTL for shipping rate lookups in seconds. Default: 3600 (1 hour). */
|
|
23
|
+
redisTtl?: number;
|
|
24
|
+
}
|
|
25
|
+
export interface ShippingActions {
|
|
26
|
+
getShippingRates: (toAddress: ShippingAddress, weight: number, serviceCodes?: string[]) => Promise<ListResult<TShippingMethod>>;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Creates server-side shipping actions with Redis caching and edge cache support.
|
|
30
|
+
*
|
|
31
|
+
* Uses `withServerCache` which produces cache keys compatible with augur-hooks'
|
|
32
|
+
* `withCache`, so server-prefetched data is shared with client-side hooks.
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```ts
|
|
36
|
+
* // lib/shipping-actions.ts
|
|
37
|
+
* import { createShippingActions } from "@simpleapps-com/augur-server";
|
|
38
|
+
* import { getAugurClient } from "./augur-client";
|
|
39
|
+
*
|
|
40
|
+
* export const shippingActions = createShippingActions(getAugurClient(), {
|
|
41
|
+
* fromAddress: {
|
|
42
|
+
* address1: "123 Warehouse Ln",
|
|
43
|
+
* city: "Chicago",
|
|
44
|
+
* state: "IL",
|
|
45
|
+
* postalCode: "60601",
|
|
46
|
+
* },
|
|
47
|
+
* });
|
|
48
|
+
*
|
|
49
|
+
* // In a server component:
|
|
50
|
+
* const rates = await shippingActions.getShippingRates(
|
|
51
|
+
* { address1: "456 Main St", city: "Denver", state: "CO", postalCode: "80202" },
|
|
52
|
+
* 5.0,
|
|
53
|
+
* );
|
|
54
|
+
* ``` */
|
|
55
|
+
export declare function createShippingActions(api: ShippingApiClient, config: ShippingActionsConfig): ShippingActions;
|
|
56
|
+
//# sourceMappingURL=shipping.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shipping.d.ts","sourceRoot":"","sources":["../../src/actions/shipping.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAkB,MAAM,2BAA2B,CAAC;AAC1E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,KAAK,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAI9D,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,sEAAsE;AACtE,MAAM,MAAM,iBAAiB,GAAG,IAAI,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;AAE5D,MAAM,WAAW,qBAAqB;IACpC,sDAAsD;IACtD,WAAW,EAAE,eAAe,CAAC;IAC7B,4EAA4E;IAC5E,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC/B,uDAAuD;IACvD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,6DAA6D;IAC7D,SAAS,CAAC,EAAE,cAAc,CAAC;IAC3B,8EAA8E;IAC9E,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,eAAe;IAC9B,gBAAgB,EAAE,CAChB,SAAS,EAAE,eAAe,EAC1B,MAAM,EAAE,MAAM,EACd,YAAY,CAAC,EAAE,MAAM,EAAE,KACpB,OAAO,CAAC,UAAU,CAAC,eAAe,CAAC,CAAC,CAAC;CAC3C;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;SA0BS;AACT,wBAAgB,qBAAqB,CACnC,GAAG,EAAE,iBAAiB,EACtB,MAAM,EAAE,qBAAqB,GAC5B,eAAe,CA2CjB"}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import type { EdgeCacheValue } from "../sdk-call";
|
|
2
|
+
import type { PricingActions } from "./pricing";
|
|
3
|
+
import type { ItemActions } from "./items";
|
|
4
|
+
import type { CommerceActions } from "./commerce";
|
|
5
|
+
import type { SearchActions } from "./search";
|
|
6
|
+
import type { OrderActions } from "./orders";
|
|
7
|
+
import type { ShippingAddress, ShippingActions } from "./shipping";
|
|
8
|
+
import type { JoomlaActions } from "./joomla";
|
|
9
|
+
import type { LegacyActions } from "./legacy";
|
|
10
|
+
import type { CustomersActions } from "./customers";
|
|
11
|
+
import type { SmartyStreetsActions } from "./smarty-streets";
|
|
12
|
+
import type { P21PimActions } from "./p21-pim";
|
|
13
|
+
import type { AgrSiteActions } from "./agr-site";
|
|
14
|
+
import type { AvalaraActions } from "./avalara";
|
|
15
|
+
import type { PaymentsActions } from "./payments";
|
|
16
|
+
import type { LogisticsActions } from "./logistics";
|
|
17
|
+
import type { VmiActions } from "./vmi";
|
|
18
|
+
import type { P21CoreActions } from "./p21-core";
|
|
19
|
+
import type { P21ApisActions } from "./p21-apis";
|
|
20
|
+
import type { P21SismActions } from "./p21-sism";
|
|
21
|
+
import type { AgrWorkActions } from "./agr-work";
|
|
22
|
+
import type { AgrInfoActions } from "./agr-info";
|
|
23
|
+
import type { Basecamp2Actions } from "./basecamp2";
|
|
24
|
+
import type { BrandFolderActions } from "./brand-folder";
|
|
25
|
+
import type { GregorovichActions } from "./gregorovich";
|
|
26
|
+
import type { FavoritesActions } from "./favorites";
|
|
27
|
+
import type { WishlistActions } from "./wishlists";
|
|
28
|
+
export interface SiteActionsConfig {
|
|
29
|
+
/**
|
|
30
|
+
* Cache key prefix shared across all services.
|
|
31
|
+
*
|
|
32
|
+
* Defaults to `"${siteId}:"` extracted from the API client.
|
|
33
|
+
* The site ID is the canonical cache namespace — most sites should
|
|
34
|
+
* NOT set this and let it derive automatically.
|
|
35
|
+
*
|
|
36
|
+
* Only override when migrating from a legacy prefix (e.g. `"example:"`
|
|
37
|
+
* instead of the site ID `"example-site"`).
|
|
38
|
+
*/
|
|
39
|
+
cachePrefix?: string;
|
|
40
|
+
/** Default edge cache TTL in seconds */
|
|
41
|
+
edgeCache?: EdgeCacheValue;
|
|
42
|
+
/** Default Redis TTL in seconds */
|
|
43
|
+
redisTtl?: number;
|
|
44
|
+
/** Long-lived edge cache TTL for rarely-changing data */
|
|
45
|
+
longEdgeCache?: EdgeCacheValue;
|
|
46
|
+
/** Long-lived Redis TTL for rarely-changing data */
|
|
47
|
+
longRedisTtl?: number;
|
|
48
|
+
/** Default contact ID for commerce operations. Falls back to process.env.DEFAULT_CONTACT_ID. */
|
|
49
|
+
defaultContactId?: string | number;
|
|
50
|
+
/** Default customer ID for pricing and commerce. Falls back to process.env.DEFAULT_CUSTOMER_ID. */
|
|
51
|
+
defaultCustomerId?: string | number;
|
|
52
|
+
/** Default company ID. Accepted but not yet read by any factory (no env fallback). */
|
|
53
|
+
defaultCompanyId?: string | number;
|
|
54
|
+
/** UOM conversion function for commerce (e.g. "EA" → "EACH") */
|
|
55
|
+
convertUnitOfMeasure?: (uom: string) => string;
|
|
56
|
+
/** Pricing-specific overrides */
|
|
57
|
+
pricing?: {
|
|
58
|
+
taxRedisTtl?: number;
|
|
59
|
+
};
|
|
60
|
+
/** Items-specific overrides */
|
|
61
|
+
items?: {
|
|
62
|
+
sortChildren?: boolean;
|
|
63
|
+
sortByPrefix?: string;
|
|
64
|
+
};
|
|
65
|
+
/** Search-specific overrides */
|
|
66
|
+
search?: {
|
|
67
|
+
defaultSourceFields?: string;
|
|
68
|
+
};
|
|
69
|
+
/** Payments-specific overrides */
|
|
70
|
+
payments?: {
|
|
71
|
+
mode?: string;
|
|
72
|
+
};
|
|
73
|
+
/** Shipping config — fromAddress is required for shipping to work */
|
|
74
|
+
shipping?: {
|
|
75
|
+
fromAddress: ShippingAddress;
|
|
76
|
+
defaultServiceCodes?: string[];
|
|
77
|
+
};
|
|
78
|
+
/** VMI-specific overrides */
|
|
79
|
+
vmi?: {
|
|
80
|
+
shortRedisTtl?: number;
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
export interface SiteActions {
|
|
84
|
+
pricing: PricingActions;
|
|
85
|
+
items: ItemActions;
|
|
86
|
+
commerce: CommerceActions;
|
|
87
|
+
search: SearchActions;
|
|
88
|
+
orders: OrderActions;
|
|
89
|
+
shipping: ShippingActions;
|
|
90
|
+
joomla: JoomlaActions;
|
|
91
|
+
legacy: LegacyActions;
|
|
92
|
+
customers: CustomersActions;
|
|
93
|
+
smartyStreets: SmartyStreetsActions;
|
|
94
|
+
p21Pim: P21PimActions;
|
|
95
|
+
agrSite: AgrSiteActions;
|
|
96
|
+
avalara: AvalaraActions;
|
|
97
|
+
payments: PaymentsActions;
|
|
98
|
+
logistics: LogisticsActions;
|
|
99
|
+
vmi: VmiActions;
|
|
100
|
+
p21Core: P21CoreActions;
|
|
101
|
+
p21Apis: P21ApisActions;
|
|
102
|
+
p21Sism: P21SismActions;
|
|
103
|
+
agrWork: AgrWorkActions;
|
|
104
|
+
agrInfo: AgrInfoActions;
|
|
105
|
+
basecamp2: Basecamp2Actions;
|
|
106
|
+
brandFolder: BrandFolderActions;
|
|
107
|
+
gregorovich: GregorovichActions;
|
|
108
|
+
favorites: FavoritesActions;
|
|
109
|
+
wishlists: WishlistActions;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Creates a unified site actions object with all service factories.
|
|
113
|
+
*
|
|
114
|
+
* Shared config (cachePrefix, edgeCache, redisTtl, etc.) is passed to all
|
|
115
|
+
* services automatically. Per-service overrides are available for services
|
|
116
|
+
* with additional configuration.
|
|
117
|
+
*
|
|
118
|
+
* @example
|
|
119
|
+
* ```ts
|
|
120
|
+
* import { createSiteActions } from "@simpleapps-com/augur-server";
|
|
121
|
+
* import { getAugurClient } from "./augur-client";
|
|
122
|
+
*
|
|
123
|
+
* // defaultCustomerId/defaultContactId fall back to DEFAULT_CUSTOMER_ID/DEFAULT_CONTACT_ID
|
|
124
|
+
* // env vars when not provided — no need to set them if CDK injects them.
|
|
125
|
+
* export const actions = createSiteActions(getAugurClient(), {
|
|
126
|
+
* convertUnitOfMeasure: (uom) => uom === "EA" ? "EACH" : uom,
|
|
127
|
+
* items: { sortChildren: true },
|
|
128
|
+
* shipping: {
|
|
129
|
+
* fromAddress: { address1: "123 Main", city: "Provo", state: "UT", postalCode: "84606" },
|
|
130
|
+
* defaultServiceCodes: ["03"],
|
|
131
|
+
* },
|
|
132
|
+
* });
|
|
133
|
+
*
|
|
134
|
+
* // Usage:
|
|
135
|
+
* const price = await actions.pricing.getItemPrice("ITEM-1");
|
|
136
|
+
* const doc = await actions.items.getInvMastDoc("ITEM-1");
|
|
137
|
+
* const cart = await actions.commerce.cartHdrLookup({ userId: 123 });
|
|
138
|
+
* ```
|
|
139
|
+
*/
|
|
140
|
+
export declare function createSiteActions<TApi extends object>(api: TApi, config?: SiteActionsConfig): SiteActions;
|
|
141
|
+
//# sourceMappingURL=site.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"site.d.ts","sourceRoot":"","sources":["../../src/actions/site.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAIlD,OAAO,KAAK,EAAoB,cAAc,EAAE,MAAM,WAAW,CAAC;AAElE,OAAO,KAAK,EAAkB,WAAW,EAAE,MAAM,SAAS,CAAC;AAE3D,OAAO,KAAK,EAAqB,eAAe,EAAE,MAAM,YAAY,CAAC;AAErE,OAAO,KAAK,EAAmB,aAAa,EAAE,MAAM,UAAU,CAAC;AAE/D,OAAO,KAAK,EAAkB,YAAY,EAAE,MAAM,UA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,EAAE,WAAW,CAAC;IACnB,QAAQ,EAAE,eAAe,CAAC;IAC1B,MAAM,EAAE,aAAa,CAAC;IACtB,MAAM,EAAE,YAAY,CAAC;IACrB,QAAQ,EAAE,eAAe,CAAC;IAC1B,MAAM,EAAE,aAAa,CAAC;IACtB,MAAM,EAAE,aAAa,CAAC;IACtB,SAAS,EAAE,gBAAgB,CAAC;IAC5B,aAAa,EAAE,oBAAoB,CAAC;IACpC,MAAM,EAAE,aAAa,CAAC;IACtB,OAAO,EAAE,cAAc,CAAC;IACxB,OAAO,EAAE,cAAc,CAAC;IACxB,QAAQ,EAAE,eAAe,CAAC;IAC1B,SAAS,EAAE,gBAAgB,CAAC;IAC5B,GAAG,EAAE,UAAU,CAAC;IAChB,OAAO,EAAE,cAAc,CAAC;IACxB,OAAO,EAAE,cAAc,CAAC;IACxB,OAAO,EAAE,cAAc,CAAC;IACxB,OAAO,EAAE,cAAc,CAAC;IACxB,OAAO,EAAE,cAAc,CAAC;IACxB,SAAS,EAAE,gBAAgB,CAAC;IAC5B,WAAW,EAAE,kBAAkB,CAAC;IAChC,WAAW,EAAE,kBAAkB,CAAC;IAChC,SAAS,EAAE,gBAAgB,CAAC;IAC5B,SAAS,EAAE,eAAe,CAAC;CAC5B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,SAAS,MAAM,EACnD,GAAG,EAAE,IAAI,EACT,MAAM,GAAE,iBAAsB,GAC7B,WAAW,CAyOb"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { AugurAPI, SmartyStreetsTypes } from "@simpleapps-com/augur-api";
|
|
2
|
+
import type { TSmartyStreets } from "@simpleapps-com/augur-utils";
|
|
3
|
+
/** Derived from augur-api SDK — keeps types in sync automatically. */
|
|
4
|
+
export type SmartyStreetsApiClient = Pick<AugurAPI, "smartyStreets">;
|
|
5
|
+
export interface SmartyStreetsActionsConfig {
|
|
6
|
+
/** Cache key prefix (e.g. "example:"). Default: "". */
|
|
7
|
+
cachePrefix?: string;
|
|
8
|
+
}
|
|
9
|
+
/** Standardized response from address validation. */
|
|
10
|
+
interface AddressValidationResult {
|
|
11
|
+
data: TSmartyStreets | undefined;
|
|
12
|
+
status: "success" | "not_found" | "error";
|
|
13
|
+
error?: {
|
|
14
|
+
message: string;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
export interface SmartyStreetsActions {
|
|
18
|
+
validateAddress: (params: SmartyStreetsTypes.UsLookupGetParams) => Promise<AddressValidationResult>;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Creates server-side SmartyStreets actions for address validation.
|
|
22
|
+
*
|
|
23
|
+
* Note: Address validation is a real-time operation and does NOT use caching.
|
|
24
|
+
* Each call hits the SmartyStreets API directly to ensure up-to-date results.
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```ts
|
|
28
|
+
* import { createSmartyStreetsActions } from "@simpleapps-com/augur-server";
|
|
29
|
+
* import { getAugurClient } from "./augur-client";
|
|
30
|
+
*
|
|
31
|
+
* export const smartyStreetsActions = createSmartyStreetsActions(getAugurClient());
|
|
32
|
+
*
|
|
33
|
+
* const result = await smartyStreetsActions.validateAddress({
|
|
34
|
+
* address1: "123 Main St",
|
|
35
|
+
* city: "Provo",
|
|
36
|
+
* state: "UT",
|
|
37
|
+
* postalCode: "84606",
|
|
38
|
+
* });
|
|
39
|
+
* if (result.status === "success") {
|
|
40
|
+
* console.log(result.data); // TSmartyStreets
|
|
41
|
+
* }
|
|
42
|
+
* ``` */
|
|
43
|
+
export declare function createSmartyStreetsActions(api: SmartyStreetsApiClient, _config?: SmartyStreetsActionsConfig): SmartyStreetsActions;
|
|
44
|
+
export {};
|
|
45
|
+
//# sourceMappingURL=smarty-streets.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"smarty-streets.d.ts","sourceRoot":"","sources":["../../src/actions/smarty-streets.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC9E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAElE,sEAAsE;AACtE,MAAM,MAAM,sBAAsB,GAAG,IAAI,CAAC,QAAQ,EAAE,eAAe,CAAC,CAAC;AAErE,MAAM,WAAW,0BAA0B;IACzC,uDAAuD;IACvD,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,qDAAqD;AACrD,UAAU,uBAAuB;IAC/B,IAAI,EAAE,cAAc,GAAG,SAAS,CAAC;IACjC,MAAM,EAAE,SAAS,GAAG,WAAW,GAAG,OAAO,CAAC;IAC1C,KAAK,CAAC,EAAE;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;CAC7B;AAED,MAAM,WAAW,oBAAoB;IACnC,eAAe,EAAE,CACf,MAAM,EAAE,kBAAkB,CAAC,iBAAiB,KACzC,OAAO,CAAC,uBAAuB,CAAC,CAAC;CACvC;AAED;;;;;;;;;;;;;;;;;;;;;;SAsBS;AACT,wBAAgB,0BAA0B,CACxC,GAAG,EAAE,sBAAsB,EAG3B,OAAO,GAAE,0BAA+B,GACvC,oBAAoB,CAoBtB"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { AugurAPI, VMITypes } from "@simpleapps-com/augur-api";
|
|
2
|
+
import type { EdgeCacheValue, ListResult } from "../sdk-call";
|
|
3
|
+
/** Derived from augur-api SDK — keeps types in sync automatically. */
|
|
4
|
+
export type VmiApiClient = Pick<AugurAPI, "vmi">;
|
|
5
|
+
export interface VmiActionsConfig {
|
|
6
|
+
/** Cache key prefix (e.g. "example:"). Default: "". */
|
|
7
|
+
cachePrefix?: string;
|
|
8
|
+
/** CDN edge cache value passed to SDK. Default: 1 (hour). */
|
|
9
|
+
edgeCache?: EdgeCacheValue;
|
|
10
|
+
/** Redis TTL in seconds. Default: 3600 (1 hour). */
|
|
11
|
+
redisTtl?: number;
|
|
12
|
+
/** Redis TTL for short-lived data like availability. Default: 300 (5 min). */
|
|
13
|
+
shortRedisTtl?: number;
|
|
14
|
+
}
|
|
15
|
+
export interface VmiActions {
|
|
16
|
+
getWarehouses: (params: VMITypes.WarehouseListParams) => Promise<ListResult>;
|
|
17
|
+
getWarehouseAvailability: (warehouseUid: number, params: VMITypes.WarehouseAvailabilityListParams) => Promise<ListResult>;
|
|
18
|
+
getDistributors: (params: VMITypes.DistributorsListParams) => Promise<ListResult>;
|
|
19
|
+
getProducts: (params: VMITypes.ProductsListParams) => Promise<ListResult>;
|
|
20
|
+
getInventoryProfiles: (params: VMITypes.InvProfileHdrListParams) => Promise<ListResult>;
|
|
21
|
+
getRestockHeaders: (params?: VMITypes.RestockHdrListParams) => Promise<ListResult>;
|
|
22
|
+
getSections: (params: VMITypes.SectionsListParams) => Promise<ListResult>;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Creates server-side VMI (Vendor Managed Inventory) actions with Redis caching.
|
|
26
|
+
*
|
|
27
|
+
* All VMI read operations are cached. Warehouse availability uses a shorter TTL
|
|
28
|
+
* because inventory levels change more frequently than configuration data.
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```ts
|
|
32
|
+
* import { createVmiActions } from "@simpleapps-com/augur-server";
|
|
33
|
+
* import { getAugurClient } from "./augur-client";
|
|
34
|
+
*
|
|
35
|
+
* export const vmiActions = createVmiActions(getAugurClient(), {
|
|
36
|
+
* cachePrefix: "example:",
|
|
37
|
+
* });
|
|
38
|
+
*
|
|
39
|
+
* const warehouses = await vmiActions.getWarehouses({ customerId: 12345 });
|
|
40
|
+
* const availability = await vmiActions.getWarehouseAvailability(123, { q: "wire" });
|
|
41
|
+
* const distributors = await vmiActions.getDistributors({ customerId: 12345 });
|
|
42
|
+
* ``` */
|
|
43
|
+
export declare function createVmiActions(api: VmiApiClient, config?: VmiActionsConfig): VmiActions;
|
|
44
|
+
//# sourceMappingURL=vmi.d.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AAM,EAAE,QAAQ,CAAC,kBAAkB,KAAK,OAAO,CAAC,UAAU,CAAC,CAAC;CAC3E;AAED;;;;;;;;;;;;;;;;;;SAkBS;AACT,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,YAAY,EAAE,MAAM,GAAE,gBAAqB,GAAG,UAAU,CAgH7F"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { AugurAPI } from "@simpleapps-com/augur-api";
|
|
2
|
+
import type { EdgeCacheValue, ListResult } from "../sdk-call";
|
|
3
|
+
/** Derived from augur-api SDK — keeps types in sync automatically. */
|
|
4
|
+
export type WishlistsApiClient = Pick<AugurAPI, "items">;
|
|
5
|
+
export interface WishlistActionsConfig {
|
|
6
|
+
/** Cache key prefix (e.g. "example:"). Default: "". */
|
|
7
|
+
cachePrefix?: string;
|
|
8
|
+
/** CDN edge cache value passed to SDK. Default: 1 (hour). */
|
|
9
|
+
edgeCache?: EdgeCacheValue;
|
|
10
|
+
/** Redis TTL in seconds. Default: 3600 (1 hour). */
|
|
11
|
+
redisTtl?: number;
|
|
12
|
+
}
|
|
13
|
+
export interface WishlistActions {
|
|
14
|
+
getWishlists: (userId: number) => Promise<ListResult>;
|
|
15
|
+
createWishlist: (userId: number, data: {
|
|
16
|
+
name: string;
|
|
17
|
+
description?: string;
|
|
18
|
+
}) => Promise<unknown>;
|
|
19
|
+
getWishlistDetail: (userId: number, wishlistId: number) => Promise<unknown>;
|
|
20
|
+
deleteWishlist: (userId: number, wishlistId: number) => Promise<void>;
|
|
21
|
+
addWishlistItems: (userId: number, wishlistId: number, items: {
|
|
22
|
+
invMastUid: number;
|
|
23
|
+
}[]) => Promise<unknown>;
|
|
24
|
+
removeWishlistItem: (userId: number, wishlistId: number, lineId: number) => Promise<void>;
|
|
25
|
+
}
|
|
26
|
+
/** Creates server-side wishlist actions with Redis caching and edge cache support. */
|
|
27
|
+
export declare function createWishlistActions(api: WishlistsApiClient, config?: WishlistActionsConfig): WishlistActions;
|
|
28
|
+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E,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAC3F;AAED,sFAAsF;AACtF,wBAAgB,qBAAqB,CACnC,GAAG,EAAE,kBAAkB,EACvB,MAAM,GAAE,qBAA0B,GACjC,eAAe,CAqEjB"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generic API route handler for fetch-mode proxy.
|
|
3
|
+
*
|
|
4
|
+
* Exposes the existing queryAction as an HTTP POST endpoint so that
|
|
5
|
+
* `createFetchQueryAction()` from augur-core can route calls through
|
|
6
|
+
* fetch() instead of server actions. This is needed on platforms where
|
|
7
|
+
* server actions cannot access request cookies (e.g., CF Workers via OpenNext).
|
|
8
|
+
*
|
|
9
|
+
* The handler validates same-origin requests via the Sec-Fetch-Site header
|
|
10
|
+
* (set by browsers automatically and cannot be forged by scripts).
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* Creates a Next.js Route Handler that routes method calls through queryAction.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```ts
|
|
17
|
+
* // app/api/augur/route.ts
|
|
18
|
+
* import { createAugurApiHandler } from "@simpleapps-com/augur-server/api";
|
|
19
|
+
*
|
|
20
|
+
* const handler = createAugurApiHandler();
|
|
21
|
+
* export const POST = handler;
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export declare function createAugurApiHandler(): (req: Request) => Promise<Response>;
|
|
25
|
+
//# sourceMappingURL=api-handler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api-handler.d.ts","sourceRoot":"","sources":["../src/api-handler.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAgBH;;;;;;;;;;;GAWG;AACH,wBAAgB,qBAAqB,KACrB,KAAK,OAAO,KAAG,OAAO,CAAC,QAAQ,CAAC,CA4B/C"}
|