@simpleapps-com/augur-server 2.0.23 → 2.1.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 +2 -19
- package/dist/actions.d.ts +1 -2
- package/dist/actions.js +1 -2
- package/dist/actions.js.map +1 -1
- package/dist/{chunk-277J2VEB.js → chunk-HLVRV3KZ.js} +42 -55
- package/dist/chunk-HLVRV3KZ.js.map +1 -0
- package/dist/index.d.ts +4 -55
- package/dist/index.js +20 -151
- package/dist/index.js.map +1 -1
- package/dist/{server-site-registry-CO6kl6vO.d.ts → server-site-registry-DWEjDPIz.d.ts} +1 -1
- package/dist/site-GdPO-aW1.d.ts +299 -0
- package/dist/site.d.ts +3 -3
- package/dist/site.js +1 -2
- package/dist/site.js.map +1 -1
- package/dist/smarty-streets-BnEIKoi8.d.ts +158 -0
- package/dist/testing.d.ts +3 -4
- package/dist/testing.js +1 -2
- package/dist/testing.js.map +1 -1
- package/llms.txt +1 -10
- package/package.json +6 -13
- package/dist/chunk-277J2VEB.js.map +0 -1
- package/dist/chunk-DCBWABAP.js +0 -25
- package/dist/chunk-DCBWABAP.js.map +0 -1
- package/dist/chunk-XGRQ53P2.js +0 -19
- package/dist/chunk-XGRQ53P2.js.map +0 -1
- package/dist/prefetch.d.ts +0 -79
- package/dist/prefetch.js +0 -137
- package/dist/prefetch.js.map +0 -1
- package/dist/site-CwPu_puI.d.ts +0 -1032
- package/dist/smarty-streets-xhe-ldMO.d.ts +0 -349
package/dist/index.js
CHANGED
|
@@ -3,40 +3,10 @@ import {
|
|
|
3
3
|
createSuspenseQueryOptions
|
|
4
4
|
} from "./chunk-TQP67TGL.js";
|
|
5
5
|
import {
|
|
6
|
-
|
|
7
|
-
getServerQueryClient
|
|
8
|
-
} from "./chunk-DCBWABAP.js";
|
|
9
|
-
import {
|
|
6
|
+
batchFetch,
|
|
10
7
|
cacheGet,
|
|
11
8
|
cacheSet,
|
|
12
|
-
createAgrInfoActions,
|
|
13
|
-
createAgrSiteActions,
|
|
14
|
-
createAgrWorkActions,
|
|
15
|
-
createAvalaraActions,
|
|
16
|
-
createBasecamp2Actions,
|
|
17
|
-
createBrandFolderActions,
|
|
18
|
-
createCommerceActions,
|
|
19
|
-
createCustomersActions,
|
|
20
|
-
createGregorovichActions,
|
|
21
|
-
createItemActions,
|
|
22
|
-
createJoomlaActions,
|
|
23
|
-
createLegacyActions,
|
|
24
|
-
createLogisticsActions,
|
|
25
|
-
createNexusActions,
|
|
26
|
-
createOrderActions,
|
|
27
|
-
createP21ApisActions,
|
|
28
|
-
createP21CoreActions,
|
|
29
|
-
createP21PimActions,
|
|
30
|
-
createP21SismActions,
|
|
31
|
-
createPaymentsActions,
|
|
32
|
-
createPricingActions,
|
|
33
|
-
createSearchActions,
|
|
34
|
-
createShippingActions,
|
|
35
9
|
createSiteActions,
|
|
36
|
-
createSlackActions,
|
|
37
|
-
createSmartyStreetsActions,
|
|
38
|
-
createUpsActions,
|
|
39
|
-
createVmiActions,
|
|
40
10
|
env,
|
|
41
11
|
getCircuitState,
|
|
42
12
|
getSiteActions,
|
|
@@ -48,103 +18,31 @@ import {
|
|
|
48
18
|
registerSiteActions,
|
|
49
19
|
safeAction,
|
|
50
20
|
sdkCall,
|
|
51
|
-
toListResult,
|
|
52
21
|
unwrap,
|
|
53
22
|
unwrapOr,
|
|
54
23
|
withServerCache
|
|
55
|
-
} from "./chunk-
|
|
56
|
-
import {
|
|
57
|
-
batchFetch
|
|
58
|
-
} from "./chunk-XGRQ53P2.js";
|
|
24
|
+
} from "./chunk-HLVRV3KZ.js";
|
|
59
25
|
import "./chunk-DGUM43GV.js";
|
|
60
26
|
|
|
61
|
-
// src/
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
}
|
|
78
|
-
async function createWishlist(userId, data) {
|
|
79
|
-
const response = await api.items.itemWishlist.create(userId, data);
|
|
80
|
-
return response.data;
|
|
81
|
-
}
|
|
82
|
-
async function getWishlistDetail(userId, wishlistId) {
|
|
83
|
-
return withServerCache(
|
|
84
|
-
cachePrefix,
|
|
85
|
-
redisTtl,
|
|
86
|
-
"items.itemWishlist.hdr.get",
|
|
87
|
-
async () => {
|
|
88
|
-
const response = await api.items.itemWishlist.hdr.get(userId, wishlistId, { edgeCache });
|
|
89
|
-
return response.data;
|
|
90
|
-
},
|
|
91
|
-
userId,
|
|
92
|
-
wishlistId
|
|
93
|
-
);
|
|
94
|
-
}
|
|
95
|
-
async function deleteWishlist(userId, wishlistId) {
|
|
96
|
-
await api.items.itemWishlist.hdr.delete(userId, wishlistId);
|
|
97
|
-
}
|
|
98
|
-
async function addWishlistItems(userId, wishlistId, items) {
|
|
99
|
-
const response = await api.items.itemWishlist.hdr.create(
|
|
100
|
-
userId,
|
|
101
|
-
wishlistId,
|
|
102
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
103
|
-
items
|
|
104
|
-
);
|
|
105
|
-
return response.data;
|
|
106
|
-
}
|
|
107
|
-
async function removeWishlistItem(userId, wishlistId, lineId) {
|
|
108
|
-
await api.items.itemWishlist.hdr.line.delete(userId, wishlistId, lineId);
|
|
109
|
-
}
|
|
110
|
-
return {
|
|
111
|
-
getWishlists,
|
|
112
|
-
createWishlist,
|
|
113
|
-
getWishlistDetail,
|
|
114
|
-
deleteWishlist,
|
|
115
|
-
addWishlistItems,
|
|
116
|
-
removeWishlistItem
|
|
117
|
-
};
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
// src/actions/favorites.ts
|
|
121
|
-
function createFavoritesActions(api, config = {}) {
|
|
122
|
-
const { cachePrefix = "", edgeCache = 1, redisTtl = 3600 } = config;
|
|
123
|
-
async function getFavorites(userId) {
|
|
124
|
-
return withServerCache(
|
|
125
|
-
cachePrefix,
|
|
126
|
-
redisTtl,
|
|
127
|
-
"items.itemFavorites.list",
|
|
128
|
-
async () => {
|
|
129
|
-
const response = await api.items.itemFavorites.list(userId, {
|
|
130
|
-
edgeCache
|
|
131
|
-
});
|
|
132
|
-
return toListResult(response);
|
|
133
|
-
},
|
|
134
|
-
userId
|
|
135
|
-
);
|
|
136
|
-
}
|
|
137
|
-
async function addFavorite(userId, invMastUid) {
|
|
138
|
-
const response = await api.items.itemFavorites.create(userId, {
|
|
139
|
-
invMastUid
|
|
140
|
-
});
|
|
141
|
-
return response.data;
|
|
142
|
-
}
|
|
143
|
-
async function removeFavorite(userId, invMastUid) {
|
|
144
|
-
await api.items.itemFavorites.delete(userId, invMastUid);
|
|
145
|
-
}
|
|
146
|
-
return { getFavorites, addFavorite, removeFavorite };
|
|
27
|
+
// src/server-query-client.ts
|
|
28
|
+
import { cache } from "react";
|
|
29
|
+
import { QueryClient } from "@tanstack/react-query";
|
|
30
|
+
import { CACHE_CONFIG } from "@simpleapps-com/augur-utils";
|
|
31
|
+
function createServerQueryClient() {
|
|
32
|
+
return new QueryClient({
|
|
33
|
+
defaultOptions: {
|
|
34
|
+
queries: {
|
|
35
|
+
staleTime: CACHE_CONFIG.STATIC.staleTime,
|
|
36
|
+
gcTime: CACHE_CONFIG.STATIC.staleTime,
|
|
37
|
+
retry: 0,
|
|
38
|
+
refetchOnMount: false,
|
|
39
|
+
refetchOnWindowFocus: false,
|
|
40
|
+
refetchOnReconnect: false
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
});
|
|
147
44
|
}
|
|
45
|
+
var getServerQueryClient = cache(() => createServerQueryClient());
|
|
148
46
|
|
|
149
47
|
// src/recaptcha.ts
|
|
150
48
|
async function verifyRecaptcha(token) {
|
|
@@ -171,39 +69,10 @@ export {
|
|
|
171
69
|
batchFetch,
|
|
172
70
|
cacheGet,
|
|
173
71
|
cacheSet,
|
|
174
|
-
createAgrInfoActions,
|
|
175
|
-
createAgrSiteActions,
|
|
176
|
-
createAgrWorkActions,
|
|
177
|
-
createAvalaraActions,
|
|
178
|
-
createBasecamp2Actions,
|
|
179
|
-
createBrandFolderActions,
|
|
180
|
-
createCommerceActions,
|
|
181
|
-
createCustomersActions,
|
|
182
|
-
createFavoritesActions,
|
|
183
|
-
createGregorovichActions,
|
|
184
|
-
createItemActions,
|
|
185
|
-
createJoomlaActions,
|
|
186
|
-
createLegacyActions,
|
|
187
|
-
createLogisticsActions,
|
|
188
|
-
createNexusActions,
|
|
189
|
-
createOrderActions,
|
|
190
|
-
createP21ApisActions,
|
|
191
|
-
createP21CoreActions,
|
|
192
|
-
createP21PimActions,
|
|
193
|
-
createP21SismActions,
|
|
194
|
-
createPaymentsActions,
|
|
195
|
-
createPricingActions,
|
|
196
72
|
createQueryOptions,
|
|
197
|
-
createSearchActions,
|
|
198
73
|
createServerQueryClient,
|
|
199
|
-
createShippingActions,
|
|
200
74
|
createSiteActions,
|
|
201
|
-
createSlackActions,
|
|
202
|
-
createSmartyStreetsActions,
|
|
203
75
|
createSuspenseQueryOptions,
|
|
204
|
-
createUpsActions,
|
|
205
|
-
createVmiActions,
|
|
206
|
-
createWishlistActions,
|
|
207
76
|
env,
|
|
208
77
|
getCircuitState,
|
|
209
78
|
getServerQueryClient,
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/
|
|
1
|
+
{"version":3,"sources":["../src/server-query-client.ts","../src/recaptcha.ts"],"sourcesContent":["import { cache } from \"react\";\nimport { QueryClient } from \"@tanstack/react-query\";\nimport { CACHE_CONFIG } from \"@simpleapps-com/augur-utils\";\n\n/**\n * Creates a server-side query client optimised for prefetching.\n *\n * - No persistence (server-only)\n * - Longer cache times for prefetched data\n * - No retries (fail fast on server)\n * - No refetching (server renders are one-shot)\n */\nexport function createServerQueryClient(): QueryClient {\n return new QueryClient({\n defaultOptions: {\n queries: {\n staleTime: CACHE_CONFIG.STATIC.staleTime,\n gcTime: CACHE_CONFIG.STATIC.staleTime,\n retry: 0,\n refetchOnMount: false,\n refetchOnWindowFocus: false,\n refetchOnReconnect: false,\n },\n },\n });\n}\n\n/**\n * Returns a per-request singleton QueryClient for React Server Components.\n *\n * React's `cache()` deduplicates calls within a single server request,\n * so each request gets its own QueryClient while avoiding the cross-request\n * state leakage that a module-level singleton would cause.\n */\nexport const getServerQueryClient = cache((): QueryClient => createServerQueryClient());\n","/**\n * Server-side Google reCAPTCHA v3 verification.\n * Used by API routes that accept public form submissions.\n */\nexport async function verifyRecaptcha(token: string): Promise<boolean> {\n try {\n const secretKey = process.env[\"RECAPTCHA_SECRET_KEY\"];\n if (!secretKey) return false;\n\n const res = await fetch(\"https://www.google.com/recaptcha/api/siteverify\", {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/x-www-form-urlencoded\" },\n body: new URLSearchParams({ secret: secretKey, response: token }),\n });\n if (!res.ok) {\n console.error(\"reCAPTCHA verify failed:\", res.status);\n return false;\n }\n const result = (await res.json()) as { success?: boolean };\n return result.success === true;\n } catch (error) {\n console.error(\"reCAPTCHA verify error:\", error);\n return false;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,aAAa;AACtB,SAAS,mBAAmB;AAC5B,SAAS,oBAAoB;AAUtB,SAAS,0BAAuC;AACrD,SAAO,IAAI,YAAY;AAAA,IACrB,gBAAgB;AAAA,MACd,SAAS;AAAA,QACP,WAAW,aAAa,OAAO;AAAA,QAC/B,QAAQ,aAAa,OAAO;AAAA,QAC5B,OAAO;AAAA,QACP,gBAAgB;AAAA,QAChB,sBAAsB;AAAA,QACtB,oBAAoB;AAAA,MACtB;AAAA,IACF;AAAA,EACF,CAAC;AACH;AASO,IAAM,uBAAuB,MAAM,MAAmB,wBAAwB,CAAC;;;AC9BtF,eAAsB,gBAAgB,OAAiC;AACrE,MAAI;AACF,UAAM,YAAY,QAAQ,IAAI,sBAAsB;AACpD,QAAI,CAAC,UAAW,QAAO;AAEvB,UAAM,MAAM,MAAM,MAAM,mDAAmD;AAAA,MACzE,QAAQ;AAAA,MACR,SAAS,EAAE,gBAAgB,oCAAoC;AAAA,MAC/D,MAAM,IAAI,gBAAgB,EAAE,QAAQ,WAAW,UAAU,MAAM,CAAC;AAAA,IAClE,CAAC;AACD,QAAI,CAAC,IAAI,IAAI;AACX,cAAQ,MAAM,4BAA4B,IAAI,MAAM;AACpD,aAAO;AAAA,IACT;AACA,UAAM,SAAU,MAAM,IAAI,KAAK;AAC/B,WAAO,OAAO,YAAY;AAAA,EAC5B,SAAS,OAAO;AACd,YAAQ,MAAM,2BAA2B,KAAK;AAC9C,WAAO;AAAA,EACT;AACF;","names":[]}
|
|
@@ -0,0 +1,299 @@
|
|
|
1
|
+
import { ListResult, EdgeCacheValue } from '@simpleapps-com/augur-core';
|
|
2
|
+
import { TPriceData, TTaxItem, TTax, TCartLookUp, TCartLine, TRelatedProduct, TCheckoutResult, TWebDesc, CustomerDocument, TTransactionSetup, TAccountQuery, TSurcharge, TCardInfo, TBillingUpdate, TPaymentValidation, TShippingMethod } from '@simpleapps-com/augur-utils';
|
|
3
|
+
import { I as ItemActions, S as SearchActions, a as ShippingActions, J as JoomlaActions, b as SmartyStreetsActions, c as ShippingAddress } from './smarty-streets-BnEIKoi8.js';
|
|
4
|
+
|
|
5
|
+
interface PricingActions {
|
|
6
|
+
getItemPrice: (itemId: string, customerId?: string | number, quantity?: number) => Promise<TPriceData>;
|
|
7
|
+
batchGetItemPrices: (itemIds: string[], customerId?: string | number, quantity?: number) => Promise<Record<string, TPriceData>>;
|
|
8
|
+
getTaxEstimate: (customerId?: string | number, postalCode?: string, items?: TTaxItem[]) => Promise<TTax>;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
interface CommerceActions {
|
|
12
|
+
cartHdrLookup: (params: {
|
|
13
|
+
userId?: string | number;
|
|
14
|
+
cartToken?: string;
|
|
15
|
+
contactId?: string | number;
|
|
16
|
+
customerId?: string | number;
|
|
17
|
+
}) => Promise<TCartLookUp>;
|
|
18
|
+
getCartLines: (cartHdrUid: number) => Promise<ListResult<TCartLine>>;
|
|
19
|
+
addToCart: (cartHdrUid: number, items: {
|
|
20
|
+
itemId?: string;
|
|
21
|
+
invMastUid?: number;
|
|
22
|
+
quantity: number;
|
|
23
|
+
unitOfMeasure: string;
|
|
24
|
+
}[]) => Promise<unknown>;
|
|
25
|
+
updateCartLines: (cartHdrUid: number, lines: {
|
|
26
|
+
lineNo: number;
|
|
27
|
+
quantity: number;
|
|
28
|
+
unitOfMeasure: string;
|
|
29
|
+
}[]) => Promise<unknown>;
|
|
30
|
+
deleteCartItems: (cartHdrUid: number) => Promise<void>;
|
|
31
|
+
getCartAlsoBought: (cartHdrUid: number) => Promise<ListResult<TRelatedProduct>>;
|
|
32
|
+
checkoutOrder: (cartHdrUid: number, data: Record<string, unknown>) => Promise<TCheckoutResult | undefined>;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
interface OrderActions {
|
|
36
|
+
getOrderDoc: (orderNo: string, postalCode: string) => Promise<unknown>;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
interface LegacyActions {
|
|
40
|
+
getItemWebDesc: (invMastUid: number) => Promise<TWebDesc | undefined>;
|
|
41
|
+
getAlsoBoughtItems: (invMastUid: number) => Promise<ListResult<TRelatedProduct>>;
|
|
42
|
+
getItemTags: (invMastUid: number) => Promise<ListResult>;
|
|
43
|
+
getStates: (params?: {
|
|
44
|
+
twoLetterCode?: string;
|
|
45
|
+
}) => Promise<ListResult>;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
interface CustomersActions {
|
|
49
|
+
getCustomer: (customerId: number) => Promise<CustomerDocument>;
|
|
50
|
+
customerLookup: (params: Record<string, unknown>) => Promise<ListResult<CustomerDocument>>;
|
|
51
|
+
getCustomerDoc: (customerId: number) => Promise<CustomerDocument>;
|
|
52
|
+
getCustomerOrders: (customerId: number, params?: Record<string, unknown>) => Promise<ListResult>;
|
|
53
|
+
getCustomerOrderDetail: (customerId: number, orderId: number) => Promise<unknown>;
|
|
54
|
+
getCustomerInvoices: (customerId: number, params?: Record<string, unknown>) => Promise<ListResult>;
|
|
55
|
+
getCustomerInvoiceDetail: (customerId: number, invoiceNo: number) => Promise<unknown>;
|
|
56
|
+
getCustomerQuotes: (customerId: number, params?: Record<string, unknown>) => Promise<ListResult>;
|
|
57
|
+
getCustomerQuoteDetail: (customerId: number, quoteNo: number) => Promise<unknown>;
|
|
58
|
+
getContacts: (params?: Record<string, unknown>) => Promise<ListResult>;
|
|
59
|
+
getShipToAddresses: (customerId: number) => Promise<ListResult>;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
interface P21PimActions {
|
|
63
|
+
getInvMastExt: (invMastUid: number) => Promise<unknown>;
|
|
64
|
+
listInvMastExt: (params?: Record<string, unknown>) => Promise<ListResult>;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
interface AgrSiteActions {
|
|
68
|
+
getSettings: (serviceName?: string) => Promise<ListResult>;
|
|
69
|
+
getMetaFiles: (params?: Record<string, unknown>) => Promise<ListResult>;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
interface AvalaraActions {
|
|
73
|
+
calculateTax: (data: Record<string, unknown>) => Promise<unknown>;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
interface PaymentsActions {
|
|
77
|
+
transactionSetup: (params: Record<string, unknown>) => Promise<TTransactionSetup | undefined>;
|
|
78
|
+
accountQuery: (params: Record<string, unknown>) => Promise<TAccountQuery | undefined>;
|
|
79
|
+
getSurcharge: (params: Record<string, unknown>) => Promise<TSurcharge | undefined>;
|
|
80
|
+
cardInfo: (params: Record<string, unknown>) => Promise<TCardInfo | undefined>;
|
|
81
|
+
billingUpdate: (params: Record<string, unknown>) => Promise<TBillingUpdate | undefined>;
|
|
82
|
+
validatePayment: (params: Record<string, unknown>) => Promise<TPaymentValidation | undefined>;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
interface UpsActions {
|
|
86
|
+
getRates: (params: Record<string, unknown>) => Promise<ListResult<TShippingMethod>>;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
interface LogisticsActions {
|
|
90
|
+
getFreightRates: (params: Record<string, unknown>) => Promise<ListResult>;
|
|
91
|
+
getShipVia: (params?: Record<string, unknown>) => Promise<ListResult>;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
interface NexusActions {
|
|
95
|
+
createBinTransfer: (data: Record<string, unknown>) => Promise<unknown>;
|
|
96
|
+
createReceiving: (data: Record<string, unknown>) => Promise<unknown>;
|
|
97
|
+
createTransfer: (data: Record<string, unknown>) => Promise<unknown>;
|
|
98
|
+
getPurchaseOrderReceipts: (params?: Record<string, unknown>) => Promise<ListResult>;
|
|
99
|
+
getTransferReceipts: (params?: Record<string, unknown>) => Promise<ListResult>;
|
|
100
|
+
getTransferShipping: (params?: Record<string, unknown>) => Promise<ListResult>;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
interface VmiActions {
|
|
104
|
+
getWarehouses: (params?: Record<string, unknown>) => Promise<ListResult>;
|
|
105
|
+
getWarehouseAvailability: (warehouseUid: number, params?: Record<string, unknown>) => Promise<ListResult>;
|
|
106
|
+
getDistributors: (params?: Record<string, unknown>) => Promise<ListResult>;
|
|
107
|
+
getProducts: (params?: Record<string, unknown>) => Promise<ListResult>;
|
|
108
|
+
getInventoryProfiles: (params?: Record<string, unknown>) => Promise<ListResult>;
|
|
109
|
+
getRestockHeaders: (params?: Record<string, unknown>) => Promise<ListResult>;
|
|
110
|
+
getSections: (params?: Record<string, unknown>) => Promise<ListResult>;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
interface P21CoreActions {
|
|
114
|
+
getAddresses: (params?: Record<string, unknown>) => Promise<ListResult>;
|
|
115
|
+
getCompanies: (params?: Record<string, unknown>) => Promise<ListResult>;
|
|
116
|
+
getCompany: (companyId: number) => Promise<unknown | undefined>;
|
|
117
|
+
getLocations: (params?: Record<string, unknown>) => Promise<ListResult>;
|
|
118
|
+
getPaymentTypes: (params?: Record<string, unknown>) => Promise<ListResult>;
|
|
119
|
+
getCashDrawers: (params?: Record<string, unknown>) => Promise<ListResult>;
|
|
120
|
+
getCodeP21: (params?: Record<string, unknown>) => Promise<ListResult>;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
interface P21ApisActions {
|
|
124
|
+
getCategories: (params?: Record<string, unknown>) => Promise<ListResult>;
|
|
125
|
+
getCategoryDefaults: (categoryId: number) => Promise<unknown | undefined>;
|
|
126
|
+
getCompanies: (params?: Record<string, unknown>) => Promise<ListResult>;
|
|
127
|
+
getUsers: (params?: Record<string, unknown>) => Promise<ListResult>;
|
|
128
|
+
getWebDisplayTypes: (params?: Record<string, unknown>) => Promise<ListResult>;
|
|
129
|
+
getWebDisplayTypeDefaults: (id?: number) => Promise<unknown | undefined>;
|
|
130
|
+
refreshContacts: (params?: Record<string, unknown>) => Promise<unknown | undefined>;
|
|
131
|
+
refreshCustomers: (params?: Record<string, unknown>) => Promise<unknown | undefined>;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
interface P21SismActions {
|
|
135
|
+
getRecentImports: (params?: Record<string, unknown>) => Promise<ListResult>;
|
|
136
|
+
getImport: (importId: string) => Promise<unknown | undefined>;
|
|
137
|
+
getImportLines: (importId: number, params?: Record<string, unknown>) => Promise<ListResult>;
|
|
138
|
+
getScheduledImports: (params?: Record<string, unknown>) => Promise<ListResult>;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
interface AgrWorkActions {
|
|
142
|
+
healthCheck: () => Promise<string | undefined>;
|
|
143
|
+
ping: () => Promise<string | undefined>;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
interface AgrInfoActions {
|
|
147
|
+
getContext: (params?: Record<string, unknown>) => Promise<ListResult>;
|
|
148
|
+
getRubrics: (params?: Record<string, unknown>) => Promise<ListResult>;
|
|
149
|
+
getMicroservices: (params?: Record<string, unknown>) => Promise<ListResult>;
|
|
150
|
+
generateAkasha: (data?: Record<string, unknown>) => Promise<unknown | undefined>;
|
|
151
|
+
generateJoomla: (data?: Record<string, unknown>) => Promise<unknown | undefined>;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
interface Basecamp2Actions {
|
|
155
|
+
getTodos: (params?: Record<string, unknown>) => Promise<ListResult>;
|
|
156
|
+
getTodo: (todoId: number) => Promise<unknown>;
|
|
157
|
+
getTodosSummary: (params?: Record<string, unknown>) => Promise<ListResult>;
|
|
158
|
+
getComments: (params?: Record<string, unknown>) => Promise<ListResult>;
|
|
159
|
+
getPeople: (params?: Record<string, unknown>) => Promise<ListResult>;
|
|
160
|
+
getProjects: (params?: Record<string, unknown>) => Promise<ListResult>;
|
|
161
|
+
getEvents: (params?: Record<string, unknown>) => Promise<ListResult>;
|
|
162
|
+
getMetrics: (params?: Record<string, unknown>) => Promise<ListResult>;
|
|
163
|
+
getTodolists: (params?: Record<string, unknown>) => Promise<ListResult>;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
interface BrandFolderActions {
|
|
167
|
+
getCategories: (params?: Record<string, unknown>) => Promise<ListResult>;
|
|
168
|
+
getCategory: (categoryId: string) => Promise<unknown>;
|
|
169
|
+
createFocus: (categoryId: string, data: Record<string, unknown>) => Promise<unknown | undefined>;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
interface GregorovichActions {
|
|
173
|
+
askChatGpt: (params: Record<string, unknown>) => Promise<unknown | undefined>;
|
|
174
|
+
getDocuments: (params?: Record<string, unknown>) => Promise<ListResult>;
|
|
175
|
+
createDocument: (data: Record<string, unknown>) => Promise<unknown | undefined>;
|
|
176
|
+
generateOllama: (data: Record<string, unknown>) => Promise<unknown | undefined>;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
interface SlackActions {
|
|
180
|
+
sendWebhook: (data: Record<string, unknown>) => Promise<unknown | undefined>;
|
|
181
|
+
getWebhooks: (params?: Record<string, unknown>) => Promise<ListResult>;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
interface SiteActionsConfig {
|
|
185
|
+
/**
|
|
186
|
+
* Cache key prefix shared across all services.
|
|
187
|
+
*
|
|
188
|
+
* Defaults to `"${siteId}:"` extracted from the API client.
|
|
189
|
+
* The site ID is the canonical cache namespace — most sites should
|
|
190
|
+
* NOT set this and let it derive automatically.
|
|
191
|
+
*
|
|
192
|
+
* Only override when migrating from a legacy prefix (e.g. `"ampro:"`
|
|
193
|
+
* instead of the site ID `"ampro-online"`).
|
|
194
|
+
*/
|
|
195
|
+
cachePrefix?: string;
|
|
196
|
+
/** Default edge cache TTL in seconds */
|
|
197
|
+
edgeCache?: EdgeCacheValue;
|
|
198
|
+
/** Default Redis TTL in seconds */
|
|
199
|
+
redisTtl?: number;
|
|
200
|
+
/** Long-lived edge cache TTL for rarely-changing data */
|
|
201
|
+
longEdgeCache?: EdgeCacheValue;
|
|
202
|
+
/** Long-lived Redis TTL for rarely-changing data */
|
|
203
|
+
longRedisTtl?: number;
|
|
204
|
+
/** Default contact ID for commerce operations. Falls back to process.env.DEFAULT_CONTACT_ID. */
|
|
205
|
+
defaultContactId?: string | number;
|
|
206
|
+
/** Default customer ID for pricing and commerce. Falls back to process.env.DEFAULT_CUSTOMER_ID. */
|
|
207
|
+
defaultCustomerId?: string | number;
|
|
208
|
+
/** Default company ID. Falls back to process.env.DEFAULT_COMPANY_ID. Not yet consumed by any factory. */
|
|
209
|
+
defaultCompanyId?: string | number;
|
|
210
|
+
/** UOM conversion function for commerce (e.g. "EA" → "EACH") */
|
|
211
|
+
convertUnitOfMeasure?: (uom: string) => string;
|
|
212
|
+
/** Pricing-specific overrides */
|
|
213
|
+
pricing?: {
|
|
214
|
+
taxRedisTtl?: number;
|
|
215
|
+
};
|
|
216
|
+
/** Items-specific overrides */
|
|
217
|
+
items?: {
|
|
218
|
+
sortChildren?: boolean;
|
|
219
|
+
sortByPrefix?: string;
|
|
220
|
+
};
|
|
221
|
+
/** Search-specific overrides */
|
|
222
|
+
search?: {
|
|
223
|
+
defaultSourceFields?: string;
|
|
224
|
+
};
|
|
225
|
+
/** Payments-specific overrides */
|
|
226
|
+
payments?: {
|
|
227
|
+
mode?: string;
|
|
228
|
+
};
|
|
229
|
+
/** Shipping config — fromAddress is required for shipping to work */
|
|
230
|
+
shipping?: {
|
|
231
|
+
fromAddress: ShippingAddress;
|
|
232
|
+
defaultServiceCodes?: string[];
|
|
233
|
+
};
|
|
234
|
+
/** VMI-specific overrides */
|
|
235
|
+
vmi?: {
|
|
236
|
+
shortRedisTtl?: number;
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
interface SiteActions {
|
|
240
|
+
pricing: PricingActions;
|
|
241
|
+
items: ItemActions;
|
|
242
|
+
commerce: CommerceActions;
|
|
243
|
+
search: SearchActions;
|
|
244
|
+
orders: OrderActions;
|
|
245
|
+
shipping: ShippingActions;
|
|
246
|
+
joomla: JoomlaActions;
|
|
247
|
+
legacy: LegacyActions;
|
|
248
|
+
customers: CustomersActions;
|
|
249
|
+
smartyStreets: SmartyStreetsActions;
|
|
250
|
+
p21Pim: P21PimActions;
|
|
251
|
+
agrSite: AgrSiteActions;
|
|
252
|
+
avalara: AvalaraActions;
|
|
253
|
+
payments: PaymentsActions;
|
|
254
|
+
ups: UpsActions;
|
|
255
|
+
logistics: LogisticsActions;
|
|
256
|
+
nexus: NexusActions;
|
|
257
|
+
vmi: VmiActions;
|
|
258
|
+
p21Core: P21CoreActions;
|
|
259
|
+
p21Apis: P21ApisActions;
|
|
260
|
+
p21Sism: P21SismActions;
|
|
261
|
+
agrWork: AgrWorkActions;
|
|
262
|
+
agrInfo: AgrInfoActions;
|
|
263
|
+
basecamp2: Basecamp2Actions;
|
|
264
|
+
brandFolder: BrandFolderActions;
|
|
265
|
+
gregorovich: GregorovichActions;
|
|
266
|
+
slack: SlackActions;
|
|
267
|
+
}
|
|
268
|
+
/**
|
|
269
|
+
* Creates a unified site actions object with all service factories.
|
|
270
|
+
*
|
|
271
|
+
* Shared config (cachePrefix, edgeCache, redisTtl, etc.) is passed to all
|
|
272
|
+
* services automatically. Per-service overrides are available for services
|
|
273
|
+
* with additional configuration.
|
|
274
|
+
*
|
|
275
|
+
* @example
|
|
276
|
+
* ```ts
|
|
277
|
+
* import { createSiteActions } from "@simpleapps-com/augur-server";
|
|
278
|
+
* import { getAugurClient } from "./augur-client";
|
|
279
|
+
*
|
|
280
|
+
* // defaultCustomerId/defaultContactId fall back to DEFAULT_CUSTOMER_ID/DEFAULT_CONTACT_ID
|
|
281
|
+
* // env vars when not provided — no need to set them if CDK injects them.
|
|
282
|
+
* export const actions = createSiteActions(getAugurClient(), {
|
|
283
|
+
* convertUnitOfMeasure: (uom) => uom === "EA" ? "EACH" : uom,
|
|
284
|
+
* items: { sortChildren: true },
|
|
285
|
+
* shipping: {
|
|
286
|
+
* fromAddress: { address1: "123 Main", city: "Provo", state: "UT", postalCode: "84606" },
|
|
287
|
+
* defaultServiceCodes: ["03"],
|
|
288
|
+
* },
|
|
289
|
+
* });
|
|
290
|
+
*
|
|
291
|
+
* // Usage:
|
|
292
|
+
* const price = await actions.pricing.getItemPrice("ITEM-1");
|
|
293
|
+
* const doc = await actions.items.getInvMastDoc("ITEM-1");
|
|
294
|
+
* const cart = await actions.commerce.cartHdrLookup({ userId: 123 });
|
|
295
|
+
* ```
|
|
296
|
+
*/
|
|
297
|
+
declare function createSiteActions<TApi extends object>(api: TApi, config?: SiteActionsConfig): SiteActions;
|
|
298
|
+
|
|
299
|
+
export { type SiteActions as S, type SiteActionsConfig as a, createSiteActions as c };
|
package/dist/site.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { S as SiteActions, a as SiteActionsConfig } from './site-GdPO-aW1.js';
|
|
2
2
|
import { AugurAuthCallbacks } from './auth.js';
|
|
3
3
|
import { NextAuthConfig } from 'next-auth';
|
|
4
4
|
import '@simpleapps-com/augur-core';
|
|
5
|
-
import '@simpleapps-com/augur-api';
|
|
6
5
|
import '@simpleapps-com/augur-utils';
|
|
7
|
-
import './smarty-streets-
|
|
6
|
+
import './smarty-streets-BnEIKoi8.js';
|
|
7
|
+
import '@simpleapps-com/augur-api';
|
|
8
8
|
|
|
9
9
|
/** Auth options forwarded to NextAuth when creating a server site. */
|
|
10
10
|
interface ServerSiteAuthConfig {
|
package/dist/site.js
CHANGED
package/dist/site.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/server-site.ts"],"sourcesContent":["import { createSiteActions } from \"./actions/site\";\nimport type { SiteActionsConfig, SiteActions } from \"./actions/site\";\nimport { createAuthConfig } from \"./auth\";\nimport type { AugurAuthCallbacks, AugurAuthClient } from \"./auth\";\nimport type { NextAuthConfig } from \"next-auth\";\nimport { registerSiteActions } from \"./server-site-registry\";\n\n/** Auth options forwarded to NextAuth when creating a server site. */\nexport interface ServerSiteAuthConfig {\n secret?: string;\n maxAge?: number;\n callbacks?: Partial<AugurAuthCallbacks>;\n debug?: boolean;\n}\n\n/** Configuration for {@link createServerSite}, combining action config and auth. */\nexport interface ServerSiteConfig extends SiteActionsConfig {\n auth?: ServerSiteAuthConfig;\n}\n\n/** The object returned by {@link createServerSite}. */\nexport interface ServerSite<TApi extends object> {\n client: TApi;\n actions: SiteActions;\n auth: NextAuthConfig | undefined;\n}\n\n/**\n * Create a server-side site instance that bundles the SDK client, server\n * actions, and (optional) NextAuth configuration.\n *\n * @example\n * ```ts\n * import { AugurApi } from \"@simpleapps-com/augur-api\";\n * import { createServerSite } from \"@simpleapps-com/augur-server\";\n *\n * const api = new AugurApi({ baseUrl: process.env.AUGUR_API_URL! });\n * export const site = createServerSite(api, {\n * defaultCustomerId: \"12345\",\n * auth: { secret: process.env.AUTH_SECRET },\n * });\n * ```\n */\nexport function createServerSite<TApi extends object>(\n client: TApi,\n config: ServerSiteConfig = {},\n): ServerSite<TApi> {\n const actions = createSiteActions(client, config);\n registerSiteActions(actions);\n\n const auth = config.auth\n ? createAuthConfig({\n augurClient: client as unknown as AugurAuthClient,\n defaultCustomerId: config.defaultCustomerId,\n defaultContactId: config.defaultContactId,\n ...config.auth,\n })\n : undefined;\n\n return { client, actions, auth };\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/server-site.ts"],"sourcesContent":["import { createSiteActions } from \"./actions/site\";\nimport type { SiteActionsConfig, SiteActions } from \"./actions/site\";\nimport { createAuthConfig } from \"./auth\";\nimport type { AugurAuthCallbacks, AugurAuthClient } from \"./auth\";\nimport type { NextAuthConfig } from \"next-auth\";\nimport { registerSiteActions } from \"./server-site-registry\";\n\n/** Auth options forwarded to NextAuth when creating a server site. */\nexport interface ServerSiteAuthConfig {\n secret?: string;\n maxAge?: number;\n callbacks?: Partial<AugurAuthCallbacks>;\n debug?: boolean;\n}\n\n/** Configuration for {@link createServerSite}, combining action config and auth. */\nexport interface ServerSiteConfig extends SiteActionsConfig {\n auth?: ServerSiteAuthConfig;\n}\n\n/** The object returned by {@link createServerSite}. */\nexport interface ServerSite<TApi extends object> {\n client: TApi;\n actions: SiteActions;\n auth: NextAuthConfig | undefined;\n}\n\n/**\n * Create a server-side site instance that bundles the SDK client, server\n * actions, and (optional) NextAuth configuration.\n *\n * @example\n * ```ts\n * import { AugurApi } from \"@simpleapps-com/augur-api\";\n * import { createServerSite } from \"@simpleapps-com/augur-server\";\n *\n * const api = new AugurApi({ baseUrl: process.env.AUGUR_API_URL! });\n * export const site = createServerSite(api, {\n * defaultCustomerId: \"12345\",\n * auth: { secret: process.env.AUTH_SECRET },\n * });\n * ```\n */\nexport function createServerSite<TApi extends object>(\n client: TApi,\n config: ServerSiteConfig = {},\n): ServerSite<TApi> {\n const actions = createSiteActions(client, config);\n registerSiteActions(actions);\n\n const auth = config.auth\n ? createAuthConfig({\n augurClient: client as unknown as AugurAuthClient,\n defaultCustomerId: config.defaultCustomerId,\n defaultContactId: config.defaultContactId,\n ...config.auth,\n })\n : undefined;\n\n return { client, actions, auth };\n}\n"],"mappings":";;;;;;;;;;AA2CO,SAAS,iBACd,QACA,SAA2B,CAAC,GACV;AAClB,QAAM,UAAU,kBAAkB,QAAQ,MAAM;AAChD,sBAAoB,OAAO;AAE3B,QAAM,OAAO,OAAO,OAChB,iBAAiB;AAAA,IACf,aAAa;AAAA,IACb,mBAAmB,OAAO;AAAA,IAC1B,kBAAkB,OAAO;AAAA,IACzB,GAAG,OAAO;AAAA,EACZ,CAAC,IACD;AAEJ,SAAO,EAAE,QAAQ,SAAS,KAAK;AACjC;","names":[]}
|