pim-import 6.1.8 → 6.2.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.
|
@@ -4,7 +4,7 @@ export declare const publishTopicProduct: (productEntry: Entry) => Promise<void>
|
|
|
4
4
|
export declare const publishAllProductDrafts: (filters: {
|
|
5
5
|
catalog?: AvailableCatalogs;
|
|
6
6
|
destination?: string;
|
|
7
|
-
}, limit?: number) => Promise<{
|
|
7
|
+
}, limit?: number, reindexProducts?: boolean) => Promise<{
|
|
8
8
|
completed: boolean;
|
|
9
9
|
total: number;
|
|
10
10
|
}>;
|
|
@@ -21,7 +21,7 @@ const publishTopicProduct = async (productEntry) => {
|
|
|
21
21
|
await productEntry.publish();
|
|
22
22
|
};
|
|
23
23
|
exports.publishTopicProduct = publishTopicProduct;
|
|
24
|
-
const publishAllProductDrafts = async (filters, limit = 100) => {
|
|
24
|
+
const publishAllProductDrafts = async (filters, limit = 100, reindexProducts = true) => {
|
|
25
25
|
let logMsg = `publishAllProductDrafts limit: ${limit} filters: ${JSON.stringify(filters)}`;
|
|
26
26
|
(0, logs_1.log)(logMsg);
|
|
27
27
|
if (logs_1.serverUtils) {
|
|
@@ -65,11 +65,13 @@ const publishAllProductDrafts = async (filters, limit = 100) => {
|
|
|
65
65
|
logs_1.serverUtils.log(logMsg);
|
|
66
66
|
}
|
|
67
67
|
await (0, exports.publishTopicProduct)(item);
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
logs_1.serverUtils
|
|
68
|
+
if (reindexProducts) {
|
|
69
|
+
logMsg = `Reindex product: ${item.sys.id}`;
|
|
70
|
+
if (logs_1.serverUtils) {
|
|
71
|
+
logs_1.serverUtils.log(logMsg);
|
|
72
|
+
}
|
|
73
|
+
await (0, products_2.reindexProduct)(item.sys.id, true);
|
|
71
74
|
}
|
|
72
|
-
await (0, products_2.reindexProduct)(item.sys.id, true);
|
|
73
75
|
if (logs_1.serverUtils) {
|
|
74
76
|
const progress = Math.floor((count / items.length) * 100);
|
|
75
77
|
logs_1.serverUtils.updateProgress(progress);
|
|
@@ -515,13 +515,13 @@ const getProductData = async (productEntry, productDetails) => {
|
|
|
515
515
|
data.fields = await (0, contentful_1.addToRelationFields)(data, "productLine", productLineEntry.sys.id);
|
|
516
516
|
}
|
|
517
517
|
}
|
|
518
|
-
if (productDetails?.
|
|
519
|
-
const productSubLineEntry = await (0, contentful_1.getEntryByCode)(productDetails.
|
|
518
|
+
if (productDetails?.productSubLine) {
|
|
519
|
+
const productSubLineEntry = await (0, contentful_1.getEntryByCode)(productDetails.productSubLine.code, "topicProductSubLine", "sys");
|
|
520
520
|
if (!productSubLineEntry) {
|
|
521
|
-
(0, logs_1.log)(`The topicProductSubLine with code ${productDetails.
|
|
521
|
+
(0, logs_1.log)(`The topicProductSubLine with code ${productDetails.productSubLine.code} not found`, "WARN");
|
|
522
522
|
}
|
|
523
523
|
else {
|
|
524
|
-
(0, logs_1.log)(`Set productSubLine relation: ${productDetails.
|
|
524
|
+
(0, logs_1.log)(`Set productSubLine relation: ${productDetails.productSubLine.code}`);
|
|
525
525
|
data.fields = await (0, contentful_1.addToRelationFields)(data, "productSubLine", productSubLineEntry.sys.id);
|
|
526
526
|
}
|
|
527
527
|
}
|