pim-import 4.3.0 → 4.4.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/downloads.js +2 -2
- package/dist/algolia/downloads.js.map +1 -1
- package/dist/algolia/families.js +2 -2
- package/dist/algolia/families.js.map +1 -1
- package/dist/algolia/models.js +5 -5
- package/dist/algolia/models.js.map +1 -1
- package/dist/algolia/news.js +3 -3
- package/dist/algolia/news.js.map +1 -1
- package/dist/algolia/pressRelease.js +3 -3
- package/dist/algolia/pressRelease.js.map +1 -1
- package/dist/algolia/pressReview.js +1 -1
- package/dist/algolia/pressReview.js.map +1 -1
- package/dist/algolia/products.js +20 -20
- package/dist/algolia/products.js.map +1 -1
- package/dist/algolia/projects.js +1 -1
- package/dist/algolia/projects.js.map +1 -1
- package/dist/algolia/stories.js +8 -10
- package/dist/algolia/stories.js.map +1 -1
- package/dist/algolia/subFamilies.js +5 -5
- package/dist/algolia/subFamilies.js.map +1 -1
- package/dist/algolia/subModels.js +6 -6
- package/dist/algolia/subModels.js.map +1 -1
- package/dist/index.js +2 -2
- package/dist/libs/contentful-cda.js +6 -11
- package/dist/libs/contentful-cda.js.map +1 -1
- package/dist/libs/contentful.js +13 -19
- package/dist/libs/contentful.js.map +1 -1
- package/dist/libs/imgix.js +3 -3
- package/dist/libs/imgix.js.map +1 -1
- package/dist/pim/methods/bulkPublish.js +37 -18
- package/dist/pim/methods/bulkPublish.js.map +1 -1
- package/dist/utils.js +11 -1
- package/dist/utils.js.map +1 -1
- package/package.json +1 -1
- package/src/algolia/downloads.ts +1 -3
- package/src/algolia/families.ts +2 -4
- package/src/algolia/models.ts +4 -7
- package/src/algolia/news.ts +10 -4
- package/src/algolia/pressRelease.ts +11 -4
- package/src/algolia/pressReview.ts +8 -2
- package/src/algolia/products.ts +9 -26
- package/src/algolia/projects.ts +6 -2
- package/src/algolia/stories.ts +21 -12
- package/src/algolia/subFamilies.ts +9 -9
- package/src/algolia/subModels.ts +10 -10
- package/src/index.ts +1 -1
- package/src/libs/contentful-cda.ts +17 -15
- package/src/libs/contentful.ts +15 -24
- package/src/libs/imgix.ts +6 -4
- package/src/pim/methods/bulkPublish.ts +38 -19
- package/src/utils.ts +22 -0
- package/types/index.d.ts +1 -1
- package/types/libs/contentful-cda.d.ts +1 -1
- package/types/libs/contentful.d.ts +1 -1
- package/types/pim/methods/bulkPublish.d.ts +5 -2
- package/types/utils.d.ts +1 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bulkPublish.js","sourceRoot":"","sources":["../../../src/pim/methods/bulkPublish.ts"],"names":[],"mappings":";;;AAEA,sDAI+B;AAC/B,
|
|
1
|
+
{"version":3,"file":"bulkPublish.js","sourceRoot":"","sources":["../../../src/pim/methods/bulkPublish.ts"],"names":[],"mappings":";;;AAEA,sDAI+B;AAC/B,0CAAmD;AACnD,yCAAoD;AACpD,qDAAwD;AAExD,MAAM,YAAY,GAAG,KAAK,EAAE,OAAe,EAAE,IAAY,EAAE,EAAE;IAC3D,MAAM,KAAK,GAAG,MAAM,yBAAY,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IAChD,IAAI,KAAK,IAAI,KAAK,CAAC,OAAO,EAAE,EAAE;QAC5B,UAAG,CAAC,iBAAiB,OAAO,cAAc,IAAI,EAAE,CAAC,CAAC;QAClD,MAAM,KAAK,CAAC,OAAO,EAAE,CAAC;KACvB;SAAM,IAAI,CAAC,KAAK,EAAE;QACjB,UAAG,CAAC,mBAAmB,OAAO,cAAc,IAAI,EAAE,EAAE,MAAM,CAAC,CAAC;KAC7D;AACH,CAAC,CAAC;AAEK,MAAM,mBAAmB,GAAG,KAAK,EAAE,YAAmB,EAAE,EAAE;IAC/D,MAAM,gBAAgB,GAAG,MAAM,4CAA+B,EAAE,CAAC;IAGjE,MAAM,MAAM,GAAG,iCAAsB,CAAC,YAAY,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAC3D,MAAM,YAAY,CAAC,M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CAAC,CAAC;iBACzB;gBACD,MAAM,2BAAmB,CAAC,IAAI,CAAC,CAAC;gBAChC,MAAM,GAAG,oBAAoB,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC;gBAC3C,IAAI,kBAAW,EAAE;oBACf,kBAAW,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;iBACzB;gBACD,MAAM,yBAAc,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC;gBAExC,IAAI,kBAAW,EAAE;oBACf,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,GAAG,GAAG,CAAC,CAAC;oBAC1D,kBAAW,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC;iBACtC;aACF;YAAC,OAAO,GAAG,EAAE;gBACZ,MAAM,GAAG,iBAAiB,IAAI,CAAC,GAAG,CAAC,EAAE,SAAS,CAAC;gBAC/C,IAAI,kBAAW,EAAE;oBACf,kBAAW,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;iBACzB;aACF;SACF;KACF;IAED,MAAM,SAAS,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC;IACzC,OAAO;QACL,SAAS;QACT,KAAK;KACN,CAAC;AACJ,CAAC,CAAC;AArEW,QAAA,uBAAuB,2BAqElC"}
|
package/dist/utils.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.replaceAll = exports.addProductFieldValueCodesByPimDetails = exports.keysToLowerCase = exports.capitalizeFirstLetter = exports.getLocalISOTime = exports.doChunk = exports.sanitizeValue = exports.getUnwantedValues = exports.getPimTranslations = exports.getLocale = exports.pimLocaleMap = exports.stringToSlug = exports.secondBetweenTwoDate = exports.basename = exports.getBaseURL = exports.sleep = exports.mergeObjects = void 0;
|
|
3
|
+
exports.getAllTranslations = exports.replaceAll = exports.addProductFieldValueCodesByPimDetails = exports.keysToLowerCase = exports.capitalizeFirstLetter = exports.getLocalISOTime = exports.doChunk = exports.sanitizeValue = exports.getUnwantedValues = exports.getPimTranslations = exports.getLocale = exports.pimLocaleMap = exports.stringToSlug = exports.secondBetweenTwoDate = exports.basename = exports.getBaseURL = exports.sleep = exports.mergeObjects = void 0;
|
|
4
4
|
const logs_1 = require("./libs/logs");
|
|
5
|
+
const contentful_1 = require("./libs/contentful");
|
|
5
6
|
const mergeObjects = (objA, objB) => {
|
|
6
7
|
return { ...objA, ...objB };
|
|
7
8
|
};
|
|
@@ -171,4 +172,13 @@ const replaceAll = (original, from, to) => {
|
|
|
171
172
|
return original.replace(regExp, to);
|
|
172
173
|
};
|
|
173
174
|
exports.replaceAll = replaceAll;
|
|
175
|
+
const getAllTranslations = async (values) => {
|
|
176
|
+
const defaultLocale = await contentful_1.getEnvironmentDefaultLocaleCode();
|
|
177
|
+
const newValue = {};
|
|
178
|
+
for (const locale of contentful_1.cfLocales) {
|
|
179
|
+
newValue[locale] = values?.[locale] || values[defaultLocale] || "";
|
|
180
|
+
}
|
|
181
|
+
return exports.keysToLowerCase(newValue);
|
|
182
|
+
};
|
|
183
|
+
exports.getAllTranslations = getAllTranslations;
|
|
174
184
|
//# sourceMappingURL=utils.js.map
|
package/dist/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";;;AASA,sCAAkC;
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";;;AASA,sCAAkC;AAClC,kDAA+E;AAcxE,MAAM,YAAY,GAAG,CAC1B,IAAO,EACP,IAAO,EACP,EAAE;IACF,OAAO,EAAE,GAAG,IAAI,EAAE,GAAG,IAAI,EAAE,CAAC;AAC9B,CAAC,CAAC;AALW,QAAA,YAAY,gBAKvB;AAEK,MAAM,KAAK,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AAC;AAHW,QAAA,UAAU,cAGrB;AAYK,MAAM,kBAAkB,GAAG,KAAK,EAAE,MAAW,EAAE,EAAE;IACtD,MAAM,aAAa,GAAG,MAAM,4CAA+B,EAAE,CAAC;IAE9D,MAAM,QAAQ,GAAQ,EAAE,CAAC;IACzB,KAAK,MAAM,MAAM,IAAI,sBAAS,EAAE;QAC9B,QAAQ,CAAC,MAAM,CAAC,GAAG,MAAM,EAAE,CAAC,MAAM,CAAC,IAAI,MAAM,CAAC,aAAa,CAAC,IAAI,EAAE,CAAC;KACpE;IAED,OAAO,uBAAe,CAAC,QAAQ,CAAC,CAAC;AACnC,CAAC,CAAC;AATW,QAAA,kBAAkB,sBAS7B"}
|
package/package.json
CHANGED
package/src/algolia/downloads.ts
CHANGED
|
@@ -117,8 +117,7 @@ const getObject = async (
|
|
|
117
117
|
const catalogs = await getTopicDetails(
|
|
118
118
|
topicDownloadWithFields,
|
|
119
119
|
"catalogs",
|
|
120
|
-
"topicCatalog"
|
|
121
|
-
true
|
|
120
|
+
"topicCatalog"
|
|
122
121
|
);
|
|
123
122
|
|
|
124
123
|
log(`Get category details...`);
|
|
@@ -126,7 +125,6 @@ const getObject = async (
|
|
|
126
125
|
topicDownloadWithFields,
|
|
127
126
|
"category",
|
|
128
127
|
"topicDownloadCategory",
|
|
129
|
-
true,
|
|
130
128
|
false,
|
|
131
129
|
false
|
|
132
130
|
);
|
package/src/algolia/families.ts
CHANGED
|
@@ -304,8 +304,7 @@ const getObject = async (topicFamily: Entry): Promise<AlgoliaFamilyRecord> => {
|
|
|
304
304
|
const catalogs = await getTopicDetails(
|
|
305
305
|
topicFamilyWithFields,
|
|
306
306
|
"catalogs",
|
|
307
|
-
"topicCatalog"
|
|
308
|
-
true
|
|
307
|
+
"topicCatalog"
|
|
309
308
|
);
|
|
310
309
|
log(`${catalogs?.length} catalogs founded`);
|
|
311
310
|
|
|
@@ -313,8 +312,7 @@ const getObject = async (topicFamily: Entry): Promise<AlgoliaFamilyRecord> => {
|
|
|
313
312
|
const categories = await getTopicDetails(
|
|
314
313
|
topicFamilyWithFields,
|
|
315
314
|
"categories",
|
|
316
|
-
"topicCategory"
|
|
317
|
-
true
|
|
315
|
+
"topicCategory"
|
|
318
316
|
);
|
|
319
317
|
log(`${categories?.length} categories founded`);
|
|
320
318
|
|
package/src/algolia/models.ts
CHANGED
|
@@ -23,6 +23,7 @@ import {
|
|
|
23
23
|
secondBetweenTwoDate,
|
|
24
24
|
capitalizeFirstLetter,
|
|
25
25
|
keysToLowerCase,
|
|
26
|
+
getAllTranslations,
|
|
26
27
|
} from "../utils";
|
|
27
28
|
import { getWrapperImgixFields } from "../libs/imgix";
|
|
28
29
|
|
|
@@ -157,7 +158,7 @@ const getObject = async (
|
|
|
157
158
|
"page",
|
|
158
159
|
"fields.slug,fields.type,fields.protected"
|
|
159
160
|
);
|
|
160
|
-
const slugs = modelPage?.fields?.slug;
|
|
161
|
+
const slugs = await getAllTranslations(modelPage?.fields?.slug || {});
|
|
161
162
|
const isProtected =
|
|
162
163
|
!!modelPage?.fields?.protected?.[defaultEnvironmentLocaleCode];
|
|
163
164
|
|
|
@@ -165,8 +166,7 @@ const getObject = async (
|
|
|
165
166
|
const catalogs = await getTopicDetails(
|
|
166
167
|
topicModelWithFields,
|
|
167
168
|
"catalog",
|
|
168
|
-
"topicCatalog"
|
|
169
|
-
true
|
|
169
|
+
"topicCatalog"
|
|
170
170
|
);
|
|
171
171
|
const catalog = catalogs?.[0];
|
|
172
172
|
const catalogId = catalog?.code;
|
|
@@ -181,8 +181,7 @@ const getObject = async (
|
|
|
181
181
|
const productLines = await getTopicDetails(
|
|
182
182
|
topicModelWithFields,
|
|
183
183
|
"productLine",
|
|
184
|
-
"topicProductLine"
|
|
185
|
-
true
|
|
184
|
+
"topicProductLine"
|
|
186
185
|
);
|
|
187
186
|
const productLine = productLines?.[0];
|
|
188
187
|
|
|
@@ -191,7 +190,6 @@ const getObject = async (
|
|
|
191
190
|
topicModelWithFields,
|
|
192
191
|
"subFamily",
|
|
193
192
|
"topicSubFamily",
|
|
194
|
-
true,
|
|
195
193
|
false,
|
|
196
194
|
true,
|
|
197
195
|
true
|
|
@@ -213,7 +211,6 @@ const getObject = async (
|
|
|
213
211
|
topicSubFamily,
|
|
214
212
|
"designer",
|
|
215
213
|
"topicDesigner",
|
|
216
|
-
true,
|
|
217
214
|
false,
|
|
218
215
|
true,
|
|
219
216
|
true
|
package/src/algolia/news.ts
CHANGED
|
@@ -6,7 +6,11 @@ import {
|
|
|
6
6
|
getTopicPage,
|
|
7
7
|
} from "../libs/contentful-cda";
|
|
8
8
|
import { getIndex, AvailableIndicesKey, removeIndexObject } from "./config";
|
|
9
|
-
import {
|
|
9
|
+
import {
|
|
10
|
+
getAllTranslations,
|
|
11
|
+
getLocalISOTime,
|
|
12
|
+
secondBetweenTwoDate,
|
|
13
|
+
} from "../utils";
|
|
10
14
|
import type { Entry } from "contentful-management/dist/typings/entities/entry";
|
|
11
15
|
import {
|
|
12
16
|
CfLocalizedEntryField,
|
|
@@ -72,7 +76,7 @@ const getObject = async (topicNews: Entry): Promise<AlgoliaPostRecord> => {
|
|
|
72
76
|
return recordFail; // return objectID to delete the record if it exists
|
|
73
77
|
}
|
|
74
78
|
|
|
75
|
-
const slugs = page?.fields.slug || {};
|
|
79
|
+
const slugs = await getAllTranslations(page?.fields.slug || {});
|
|
76
80
|
const isProtected = !!page?.fields?.protected?.[defaultEnvironmentLocaleCode];
|
|
77
81
|
|
|
78
82
|
log(`Get thumbnail imgix details...`);
|
|
@@ -106,10 +110,12 @@ const getObject = async (topicNews: Entry): Promise<AlgoliaPostRecord> => {
|
|
|
106
110
|
// Single record
|
|
107
111
|
const record: AlgoliaPostRecord = {
|
|
108
112
|
objectID: topicNewsWithFields.sys.id,
|
|
109
|
-
name: page?.fields?.title || {},
|
|
113
|
+
name: await getAllTranslations(page?.fields?.title || {}),
|
|
110
114
|
slugs,
|
|
111
115
|
isProtected,
|
|
112
|
-
previewExcerpt:
|
|
116
|
+
previewExcerpt: await getAllTranslations(
|
|
117
|
+
topicNewsWithFields?.fields?.previewExcerpt || {}
|
|
118
|
+
),
|
|
113
119
|
thumbnailImageImgix,
|
|
114
120
|
fullScreenImageImgix,
|
|
115
121
|
visualizationDate:
|
|
@@ -6,7 +6,11 @@ import {
|
|
|
6
6
|
getTopicDetails,
|
|
7
7
|
} from "../libs/contentful-cda";
|
|
8
8
|
import { getIndex, AvailableIndicesKey, removeIndexObject } from "./config";
|
|
9
|
-
import {
|
|
9
|
+
import {
|
|
10
|
+
getAllTranslations,
|
|
11
|
+
getLocalISOTime,
|
|
12
|
+
secondBetweenTwoDate,
|
|
13
|
+
} from "../utils";
|
|
10
14
|
import type { Entry } from "contentful-management/dist/typings/entities/entry";
|
|
11
15
|
import {
|
|
12
16
|
CfLocalizedEntryField,
|
|
@@ -80,7 +84,6 @@ const getObject = async (
|
|
|
80
84
|
topicPressReleaseWithFields,
|
|
81
85
|
"category",
|
|
82
86
|
"topicPressReleaseCategory",
|
|
83
|
-
true,
|
|
84
87
|
false,
|
|
85
88
|
false,
|
|
86
89
|
true
|
|
@@ -100,8 +103,12 @@ const getObject = async (
|
|
|
100
103
|
// Single record
|
|
101
104
|
const record: AlgoliaPressReleaseRecord = {
|
|
102
105
|
objectID: topicPressReleaseWithFields.sys.id,
|
|
103
|
-
name:
|
|
104
|
-
|
|
106
|
+
name: await getAllTranslations(
|
|
107
|
+
topicPressReleaseWithFields?.fields?.name || {}
|
|
108
|
+
),
|
|
109
|
+
description: await getAllTranslations(
|
|
110
|
+
topicPressReleaseWithFields?.fields?.description || {}
|
|
111
|
+
),
|
|
105
112
|
thumbnailImgix,
|
|
106
113
|
category: category?.[0],
|
|
107
114
|
assets,
|
|
@@ -5,7 +5,11 @@ import {
|
|
|
5
5
|
getEntryByID,
|
|
6
6
|
} from "../libs/contentful-cda";
|
|
7
7
|
import { getIndex, AvailableIndicesKey, removeIndexObject } from "./config";
|
|
8
|
-
import {
|
|
8
|
+
import {
|
|
9
|
+
getAllTranslations,
|
|
10
|
+
getLocalISOTime,
|
|
11
|
+
secondBetweenTwoDate,
|
|
12
|
+
} from "../utils";
|
|
9
13
|
import type { Entry } from "contentful-management/dist/typings/entities/entry";
|
|
10
14
|
import {
|
|
11
15
|
CfLocalizedEntryField,
|
|
@@ -87,7 +91,9 @@ const getObject = async (
|
|
|
87
91
|
// Single record
|
|
88
92
|
const record: AlgoliaPressReviewRecord = {
|
|
89
93
|
objectID: topicPressReviewWithFields.sys.id,
|
|
90
|
-
name:
|
|
94
|
+
name: await getAllTranslations(
|
|
95
|
+
topicPressReviewWithFields?.fields?.name || {}
|
|
96
|
+
),
|
|
91
97
|
yearOfRelease:
|
|
92
98
|
topicPressReviewWithFields?.fields?.yearOfRelease?.[
|
|
93
99
|
defaultEnvironmentLocaleCode
|
package/src/algolia/products.ts
CHANGED
|
@@ -19,7 +19,7 @@ import { getIndex, AvailableIndicesKey, removeIndexObject } from "./config";
|
|
|
19
19
|
import {
|
|
20
20
|
getLocalISOTime,
|
|
21
21
|
secondBetweenTwoDate,
|
|
22
|
-
|
|
22
|
+
getAllTranslations,
|
|
23
23
|
} from "../utils";
|
|
24
24
|
import { getWrapperImgixFields } from "../libs/imgix";
|
|
25
25
|
import axios from "@atoms-studio/axios";
|
|
@@ -127,7 +127,7 @@ const getObject = async (
|
|
|
127
127
|
"sys,fields.slug,fields.protected"
|
|
128
128
|
);
|
|
129
129
|
|
|
130
|
-
const slugs =
|
|
130
|
+
const slugs = await getAllTranslations(productPage?.fields?.slug || {});
|
|
131
131
|
const isProtected =
|
|
132
132
|
!!productPage?.fields?.protected?.[defaultEnvironmentLocaleCode];
|
|
133
133
|
|
|
@@ -135,40 +135,35 @@ const getObject = async (
|
|
|
135
135
|
const catalogs = await getTopicDetails(
|
|
136
136
|
topicProductWithFields,
|
|
137
137
|
"catalogs",
|
|
138
|
-
"topicCatalog"
|
|
139
|
-
true
|
|
138
|
+
"topicCatalog"
|
|
140
139
|
);
|
|
141
140
|
|
|
142
141
|
log(`Get categoriesArchitectural details...`);
|
|
143
142
|
const categoriesArchitectural = await getTopicDetails(
|
|
144
143
|
topicProductWithFields,
|
|
145
144
|
"categoriesArchitectural",
|
|
146
|
-
"topicCategory"
|
|
147
|
-
true
|
|
145
|
+
"topicCategory"
|
|
148
146
|
);
|
|
149
147
|
|
|
150
148
|
log(`Get categoriesOutdoor details...`);
|
|
151
149
|
const categoriesOutdoor = await getTopicDetails(
|
|
152
150
|
topicProductWithFields,
|
|
153
151
|
"categoriesOutdoor",
|
|
154
|
-
"topicCategory"
|
|
155
|
-
true
|
|
152
|
+
"topicCategory"
|
|
156
153
|
);
|
|
157
154
|
|
|
158
155
|
log(`Get categoriesDecorative details...`);
|
|
159
156
|
const categoriesDecorative = await getTopicDetails(
|
|
160
157
|
topicProductWithFields,
|
|
161
158
|
"categoriesDecorative",
|
|
162
|
-
"topicCategory"
|
|
163
|
-
true
|
|
159
|
+
"topicCategory"
|
|
164
160
|
);
|
|
165
161
|
|
|
166
162
|
log(`Get families details...`);
|
|
167
163
|
const families = await getTopicDetails(
|
|
168
164
|
topicProductWithFields,
|
|
169
165
|
"families",
|
|
170
|
-
"topicFamily"
|
|
171
|
-
true
|
|
166
|
+
"topicFamily"
|
|
172
167
|
);
|
|
173
168
|
|
|
174
169
|
log(`Get subFamiliesArchitectural details...`);
|
|
@@ -176,7 +171,6 @@ const getObject = async (
|
|
|
176
171
|
topicProductWithFields,
|
|
177
172
|
"subFamiliesArchitectural",
|
|
178
173
|
"topicSubFamily",
|
|
179
|
-
true,
|
|
180
174
|
false,
|
|
181
175
|
true,
|
|
182
176
|
true
|
|
@@ -187,7 +181,6 @@ const getObject = async (
|
|
|
187
181
|
topicProductWithFields,
|
|
188
182
|
"subFamiliesOutdoor",
|
|
189
183
|
"topicSubFamily",
|
|
190
|
-
true,
|
|
191
184
|
false,
|
|
192
185
|
true,
|
|
193
186
|
true
|
|
@@ -198,7 +191,6 @@ const getObject = async (
|
|
|
198
191
|
topicProductWithFields,
|
|
199
192
|
"subFamiliesDecorative",
|
|
200
193
|
"topicSubFamily",
|
|
201
|
-
true,
|
|
202
194
|
false,
|
|
203
195
|
true,
|
|
204
196
|
true
|
|
@@ -209,7 +201,6 @@ const getObject = async (
|
|
|
209
201
|
topicProductWithFields,
|
|
210
202
|
"modelsArchitectural",
|
|
211
203
|
"topicModel",
|
|
212
|
-
true,
|
|
213
204
|
false,
|
|
214
205
|
true,
|
|
215
206
|
true
|
|
@@ -220,7 +211,6 @@ const getObject = async (
|
|
|
220
211
|
topicProductWithFields,
|
|
221
212
|
"modelsOutdoor",
|
|
222
213
|
"topicModel",
|
|
223
|
-
true,
|
|
224
214
|
false,
|
|
225
215
|
true,
|
|
226
216
|
true
|
|
@@ -231,7 +221,6 @@ const getObject = async (
|
|
|
231
221
|
topicProductWithFields,
|
|
232
222
|
"modelsDecorative",
|
|
233
223
|
"topicModel",
|
|
234
|
-
true,
|
|
235
224
|
false,
|
|
236
225
|
true,
|
|
237
226
|
true
|
|
@@ -242,7 +231,6 @@ const getObject = async (
|
|
|
242
231
|
topicProductWithFields,
|
|
243
232
|
"subModelsArchitectural",
|
|
244
233
|
"topicSubModel",
|
|
245
|
-
true,
|
|
246
234
|
false,
|
|
247
235
|
true,
|
|
248
236
|
true
|
|
@@ -253,7 +241,6 @@ const getObject = async (
|
|
|
253
241
|
topicProductWithFields,
|
|
254
242
|
"subModelsOutdoor",
|
|
255
243
|
"topicSubModel",
|
|
256
|
-
true,
|
|
257
244
|
false,
|
|
258
245
|
true,
|
|
259
246
|
true
|
|
@@ -264,7 +251,6 @@ const getObject = async (
|
|
|
264
251
|
topicProductWithFields,
|
|
265
252
|
"subModelsDecorative",
|
|
266
253
|
"topicSubModel",
|
|
267
|
-
true,
|
|
268
254
|
false,
|
|
269
255
|
true,
|
|
270
256
|
true
|
|
@@ -275,7 +261,6 @@ const getObject = async (
|
|
|
275
261
|
topicProductWithFields,
|
|
276
262
|
"productLine",
|
|
277
263
|
"topicProductLine",
|
|
278
|
-
true,
|
|
279
264
|
false,
|
|
280
265
|
true,
|
|
281
266
|
true
|
|
@@ -286,7 +271,6 @@ const getObject = async (
|
|
|
286
271
|
topicProductWithFields,
|
|
287
272
|
"productSubLine",
|
|
288
273
|
"topicProductSubLine",
|
|
289
|
-
true,
|
|
290
274
|
false,
|
|
291
275
|
true,
|
|
292
276
|
true
|
|
@@ -336,7 +320,6 @@ const getObject = async (
|
|
|
336
320
|
topicProductWithFields,
|
|
337
321
|
"designers",
|
|
338
322
|
"topicDesigner",
|
|
339
|
-
true,
|
|
340
323
|
false,
|
|
341
324
|
true,
|
|
342
325
|
true
|
|
@@ -350,7 +333,7 @@ const getObject = async (
|
|
|
350
333
|
name:
|
|
351
334
|
topicProductWithFields?.fields?.name?.[defaultEnvironmentLocaleCode] ||
|
|
352
335
|
"",
|
|
353
|
-
names: topicProductWithFields?.fields?.name || {},
|
|
336
|
+
names: await getAllTranslations(topicProductWithFields?.fields?.name || {}),
|
|
354
337
|
code:
|
|
355
338
|
topicProductWithFields?.fields?.code?.[defaultEnvironmentLocaleCode] ||
|
|
356
339
|
"",
|
|
@@ -358,7 +341,7 @@ const getObject = async (
|
|
|
358
341
|
isProtected,
|
|
359
342
|
// description: topicProductWithFields?.fields?.description, // Rimosso perché in caluni prodotti si superava il limite massimo della dimensione del record (10000 bytes). es: F0070054
|
|
360
343
|
// excerpt: topicProductWithFields?.fields?.excerpt, // Rimosso perché in caluni prodotti si superava il limite massimo della dimensione del record (10000 bytes). es: F0070054
|
|
361
|
-
autoDescription:
|
|
344
|
+
autoDescription: await getAllTranslations(autoDescription || {}),
|
|
362
345
|
thumbnailImgix,
|
|
363
346
|
catalogs,
|
|
364
347
|
categoriesArchitectural,
|
package/src/algolia/projects.ts
CHANGED
|
@@ -6,7 +6,11 @@ import {
|
|
|
6
6
|
getTopicPage,
|
|
7
7
|
} from "../libs/contentful-cda";
|
|
8
8
|
import { getIndex, AvailableIndicesKey, removeIndexObject } from "./config";
|
|
9
|
-
import {
|
|
9
|
+
import {
|
|
10
|
+
getAllTranslations,
|
|
11
|
+
getLocalISOTime,
|
|
12
|
+
secondBetweenTwoDate,
|
|
13
|
+
} from "../utils";
|
|
10
14
|
import type { Entry } from "contentful-management/dist/typings/entities/entry";
|
|
11
15
|
import {
|
|
12
16
|
CfLocalizedEntryField,
|
|
@@ -82,7 +86,7 @@ const getObject = async (
|
|
|
82
86
|
return recordFail; // return objectID to delete the record if it exists
|
|
83
87
|
}
|
|
84
88
|
|
|
85
|
-
const slugs = page?.fields.slug || {};
|
|
89
|
+
const slugs = await getAllTranslations(page?.fields.slug || {});
|
|
86
90
|
const isProtected = !!page?.fields?.protected?.[defaultEnvironmentLocaleCode];
|
|
87
91
|
|
|
88
92
|
log(`Get thumbnail imgix details...`);
|
package/src/algolia/stories.ts
CHANGED
|
@@ -6,7 +6,11 @@ import {
|
|
|
6
6
|
getTopicPage,
|
|
7
7
|
} from "../libs/contentful-cda";
|
|
8
8
|
import { getIndex, AvailableIndicesKey, removeIndexObject } from "./config";
|
|
9
|
-
import {
|
|
9
|
+
import {
|
|
10
|
+
getAllTranslations,
|
|
11
|
+
getLocalISOTime,
|
|
12
|
+
secondBetweenTwoDate,
|
|
13
|
+
} from "../utils";
|
|
10
14
|
import type { Entry } from "contentful-management/dist/typings/entities/entry";
|
|
11
15
|
import {
|
|
12
16
|
CfLocalizedEntryField,
|
|
@@ -82,7 +86,7 @@ const getObject = async (topicStory: Entry): Promise<AlgoliaStoryRecord> => {
|
|
|
82
86
|
return recordFail; // return objectID to delete the record if it exists
|
|
83
87
|
}
|
|
84
88
|
|
|
85
|
-
const slugs = page?.fields.slug || {};
|
|
89
|
+
const slugs = await getAllTranslations(page?.fields.slug || {});
|
|
86
90
|
const isProtected = !!page?.fields?.protected?.[defaultEnvironmentLocaleCode];
|
|
87
91
|
|
|
88
92
|
log(`Get Full Screen Image Imgix details...`);
|
|
@@ -152,8 +156,10 @@ const getObject = async (topicStory: Entry): Promise<AlgoliaStoryRecord> => {
|
|
|
152
156
|
if (categoryEntry) {
|
|
153
157
|
category = {
|
|
154
158
|
sysId: topicStory.fields.category[defaultEnvironmentLocaleCode].sys.id,
|
|
155
|
-
title: categoryEntry?.fields?.title,
|
|
156
|
-
priority:
|
|
159
|
+
title: await getAllTranslations(categoryEntry?.fields?.title || {}),
|
|
160
|
+
priority: await getAllTranslations(
|
|
161
|
+
categoryEntry?.fields?.priority || {}
|
|
162
|
+
),
|
|
157
163
|
};
|
|
158
164
|
} else {
|
|
159
165
|
log(`No categoryEntry found`, "WARN");
|
|
@@ -162,10 +168,10 @@ const getObject = async (topicStory: Entry): Promise<AlgoliaStoryRecord> => {
|
|
|
162
168
|
log(`No category found`, "WARN");
|
|
163
169
|
}
|
|
164
170
|
|
|
165
|
-
const
|
|
171
|
+
const clearExcerpt = {};
|
|
166
172
|
for (const locale in topicStoryWithFields?.fields?.excerpt) {
|
|
167
173
|
if (topicStoryWithFields?.fields?.excerpt?.[locale]) {
|
|
168
|
-
(
|
|
174
|
+
(clearExcerpt as any)[locale] = removeMd(
|
|
169
175
|
topicStoryWithFields?.fields?.excerpt?.[locale]
|
|
170
176
|
);
|
|
171
177
|
}
|
|
@@ -174,12 +180,15 @@ const getObject = async (topicStory: Entry): Promise<AlgoliaStoryRecord> => {
|
|
|
174
180
|
// Single record
|
|
175
181
|
const record: AlgoliaStoryRecord = {
|
|
176
182
|
objectID: topicStoryWithFields.sys.id,
|
|
177
|
-
name:
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
+
name: await getAllTranslations(
|
|
184
|
+
topicStoryWithFields?.fields?.title || emptyLocalizedField
|
|
185
|
+
),
|
|
186
|
+
excerpt: await getAllTranslations(
|
|
187
|
+
topicStoryWithFields?.fields?.excerpt ? clearExcerpt : emptyLocalizedField
|
|
188
|
+
),
|
|
189
|
+
description: await getAllTranslations(
|
|
190
|
+
topicStoryWithFields?.fields?.description || emptyLocalizedField
|
|
191
|
+
),
|
|
183
192
|
slugs,
|
|
184
193
|
isProtected,
|
|
185
194
|
fullScreenImageImgix,
|
|
@@ -16,9 +16,9 @@ import {
|
|
|
16
16
|
getLocalISOTime,
|
|
17
17
|
sanitizeValue,
|
|
18
18
|
secondBetweenTwoDate,
|
|
19
|
-
keysToLowerCase,
|
|
20
19
|
addProductFieldValueCodesByPimDetails,
|
|
21
20
|
capitalizeFirstLetter,
|
|
21
|
+
getAllTranslations,
|
|
22
22
|
} from "../utils";
|
|
23
23
|
import { getWrapperImgixFields } from "../libs/imgix";
|
|
24
24
|
import { AlgoliaFamilyRecord, pageResponse } from "./families";
|
|
@@ -258,8 +258,7 @@ const getObject = async (
|
|
|
258
258
|
const catalogs = await getTopicDetails(
|
|
259
259
|
topicSubFamilyWithFields,
|
|
260
260
|
"catalog",
|
|
261
|
-
"topicCatalog"
|
|
262
|
-
true
|
|
261
|
+
"topicCatalog"
|
|
263
262
|
);
|
|
264
263
|
log(`${catalogs?.length} catalogs founded`);
|
|
265
264
|
|
|
@@ -267,8 +266,7 @@ const getObject = async (
|
|
|
267
266
|
const categories = await getTopicDetails(
|
|
268
267
|
topicSubFamilyWithFields,
|
|
269
268
|
"category",
|
|
270
|
-
"topicCategory"
|
|
271
|
-
true
|
|
269
|
+
"topicCategory"
|
|
272
270
|
);
|
|
273
271
|
log(`${categories?.length} categories founded`);
|
|
274
272
|
|
|
@@ -314,15 +312,17 @@ const getObject = async (
|
|
|
314
312
|
// Single record
|
|
315
313
|
const record: AlgoliaFamilyRecord = {
|
|
316
314
|
objectID: topicSubFamilyWithFields.sys.id,
|
|
317
|
-
names:
|
|
315
|
+
names: await getAllTranslations(
|
|
316
|
+
topicSubFamilyWithFields?.fields?.name || {}
|
|
317
|
+
),
|
|
318
318
|
code:
|
|
319
319
|
topicSubFamilyWithFields?.fields?.code?.[defaultEnvironmentLocaleCode] ||
|
|
320
|
-
|
|
320
|
+
"",
|
|
321
321
|
thumbnailImgix,
|
|
322
322
|
fullScreenImageImgix,
|
|
323
|
-
slugs:
|
|
323
|
+
slugs: await getAllTranslations(page?.slugs || {}),
|
|
324
324
|
slugType: page?.type || "",
|
|
325
|
-
// slugDetails: page?.details || {},
|
|
325
|
+
// slugDetails: await getAllTranslations(page?.details || {}),
|
|
326
326
|
catalogs,
|
|
327
327
|
categories,
|
|
328
328
|
productFields,
|