@scayle/storefront-core 7.65.11 → 7.66.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/CHANGELOG.md +20 -0
- package/dist/rpc/methods/checkout/checkout.cjs +1 -1
- package/dist/rpc/methods/checkout/checkout.mjs +1 -1
- package/dist/rpc/methods/navigationTrees.cjs +24 -1
- package/dist/rpc/methods/navigationTrees.d.ts +3 -1
- package/dist/rpc/methods/navigationTrees.mjs +23 -0
- package/dist/types/bapi/navigation.d.ts +3 -0
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @scayle/storefront-core
|
|
2
2
|
|
|
3
|
+
## 7.66.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
**Dependencies**
|
|
8
|
+
|
|
9
|
+
- Updated dependency to @scayle/storefront-api@17.9.3
|
|
10
|
+
|
|
11
|
+
## 7.66.0
|
|
12
|
+
|
|
13
|
+
### Minor Changes
|
|
14
|
+
|
|
15
|
+
- Add `fetchNavigationTreeByName` rpc.
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
**Dependencies**
|
|
20
|
+
|
|
21
|
+
- Updated dependency to @scayle/storefront-api@17.9.2
|
|
22
|
+
|
|
3
23
|
## 7.65.11
|
|
4
24
|
|
|
5
25
|
### Patch Changes
|
|
@@ -37,7 +37,7 @@ const getCheckoutToken = exports.getCheckoutToken = async function getCheckoutTo
|
|
|
37
37
|
carrier,
|
|
38
38
|
basketId: context.basketKey,
|
|
39
39
|
campaignKey: context.campaignKey
|
|
40
|
-
}).setIssuedAt(now).setNotBefore(now).setExpirationTime("1h").setIssuer(`${"@scayle/storefront-core"}@${"7.
|
|
40
|
+
}).setIssuedAt(now).setNotBefore(now).setExpirationTime("1h").setIssuer(`${"@scayle/storefront-core"}@${"7.66.1"}`).setProtectedHeader({
|
|
41
41
|
alg: "HS256",
|
|
42
42
|
typ: "JWT"
|
|
43
43
|
}).sign(secret);
|
|
@@ -35,7 +35,7 @@ export const getCheckoutToken = async function getCheckoutToken2(jwtPayload = {}
|
|
|
35
35
|
carrier,
|
|
36
36
|
basketId: context.basketKey,
|
|
37
37
|
campaignKey: context.campaignKey
|
|
38
|
-
}).setIssuedAt(now).setNotBefore(now).setExpirationTime("1h").setIssuer(`${"@scayle/storefront-core"}@${"7.
|
|
38
|
+
}).setIssuedAt(now).setNotBefore(now).setExpirationTime("1h").setIssuer(`${"@scayle/storefront-core"}@${"7.66.1"}`).setProtectedHeader({ alg: "HS256", typ: "JWT" }).sign(secret);
|
|
39
39
|
return {
|
|
40
40
|
accessToken: refreshedAccessToken,
|
|
41
41
|
checkoutJwt
|
|
@@ -3,7 +3,9 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.fetchNavigationTreeById = exports.fetchAllNavigationTrees = void 0;
|
|
6
|
+
exports.fetchNavigationTreeByName = exports.fetchNavigationTreeById = exports.fetchAllNavigationTrees = void 0;
|
|
7
|
+
var _errors = require("../../errors/index.cjs");
|
|
8
|
+
var _constants = require("../../constants/index.cjs");
|
|
7
9
|
const fetchAllNavigationTrees = exports.fetchAllNavigationTrees = async function fetchAllNavigationTrees2({
|
|
8
10
|
params
|
|
9
11
|
}, {
|
|
@@ -28,4 +30,25 @@ const fetchNavigationTreeById = exports.fetchNavigationTreeById = async function
|
|
|
28
30
|
return await cached(navigation.getById, {
|
|
29
31
|
cacheKeyPrefix: `getById-navigation-trees-${treeId}`
|
|
30
32
|
})(treeId, params);
|
|
33
|
+
};
|
|
34
|
+
const fetchNavigationTreeByName = exports.fetchNavigationTreeByName = async function fetchNavigationTreeByName2({
|
|
35
|
+
treeName,
|
|
36
|
+
params
|
|
37
|
+
}, {
|
|
38
|
+
bapiClient: {
|
|
39
|
+
navigation
|
|
40
|
+
},
|
|
41
|
+
cached
|
|
42
|
+
}) {
|
|
43
|
+
return await cached(async (name, params2) => {
|
|
44
|
+
const navigationTree = (await navigation.getAll(params2)).find(nav => nav.name === treeName);
|
|
45
|
+
if (!navigationTree) {
|
|
46
|
+
return new _errors.ErrorResponse(_constants.HttpStatusCode.NOT_FOUND, `No navigation tree with name "${treeName}" found.`, _constants.HttpStatusMessage.NOT_FOUND, {
|
|
47
|
+
name
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
return navigationTree;
|
|
51
|
+
}, {
|
|
52
|
+
cacheKeyPrefix: `getByName-navigation-trees-${treeName}`
|
|
53
|
+
})(treeName, params);
|
|
31
54
|
};
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { NavigationAllEndpointResponseData, NavigationTree } from '@scayle/storefront-api';
|
|
2
|
-
import type { FetchNavigationTreeByIdParams, FetchNavigationTreesParams } from '../../types';
|
|
2
|
+
import type { FetchNavigationTreeByIdParams, FetchNavigationTreeByNameParams, FetchNavigationTreesParams } from '../../types';
|
|
3
|
+
import { ErrorResponse } from '../../errors';
|
|
3
4
|
export declare const fetchAllNavigationTrees: ({ params }: FetchNavigationTreesParams, { bapiClient: { navigation }, cached }: import("../../types").RpcContext) => Promise<NavigationAllEndpointResponseData>;
|
|
4
5
|
export declare const fetchNavigationTreeById: ({ treeId, params }: FetchNavigationTreeByIdParams, { bapiClient: { navigation }, cached }: import("../../types").RpcContext) => Promise<NavigationTree>;
|
|
6
|
+
export declare const fetchNavigationTreeByName: ({ treeName, params }: FetchNavigationTreeByNameParams, { bapiClient: { navigation }, cached }: import("../../types").RpcContext) => Promise<ErrorResponse | NavigationTree>;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { ErrorResponse } from "../../errors/index.mjs";
|
|
2
|
+
import { HttpStatusCode, HttpStatusMessage } from "../../constants/index.mjs";
|
|
1
3
|
export const fetchAllNavigationTrees = async function fetchAllNavigationTrees2({ params }, { bapiClient: { navigation }, cached }) {
|
|
2
4
|
return await cached(navigation.getAll, {
|
|
3
5
|
cacheKeyPrefix: "getAll-navigation-trees"
|
|
@@ -8,3 +10,24 @@ export const fetchNavigationTreeById = async function fetchNavigationTreeById2({
|
|
|
8
10
|
cacheKeyPrefix: `getById-navigation-trees-${treeId}`
|
|
9
11
|
})(treeId, params);
|
|
10
12
|
};
|
|
13
|
+
export const fetchNavigationTreeByName = async function fetchNavigationTreeByName2({ treeName, params }, { bapiClient: { navigation }, cached }) {
|
|
14
|
+
return await cached(
|
|
15
|
+
async (name, params2) => {
|
|
16
|
+
const navigationTree = (await navigation.getAll(params2)).find(
|
|
17
|
+
(nav) => nav.name === treeName
|
|
18
|
+
);
|
|
19
|
+
if (!navigationTree) {
|
|
20
|
+
return new ErrorResponse(
|
|
21
|
+
HttpStatusCode.NOT_FOUND,
|
|
22
|
+
`No navigation tree with name "${treeName}" found.`,
|
|
23
|
+
HttpStatusMessage.NOT_FOUND,
|
|
24
|
+
{ name }
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
return navigationTree;
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
cacheKeyPrefix: `getByName-navigation-trees-${treeName}`
|
|
31
|
+
}
|
|
32
|
+
)(treeName, params);
|
|
33
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scayle/storefront-core",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.66.1",
|
|
4
4
|
"description": "Collection of essential utilities to work with the Storefront API",
|
|
5
5
|
"author": "SCAYLE Commerce Engine",
|
|
6
6
|
"license": "MIT",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"test:ci": "vitest --run --passWithNoTests --coverage --reporter=default --reporter=junit --outputFile=./junit.xml"
|
|
60
60
|
},
|
|
61
61
|
"dependencies": {
|
|
62
|
-
"@scayle/storefront-api": "17.9.
|
|
62
|
+
"@scayle/storefront-api": "17.9.3",
|
|
63
63
|
"crypto-js": "^4.2.0",
|
|
64
64
|
"hookable": "^5.5.3",
|
|
65
65
|
"jose": "^5.6.3",
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
"devDependencies": {
|
|
72
72
|
"@scayle/eslint-config-storefront": "4.3.2",
|
|
73
73
|
"@types/crypto-js": "4.2.2",
|
|
74
|
-
"@types/node": "22.8.
|
|
74
|
+
"@types/node": "22.8.5",
|
|
75
75
|
"@types/webpack-env": "1.18.5",
|
|
76
76
|
"@vitest/coverage-v8": "2.1.4",
|
|
77
77
|
"dprint": "0.47.5",
|