pim-import 6.2.2 → 6.3.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 +3 -1
- package/dist/algolia/downloads.d.ts +3 -1
- package/dist/algolia/families.d.ts +3 -1
- package/dist/algolia/inspirations.d.ts +3 -1
- package/dist/algolia/models.d.ts +3 -1
- package/dist/algolia/news.d.ts +3 -1
- package/dist/algolia/pressRelease.d.ts +3 -1
- package/dist/algolia/pressReview.d.ts +3 -1
- package/dist/algolia/products.d.ts +3 -1
- package/dist/algolia/projects.d.ts +3 -1
- package/dist/algolia/stories.d.ts +3 -1
- package/dist/algolia/subFamilies.d.ts +3 -1
- package/dist/algolia/subModels.d.ts +3 -1
- package/dist/pim/endpoints.d.ts +1 -1
- package/dist/pim/endpoints.js +20 -8
- package/dist/pim/methods/subfamilies.d.ts +1 -1
- package/dist/pim/methods/subfamilies.js +15 -15
- package/dist/resources/CollectionSubFamilies.d.ts +37 -16
- package/dist/types.d.ts +4 -2
- package/package.json +1 -1
package/dist/algolia/clean.d.ts
CHANGED
|
@@ -3,7 +3,9 @@ import { AvailableIndicesKey } from "./config";
|
|
|
3
3
|
export declare const removeRecordsByStatus: (indexKey: AvailableIndicesKey, offset?: number, limit?: number, status?: AvailableEntryStatus, catalogCode?: AvailableCatalogs) => Promise<false | {
|
|
4
4
|
objectIds: string[];
|
|
5
5
|
offset?: number | undefined;
|
|
6
|
-
limit
|
|
6
|
+
limit?: number | undefined;
|
|
7
|
+
page?: number | undefined;
|
|
8
|
+
size?: number | undefined;
|
|
7
9
|
completed: boolean;
|
|
8
10
|
s3FilePath?: string | undefined;
|
|
9
11
|
total?: number | undefined;
|
|
@@ -34,7 +34,9 @@ export declare const reindexDownloads: (offset?: number, limit?: number, filterK
|
|
|
34
34
|
deletedObjectIDs: string[];
|
|
35
35
|
objects: Readonly<Record<string, any>>[];
|
|
36
36
|
offset?: number | undefined;
|
|
37
|
-
limit
|
|
37
|
+
limit?: number | undefined;
|
|
38
|
+
page?: number | undefined;
|
|
39
|
+
size?: number | undefined;
|
|
38
40
|
completed: boolean;
|
|
39
41
|
s3FilePath?: string | undefined;
|
|
40
42
|
total?: number | undefined;
|
|
@@ -31,7 +31,9 @@ export declare const reindexFamilies: (offset?: number, limit?: number, catalogC
|
|
|
31
31
|
deletedObjectIDs: string[];
|
|
32
32
|
objects: Readonly<Record<string, any>>[];
|
|
33
33
|
offset?: number | undefined;
|
|
34
|
-
limit
|
|
34
|
+
limit?: number | undefined;
|
|
35
|
+
page?: number | undefined;
|
|
36
|
+
size?: number | undefined;
|
|
35
37
|
completed: boolean;
|
|
36
38
|
s3FilePath?: string | undefined;
|
|
37
39
|
total?: number | undefined;
|
|
@@ -33,7 +33,9 @@ export declare const reindexInspirations: (offset?: number, limit?: number, filt
|
|
|
33
33
|
deletedObjectIDs: string[];
|
|
34
34
|
objects: Readonly<Record<string, any>>[];
|
|
35
35
|
offset?: number | undefined;
|
|
36
|
-
limit
|
|
36
|
+
limit?: number | undefined;
|
|
37
|
+
page?: number | undefined;
|
|
38
|
+
size?: number | undefined;
|
|
37
39
|
completed: boolean;
|
|
38
40
|
s3FilePath?: string | undefined;
|
|
39
41
|
total?: number | undefined;
|
package/dist/algolia/models.d.ts
CHANGED
|
@@ -28,7 +28,9 @@ export declare const reindexModels: (offset?: number, limit?: number, catalogCod
|
|
|
28
28
|
deletedObjectIDs: string[];
|
|
29
29
|
objects: Readonly<Record<string, any>>[];
|
|
30
30
|
offset?: number | undefined;
|
|
31
|
-
limit
|
|
31
|
+
limit?: number | undefined;
|
|
32
|
+
page?: number | undefined;
|
|
33
|
+
size?: number | undefined;
|
|
32
34
|
completed: boolean;
|
|
33
35
|
s3FilePath?: string | undefined;
|
|
34
36
|
total?: number | undefined;
|
package/dist/algolia/news.d.ts
CHANGED
|
@@ -29,7 +29,9 @@ export declare const reindexPosts: (offset?: number, limit?: number, filterKey?:
|
|
|
29
29
|
deletedObjectIDs: string[];
|
|
30
30
|
objects: Readonly<Record<string, any>>[];
|
|
31
31
|
offset?: number | undefined;
|
|
32
|
-
limit
|
|
32
|
+
limit?: number | undefined;
|
|
33
|
+
page?: number | undefined;
|
|
34
|
+
size?: number | undefined;
|
|
33
35
|
completed: boolean;
|
|
34
36
|
s3FilePath?: string | undefined;
|
|
35
37
|
total?: number | undefined;
|
|
@@ -27,7 +27,9 @@ export declare const reindexPressReleases: (offset?: number, limit?: number, fil
|
|
|
27
27
|
deletedObjectIDs: string[];
|
|
28
28
|
objects: Readonly<Record<string, any>>[];
|
|
29
29
|
offset?: number | undefined;
|
|
30
|
-
limit
|
|
30
|
+
limit?: number | undefined;
|
|
31
|
+
page?: number | undefined;
|
|
32
|
+
size?: number | undefined;
|
|
31
33
|
completed: boolean;
|
|
32
34
|
s3FilePath?: string | undefined;
|
|
33
35
|
total?: number | undefined;
|
|
@@ -27,7 +27,9 @@ export declare const reindexPressReviews: (offset?: number, limit?: number, filt
|
|
|
27
27
|
deletedObjectIDs: string[];
|
|
28
28
|
objects: Readonly<Record<string, any>>[];
|
|
29
29
|
offset?: number | undefined;
|
|
30
|
-
limit
|
|
30
|
+
limit?: number | undefined;
|
|
31
|
+
page?: number | undefined;
|
|
32
|
+
size?: number | undefined;
|
|
31
33
|
completed: boolean;
|
|
32
34
|
s3FilePath?: string | undefined;
|
|
33
35
|
total?: number | undefined;
|
|
@@ -82,7 +82,9 @@ export declare const reindexProducts: (filterKey: string, filterValue: string, o
|
|
|
82
82
|
deletedObjectIDs: string[];
|
|
83
83
|
objects: Readonly<Record<string, any>>[];
|
|
84
84
|
offset?: number | undefined;
|
|
85
|
-
limit
|
|
85
|
+
limit?: number | undefined;
|
|
86
|
+
page?: number | undefined;
|
|
87
|
+
size?: number | undefined;
|
|
86
88
|
completed: boolean;
|
|
87
89
|
s3FilePath?: string | undefined;
|
|
88
90
|
total?: number | undefined;
|
|
@@ -45,7 +45,9 @@ export declare const reindexProjects: (offset?: number, limit?: number, filterKe
|
|
|
45
45
|
deletedObjectIDs: string[];
|
|
46
46
|
objects: Readonly<Record<string, any>>[];
|
|
47
47
|
offset?: number | undefined;
|
|
48
|
-
limit
|
|
48
|
+
limit?: number | undefined;
|
|
49
|
+
page?: number | undefined;
|
|
50
|
+
size?: number | undefined;
|
|
49
51
|
completed: boolean;
|
|
50
52
|
s3FilePath?: string | undefined;
|
|
51
53
|
total?: number | undefined;
|
|
@@ -41,7 +41,9 @@ export declare const reindexStories: (offset?: number, limit?: number, filterKey
|
|
|
41
41
|
deletedObjectIDs: string[];
|
|
42
42
|
objects: Readonly<Record<string, any>>[];
|
|
43
43
|
offset?: number | undefined;
|
|
44
|
-
limit
|
|
44
|
+
limit?: number | undefined;
|
|
45
|
+
page?: number | undefined;
|
|
46
|
+
size?: number | undefined;
|
|
45
47
|
completed: boolean;
|
|
46
48
|
s3FilePath?: string | undefined;
|
|
47
49
|
total?: number | undefined;
|
|
@@ -4,7 +4,9 @@ export declare const reindexSubFamilies: (offset?: number, limit?: number, catal
|
|
|
4
4
|
deletedObjectIDs: string[];
|
|
5
5
|
objects: Readonly<Record<string, any>>[];
|
|
6
6
|
offset?: number | undefined;
|
|
7
|
-
limit
|
|
7
|
+
limit?: number | undefined;
|
|
8
|
+
page?: number | undefined;
|
|
9
|
+
size?: number | undefined;
|
|
8
10
|
completed: boolean;
|
|
9
11
|
s3FilePath?: string | undefined;
|
|
10
12
|
total?: number | undefined;
|
|
@@ -22,7 +22,9 @@ export declare const reindexSubModels: (offset?: number, limit?: number, catalog
|
|
|
22
22
|
deletedObjectIDs: string[];
|
|
23
23
|
objects: Readonly<Record<string, any>>[];
|
|
24
24
|
offset?: number | undefined;
|
|
25
|
-
limit
|
|
25
|
+
limit?: number | undefined;
|
|
26
|
+
page?: number | undefined;
|
|
27
|
+
size?: number | undefined;
|
|
26
28
|
completed: boolean;
|
|
27
29
|
s3FilePath?: string | undefined;
|
|
28
30
|
total?: number | undefined;
|
package/dist/pim/endpoints.d.ts
CHANGED
|
@@ -15,6 +15,6 @@ export declare const getProductDetails: (code: string) => Promise<any>;
|
|
|
15
15
|
export declare const getAudit: (lastModified?: string) => Promise<Audit[]>;
|
|
16
16
|
export declare const getStaticDailyProducts: (catalogCode: AvailableCatalogs, day: string, saveToS3?: boolean) => Promise<any>;
|
|
17
17
|
type AvailableOtherCatalogCollection = CollectionModels | CollectionSubModels | CollectionSubFamilies;
|
|
18
|
-
export declare const getOtherCatalogData: <T extends AvailableOtherCatalogCollection>(endpoint: AvailableOtherCatalogDataEndpoint, offset?: number, limit?: number) => Promise<T>;
|
|
18
|
+
export declare const getOtherCatalogData: <T extends AvailableOtherCatalogCollection>(endpoint: AvailableOtherCatalogDataEndpoint, offset?: number, limit?: number, newEndpoint?: boolean) => Promise<T>;
|
|
19
19
|
export declare const getFamilies: () => Promise<FamilyDetails[]>;
|
|
20
20
|
export {};
|
package/dist/pim/endpoints.js
CHANGED
|
@@ -189,18 +189,30 @@ const getStaticDailyProducts = async (catalogCode, day, saveToS3 = false) => {
|
|
|
189
189
|
}
|
|
190
190
|
};
|
|
191
191
|
exports.getStaticDailyProducts = getStaticDailyProducts;
|
|
192
|
-
const getOtherCatalogData = async (endpoint, offset = 0, limit = 50) => {
|
|
192
|
+
const getOtherCatalogData = async (endpoint, offset = 0, limit = 50, newEndpoint = false) => {
|
|
193
193
|
try {
|
|
194
194
|
const timeStart = new Date();
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
195
|
+
let endpointUrl = endpoint;
|
|
196
|
+
let opts;
|
|
197
|
+
if (newEndpoint) {
|
|
198
|
+
endpointUrl = `micro-service/dictionary/get/${endpoint}`;
|
|
199
|
+
opts = {
|
|
200
|
+
onlyWeb: true,
|
|
201
|
+
page: offset,
|
|
202
|
+
size: limit,
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
else {
|
|
206
|
+
opts = {
|
|
207
|
+
onlyweb: true,
|
|
208
|
+
offset,
|
|
209
|
+
limit,
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
const { data } = await (0, request_1.getRequest)(endpointUrl, { params: opts });
|
|
201
213
|
const timeEnd = new Date();
|
|
202
214
|
const seconds = (0, utils_1.secondBetweenTwoDate)(timeStart, timeEnd);
|
|
203
|
-
(0, logs_1.log)(`Request time: ${seconds} seconds - endpoint: ${
|
|
215
|
+
(0, logs_1.log)(`Request time: ${seconds} seconds - endpoint: ${endpointUrl}`);
|
|
204
216
|
return data;
|
|
205
217
|
}
|
|
206
218
|
catch (err) {
|
|
@@ -3,7 +3,7 @@ import { PaginationResults, CfLocalizedEntryField, AvailableCatalogs } from "../
|
|
|
3
3
|
import { pageResponse } from "../../algolia/families";
|
|
4
4
|
export declare const getSubFamilyPageSlugs: (catalogPage: Entry, categoryPage: Entry, subFamilyEntry: Entry) => Promise<CfLocalizedEntryField>;
|
|
5
5
|
export declare const createOrUpdatePage: (subFamilyEntry: Entry) => Promise<Entry>;
|
|
6
|
-
export declare const importSubFamilies: (
|
|
6
|
+
export declare const importSubFamilies: (page: number | undefined, size: number | undefined, catalog: AvailableCatalogs) => Promise<PaginationResults>;
|
|
7
7
|
export declare const getSubFamilyRelatedDetails: (topicSubFamily: Entry) => Promise<{
|
|
8
8
|
catalogPageSlugs: any;
|
|
9
9
|
familyPageSlugs: any;
|
|
@@ -210,16 +210,16 @@ const importSubFamily = async (subFamily, catalog) => {
|
|
|
210
210
|
}
|
|
211
211
|
return topicSubFamily;
|
|
212
212
|
};
|
|
213
|
-
const importSubFamilies = async (
|
|
214
|
-
(0, logs_1.log)(`importSubFamilies -
|
|
215
|
-
const subFamilies = await (0, endpoints_1.getOtherCatalogData)("subfamilies",
|
|
216
|
-
const total = subFamilies?.
|
|
217
|
-
if (subFamilies?.
|
|
213
|
+
const importSubFamilies = async (page = 0, size = 50, catalog) => {
|
|
214
|
+
(0, logs_1.log)(`importSubFamilies - page: ${page}, size: ${size}`, "INFO");
|
|
215
|
+
const subFamilies = await (0, endpoints_1.getOtherCatalogData)("subfamilies", page, size, true);
|
|
216
|
+
const total = subFamilies?.content?.length || 0;
|
|
217
|
+
if (subFamilies?.content?.length) {
|
|
218
218
|
(0, logs_1.log)(`Import ${total} subFamilies`);
|
|
219
|
-
let count =
|
|
219
|
+
let count = page * size;
|
|
220
220
|
let current = 0;
|
|
221
|
-
for (const subFamily of subFamilies.
|
|
222
|
-
(0, logs_1.log)(`${++count} of ${subFamilies.
|
|
221
|
+
for (const subFamily of subFamilies.content) {
|
|
222
|
+
(0, logs_1.log)(`${++count} of ${subFamilies.totalElements}`);
|
|
223
223
|
if (subFamily.catalogCode !== catalog) {
|
|
224
224
|
(0, logs_1.log)(`The ${subFamily.data.code} subfamily does not belong to the ${catalog} catalog and will not be imported`);
|
|
225
225
|
continue;
|
|
@@ -232,10 +232,10 @@ const importSubFamilies = async (offset = 0, limit = 50, catalog) => {
|
|
|
232
232
|
await (0, exports.createOrUpdatePage)(topicSubFamily);
|
|
233
233
|
if (logs_1.serverUtils) {
|
|
234
234
|
logs_1.serverUtils.log(subFamily.data.code);
|
|
235
|
-
const progress = Math.floor((++current / subFamilies.
|
|
235
|
+
const progress = Math.floor((++current / subFamilies.content.length) * 100);
|
|
236
236
|
logs_1.serverUtils.updateProgress(progress);
|
|
237
237
|
}
|
|
238
|
-
if (count % 2 === 0 && count < subFamilies.
|
|
238
|
+
if (count % 2 === 0 && count < subFamilies.totalElements) {
|
|
239
239
|
await (0, utils_1.sleep)(1000);
|
|
240
240
|
}
|
|
241
241
|
}
|
|
@@ -243,15 +243,15 @@ const importSubFamilies = async (offset = 0, limit = 50, catalog) => {
|
|
|
243
243
|
else {
|
|
244
244
|
(0, logs_1.log)(`No subFamilies found`);
|
|
245
245
|
}
|
|
246
|
-
const
|
|
246
|
+
const nextPage = Number(page) + 1;
|
|
247
247
|
if (logs_1.serverUtils) {
|
|
248
248
|
logs_1.serverUtils.updateProgress(100);
|
|
249
249
|
}
|
|
250
250
|
return {
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
completed:
|
|
254
|
-
total: subFamilies.
|
|
251
|
+
page: nextPage,
|
|
252
|
+
size: Number(size),
|
|
253
|
+
completed: nextPage >= subFamilies.totalPages,
|
|
254
|
+
total: subFamilies.totalElements,
|
|
255
255
|
};
|
|
256
256
|
};
|
|
257
257
|
exports.importSubFamilies = importSubFamilies;
|
|
@@ -1,28 +1,45 @@
|
|
|
1
1
|
export interface CollectionSubFamilies {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
content?: PagedCollectionEntity[] | null;
|
|
3
|
+
page: number;
|
|
4
|
+
size: number;
|
|
5
|
+
totalElements: number;
|
|
6
|
+
totalPages: number;
|
|
6
7
|
}
|
|
7
8
|
export interface PagedCollectionEntity {
|
|
8
9
|
data: GenericData;
|
|
9
|
-
priority?: number;
|
|
10
10
|
catalogCode: string;
|
|
11
11
|
categoryCode: string;
|
|
12
12
|
parentFamily: ParentFamily;
|
|
13
|
+
priority?: number | null;
|
|
13
14
|
designers?: GenericData[] | null;
|
|
14
15
|
relatedProducts?: string[] | null;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
description1_it?: string;
|
|
18
|
-
description1_es?: string;
|
|
19
|
-
description1_de?: string;
|
|
20
|
-
description1_fr?: string;
|
|
21
|
-
description1_sv?: string;
|
|
22
|
-
description1_no?: string;
|
|
23
|
-
description1_da?: string;
|
|
24
|
-
description1_ru?: string;
|
|
25
|
-
|
|
16
|
+
destinations?: string[] | null;
|
|
17
|
+
description1_en?: string | null;
|
|
18
|
+
description1_it?: string | null;
|
|
19
|
+
description1_es?: string | null;
|
|
20
|
+
description1_de?: string | null;
|
|
21
|
+
description1_fr?: string | null;
|
|
22
|
+
description1_sv?: string | null;
|
|
23
|
+
description1_no?: string | null;
|
|
24
|
+
description1_da?: string | null;
|
|
25
|
+
description1_ru?: string | null;
|
|
26
|
+
description1_en_us?: string | null;
|
|
27
|
+
description1_zh?: string | null;
|
|
28
|
+
description1_ja?: string | null;
|
|
29
|
+
description1_ko?: string | null;
|
|
30
|
+
description2_en?: string | null;
|
|
31
|
+
description2_it?: string | null;
|
|
32
|
+
description2_es?: string | null;
|
|
33
|
+
description2_de?: string | null;
|
|
34
|
+
description2_fr?: string | null;
|
|
35
|
+
description2_sv?: string | null;
|
|
36
|
+
description2_no?: string | null;
|
|
37
|
+
description2_da?: string | null;
|
|
38
|
+
description2_ru?: string | null;
|
|
39
|
+
description2_zh?: string | null;
|
|
40
|
+
description2_ja?: string | null;
|
|
41
|
+
description2_ko?: string | null;
|
|
42
|
+
description2_en_us?: string | null;
|
|
26
43
|
}
|
|
27
44
|
export interface GenericData {
|
|
28
45
|
code: string;
|
|
@@ -36,6 +53,9 @@ export interface GenericData {
|
|
|
36
53
|
value_no: string;
|
|
37
54
|
value_da: string;
|
|
38
55
|
value_ru: string;
|
|
56
|
+
value_zh?: string;
|
|
57
|
+
value_ja?: string;
|
|
58
|
+
value_ko?: string;
|
|
39
59
|
othersData: OthersData;
|
|
40
60
|
}
|
|
41
61
|
export interface OthersData {
|
|
@@ -43,4 +63,5 @@ export interface OthersData {
|
|
|
43
63
|
export interface ParentFamily {
|
|
44
64
|
data: GenericData;
|
|
45
65
|
designers?: GenericData[] | null;
|
|
66
|
+
destinations?: string[] | null;
|
|
46
67
|
}
|
package/dist/types.d.ts
CHANGED
|
@@ -42,7 +42,7 @@ export type PimProductDescription = {
|
|
|
42
42
|
description1_ru: string | null;
|
|
43
43
|
};
|
|
44
44
|
export type PimProductExcerpt = {
|
|
45
|
-
description2_en: string;
|
|
45
|
+
description2_en: string | null;
|
|
46
46
|
description2_en_US?: string | null;
|
|
47
47
|
description2_it: string | null;
|
|
48
48
|
description2_es: string | null;
|
|
@@ -62,7 +62,9 @@ export type CfSys = {
|
|
|
62
62
|
};
|
|
63
63
|
export type PaginationResults = {
|
|
64
64
|
offset?: number;
|
|
65
|
-
limit
|
|
65
|
+
limit?: number;
|
|
66
|
+
page?: number;
|
|
67
|
+
size?: number;
|
|
66
68
|
completed: boolean;
|
|
67
69
|
s3FilePath?: string;
|
|
68
70
|
total?: number;
|