pim-import 5.6.0 → 5.7.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.
@@ -102,4 +102,82 @@ export declare const getIndicesSettings: () => {
102
102
  export declare const getIndexConfig: (indexKey: AvailableIndicesKey) => any;
103
103
  export declare const getIndex: (indexKey: AvailableIndicesKey) => import("algoliasearch").SearchIndex;
104
104
  export declare const resetIndexSettings: (indexKey: AvailableIndicesKey) => import("algoliasearch").SearchIndex;
105
+ export declare const cloneIndexSettings: (sourceIndex: string, targetIndex: string) => Promise<{
106
+ sourceIndex: string;
107
+ targetIndex: string;
108
+ clonedSettings: {
109
+ searchableAttributes?: readonly string[] | undefined;
110
+ attributesToIndex?: readonly string[] | undefined;
111
+ attributesForFaceting?: readonly string[] | undefined;
112
+ unretrievableAttributes?: readonly string[] | undefined;
113
+ attributesToRetrieve?: readonly string[] | undefined;
114
+ ranking?: readonly string[] | undefined;
115
+ customRanking?: readonly string[] | undefined;
116
+ replicas?: readonly string[] | undefined;
117
+ slaves?: readonly string[] | undefined;
118
+ primary?: string | undefined;
119
+ maxValuesPerFacet?: number | undefined;
120
+ sortFacetValuesBy?: "count" | "alpha" | undefined;
121
+ attributesToHighlight?: readonly string[] | undefined;
122
+ attributesToSnippet?: readonly string[] | undefined;
123
+ highlightPreTag?: string | undefined;
124
+ highlightPostTag?: string | undefined;
125
+ snippetEllipsisText?: string | undefined;
126
+ restrictHighlightAndSnippetArrays?: boolean | undefined;
127
+ hitsPerPage?: number | undefined;
128
+ paginationLimitedTo?: number | undefined;
129
+ minWordSizefor1Typo?: number | undefined;
130
+ minWordSizefor2Typos?: number | undefined;
131
+ typoTolerance?: string | boolean | undefined;
132
+ allowTyposOnNumericTokens?: boolean | undefined;
133
+ disableTypoToleranceOnAttributes?: readonly string[] | undefined;
134
+ disableTypoToleranceOnWords?: readonly string[] | undefined;
135
+ separatorsToIndex?: string | undefined;
136
+ ignorePlurals?: boolean | readonly string[] | undefined;
137
+ queryLanguages?: readonly string[] | undefined;
138
+ indexLanguages?: readonly string[] | undefined;
139
+ enableRules?: boolean | undefined;
140
+ queryType?: "prefixLast" | "prefixAll" | "prefixNone" | undefined;
141
+ removeWordsIfNoResults?: "none" | "lastWords" | "firstWords" | "allOptional" | undefined;
142
+ advancedSyntax?: boolean | undefined;
143
+ advancedSyntaxFeatures?: readonly ("exactPhrase" | "excludeWords")[] | undefined;
144
+ optionalWords?: readonly string[] | undefined;
145
+ disablePrefixOnAttributes?: readonly string[] | undefined;
146
+ disableExactOnAttributes?: readonly string[] | undefined;
147
+ exactOnSingleWordQuery?: "attribute" | "none" | "word" | undefined;
148
+ alternativesAsExact?: readonly ("ignorePlurals" | "singleWordSynonym" | "multiWordsSynonym")[] | undefined;
149
+ removeStopWords?: boolean | readonly string[] | undefined;
150
+ numericAttributesForFiltering?: readonly string[] | undefined;
151
+ allowCompressionOfIntegerArray?: boolean | undefined;
152
+ attributeForDistinct?: string | undefined;
153
+ distinct?: number | boolean | undefined;
154
+ replaceSynonymsInHighlight?: boolean | undefined;
155
+ attributeCriteriaComputedByMinProximity?: boolean | undefined;
156
+ minProximity?: number | undefined;
157
+ responseFields?: readonly string[] | undefined;
158
+ maxFacetHits?: number | undefined;
159
+ camelCaseAttributes?: readonly string[] | undefined;
160
+ decompoundedAttributes?: Readonly<Record<string, readonly string[]>> | undefined;
161
+ keepDiacriticsOnCharacters?: string | undefined;
162
+ customNormalization?: Readonly<Record<string, Readonly<Record<string, string>>>> | undefined;
163
+ enablePersonalization?: boolean | undefined;
164
+ userData?: any;
165
+ decompoundQuery?: boolean | undefined;
166
+ attributesToTransliterate?: readonly string[] | undefined;
167
+ relevancyStrictness?: number | undefined;
168
+ renderingContent?: {
169
+ readonly facetOrdering?: {
170
+ readonly facets?: {
171
+ readonly order?: readonly string[] | undefined;
172
+ } | undefined;
173
+ readonly values?: {
174
+ readonly [facet: string]: {
175
+ readonly order?: readonly string[] | undefined;
176
+ readonly sortRemainingBy?: "count" | "alpha" | "hidden" | undefined;
177
+ };
178
+ } | undefined;
179
+ } | undefined;
180
+ } | undefined;
181
+ };
182
+ }>;
105
183
  export declare const removeIndexObject: (objectId: string, indexKey: AvailableIndicesKey) => Promise<void>;
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.removeIndexObject = exports.resetIndexSettings = exports.getIndex = exports.getIndexConfig = exports.getIndicesSettings = exports.getClient = void 0;
6
+ exports.removeIndexObject = exports.cloneIndexSettings = exports.resetIndexSettings = exports.getIndex = exports.getIndexConfig = exports.getIndicesSettings = exports.getClient = void 0;
7
7
  const algoliasearch_1 = __importDefault(require("algoliasearch"));
8
8
  const logs_1 = require("../libs/logs");
9
9
  const getClient = () => {
@@ -290,6 +290,32 @@ const resetIndexSettings = (indexKey) => {
290
290
  }
291
291
  };
292
292
  exports.resetIndexSettings = resetIndexSettings;
293
+ const cloneIndexSettings = async (sourceIndex, targetIndex) => {
294
+ try {
295
+ const client = (0, exports.getClient)();
296
+ const sourceAlgoliaIndex = client.initIndex(sourceIndex);
297
+ const targetAlgoliaIndex = client.initIndex(targetIndex);
298
+ console.log(`Copying settings from ${sourceIndex} to ${targetIndex}`);
299
+ const sourceSettings = await sourceAlgoliaIndex.getSettings();
300
+ const settingsToClone = { ...sourceSettings };
301
+ delete settingsToClone.replicas;
302
+ delete settingsToClone.primary;
303
+ delete settingsToClone.slaves;
304
+ await targetAlgoliaIndex.setSettings(settingsToClone);
305
+ (0, logs_1.log)(`Successfully cloned settings from ${sourceIndex} to ${targetIndex}`);
306
+ return {
307
+ sourceIndex,
308
+ targetIndex,
309
+ clonedSettings: settingsToClone,
310
+ };
311
+ }
312
+ catch (error) {
313
+ const errorMessage = `Error cloning settings from ${sourceIndex} to ${targetIndex}: ${error}`;
314
+ (0, logs_1.log)(errorMessage);
315
+ throw new Error(errorMessage);
316
+ }
317
+ };
318
+ exports.cloneIndexSettings = cloneIndexSettings;
293
319
  const removeIndexObject = async (objectId, indexKey) => {
294
320
  const index = (0, exports.getIndex)(indexKey);
295
321
  await index.deleteObject(objectId);
package/dist/browser.d.ts CHANGED
@@ -9,7 +9,7 @@ export { importSubModels } from "./pim/methods/submodels";
9
9
  export { importSubFamilies } from "./pim/methods/subfamilies";
10
10
  export { importFamilies } from "./pim/methods/families";
11
11
  export { importProductByCode, setProductsRelationships, setProductRelationships, getAllProductEntriesByCatalog, audit, generateTechSpecPdf, setProductsAutodescription, getProductAutodescription, setProductAutodescriptionByTopicId, removeProductFromColorVariantsByProductLine, removeAllProductModelProductRelations, } from "./pim/methods/products";
12
- export { resetIndexSettings } from "./algolia/config";
12
+ export { resetIndexSettings, cloneIndexSettings } from "./algolia/config";
13
13
  export { reindexFamilies, reindexFamily, removeFamilyObject, } from "./algolia/families";
14
14
  export { reindexSubFamilies, reindexSubFamily, removeSubFamilyObject, } from "./algolia/subFamilies";
15
15
  export { reindexProduct, reindexProducts, removeProductObject, } from "./algolia/products";
package/dist/browser.js CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.removeModelObject = exports.reindexModels = exports.reindexModel = exports.removeSubModelObject = exports.reindexSubModels = exports.reindexSubModel = exports.removeProductObject = exports.reindexProducts = exports.reindexProduct = exports.removeSubFamilyObject = exports.reindexSubFamily = exports.reindexSubFamilies = exports.removeFamilyObject = exports.reindexFamily = exports.reindexFamilies = exports.resetIndexSettings = exports.removeAllProductModelProductRelations = exports.removeProductFromColorVariantsByProductLine = exports.setProductAutodescriptionByTopicId = exports.getProductAutodescription = exports.setProductsAutodescription = exports.generateTechSpecPdf = exports.audit = exports.getAllProductEntriesByCatalog = exports.setProductRelationships = exports.setProductsRelationships = exports.importProductByCode = exports.importFamilies = exports.importSubFamilies = exports.importSubModels = exports.importModels = exports.importLatestProducts = exports.importCategories = exports.importDictionaryProductSubLine = exports.importDictionaryProductLine = exports.importDictionaryData = exports.importDictionaryIcons = exports.importDictionaryFields = exports.savePDFToS3 = exports.getFileFromS3 = exports.saveJsonToS3 = exports.uploadS3 = exports.initS3 = exports.getTopicPage = exports.getEntryByID = exports.deleteEntries = exports.deletePages = exports.initBaseEntries = exports.initContentful = exports.initPim = void 0;
4
- exports.netlifyBuild = exports.generatePDFByUrl = exports.removeRecordsByStatus = exports.setLogId = exports.log = exports.getStaticDailyProducts = exports.getLocalISOTime = exports.importDownloads = exports.removePostObject = exports.reindexPosts = exports.reindexPost = exports.removePressReleaseObject = exports.reindexPressReleases = exports.reindexPressRelease = exports.removePressReviewObject = exports.reindexPressReviews = exports.reindexPressReview = exports.removeStoryObject = exports.reindexStories = exports.reindexStory = exports.removeProjectObject = exports.reindexProjects = exports.reindexProject = exports.removeInspirationObject = exports.reindexInspirations = exports.reindexInspiration = exports.removeDownloadObject = exports.reindexDownloads = exports.reindexDownload = void 0;
3
+ exports.reindexModels = exports.reindexModel = exports.removeSubModelObject = exports.reindexSubModels = exports.reindexSubModel = exports.removeProductObject = exports.reindexProducts = exports.reindexProduct = exports.removeSubFamilyObject = exports.reindexSubFamily = exports.reindexSubFamilies = exports.removeFamilyObject = exports.reindexFamily = exports.reindexFamilies = exports.cloneIndexSettings = exports.resetIndexSettings = exports.removeAllProductModelProductRelations = exports.removeProductFromColorVariantsByProductLine = exports.setProductAutodescriptionByTopicId = exports.getProductAutodescription = exports.setProductsAutodescription = exports.generateTechSpecPdf = exports.audit = exports.getAllProductEntriesByCatalog = exports.setProductRelationships = exports.setProductsRelationships = exports.importProductByCode = exports.importFamilies = exports.importSubFamilies = exports.importSubModels = exports.importModels = exports.importLatestProducts = exports.importCategories = exports.importDictionaryProductSubLine = exports.importDictionaryProductLine = exports.importDictionaryData = exports.importDictionaryIcons = exports.importDictionaryFields = exports.savePDFToS3 = exports.getFileFromS3 = exports.saveJsonToS3 = exports.uploadS3 = exports.initS3 = exports.getTopicPage = exports.getEntryByID = exports.deleteEntries = exports.deletePages = exports.initBaseEntries = exports.initContentful = exports.initPim = void 0;
4
+ exports.netlifyBuild = exports.generatePDFByUrl = exports.removeRecordsByStatus = exports.setLogId = exports.log = exports.getStaticDailyProducts = exports.getLocalISOTime = exports.importDownloads = exports.removePostObject = exports.reindexPosts = exports.reindexPost = exports.removePressReleaseObject = exports.reindexPressReleases = exports.reindexPressRelease = exports.removePressReviewObject = exports.reindexPressReviews = exports.reindexPressReview = exports.removeStoryObject = exports.reindexStories = exports.reindexStory = exports.removeProjectObject = exports.reindexProjects = exports.reindexProject = exports.removeInspirationObject = exports.reindexInspirations = exports.reindexInspiration = exports.removeDownloadObject = exports.reindexDownloads = exports.reindexDownload = exports.removeModelObject = void 0;
5
5
  var config_1 = require("./pim/config");
6
6
  Object.defineProperty(exports, "initPim", { enumerable: true, get: function () { return config_1.init; } });
7
7
  var contentful_1 = require("./libs/contentful");
@@ -49,6 +49,7 @@ Object.defineProperty(exports, "removeProductFromColorVariantsByProductLine", {
49
49
  Object.defineProperty(exports, "removeAllProductModelProductRelations", { enumerable: true, get: function () { return products_1.removeAllProductModelProductRelations; } });
50
50
  var config_2 = require("./algolia/config");
51
51
  Object.defineProperty(exports, "resetIndexSettings", { enumerable: true, get: function () { return config_2.resetIndexSettings; } });
52
+ Object.defineProperty(exports, "cloneIndexSettings", { enumerable: true, get: function () { return config_2.cloneIndexSettings; } });
52
53
  var families_2 = require("./algolia/families");
53
54
  Object.defineProperty(exports, "reindexFamilies", { enumerable: true, get: function () { return families_2.reindexFamilies; } });
54
55
  Object.defineProperty(exports, "reindexFamily", { enumerable: true, get: function () { return families_2.reindexFamily; } });
package/dist/index.d.ts CHANGED
@@ -12,7 +12,7 @@ export { importProductByCode, setProductsRelationships, setProductRelationships,
12
12
  export { publishAllProductDrafts } from "./pim/methods/bulkPublish";
13
13
  export { migrateEntryFields } from "./pim/methods/migrateEntryFields";
14
14
  export { checkTopicDraftAndPagePublished } from "./pim/methods/checkTopicDraftAndPagePublished";
15
- export { getIndex } from "./algolia/config";
15
+ export { getIndex, cloneIndexSettings } from "./algolia/config";
16
16
  export { reindexFamilies, reindexFamily, removeFamilyObject, } from "./algolia/families";
17
17
  export { reindexSubFamilies, reindexSubFamily, removeSubFamilyObject, } from "./algolia/subFamilies";
18
18
  export { reindexProduct, reindexProducts, removeProductObject, triggerPDFGenerator, } from "./algolia/products";
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.reindexProduct = exports.removeSubFamilyObject = exports.reindexSubFamily = exports.reindexSubFamilies = exports.removeFamilyObject = exports.reindexFamily = exports.reindexFamilies = exports.getIndex = exports.checkTopicDraftAndPagePublished = exports.migrateEntryFields = exports.publishAllProductDrafts = exports.purgeProductThumbCacheByProductCodes = exports.populateDestinations = exports.reimportAuditProducts = exports.getProductPageIdByCode = exports.removeAllProductModelProductRelations = exports.removeProductFromColorVariantsByProductLine = exports.setProductAutodescriptionByTopicId = exports.getProductAutodescription = exports.setProductsAutodescription = exports.generateTechSpecPdf = exports.audit = exports.getAllProductEntriesByCatalog = exports.setProductRelationships = exports.setProductsRelationships = exports.importProductByCode = exports.importFamilies = exports.importSubFamilies = exports.importSubModels = exports.importModels = exports.importLatestProducts = exports.importCategories = exports.importDictionaryProductSubLine = exports.importDictionaryProductLine = exports.importDictionaryData = exports.importDictionaryIcons = exports.importDictionaryFields = exports.savePDFToS3 = exports.getFileFromS3 = exports.saveJsonToS3 = exports.uploadS3 = exports.initS3 = exports.getEntries = exports.getTopicPage = exports.getEntryByID = exports.deleteEntries = exports.deletePages = exports.initBaseEntries = exports.initContentful = exports.initPim = void 0;
4
- exports.netlifyBuild = exports.notify = exports.importDesigner = exports.importDesigners = exports.generatePDFByUrl = exports.removeRecordsByStatus = exports.getLogFolder = exports.setLogFilename = exports.setLogPath = exports.setLogId = exports.setServerUtils = exports.log = exports.getLatestProducts = exports.getStaticDailyProducts = exports.getLocalISOTime = exports.importDownloads = exports.removePostObject = exports.reindexPosts = exports.reindexPost = exports.removePressReleaseObject = exports.reindexPressReleases = exports.reindexPressRelease = exports.removePressReviewObject = exports.reindexPressReviews = exports.reindexPressReview = exports.removeStoryObject = exports.reindexStories = exports.reindexStory = exports.removeProjectObject = exports.reindexProjects = exports.reindexProject = exports.removeInspirationObject = exports.reindexInspirations = exports.reindexInspiration = exports.removeDownloadObject = exports.reindexDownloads = exports.reindexDownload = exports.removeModelObject = exports.reindexModels = exports.reindexModel = exports.removeSubModelObject = exports.reindexSubModels = exports.reindexSubModel = exports.triggerPDFGenerator = exports.removeProductObject = exports.reindexProducts = void 0;
3
+ exports.removeSubFamilyObject = exports.reindexSubFamily = exports.reindexSubFamilies = exports.removeFamilyObject = exports.reindexFamily = exports.reindexFamilies = exports.cloneIndexSettings = exports.getIndex = exports.checkTopicDraftAndPagePublished = exports.migrateEntryFields = exports.publishAllProductDrafts = exports.purgeProductThumbCacheByProductCodes = exports.populateDestinations = exports.reimportAuditProducts = exports.getProductPageIdByCode = exports.removeAllProductModelProductRelations = exports.removeProductFromColorVariantsByProductLine = exports.setProductAutodescriptionByTopicId = exports.getProductAutodescription = exports.setProductsAutodescription = exports.generateTechSpecPdf = exports.audit = exports.getAllProductEntriesByCatalog = exports.setProductRelationships = exports.setProductsRelationships = exports.importProductByCode = exports.importFamilies = exports.importSubFamilies = exports.importSubModels = exports.importModels = exports.importLatestProducts = exports.importCategories = exports.importDictionaryProductSubLine = exports.importDictionaryProductLine = exports.importDictionaryData = exports.importDictionaryIcons = exports.importDictionaryFields = exports.savePDFToS3 = exports.getFileFromS3 = exports.saveJsonToS3 = exports.uploadS3 = exports.initS3 = exports.getEntries = exports.getTopicPage = exports.getEntryByID = exports.deleteEntries = exports.deletePages = exports.initBaseEntries = exports.initContentful = exports.initPim = void 0;
4
+ exports.netlifyBuild = exports.notify = exports.importDesigner = exports.importDesigners = exports.generatePDFByUrl = exports.removeRecordsByStatus = exports.getLogFolder = exports.setLogFilename = exports.setLogPath = exports.setLogId = exports.setServerUtils = exports.log = exports.getLatestProducts = exports.getStaticDailyProducts = exports.getLocalISOTime = exports.importDownloads = exports.removePostObject = exports.reindexPosts = exports.reindexPost = exports.removePressReleaseObject = exports.reindexPressReleases = exports.reindexPressRelease = exports.removePressReviewObject = exports.reindexPressReviews = exports.reindexPressReview = exports.removeStoryObject = exports.reindexStories = exports.reindexStory = exports.removeProjectObject = exports.reindexProjects = exports.reindexProject = exports.removeInspirationObject = exports.reindexInspirations = exports.reindexInspiration = exports.removeDownloadObject = exports.reindexDownloads = exports.reindexDownload = exports.removeModelObject = exports.reindexModels = exports.reindexModel = exports.removeSubModelObject = exports.reindexSubModels = exports.reindexSubModel = exports.triggerPDFGenerator = exports.removeProductObject = exports.reindexProducts = exports.reindexProduct = void 0;
5
5
  var config_1 = require("./pim/config");
6
6
  Object.defineProperty(exports, "initPim", { enumerable: true, get: function () { return config_1.init; } });
7
7
  var contentful_1 = require("./libs/contentful");
@@ -60,6 +60,7 @@ var checkTopicDraftAndPagePublished_1 = require("./pim/methods/checkTopicDraftAn
60
60
  Object.defineProperty(exports, "checkTopicDraftAndPagePublished", { enumerable: true, get: function () { return checkTopicDraftAndPagePublished_1.checkTopicDraftAndPagePublished; } });
61
61
  var config_2 = require("./algolia/config");
62
62
  Object.defineProperty(exports, "getIndex", { enumerable: true, get: function () { return config_2.getIndex; } });
63
+ Object.defineProperty(exports, "cloneIndexSettings", { enumerable: true, get: function () { return config_2.cloneIndexSettings; } });
63
64
  var families_2 = require("./algolia/families");
64
65
  Object.defineProperty(exports, "reindexFamilies", { enumerable: true, get: function () { return families_2.reindexFamilies; } });
65
66
  Object.defineProperty(exports, "reindexFamily", { enumerable: true, get: function () { return families_2.reindexFamily; } });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pim-import",
3
- "version": "5.6.0",
3
+ "version": "5.7.0",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",