@simpleapps-com/augur-server 1.0.19 → 2.0.0
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/actions.d.ts +23 -23
- package/dist/actions.js +2 -2
- package/dist/actions.js.map +1 -1
- package/dist/{chunk-6D3JVRXB.js → chunk-DF3HMPTP.js} +4 -3
- package/dist/chunk-DF3HMPTP.js.map +1 -0
- package/dist/{chunk-C3V6CBNQ.js → chunk-GYZT5Q2K.js} +2 -2
- package/dist/chunk-GYZT5Q2K.js.map +1 -0
- package/dist/{chunk-MQGUOFAZ.js → chunk-QRCB7P2N.js} +6 -6
- package/dist/chunk-QRCB7P2N.js.map +1 -0
- package/dist/index.d.ts +4 -4
- package/dist/index.js +3 -3
- package/dist/{sdk-call-CaW_esvl.d.ts → sdk-call-CPDSzeu0.d.ts} +10 -10
- package/dist/{server-site-registry--cWuKRVq.d.ts → server-site-registry-DXum3EsN.d.ts} +1 -1
- package/dist/{site-BIi93EZe.d.ts → site-B_2M8bT-.d.ts} +23 -14
- package/dist/site.d.ts +2 -2
- package/dist/site.js +2 -2
- package/dist/{smarty-streets-BM7oah88.d.ts → smarty-streets-wNE71Nip.d.ts} +11 -11
- package/dist/testing.d.ts +3 -3
- package/dist/testing.js +1 -1
- package/package.json +5 -5
- package/dist/chunk-6D3JVRXB.js.map +0 -1
- package/dist/chunk-C3V6CBNQ.js.map +0 -1
- package/dist/chunk-MQGUOFAZ.js.map +0 -1
|
@@ -15,12 +15,15 @@
|
|
|
15
15
|
* ```
|
|
16
16
|
*/
|
|
17
17
|
declare function sdkCall<TArgs extends unknown[], TResult>(method: (...args: TArgs) => Promise<TResult>, ...args: TArgs): Promise<TResult>;
|
|
18
|
-
/**
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
/**
|
|
19
|
+
* @deprecated No longer needed — `SafeActionResult<T>` uses `T` directly.
|
|
20
|
+
* Kept as a passthrough alias for backwards compatibility.
|
|
21
|
+
*/
|
|
22
|
+
type SafeData<T> = T;
|
|
23
|
+
/** Result type for `safeAction`. */
|
|
21
24
|
type SafeActionResult<T> = {
|
|
22
25
|
ok: true;
|
|
23
|
-
data:
|
|
26
|
+
data: T;
|
|
24
27
|
} | {
|
|
25
28
|
ok: false;
|
|
26
29
|
error: string;
|
|
@@ -33,9 +36,6 @@ type SafeActionResult<T> = {
|
|
|
33
36
|
* Reads that go through React Query should NOT use this — let errors
|
|
34
37
|
* propagate so React Query can handle retries and error state.
|
|
35
38
|
*
|
|
36
|
-
* When the wrapped function returns `void`, `data` is set to `true`
|
|
37
|
-
* so that `result.data` is never `undefined` on a successful call.
|
|
38
|
-
*
|
|
39
39
|
* @param fn — The async function to execute
|
|
40
40
|
* @param onError — Optional callback for logging/reporting
|
|
41
41
|
*
|
|
@@ -45,7 +45,7 @@ type SafeActionResult<T> = {
|
|
|
45
45
|
* () => actions.commerce.addToCart(cartId, items),
|
|
46
46
|
* );
|
|
47
47
|
* if (result.ok) {
|
|
48
|
-
* // result.data is
|
|
48
|
+
* // result.data is the response data (undefined for void actions)
|
|
49
49
|
* } else {
|
|
50
50
|
* // result.error is the error message
|
|
51
51
|
* }
|
|
@@ -63,7 +63,7 @@ declare function safeAction<T>(fn: () => Promise<T>, onError?: (error: Error) =>
|
|
|
63
63
|
* const cart = unwrap(await getCartLines(cartId));
|
|
64
64
|
* ```
|
|
65
65
|
*/
|
|
66
|
-
declare function unwrap<T>(result: SafeActionResult<T>):
|
|
66
|
+
declare function unwrap<T>(result: SafeActionResult<T>): T;
|
|
67
67
|
/**
|
|
68
68
|
* Extracts the data from a `SafeActionResult`, returning `null` on error.
|
|
69
69
|
*
|
|
@@ -75,6 +75,6 @@ declare function unwrap<T>(result: SafeActionResult<T>): SafeData<T>;
|
|
|
75
75
|
* if (!cart) { /* handle missing data *\/ }
|
|
76
76
|
* ```
|
|
77
77
|
*/
|
|
78
|
-
declare function unwrapOr<T>(result: SafeActionResult<T>):
|
|
78
|
+
declare function unwrapOr<T>(result: SafeActionResult<T>): T | null;
|
|
79
79
|
|
|
80
80
|
export { type SafeActionResult as S, type SafeData as a, sdkCall as b, unwrapOr as c, safeAction as s, unwrap as u };
|
|
@@ -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, 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-
|
|
3
|
+
import { TPriceData, TTaxItem, TTax, TCartLookUp, TCartLine, TRelatedProduct, TCheckoutResult, TWebDesc, TTransactionSetup, TAccountQuery, TSurcharge, TCardInfo, TBillingUpdate, TPaymentValidation, TShippingMethod } 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-wNE71Nip.js';
|
|
5
5
|
|
|
6
6
|
/** Derived from augur-api SDK — keeps types in sync automatically. */
|
|
7
7
|
type PricingApiClient = Pick<AugurAPI, "pricing">;
|
|
@@ -76,8 +76,8 @@ interface CommerceActions {
|
|
|
76
76
|
unitOfMeasure: string;
|
|
77
77
|
}[]) => Promise<unknown>;
|
|
78
78
|
deleteCartItems: (cartHdrUid: number) => Promise<void>;
|
|
79
|
-
getCartAlsoBought: (cartHdrUid: number) => Promise<
|
|
80
|
-
checkoutOrder: (cartHdrUid: number, data: Record<string, unknown>) => Promise<
|
|
79
|
+
getCartAlsoBought: (cartHdrUid: number) => Promise<TRelatedProduct[]>;
|
|
80
|
+
checkoutOrder: (cartHdrUid: number, data: Record<string, unknown>) => Promise<TCheckoutResult | undefined>;
|
|
81
81
|
}
|
|
82
82
|
/**
|
|
83
83
|
* @deprecated Use `createSiteActions()` instead. This factory will be removed in the next major version.
|
|
@@ -159,7 +159,7 @@ interface LegacyActionsConfig {
|
|
|
159
159
|
}
|
|
160
160
|
interface LegacyActions {
|
|
161
161
|
getItemWebDesc: (invMastUid: number) => Promise<TWebDesc | undefined>;
|
|
162
|
-
getAlsoBoughtItems: (invMastUid: number) => Promise<
|
|
162
|
+
getAlsoBoughtItems: (invMastUid: number) => Promise<TRelatedProduct[]>;
|
|
163
163
|
getItemTags: (invMastUid: number) => Promise<unknown[]>;
|
|
164
164
|
getStates: (params?: {
|
|
165
165
|
twoLetterCode?: string;
|
|
@@ -313,12 +313,12 @@ interface PaymentsActionsConfig {
|
|
|
313
313
|
mode?: string;
|
|
314
314
|
}
|
|
315
315
|
interface PaymentsActions {
|
|
316
|
-
transactionSetup: (params: Record<string, unknown>) => Promise<
|
|
317
|
-
accountQuery: (params: Record<string, unknown>) => Promise<
|
|
318
|
-
getSurcharge: (params: Record<string, unknown>) => Promise<
|
|
319
|
-
cardInfo: (params: Record<string, unknown>) => Promise<
|
|
320
|
-
billingUpdate: (params: Record<string, unknown>) => Promise<
|
|
321
|
-
validatePayment: (params: Record<string, unknown>) => Promise<
|
|
316
|
+
transactionSetup: (params: Record<string, unknown>) => Promise<TTransactionSetup | undefined>;
|
|
317
|
+
accountQuery: (params: Record<string, unknown>) => Promise<TAccountQuery | undefined>;
|
|
318
|
+
getSurcharge: (params: Record<string, unknown>) => Promise<TSurcharge | undefined>;
|
|
319
|
+
cardInfo: (params: Record<string, unknown>) => Promise<TCardInfo | undefined>;
|
|
320
|
+
billingUpdate: (params: Record<string, unknown>) => Promise<TBillingUpdate | undefined>;
|
|
321
|
+
validatePayment: (params: Record<string, unknown>) => Promise<TPaymentValidation | undefined>;
|
|
322
322
|
}
|
|
323
323
|
/**
|
|
324
324
|
* @deprecated Use `createSiteActions()` instead. This factory will be removed in the next major version.
|
|
@@ -349,7 +349,7 @@ interface UpsActionsConfig {
|
|
|
349
349
|
cachePrefix?: string;
|
|
350
350
|
}
|
|
351
351
|
interface UpsActions {
|
|
352
|
-
getRates: (params: Record<string, unknown>) => Promise<
|
|
352
|
+
getRates: (params: Record<string, unknown>) => Promise<TShippingMethod[] | undefined>;
|
|
353
353
|
}
|
|
354
354
|
/**
|
|
355
355
|
* @deprecated Use `createSiteActions()` instead. This factory will be removed in the next major version.
|
|
@@ -868,7 +868,16 @@ interface SlackActions {
|
|
|
868
868
|
declare function createSlackActions(api: SlackApiClient, config?: SlackActionsConfig): SlackActions;
|
|
869
869
|
|
|
870
870
|
interface SiteActionsConfig {
|
|
871
|
-
/**
|
|
871
|
+
/**
|
|
872
|
+
* Cache key prefix shared across all services.
|
|
873
|
+
*
|
|
874
|
+
* Defaults to `"${siteId}:"` extracted from the API client.
|
|
875
|
+
* The site ID is the canonical cache namespace — most sites should
|
|
876
|
+
* NOT set this and let it derive automatically.
|
|
877
|
+
*
|
|
878
|
+
* Only override when migrating from a legacy prefix (e.g. `"ampro:"`
|
|
879
|
+
* instead of the site ID `"ampro-online"`).
|
|
880
|
+
*/
|
|
872
881
|
cachePrefix?: string;
|
|
873
882
|
/** Default edge cache TTL in seconds */
|
|
874
883
|
edgeCache?: EdgeCacheValue;
|
|
@@ -952,8 +961,8 @@ interface SiteActions {
|
|
|
952
961
|
* import { createSiteActions } from "@simpleapps-com/augur-server";
|
|
953
962
|
* import { getAugurClient } from "./augur-client";
|
|
954
963
|
*
|
|
964
|
+
* // cachePrefix defaults to "${siteId}:" from the API client — no need to set it.
|
|
955
965
|
* export const actions = createSiteActions(getAugurClient(), {
|
|
956
|
-
* cachePrefix: "ampro:",
|
|
957
966
|
* defaultCustomerId: process.env.NEXT_PUBLIC_DEFAULT_CUSTOMER_ID,
|
|
958
967
|
* defaultContactId: process.env.NEXT_PUBLIC_DEFAULT_CONTACT_ID,
|
|
959
968
|
* convertUnitOfMeasure: (uom) => uom === "EA" ? "EACH" : uom,
|
package/dist/site.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { a0 as SiteActions, a1 as SiteActionsConfig } from './site-
|
|
1
|
+
import { a0 as SiteActions, a1 as SiteActionsConfig } from './site-B_2M8bT-.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-
|
|
7
|
+
import './smarty-streets-wNE71Nip.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,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createSiteActions
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-DF3HMPTP.js";
|
|
4
4
|
import {
|
|
5
5
|
createAuthConfig
|
|
6
6
|
} from "./chunk-Z7QWERHW.js";
|
|
7
7
|
import "./chunk-XGRQ53P2.js";
|
|
8
8
|
import {
|
|
9
9
|
registerSiteActions
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-QRCB7P2N.js";
|
|
11
11
|
|
|
12
12
|
// src/server-site.ts
|
|
13
13
|
function createServerSite(client, config = {}) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AugurAPI } from '@simpleapps-com/augur-api';
|
|
2
2
|
import { EdgeCacheValue } from '@simpleapps-com/augur-core';
|
|
3
|
-
import { TCategory, TAttribute, TInvMast, TInvMastDoc, TStockData, TItemAccessory, TProductItem, TSmartyStreets } from '@simpleapps-com/augur-utils';
|
|
3
|
+
import { TCategory, TCategoryItemsResult, TAttribute, TInvMast, TInvMastDoc, TStockData, TItemAccessory, TProductItem, TShippingMethod, TJoomlaContent, TMenu, TPasswordVerification, CustomerDocument, TSmartyStreets } from '@simpleapps-com/augur-utils';
|
|
4
4
|
|
|
5
5
|
/** Derived from augur-api SDK — keeps types in sync automatically. */
|
|
6
6
|
type ItemsApiClient = Pick<AugurAPI, "items">;
|
|
@@ -35,7 +35,7 @@ interface GetItemCategoryOptions {
|
|
|
35
35
|
interface ItemActions {
|
|
36
36
|
itemCategoryLookup: (path: string) => Promise<unknown>;
|
|
37
37
|
getItemCategory: (uid: number, options?: GetItemCategoryOptions) => Promise<TCategory>;
|
|
38
|
-
getCategoryItems: (uid: number, filters: Record<string, unknown>) => Promise<
|
|
38
|
+
getCategoryItems: (uid: number, filters: Record<string, unknown>) => Promise<TCategoryItemsResult>;
|
|
39
39
|
getItemAttributes: (categoryUid: number) => Promise<TAttribute[]>;
|
|
40
40
|
getInvMast: (uid: number) => Promise<TInvMast>;
|
|
41
41
|
getInvMastDoc: (params: {
|
|
@@ -169,7 +169,7 @@ interface ShippingActionsConfig {
|
|
|
169
169
|
redisTtl?: number;
|
|
170
170
|
}
|
|
171
171
|
interface ShippingActions {
|
|
172
|
-
getShippingRates: (toAddress: ShippingAddress, weight: number, serviceCodes?: string[]) => Promise<
|
|
172
|
+
getShippingRates: (toAddress: ShippingAddress, weight: number, serviceCodes?: string[]) => Promise<TShippingMethod[]>;
|
|
173
173
|
}
|
|
174
174
|
/**
|
|
175
175
|
* @deprecated Use `createSiteActions()` instead. This factory will be removed in the next major version.
|
|
@@ -221,12 +221,12 @@ interface NormalizedUserProfile {
|
|
|
221
221
|
permissions: string[];
|
|
222
222
|
}
|
|
223
223
|
interface JoomlaActions {
|
|
224
|
-
getJoomlaContent: (articleId: number) => Promise<
|
|
225
|
-
getJoomlaContentList: (params?: Record<string, unknown>) => Promise<
|
|
226
|
-
getJoomlaMenu: (params?: Record<string, unknown>) => Promise<
|
|
227
|
-
getJoomlaMenuDoc: (menuId: number | string) => Promise<
|
|
224
|
+
getJoomlaContent: (articleId: number) => Promise<TJoomlaContent>;
|
|
225
|
+
getJoomlaContentList: (params?: Record<string, unknown>) => Promise<TJoomlaContent[]>;
|
|
226
|
+
getJoomlaMenu: (params?: Record<string, unknown>) => Promise<TMenu[]>;
|
|
227
|
+
getJoomlaMenuDoc: (menuId: number | string) => Promise<TMenu>;
|
|
228
228
|
getUserProfile: (userId: number | string) => Promise<NormalizedUserProfile>;
|
|
229
|
-
verifyPassword: (username: string, password: string) => Promise<
|
|
229
|
+
verifyPassword: (username: string, password: string) => Promise<TPasswordVerification>;
|
|
230
230
|
}
|
|
231
231
|
/**
|
|
232
232
|
* @deprecated Use `createSiteActions()` instead. This factory will be removed in the next major version.
|
|
@@ -268,9 +268,9 @@ interface CustomersActionsConfig {
|
|
|
268
268
|
redisTtl?: number;
|
|
269
269
|
}
|
|
270
270
|
interface CustomersActions {
|
|
271
|
-
getCustomer: (customerId: number) => Promise<
|
|
272
|
-
customerLookup: (params: Record<string, unknown>) => Promise<
|
|
273
|
-
getCustomerDoc: (customerId: number) => Promise<
|
|
271
|
+
getCustomer: (customerId: number) => Promise<CustomerDocument>;
|
|
272
|
+
customerLookup: (params: Record<string, unknown>) => Promise<CustomerDocument[]>;
|
|
273
|
+
getCustomerDoc: (customerId: number) => Promise<CustomerDocument>;
|
|
274
274
|
getCustomerOrders: (customerId: number, params?: Record<string, unknown>) => Promise<CustomerListResult>;
|
|
275
275
|
getCustomerOrderDetail: (customerId: number, orderId: number) => Promise<unknown>;
|
|
276
276
|
getCustomerInvoices: (customerId: number, params?: Record<string, unknown>) => Promise<CustomerListResult>;
|
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
|
|
3
|
-
import { a0 as SiteActions } from './site-
|
|
2
|
+
export { c as clearSiteActions } from './server-site-registry-DXum3EsN.js';
|
|
3
|
+
import { a0 as SiteActions } from './site-B_2M8bT-.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-
|
|
7
|
+
import './smarty-streets-wNE71Nip.js';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* A mock function type compatible with both Vitest and Jest.
|
package/dist/testing.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@simpleapps-com/augur-server",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
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": "
|
|
53
|
-
"@simpleapps-com/augur-utils": "
|
|
52
|
+
"@simpleapps-com/augur-core": "2.0.0",
|
|
53
|
+
"@simpleapps-com/augur-utils": "2.0.0"
|
|
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": "
|
|
62
|
+
"@simpleapps-com/augur-hooks": "2.0.0"
|
|
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": "
|
|
85
|
+
"@simpleapps-com/augur-hooks": "2.0.0"
|
|
86
86
|
},
|
|
87
87
|
"scripts": {
|
|
88
88
|
"build": "tsup",
|