pim-import 6.5.0 → 6.8.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/dist/algolia/clean.d.ts +1 -0
- package/dist/algolia/downloads.d.ts +1 -0
- package/dist/algolia/families.d.ts +1 -0
- package/dist/algolia/inspirations.d.ts +1 -0
- package/dist/algolia/models.d.ts +1 -0
- package/dist/algolia/news.d.ts +1 -0
- package/dist/algolia/pressRelease.d.ts +1 -0
- package/dist/algolia/pressReview.d.ts +1 -0
- package/dist/algolia/products.d.ts +1 -0
- package/dist/algolia/projects.d.ts +1 -0
- package/dist/algolia/stories.d.ts +1 -0
- package/dist/algolia/subFamilies.d.ts +1 -0
- package/dist/algolia/subModels.d.ts +1 -0
- package/dist/pim/endpoints.js +1 -1
- package/dist/pim/methods/latestProducts.js +1 -0
- package/dist/pim/methods/models.d.ts +1 -1
- package/dist/pim/methods/models.js +18 -17
- package/dist/pim/methods/subfamilies.js +1 -0
- package/dist/pim/methods/submodels.d.ts +1 -1
- package/dist/pim/methods/submodels.js +17 -16
- package/dist/resources/CollectionModels.d.ts +26 -23
- package/dist/resources/CollectionSubModels.d.ts +14 -14
- package/dist/types.d.ts +1 -0
- package/package.json +1 -1
package/dist/algolia/clean.d.ts
CHANGED
|
@@ -41,5 +41,6 @@ export declare const reindexDownloads: (offset?: number, limit?: number, filterK
|
|
|
41
41
|
s3FilePath?: string | undefined;
|
|
42
42
|
total?: number | undefined;
|
|
43
43
|
nextPage?: number | null | undefined;
|
|
44
|
+
totalPages?: number | null | undefined;
|
|
44
45
|
}>;
|
|
45
46
|
export declare const removeDownloadObject: (objectId: string) => Promise<void>;
|
|
@@ -38,6 +38,7 @@ export declare const reindexFamilies: (offset?: number, limit?: number, catalogC
|
|
|
38
38
|
s3FilePath?: string | undefined;
|
|
39
39
|
total?: number | undefined;
|
|
40
40
|
nextPage?: number | null | undefined;
|
|
41
|
+
totalPages?: number | null | undefined;
|
|
41
42
|
}>;
|
|
42
43
|
export declare const reindexFamily: (topicFamilyEntryId: string) => Promise<{
|
|
43
44
|
taskID: number;
|
|
@@ -40,5 +40,6 @@ export declare const reindexInspirations: (offset?: number, limit?: number, filt
|
|
|
40
40
|
s3FilePath?: string | undefined;
|
|
41
41
|
total?: number | undefined;
|
|
42
42
|
nextPage?: number | null | undefined;
|
|
43
|
+
totalPages?: number | null | undefined;
|
|
43
44
|
}>;
|
|
44
45
|
export declare const removeInspirationObject: (objectId: string) => Promise<void>;
|
package/dist/algolia/models.d.ts
CHANGED
|
@@ -35,5 +35,6 @@ export declare const reindexModels: (offset?: number, limit?: number, catalogCod
|
|
|
35
35
|
s3FilePath?: string | undefined;
|
|
36
36
|
total?: number | undefined;
|
|
37
37
|
nextPage?: number | null | undefined;
|
|
38
|
+
totalPages?: number | null | undefined;
|
|
38
39
|
}>;
|
|
39
40
|
export declare const removeModelObject: (topicModelId: string) => Promise<void>;
|
package/dist/algolia/news.d.ts
CHANGED
|
@@ -36,5 +36,6 @@ export declare const reindexPosts: (offset?: number, limit?: number, filterKey?:
|
|
|
36
36
|
s3FilePath?: string | undefined;
|
|
37
37
|
total?: number | undefined;
|
|
38
38
|
nextPage?: number | null | undefined;
|
|
39
|
+
totalPages?: number | null | undefined;
|
|
39
40
|
}>;
|
|
40
41
|
export declare const removePostObject: (objectId: string) => Promise<void>;
|
|
@@ -34,5 +34,6 @@ export declare const reindexPressReleases: (offset?: number, limit?: number, fil
|
|
|
34
34
|
s3FilePath?: string | undefined;
|
|
35
35
|
total?: number | undefined;
|
|
36
36
|
nextPage?: number | null | undefined;
|
|
37
|
+
totalPages?: number | null | undefined;
|
|
37
38
|
}>;
|
|
38
39
|
export declare const removePressReleaseObject: (objectId: string) => Promise<void>;
|
|
@@ -34,5 +34,6 @@ export declare const reindexPressReviews: (offset?: number, limit?: number, filt
|
|
|
34
34
|
s3FilePath?: string | undefined;
|
|
35
35
|
total?: number | undefined;
|
|
36
36
|
nextPage?: number | null | undefined;
|
|
37
|
+
totalPages?: number | null | undefined;
|
|
37
38
|
}>;
|
|
38
39
|
export declare const removePressReviewObject: (objectId: string) => Promise<void>;
|
|
@@ -89,5 +89,6 @@ export declare const reindexProducts: (filterKey: string, filterValue: string, o
|
|
|
89
89
|
s3FilePath?: string | undefined;
|
|
90
90
|
total?: number | undefined;
|
|
91
91
|
nextPage?: number | null | undefined;
|
|
92
|
+
totalPages?: number | null | undefined;
|
|
92
93
|
}>;
|
|
93
94
|
export declare const removeProductObject: (topicProductId: string) => Promise<void>;
|
|
@@ -52,5 +52,6 @@ export declare const reindexProjects: (offset?: number, limit?: number, filterKe
|
|
|
52
52
|
s3FilePath?: string | undefined;
|
|
53
53
|
total?: number | undefined;
|
|
54
54
|
nextPage?: number | null | undefined;
|
|
55
|
+
totalPages?: number | null | undefined;
|
|
55
56
|
}>;
|
|
56
57
|
export declare const removeProjectObject: (objectId: string) => Promise<void>;
|
|
@@ -48,5 +48,6 @@ export declare const reindexStories: (offset?: number, limit?: number, filterKey
|
|
|
48
48
|
s3FilePath?: string | undefined;
|
|
49
49
|
total?: number | undefined;
|
|
50
50
|
nextPage?: number | null | undefined;
|
|
51
|
+
totalPages?: number | null | undefined;
|
|
51
52
|
}>;
|
|
52
53
|
export declare const removeStoryObject: (objectId: string) => Promise<void>;
|
|
@@ -11,6 +11,7 @@ export declare const reindexSubFamilies: (offset?: number, limit?: number, catal
|
|
|
11
11
|
s3FilePath?: string | undefined;
|
|
12
12
|
total?: number | undefined;
|
|
13
13
|
nextPage?: number | null | undefined;
|
|
14
|
+
totalPages?: number | null | undefined;
|
|
14
15
|
}>;
|
|
15
16
|
export declare const reindexSubFamily: (topicSubFamilyEntryId: string) => Promise<{
|
|
16
17
|
taskID: number;
|
|
@@ -29,5 +29,6 @@ export declare const reindexSubModels: (offset?: number, limit?: number, catalog
|
|
|
29
29
|
s3FilePath?: string | undefined;
|
|
30
30
|
total?: number | undefined;
|
|
31
31
|
nextPage?: number | null | undefined;
|
|
32
|
+
totalPages?: number | null | undefined;
|
|
32
33
|
}>;
|
|
33
34
|
export declare const removeSubModelObject: (topicSubModelId: string) => Promise<void>;
|
package/dist/pim/endpoints.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { PaginationResults } from "../../types";
|
|
2
|
-
export declare const importModels: (
|
|
2
|
+
export declare const importModels: (page?: number, size?: number) => Promise<PaginationResults>;
|
|
@@ -54,7 +54,7 @@ const getTopicModelData = async (model, topicModel) => {
|
|
|
54
54
|
};
|
|
55
55
|
data.fields.name = (0, utils_1.getPimTranslations)(model.data);
|
|
56
56
|
data.fields = await (0, contentful_1.addFieldValue)(data, "code", model.code);
|
|
57
|
-
data.fields = await (0, contentful_1.addFieldValue)(data, "priority", model
|
|
57
|
+
data.fields = await (0, contentful_1.addFieldValue)(data, "priority", model?.priority || 0);
|
|
58
58
|
data.fields.description = (0, utils_1.getPimTranslations)(model, "description1");
|
|
59
59
|
if (model.subFamilyCode) {
|
|
60
60
|
const subFamilyEntry = await (0, contentful_1.getEntryByCode)(model.subFamilyCode, "topicSubFamily", "sys,fields.code,fields.catalog");
|
|
@@ -87,7 +87,7 @@ const getTopicModelData = async (model, topicModel) => {
|
|
|
87
87
|
(0, logs_1.log)(`topicProductLine with code ${model.productLineCode} not found`, "WARN");
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
|
-
if (model
|
|
90
|
+
if (model?.designers?.length) {
|
|
91
91
|
const designerCode = model.designers[0].code;
|
|
92
92
|
const designerEntry = await (0, contentful_1.getEntryByCode)(designerCode, "topicDesigner", "sys,fields.code");
|
|
93
93
|
if (designerEntry) {
|
|
@@ -139,25 +139,25 @@ const importModel = async (model) => {
|
|
|
139
139
|
}
|
|
140
140
|
return topicModel;
|
|
141
141
|
};
|
|
142
|
-
const importModels = async (
|
|
143
|
-
(0, logs_1.log)(`importModels -
|
|
144
|
-
const models = await (0, endpoints_1.getOtherCatalogData)("models",
|
|
145
|
-
const total = models?.
|
|
146
|
-
if (models?.
|
|
142
|
+
const importModels = async (page = 0, size = 40) => {
|
|
143
|
+
(0, logs_1.log)(`importModels - page: ${page}, size: ${size}`, "INFO");
|
|
144
|
+
const models = await (0, endpoints_1.getOtherCatalogData)("models", page, size, true);
|
|
145
|
+
const total = models?.content?.length || 0;
|
|
146
|
+
if (models?.content?.length) {
|
|
147
147
|
(0, logs_1.log)(`Founded ${total} models`);
|
|
148
|
-
let count =
|
|
148
|
+
let count = page * size;
|
|
149
149
|
let current = 0;
|
|
150
|
-
for (const model of models.
|
|
151
|
-
(0, logs_1.log)(`${++count} of ${models.
|
|
150
|
+
for (const model of models.content) {
|
|
151
|
+
(0, logs_1.log)(`${++count} of ${models.totalElements}`);
|
|
152
152
|
const topicModel = await importModel(model);
|
|
153
153
|
await createOrUpdatePage(topicModel);
|
|
154
154
|
await updateComponentModelOfSubFamilyPages(topicModel);
|
|
155
155
|
if (logs_1.serverUtils) {
|
|
156
156
|
logs_1.serverUtils.log(model.code);
|
|
157
|
-
const progress = Math.floor((++current / models.
|
|
157
|
+
const progress = Math.floor((++current / models.content.length) * 100);
|
|
158
158
|
logs_1.serverUtils.updateProgress(progress);
|
|
159
159
|
}
|
|
160
|
-
if (count % 2 === 0 && count < models.
|
|
160
|
+
if (count % 2 === 0 && count < models.totalElements) {
|
|
161
161
|
await (0, utils_1.sleep)(1000);
|
|
162
162
|
}
|
|
163
163
|
}
|
|
@@ -165,12 +165,13 @@ const importModels = async (offset = 0, limit = 40) => {
|
|
|
165
165
|
else {
|
|
166
166
|
(0, logs_1.log)(`No models found`);
|
|
167
167
|
}
|
|
168
|
-
const
|
|
168
|
+
const nextPage = Number(page) + 1;
|
|
169
169
|
return {
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
completed:
|
|
173
|
-
total: models.
|
|
170
|
+
page: nextPage,
|
|
171
|
+
size: Number(size),
|
|
172
|
+
completed: nextPage >= models.totalPages,
|
|
173
|
+
total: models.totalElements,
|
|
174
|
+
totalPages: models.totalPages,
|
|
174
175
|
};
|
|
175
176
|
};
|
|
176
177
|
exports.importModels = importModels;
|
|
@@ -252,6 +252,7 @@ const importSubFamilies = async (page = 0, size = 50, catalog) => {
|
|
|
252
252
|
size: Number(size),
|
|
253
253
|
completed: nextPage >= subFamilies.totalPages,
|
|
254
254
|
total: subFamilies.totalElements,
|
|
255
|
+
totalPages: subFamilies.totalPages,
|
|
255
256
|
};
|
|
256
257
|
};
|
|
257
258
|
exports.importSubFamilies = importSubFamilies;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { PaginationResults } from "../../types";
|
|
2
|
-
export declare const importSubModels: (
|
|
2
|
+
export declare const importSubModels: (page?: number, size?: number) => Promise<PaginationResults>;
|
|
@@ -12,7 +12,7 @@ const getTopicSubModelData = async (subModel, topicSubModel) => {
|
|
|
12
12
|
};
|
|
13
13
|
data.fields.name = (0, utils_1.getPimTranslations)(subModel.data);
|
|
14
14
|
data.fields = await (0, contentful_1.addFieldValue)(data, "code", subModel.code);
|
|
15
|
-
data.fields = await (0, contentful_1.addFieldValue)(data, "priority", subModel
|
|
15
|
+
data.fields = await (0, contentful_1.addFieldValue)(data, "priority", subModel?.priority || 0);
|
|
16
16
|
if (subModel.subFamilyCode) {
|
|
17
17
|
const subFamilyEntry = await (0, contentful_1.getEntryByCode)(subModel.subFamilyCode, "topicSubFamily", "sys,fields.code,fields.catalog");
|
|
18
18
|
if (subFamilyEntry) {
|
|
@@ -85,37 +85,38 @@ const addSubModelToModel = async (topicSubModelId, topicModelId) => {
|
|
|
85
85
|
data.fields = await (0, contentful_1.addToRelationFields)(topicModel, "subModels", topicSubModelId, true);
|
|
86
86
|
topicModel = await (0, contentful_1.updateEntry)(topicModel, data, topicModel.isPublished());
|
|
87
87
|
};
|
|
88
|
-
const importSubModels = async (
|
|
88
|
+
const importSubModels = async (page = 0, size = 50) => {
|
|
89
89
|
const timeStart = new Date();
|
|
90
|
-
(0, logs_1.log)(`importSubModels -
|
|
91
|
-
const subModels = await (0, endpoints_1.getOtherCatalogData)("submodels",
|
|
92
|
-
const total = subModels?.
|
|
93
|
-
if (subModels?.
|
|
90
|
+
(0, logs_1.log)(`importSubModels - page: ${page}, size: ${size}`, "INFO");
|
|
91
|
+
const subModels = await (0, endpoints_1.getOtherCatalogData)("submodels", page, size, true);
|
|
92
|
+
const total = subModels?.content?.length || 0;
|
|
93
|
+
if (subModels?.content?.length) {
|
|
94
94
|
(0, logs_1.log)(`Founded ${total} subModels`);
|
|
95
|
-
let count =
|
|
95
|
+
let count = page * size;
|
|
96
96
|
let current = 0;
|
|
97
|
-
for (const subModel of subModels.
|
|
98
|
-
(0, logs_1.log)(`${++count} of ${subModels.
|
|
97
|
+
for (const subModel of subModels.content) {
|
|
98
|
+
(0, logs_1.log)(`${++count} of ${subModels.totalElements}`);
|
|
99
99
|
await importSubModel(subModel);
|
|
100
100
|
if (logs_1.serverUtils) {
|
|
101
101
|
logs_1.serverUtils.log(subModel.code);
|
|
102
|
-
const progress = Math.floor((++current / subModels.
|
|
102
|
+
const progress = Math.floor((++current / subModels.content.length) * 100);
|
|
103
103
|
logs_1.serverUtils.updateProgress(progress);
|
|
104
104
|
}
|
|
105
|
-
if (count % 2 === 0 && count < subModels.
|
|
105
|
+
if (count % 2 === 0 && count < subModels.totalElements) {
|
|
106
106
|
await (0, utils_1.sleep)(1000);
|
|
107
107
|
}
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
|
-
const nextOffset = Number(offset) + Number(limit);
|
|
111
110
|
const timeEnd = new Date();
|
|
112
111
|
const seconds = (0, utils_1.secondBetweenTwoDate)(timeStart, timeEnd);
|
|
113
112
|
(0, logs_1.log)(`Request time: ${seconds} seconds`);
|
|
113
|
+
const nextPage = Number(page) + 1;
|
|
114
114
|
return {
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
completed:
|
|
118
|
-
total: subModels.
|
|
115
|
+
page: nextPage,
|
|
116
|
+
size: Number(size),
|
|
117
|
+
completed: nextPage >= subModels.totalPages,
|
|
118
|
+
total: subModels.totalElements,
|
|
119
|
+
totalPages: subModels.totalPages,
|
|
119
120
|
};
|
|
120
121
|
};
|
|
121
122
|
exports.importSubModels = importSubModels;
|
|
@@ -1,29 +1,32 @@
|
|
|
1
1
|
export interface CollectionModels {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
content: ModelEntity[];
|
|
3
|
+
page: number;
|
|
4
|
+
size: number;
|
|
5
|
+
totalElements: number;
|
|
6
|
+
totalPages: number;
|
|
6
7
|
}
|
|
7
|
-
export interface
|
|
8
|
-
designers: Data[];
|
|
9
|
-
relatedProducts?: string[] | null;
|
|
8
|
+
export interface ModelEntity {
|
|
10
9
|
data: Data;
|
|
11
|
-
|
|
10
|
+
destinations?: string[] | null;
|
|
11
|
+
relatedProducts?: string[] | null;
|
|
12
12
|
subFamilyCode: string;
|
|
13
13
|
productLineCode: string;
|
|
14
|
+
designers?: Data[] | null;
|
|
15
|
+
priority?: number | null;
|
|
14
16
|
code: string;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
17
|
+
description1_en?: string | null;
|
|
18
|
+
description1_en_us?: string | null;
|
|
19
|
+
description1_it?: string | null;
|
|
20
|
+
description1_es?: string | null;
|
|
21
|
+
description1_de?: string | null;
|
|
22
|
+
description1_fr?: string | null;
|
|
23
|
+
description1_sv?: string | null;
|
|
24
|
+
description1_no?: string | null;
|
|
25
|
+
description1_da?: string | null;
|
|
26
|
+
description1_ru?: string | null;
|
|
27
|
+
description1_zh?: string | null;
|
|
28
|
+
description1_ja?: string | null;
|
|
29
|
+
description1_ko?: string | null;
|
|
27
30
|
}
|
|
28
31
|
export interface Data {
|
|
29
32
|
code: string;
|
|
@@ -37,7 +40,7 @@ export interface Data {
|
|
|
37
40
|
value_no: string;
|
|
38
41
|
value_da: string;
|
|
39
42
|
value_ru: string;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
+
value_zh: string;
|
|
44
|
+
value_ja: string;
|
|
45
|
+
value_ko: string;
|
|
43
46
|
}
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
export interface CollectionSubModels {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
content: SubModelEntity[];
|
|
3
|
+
page: number;
|
|
4
|
+
size: number;
|
|
5
|
+
totalElements: number;
|
|
6
|
+
totalPages: number;
|
|
6
7
|
}
|
|
7
|
-
export interface
|
|
8
|
-
relatedProducts?: string[] | null;
|
|
8
|
+
export interface SubModelEntity {
|
|
9
9
|
data: Data;
|
|
10
|
-
|
|
10
|
+
destinations?: string[] | null;
|
|
11
|
+
relatedProducts?: string[] | null;
|
|
12
|
+
code: string;
|
|
13
|
+
priority?: number | null;
|
|
11
14
|
subFamilyCode: string;
|
|
12
15
|
productLineCode: string;
|
|
13
16
|
parentModel: ParentModel;
|
|
14
|
-
code: string;
|
|
15
|
-
othersData: OthersData;
|
|
16
|
-
destinations?: string[];
|
|
17
17
|
}
|
|
18
18
|
export interface Data {
|
|
19
19
|
code: string;
|
|
@@ -27,11 +27,11 @@ export interface Data {
|
|
|
27
27
|
value_no: string;
|
|
28
28
|
value_da: string;
|
|
29
29
|
value_ru: string;
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
value_zh: string;
|
|
31
|
+
value_ja: string;
|
|
32
|
+
value_ko: string;
|
|
33
33
|
}
|
|
34
34
|
export interface ParentModel {
|
|
35
35
|
code: string;
|
|
36
|
-
|
|
36
|
+
designers?: Data[] | null;
|
|
37
37
|
}
|
package/dist/types.d.ts
CHANGED
|
@@ -69,6 +69,7 @@ export type PaginationResults = {
|
|
|
69
69
|
s3FilePath?: string;
|
|
70
70
|
total?: number;
|
|
71
71
|
nextPage?: number | null;
|
|
72
|
+
totalPages?: number | null;
|
|
72
73
|
};
|
|
73
74
|
export type CfLocalizedEntryField = Partial<Record<ContentfulLocale, string | null>>;
|
|
74
75
|
export type TopicDetailsResponse = {
|