pim-import 4.16.0 → 4.18.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.
@@ -83,6 +83,13 @@
83
83
  "dictionary": "DEnec",
84
84
  "type": "object"
85
85
  },
86
+ {
87
+ "key": "enecCertified",
88
+ "parent": "certification",
89
+ "icon": false,
90
+ "dictionary": "",
91
+ "type": "boolean"
92
+ },
86
93
  {
87
94
  "key": "ul",
88
95
  "parent": "certification",
@@ -0,0 +1,126 @@
1
+ const pimImport = require("../dist/index");
2
+
3
+ function reindexFamilies(offset, limit, catalog) {
4
+ pimImport
5
+ .reindexFamilies(offset, limit, catalog)
6
+ .then((res) => {
7
+ console.log(res);
8
+ if (!res?.completed) {
9
+ reindexFamilies(res.offset, res.limit, catalog);
10
+ }
11
+ })
12
+ .catch((err) => {
13
+ console.log(err);
14
+ });
15
+ }
16
+
17
+ function reindexSubFamilies(offset, limit, catalog) {
18
+ pimImport
19
+ .reindexSubFamilies(offset, limit, catalog)
20
+ .then((res) => {
21
+ console.log(res);
22
+ if (!res?.completed) {
23
+ reindexSubFamilies(res.offset, res.limit, catalog);
24
+ }
25
+ })
26
+ .catch((err) => {
27
+ console.log(err);
28
+ });
29
+ }
30
+
31
+ function reindexModels(offset, limit, catalogCode) {
32
+ pimImport
33
+ .reindexModels(offset, limit, catalogCode)
34
+ .then((res) => {
35
+ console.log(res);
36
+ if (!res.completed) {
37
+ reindexModels(res.offset, res.limit, catalogCode);
38
+ }
39
+ })
40
+ .catch((err) => {
41
+ console.log(err);
42
+ });
43
+ }
44
+
45
+ function reindexSubModels(offset, limit, catalogCode) {
46
+ pimImport
47
+ .reindexSubModels(offset, limit, catalogCode)
48
+ .then((res) => {
49
+ console.log(res);
50
+ if (!res.completed) {
51
+ reindexSubModels(res.offset, res.limit, catalogCode);
52
+ }
53
+ })
54
+ .catch((err) => {
55
+ console.log(err);
56
+ });
57
+ }
58
+
59
+ function reindexProducts(
60
+ filterKey,
61
+ filterValue,
62
+ offset,
63
+ limit,
64
+ lastPimSyncDateGte = "",
65
+ generatePdf = true,
66
+ filters = []
67
+ ) {
68
+ pimImport
69
+ .reindexProducts(
70
+ filterKey,
71
+ filterValue,
72
+ offset,
73
+ limit,
74
+ lastPimSyncDateGte,
75
+ generatePdf,
76
+ filters
77
+ )
78
+ .then((res) => {
79
+ console.log(res);
80
+ if (!res.completed) {
81
+ reindexProducts(
82
+ filterKey,
83
+ filterValue,
84
+ res.offset,
85
+ res.limit,
86
+ lastPimSyncDateGte,
87
+ generatePdf,
88
+ filters
89
+ );
90
+ }
91
+ })
92
+ .catch((err) => {
93
+ console.log(err);
94
+ });
95
+ }
96
+
97
+ /**
98
+ * Per reindicizzare i contentuti negli indici di stage prima di procedere accertarsi che:
99
+ * - La variabile d'ambiente FPI_ALGOLIA_INDEX_NAME_SUFFIX sia uguale a "_STAGE"
100
+ * - Il file src/algolia/products.ts stia utilizzando la CMA di Contentful (../libs/contentful) e non la CDA (../libs/contentful-cda)
101
+ */
102
+
103
+ const catalog = "ARCHITECTURAL"; // ARCHITECTURAL, OUTDOOR or DECORATIVE
104
+ const lastModified = "2023-05-30T00:01:00.931Z"; // Modificare solo mese e giorno non occorre modificare l'ora
105
+
106
+ // 1. Reindicizzare per ogni catalogo tutte le famiglie
107
+ // reindexFamilies(0, 10, catalog);
108
+
109
+ // 2. Reindicizzare per ogni catalogo tutte le subfamily
110
+ // reindexSubFamilies(0, 50, catalog);
111
+
112
+ // 3. Reindicizzare per ogni catalogo tutti i model
113
+ // reindexModels(0, 50, catalog);
114
+
115
+ // 4. Reindicizzare per ogni catalogo tutti i submodel
116
+ // reindexSubModels(0, 50, catalog);
117
+
118
+ // 5. Reindicizzare per ogni catalogo tutti i prodotti modificati da una certa data in poi
119
+ // reindexProducts(
120
+ // "fields.catalogs.sys.id[in]",
121
+ // catalog,
122
+ // 0,
123
+ // 50,
124
+ // lastModified,
125
+ // false
126
+ // );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pim-import",
3
- "version": "4.16.0",
3
+ "version": "4.18.0",
4
4
  "description": "",
5
5
  "main": "./dist/index.js",
6
6
  "types": "types/index.d.ts",
@@ -83,6 +83,13 @@
83
83
  "dictionary": "DEnec",
84
84
  "type": "object"
85
85
  },
86
+ {
87
+ "key": "enecCertified",
88
+ "parent": "certification",
89
+ "icon": false,
90
+ "dictionary": "",
91
+ "type": "boolean"
92
+ },
86
93
  {
87
94
  "key": "ul",
88
95
  "parent": "certification",