@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
package/dist/testing.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/testing.ts"],"sourcesContent":["export { createMockClient } from \"@simpleapps-com/augur-core/testing\";\nexport { clearSiteActions } from \"./server-site-registry\";\nexport type { DeepMockClient, MockClientResult } from \"@simpleapps-com/augur-core/testing\";\n\nimport type { SiteActions } from \"./actions/site\";\n\n/**\n * A mock function type compatible with both Vitest and Jest.\n * Supports `.mockResolvedValue()`, `.mockRejectedValue()`, and call tracking.\n */\nexport interface MockFn {\n (...args: unknown[]): unknown;\n mockResolvedValue: (value: unknown) => MockFn;\n mockRejectedValue: (value: unknown) => MockFn;\n mockReturnValue: (value: unknown) => MockFn;\n mockImplementation: (fn: (...args: unknown[]) => unknown) => MockFn;\n mock: { calls: unknown[][] };\n}\n\n/** Mirror of SiteActions where every method is a MockFn. */\nexport type MockSiteActions = {\n [K in keyof SiteActions]: {\n [M in keyof SiteActions[K]]: MockFn;\n };\n};\n\n/** Return type of createMockSiteActions. */\nexport interface MockSiteActionsResult {\n /** Typed as SiteActions — pass this to your components/server actions. */\n actions: SiteActions;\n /** Same object typed with MockFn — use for assertions and mock setup. */\n mocks: MockSiteActions;\n}\n\n/** Shape definition: service name → method names. */\nconst SERVICE_METHODS: Record<string, string[]> = {\n pricing: [\"getItemPrice\", \"batchGetItemPrices\", \"getTaxEstimate\"],\n items: [\n \"itemCategoryLookup\",\n \"getItemCategory\",\n \"getCategoryItems\",\n \"getCategoryItemsInfinite\",\n \"getItemAttributes\",\n \"getInvMast\",\n \"getInvMastDoc\",\n \"getStock\",\n \"getStockCompanySummary\",\n \"getItemFaqs\",\n \"getItemSubstitutes\",\n \"getItemAccessories\",\n \"getSimilarItems\",\n \"batchGetInvMastDocs\",\n \"batchGetStockData\",\n ],\n commerce: [\n \"cartHdrLookup\",\n \"getCartLines\",\n \"addToCart\",\n \"updateCartLines\",\n \"deleteCartItems\",\n \"getCartAlsoBought\",\n \"checkoutOrder\",\n ],\n search: [\"getSearchAttributes\", \"getSearchSuggestions\", \"itemSearch\", \"itemSearchInfinite\"],\n orders: [\"getOrderDoc\"],\n shipping: [\"getShippingRates\"],\n joomla: [\n \"getJoomlaContent\",\n \"getJoomlaContentList\",\n \"getJoomlaMenu\",\n \"getJoomlaMenuDoc\",\n \"getUserProfile\",\n \"verifyPassword\",\n ],\n legacy: [\"getItemWebDesc\", \"getAlsoBoughtItems\", \"getItemTags\", \"getStates\"],\n customers: [\n \"
|
|
1
|
+
{"version":3,"sources":["../src/testing.ts"],"sourcesContent":["export { createMockClient } from \"@simpleapps-com/augur-core/testing\";\nexport { clearSiteActions } from \"./server-site-registry\";\nexport type { DeepMockClient, MockClientResult } from \"@simpleapps-com/augur-core/testing\";\n\nimport type { SiteActions } from \"./actions/site\";\n\n/**\n * A mock function type compatible with both Vitest and Jest.\n * Supports `.mockResolvedValue()`, `.mockRejectedValue()`, and call tracking.\n */\nexport interface MockFn {\n (...args: unknown[]): unknown;\n mockResolvedValue: (value: unknown) => MockFn;\n mockRejectedValue: (value: unknown) => MockFn;\n mockReturnValue: (value: unknown) => MockFn;\n mockImplementation: (fn: (...args: unknown[]) => unknown) => MockFn;\n mock: { calls: unknown[][] };\n}\n\n/** Mirror of SiteActions where every method is a MockFn. */\nexport type MockSiteActions = {\n [K in keyof SiteActions]: {\n [M in keyof SiteActions[K]]: MockFn;\n };\n};\n\n/** Return type of createMockSiteActions. */\nexport interface MockSiteActionsResult {\n /** Typed as SiteActions — pass this to your components/server actions. */\n actions: SiteActions;\n /** Same object typed with MockFn — use for assertions and mock setup. */\n mocks: MockSiteActions;\n}\n\n/** Shape definition: service name → method names. */\nconst SERVICE_METHODS: Record<string, string[]> = {\n pricing: [\"getItemPrice\", \"batchGetItemPrices\", \"getTaxEstimate\"],\n items: [\n \"itemCategoryLookup\",\n \"getItemCategory\",\n \"getCategoryItems\",\n \"getCategoryItemsInfinite\",\n \"getItemAttributes\",\n \"getInvMast\",\n \"getInvMastDoc\",\n \"getStock\",\n \"getStockCompanySummary\",\n \"getItemFaqs\",\n \"getItemSubstitutes\",\n \"getItemAccessories\",\n \"getSimilarItems\",\n \"batchGetInvMastDocs\",\n \"batchGetStockData\",\n ],\n commerce: [\n \"cartHdrLookup\",\n \"getCartLines\",\n \"addToCart\",\n \"updateCartLines\",\n \"deleteCartItems\",\n \"getCartAlsoBought\",\n \"checkoutOrder\",\n ],\n search: [\"getSearchAttributes\", \"getSearchSuggestions\", \"itemSearch\", \"itemSearchInfinite\"],\n orders: [\"getOrderDoc\"],\n shipping: [\"getShippingRates\"],\n joomla: [\n \"getJoomlaContent\",\n \"getJoomlaContentList\",\n \"getJoomlaMenu\",\n \"getJoomlaMenuDoc\",\n \"getUserProfile\",\n \"verifyPassword\",\n ],\n legacy: [\"getItemWebDesc\", \"getAlsoBoughtItems\", \"getItemTags\", \"getStates\"],\n customers: [\n \"customerLookup\",\n \"getCustomerDoc\",\n \"getCustomerOrders\",\n \"getCustomerOrderDetail\",\n \"getCustomerInvoices\",\n \"getCustomerInvoiceDetail\",\n \"getCustomerQuotes\",\n \"getCustomerQuoteDetail\",\n \"getShipToAddresses\",\n ],\n smartyStreets: [\"validateAddress\"],\n p21Pim: [\"getInvMastExt\", \"listInvMastExt\"],\n agrSite: [\"getSettings\", \"getRobots\"],\n avalara: [\"calculateTax\"],\n payments: [\n \"transactionSetup\",\n \"accountQuery\",\n \"getSurcharge\",\n \"cardInfo\",\n \"billingUpdate\",\n \"validatePayment\",\n ],\n logistics: [\"getFreightRates\", \"getShipVia\"],\n vmi: [\n \"getWarehouses\",\n \"getWarehouseAvailability\",\n \"getDistributors\",\n \"getProducts\",\n \"getInventoryProfiles\",\n \"getRestockHeaders\",\n \"getSections\",\n ],\n p21Core: [\n \"getAddresses\",\n \"getCompanies\",\n \"getCompany\",\n \"getLocations\",\n \"getPaymentTypes\",\n \"getCashDrawers\",\n \"getCodeP21\",\n ],\n p21Apis: [\"refreshContacts\", \"refreshCustomers\"],\n p21Sism: [\"getRecentImports\", \"getImport\", \"getScheduledImports\"],\n agrWork: [\"healthCheck\", \"ping\"],\n agrInfo: [\"getContext\", \"getRubrics\", \"getMicroservices\", \"generateAkasha\", \"generateJoomla\"],\n basecamp2: [\n \"getTodos\",\n \"getTodo\",\n \"getTodosSummary\",\n \"getComments\",\n \"getPeople\",\n \"getProjects\",\n \"getEvents\",\n \"getMetrics\",\n \"getTodolists\",\n ],\n brandFolder: [\"getCategories\", \"getCategory\", \"createFocus\"],\n gregorovich: [\"getDocuments\"],\n favorites: [\"getFavorites\", \"addFavorite\", \"removeFavorite\"],\n wishlists: [\n \"getWishlists\",\n \"createWishlist\",\n \"getWishlistDetail\",\n \"deleteWishlist\",\n \"addWishlistItems\",\n \"removeWishlistItem\",\n ],\n};\n\nfunction createStubFn(): MockFn {\n const calls: unknown[][] = [];\n\n const fn = ((...args: unknown[]) => {\n calls.push(args);\n const impl = (fn as MockFnInternal)._impl;\n return impl ? impl(...args) : undefined;\n }) as MockFn & MockFnInternal;\n\n fn._impl = undefined;\n fn.mock = { calls };\n\n fn.mockResolvedValue = (value: unknown) => {\n fn._impl = () => Promise.resolve(value);\n return fn;\n };\n\n fn.mockRejectedValue = (value: unknown) => {\n fn._impl = () => Promise.reject(value);\n return fn;\n };\n\n fn.mockReturnValue = (value: unknown) => {\n fn._impl = () => value;\n return fn;\n };\n\n fn.mockImplementation = (impl: (...args: unknown[]) => unknown) => {\n fn._impl = impl;\n return fn;\n };\n\n return fn;\n}\n\ninterface MockFnInternal {\n _impl: ((...args: unknown[]) => unknown) | undefined;\n}\n\n/**\n * Creates a fully-mocked SiteActions object for testing.\n *\n * Every method on every service is a stub function with call tracking\n * and `.mockResolvedValue()` / `.mockReturnValue()` support.\n * Works with both Vitest and Jest — no framework dependency.\n *\n * @example\n * ```ts\n * import { createMockSiteActions } from \"@simpleapps-com/augur-server/testing\";\n *\n * const { actions, mocks } = createMockSiteActions();\n *\n * // Setup return values\n * mocks.pricing.getItemPrice.mockResolvedValue({ price: 9.99 });\n *\n * // Pass actions to your component/server action\n * const price = await actions.pricing.getItemPrice(\"ITEM-1\");\n *\n * // Assert calls\n * expect(mocks.pricing.getItemPrice.mock.calls[0]).toEqual([\"ITEM-1\"]);\n * ```\n */\nexport function createMockSiteActions(): MockSiteActionsResult {\n const result: Record<string, Record<string, MockFn>> = {};\n\n for (const [service, methods] of Object.entries(SERVICE_METHODS)) {\n const serviceMock: Record<string, MockFn> = {};\n for (const method of methods) {\n serviceMock[method] = createStubFn();\n }\n result[service] = serviceMock;\n }\n\n return {\n actions: result as unknown as SiteActions,\n mocks: result as unknown as MockSiteActions,\n };\n}\n"],"mappings":"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","names":[]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fetches data for multiple params in parallel, returning a Record keyed by
|
|
3
|
+
* `getKey(param)`. Individual failures are silently excluded from the result
|
|
4
|
+
* so one bad item never takes down the entire batch.
|
|
5
|
+
*/
|
|
6
|
+
export declare function batchFetch<TParam, TKey extends string | number, TData>(params: TParam[], fetchOne: (param: TParam) => Promise<TData>, getKey: (param: TParam) => TKey): Promise<Record<TKey, TData>>;
|
|
7
|
+
//# sourceMappingURL=batch-fetch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"batch-fetch.d.ts","sourceRoot":"","sources":["../../src/utils/batch-fetch.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAsB,UAAU,CAAC,MAAM,EAAE,IAAI,SAAS,MAAM,GAAG,MAAM,EAAE,KAAK,EAC1E,MAAM,EAAE,MAAM,EAAE,EAChB,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,KAAK,CAAC,EAC3C,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,GAC9B,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAgB9B"}
|
package/llms.txt
CHANGED
|
@@ -1,22 +1,19 @@
|
|
|
1
1
|
# Augur Platform Packages
|
|
2
2
|
|
|
3
3
|
This package is part of the @simpleapps-com/augur-* platform.
|
|
4
|
-
|
|
5
|
-
The
|
|
6
|
-
Pure transform utilities bridge user-facing types to SDK params without breaking proxy type safety.
|
|
4
|
+
Each package releases on its own CalVer version; nothing requires them to share one.
|
|
5
|
+
The docs are at https://augur.build/docs/packages (the API reference lists every export).
|
|
7
6
|
|
|
8
7
|
## Sibling packages
|
|
9
8
|
|
|
10
|
-
- @simpleapps-com/augur-config - Shared tooling configuration presets for Augur ecommerce sites
|
|
11
9
|
- @simpleapps-com/augur-core - Universal foundation for Augur packages — proxy infrastructure, cache keys, method classification, shared types
|
|
10
|
+
- @simpleapps-com/augur-utils - Shared types, cache configuration, and utility functions for Augur ecommerce sites
|
|
12
11
|
- @simpleapps-com/augur-hooks - Cross-platform React Query hooks and Zustand stores for Augur ecommerce sites
|
|
13
|
-
- @simpleapps-com/augur-mobile - React Native/Expo adapters for Augur ecommerce apps (offline sync, biometrics, push)
|
|
14
12
|
- @simpleapps-com/augur-server (this package) - Server-side utilities for Augur ecommerce sites (Redis caching, SDK helpers, auth)
|
|
15
|
-
- @simpleapps-com/augur-tailwind - Shared Tailwind CSS v4 theme with HSL variables for Augur ecommerce sites
|
|
16
|
-
- @simpleapps-com/augur-utils - Shared types, cache configuration, and utility functions for Augur ecommerce sites
|
|
17
13
|
- @simpleapps-com/augur-web - Shared React UI components for Augur ecommerce sites (Radix + Tailwind)
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
- @simpleapps-com/augur-mobile - React Native/Expo adapters for Augur ecommerce apps (offline sync, biometrics, push)
|
|
15
|
+
- @simpleapps-com/augur-tailwind - Shared Tailwind CSS v4 theme with HSL variables for Augur ecommerce sites
|
|
16
|
+
- @simpleapps-com/augur-config - Shared tooling configuration presets for Augur ecommerce sites
|
|
20
17
|
|
|
21
18
|
---
|
|
22
19
|
|
|
@@ -24,43 +21,72 @@ Each package ships its own llms.txt with exports and usage patterns.
|
|
|
24
21
|
|
|
25
22
|
> Server-side utilities for Augur ecommerce sites (Redis caching, SDK helpers, auth)
|
|
26
23
|
|
|
27
|
-
Version: 2.2.29
|
|
28
|
-
|
|
29
24
|
## @simpleapps-com/augur-server
|
|
30
25
|
|
|
31
|
-
-
|
|
32
|
-
-
|
|
33
|
-
- value:
|
|
34
|
-
-
|
|
35
|
-
- function: batchFetch - Fetches data for multiple params in parallel, returning a Record keyed by
|
|
36
|
-
- function: cacheGet - Read a cached value by key.
|
|
37
|
-
- function: cacheSet - Write a value to cache with a TTL. Fire-and-forget semantics: no-ops
|
|
38
|
-
- value: createQueryOptions
|
|
26
|
+
- function: batchFetch - Fetches data for multiple params in parallel, returning a Record keyed by `getKey(param)`. Individual failures are silently excluded from the result so one bad item never takes down the entire batch.
|
|
27
|
+
- function: cacheGet - Read a cached value by key. Returns `null` on cache miss, circuit-open, connection failure, or if Redis is unavailable. Never throws.
|
|
28
|
+
- function: cacheSet - Write a value to cache with a TTL. Fire-and-forget semantics: no-ops silently when the circuit is open or Redis is unavailable. Never throws.
|
|
29
|
+
- const: createQueryOptions - Creates useQuery options with consistent key generation. Filters out undefined/null/empty params from the query key.
|
|
39
30
|
- function: createServerQueryClient - Creates a server-side query client optimised for prefetching.
|
|
40
|
-
- function: createSiteActions
|
|
41
|
-
-
|
|
31
|
+
- function: createSiteActions - Creates a unified site actions object with all service factories.
|
|
32
|
+
- const: createSuspenseQueryOptions - Creates useSuspenseQuery options with consistent key generation. Same as createQueryOptions but without enabledFn (suspense queries cannot be disabled).
|
|
42
33
|
- const: env - Resolved environment: `"development"`, `"staging"`, or `"production"`.
|
|
43
34
|
- function: getCircuitState - Returns the current circuit breaker state.
|
|
44
35
|
- const: getServerQueryClient - Returns a per-request singleton QueryClient for React Server Components.
|
|
45
|
-
- function: getSiteActions
|
|
36
|
+
- function: getSiteActions - Returns the registered site actions instance.
|
|
46
37
|
- const: isDev - `true` when running locally (localhost / NODE_ENV=development).
|
|
47
38
|
- const: isProduction - `true` when running on the production deployment.
|
|
48
39
|
- function: isRedisConnected - Whether the Redis client is connected and ready to accept commands.
|
|
49
40
|
- const: isStaging - `true` when running on the staging/dev deployment.
|
|
50
|
-
- function: paginateOffset
|
|
51
|
-
- function: registerSiteActions
|
|
52
|
-
- function: safeAction - Wraps an async function call with error handling, returning a
|
|
41
|
+
- function: paginateOffset - Wraps a list of items with offset-based pagination metadata.
|
|
42
|
+
- function: registerSiteActions - Stores the site actions instance for use by server action exports. Called automatically by {@link createServerSite}.
|
|
43
|
+
- function: safeAction - Wraps an async function call with error handling, returning a `SafeActionResult<T>` instead of throwing.
|
|
53
44
|
- function: sdkCall - Calls an Augur SDK method, forwarding all arguments with full type safety.
|
|
54
45
|
- value: unwrap
|
|
55
46
|
- value: unwrapOr
|
|
56
|
-
- function: verifyRecaptcha - Server-side Google reCAPTCHA v3 verification.
|
|
47
|
+
- function: verifyRecaptcha - Server-side Google reCAPTCHA v3 verification. Used by API routes that accept public form submissions.
|
|
57
48
|
- function: withServerCache - Server-side cache wrapper using augur-server's Redis client.
|
|
49
|
+
- type: ActionResult
|
|
50
|
+
- type: EdgeCacheValue
|
|
58
51
|
- type: PaginatedResult
|
|
52
|
+
- type: QueryOptionsConfig
|
|
53
|
+
- type: SafeActionResult
|
|
59
54
|
- type: SiteActions
|
|
60
55
|
- type: SiteActionsConfig
|
|
61
56
|
|
|
62
57
|
### Examples
|
|
63
58
|
|
|
59
|
+
createSiteActions:
|
|
60
|
+
```ts
|
|
61
|
+
import { createSiteActions } from "@simpleapps-com/augur-server";
|
|
62
|
+
import { getAugurClient } from "./augur-client";
|
|
63
|
+
|
|
64
|
+
// defaultCustomerId/defaultContactId fall back to DEFAULT_CUSTOMER_ID/DEFAULT_CONTACT_ID
|
|
65
|
+
// env vars when not provided — no need to set them if CDK injects them.
|
|
66
|
+
export const actions = createSiteActions(getAugurClient(), {
|
|
67
|
+
convertUnitOfMeasure: (uom) => uom === "EA" ? "EACH" : uom,
|
|
68
|
+
items: { sortChildren: true },
|
|
69
|
+
shipping: {
|
|
70
|
+
fromAddress: { address1: "123 Main", city: "Provo", state: "UT", postalCode: "84606" },
|
|
71
|
+
defaultServiceCodes: ["03"],
|
|
72
|
+
},
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
// Usage:
|
|
76
|
+
const price = await actions.pricing.getItemPrice("ITEM-1");
|
|
77
|
+
const doc = await actions.items.getInvMastDoc("ITEM-1");
|
|
78
|
+
const cart = await actions.commerce.cartHdrLookup({ userId: 123 });
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
paginateOffset:
|
|
82
|
+
```ts
|
|
83
|
+
const result = await actions.items.getCategoryItems(uid, {
|
|
84
|
+
...filters, offset: page * 24, limit: 24,
|
|
85
|
+
});
|
|
86
|
+
return paginateOffset(result.items, page, 24, result.total);
|
|
87
|
+
// { data: [...], total: 150, nextCursor: 1, hasMore: true }
|
|
88
|
+
```
|
|
89
|
+
|
|
64
90
|
safeAction:
|
|
65
91
|
```ts
|
|
66
92
|
const result = await safeAction(
|
|
@@ -82,7 +108,6 @@ const result = await sdkCall(
|
|
|
82
108
|
);
|
|
83
109
|
```
|
|
84
110
|
|
|
85
|
-
|
|
86
111
|
## @simpleapps-com/augur-server/auth
|
|
87
112
|
|
|
88
113
|
- function: createAuthConfig - Creates a NextAuth configuration with Joomla credential provider, session callbacks, and automatic cart initialization.
|
|
@@ -95,17 +120,17 @@ const result = await sdkCall(
|
|
|
95
120
|
|
|
96
121
|
## @simpleapps-com/augur-server/query
|
|
97
122
|
|
|
98
|
-
- const: createQueryOptions - Creates useQuery options with consistent key generation.
|
|
99
|
-
- const: createSuspenseQueryOptions - Creates useSuspenseQuery options with consistent key generation.
|
|
123
|
+
- const: createQueryOptions - Creates useQuery options with consistent key generation. Filters out undefined/null/empty params from the query key.
|
|
124
|
+
- const: createSuspenseQueryOptions - Creates useSuspenseQuery options with consistent key generation. Same as createQueryOptions but without enabledFn (suspense queries cannot be disabled).
|
|
100
125
|
- type: QueryOptionsConfig
|
|
101
126
|
|
|
102
127
|
## @simpleapps-com/augur-server/testing
|
|
103
128
|
|
|
104
|
-
-
|
|
105
|
-
- value: MockClientResult
|
|
106
|
-
- function: clearSiteActions
|
|
129
|
+
- function: clearSiteActions - Clears the registered site actions. Used in tests only.
|
|
107
130
|
- value: createMockClient
|
|
108
131
|
- function: createMockSiteActions - Creates a fully-mocked SiteActions object for testing.
|
|
132
|
+
- type: DeepMockClient
|
|
133
|
+
- type: MockClientResult
|
|
109
134
|
- type: MockFn
|
|
110
135
|
- type: MockSiteActions
|
|
111
136
|
- type: MockSiteActionsResult
|
|
@@ -128,10 +153,9 @@ const price = await actions.pricing.getItemPrice("ITEM-1");
|
|
|
128
153
|
expect(mocks.pricing.getItemPrice.mock.calls[0]).toEqual(["ITEM-1"]);
|
|
129
154
|
```
|
|
130
155
|
|
|
131
|
-
|
|
132
156
|
## @simpleapps-com/augur-server/site
|
|
133
157
|
|
|
134
|
-
- function: createServerSite - Create a server-side site instance that bundles the SDK client, server
|
|
158
|
+
- function: createServerSite - Create a server-side site instance that bundles the SDK client, server actions, and (optional) NextAuth configuration.
|
|
135
159
|
- type: ServerSite
|
|
136
160
|
- type: ServerSiteAuthConfig
|
|
137
161
|
- type: ServerSiteConfig
|
|
@@ -140,27 +164,26 @@ expect(mocks.pricing.getItemPrice.mock.calls[0]).toEqual(["ITEM-1"]);
|
|
|
140
164
|
|
|
141
165
|
createServerSite:
|
|
142
166
|
```ts
|
|
143
|
-
import {
|
|
144
|
-
import { createServerSite } from "@simpleapps-com/augur-server";
|
|
167
|
+
import { AugurAPI } from "@simpleapps-com/augur-api";
|
|
168
|
+
import { createServerSite } from "@simpleapps-com/augur-server/site";
|
|
145
169
|
|
|
146
|
-
const api = new
|
|
170
|
+
const api = new AugurAPI({ siteId: process.env.AUGUR_SITE_ID!, bearerToken: process.env.AUGUR_JWT! });
|
|
147
171
|
export const site = createServerSite(api, {
|
|
148
172
|
defaultCustomerId: "12345",
|
|
149
173
|
auth: { secret: process.env.AUTH_SECRET },
|
|
150
174
|
});
|
|
151
175
|
```
|
|
152
176
|
|
|
153
|
-
|
|
154
177
|
## @simpleapps-com/augur-server/actions
|
|
155
178
|
|
|
156
|
-
-
|
|
157
|
-
-
|
|
158
|
-
-
|
|
179
|
+
- type: ApiResult
|
|
180
|
+
- type: ListResult
|
|
181
|
+
- type: SafeActionResult
|
|
159
182
|
|
|
160
183
|
## @simpleapps-com/augur-server/hooks
|
|
161
184
|
|
|
162
|
-
-
|
|
163
|
-
-
|
|
185
|
+
- function: createServerQueryProxy - Creates a client-side proxy that mirrors the SDK namespace and routes every method call through a server action function.
|
|
186
|
+
- type: QueryActionFn
|
|
164
187
|
|
|
165
188
|
### Examples
|
|
166
189
|
|
|
@@ -172,12 +195,12 @@ const q = createServerQueryProxy();
|
|
|
172
195
|
|
|
173
196
|
// Reads — any SDK method, routed through server actions
|
|
174
197
|
const { data: item } = useQuery(q.items.invMast.doc.get(42));
|
|
175
|
-
const { data: price } = useQuery(q.pricing.priceEngine.
|
|
198
|
+
const { data: price } = useQuery(q.pricing.priceEngine.list({ itemId, customerId }));
|
|
176
199
|
|
|
177
200
|
// Infinite queries — spread and add infinite-specific options
|
|
178
201
|
const { data, fetchNextPage } = useInfiniteQuery({
|
|
179
|
-
...q.items.
|
|
180
|
-
getNextPageParam: (lastPage) => lastPage
|
|
202
|
+
...q.items.categories.items.list(itemCategoryUid, filters),
|
|
203
|
+
getNextPageParam: (lastPage, pages) => nextOffset(lastPage, pages), // the site's paging rule
|
|
181
204
|
initialPageParam: 0,
|
|
182
205
|
});
|
|
183
206
|
|
|
@@ -185,14 +208,13 @@ const { data, fetchNextPage } = useInfiniteQuery({
|
|
|
185
208
|
const addToCart = useMutation(q.commerce.cartLine.add.create());
|
|
186
209
|
```
|
|
187
210
|
|
|
188
|
-
|
|
189
211
|
## @simpleapps-com/augur-server/query-action
|
|
190
212
|
|
|
191
213
|
- function: getSessionCredentials - Resolve session credentials from the Auth.js JWT cookie.
|
|
192
|
-
- function: queryAction - Generic server action that routes any SDK method call through the raw
|
|
214
|
+
- function: queryAction - Generic server action that routes any SDK method call through the raw SDK client with optional Redis caching. Used internally by `createServerQueryProxy()` to bridge client-side React Query hooks to server-side API calls.
|
|
193
215
|
- function: resetSessionImports - Reset lazy-loaded imports. Used in tests only. @internal
|
|
194
216
|
- function: resolveMethod - Resolve a dot-separated method path on an object, returning the leaf function.
|
|
195
|
-
-
|
|
217
|
+
- value: unwrapBaseResponse
|
|
196
218
|
|
|
197
219
|
## @simpleapps-com/augur-server/api
|
|
198
220
|
|
|
@@ -209,6 +231,5 @@ const handler = createAugurApiHandler();
|
|
|
209
231
|
export const POST = handler;
|
|
210
232
|
```
|
|
211
233
|
|
|
212
|
-
|
|
213
234
|
## @simpleapps-com/augur-server/next-auth
|
|
214
235
|
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@simpleapps-com/augur-server",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2026.11.1",
|
|
4
4
|
"description": "Server-side utilities for Augur ecommerce sites (Redis caching, SDK helpers, auth)",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
|
-
"url": "https://github.com/simpleapps-com/
|
|
8
|
+
"url": "https://github.com/simpleapps-com/atlas.git",
|
|
9
9
|
"directory": "packages/augur-server"
|
|
10
10
|
},
|
|
11
11
|
"type": "module",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"import": "./dist/auth.js"
|
|
20
20
|
},
|
|
21
21
|
"./query": {
|
|
22
|
-
"types": "./dist/query.d.ts",
|
|
22
|
+
"types": "./dist/query-options-helper.d.ts",
|
|
23
23
|
"import": "./dist/query.js"
|
|
24
24
|
},
|
|
25
25
|
"./testing": {
|
|
@@ -27,11 +27,11 @@
|
|
|
27
27
|
"import": "./dist/testing.js"
|
|
28
28
|
},
|
|
29
29
|
"./site": {
|
|
30
|
-
"types": "./dist/site.d.ts",
|
|
30
|
+
"types": "./dist/server-site.d.ts",
|
|
31
31
|
"import": "./dist/site.js"
|
|
32
32
|
},
|
|
33
33
|
"./actions": {
|
|
34
|
-
"types": "./dist/actions.d.ts",
|
|
34
|
+
"types": "./dist/server-actions.d.ts",
|
|
35
35
|
"import": "./dist/actions.js"
|
|
36
36
|
},
|
|
37
37
|
"./hooks": {
|
|
@@ -58,12 +58,12 @@
|
|
|
58
58
|
"llms.txt"
|
|
59
59
|
],
|
|
60
60
|
"dependencies": {
|
|
61
|
-
"@simpleapps-com/augur-core": "
|
|
62
|
-
"@simpleapps-com/augur-hooks": "
|
|
63
|
-
"@simpleapps-com/augur-utils": "
|
|
61
|
+
"@simpleapps-com/augur-core": "^2026.11.1",
|
|
62
|
+
"@simpleapps-com/augur-hooks": "^2026.11.1",
|
|
63
|
+
"@simpleapps-com/augur-utils": "^2026.11.1"
|
|
64
64
|
},
|
|
65
65
|
"peerDependencies": {
|
|
66
|
-
"@simpleapps-com/augur-api": "^2026.
|
|
66
|
+
"@simpleapps-com/augur-api": "^2026.10.17",
|
|
67
67
|
"@tanstack/react-query": "^5.80.0",
|
|
68
68
|
"ioredis": "^5.9.0",
|
|
69
69
|
"jose": "^5.0.0 || ^6.0.0",
|
|
@@ -84,23 +84,32 @@
|
|
|
84
84
|
},
|
|
85
85
|
"devDependencies": {
|
|
86
86
|
"@tanstack/react-query": "^5.80.0",
|
|
87
|
-
"@types/node": "^
|
|
87
|
+
"@types/node": "^26.6.6",
|
|
88
88
|
"@types/react": "^19.0.0",
|
|
89
|
-
"@vitest/coverage-v8": "
|
|
89
|
+
"@vitest/coverage-v8": "~5.0.3",
|
|
90
|
+
"eslint": "^10.12.0",
|
|
90
91
|
"ioredis": "^5.9.0",
|
|
91
92
|
"jose": "^5.0.0",
|
|
93
|
+
"lemmascript": "0.6.5",
|
|
92
94
|
"react": "^19.0.0",
|
|
93
|
-
"tsup": "^
|
|
94
|
-
"
|
|
95
|
-
"
|
|
96
|
-
"@
|
|
95
|
+
"tsup": "^9.0.0",
|
|
96
|
+
"typescript": "~6.0.3",
|
|
97
|
+
"vitest": "~5.0.3",
|
|
98
|
+
"@atlas/eslint-config": "0.0.0",
|
|
99
|
+
"@atlas/tsconfig": "0.0.0",
|
|
100
|
+
"@atlas/tsup-config": "0.0.0",
|
|
101
|
+
"@atlas/utils": "0.0.0",
|
|
102
|
+
"@atlas/vitest-config": "0.0.0",
|
|
103
|
+
"@simpleapps-com/augur-api": "2026.11.2"
|
|
104
|
+
},
|
|
105
|
+
"engines": {
|
|
106
|
+
"node": ">=22.0.0"
|
|
97
107
|
},
|
|
98
108
|
"scripts": {
|
|
99
|
-
"build": "tsup",
|
|
100
|
-
"
|
|
101
|
-
"
|
|
109
|
+
"build": "tsup && tsc -p tsconfig.build.json",
|
|
110
|
+
"lint": "eslint .",
|
|
111
|
+
"proofs": "lsc check --backend=dafny",
|
|
102
112
|
"test": "vitest run --coverage",
|
|
103
|
-
"typecheck": "tsc --noEmit"
|
|
104
|
-
"check-exports": "publint"
|
|
113
|
+
"typecheck": "tsc --noEmit"
|
|
105
114
|
}
|
|
106
115
|
}
|
package/dist/actions.d.ts
DELETED