@scayle/storefront-core 7.45.0 → 7.46.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
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.getProductsCount = exports.getProductsByIds = exports.getProductsByCategory = exports.getProductById = exports.getFilters = exports.fetchAllFiltersForCategory = void 0;
|
|
6
|
+
exports.getProductsCount = exports.getProductsByReferenceKeys = exports.getProductsByIds = exports.getProductsByCategory = exports.getProductById = exports.getFilters = exports.fetchAllFiltersForCategory = void 0;
|
|
7
7
|
var _helpers = require("../../helpers/index.cjs");
|
|
8
8
|
var _constants = require("../../constants/index.cjs");
|
|
9
9
|
var _cache = require("../../cache/index.cjs");
|
|
@@ -37,8 +37,22 @@ const getProductsByIds = exports.getProductsByIds = async function getProductsBy
|
|
|
37
37
|
})(options.ids, {
|
|
38
38
|
with: options.with ?? withParams?.product ?? _constants.MIN_WITH_PARAMS_PRODUCT,
|
|
39
39
|
campaignKey,
|
|
40
|
-
pricePromotionKey: options.pricePromotionKey
|
|
41
|
-
|
|
40
|
+
pricePromotionKey: options.pricePromotionKey
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
const getProductsByReferenceKeys = exports.getProductsByReferenceKeys = async function getProductsByReferenceKeys2(options, {
|
|
44
|
+
bapiClient,
|
|
45
|
+
cached,
|
|
46
|
+
campaignKey,
|
|
47
|
+
withParams
|
|
48
|
+
}) {
|
|
49
|
+
return await cached(bapiClient.products.getByReferenceKeys, {
|
|
50
|
+
cacheKeyPrefix: "getByReferenceKeys-products",
|
|
51
|
+
ttl: 5 * _cache.MINUTE
|
|
52
|
+
})(options.referenceKeys, {
|
|
53
|
+
with: options.with ?? withParams?.product ?? _constants.MIN_WITH_PARAMS_PRODUCT,
|
|
54
|
+
campaignKey,
|
|
55
|
+
pricePromotionKey: options.pricePromotionKey
|
|
42
56
|
});
|
|
43
57
|
};
|
|
44
58
|
const getProductsByCategory = exports.getProductsByCategory = async function getProductsByCategory2({
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { FiltersEndpointResponseData } from '@aboutyou/backbone/endpoints/filters/filters';
|
|
2
|
-
import { FetchFiltersParams, FetchProductParams, FetchProductsByCategoryParams,
|
|
2
|
+
import { FetchFiltersParams, FetchProductParams, FetchProductsByCategoryParams, FetchProductsByIdsParams, FetchProductsByReferenceKeysParams, FetchProductsCountParams, Product, RpcContext } from '../../types';
|
|
3
3
|
export declare const getProductById: (options: FetchProductParams, { bapiClient, cached, campaignKey, withParams }: RpcContext) => Promise<Product>;
|
|
4
|
-
export declare const getProductsByIds: (options:
|
|
4
|
+
export declare const getProductsByIds: (options: FetchProductsByIdsParams, { bapiClient, cached, campaignKey, withParams }: RpcContext) => Promise<Product[]>;
|
|
5
|
+
export declare const getProductsByReferenceKeys: (options: FetchProductsByReferenceKeysParams, { bapiClient, cached, campaignKey, withParams }: RpcContext) => Promise<Product[]>;
|
|
5
6
|
export declare const getProductsByCategory: ({ category, cache, with: _with, perPage, page, where, sort, pricePromotionKey, includeSellableForFree, includeSoldOut, orFiltersOperator, }: FetchProductsByCategoryParams, context: RpcContext) => Promise<{
|
|
6
7
|
products: Product[];
|
|
7
8
|
pagination: import("@aboutyou/backbone/endpoints/products/productsByIds").Pagination;
|
|
@@ -21,8 +21,17 @@ export const getProductsByIds = async function getProductsByIds2(options, { bapi
|
|
|
21
21
|
})(options.ids, {
|
|
22
22
|
with: options.with ?? withParams?.product ?? MIN_WITH_PARAMS_PRODUCT,
|
|
23
23
|
campaignKey,
|
|
24
|
-
pricePromotionKey: options.pricePromotionKey
|
|
25
|
-
|
|
24
|
+
pricePromotionKey: options.pricePromotionKey
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
export const getProductsByReferenceKeys = async function getProductsByReferenceKeys2(options, { bapiClient, cached, campaignKey, withParams }) {
|
|
28
|
+
return await cached(bapiClient.products.getByReferenceKeys, {
|
|
29
|
+
cacheKeyPrefix: "getByReferenceKeys-products",
|
|
30
|
+
ttl: 5 * MINUTE
|
|
31
|
+
})(options.referenceKeys, {
|
|
32
|
+
with: options.with ?? withParams?.product ?? MIN_WITH_PARAMS_PRODUCT,
|
|
33
|
+
campaignKey,
|
|
34
|
+
pricePromotionKey: options.pricePromotionKey
|
|
26
35
|
});
|
|
27
36
|
};
|
|
28
37
|
export const getProductsByCategory = async function getProductsByCategory2({
|
|
@@ -36,6 +36,16 @@ export interface FetchProductsParams {
|
|
|
36
36
|
pricePromotionKey?: string;
|
|
37
37
|
includeSellableForFree?: boolean;
|
|
38
38
|
}
|
|
39
|
+
export interface FetchProductsByIdsParams {
|
|
40
|
+
ids: number[];
|
|
41
|
+
with?: ProductWith;
|
|
42
|
+
pricePromotionKey?: string;
|
|
43
|
+
}
|
|
44
|
+
export interface FetchProductsByReferenceKeysParams {
|
|
45
|
+
referenceKeys: string[];
|
|
46
|
+
with?: ProductWith;
|
|
47
|
+
pricePromotionKey?: string;
|
|
48
|
+
}
|
|
39
49
|
export interface FetchProductsByCategoryParams {
|
|
40
50
|
category: string;
|
|
41
51
|
with?: ProductWith;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scayle/storefront-core",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.46.0",
|
|
4
4
|
"description": "Collection of essential utilities to work with the Storefront API",
|
|
5
5
|
"author": "SCAYLE Commerce Engine",
|
|
6
6
|
"license": "MIT",
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
"ts-node": "10.9.2",
|
|
83
83
|
"typescript": "5.4.2",
|
|
84
84
|
"unbuild": "2.0.0",
|
|
85
|
-
"unstorage": "1.10.
|
|
85
|
+
"unstorage": "1.10.2",
|
|
86
86
|
"vitest": "1.3.1"
|
|
87
87
|
},
|
|
88
88
|
"optionalDependencies": {
|