@simpleapps-com/augur-server 2026.11.10 → 2026.11.12
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 -2
- package/README.md +45 -6
- package/dist/actions/commerce.d.ts.map +1 -1
- package/dist/actions/customers.d.ts +7 -2
- package/dist/actions/customers.d.ts.map +1 -1
- package/dist/actions/joomla.d.ts +3 -2
- package/dist/actions/joomla.d.ts.map +1 -1
- package/dist/actions/pricing.d.ts.map +1 -1
- package/dist/actions/require-customer.d.ts +9 -0
- package/dist/actions/require-customer.d.ts.map +1 -0
- package/dist/address-id.d.ts +12 -0
- package/dist/address-id.d.ts.map +1 -0
- package/dist/api-handler.d.ts.map +1 -1
- package/dist/api.js +7 -5
- package/dist/api.js.map +1 -1
- package/dist/auth.d.ts +44 -6
- package/dist/auth.d.ts.map +1 -1
- package/dist/auth.js +4 -3
- package/dist/{chunk-4KPTIVYO.js → chunk-5DBFTSWY.js} +11 -14
- package/dist/chunk-5DBFTSWY.js.map +1 -0
- package/dist/{chunk-AYHUM7SG.js → chunk-GKT4MAWC.js} +46 -64
- package/dist/chunk-GKT4MAWC.js.map +1 -0
- package/dist/{chunk-BG4G5QUQ.js → chunk-HGJF667G.js} +8 -1
- package/dist/{chunk-BG4G5QUQ.js.map → chunk-HGJF667G.js.map} +1 -1
- package/dist/chunk-ILXNFJVM.js +86 -0
- package/dist/chunk-ILXNFJVM.js.map +1 -0
- package/dist/{chunk-JIYVQWXK.js → chunk-IM7FDRER.js} +1 -1
- package/dist/chunk-IM7FDRER.js.map +1 -0
- package/dist/chunk-M35O5JDZ.js +257 -0
- package/dist/chunk-M35O5JDZ.js.map +1 -0
- package/dist/{chunk-G5P4IDK7.js → chunk-Y54RGILF.js} +35 -3
- package/dist/chunk-Y54RGILF.js.map +1 -0
- package/dist/hooks.js +4 -3
- package/dist/hooks.js.map +1 -1
- package/dist/index.js +6 -5
- package/dist/index.js.map +1 -1
- package/dist/query-action.d.ts +2 -8
- package/dist/query-action.d.ts.map +1 -1
- package/dist/query-action.js +4 -3
- package/dist/recaptcha.d.ts.map +1 -1
- package/dist/rules.d.ts +17 -17
- package/dist/rules.d.ts.map +1 -1
- package/dist/sdk-client-store.d.ts +4 -3
- package/dist/sdk-client-store.d.ts.map +1 -1
- package/dist/server-site.d.ts +6 -8
- package/dist/server-site.d.ts.map +1 -1
- package/dist/session-rules.d.ts +118 -0
- package/dist/session-rules.d.ts.map +1 -0
- package/dist/site.js +14 -9
- package/dist/site.js.map +1 -1
- package/dist/sitemap.js +2 -2
- package/dist/testing.js +4 -4
- package/llms.txt +4 -2
- package/next-auth.d.ts +2 -2
- package/package.json +6 -5
- package/dist/chunk-4KPTIVYO.js.map +0 -1
- package/dist/chunk-AUIC4HS2.js +0 -174
- package/dist/chunk-AUIC4HS2.js.map +0 -1
- package/dist/chunk-AYHUM7SG.js.map +0 -1
- package/dist/chunk-G5P4IDK7.js.map +0 -1
- package/dist/chunk-JIYVQWXK.js.map +0 -1
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
decimal
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-IM7FDRER.js";
|
|
4
4
|
import {
|
|
5
5
|
cacheTtlOf,
|
|
6
6
|
circuitCheck,
|
|
7
7
|
configuredModeOf,
|
|
8
|
+
customerRefusalOf,
|
|
8
9
|
docUidOf,
|
|
9
10
|
envOf,
|
|
10
11
|
hasDocKey,
|
|
@@ -13,7 +14,6 @@ import {
|
|
|
13
14
|
minutes,
|
|
14
15
|
nextCursorOf,
|
|
15
16
|
opensAt,
|
|
16
|
-
positiveOrZero,
|
|
17
17
|
recordFailureOf,
|
|
18
18
|
recordSuccessOf,
|
|
19
19
|
registerSdkCallWrapper,
|
|
@@ -23,11 +23,11 @@ import {
|
|
|
23
23
|
shouldCache,
|
|
24
24
|
takesItemId,
|
|
25
25
|
ttlFor
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-5DBFTSWY.js";
|
|
27
27
|
import {
|
|
28
28
|
isBlank,
|
|
29
29
|
upperAscii
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-HGJF667G.js";
|
|
31
31
|
|
|
32
32
|
// src/environment.ts
|
|
33
33
|
function getEnvironment() {
|
|
@@ -414,9 +414,18 @@ function wrapCaches(isRead, hasTtl, ttl) {
|
|
|
414
414
|
|
|
415
415
|
// src/actions/pricing.ts
|
|
416
416
|
import { hours, minutes as minutes3 } from "@simpleapps-com/augur-utils";
|
|
417
|
-
|
|
418
|
-
|
|
417
|
+
|
|
418
|
+
// src/actions/require-customer.ts
|
|
419
|
+
import { resolveAddressId } from "@simpleapps-com/augur-utils";
|
|
420
|
+
function requireCustomer(refusal, ...candidates) {
|
|
421
|
+
const customerId = resolveAddressId(...candidates);
|
|
422
|
+
const reason = customerRefusalOf(customerId, refusal);
|
|
423
|
+
if (reason !== null) throw new Error(reason);
|
|
424
|
+
return customerId;
|
|
419
425
|
}
|
|
426
|
+
|
|
427
|
+
// src/actions/pricing.ts
|
|
428
|
+
var NO_CUSTOMER = "A price needs a customer: no usable customerId was given and there is no defaultCustomerId";
|
|
420
429
|
function createPricingActions(api, config = {}) {
|
|
421
430
|
const {
|
|
422
431
|
defaultCustomerId,
|
|
@@ -426,7 +435,7 @@ function createPricingActions(api, config = {}) {
|
|
|
426
435
|
taxRedisTtl = minutes3(30)
|
|
427
436
|
} = config;
|
|
428
437
|
async function getItemPrice(itemId, customerId, quantity = 1, unitOfMeasure) {
|
|
429
|
-
const custId =
|
|
438
|
+
const custId = requireCustomer(NO_CUSTOMER, customerId, defaultCustomerId);
|
|
430
439
|
const params = {
|
|
431
440
|
customerId: custId,
|
|
432
441
|
itemId,
|
|
@@ -446,14 +455,15 @@ function createPricingActions(api, config = {}) {
|
|
|
446
455
|
);
|
|
447
456
|
}
|
|
448
457
|
async function batchGetItemPrices(itemIds, customerId, quantity = 1, unitOfMeasure) {
|
|
458
|
+
const custId = requireCustomer(NO_CUSTOMER, customerId, defaultCustomerId);
|
|
449
459
|
return batchFetch(
|
|
450
460
|
itemIds,
|
|
451
|
-
(id) => getItemPrice(id,
|
|
461
|
+
(id) => getItemPrice(id, custId, quantity, unitOfMeasure),
|
|
452
462
|
(id) => id
|
|
453
463
|
);
|
|
454
464
|
}
|
|
455
465
|
async function getTaxEstimate(customerId, postalCode, items = []) {
|
|
456
|
-
const custId =
|
|
466
|
+
const custId = requireCustomer(NO_CUSTOMER, customerId, defaultCustomerId);
|
|
457
467
|
const params = {
|
|
458
468
|
customerId: custId,
|
|
459
469
|
postalCode: postalCode ?? "",
|
|
@@ -916,12 +926,13 @@ function createItemActions(api, config = {}) {
|
|
|
916
926
|
}
|
|
917
927
|
|
|
918
928
|
// src/actions/commerce.ts
|
|
929
|
+
import { resolveAddressId as resolveAddressId2 } from "@simpleapps-com/augur-utils";
|
|
919
930
|
function createCommerceActions(api, config = {}) {
|
|
920
931
|
const { defaultContactId, defaultCustomerId, convertUnitOfMeasure } = config;
|
|
921
932
|
async function cartHdrLookup(params) {
|
|
922
933
|
const contactId = params.contactId ?? defaultContactId;
|
|
923
|
-
const customerId = params.customerId
|
|
924
|
-
if (!cartIdsPresent(contactId != null, customerId
|
|
934
|
+
const customerId = resolveAddressId2(params.customerId, defaultCustomerId);
|
|
935
|
+
if (!cartIdsPresent(contactId != null, customerId !== null)) {
|
|
925
936
|
throw new Error("cartHdrLookup requires contactId and customerId (param or config default)");
|
|
926
937
|
}
|
|
927
938
|
const userId = Number(params.userId);
|
|
@@ -931,7 +942,8 @@ function createCommerceActions(api, config = {}) {
|
|
|
931
942
|
userId: cartUserId(userId, Number.isNaN(userId)),
|
|
932
943
|
cartToken: params.cartToken,
|
|
933
944
|
contactId: Number(contactId),
|
|
934
|
-
|
|
945
|
+
// Not null: cartIdsPresent refused the lookup above without one.
|
|
946
|
+
customerId
|
|
935
947
|
});
|
|
936
948
|
return response.data;
|
|
937
949
|
}
|
|
@@ -1149,6 +1161,7 @@ function createShippingActions(api, config) {
|
|
|
1149
1161
|
}
|
|
1150
1162
|
|
|
1151
1163
|
// src/actions/joomla.ts
|
|
1164
|
+
import { addressIdOf } from "@simpleapps-com/augur-utils";
|
|
1152
1165
|
function normalizedProfile(answer) {
|
|
1153
1166
|
const user = answer.data;
|
|
1154
1167
|
if (!user) throw new Error("User not found");
|
|
@@ -1156,7 +1169,7 @@ function normalizedProfile(answer) {
|
|
|
1156
1169
|
id: profileId(user.id),
|
|
1157
1170
|
name: user.name,
|
|
1158
1171
|
email: user.email,
|
|
1159
|
-
customerId: user.customerId,
|
|
1172
|
+
customerId: addressIdOf(user.customerId),
|
|
1160
1173
|
permissions: nonEmptyTitlesFrom(
|
|
1161
1174
|
user.groups.map((group) => group.title),
|
|
1162
1175
|
0
|
|
@@ -1302,6 +1315,7 @@ function createLegacyActions(api, config = {}) {
|
|
|
1302
1315
|
}
|
|
1303
1316
|
|
|
1304
1317
|
// src/actions/customers.ts
|
|
1318
|
+
var NO_CUSTOMER2 = "A customer's records need a customer: the customerId given is not a usable P21 customer id";
|
|
1305
1319
|
function createCustomersActions(api, config = {}) {
|
|
1306
1320
|
async function customerLookup(params) {
|
|
1307
1321
|
return specRead(
|
|
@@ -1315,84 +1329,52 @@ function createCustomersActions(api, config = {}) {
|
|
|
1315
1329
|
);
|
|
1316
1330
|
}
|
|
1317
1331
|
async function getCustomerDoc(customerId) {
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
customerDocRead(),
|
|
1321
|
-
config,
|
|
1322
|
-
[customerId],
|
|
1323
|
-
{},
|
|
1324
|
-
[customerId],
|
|
1325
|
-
asData
|
|
1326
|
-
);
|
|
1332
|
+
const id = requireCustomer(NO_CUSTOMER2, customerId);
|
|
1333
|
+
return specRead(api, customerDocRead(), config, [id], {}, [id], asData);
|
|
1327
1334
|
}
|
|
1328
1335
|
async function getCustomerOrders(customerId, params) {
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
customerOrdersRead(),
|
|
1332
|
-
config,
|
|
1333
|
-
[customerId],
|
|
1334
|
-
{ ...params },
|
|
1335
|
-
[customerId, params],
|
|
1336
|
-
asList
|
|
1337
|
-
);
|
|
1336
|
+
const id = requireCustomer(NO_CUSTOMER2, customerId);
|
|
1337
|
+
return specRead(api, customerOrdersRead(), config, [id], { ...params }, [id, params], asList);
|
|
1338
1338
|
}
|
|
1339
1339
|
async function getCustomerOrderDetail(customerId, orderId) {
|
|
1340
|
+
const id = requireCustomer(NO_CUSTOMER2, customerId);
|
|
1340
1341
|
return specRead(
|
|
1341
1342
|
api,
|
|
1342
1343
|
customerOrderRead(),
|
|
1343
1344
|
config,
|
|
1344
|
-
[
|
|
1345
|
+
[id, String(orderId)],
|
|
1345
1346
|
{},
|
|
1346
|
-
[
|
|
1347
|
+
[id, orderId],
|
|
1347
1348
|
asData
|
|
1348
1349
|
);
|
|
1349
1350
|
}
|
|
1350
1351
|
async function getCustomerInvoices(customerId, params) {
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
customerInvoicesRead(),
|
|
1354
|
-
config,
|
|
1355
|
-
[customerId],
|
|
1356
|
-
{ ...params },
|
|
1357
|
-
[customerId, params],
|
|
1358
|
-
asList
|
|
1359
|
-
);
|
|
1352
|
+
const id = requireCustomer(NO_CUSTOMER2, customerId);
|
|
1353
|
+
return specRead(api, customerInvoicesRead(), config, [id], { ...params }, [id, params], asList);
|
|
1360
1354
|
}
|
|
1361
1355
|
async function getCustomerInvoiceDetail(customerId, invoiceNo) {
|
|
1356
|
+
const id = requireCustomer(NO_CUSTOMER2, customerId);
|
|
1362
1357
|
return specRead(
|
|
1363
1358
|
api,
|
|
1364
1359
|
customerInvoiceRead(),
|
|
1365
1360
|
config,
|
|
1366
|
-
[
|
|
1361
|
+
[id, invoiceNo],
|
|
1367
1362
|
{},
|
|
1368
|
-
[
|
|
1363
|
+
[id, invoiceNo],
|
|
1369
1364
|
asData
|
|
1370
1365
|
);
|
|
1371
1366
|
}
|
|
1372
1367
|
async function getCustomerQuotes(customerId, params) {
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
customerQuotesRead(),
|
|
1376
|
-
config,
|
|
1377
|
-
[customerId],
|
|
1378
|
-
{ ...params },
|
|
1379
|
-
[customerId, params],
|
|
1380
|
-
asList
|
|
1381
|
-
);
|
|
1368
|
+
const id = requireCustomer(NO_CUSTOMER2, customerId);
|
|
1369
|
+
return specRead(api, customerQuotesRead(), config, [id], { ...params }, [id, params], asList);
|
|
1382
1370
|
}
|
|
1383
1371
|
async function getCustomerQuoteDetail(customerId, quoteNo) {
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
customerQuoteRead(),
|
|
1387
|
-
config,
|
|
1388
|
-
[customerId, quoteNo],
|
|
1389
|
-
{},
|
|
1390
|
-
[customerId, quoteNo],
|
|
1391
|
-
asData
|
|
1392
|
-
);
|
|
1372
|
+
const id = requireCustomer(NO_CUSTOMER2, customerId);
|
|
1373
|
+
return specRead(api, customerQuoteRead(), config, [id, quoteNo], {}, [id, quoteNo], asData);
|
|
1393
1374
|
}
|
|
1394
1375
|
async function getShipToAddresses(customerId) {
|
|
1395
|
-
|
|
1376
|
+
const id = requireCustomer(NO_CUSTOMER2, customerId);
|
|
1377
|
+
return specRead(api, shipToRead(), config, [id], {}, [id], asAllRows);
|
|
1396
1378
|
}
|
|
1397
1379
|
return {
|
|
1398
1380
|
customerLookup,
|
|
@@ -2509,4 +2491,4 @@ export {
|
|
|
2509
2491
|
getSiteActions,
|
|
2510
2492
|
clearSiteActions2 as clearSiteActions
|
|
2511
2493
|
};
|
|
2512
|
-
//# sourceMappingURL=chunk-
|
|
2494
|
+
//# sourceMappingURL=chunk-GKT4MAWC.js.map
|