@simpleapps-com/augur-server 1.0.17 → 1.0.19

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.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/pagination.ts","../src/actions/wishlists.ts","../src/actions/favorites.ts"],"sourcesContent":["/**\n * Standardized paginated response shape.\n * Works with any factory method — compose with `paginateOffset()`.\n */\nexport interface PaginatedResult<T> {\n data: T[];\n total?: number;\n nextCursor?: number;\n hasMore: boolean;\n}\n\n/**\n * Wraps a list of items with offset-based pagination metadata.\n *\n * Use this to standardize pagination responses from any factory method.\n * Compatible with React Query's infinite query pattern (`getNextPageParam`).\n *\n * @param items - The items returned from the current page\n * @param pageParam - The current page number (0-based)\n * @param limit - The page size\n * @param total - Optional total count of items (from API response)\n *\n * @example\n * ```ts\n * const result = await actions.items.getCategoryItems(uid, {\n * ...filters, offset: page * 24, limit: 24,\n * });\n * return paginateOffset(result.items, page, 24, result.total);\n * // { data: [...], total: 150, nextCursor: 1, hasMore: true }\n * ```\n */\nexport function paginateOffset<T>(\n items: T[],\n pageParam: number,\n limit: number,\n total?: number,\n): PaginatedResult<T> {\n const hasMore =\n total !== undefined\n ? (pageParam + 1) * limit < total\n : items.length === limit;\n\n return {\n data: items,\n total,\n nextCursor: hasMore ? pageParam + 1 : undefined,\n hasMore,\n };\n}\n","import type { AugurAPI } from \"@simpleapps-com/augur-api\";\nimport type { EdgeCacheValue } from \"../sdk-call\";\nimport { withServerCache } from \"../cache/with-cache\";\n\n/** Derived from augur-api SDK — keeps types in sync automatically. */\nexport type WishlistsApiClient = Pick<AugurAPI, \"items\">;\n\nexport interface WishlistActionsConfig {\n /** Cache key prefix (e.g. \"ampro:\"). Default: \"\". */\n cachePrefix?: string;\n /** CDN edge cache value passed to SDK. Default: 1 (hour). */\n edgeCache?: EdgeCacheValue;\n /** Redis TTL in seconds. Default: 3600 (1 hour). */\n redisTtl?: number;\n}\n\nexport interface WishlistActions {\n getWishlists: (userId: number) => Promise<unknown[]>;\n createWishlist: (\n userId: number,\n data: { name: string; description?: string },\n ) => Promise<unknown>;\n getWishlistDetail: (\n userId: number,\n wishlistId: number,\n ) => Promise<unknown>;\n deleteWishlist: (userId: number, wishlistId: number) => Promise<void>;\n addWishlistItems: (\n userId: number,\n wishlistId: number,\n items: { invMastUid: number }[],\n ) => Promise<unknown>;\n removeWishlistItem: (\n userId: number,\n wishlistId: number,\n lineId: number,\n ) => Promise<void>;\n}\n\n/** @deprecated Use `createSiteActions()` instead. This factory will be removed in the next major version. */\nexport function createWishlistActions(\n api: WishlistsApiClient,\n config: WishlistActionsConfig = {},\n): WishlistActions {\n const { cachePrefix = \"\", edgeCache = 1, redisTtl = 3600 } = config;\n\n async function getWishlists(userId: number): Promise<unknown[]> {\n return withServerCache(\n cachePrefix,\n redisTtl,\n \"items.itemWishlist.list\",\n async () => {\n const response = await api.items.itemWishlist.list(userId, {\n edgeCache,\n });\n return response.data;\n },\n userId,\n );\n }\n\n async function createWishlist(\n userId: number,\n data: { name: string; description?: string },\n ): Promise<unknown> {\n const response = await api.items.itemWishlist.create(userId, data);\n return response.data;\n }\n\n async function getWishlistDetail(\n userId: number,\n wishlistId: number,\n ): Promise<unknown> {\n return withServerCache(\n cachePrefix,\n redisTtl,\n \"items.itemWishlist.hdr.get\",\n async () => {\n const response = await api.items.itemWishlist.hdr.get(\n userId,\n wishlistId,\n { edgeCache },\n );\n return response.data;\n },\n userId,\n wishlistId,\n );\n }\n\n async function deleteWishlist(\n userId: number,\n wishlistId: number,\n ): Promise<void> {\n await api.items.itemWishlist.hdr.delete(userId, wishlistId);\n }\n\n async function addWishlistItems(\n userId: number,\n wishlistId: number,\n items: { invMastUid: number }[],\n ): Promise<unknown> {\n const response = await api.items.itemWishlist.hdr.create(\n userId,\n wishlistId,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n items as any,\n );\n return response.data;\n }\n\n async function removeWishlistItem(\n userId: number,\n wishlistId: number,\n lineId: number,\n ): Promise<void> {\n await api.items.itemWishlist.hdr.line.delete(userId, wishlistId, lineId);\n }\n\n return {\n getWishlists,\n createWishlist,\n getWishlistDetail,\n deleteWishlist,\n addWishlistItems,\n removeWishlistItem,\n };\n}\n","import type { AugurAPI } from \"@simpleapps-com/augur-api\";\nimport type { EdgeCacheValue } from \"../sdk-call\";\nimport { withServerCache } from \"../cache/with-cache\";\n\n/** Derived from augur-api SDK — keeps types in sync automatically. */\nexport type FavoritesApiClient = Pick<AugurAPI, \"items\">;\n\nexport interface FavoritesActionsConfig {\n /** Cache key prefix (e.g. \"ampro:\"). Default: \"\". */\n cachePrefix?: string;\n /** CDN edge cache value passed to SDK. Default: 1 (hour). */\n edgeCache?: EdgeCacheValue;\n /** Redis TTL in seconds. Default: 3600 (1 hour). */\n redisTtl?: number;\n}\n\nexport interface FavoritesActions {\n getFavorites: (userId: number) => Promise<unknown[]>;\n addFavorite: (userId: number, invMastUid: number) => Promise<unknown>;\n removeFavorite: (userId: number, invMastUid: number) => Promise<void>;\n}\n\n/** @deprecated Use `createSiteActions()` instead. This factory will be removed in the next major version. */\nexport function createFavoritesActions(\n api: FavoritesApiClient,\n config: FavoritesActionsConfig = {},\n): FavoritesActions {\n const { cachePrefix = \"\", edgeCache = 1, redisTtl = 3600 } = config;\n\n async function getFavorites(userId: number): Promise<unknown[]> {\n return withServerCache(\n cachePrefix,\n redisTtl,\n \"items.itemFavorites.list\",\n async () => {\n const response = await api.items.itemFavorites.list(userId, {\n edgeCache,\n });\n return response.data;\n },\n userId,\n );\n }\n\n async function addFavorite(\n userId: number,\n invMastUid: number,\n ): Promise<unknown> {\n const response = await api.items.itemFavorites.create(userId, {\n invMastUid,\n });\n return response.data;\n }\n\n async function removeFavorite(\n userId: number,\n invMastUid: number,\n ): Promise<void> {\n await api.items.itemFavorites.delete(userId, invMastUid);\n }\n\n return { getFavorites, addFavorite, removeFavorite };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;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AAA,EAClB;AAEA,iBAAe,mBACb,QACA,YACA,QACe;AACf,UAAM,IAAI,MAAM,aAAa,IAAI,KAAK,OAAO,QAAQ,YAAY,MAAM;AAAA,EACzE;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;;;ACxGO,SAAS,uBACd,KACA,SAAiC,CAAC,GAChB;AAClB,QAAM,EAAE,cAAc,IAAI,YAAY,GAAG,WAAW,KAAK,IAAI;AAE7D,iBAAe,aAAa,QAAoC;AAC9D,WAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA,YAAY;AACV,cAAM,WAAW,MAAM,IAAI,MAAM,cAAc,KAAK,QAAQ;AAAA,UAC1D;AAAA,QACF,CAAC;AACD,eAAO,SAAS;AAAA,MAClB;AAAA,MACA;AAAA,IACF;AAAA,EACF;AAEA,iBAAe,YACb,QACA,YACkB;AAClB,UAAM,WAAW,MAAM,IAAI,MAAM,cAAc,OAAO,QAAQ;AAAA,MAC5D;AAAA,IACF,CAAC;AACD,WAAO,SAAS;AAAA,EAClB;AAEA,iBAAe,eACb,QACA,YACe;AACf,UAAM,IAAI,MAAM,cAAc,OAAO,QAAQ,UAAU;AAAA,EACzD;AAEA,SAAO,EAAE,cAAc,aAAa,eAAe;AACrD;","names":[]}
1
+ {"version":3,"sources":["../src/pagination.ts","../src/actions/wishlists.ts","../src/actions/favorites.ts"],"sourcesContent":["/**\n * Standardized paginated response shape.\n * Works with any factory method — compose with `paginateOffset()`.\n */\nexport interface PaginatedResult<T> {\n data: T[];\n total?: number;\n nextCursor?: number;\n hasMore: boolean;\n}\n\n/**\n * Wraps a list of items with offset-based pagination metadata.\n *\n * Use this to standardize pagination responses from any factory method.\n * Compatible with React Query's infinite query pattern (`getNextPageParam`).\n *\n * @param items - The items returned from the current page\n * @param pageParam - The current page number (0-based)\n * @param limit - The page size\n * @param total - Optional total count of items (from API response)\n *\n * @example\n * ```ts\n * const result = await actions.items.getCategoryItems(uid, {\n * ...filters, offset: page * 24, limit: 24,\n * });\n * return paginateOffset(result.items, page, 24, result.total);\n * // { data: [...], total: 150, nextCursor: 1, hasMore: true }\n * ```\n */\nexport function paginateOffset<T>(\n items: T[],\n pageParam: number,\n limit: number,\n total?: number,\n): PaginatedResult<T> {\n const hasMore =\n total !== undefined\n ? (pageParam + 1) * limit < total\n : items.length === limit;\n\n return {\n data: items,\n total,\n nextCursor: hasMore ? pageParam + 1 : undefined,\n hasMore,\n };\n}\n","import type { AugurAPI } from \"@simpleapps-com/augur-api\";\nimport type { EdgeCacheValue } from \"../sdk-call\";\nimport { withServerCache } from \"../cache/with-cache\";\n\n/** Derived from augur-api SDK — keeps types in sync automatically. */\nexport type WishlistsApiClient = Pick<AugurAPI, \"items\">;\n\nexport interface WishlistActionsConfig {\n /** Cache key prefix (e.g. \"ampro:\"). Default: \"\". */\n cachePrefix?: string;\n /** CDN edge cache value passed to SDK. Default: 1 (hour). */\n edgeCache?: EdgeCacheValue;\n /** Redis TTL in seconds. Default: 3600 (1 hour). */\n redisTtl?: number;\n}\n\nexport interface WishlistActions {\n getWishlists: (userId: number) => Promise<unknown[]>;\n createWishlist: (\n userId: number,\n data: { name: string; description?: string },\n ) => Promise<unknown>;\n getWishlistDetail: (\n userId: number,\n wishlistId: number,\n ) => Promise<unknown>;\n deleteWishlist: (userId: number, wishlistId: number) => Promise<void>;\n addWishlistItems: (\n userId: number,\n wishlistId: number,\n items: { invMastUid: number }[],\n ) => Promise<unknown>;\n removeWishlistItem: (\n userId: number,\n wishlistId: number,\n lineId: number,\n ) => Promise<void>;\n}\n\n/** @deprecated Use `createSiteActions()` instead. This factory will be removed in the next major version. */\nexport function createWishlistActions(\n api: WishlistsApiClient,\n config: WishlistActionsConfig = {},\n): WishlistActions {\n const { cachePrefix = \"\", edgeCache = 1, redisTtl = 3600 } = config;\n\n async function getWishlists(userId: number): Promise<unknown[]> {\n return withServerCache(\n cachePrefix,\n redisTtl,\n \"items.itemWishlist.list\",\n async () => {\n const response = await api.items.itemWishlist.list(userId, {\n edgeCache,\n });\n return response.data;\n },\n userId,\n );\n }\n\n async function createWishlist(\n userId: number,\n data: { name: string; description?: string },\n ): Promise<unknown> {\n const response = await api.items.itemWishlist.create(userId, data);\n return response.data;\n }\n\n async function getWishlistDetail(\n userId: number,\n wishlistId: number,\n ): Promise<unknown> {\n return withServerCache(\n cachePrefix,\n redisTtl,\n \"items.itemWishlist.hdr.get\",\n async () => {\n const response = await api.items.itemWishlist.hdr.get(\n userId,\n wishlistId,\n { edgeCache },\n );\n return response.data;\n },\n userId,\n wishlistId,\n );\n }\n\n async function deleteWishlist(\n userId: number,\n wishlistId: number,\n ): Promise<void> {\n await api.items.itemWishlist.hdr.delete(userId, wishlistId);\n }\n\n async function addWishlistItems(\n userId: number,\n wishlistId: number,\n items: { invMastUid: number }[],\n ): Promise<unknown> {\n const response = await api.items.itemWishlist.hdr.create(\n userId,\n wishlistId,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n items as any,\n );\n return response.data;\n }\n\n async function removeWishlistItem(\n userId: number,\n wishlistId: number,\n lineId: number,\n ): Promise<void> {\n await api.items.itemWishlist.hdr.line.delete(userId, wishlistId, lineId);\n }\n\n return {\n getWishlists,\n createWishlist,\n getWishlistDetail,\n deleteWishlist,\n addWishlistItems,\n removeWishlistItem,\n };\n}\n","import type { AugurAPI } from \"@simpleapps-com/augur-api\";\nimport type { EdgeCacheValue } from \"../sdk-call\";\nimport { withServerCache } from \"../cache/with-cache\";\n\n/** Derived from augur-api SDK — keeps types in sync automatically. */\nexport type FavoritesApiClient = Pick<AugurAPI, \"items\">;\n\nexport interface FavoritesActionsConfig {\n /** Cache key prefix (e.g. \"ampro:\"). Default: \"\". */\n cachePrefix?: string;\n /** CDN edge cache value passed to SDK. Default: 1 (hour). */\n edgeCache?: EdgeCacheValue;\n /** Redis TTL in seconds. Default: 3600 (1 hour). */\n redisTtl?: number;\n}\n\nexport interface FavoritesActions {\n getFavorites: (userId: number) => Promise<unknown[]>;\n addFavorite: (userId: number, invMastUid: number) => Promise<unknown>;\n removeFavorite: (userId: number, invMastUid: number) => Promise<void>;\n}\n\n/** @deprecated Use `createSiteActions()` instead. This factory will be removed in the next major version. */\nexport function createFavoritesActions(\n api: FavoritesApiClient,\n config: FavoritesActionsConfig = {},\n): FavoritesActions {\n const { cachePrefix = \"\", edgeCache = 1, redisTtl = 3600 } = config;\n\n async function getFavorites(userId: number): Promise<unknown[]> {\n return withServerCache(\n cachePrefix,\n redisTtl,\n \"items.itemFavorites.list\",\n async () => {\n const response = await api.items.itemFavorites.list(userId, {\n edgeCache,\n });\n return response.data;\n },\n userId,\n );\n }\n\n async function addFavorite(\n userId: number,\n invMastUid: number,\n ): Promise<unknown> {\n const response = await api.items.itemFavorites.create(userId, {\n invMastUid,\n });\n return response.data;\n }\n\n async function removeFavorite(\n userId: number,\n invMastUid: number,\n ): Promise<void> {\n await api.items.itemFavorites.delete(userId, invMastUid);\n }\n\n return { getFavorites, addFavorite, removeFavorite };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BO,SAAS,eACd,OACA,WACA,OACA,OACoB;AACpB,QAAM,UACJ,UAAU,UACL,YAAY,KAAK,QAAQ,QAC1B,MAAM,WAAW;AAEvB,SAAO;AAAA,IACL,MAAM;AAAA,IACN;AAAA,IACA,YAAY,UAAU,YAAY,IAAI;AAAA,IACtC;AAAA,EACF;AACF;;;ACRO,SAAS,sBACd,KACA,SAAgC,CAAC,GAChB;AACjB,QAAM,EAAE,cAAc,IAAI,YAAY,GAAG,WAAW,KAAK,IAAI;AAE7D,iBAAe,aAAa,QAAoC;AAC9D,WAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA;AAAA,MACA,YAAY;AACV,cAAM,WAAW,MAAM,IAAI,MAAM,aAAa,KAAK,QAAQ;AAAA,UACzD;AAAA,QACF,CAAC;AACD,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,IACF;AAAA,EACF;AAEA,iBAAe,YACb,QACA,YACkB;AAClB,UAAM,WAAW,MAAM,IAAI,MAAM,cAAc,OAAO,QAAQ;AAAA,MAC5D;AAAA,IACF,CAAC;AACD,WAAO,SAAS;AAAA,EAClB;AAEA,iBAAe,eACb,QACA,YACe;AACf,UAAM,IAAI,MAAM,cAAc,OAAO,QAAQ,UAAU;AAAA,EACzD;AAEA,SAAO,EAAE,cAAc,aAAa,eAAe;AACrD;","names":[]}
@@ -52,5 +52,29 @@ type SafeActionResult<T> = {
52
52
  * ```
53
53
  */
54
54
  declare function safeAction<T>(fn: () => Promise<T>, onError?: (error: Error) => void): Promise<SafeActionResult<T>>;
55
+ /**
56
+ * Extracts the data from a `SafeActionResult`, throwing on error.
57
+ *
58
+ * Ideal for React Query `queryFn` where errors should propagate
59
+ * to the error boundary.
60
+ *
61
+ * @example
62
+ * ```ts
63
+ * const cart = unwrap(await getCartLines(cartId));
64
+ * ```
65
+ */
66
+ declare function unwrap<T>(result: SafeActionResult<T>): SafeData<T>;
67
+ /**
68
+ * Extracts the data from a `SafeActionResult`, returning `null` on error.
69
+ *
70
+ * For direct calls that prefer `null` over thrown errors.
71
+ *
72
+ * @example
73
+ * ```ts
74
+ * const cart = unwrapOr(await getCartLines(cartId));
75
+ * if (!cart) { /* handle missing data *\/ }
76
+ * ```
77
+ */
78
+ declare function unwrapOr<T>(result: SafeActionResult<T>): SafeData<T> | null;
55
79
 
56
- export { type SafeActionResult as S, type SafeData as a, sdkCall as b, safeAction as s };
80
+ export { type SafeActionResult as S, type SafeData as a, sdkCall as b, unwrapOr as c, safeAction as s, unwrap as u };
@@ -1,4 +1,4 @@
1
- import { a3 as SiteActions } from './site-BKPGMqQx.js';
1
+ import { a0 as SiteActions } from './site-BIi93EZe.js';
2
2
 
3
3
  /**
4
4
  * Stores the site actions instance for use by server action exports.
@@ -1,7 +1,7 @@
1
1
  import { EdgeCacheValue } from '@simpleapps-com/augur-core';
2
2
  import { AugurAPI } from '@simpleapps-com/augur-api';
3
- import { TPriceData, TTaxItem, TTax, TCategory, TAttribute, TInvMast, TInvMastDoc, TStockData, TItemAccessory, TCartLookUp, TCartLine, TWebDesc } from '@simpleapps-com/augur-utils';
4
- import { S as SearchActions, i as ShippingActions, J as JoomlaActions, a as CustomersActions, m as SmartyStreetsActions, k as ShippingAddress } from './smarty-streets-BS4ifhxQ.js';
3
+ import { TPriceData, TTaxItem, TTax, TCartLookUp, TCartLine, TWebDesc } from '@simpleapps-com/augur-utils';
4
+ import { I as ItemActions, S as SearchActions, k as ShippingActions, J as JoomlaActions, a as CustomersActions, o as SmartyStreetsActions, m as ShippingAddress } from './smarty-streets-BM7oah88.js';
5
5
 
6
6
  /** Derived from augur-api SDK — keeps types in sync automatically. */
7
7
  type PricingApiClient = Pick<AugurAPI, "pricing">;
@@ -20,7 +20,7 @@ interface PricingActionsConfig {
20
20
  interface PricingActions {
21
21
  getItemPrice: (itemId: string, customerId?: string | number, quantity?: number) => Promise<TPriceData>;
22
22
  batchGetItemPrices: (itemIds: string[], customerId?: string | number, quantity?: number) => Promise<Record<string, TPriceData>>;
23
- getTaxEstimate: (customerId: string | number, postalCode: string, items: TTaxItem[]) => Promise<TTax>;
23
+ getTaxEstimate: (customerId?: string | number, postalCode?: string, items?: TTaxItem[]) => Promise<TTax>;
24
24
  }
25
25
  /**
26
26
  * @deprecated Use `createSiteActions()` instead. This factory will be removed in the next major version.
@@ -48,72 +48,6 @@ interface PricingActions {
48
48
  */
49
49
  declare function createPricingActions(api: PricingApiClient, config?: PricingActionsConfig): PricingActions;
50
50
 
51
- /** Derived from augur-api SDK — keeps types in sync automatically. */
52
- type ItemsApiClient = Pick<AugurAPI, "items">;
53
- interface ItemActionsConfig {
54
- /** Cache key prefix (e.g. "ampro:"). Default: "". */
55
- cachePrefix?: string;
56
- /** CDN edge cache value for most calls. Default: 1 (hour). */
57
- edgeCache?: EdgeCacheValue;
58
- /** CDN edge cache for rarely-changing data like FAQs. Default: 8 (hours). */
59
- longEdgeCache?: EdgeCacheValue;
60
- /** Redis TTL for most calls in seconds. Default: 3600 (1 hour). */
61
- redisTtl?: number;
62
- /** Redis TTL for rarely-changing data in seconds. Default: 28800 (8 hours). */
63
- longRedisTtl?: number;
64
- /** Sort category children by sequenceNo. Default: true. */
65
- sortChildren?: boolean;
66
- /** Prefix prepended to sortBy filter values (e.g. "item_category_sequence_no_min|"). */
67
- sortByPrefix?: string;
68
- }
69
- interface ItemActions {
70
- itemCategoryLookup: (path: string) => Promise<unknown>;
71
- getItemCategory: (uid: number, options?: Record<string, unknown>) => Promise<TCategory>;
72
- getCategoryItems: (uid: number, filters: Record<string, unknown>) => Promise<unknown>;
73
- getItemAttributes: (categoryUid: number) => Promise<TAttribute[]>;
74
- getInvMast: (uid: number) => Promise<TInvMast>;
75
- getInvMastDoc: (params: {
76
- invMastUid?: number;
77
- itemId?: string;
78
- includePricing?: "Y" | "N";
79
- }) => Promise<TInvMastDoc>;
80
- getStock: (invMastUid: number) => Promise<TStockData[]>;
81
- getStockCompanySummary: (invMastUid: number) => Promise<Record<string, number>>;
82
- getItemFaqs: (invMastUid: number) => Promise<unknown[]>;
83
- getItemSubstitutes: (invMastUid: number) => Promise<unknown[]>;
84
- getItemAccessories: (invMastUid: number) => Promise<TItemAccessory[]>;
85
- getSimilarItems: (invMastUid: number) => Promise<unknown[]>;
86
- batchGetInvMastDocs: (params: {
87
- invMastUid?: number;
88
- itemId?: string;
89
- }[]) => Promise<Record<string, TInvMastDoc>>;
90
- batchGetStockData: (invMastUids: number[]) => Promise<Record<number, TStockData[]>>;
91
- }
92
- /**
93
- * @deprecated Use `createSiteActions()` instead. This factory will be removed in the next major version.
94
- *
95
- * Creates server-side item actions with Redis caching and edge cache support.
96
- *
97
- * Uses `withServerCache` which produces cache keys compatible with augur-hooks'
98
- * `withCache`, so server-prefetched data is shared with client-side hooks.
99
- *
100
- * @example
101
- * ```ts
102
- * // lib/item-actions.ts
103
- * import { createItemActions } from "@simpleapps-com/augur-server";
104
- * import { getAugurClient } from "./augur-client";
105
- *
106
- * export const itemActions = createItemActions(getAugurClient(), {
107
- * cachePrefix: "ampro:",
108
- * });
109
- *
110
- * // In a server component:
111
- * const category = await itemActions.getItemCategory(123);
112
- * const doc = await itemActions.getInvMastDoc({ itemId: "ITEM-1" });
113
- * ```
114
- */
115
- declare function createItemActions(api: ItemsApiClient, config?: ItemActionsConfig): ItemActions;
116
-
117
51
  /** Derived from augur-api SDK — keeps types in sync automatically. */
118
52
  type CommerceApiClient = Pick<AugurAPI, "commerce">;
119
53
  interface CommerceActionsConfig {
@@ -1038,4 +972,4 @@ interface SiteActions {
1038
972
  */
1039
973
  declare function createSiteActions<TApi extends object>(api: TApi, config?: SiteActionsConfig): SiteActions;
1040
974
 
1041
- export { type PaymentsApiClient as $, type AgrInfoActions as A, type Basecamp2Actions as B, type CommerceActions as C, type LogisticsApiClient as D, type NexusActionsConfig as E, type NexusApiClient as F, type GregorovichActions as G, type OrderActionsConfig as H, type ItemActions as I, type OrderApiClient as J, type P21ApisActionsConfig as K, type LegacyActions as L, type P21ApisApiClient as M, type NexusActions as N, type OrderActions as O, type P21ApisActions as P, type P21CoreActions as Q, type P21CoreActionsConfig as R, type P21CoreApiClient as S, type P21PimActions as T, type P21PimActionsConfig as U, type P21PimApiClient as V, type P21SismActions as W, type P21SismActionsConfig as X, type P21SismApiClient as Y, type PaymentsActions as Z, type PaymentsActionsConfig as _, type AgrInfoActionsConfig as a, type PricingActions as a0, type PricingActionsConfig as a1, type PricingApiClient as a2, type SiteActions as a3, type SiteActionsConfig as a4, type SlackActions as a5, type SlackActionsConfig as a6, type SlackApiClient as a7, type UpsActions as a8, type UpsActionsConfig as a9, createVmiActions as aA, type UpsApiClient as aa, type VmiActions as ab, type VmiActionsConfig as ac, type VmiApiClient as ad, createAgrInfoActions as ae, createAgrSiteActions as af, createAgrWorkActions as ag, createAvalaraActions as ah, createBasecamp2Actions as ai, createBrandFolderActions as aj, createCommerceActions as ak, createGregorovichActions as al, createItemActions as am, createLegacyActions as an, createLogisticsActions as ao, createNexusActions as ap, createOrderActions as aq, createP21ApisActions as ar, createP21CoreActions as as, createP21PimActions as at, createP21SismActions as au, createPaymentsActions as av, createPricingActions as aw, createSiteActions as ax, createSlackActions as ay, createUpsActions as az, type AgrInfoApiClient as b, type AgrSiteActions as c, type AgrSiteActionsConfig as d, type AgrSiteApiClient as e, type AgrWorkActions as f, type AgrWorkActionsConfig as g, type AgrWorkApiClient as h, type AvalaraActions as i, type AvalaraActionsConfig as j, type AvalaraApiClient as k, type Basecamp2ActionsConfig as l, type Basecamp2ApiClient as m, type BrandFolderActions as n, type BrandFolderActionsConfig as o, type BrandFolderApiClient as p, type CommerceActionsConfig as q, type CommerceApiClient as r, type GregorovichActionsConfig as s, type GregorovichApiClient as t, type ItemActionsConfig as u, type ItemsApiClient as v, type LegacyActionsConfig as w, type LegacyApiClient as x, type LogisticsActions as y, type LogisticsActionsConfig as z };
975
+ export { type PricingApiClient as $, type AgrInfoActions as A, type Basecamp2Actions as B, type CommerceActions as C, type NexusApiClient as D, type OrderActionsConfig as E, type OrderApiClient as F, type GregorovichActions as G, type P21ApisActionsConfig as H, type P21ApisApiClient as I, type P21CoreActions as J, type P21CoreActionsConfig as K, type LegacyActions as L, type P21CoreApiClient as M, type NexusActions as N, type OrderActions as O, type P21ApisActions as P, type P21PimActions as Q, type P21PimActionsConfig as R, type P21PimApiClient as S, type P21SismActions as T, type P21SismActionsConfig as U, type P21SismApiClient as V, type PaymentsActions as W, type PaymentsActionsConfig as X, type PaymentsApiClient as Y, type PricingActions as Z, type PricingActionsConfig as _, type AgrInfoActionsConfig as a, type SiteActions as a0, type SiteActionsConfig as a1, type SlackActions as a2, type SlackActionsConfig as a3, type SlackApiClient as a4, type UpsActions as a5, type UpsActionsConfig as a6, type UpsApiClient as a7, type VmiActions as a8, type VmiActionsConfig as a9, type VmiApiClient as aa, createAgrInfoActions as ab, createAgrSiteActions as ac, createAgrWorkActions as ad, createAvalaraActions as ae, createBasecamp2Actions as af, createBrandFolderActions as ag, createCommerceActions as ah, createGregorovichActions as ai, createLegacyActions as aj, createLogisticsActions as ak, createNexusActions as al, createOrderActions as am, createP21ApisActions as an, createP21CoreActions as ao, createP21PimActions as ap, createP21SismActions as aq, createPaymentsActions as ar, createPricingActions as as, createSiteActions as at, createSlackActions as au, createUpsActions as av, createVmiActions as aw, type AgrInfoApiClient as b, type AgrSiteActions as c, type AgrSiteActionsConfig as d, type AgrSiteApiClient as e, type AgrWorkActions as f, type AgrWorkActionsConfig as g, type AgrWorkApiClient as h, type AvalaraActions as i, type AvalaraActionsConfig as j, type AvalaraApiClient as k, type Basecamp2ActionsConfig as l, type Basecamp2ApiClient as m, type BrandFolderActions as n, type BrandFolderActionsConfig as o, type BrandFolderApiClient as p, type CommerceActionsConfig as q, type CommerceApiClient as r, type GregorovichActionsConfig as s, type GregorovichApiClient as t, type LegacyActionsConfig as u, type LegacyApiClient as v, type LogisticsActions as w, type LogisticsActionsConfig as x, type LogisticsApiClient as y, type NexusActionsConfig as z };
package/dist/site.d.ts CHANGED
@@ -1,10 +1,10 @@
1
- import { a3 as SiteActions, a4 as SiteActionsConfig } from './site-BKPGMqQx.js';
1
+ import { a0 as SiteActions, a1 as SiteActionsConfig } from './site-BIi93EZe.js';
2
2
  import { AugurAuthCallbacks } from './auth.js';
3
3
  import { NextAuthConfig } from 'next-auth';
4
4
  import '@simpleapps-com/augur-core';
5
5
  import '@simpleapps-com/augur-api';
6
6
  import '@simpleapps-com/augur-utils';
7
- import './smarty-streets-BS4ifhxQ.js';
7
+ import './smarty-streets-BM7oah88.js';
8
8
 
9
9
  /** Auth options forwarded to NextAuth when creating a server site. */
10
10
  interface ServerSiteAuthConfig {
package/dist/site.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createSiteActions
3
- } from "./chunk-5D5JCAKO.js";
3
+ } from "./chunk-6D3JVRXB.js";
4
4
  import {
5
5
  createAuthConfig
6
6
  } from "./chunk-Z7QWERHW.js";
@@ -1,6 +1,84 @@
1
1
  import { AugurAPI } from '@simpleapps-com/augur-api';
2
2
  import { EdgeCacheValue } from '@simpleapps-com/augur-core';
3
- import { TAttribute, TProductItem, TSmartyStreets } from '@simpleapps-com/augur-utils';
3
+ import { TCategory, TAttribute, TInvMast, TInvMastDoc, TStockData, TItemAccessory, TProductItem, TSmartyStreets } from '@simpleapps-com/augur-utils';
4
+
5
+ /** Derived from augur-api SDK — keeps types in sync automatically. */
6
+ type ItemsApiClient = Pick<AugurAPI, "items">;
7
+ interface ItemActionsConfig {
8
+ /** Cache key prefix (e.g. "ampro:"). Default: "". */
9
+ cachePrefix?: string;
10
+ /** CDN edge cache value for most calls. Default: 1 (hour). */
11
+ edgeCache?: EdgeCacheValue;
12
+ /** CDN edge cache for rarely-changing data like FAQs. Default: 8 (hours). */
13
+ longEdgeCache?: EdgeCacheValue;
14
+ /** Redis TTL for most calls in seconds. Default: 3600 (1 hour). */
15
+ redisTtl?: number;
16
+ /** Redis TTL for rarely-changing data in seconds. Default: 28800 (8 hours). */
17
+ longRedisTtl?: number;
18
+ /** Sort category children by sequenceNo. Default: true. */
19
+ sortChildren?: boolean;
20
+ /** Prefix prepended to sortBy filter values (e.g. "item_category_sequence_no_min|"). */
21
+ sortByPrefix?: string;
22
+ }
23
+ /** Typed options for getItemCategory. */
24
+ interface GetItemCategoryOptions {
25
+ childrenFilter?: string;
26
+ childrenLimit?: number;
27
+ childrenOffset?: number;
28
+ classId5List?: string;
29
+ filters?: Record<string, string>;
30
+ orderBy?: string;
31
+ path?: string;
32
+ productCollection?: string;
33
+ rootItemCategoryId?: string;
34
+ }
35
+ interface ItemActions {
36
+ itemCategoryLookup: (path: string) => Promise<unknown>;
37
+ getItemCategory: (uid: number, options?: GetItemCategoryOptions) => Promise<TCategory>;
38
+ getCategoryItems: (uid: number, filters: Record<string, unknown>) => Promise<unknown>;
39
+ getItemAttributes: (categoryUid: number) => Promise<TAttribute[]>;
40
+ getInvMast: (uid: number) => Promise<TInvMast>;
41
+ getInvMastDoc: (params: {
42
+ invMastUid?: number;
43
+ itemId?: string;
44
+ includePricing?: "Y" | "N";
45
+ }) => Promise<TInvMastDoc>;
46
+ getStock: (invMastUid: number) => Promise<TStockData[]>;
47
+ getStockCompanySummary: (invMastUid: number) => Promise<Record<string, number>>;
48
+ getItemFaqs: (invMastUid: number) => Promise<unknown[]>;
49
+ getItemSubstitutes: (invMastUid: number) => Promise<unknown[]>;
50
+ getItemAccessories: (invMastUid: number) => Promise<TItemAccessory[]>;
51
+ getSimilarItems: (invMastUid: number) => Promise<unknown[]>;
52
+ batchGetInvMastDocs: (params: {
53
+ invMastUid?: number;
54
+ itemId?: string;
55
+ }[]) => Promise<Record<string, TInvMastDoc>>;
56
+ batchGetStockData: (invMastUids: number[]) => Promise<Record<number, TStockData[]>>;
57
+ }
58
+ /**
59
+ * @deprecated Use `createSiteActions()` instead. This factory will be removed in the next major version.
60
+ *
61
+ * Creates server-side item actions with Redis caching and edge cache support.
62
+ *
63
+ * Uses `withServerCache` which produces cache keys compatible with augur-hooks'
64
+ * `withCache`, so server-prefetched data is shared with client-side hooks.
65
+ *
66
+ * @example
67
+ * ```ts
68
+ * // lib/item-actions.ts
69
+ * import { createItemActions } from "@simpleapps-com/augur-server";
70
+ * import { getAugurClient } from "./augur-client";
71
+ *
72
+ * export const itemActions = createItemActions(getAugurClient(), {
73
+ * cachePrefix: "ampro:",
74
+ * });
75
+ *
76
+ * // In a server component:
77
+ * const category = await itemActions.getItemCategory(123);
78
+ * const doc = await itemActions.getInvMastDoc({ itemId: "ITEM-1" });
79
+ * ```
80
+ */
81
+ declare function createItemActions(api: ItemsApiClient, config?: ItemActionsConfig): ItemActions;
4
82
 
5
83
  /** Derived from augur-api SDK — keeps types in sync automatically. */
6
84
  type SearchApiClient = Pick<AugurAPI, "opensearch">;
@@ -270,4 +348,4 @@ interface SmartyStreetsActions {
270
348
  */
271
349
  declare function createSmartyStreetsActions(api: SmartyStreetsApiClient, config?: SmartyStreetsActionsConfig): SmartyStreetsActions;
272
350
 
273
- export { type AddressValidationResult as A, type CustomerListResult as C, type JoomlaActions as J, type NormalizedUserProfile as N, type SearchActions as S, type CustomersActions as a, type CustomersActionsConfig as b, type CustomersApiClient as c, type JoomlaActionsConfig as d, type JoomlaApiClient as e, type SearchActionsConfig as f, type SearchApiClient as g, type SearchPage as h, type ShippingActions as i, type ShippingActionsConfig as j, type ShippingAddress as k, type ShippingApiClient as l, type SmartyStreetsActions as m, type SmartyStreetsActionsConfig as n, type SmartyStreetsApiClient as o, createCustomersActions as p, createJoomlaActions as q, createSearchActions as r, createShippingActions as s, createSmartyStreetsActions as t };
351
+ export { type AddressValidationResult as A, type CustomerListResult as C, type GetItemCategoryOptions as G, type ItemActions as I, type JoomlaActions as J, type NormalizedUserProfile as N, type SearchActions as S, type CustomersActions as a, type CustomersActionsConfig as b, type CustomersApiClient as c, type ItemActionsConfig as d, type ItemsApiClient as e, type JoomlaActionsConfig as f, type JoomlaApiClient as g, type SearchActionsConfig as h, type SearchApiClient as i, type SearchPage as j, type ShippingActions as k, type ShippingActionsConfig as l, type ShippingAddress as m, type ShippingApiClient as n, type SmartyStreetsActions as o, type SmartyStreetsActionsConfig as p, type SmartyStreetsApiClient as q, createCustomersActions as r, createItemActions as s, createJoomlaActions as t, createSearchActions as u, createShippingActions as v, createSmartyStreetsActions as w };
package/dist/testing.d.ts CHANGED
@@ -1,10 +1,10 @@
1
1
  export { DeepMockClient, MockClientResult, createMockClient } from '@simpleapps-com/augur-core/testing';
2
- export { c as clearSiteActions } from './server-site-registry-BZvxwcGM.js';
3
- import { a3 as SiteActions } from './site-BKPGMqQx.js';
2
+ export { c as clearSiteActions } from './server-site-registry--cWuKRVq.js';
3
+ import { a0 as SiteActions } from './site-BIi93EZe.js';
4
4
  import '@simpleapps-com/augur-core';
5
5
  import '@simpleapps-com/augur-api';
6
6
  import '@simpleapps-com/augur-utils';
7
- import './smarty-streets-BS4ifhxQ.js';
7
+ import './smarty-streets-BM7oah88.js';
8
8
 
9
9
  /**
10
10
  * A mock function type compatible with both Vitest and Jest.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@simpleapps-com/augur-server",
3
- "version": "1.0.17",
3
+ "version": "1.0.19",
4
4
  "description": "Server-side utilities for Augur ecommerce sites (Redis caching, SDK helpers, auth)",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -49,8 +49,8 @@
49
49
  ],
50
50
  "dependencies": {
51
51
  "valibot": "^1.0.0",
52
- "@simpleapps-com/augur-core": "1.0.17",
53
- "@simpleapps-com/augur-utils": "1.0.17"
52
+ "@simpleapps-com/augur-core": "1.0.19",
53
+ "@simpleapps-com/augur-utils": "1.0.19"
54
54
  },
55
55
  "peerDependencies": {
56
56
  "@simpleapps-com/augur-api": "^2026.3.1",
@@ -59,7 +59,7 @@
59
59
  "next": "^16.1.6",
60
60
  "next-auth": ">=5.0.0-beta.30",
61
61
  "react": "^19.0.0",
62
- "@simpleapps-com/augur-hooks": "1.0.17"
62
+ "@simpleapps-com/augur-hooks": "1.0.19"
63
63
  },
64
64
  "peerDependenciesMeta": {
65
65
  "ioredis": {
@@ -82,7 +82,7 @@
82
82
  "tsup": "^8.5.0",
83
83
  "vitest": "^3.2.0",
84
84
  "@augur-packages/tsconfig": "0.0.0",
85
- "@simpleapps-com/augur-hooks": "1.0.17"
85
+ "@simpleapps-com/augur-hooks": "1.0.19"
86
86
  },
87
87
  "scripts": {
88
88
  "build": "tsup",