pim-import 4.30.3 → 4.30.5
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.js +10 -10
- package/dist/algolia/clean.js.map +1 -1
- package/dist/algolia/config.js +9 -9
- package/dist/algolia/config.js.map +1 -1
- package/dist/algolia/downloads.js +42 -43
- package/dist/algolia/downloads.js.map +1 -1
- package/dist/algolia/families.js +71 -73
- package/dist/algolia/families.js.map +1 -1
- package/dist/algolia/models.js +49 -50
- package/dist/algolia/models.js.map +1 -1
- package/dist/algolia/news.js +40 -41
- package/dist/algolia/news.js.map +1 -1
- package/dist/algolia/pressRelease.js +37 -38
- package/dist/algolia/pressRelease.js.map +1 -1
- package/dist/algolia/pressReview.js +35 -36
- package/dist/algolia/pressReview.js.map +1 -1
- package/dist/algolia/products.js +84 -85
- package/dist/algolia/products.js.map +1 -1
- package/dist/algolia/projects.js +44 -45
- package/dist/algolia/projects.js.map +1 -1
- package/dist/algolia/stories.js +53 -54
- package/dist/algolia/stories.js.map +1 -1
- package/dist/algolia/subFamilies.js +78 -80
- package/dist/algolia/subFamilies.js.map +1 -1
- package/dist/algolia/subModels.js +48 -49
- package/dist/algolia/subModels.js.map +1 -1
- package/dist/downloads/classes/manageEntry.js +3 -3
- package/dist/downloads/classes/manageEntry.js.map +1 -1
- package/dist/downloads/import.js +27 -27
- package/dist/downloads/import.js.map +1 -1
- package/dist/libs/contentful-cda.js +37 -44
- package/dist/libs/contentful-cda.js.map +1 -1
- package/dist/libs/contentful.js +131 -130
- package/dist/libs/contentful.js.map +1 -1
- package/dist/libs/imgix.js +23 -23
- package/dist/libs/imgix.js.map +1 -1
- package/dist/libs/logs.js +4 -4
- package/dist/libs/logs.js.map +1 -1
- package/dist/libs/pdf.js +5 -5
- package/dist/libs/pdf.js.map +1 -1
- package/dist/libs/s3.js +28 -28
- package/dist/libs/s3.js.map +1 -1
- package/dist/libs/sentry.js +6 -2
- package/dist/libs/sentry.js.map +1 -1
- package/dist/pim/config.js +3 -3
- package/dist/pim/config.js.map +1 -1
- package/dist/pim/endpoints.js +39 -39
- package/dist/pim/endpoints.js.map +1 -1
- package/dist/pim/methods/bulkPublish.js +10 -10
- package/dist/pim/methods/bulkPublish.js.map +1 -1
- package/dist/pim/methods/catalogs.js +62 -62
- package/dist/pim/methods/catalogs.js.map +1 -1
- package/dist/pim/methods/designers.js +19 -19
- package/dist/pim/methods/designers.js.map +1 -1
- package/dist/pim/methods/dictionary.js +66 -66
- package/dist/pim/methods/dictionary.js.map +1 -1
- package/dist/pim/methods/families.js +37 -37
- package/dist/pim/methods/families.js.map +1 -1
- package/dist/pim/methods/latestProducts.js +7 -7
- package/dist/pim/methods/latestProducts.js.map +1 -1
- package/dist/pim/methods/models.js +47 -47
- package/dist/pim/methods/models.js.map +1 -1
- package/dist/pim/methods/pages/catalogs.js +6 -6
- package/dist/pim/methods/pages/catalogs.js.map +1 -1
- package/dist/pim/methods/pages/families.js +7 -7
- package/dist/pim/methods/pages/families.js.map +1 -1
- package/dist/pim/methods/pages/subfamilies.js +11 -11
- package/dist/pim/methods/pages/subfamilies.js.map +1 -1
- package/dist/pim/methods/products.js +426 -426
- package/dist/pim/methods/products.js.map +1 -1
- package/dist/pim/methods/subfamilies.js +107 -107
- package/dist/pim/methods/subfamilies.js.map +1 -1
- package/dist/pim/methods/submodels.js +37 -37
- package/dist/pim/methods/submodels.js.map +1 -1
- package/dist/pim/request.js +2 -2
- package/dist/pim/request.js.map +1 -1
- package/dist/utils.js +23 -23
- package/dist/utils.js.map +1 -1
- package/package.json +4 -4
- package/src/algolia/downloads.ts +1 -2
- package/src/algolia/families.ts +2 -4
- package/src/algolia/models.ts +1 -2
- package/src/algolia/news.ts +1 -2
- package/src/algolia/pressRelease.ts +1 -2
- package/src/algolia/pressReview.ts +1 -2
- package/src/algolia/products.ts +1 -2
- package/src/algolia/projects.ts +1 -2
- package/src/algolia/stories.ts +1 -2
- package/src/algolia/subFamilies.ts +2 -4
- package/src/algolia/subModels.ts +1 -2
- package/src/downloads/import.ts +1 -1
- package/src/libs/contentful-cda.ts +7 -10
- package/src/libs/contentful.ts +8 -7
- package/src/libs/s3.ts +2 -2
- package/src/pim/endpoints.ts +8 -8
- package/src/pim/methods/bulkPublish.ts +1 -1
- package/src/pim/methods/dictionary.ts +1 -1
- package/src/pim/methods/families.ts +1 -1
- package/src/pim/methods/products.ts +7 -7
- package/types/algolia/clean.d.ts +1 -1
- package/types/algolia/config.d.ts +1 -1
- package/types/algolia/downloads.d.ts +1 -1
- package/types/algolia/families.d.ts +3 -3
- package/types/algolia/models.d.ts +1 -1
- package/types/algolia/news.d.ts +1 -1
- package/types/algolia/pressRelease.d.ts +1 -1
- package/types/algolia/pressReview.d.ts +1 -1
- package/types/algolia/products.d.ts +2 -2
- package/types/algolia/projects.d.ts +1 -1
- package/types/algolia/stories.d.ts +1 -1
- package/types/algolia/subFamilies.d.ts +1 -1
- package/types/algolia/subModels.d.ts +1 -1
- package/types/libs/contentful-cda.d.ts +2 -2
- package/types/libs/contentful.d.ts +10 -10
- package/types/libs/logs.d.ts +1 -1
- package/types/libs/pdf.d.ts +1 -1
- package/types/libs/s3.d.ts +1 -1
- package/types/pim/config.d.ts +1 -1
- package/types/pim/endpoints.d.ts +3 -3
- package/types/pim/methods/designers.d.ts +1 -1
- package/types/pim/methods/products.d.ts +3 -3
- package/types/resources/Audit.d.ts +1 -1
- package/types/types.d.ts +21 -21
- package/types/utils.d.ts +1 -1
|
@@ -48,11 +48,10 @@ const getSubFamilyPage = async (
|
|
|
48
48
|
// check if subFamily has many relations with model
|
|
49
49
|
log(`check if subFamily has many relations with model`);
|
|
50
50
|
const client = await getClient();
|
|
51
|
-
const { items: modelEntries } = await client.getEntries({
|
|
51
|
+
const { items: modelEntries } = await client.withAllLocales.getEntries({
|
|
52
52
|
content_type: "topicModel",
|
|
53
53
|
"fields.subFamily.sys.id": subFamilyPageId.replace("_PAGE", ""),
|
|
54
54
|
limit: 2,
|
|
55
|
-
locale: "*",
|
|
56
55
|
select: "sys,fields.catalog,fields.subFamily",
|
|
57
56
|
});
|
|
58
57
|
|
|
@@ -399,13 +398,12 @@ const getObjects = async (
|
|
|
399
398
|
content_type: "topicSubFamily",
|
|
400
399
|
limit,
|
|
401
400
|
skip: offset,
|
|
402
|
-
locale: "*",
|
|
403
401
|
select: "sys",
|
|
404
402
|
};
|
|
405
403
|
if (catalogCode) {
|
|
406
404
|
opts["fields.catalog.sys.id"] = catalogCode;
|
|
407
405
|
}
|
|
408
|
-
const { items, total } = await client.getEntries(opts);
|
|
406
|
+
const { items, total } = await client.withAllLocales.getEntries(opts);
|
|
409
407
|
|
|
410
408
|
const objects: AlgoliaFamilyRecord[] = [];
|
|
411
409
|
let count: number = Number(offset);
|
package/src/algolia/subModels.ts
CHANGED
|
@@ -282,13 +282,12 @@ const getObjects = async (
|
|
|
282
282
|
content_type: "topicSubModel",
|
|
283
283
|
limit,
|
|
284
284
|
skip: offset,
|
|
285
|
-
locale: "*",
|
|
286
285
|
select: topicSubModelSelect,
|
|
287
286
|
};
|
|
288
287
|
if (catalogCode) {
|
|
289
288
|
opts["fields.catalog.sys.id"] = catalogCode;
|
|
290
289
|
}
|
|
291
|
-
const { items, total } = await client.getEntries(opts);
|
|
290
|
+
const { items, total } = await client.withAllLocales.getEntries(opts);
|
|
292
291
|
|
|
293
292
|
const objects: AlgoliaSubModelRecord[] = [];
|
|
294
293
|
let count: number = Number(offset);
|
package/src/downloads/import.ts
CHANGED
|
@@ -175,7 +175,7 @@ const importFileToContentful = async (file: PostFile) => {
|
|
|
175
175
|
asset = await env.createAssetWithId(assetId, assetData);
|
|
176
176
|
asset = await asset.processForAllLocales();
|
|
177
177
|
asset = await asset.publish();
|
|
178
|
-
} catch (err) {
|
|
178
|
+
} catch (err: any) {
|
|
179
179
|
console.log(err);
|
|
180
180
|
log(`Import asset fail`, "WARN");
|
|
181
181
|
}
|
|
@@ -24,8 +24,8 @@ const config = {
|
|
|
24
24
|
previewAccessToken: process.env.FPI_CTF_PREVIEW_ACCESS_TOKEN,
|
|
25
25
|
accessToken: process.env.FPI_CTF_CDA_ACCESS_TOKEN,
|
|
26
26
|
environment: process.env.FPI_CTF_ENVIRONMENT,
|
|
27
|
-
removeUnresolved: process.env.FPI_CTF_REMOVE_UNRESOLVED === "1",
|
|
28
|
-
resolveLinks: process.env.FPI_CTF_RESOLVE_LINKS === "1",
|
|
27
|
+
// removeUnresolved: process.env.FPI_CTF_REMOVE_UNRESOLVED === "1",
|
|
28
|
+
// resolveLinks: process.env.FPI_CTF_RESOLVE_LINKS === "1",
|
|
29
29
|
previewEnabled: process.env.FPI_CTF_PREVIEW_ENABLED === "1",
|
|
30
30
|
host:
|
|
31
31
|
process.env.FPI_CTF_PREVIEW_ENABLED === "1"
|
|
@@ -40,8 +40,8 @@ const initClient = async () => {
|
|
|
40
40
|
? config.previewAccessToken || ""
|
|
41
41
|
: config.accessToken,
|
|
42
42
|
environment: config.environment || "master",
|
|
43
|
-
removeUnresolved: config.removeUnresolved,
|
|
44
|
-
resolveLinks: config.resolveLinks,
|
|
43
|
+
// removeUnresolved: config.removeUnresolved,
|
|
44
|
+
// resolveLinks: config.resolveLinks,
|
|
45
45
|
host: config.previewEnabled
|
|
46
46
|
? "preview.contentful.com"
|
|
47
47
|
: "cdn.contentful.com",
|
|
@@ -121,12 +121,11 @@ export const getEntryByID = async (
|
|
|
121
121
|
content_type: contentTypeId,
|
|
122
122
|
"sys.id": entryID,
|
|
123
123
|
limit: 1,
|
|
124
|
-
locale: "*",
|
|
125
124
|
select,
|
|
126
125
|
include: 1,
|
|
127
126
|
};
|
|
128
127
|
|
|
129
|
-
const entries = await client.getEntries(opts);
|
|
128
|
+
const entries = await client.withAllLocales.getEntries(opts);
|
|
130
129
|
|
|
131
130
|
return entries.items[0];
|
|
132
131
|
};
|
|
@@ -166,7 +165,6 @@ export const getAllEntries = async (
|
|
|
166
165
|
content_type: contentType,
|
|
167
166
|
limit,
|
|
168
167
|
skip,
|
|
169
|
-
locale: "*",
|
|
170
168
|
select,
|
|
171
169
|
include,
|
|
172
170
|
};
|
|
@@ -179,7 +177,7 @@ export const getAllEntries = async (
|
|
|
179
177
|
}
|
|
180
178
|
}
|
|
181
179
|
|
|
182
|
-
const { items, total } = await client.getEntries(opts);
|
|
180
|
+
const { items, total } = await client.withAllLocales.getEntries(opts);
|
|
183
181
|
|
|
184
182
|
allItems = [...allItems, ...(items || [])];
|
|
185
183
|
|
|
@@ -476,11 +474,10 @@ export const getTopicPage = async (
|
|
|
476
474
|
) => {
|
|
477
475
|
const client = await getClient();
|
|
478
476
|
|
|
479
|
-
const { items } = await client.getEntries({
|
|
477
|
+
const { items } = await client.withAllLocales.getEntries({
|
|
480
478
|
links_to_entry: topicId,
|
|
481
479
|
content_type: "page",
|
|
482
480
|
include: 2,
|
|
483
|
-
locale: "*",
|
|
484
481
|
select,
|
|
485
482
|
limit: 1,
|
|
486
483
|
});
|
package/src/libs/contentful.ts
CHANGED
|
@@ -221,7 +221,7 @@ export const createEntryWithId = async (
|
|
|
221
221
|
if (publish) {
|
|
222
222
|
try {
|
|
223
223
|
return await entry.publish();
|
|
224
|
-
} catch (err) {
|
|
224
|
+
} catch (err: any) {
|
|
225
225
|
log(`Cannot publish entry.`);
|
|
226
226
|
log(err);
|
|
227
227
|
}
|
|
@@ -250,7 +250,7 @@ export const updateEntry = async (
|
|
|
250
250
|
let entry = itemEntry;
|
|
251
251
|
try {
|
|
252
252
|
entry = await itemEntry.update();
|
|
253
|
-
} catch (err) {
|
|
253
|
+
} catch (err: any) {
|
|
254
254
|
log(`Cannot update entry.`);
|
|
255
255
|
log(err);
|
|
256
256
|
}
|
|
@@ -258,7 +258,7 @@ export const updateEntry = async (
|
|
|
258
258
|
if (publish) {
|
|
259
259
|
try {
|
|
260
260
|
return await entry.publish();
|
|
261
|
-
} catch (err) {
|
|
261
|
+
} catch (err: any) {
|
|
262
262
|
log(`Cannot publish entry.`);
|
|
263
263
|
log(err);
|
|
264
264
|
}
|
|
@@ -328,8 +328,8 @@ export const getAllEntriesByCodes = async (
|
|
|
328
328
|
let allItems: Entry[] = [];
|
|
329
329
|
let othersPagesToFetch = false;
|
|
330
330
|
let skip = 0;
|
|
331
|
-
const limit =
|
|
332
|
-
const chunkLimit =
|
|
331
|
+
const limit = 20;
|
|
332
|
+
const chunkLimit = 20;
|
|
333
333
|
const filterKey = `${filter}[in]`;
|
|
334
334
|
|
|
335
335
|
let codesChunks: any[] = [];
|
|
@@ -356,6 +356,7 @@ export const getAllEntriesByCodes = async (
|
|
|
356
356
|
opts[otherFilter.key] = otherFilter.value;
|
|
357
357
|
}
|
|
358
358
|
}
|
|
359
|
+
console.log("opts", opts);
|
|
359
360
|
const { items, total } = await env.getEntries(opts);
|
|
360
361
|
|
|
361
362
|
allItems = [...allItems, ...(items || [])];
|
|
@@ -734,7 +735,7 @@ export const deleteAllEntries = async (
|
|
|
734
735
|
} else {
|
|
735
736
|
log(`No entries found`);
|
|
736
737
|
}
|
|
737
|
-
} catch (err) {
|
|
738
|
+
} catch (err: any) {
|
|
738
739
|
log(err, "ERROR");
|
|
739
740
|
}
|
|
740
741
|
// await sleep(200);
|
|
@@ -796,7 +797,7 @@ export const deleteAllPages = async (types: string[]) => {
|
|
|
796
797
|
} else {
|
|
797
798
|
log(`No pages found`);
|
|
798
799
|
}
|
|
799
|
-
} catch (err) {
|
|
800
|
+
} catch (err: any) {
|
|
800
801
|
log(err, "ERROR");
|
|
801
802
|
}
|
|
802
803
|
// await sleep(200);
|
package/src/libs/s3.ts
CHANGED
|
@@ -163,7 +163,7 @@ export const getFileFromS3 = async (
|
|
|
163
163
|
} else {
|
|
164
164
|
return res.data;
|
|
165
165
|
}
|
|
166
|
-
} catch (err) {
|
|
166
|
+
} catch (err: any) {
|
|
167
167
|
log(`S3 file not found. ${url}`);
|
|
168
168
|
return false;
|
|
169
169
|
}
|
|
@@ -295,7 +295,7 @@ export const savePDFToS3 = async (
|
|
|
295
295
|
s3.getBucketWebsite();
|
|
296
296
|
await s3.putObject(s3Params).promise();
|
|
297
297
|
url = `https://${config.bucket}.s3.${config.region}.amazonaws.com/${path}${fileName}`;
|
|
298
|
-
} catch (err) {
|
|
298
|
+
} catch (err: any) {
|
|
299
299
|
console.log(err);
|
|
300
300
|
}
|
|
301
301
|
const timeEnd = new Date();
|
package/src/pim/endpoints.ts
CHANGED
|
@@ -63,7 +63,7 @@ export const getCatalogTaxonomiesHierarchy = async (
|
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
return catalogData;
|
|
66
|
-
} catch (err) {
|
|
66
|
+
} catch (err: any) {
|
|
67
67
|
throw new Error(err);
|
|
68
68
|
}
|
|
69
69
|
};
|
|
@@ -86,7 +86,7 @@ export const getDictionary = async () => {
|
|
|
86
86
|
log(`Request time: ${seconds} seconds - endpoint: dictionary`);
|
|
87
87
|
|
|
88
88
|
return data;
|
|
89
|
-
} catch (err) {
|
|
89
|
+
} catch (err: any) {
|
|
90
90
|
throw new Error(err);
|
|
91
91
|
}
|
|
92
92
|
};
|
|
@@ -126,7 +126,7 @@ export const getAllProducts = async (
|
|
|
126
126
|
log(`Request time: ${seconds} seconds - endpoint: products`);
|
|
127
127
|
|
|
128
128
|
return data;
|
|
129
|
-
} catch (err) {
|
|
129
|
+
} catch (err: any) {
|
|
130
130
|
throw new Error(err);
|
|
131
131
|
}
|
|
132
132
|
};
|
|
@@ -169,7 +169,7 @@ export const getLatestProducts = async (
|
|
|
169
169
|
log(`Request time: ${seconds} seconds - endpoint: latest-products/full`);
|
|
170
170
|
|
|
171
171
|
return data;
|
|
172
|
-
} catch (err) {
|
|
172
|
+
} catch (err: any) {
|
|
173
173
|
throw new Error(err);
|
|
174
174
|
}
|
|
175
175
|
};
|
|
@@ -191,7 +191,7 @@ export const getProductDetails = async (code: string) => {
|
|
|
191
191
|
log(`Request time: ${seconds} seconds - endpoint: product/full/${code}`);
|
|
192
192
|
|
|
193
193
|
return data;
|
|
194
|
-
} catch (err) {
|
|
194
|
+
} catch (err: any) {
|
|
195
195
|
throw new Error(err);
|
|
196
196
|
}
|
|
197
197
|
};
|
|
@@ -219,7 +219,7 @@ export const getAudit = async (lastModified: string = ""): Promise<Audit[]> => {
|
|
|
219
219
|
log(`Request time: ${seconds} seconds - endpoint: products/audit`);
|
|
220
220
|
|
|
221
221
|
return data;
|
|
222
|
-
} catch (err) {
|
|
222
|
+
} catch (err: any) {
|
|
223
223
|
throw new Error(err);
|
|
224
224
|
}
|
|
225
225
|
};
|
|
@@ -338,7 +338,7 @@ export const getOtherCatalogData = async <
|
|
|
338
338
|
log(`Request time: ${seconds} seconds - endpoint: ${endpoint}`);
|
|
339
339
|
|
|
340
340
|
return data;
|
|
341
|
-
} catch (err) {
|
|
341
|
+
} catch (err: any) {
|
|
342
342
|
throw new Error(err);
|
|
343
343
|
}
|
|
344
344
|
};
|
|
@@ -358,7 +358,7 @@ export const getFamilies = async (): Promise<FamilyDetails[]> => {
|
|
|
358
358
|
log(`Request time: ${seconds} seconds - endpoint: families`);
|
|
359
359
|
|
|
360
360
|
return data;
|
|
361
|
-
} catch (err) {
|
|
361
|
+
} catch (err: any) {
|
|
362
362
|
throw new Error(err);
|
|
363
363
|
}
|
|
364
364
|
};
|
|
@@ -249,7 +249,7 @@ export const publishAllProductDrafts = async (
|
|
|
249
249
|
const progress = Math.floor((count / items.length) * 100);
|
|
250
250
|
serverUtils.updateProgress(progress);
|
|
251
251
|
}
|
|
252
|
-
} catch (err) {
|
|
252
|
+
} catch (err: any) {
|
|
253
253
|
logMsg = `Publish entry ${item.sys.id} failed`;
|
|
254
254
|
if (serverUtils) {
|
|
255
255
|
serverUtils.log(logMsg);
|
|
@@ -97,7 +97,7 @@ import { setHideInRegionField } from "./products";
|
|
|
97
97
|
// );
|
|
98
98
|
// try {
|
|
99
99
|
// componentSubFamilyPages = await componentSubFamilyPages.publish();
|
|
100
|
-
// } catch (err) {
|
|
100
|
+
// } catch (err: any) {
|
|
101
101
|
// log(`Cannot publish entry.`);
|
|
102
102
|
// log(err);
|
|
103
103
|
// }
|
|
@@ -299,7 +299,7 @@ const isTermsToAdd = async (
|
|
|
299
299
|
if (productEntry.isPublished()) {
|
|
300
300
|
try {
|
|
301
301
|
productEntry = await productEntry.publish();
|
|
302
|
-
} catch (err) {
|
|
302
|
+
} catch (err: any) {
|
|
303
303
|
log(`Cannot publish entry.`);
|
|
304
304
|
log(err);
|
|
305
305
|
}
|
|
@@ -1497,7 +1497,7 @@ export const setProductRelationships = async (
|
|
|
1497
1497
|
try {
|
|
1498
1498
|
productEntry = await productEntry.publish();
|
|
1499
1499
|
log(`Published ${code} product`);
|
|
1500
|
-
} catch (err) {
|
|
1500
|
+
} catch (err: any) {
|
|
1501
1501
|
log(`Cannot publish entry.`);
|
|
1502
1502
|
log(err);
|
|
1503
1503
|
}
|
|
@@ -1758,7 +1758,7 @@ const productAudit = async (
|
|
|
1758
1758
|
try {
|
|
1759
1759
|
log(`Publish existing changes of entry ${productEntry.sys.id}.`);
|
|
1760
1760
|
productEntry = await productEntry.publish();
|
|
1761
|
-
} catch (err) {
|
|
1761
|
+
} catch (err: any) {
|
|
1762
1762
|
log(`Cannot publish changes of entry ${productEntry.sys.id}.`);
|
|
1763
1763
|
log(err);
|
|
1764
1764
|
}
|
|
@@ -1908,12 +1908,12 @@ const productAudit = async (
|
|
|
1908
1908
|
if (productEntry.isPublished()) {
|
|
1909
1909
|
try {
|
|
1910
1910
|
productEntry = await productEntry.publish();
|
|
1911
|
-
} catch (err) {
|
|
1911
|
+
} catch (err: any) {
|
|
1912
1912
|
log(`Cannot publish entry ${productEntry.sys.id}.`);
|
|
1913
1913
|
log(err);
|
|
1914
1914
|
}
|
|
1915
1915
|
}
|
|
1916
|
-
} catch (err) {
|
|
1916
|
+
} catch (err: any) {
|
|
1917
1917
|
log(`Cannot update entry ${productEntry.sys.id}.`);
|
|
1918
1918
|
log(err);
|
|
1919
1919
|
}
|
|
@@ -2465,7 +2465,7 @@ export const generateTechSpecPdf = async (
|
|
|
2465
2465
|
if (topicProduct.isPublished()) {
|
|
2466
2466
|
try {
|
|
2467
2467
|
topicProduct = await topicProduct.publish();
|
|
2468
|
-
} catch (err) {
|
|
2468
|
+
} catch (err: any) {
|
|
2469
2469
|
log(`Cannot publish entry.`);
|
|
2470
2470
|
log(err);
|
|
2471
2471
|
}
|
|
@@ -3132,7 +3132,7 @@ export const populateDestinations = async (offset: number, limit: number) => {
|
|
|
3132
3132
|
if (productEntry.isPublished()) {
|
|
3133
3133
|
try {
|
|
3134
3134
|
productEntry = await productEntry.publish();
|
|
3135
|
-
} catch (err) {
|
|
3135
|
+
} catch (err: any) {
|
|
3136
3136
|
log(`Cannot publish entry.`);
|
|
3137
3137
|
log(err);
|
|
3138
3138
|
}
|
package/types/algolia/clean.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AvailableCatalogs, AvailableEntryStatus } from "../types";
|
|
2
2
|
import { AvailableIndicesKey } from "./config";
|
|
3
|
-
export declare const removeRecordsByStatus: (indexKey: AvailableIndicesKey, offset?: number, limit?: number, status?: AvailableEntryStatus, catalogCode?: AvailableCatalogs
|
|
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;
|
|
6
6
|
limit: number;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export
|
|
1
|
+
export type AvailableIndicesKey = "products" | "families" | "subFamilies" | "subModels" | "models" | "downloads" | "projects" | "stories" | "pressReviews" | "pressRelease" | "news";
|
|
2
2
|
export declare const getClient: () => import("algoliasearch").SearchClient;
|
|
3
3
|
export declare const getIndicesSettings: () => {
|
|
4
4
|
products: {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CfLocalizedEntryField, TopicDetailsResponse, WrapperImageFields } from "../types";
|
|
2
|
-
export
|
|
2
|
+
export type AlgoliaDownloadRecord = {
|
|
3
3
|
objectID: string;
|
|
4
4
|
name?: CfLocalizedEntryField;
|
|
5
5
|
thumbnailImgix?: WrapperImageFields | {};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { CfLocalizedEntryField, TopicDetailsResponse, TopicProductFieldsResponse, WrapperImageFields, AvailableCatalogs } from "../types";
|
|
2
|
-
export
|
|
2
|
+
export type pageResponse = {
|
|
3
3
|
slugs: {};
|
|
4
4
|
type: string;
|
|
5
5
|
details?: {};
|
|
6
6
|
} | null;
|
|
7
|
-
export
|
|
7
|
+
export type AlgoliaFamilyRecord = {
|
|
8
8
|
objectID: string;
|
|
9
9
|
names: CfLocalizedEntryField;
|
|
10
10
|
code: string;
|
|
@@ -20,7 +20,7 @@ export declare type AlgoliaFamilyRecord = {
|
|
|
20
20
|
destinations?: string[];
|
|
21
21
|
lastSyncDate: string;
|
|
22
22
|
};
|
|
23
|
-
export declare const reindexFamilies: (offset?: number, limit?: number, catalogCode?: AvailableCatalogs
|
|
23
|
+
export declare const reindexFamilies: (offset?: number, limit?: number, catalogCode?: AvailableCatalogs) => Promise<{
|
|
24
24
|
savedObjectIDs: string[];
|
|
25
25
|
deletedObjectIDs: string[];
|
|
26
26
|
objects: Readonly<Record<string, any>>[];
|
|
@@ -21,7 +21,7 @@ export declare const reindexModel: (topicModelId: string) => Promise<{
|
|
|
21
21
|
destinations?: string[] | undefined;
|
|
22
22
|
taskID: number;
|
|
23
23
|
}>;
|
|
24
|
-
export declare const reindexModels: (offset?: number, limit?: number, catalogCode?: AvailableCatalogs
|
|
24
|
+
export declare const reindexModels: (offset?: number, limit?: number, catalogCode?: AvailableCatalogs) => Promise<{
|
|
25
25
|
savedObjectIDs: string[];
|
|
26
26
|
deletedObjectIDs: string[];
|
|
27
27
|
objects: Readonly<Record<string, any>>[];
|
package/types/algolia/news.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CfLocalizedEntryField, TopicDetailsResponse, WrapperImageFields, AlgoliaObjectFilter } from "../types";
|
|
2
|
-
export
|
|
2
|
+
export type AlgoliaProductRecord = {
|
|
3
3
|
objectID: string;
|
|
4
4
|
name?: string;
|
|
5
5
|
names?: CfLocalizedEntryField;
|
|
@@ -69,7 +69,7 @@ export declare const reindexProduct: (topicProductId: string, generatePdf?: bool
|
|
|
69
69
|
lastSyncDate?: string | undefined;
|
|
70
70
|
taskID: number;
|
|
71
71
|
}>;
|
|
72
|
-
export declare const reindexProducts: (filterKey: string, filterValue: string, offset?: number, limit?: number, lastPimSyncDateGte?: string
|
|
72
|
+
export declare const reindexProducts: (filterKey: string, filterValue: string, offset?: number, limit?: number, lastPimSyncDateGte?: string, generatePdf?: boolean, filters?: AlgoliaObjectFilter[]) => Promise<{
|
|
73
73
|
savedObjectIDs: string[];
|
|
74
74
|
deletedObjectIDs: string[];
|
|
75
75
|
objects: Readonly<Record<string, any>>[];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AvailableCatalogs } from "../types";
|
|
2
|
-
export declare const reindexSubFamilies: (offset?: number, limit?: number, catalogCode?: AvailableCatalogs
|
|
2
|
+
export declare const reindexSubFamilies: (offset?: number, limit?: number, catalogCode?: AvailableCatalogs) => Promise<{
|
|
3
3
|
savedObjectIDs: string[];
|
|
4
4
|
deletedObjectIDs: string[];
|
|
5
5
|
objects: Readonly<Record<string, any>>[];
|
|
@@ -17,7 +17,7 @@ export declare const reindexSubModel: (topicSubModelId: string) => Promise<{
|
|
|
17
17
|
lastSyncDate?: string | undefined;
|
|
18
18
|
taskID: number;
|
|
19
19
|
}>;
|
|
20
|
-
export declare const reindexSubModels: (offset?: number, limit?: number, catalogCode?: AvailableCatalogs
|
|
20
|
+
export declare const reindexSubModels: (offset?: number, limit?: number, catalogCode?: AvailableCatalogs) => Promise<{
|
|
21
21
|
savedObjectIDs: string[];
|
|
22
22
|
deletedObjectIDs: string[];
|
|
23
23
|
objects: Readonly<Record<string, any>>[];
|
|
@@ -4,8 +4,8 @@ import { TopicDetailsResponse, AssetPropFieldsWithoutLocaleKey, OtherFilters } f
|
|
|
4
4
|
export declare const getClient: () => Promise<any>;
|
|
5
5
|
export declare const getEnvironmentDefaultLocale: () => Promise<Locale>;
|
|
6
6
|
export declare const getEnvironmentDefaultLocaleCode: () => Promise<string>;
|
|
7
|
-
export declare const getEntryByID: (entryID: string, contentTypeId: string, select?: string
|
|
8
|
-
export declare const getAllEntries: (contentType: string, select?: string
|
|
7
|
+
export declare const getEntryByID: (entryID: string, contentTypeId: string, select?: string) => Promise<Entry>;
|
|
8
|
+
export declare const getAllEntries: (contentType: string, select?: string, filterKey?: string, filterValue?: string, limit?: number, otherFilters?: OtherFilters[], include?: number) => Promise<Entry[]>;
|
|
9
9
|
export declare const getAssetDetails: (assetId: string) => Promise<AssetPropFieldsWithoutLocaleKey>;
|
|
10
10
|
export declare const getEntryImageDetails: (entry: Entry, fieldKey: string) => Promise<string>;
|
|
11
11
|
export declare const getTopicDetails: (topicEntry: Entry, fieldKey: string, contentType: string, showRelatedEntities?: boolean, isCatalogEntry?: boolean, skipPageSlugs?: boolean) => Promise<TopicDetailsResponse[]>;
|
|
@@ -2,7 +2,7 @@ import type { Entry, CreateEntryProps, EntryProps } from "contentful-management/
|
|
|
2
2
|
import type { QueryOptions } from "contentful-management/dist/typings/common-types";
|
|
3
3
|
import { Environment, Locale, CreateAssetProps } from "contentful-management/types";
|
|
4
4
|
import { ContentfulLocale, AvailableCatalogs, TopicDetailsResponse, AssetPropFields, OtherFilters, WrapperImageFields } from "../types";
|
|
5
|
-
export
|
|
5
|
+
export type Config = {
|
|
6
6
|
accessToken: string;
|
|
7
7
|
spaceId: string;
|
|
8
8
|
environmentId: string;
|
|
@@ -13,7 +13,7 @@ export declare let defaultEnvironmentLocale: Locale;
|
|
|
13
13
|
export declare let defaultEnvironmentLocaleCode: string;
|
|
14
14
|
export declare const cfLocales: ContentfulLocale[];
|
|
15
15
|
export declare const checkConfig: (skipInit?: boolean) => boolean;
|
|
16
|
-
export declare const init: (opts?: Config
|
|
16
|
+
export declare const init: (opts?: Config) => void;
|
|
17
17
|
export declare const getConfig: () => Config;
|
|
18
18
|
export declare const getEnvironment: () => Promise<Environment>;
|
|
19
19
|
export declare const getEnvironmentDefaultLocale: () => Promise<Locale>;
|
|
@@ -22,13 +22,13 @@ export declare const getEnvironmentDefaultLocaleCode: () => Promise<string>;
|
|
|
22
22
|
export declare const uploadFile: (asset: CreateAssetProps) => Promise<any>;
|
|
23
23
|
export declare const createEntryWithId: (contentTypeId: string, id: string, data: CreateEntryProps, publish?: boolean) => Promise<Entry>;
|
|
24
24
|
export declare const updateEntry: (itemEntry: Entry, data: CreateEntryProps, publish?: boolean) => Promise<Entry>;
|
|
25
|
-
export declare const getEntryByCode: (code: string, contentTypeId: string, select?: string
|
|
26
|
-
export declare const getAllEntriesByCodes: (codes: string[], contentTypeId: string, select?: string
|
|
27
|
-
export declare const getAllEntries: (contentType: string, select?: string
|
|
28
|
-
export declare const getEntryByID: (entryID: string, contentTypeId: string, select?: string
|
|
25
|
+
export declare const getEntryByCode: (code: string, contentTypeId: string, select?: string) => Promise<Entry>;
|
|
26
|
+
export declare const getAllEntriesByCodes: (codes: string[], contentTypeId: string, select?: string, filter?: string, otherFilters?: OtherFilters[]) => Promise<Entry[]>;
|
|
27
|
+
export declare const getAllEntries: (contentType: string, select?: string, filterKey?: string, filterValue?: string, limit?: number) => Promise<Entry[]>;
|
|
28
|
+
export declare const getEntryByID: (entryID: string, contentTypeId: string, select?: string, locale?: string) => Promise<Entry>;
|
|
29
29
|
export declare const initBaseEntries: () => Promise<boolean>;
|
|
30
|
-
export declare const getDefaultProfessionalPageContentData: (pageContentEntry: Entry, pageContentData: CreateEntryProps) => Promise<CreateEntryProps
|
|
31
|
-
export declare const deleteAllEntries: (contentType: string, catalogCode?: AvailableCatalogs
|
|
30
|
+
export declare const getDefaultProfessionalPageContentData: (pageContentEntry: Entry, pageContentData: CreateEntryProps) => Promise<CreateEntryProps>;
|
|
31
|
+
export declare const deleteAllEntries: (contentType: string, catalogCode?: AvailableCatalogs) => Promise<{
|
|
32
32
|
deleted: number;
|
|
33
33
|
total: number;
|
|
34
34
|
}>;
|
|
@@ -40,14 +40,14 @@ export declare const deletePages: (types: string[], limit?: number) => Promise<{
|
|
|
40
40
|
deleted: number;
|
|
41
41
|
total: number;
|
|
42
42
|
}>;
|
|
43
|
-
export declare const deleteEntries: (contentType: string, catalogCode?: AvailableCatalogs
|
|
43
|
+
export declare const deleteEntries: (contentType: string, catalogCode?: AvailableCatalogs, limit?: number) => Promise<{
|
|
44
44
|
deleted: number;
|
|
45
45
|
total: number;
|
|
46
46
|
}>;
|
|
47
47
|
export declare const addToRelationFields: (entry: Entry | any, fieldKey: string, entrySysIdValue: string, manyReferences?: boolean, resetOldValues?: boolean, linkType?: "Asset" | "Entry") => Promise<Entry>;
|
|
48
48
|
export declare const removeFromRelationFields: (entry: Entry | any, fieldKey: string, entrySysIdValue: string, manyReferences?: boolean) => Promise<any>;
|
|
49
49
|
export declare const removeFromFieldObject: (entry: Entry | any, fieldKey: string, entrySysIdValues: string | string[]) => Promise<any>;
|
|
50
|
-
export declare const addFieldValue: (entry: Entry | any, fieldKey: string, fieldValue: any, manyReferences?: boolean, locale?: string
|
|
50
|
+
export declare const addFieldValue: (entry: Entry | any, fieldKey: string, fieldValue: any, manyReferences?: boolean, locale?: string) => Promise<any>;
|
|
51
51
|
export declare const getTopicDetails: (topicEntry: Entry, fieldKey: string, contentType: string, showRelatedEntities?: boolean, isCatalogEntry?: boolean, skipPageSlugs?: boolean) => Promise<TopicDetailsResponse[]>;
|
|
52
52
|
export declare const getAssetDetails: (assetId: string) => Promise<AssetPropFields>;
|
|
53
53
|
export declare const getEntryImageDetails: (entry: Entry, fieldKey: string) => Promise<string>;
|
package/types/libs/logs.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import winston from "winston";
|
|
2
|
-
export
|
|
2
|
+
export type LogLevels = "VERBOSE" | "DEBUG" | "INFO" | "WARN" | "ERROR" | "SILLY" | "HTTP";
|
|
3
3
|
export declare const logStatus = true;
|
|
4
4
|
export declare let serverUtils: any;
|
|
5
5
|
export declare const setLogId: (id: string) => void;
|
package/types/libs/pdf.d.ts
CHANGED
|
@@ -13,5 +13,5 @@ interface PDFHeaderAndFooter {
|
|
|
13
13
|
header?: HeaderColumns;
|
|
14
14
|
footer?: FooterColumns;
|
|
15
15
|
}
|
|
16
|
-
export declare const generatePDFByUrl: (url: string, fileName?: string, contents?: PDFHeaderAndFooter
|
|
16
|
+
export declare const generatePDFByUrl: (url: string, fileName?: string, contents?: PDFHeaderAndFooter) => Promise<any>;
|
|
17
17
|
export {};
|
package/types/libs/s3.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ interface Config extends AWSConfig {
|
|
|
11
11
|
export declare let config: Config;
|
|
12
12
|
export declare let s3: AWS.S3;
|
|
13
13
|
export declare const checkConfig: (skipInit?: boolean) => void;
|
|
14
|
-
export declare const init: (opts?: Config
|
|
14
|
+
export declare const init: (opts?: Config) => void;
|
|
15
15
|
export declare const listObjects: (prefix?: string) => Promise<import("aws-sdk/lib/request").PromiseResult<AWS.S3.ListObjectsV2Output, AWS.AWSError>>;
|
|
16
16
|
export declare const upload: (url: string, fileName?: string, path?: string, metaData?: any) => Promise<AWS.S3.ManagedUpload.SendData>;
|
|
17
17
|
export declare const getFileFromS3: (path: string, returnUrl?: boolean) => Promise<any>;
|
package/types/pim/config.d.ts
CHANGED
|
@@ -9,5 +9,5 @@ export declare const defaultConfig: Readonly<Config>;
|
|
|
9
9
|
export declare let config: Config;
|
|
10
10
|
export declare const resetConfig: () => void;
|
|
11
11
|
export declare const checkConfig: (skipInit?: boolean) => void;
|
|
12
|
-
export declare const init: (providedConfig?: Config
|
|
12
|
+
export declare const init: (providedConfig?: Config) => void;
|
|
13
13
|
export declare const getConfig: () => Readonly<Config>;
|
package/types/pim/endpoints.d.ts
CHANGED
|
@@ -5,16 +5,16 @@ import { CollectionModels } from "../resources/CollectionModels";
|
|
|
5
5
|
import { CollectionSubModels } from "../resources/CollectionSubModels";
|
|
6
6
|
import { CollectionSubFamilies } from "../resources/CollectionSubFamilies";
|
|
7
7
|
import { FamilyDetails } from "../resources/FamilyDetails";
|
|
8
|
-
|
|
8
|
+
type AvailableOtherCatalogDataEndpoint = "models" | "submodels" | "subfamilies";
|
|
9
9
|
export declare const getPimDomain: () => string;
|
|
10
|
-
export declare const getCatalogTaxonomiesHierarchy: (catalogCode: AvailableCatalogs, jsonFile?: null
|
|
10
|
+
export declare const getCatalogTaxonomiesHierarchy: (catalogCode: AvailableCatalogs, jsonFile?: null) => Promise<CatalogDetails>;
|
|
11
11
|
export declare const getDictionary: () => Promise<any>;
|
|
12
12
|
export declare const getAllProducts: (lastModified?: string | null, catalogCode?: AvailableCatalogs | null) => Promise<any>;
|
|
13
13
|
export declare const getLatestProducts: (catalogCode: AvailableCatalogs, lastModified: string, offset?: number, limit?: number, lastModifiedTo?: string) => Promise<any>;
|
|
14
14
|
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
18
|
export declare const getOtherCatalogData: <T extends AvailableOtherCatalogCollection>(endpoint: AvailableOtherCatalogDataEndpoint, offset?: number, limit?: number) => Promise<T>;
|
|
19
19
|
export declare const getFamilies: () => Promise<FamilyDetails[]>;
|
|
20
20
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Entry, CreateEntryProps } from "contentful-management/dist/typings/entities/entry";
|
|
2
2
|
import { GenericData } from "../../resources/ProductDetails";
|
|
3
|
-
export declare const getDesignerData: (designer: GenericData) => Promise<CreateEntryProps
|
|
3
|
+
export declare const getDesignerData: (designer: GenericData) => Promise<CreateEntryProps>;
|
|
4
4
|
export declare const addDesignerData: (data: any, designer: GenericData, manyReferences?: boolean) => Promise<any>;
|
|
5
5
|
export declare const importDesigner: (designer: GenericData, skipUpdate?: boolean) => Promise<Entry>;
|
|
6
6
|
export declare const importDesigners: () => Promise<void>;
|