@scayle/storefront-core 7.68.0 → 7.69.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/CHANGELOG.md +12 -0
- package/dist/index.cjs +1 -43
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +1 -7
- package/dist/rpc/methods/checkout/checkout.cjs +1 -1
- package/dist/rpc/methods/checkout/checkout.mjs +1 -1
- package/dist/rpc/methods/products.cjs +4 -4
- package/dist/rpc/methods/products.mjs +4 -4
- package/dist/test/factories/index.cjs +16 -0
- package/dist/test/factories/index.d.ts +1 -0
- package/dist/test/factories/index.mjs +1 -0
- package/dist/utils/user.d.ts +3 -3
- package/package.json +14 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @scayle/storefront-core
|
|
2
2
|
|
|
3
|
+
## 7.69.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Move test factories to separate entry point. They are now available via `@scayle/storefront-core/dist/test/factories` (or `@scayle/storefront-core/test/factories` when `moduleResolution` is set to `Bundler`.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
**Dependencies**
|
|
12
|
+
|
|
13
|
+
- Updated dependency to @scayle/storefront-api@17.11.0
|
|
14
|
+
|
|
3
15
|
## 7.68.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
package/dist/index.cjs
CHANGED
|
@@ -6,13 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
var _exportNames = {
|
|
7
7
|
rpcMethods: true,
|
|
8
8
|
APISortOption: true,
|
|
9
|
-
APISortOrder: true
|
|
10
|
-
attributeGroupFactory: true,
|
|
11
|
-
advancedAttributeFactory: true,
|
|
12
|
-
categoryFactory: true,
|
|
13
|
-
productFactory: true,
|
|
14
|
-
priceFactory: true,
|
|
15
|
-
variantFactory: true
|
|
9
|
+
APISortOrder: true
|
|
16
10
|
};
|
|
17
11
|
Object.defineProperty(exports, "APISortOption", {
|
|
18
12
|
enumerable: true,
|
|
@@ -26,43 +20,7 @@ Object.defineProperty(exports, "APISortOrder", {
|
|
|
26
20
|
return _storefrontApi.APISortOrder;
|
|
27
21
|
}
|
|
28
22
|
});
|
|
29
|
-
Object.defineProperty(exports, "advancedAttributeFactory", {
|
|
30
|
-
enumerable: true,
|
|
31
|
-
get: function () {
|
|
32
|
-
return _storefrontApi.advancedAttributeFactory;
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
Object.defineProperty(exports, "attributeGroupFactory", {
|
|
36
|
-
enumerable: true,
|
|
37
|
-
get: function () {
|
|
38
|
-
return _storefrontApi.attributeGroupFactory;
|
|
39
|
-
}
|
|
40
|
-
});
|
|
41
|
-
Object.defineProperty(exports, "categoryFactory", {
|
|
42
|
-
enumerable: true,
|
|
43
|
-
get: function () {
|
|
44
|
-
return _storefrontApi.categoryFactory;
|
|
45
|
-
}
|
|
46
|
-
});
|
|
47
|
-
Object.defineProperty(exports, "priceFactory", {
|
|
48
|
-
enumerable: true,
|
|
49
|
-
get: function () {
|
|
50
|
-
return _storefrontApi.priceFactory;
|
|
51
|
-
}
|
|
52
|
-
});
|
|
53
|
-
Object.defineProperty(exports, "productFactory", {
|
|
54
|
-
enumerable: true,
|
|
55
|
-
get: function () {
|
|
56
|
-
return _storefrontApi.productFactory;
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
23
|
exports.rpcMethods = void 0;
|
|
60
|
-
Object.defineProperty(exports, "variantFactory", {
|
|
61
|
-
enumerable: true,
|
|
62
|
-
get: function () {
|
|
63
|
-
return _storefrontApi.variantFactory;
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
24
|
var rpcMethods = _interopRequireWildcard(require("./rpc/methods/index.cjs"));
|
|
67
25
|
exports.rpcMethods = rpcMethods;
|
|
68
26
|
var _errors = require("./errors/index.cjs");
|
package/dist/index.d.ts
CHANGED
|
@@ -17,4 +17,4 @@ export type RpcMethodName = Resolve<keyof RpcMethods>;
|
|
|
17
17
|
export type RpcMethod<N extends RpcMethodName> = RpcMethods[N];
|
|
18
18
|
export type RpcMethodParameters<N extends RpcMethodName> = Parameters<RpcMethod<N>>[0];
|
|
19
19
|
export type RpcMethodReturnType<N extends RpcMethodName> = ReturnType<RpcMethod<N>>;
|
|
20
|
-
export { APISortOption, APISortOrder, type ProductSortConfig,
|
|
20
|
+
export { APISortOption, APISortOrder, type ProductSortConfig, } from '@scayle/storefront-api';
|
package/dist/index.mjs
CHANGED
|
@@ -8,11 +8,5 @@ export * from "./helpers/index.mjs";
|
|
|
8
8
|
export * from "./types/index.mjs";
|
|
9
9
|
export {
|
|
10
10
|
APISortOption,
|
|
11
|
-
APISortOrder
|
|
12
|
-
attributeGroupFactory,
|
|
13
|
-
advancedAttributeFactory,
|
|
14
|
-
categoryFactory,
|
|
15
|
-
productFactory,
|
|
16
|
-
priceFactory,
|
|
17
|
-
variantFactory
|
|
11
|
+
APISortOrder
|
|
18
12
|
} from "@scayle/storefront-api";
|
|
@@ -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.69.0"}`).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.69.0"}`).setProtectedHeader({ alg: "HS256", typ: "JWT" }).sign(secret);
|
|
39
39
|
return {
|
|
40
40
|
accessToken: refreshedAccessToken,
|
|
41
41
|
checkoutJwt
|
|
@@ -11,7 +11,7 @@ var _cache = require("../../cache/index.cjs");
|
|
|
11
11
|
var _response = require("../../utils/response.cjs");
|
|
12
12
|
var _errors = require("../../errors/index.cjs");
|
|
13
13
|
const MAX_PER_PAGE = 100;
|
|
14
|
-
const
|
|
14
|
+
const sanitizeAttributesForSAPI = ({
|
|
15
15
|
attributes,
|
|
16
16
|
filterKeys,
|
|
17
17
|
includedFilters = []
|
|
@@ -142,14 +142,14 @@ const fetchAllFiltersForCategory = exports.fetchAllFiltersForCategory = async fu
|
|
|
142
142
|
campaignKey
|
|
143
143
|
}) {
|
|
144
144
|
const fetchAndMapFiltersToSlugs = async () => {
|
|
145
|
-
const
|
|
145
|
+
const filtersFromSAPI = await cached(sapiClient.filters.get)({
|
|
146
146
|
where: {
|
|
147
147
|
categoryId: category.id
|
|
148
148
|
},
|
|
149
149
|
campaignKey,
|
|
150
150
|
including: includedFilters
|
|
151
151
|
});
|
|
152
|
-
return mapFiltersToSlugs(
|
|
152
|
+
return mapFiltersToSlugs(filtersFromSAPI);
|
|
153
153
|
};
|
|
154
154
|
return await cached(fetchAndMapFiltersToSlugs, {
|
|
155
155
|
ttl: 4 * 60 * 60,
|
|
@@ -168,7 +168,7 @@ async function getSanitizedAttributes(context, categoryId, attributes, includedF
|
|
|
168
168
|
return response;
|
|
169
169
|
}
|
|
170
170
|
const allFiltersForCategory = await (0, _response.unwrap)(response);
|
|
171
|
-
return
|
|
171
|
+
return sanitizeAttributesForSAPI({
|
|
172
172
|
attributes: attributes || [],
|
|
173
173
|
filterKeys: allFiltersForCategory,
|
|
174
174
|
includedFilters
|
|
@@ -4,7 +4,7 @@ import { MINUTE } from "../../cache/index.mjs";
|
|
|
4
4
|
import { unwrap } from "../../utils/response.mjs";
|
|
5
5
|
import { ErrorResponse } from "../../errors/index.mjs";
|
|
6
6
|
const MAX_PER_PAGE = 100;
|
|
7
|
-
const
|
|
7
|
+
const sanitizeAttributesForSAPI = ({
|
|
8
8
|
attributes,
|
|
9
9
|
filterKeys,
|
|
10
10
|
includedFilters = []
|
|
@@ -113,12 +113,12 @@ export const getProductsCount = async function getProductsCount2(params, context
|
|
|
113
113
|
};
|
|
114
114
|
export const fetchAllFiltersForCategory = async function fetchAllFiltersForCategory2({ includedFilters = [], category }, { cached, sapiClient, campaignKey }) {
|
|
115
115
|
const fetchAndMapFiltersToSlugs = async () => {
|
|
116
|
-
const
|
|
116
|
+
const filtersFromSAPI = await cached(sapiClient.filters.get)({
|
|
117
117
|
where: { categoryId: category.id },
|
|
118
118
|
campaignKey,
|
|
119
119
|
including: includedFilters
|
|
120
120
|
});
|
|
121
|
-
return mapFiltersToSlugs(
|
|
121
|
+
return mapFiltersToSlugs(filtersFromSAPI);
|
|
122
122
|
};
|
|
123
123
|
return await cached(fetchAndMapFiltersToSlugs, {
|
|
124
124
|
ttl: 4 * 60 * 60,
|
|
@@ -138,7 +138,7 @@ async function getSanitizedAttributes(context, categoryId, attributes, includedF
|
|
|
138
138
|
return response;
|
|
139
139
|
}
|
|
140
140
|
const allFiltersForCategory = await unwrap(response);
|
|
141
|
-
return
|
|
141
|
+
return sanitizeAttributesForSAPI({
|
|
142
142
|
attributes: attributes || [],
|
|
143
143
|
filterKeys: allFiltersForCategory,
|
|
144
144
|
includedFilters
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _factories = require("@scayle/storefront-api/dist/test/factories");
|
|
7
|
+
Object.keys(_factories).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _factories[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _factories[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@scayle/storefront-api/dist/test/factories';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "@scayle/storefront-api/dist/test/factories";
|
package/dist/utils/user.d.ts
CHANGED
|
@@ -4,13 +4,13 @@ export declare const mergeBaskets: (fromBasketKey: string, toBasketKey: string,
|
|
|
4
4
|
}, context: RpcContext) => Promise<{
|
|
5
5
|
type: "failure";
|
|
6
6
|
statusCode: number;
|
|
7
|
-
basket: import("@scayle/storefront-api").BasketResponseData<import("@scayle/storefront-api").
|
|
7
|
+
basket: import("@scayle/storefront-api").BasketResponseData<import("@scayle/storefront-api/dist/shared/storefront-api.02fa829c").P, import("@scayle/storefront-api/dist/shared/storefront-api.02fa829c").a>;
|
|
8
8
|
} | {
|
|
9
9
|
readonly type: "success";
|
|
10
|
-
readonly basket: import("@scayle/storefront-api").BasketResponseData<import("@scayle/storefront-api").
|
|
10
|
+
readonly basket: import("@scayle/storefront-api").BasketResponseData<import("@scayle/storefront-api/dist/shared/storefront-api.02fa829c").P, import("@scayle/storefront-api/dist/shared/storefront-api.02fa829c").a>;
|
|
11
11
|
} | {
|
|
12
12
|
readonly type: "failure";
|
|
13
|
-
readonly basket: import("@scayle/storefront-api").BasketResponseData<import("@scayle/storefront-api").
|
|
13
|
+
readonly basket: import("@scayle/storefront-api").BasketResponseData<import("@scayle/storefront-api/dist/shared/storefront-api.02fa829c").P, import("@scayle/storefront-api/dist/shared/storefront-api.02fa829c").a>;
|
|
14
14
|
readonly errors: import("@scayle/storefront-api").AddOrUpdateItemError[];
|
|
15
15
|
} | undefined>;
|
|
16
16
|
export declare const mergeWishlists: (fromWishlistKey: string, toWishlistKey: string, withOptions: BasketWithOptions, context: RpcContext) => Promise<void>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scayle/storefront-core",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.69.0",
|
|
4
4
|
"description": "Collection of essential utilities to work with the Storefront API",
|
|
5
5
|
"author": "SCAYLE Commerce Engine",
|
|
6
6
|
"license": "MIT",
|
|
@@ -24,6 +24,18 @@
|
|
|
24
24
|
"require": "./dist/server.cjs",
|
|
25
25
|
"default": "./dist/server.cjs"
|
|
26
26
|
},
|
|
27
|
+
"./dist/test/factories": {
|
|
28
|
+
"types": "./dist/test/factories/index.d.ts",
|
|
29
|
+
"import": "./dist/test/factories/index.mjs",
|
|
30
|
+
"require": "./dist/test/factories/index.cjs",
|
|
31
|
+
"default": "./dist/test/factories/index.cjs"
|
|
32
|
+
},
|
|
33
|
+
"./test/factories": {
|
|
34
|
+
"types": "./dist/test/factories/index.d.ts",
|
|
35
|
+
"import": "./dist/test/factories/index.mjs",
|
|
36
|
+
"require": "./dist/test/factories/index.cjs",
|
|
37
|
+
"default": "./dist/test/factories/index.cjs"
|
|
38
|
+
},
|
|
27
39
|
"./dist/*": {
|
|
28
40
|
"types": "./dist/*.d.ts",
|
|
29
41
|
"import": "./dist/*.mjs",
|
|
@@ -59,7 +71,7 @@
|
|
|
59
71
|
"test:ci": "vitest --run --passWithNoTests --coverage --reporter=default --reporter=junit --outputFile=./junit.xml"
|
|
60
72
|
},
|
|
61
73
|
"dependencies": {
|
|
62
|
-
"@scayle/storefront-api": "17.
|
|
74
|
+
"@scayle/storefront-api": "17.11.0",
|
|
63
75
|
"crypto-js": "^4.2.0",
|
|
64
76
|
"hookable": "^5.5.3",
|
|
65
77
|
"jose": "^5.6.3",
|