@simpleapps-com/augur-core
v2.3.1
Published
Universal foundation for Augur packages — proxy infrastructure, cache keys, method classification, shared types
Readme
@simpleapps-com/augur-core
Universal foundation for Augur packages — proxy infrastructure, cache keys, method classification, shared types
Auto-generated. Do not edit manually. Regenerate with:
pnpm run generate-exports
Part of the @simpleapps-com/augur-* platform. All packages use fixed versioning (same version number).
Install
pnpm add @simpleapps-com/augur-corePeer Dependencies
@simpleapps-com/augur-api
Entry Points
| Import | Description |
|--------|-------------|
| @simpleapps-com/augur-core | 20 exports, 26 types |
| @simpleapps-com/augur-core/testing | 4 exports, 0 types |
Exports
Auth & Context
| Export | Kind | Description |
|--------|------|-------------|
| createOptionsProxy | function | Creates a proxy that returns TanStack Query options for every SDK method. |
| defineSite | function | Identity helper that provides type-checking and IDE autocomplete |
Configuration
| Export | Kind | Description |
|--------|------|-------------|
| DEFAULT_CACHE_TIERS | const | Default cache tier values. |
| getCacheTier | function | Resolves the cache tier for a given SDK method path. |
Items & Categories
| Export | Kind | Description |
|--------|------|-------------|
| isWriteMethod | function | Returns true if the leaf method name represents a write (POST/PUT/DELETE) operation. |
Other
| Export | Kind | Description |
|--------|------|-------------|
| NO_CACHE_PATHS | const | Paths that should not be cached at any layer. |
| buildCacheKey | function | Builds a deterministic cache key for Redis/CDN caching. |
| buildQueryKey | function | Builds a deterministic query key from a method path and arguments. |
| createActionsProxy | function | Creates a proxy that wraps every SDK method as a direct async action. |
| createDeepProxy | function | Creates a deep proxy that intercepts property access to build a method |
| createFetchQueryAction | function | Creates a QueryActionFn backed by fetch() to an API endpoint. |
| createKeysOnlyProxy | function | Creates a keys-only proxy for sites without a client-side SDK instance. |
| createQueryActionProxy | function | Creates a proxy backed by a query action function instead of a direct SDK instance. |
| fnv1a | function | FNV-1a 32-bit hash. Fast non-cryptographic hash for cache keys. |
| isNoCachePath | function | Returns true if the given SDK method path matches a no-cache namespace. |
| isReadMethod | function | Returns true if the leaf method name represents a read (GET) operation. |
| resolveMethod | function | Walk an object by path array to find the leaf function. |
| stableArgs | function | Normalize arguments for deterministic cache/query keys. |
| stableStringify | function | JSON.stringify with sorted object keys for deterministic cache keys. |
| stripEdgeCacheForNoCachePaths | function | Strips the edgeCache property from every object arg when the method path |
| DeepMockClient | value | |
| MockClientResult | value | |
| MockFn | value | |
| createMockClient | value | |
Examples
buildCacheKey
buildCacheKey("ampro:", "pricing.priceEngine.get", [{ itemId: "X" }]) → "ampro:sdk:pricing.priceEngine.get:a1b2c3d4"
buildQueryKey
buildQueryKey(["items", "invMast", "get"], [42]) → ["items", "invMast", "get", 42]
buildQueryKey(["pricing", "priceEngine", "get"], [{ itemId: "X", customerId: 1 }]) → ["pricing", "priceEngine", "get", { itemId: "X", customerId: 1 }]
createActionsProxy
const actions = createActionsProxy(api, { cachePrefix: "ampro:" }); const stock = await actions.items.invMast.stock.get(42);
createFetchQueryAction
import { createFetchQueryAction } from "@simpleapps-com/augur-core";
import { registerQueryAction } from "@simpleapps-com/augur-hooks";
registerQueryAction(createFetchQueryAction("/api/augur"));createOptionsProxy
const q = createOptionsProxy(api); const opts = q.items.invMast.stock.get(42); // opts.queryKey → ["items", "invMast", "stock", "get", 42] // opts.queryFn → () => api.items.invMast.stock.get(42) // opts.staleTime → 60000 (semiStatic default)
createQueryActionProxy
const q = createQueryActionProxy(myServerAction); const opts = q.pricing.priceEngine.get({ itemId: "X", customerId: 1 }); // opts.queryKey → ["pricing", "priceEngine", "get", { customerId: 1, itemId: "X" }] // opts.queryFn → () => myServerAction("pricing.priceEngine.get", { ... })
getCacheTier
getCacheTier("items.categories.list") → static (60 min stale) getCacheTier("pricing.priceEngine.get") → semiStatic (1 min stale) getCacheTier("commerce.cartLine.add.create") → none (0 stale)
resolveMethod
resolveMethod(api, ["items", "invMast", "stock", "get"]) → api.items.invMast.stock.get
Types
ActionResult, ActionsProxyConfig, ApiResult, AugurAnalyticsConfig, AugurAuthContext, AugurSiteConfig, AugurSiteDefaults, AugurSiteFormatting, AugurSiteItemsConfig, AugurSiteSearchConfig, CacheConfig, CacheProvider, CacheTierConfig, CacheTierDefaults, DeepActions, DeepQueryOptions, EdgeCacheValue, InfiniteScrollPage, IsReadMethod, ListResult, OptionsProxyConfig, ProxyMutationOptions, ProxyQueryOptions, QueryActionFn, ResolvedCacheTier, WrapCallContext
Related Packages
All packages use fixed versioning -- same version number across the platform.
| Package | Description |
|---------|-------------|
| @simpleapps-com/augur-config | Shared tooling configuration presets for Augur ecommerce sites |
| @simpleapps-com/augur-hooks | Cross-platform React Query hooks and Zustand stores for Augur ecommerce sites |
| @simpleapps-com/augur-mobile | React Native/Expo adapters for Augur ecommerce apps (offline sync, biometrics, push) |
| @simpleapps-com/augur-server | Server-side utilities for Augur ecommerce sites (Redis caching, SDK helpers, auth) |
| @simpleapps-com/augur-tailwind | Shared Tailwind CSS v4 theme with HSL variables for Augur ecommerce sites |
| @simpleapps-com/augur-utils | Shared types, cache configuration, and utility functions for Augur ecommerce sites |
| @simpleapps-com/augur-web | Shared React UI components for Augur ecommerce sites (Radix + Tailwind) |
