@vegan-friendly/strapi-plugin-elasticsearch 0.1.0-alpha.2 → 0.1.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.
Files changed (77) hide show
  1. package/dist/admin/index.d.ts +8 -0
  2. package/dist/admin/index.js +92 -0
  3. package/dist/admin/pluginId.d.ts +2 -0
  4. package/dist/admin/pluginId.js +8 -0
  5. package/dist/admin/src/components/Initializer/index.js +2 -1
  6. package/dist/admin/src/components/SubNavigation/index.js +10 -8
  7. package/dist/admin/src/pages/ConfigureCollectionList/index.js +40 -28
  8. package/dist/admin/src/pages/Homepage/index.js +20 -21
  9. package/dist/admin/src/pluginId.d.ts +1 -1
  10. package/dist/admin/src/utils/apiUrls.js +1 -0
  11. package/dist/admin/src/utils/axiosInstance.js +1 -2
  12. package/dist/package.json +63 -0
  13. package/dist/server/bootstrap.d.ts +4 -0
  14. package/dist/server/bootstrap.js +3 -3
  15. package/dist/server/config/index.d.ts +5 -0
  16. package/dist/server/config/index.js +2 -1
  17. package/dist/server/content-types/index.d.ts +83 -2
  18. package/dist/server/content-types/index.js +9 -5
  19. package/dist/server/content-types/indexing-logs.d.ts +32 -0
  20. package/dist/server/content-types/indexing-logs.js +22 -24
  21. package/dist/server/content-types/tasks.d.ts +46 -0
  22. package/dist/server/content-types/tasks.js +33 -38
  23. package/dist/server/controllers/configure-indexing.d.ts +11 -0
  24. package/dist/server/controllers/configure-indexing.js +3 -2
  25. package/dist/server/controllers/index.d.ts +33 -5
  26. package/dist/server/controllers/index.js +15 -11
  27. package/dist/server/controllers/log-indexing.d.ts +6 -0
  28. package/dist/server/controllers/log-indexing.js +3 -2
  29. package/dist/server/controllers/perform-indexing.d.ts +8 -0
  30. package/dist/server/controllers/perform-indexing.js +3 -2
  31. package/dist/server/controllers/perform-search.d.ts +4 -1
  32. package/dist/server/controllers/perform-search.js +11 -8
  33. package/dist/server/controllers/setup-info.d.ts +6 -0
  34. package/dist/server/controllers/setup-info.js +2 -1
  35. package/dist/server/destroy.d.ts +4 -0
  36. package/dist/server/destroy.js +2 -1
  37. package/dist/server/index.d.ts +312 -10
  38. package/dist/server/index.js +25 -21
  39. package/dist/server/middlewares/index.d.ts +2 -0
  40. package/dist/server/middlewares/index.js +2 -1
  41. package/dist/server/policies/index.d.ts +2 -0
  42. package/dist/server/policies/index.js +2 -1
  43. package/dist/server/register.d.ts +4 -0
  44. package/dist/server/register.js +2 -1
  45. package/dist/server/routes/configure-indexing.d.ts +12 -0
  46. package/dist/server/routes/configure-indexing.js +2 -1
  47. package/dist/server/routes/index.d.ts +58 -5
  48. package/dist/server/routes/index.js +15 -11
  49. package/dist/server/routes/perform-indexing.d.ts +12 -0
  50. package/dist/server/routes/perform-indexing.js +2 -1
  51. package/dist/server/routes/perform-search.d.ts +12 -0
  52. package/dist/server/routes/perform-search.js +4 -3
  53. package/dist/server/routes/run-log.d.ts +12 -0
  54. package/dist/server/routes/run-log.js +3 -2
  55. package/dist/server/routes/setup-info.d.ts +12 -0
  56. package/dist/server/routes/setup-info.js +3 -2
  57. package/dist/server/services/configure-indexing.d.ts +23 -23
  58. package/dist/server/services/configure-indexing.js +30 -18
  59. package/dist/server/services/es-interface.d.ts +27 -4
  60. package/dist/server/services/es-interface.js +13 -14
  61. package/dist/server/services/helper.d.ts +34 -33
  62. package/dist/server/services/helper.js +31 -23
  63. package/dist/server/services/index.d.ts +124 -7
  64. package/dist/server/services/index.js +19 -15
  65. package/dist/server/services/log-indexing.d.ts +8 -0
  66. package/dist/server/services/log-indexing.js +8 -7
  67. package/dist/server/services/perform-indexing.d.ts +8 -0
  68. package/dist/server/services/perform-indexing.js +29 -16
  69. package/dist/server/services/schedule-indexing.d.ts +19 -0
  70. package/dist/server/services/schedule-indexing.js +13 -12
  71. package/dist/server/services/transform-content.d.ts +7 -2
  72. package/dist/server/services/transform-content.js +4 -3
  73. package/package.json +4 -2
  74. package/dist/strapi-admin.d.ts +0 -0
  75. package/dist/strapi-admin.js +0 -2
  76. package/dist/strapi-server.d.ts +0 -0
  77. package/dist/strapi-server.js +0 -2
@@ -0,0 +1,8 @@
1
+ declare const _default: {
2
+ register(app: any): void;
3
+ bootstrap(app: any): void;
4
+ registerTrads({ locales }: {
5
+ locales: any;
6
+ }): Promise<any[]>;
7
+ };
8
+ export default _default;
@@ -0,0 +1,92 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ var __importDefault = (this && this.__importDefault) || function (mod) {
36
+ return (mod && mod.__esModule) ? mod : { "default": mod };
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ const helper_plugin_1 = require("@strapi/helper-plugin");
40
+ const package_json_1 = __importDefault(require("../package.json"));
41
+ const pluginId_1 = __importDefault(require("./pluginId"));
42
+ const Initializer_1 = __importDefault(require("./src/components/Initializer"));
43
+ const PluginIcon_1 = __importDefault(require("./src/components/PluginIcon"));
44
+ const name = package_json_1.default.strapi.name;
45
+ exports.default = {
46
+ register(app) {
47
+ app.addMenuLink({
48
+ to: `/plugins/${pluginId_1.default}`,
49
+ icon: PluginIcon_1.default,
50
+ intlLabel: {
51
+ id: `${pluginId_1.default}.plugin.name`,
52
+ defaultMessage: 'Elasticsearch',
53
+ },
54
+ Component: async () => {
55
+ const component = await Promise.resolve().then(() => __importStar(require(/* webpackChunkName: "[request]" */ './src/pages/App')));
56
+ return component;
57
+ },
58
+ permissions: [
59
+ // Uncomment to set the permissions of the plugin here
60
+ // {
61
+ // action: '', // the action name should be plugin::plugin-name.actionType
62
+ // subject: null,
63
+ // },
64
+ ],
65
+ });
66
+ app.registerPlugin({
67
+ id: pluginId_1.default,
68
+ initializer: Initializer_1.default,
69
+ isReady: false,
70
+ name,
71
+ });
72
+ },
73
+ bootstrap(app) { },
74
+ async registerTrads({ locales }) {
75
+ const importedTrads = await Promise.all(locales.map((locale) => {
76
+ return Promise.resolve(`${
77
+ /* webpackChunkName: "translation-[request]" */ `./translations/${locale}.json`}`).then(s => __importStar(require(s))).then(({ default: data }) => {
78
+ return {
79
+ data: (0, helper_plugin_1.prefixPluginTranslations)(data, pluginId_1.default),
80
+ locale,
81
+ };
82
+ })
83
+ .catch(() => {
84
+ return {
85
+ data: {},
86
+ locale,
87
+ };
88
+ });
89
+ }));
90
+ return Promise.resolve(importedTrads);
91
+ },
92
+ };
@@ -0,0 +1,2 @@
1
+ declare const pluginId: string;
2
+ export default pluginId;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const package_json_1 = __importDefault(require("../package.json"));
7
+ const pluginId = package_json_1.default.strapi.name;
8
+ exports.default = pluginId;
@@ -15,7 +15,8 @@ const Initializer = ({ setPlugin }) => {
15
15
  const ref = (0, react_1.useRef)();
16
16
  ref.current = setPlugin;
17
17
  (0, react_1.useEffect)(() => {
18
- ref.current(pluginId_1.default);
18
+ if (ref.current != null)
19
+ ref.current(pluginId_1.default);
19
20
  }, []);
20
21
  return null;
21
22
  };
@@ -7,11 +7,12 @@ exports.SubNavigation = void 0;
7
7
  const react_1 = __importDefault(require("react"));
8
8
  const icons_1 = require("@strapi/icons");
9
9
  const design_system_1 = require("@strapi/design-system");
10
- const v2_1 = require("@strapi/design-system/v2");
10
+ const design_system_2 = require("@strapi/design-system");
11
11
  const react_router_dom_1 = require("react-router-dom");
12
12
  const pluginId_1 = __importDefault(require("../../pluginId"));
13
13
  const SubNavigation = ({ activeUrl }) => {
14
- const links = [{
14
+ const links = [
15
+ {
15
16
  id: 1,
16
17
  label: 'Setup Information',
17
18
  icon: icons_1.Connector,
@@ -28,13 +29,14 @@ const SubNavigation = ({ activeUrl }) => {
28
29
  label: 'Indexing Run Logs',
29
30
  icon: icons_1.Connector,
30
31
  to: `/plugins/${pluginId_1.default}/view-indexing-logs`,
31
- }];
32
+ },
33
+ ];
32
34
  return (react_1.default.createElement(design_system_1.Box, { style: {
33
- height: '100vh'
35
+ height: '100vh',
34
36
  }, background: "neutral200" },
35
- react_1.default.createElement(v2_1.SubNav, { ariaLabel: "Settings sub nav" },
36
- react_1.default.createElement(v2_1.SubNavHeader, { label: "Strapi Elasticsearch" }),
37
- react_1.default.createElement(v2_1.SubNavSections, null,
38
- react_1.default.createElement(v2_1.SubNavSection, null, links.map(link => link.icon && react_1.default.createElement(v2_1.SubNavLink, { as: react_router_dom_1.NavLink, to: link.to, icon: link.icon, key: link.id }, link.label)))))));
37
+ react_1.default.createElement(design_system_2.SubNav, { ariaLabel: "Settings sub nav" },
38
+ react_1.default.createElement(design_system_2.SubNavHeader, { label: "Strapi Elasticsearch" }),
39
+ react_1.default.createElement(design_system_2.SubNavSections, null,
40
+ react_1.default.createElement(design_system_2.SubNavSection, null, links.map((link) => link.icon && (react_1.default.createElement(design_system_2.SubNavLink, { as: react_router_dom_1.NavLink, to: link.to, icon: link.icon, key: link.id }, link.label))))))));
39
41
  };
40
42
  exports.SubNavigation = SubNavigation;
@@ -45,7 +45,6 @@ const react_1 = __importStar(require("react"));
45
45
  // import PropTypes from 'prop-types';
46
46
  const pluginId_1 = __importDefault(require("../../pluginId"));
47
47
  const SubNavigation_1 = require("../../components/SubNavigation");
48
- ;
49
48
  const design_system_1 = require("@strapi/design-system");
50
49
  const react_2 = require("react");
51
50
  const apiUrls_1 = require("../../utils/apiUrls");
@@ -60,8 +59,9 @@ const design_system_6 = require("@strapi/design-system");
60
59
  const design_system_7 = require("@strapi/design-system");
61
60
  const helper_plugin_1 = require("@strapi/helper-plugin");
62
61
  const exportContentConfig = () => {
63
- return axiosInstance_1.default.get(apiUrls_1.apiGetContentConfig, {
64
- responseType: 'blob'
62
+ return axiosInstance_1.default
63
+ .get(apiUrls_1.apiGetContentConfig, {
64
+ responseType: 'blob',
65
65
  })
66
66
  .then((response) => {
67
67
  const href = URL.createObjectURL(response.data);
@@ -76,12 +76,11 @@ const exportContentConfig = () => {
76
76
  };
77
77
  const importContentConfig = (conf) => {
78
78
  return axiosInstance_1.default.post(apiUrls_1.apiImportContentConfig, {
79
- data: conf
79
+ data: conf,
80
80
  });
81
81
  };
82
82
  const loadContentConfig = () => {
83
- return axiosInstance_1.default.get(apiUrls_1.apiGetContentConfig)
84
- .then((resp) => resp.data);
83
+ return axiosInstance_1.default.get(apiUrls_1.apiGetContentConfig).then((resp) => resp.data);
85
84
  };
86
85
  const scheduleCollectionIndexing = (collectionName) => {
87
86
  return axiosInstance_1.default.get((0, apiUrls_1.apiRequestCollectionIndexing)(collectionName));
@@ -90,7 +89,7 @@ const Configure = () => {
90
89
  const [isInProgress, setIsInProgress] = (0, react_1.useState)(false);
91
90
  const [displayImportModal, setDisplayImportModal] = (0, react_1.useState)(false);
92
91
  const [isEnteredJsonValid, setIsEnteredJsonValid] = (0, react_1.useState)(true);
93
- const [importJson, setImportJson] = (0, react_1.useState)(null);
92
+ const [importJson, setImportJson] = (0, react_1.useState)('');
94
93
  const [config, setConfig] = (0, react_1.useState)(null);
95
94
  const history = (0, react_router_dom_1.useHistory)();
96
95
  const toggleNotification = (0, helper_plugin_1.useNotification)();
@@ -102,12 +101,16 @@ const Configure = () => {
102
101
  importContentConfig(conf)
103
102
  .then(() => {
104
103
  toggleNotification({
105
- type: "success", message: "Collections configuration imported. Please refresh this view.", timeout: 5000
104
+ type: 'success',
105
+ message: 'Collections configuration imported. Please refresh this view.',
106
+ timeout: 5000,
106
107
  });
107
108
  })
108
109
  .catch((err) => {
109
110
  toggleNotification({
110
- type: "warning", message: "Importing collections configuration failed. An error was encountered.", timeout: 5000
111
+ type: 'warning',
112
+ message: 'Importing collections configuration failed. An error was encountered.',
113
+ timeout: 5000,
111
114
  });
112
115
  console.log(err);
113
116
  })
@@ -119,12 +122,16 @@ const Configure = () => {
119
122
  exportContentConfig()
120
123
  .then(() => {
121
124
  toggleNotification({
122
- type: "success", message: "Collections configuration exported.", timeout: 5000
125
+ type: 'success',
126
+ message: 'Collections configuration exported.',
127
+ timeout: 5000,
123
128
  });
124
129
  })
125
130
  .catch((err) => {
126
131
  toggleNotification({
127
- type: "warning", message: "Exporting collections configuration failed. An error was encountered.", timeout: 5000
132
+ type: 'warning',
133
+ message: 'Exporting collections configuration failed. An error was encountered.',
134
+ timeout: 5000,
128
135
  });
129
136
  console.log(err);
130
137
  })
@@ -147,7 +154,11 @@ const Configure = () => {
147
154
  .then((resp) => {
148
155
  const displayConfig = [];
149
156
  for (let r = 0; r < Object.keys(resp).length; r++) {
150
- const item = { collectionName: Object.keys(resp)[r], indexed: [], notIndexed: [] };
157
+ const item = {
158
+ collectionName: Object.keys(resp)[r],
159
+ indexed: [],
160
+ notIndexed: [],
161
+ };
151
162
  const collectionName = item.collectionName;
152
163
  for (let k = 0; k < Object.keys(resp[collectionName]).length; k++) {
153
164
  const attribs = resp[collectionName];
@@ -166,7 +177,9 @@ const Configure = () => {
166
177
  })
167
178
  .catch((err) => {
168
179
  toggleNotification({
169
- type: "warning", message: "An error was encountered while fetching the configuration.", timeout: 5000
180
+ type: 'warning',
181
+ message: 'An error was encountered while fetching the configuration.',
182
+ timeout: 5000,
170
183
  });
171
184
  console.log(err);
172
185
  })
@@ -186,11 +199,11 @@ const Configure = () => {
186
199
  config && (react_1.default.createElement(design_system_7.TwoColsLayout, { startCol: react_1.default.createElement(design_system_2.Table, { colCount: 4, rowCount: config.length },
187
200
  react_1.default.createElement(design_system_2.Thead, null,
188
201
  react_1.default.createElement(design_system_2.Tr, null,
189
- react_1.default.createElement(design_system_2.Th, { style: { width: "250px" } },
202
+ react_1.default.createElement(design_system_2.Th, { style: { width: '250px' } },
190
203
  react_1.default.createElement(design_system_3.Typography, { variant: "sigma" }, "Collection")),
191
- react_1.default.createElement(design_system_2.Th, { style: { width: "250px" } },
204
+ react_1.default.createElement(design_system_2.Th, { style: { width: '250px' } },
192
205
  react_1.default.createElement(design_system_3.Typography, { variant: "sigma" }, "Index")),
193
- react_1.default.createElement(design_system_2.Th, { style: { width: "250px" } },
206
+ react_1.default.createElement(design_system_2.Th, { style: { width: '250px' } },
194
207
  react_1.default.createElement(design_system_3.Typography, { variant: "sigma" }, "Do not Index")),
195
208
  react_1.default.createElement(design_system_2.Th, null,
196
209
  react_1.default.createElement(design_system_3.Typography, { variant: "sigma" }, "Actions")))),
@@ -198,10 +211,10 @@ const Configure = () => {
198
211
  return (react_1.default.createElement(design_system_2.Tr, { key: idx },
199
212
  react_1.default.createElement(design_system_2.Td, null,
200
213
  react_1.default.createElement(design_system_3.Typography, { textColor: "neutral600" }, collection.collectionName)),
201
- react_1.default.createElement(design_system_2.Td, null, collection.indexed.map((i) => react_1.default.createElement(design_system_1.Box, { paddingBottom: 2 },
202
- react_1.default.createElement(design_system_3.Typography, { textColor: "neutral600" }, i)))),
203
- react_1.default.createElement(design_system_2.Td, null, collection.notIndexed.map((i) => react_1.default.createElement(design_system_1.Box, { paddingBottom: 2 },
204
- react_1.default.createElement(design_system_3.Typography, { textColor: "neutral600" }, i)))),
214
+ react_1.default.createElement(design_system_2.Td, null, collection.indexed.map((i) => (react_1.default.createElement(design_system_1.Box, { paddingBottom: 2 },
215
+ react_1.default.createElement(design_system_3.Typography, { textColor: "neutral600" }, i))))),
216
+ react_1.default.createElement(design_system_2.Td, null, collection.notIndexed.map((i) => (react_1.default.createElement(design_system_1.Box, { paddingBottom: 2 },
217
+ react_1.default.createElement(design_system_3.Typography, { textColor: "neutral600" }, i))))),
205
218
  react_1.default.createElement(design_system_2.Td, null,
206
219
  react_1.default.createElement(design_system_4.IconButton, { onClick: () => history.push(`/plugins/${pluginId_1.default}/configure-collections/${collection.collectionName}`), label: "Edit collection configuration", noBorder: true, icon: react_1.default.createElement(icons_1.Pencil, null) }),
207
220
  react_1.default.createElement(design_system_4.IconButton, { onClick: () => scheduleCollectionIndexing(collection.collectionName), label: "Schedule indexing for all items in this collection", noBorder: true, icon: react_1.default.createElement(icons_1.Server, null) }))));
@@ -215,14 +228,13 @@ const Configure = () => {
215
228
  react_1.default.createElement(design_system_5.Button, { loading: isInProgress, fullWidth: true, variant: "secondary", onClick: performExport }, "Export")),
216
229
  react_1.default.createElement(design_system_1.Box, { paddingTop: 2, paddingBottom: 2 },
217
230
  react_1.default.createElement(design_system_5.Button, { loading: isInProgress, fullWidth: true, variant: "secondary", onClick: () => setDisplayImportModal(true) }, "Import"))))) })),
218
- displayImportModal &&
219
- react_1.default.createElement(design_system_6.ModalLayout, { onClose: () => setDisplayImportModal(false), labelledBy: "title" },
220
- react_1.default.createElement(design_system_6.ModalHeader, null,
221
- react_1.default.createElement(design_system_3.Typography, { fontWeight: "bold", textColor: "neutral800", as: "h2", id: "title" }, "Import Search Configuration")),
222
- react_1.default.createElement(design_system_6.ModalBody, null,
223
- react_1.default.createElement(design_system_7.Textarea, { label: "Configuration Json", error: !isEnteredJsonValid ? 'Invalid Json' : undefined, onChange: e => setImportJson(e.target.value) }, importJson)),
224
- react_1.default.createElement(design_system_6.ModalFooter, { startActions: react_1.default.createElement(design_system_5.Button, { onClick: () => setDisplayImportModal(false), variant: "tertiary" }, "Cancel"), endActions: react_1.default.createElement(react_1.default.Fragment, null,
225
- react_1.default.createElement(design_system_5.Button, { loading: isInProgress, onClick: performImport, disabled: !isEnteredJsonValid && !importJson.length > 0 }, "Import")) }))))));
231
+ displayImportModal && (react_1.default.createElement(design_system_6.ModalLayout, { onClose: () => setDisplayImportModal(false), labelledBy: "title" },
232
+ react_1.default.createElement(design_system_6.ModalHeader, null,
233
+ react_1.default.createElement(design_system_3.Typography, { fontWeight: "bold", textColor: "neutral800", as: "h2", id: "title" }, "Import Search Configuration")),
234
+ react_1.default.createElement(design_system_6.ModalBody, null,
235
+ react_1.default.createElement(design_system_7.Textarea, { label: "Configuration Json", error: !isEnteredJsonValid ? 'Invalid Json' : undefined, onChange: (e) => setImportJson(e.target.value) }, importJson)),
236
+ react_1.default.createElement(design_system_6.ModalFooter, { startActions: react_1.default.createElement(design_system_5.Button, { onClick: () => setDisplayImportModal(false), variant: "tertiary" }, "Cancel"), endActions: react_1.default.createElement(react_1.default.Fragment, null,
237
+ react_1.default.createElement(design_system_5.Button, { loading: isInProgress, onClick: performImport, disabled: !isEnteredJsonValid && !(importJson.length > 0) }, "Import")) })))))));
226
238
  }
227
239
  };
228
240
  exports.default = Configure;
@@ -116,32 +116,31 @@ const Homepage = () => {
116
116
  return react_1.default.createElement(helper_plugin_1.LoadingIndicatorPage, null);
117
117
  else
118
118
  return (react_1.default.createElement(design_system_1.Flex, { alignItems: "stretch", gap: 4 },
119
- react_1.default.createElement(SubNavigation_1.SubNavigation, null),
119
+ react_1.default.createElement(SubNavigation_1.SubNavigation, { activeUrl: "Setup Information" }),
120
120
  react_1.default.createElement(design_system_1.Box, { padding: 8, background: "neutral100", width: "100%" },
121
121
  react_1.default.createElement(design_system_1.Box, { paddingBottom: 4 },
122
122
  react_1.default.createElement(design_system_2.Typography, { variant: "alpha" }, "Setup Information")),
123
123
  react_1.default.createElement(design_system_1.Box, { width: "100%", paddingBottom: 4 },
124
124
  react_1.default.createElement(design_system_5.TwoColsLayout, { startCol: react_1.default.createElement(react_1.default.Fragment, null,
125
- react_1.default.createElement(design_system_4.Table, null, setupInfo && (Object.keys(setupInfo).map((k, idx) => {
126
- return (react_1.default.createElement(design_system_4.Tr, { key: idx },
127
- react_1.default.createElement(design_system_4.Td, null,
128
- react_1.default.createElement(design_system_1.Box, { padding: 2 },
129
- react_1.default.createElement(design_system_2.Typography, { textColor: "neutral600" },
130
- displayLabels[k],
131
- " :"))),
132
- react_1.default.createElement(design_system_4.Td, null,
133
- react_1.default.createElement(design_system_1.Box, { padding: 2 },
134
- react_1.default.createElement(design_system_6.Grid, null,
135
- react_1.default.createElement(design_system_6.GridItem, { padding: 2 },
136
- k === 'connected' && setupInfo[k] === true &&
137
- (react_1.default.createElement(design_system_2.Typography, { fontWeight: "bold", textColor: "success500" }, "Yes")),
138
- k === 'connected' && setupInfo[k] === false &&
139
- (react_1.default.createElement(design_system_2.Typography, { fontWeight: "bold", textColor: "danger500" }, "No")),
140
- k !== 'connected' &&
141
- (react_1.default.createElement(design_system_2.Typography, { textColor: "neutral600" }, String(setupInfo[k])))),
142
- react_1.default.createElement(design_system_6.GridItem, { padding: 1 }, k === 'connected' ?
143
- react_1.default.createElement(design_system_3.IconButton, { disabled: isInProgress, onClick: () => reloadElasticsearchSetupInfo({ showNotification: true }), label: "Refresh", icon: react_1.default.createElement(icons_1.Refresh, null) }) : null))))));
144
- })))), endCol: react_1.default.createElement(react_1.default.Fragment, null,
125
+ react_1.default.createElement(design_system_4.Table, null, setupInfo &&
126
+ Object.keys(setupInfo).map((k, idx) => {
127
+ return (react_1.default.createElement(design_system_4.Tr, { key: idx },
128
+ react_1.default.createElement(design_system_4.Td, null,
129
+ react_1.default.createElement(design_system_1.Box, { padding: 2 },
130
+ react_1.default.createElement(design_system_2.Typography, { textColor: "neutral600" },
131
+ displayLabels[k],
132
+ " :"))),
133
+ react_1.default.createElement(design_system_4.Td, null,
134
+ react_1.default.createElement(design_system_1.Box, { padding: 2 },
135
+ react_1.default.createElement(design_system_6.Grid, null,
136
+ react_1.default.createElement(design_system_6.GridItem, { padding: 2 },
137
+ k === 'connected' && setupInfo[k] === true && (react_1.default.createElement(design_system_2.Typography, { fontWeight: "bold", textColor: "success500" }, "Yes")),
138
+ k === 'connected' && setupInfo[k] === false && (react_1.default.createElement(design_system_2.Typography, { fontWeight: "bold", textColor: "danger500" }, "No")),
139
+ k !== 'connected' && (react_1.default.createElement(design_system_2.Typography, { textColor: "neutral600" }, String(setupInfo[k])))),
140
+ react_1.default.createElement(design_system_6.GridItem, { padding: 1 }, k === 'connected' ? (react_1.default.createElement(design_system_3.IconButton, { disabled: isInProgress, onClick: () => reloadElasticsearchSetupInfo({
141
+ showNotification: true,
142
+ }), label: "Refresh", icon: react_1.default.createElement(icons_1.Refresh, null) })) : null))))));
143
+ }))), endCol: react_1.default.createElement(react_1.default.Fragment, null,
145
144
  react_1.default.createElement(design_system_1.Box, { paddingLeft: 2, paddingRight: 2, paddingTop: 4, paddingBottom: 4 },
146
145
  react_1.default.createElement(design_system_1.Box, { paddingTop: 4, paddingBottom: 4 },
147
146
  react_1.default.createElement(design_system_2.Typography, { variant: "pi", fontWeight: "bold", textColor: "neutral600" }, "ACTIONS")),
@@ -1,2 +1,2 @@
1
- declare const pluginId: any;
1
+ declare const pluginId: string;
2
2
  export default pluginId;
@@ -4,6 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.apiImportContentConfig = exports.apiExportContentConfig = exports.apiTriggerIndexing = exports.apiRequestCollectionIndexing = exports.apiRequestReIndexing = exports.apiFetchRecentIndexingRunLog = exports.apiGetElasticsearchSetupInfo = exports.apiSaveCollectionConfig = exports.apiGetCollectionConfig = exports.apiGetContentConfig = void 0;
7
+ // import { collectionName } from "../../../server/content-types/tasks";
7
8
  const pluginId_1 = __importDefault(require("../pluginId"));
8
9
  exports.apiGetContentConfig = `/${pluginId_1.default}/content-config/`;
9
10
  const apiGetCollectionConfig = (collectionName) => `/${pluginId_1.default}/collection-config/${collectionName}`;
@@ -22,9 +22,8 @@ instance.interceptors.request.use(async (config) => {
22
22
  Promise.reject(error);
23
23
  });
24
24
  instance.interceptors.response.use(response => response, error => {
25
- var _a;
26
25
  // whatever you want to do with the error
27
- if (((_a = error.response) === null || _a === void 0 ? void 0 : _a.status) === 401) {
26
+ if (error.response?.status === 401) {
28
27
  helper_plugin_1.auth.clearAppStorage();
29
28
  window.location.reload();
30
29
  }
@@ -0,0 +1,63 @@
1
+ {
2
+ "name": "@vegan-friendly/strapi-plugin-elasticsearch",
3
+ "version": "0.1.0-alpha.3",
4
+ "description": "A Strapi plugin to enable using Elasticsearch with Strapi CMS.",
5
+ "homepage": "https://github.com/vegan-friendly/strapi-plugin-elasticsearch",
6
+ "strapi": {
7
+ "name": "elasticsearch",
8
+ "description": "A plugin to enable using Elasticsearch with Strapi CMS.",
9
+ "kind": "plugin",
10
+ "displayName": "Strapi <-> Elasticsearch",
11
+ "admin": {
12
+ "entry": "dist/admin/index.js",
13
+ "watchIgnoreFiles": [
14
+ "dist/admin/index.js"
15
+ ]
16
+ }
17
+ },
18
+ "repository": {
19
+ "type": "git",
20
+ "url": "git://github.com/vegan-friendly/strapi-plugin-elasticsearch.git"
21
+ },
22
+ "author": {
23
+ "name": "Punit Sethi",
24
+ "email": "punit@tezify.com",
25
+ "url": "https://punits.dev"
26
+ },
27
+ "main": "dist/server.js",
28
+ "module": "dist/server.js",
29
+ "types": "dist/index.d.ts",
30
+ "files": [
31
+ "dist"
32
+ ],
33
+ "scripts": {
34
+ "build": "tsc",
35
+ "develop": "tsc --watch"
36
+ },
37
+ "dependencies": {
38
+ "@elastic/elasticsearch": "^8.9.0",
39
+ "@strapi/design-system": "^1.19.0",
40
+ "markdown-to-txt": "^2.0.1"
41
+ },
42
+ "peerDependencies": {
43
+ "@strapi/strapi": "^4.0.0"
44
+ },
45
+ "maintainers": [
46
+ {
47
+ "name": "Punit Sethi",
48
+ "email": "punit@tezify.com",
49
+ "url": "https://punits.dev"
50
+ }
51
+ ],
52
+ "engines": {
53
+ "node": ">=16.0.0 <=20.x.x",
54
+ "npm": ">=6.0.0"
55
+ },
56
+ "license": "MIT",
57
+ "devDependencies": {
58
+ "@strapi/typescript-utils": "^5.12.5",
59
+ "@types/node": "^22.14.1",
60
+ "ts-node": "^10.9.2",
61
+ "typescript": "^5.8.3"
62
+ }
63
+ }
@@ -0,0 +1,4 @@
1
+ declare const _default: ({ strapi }: {
2
+ strapi: any;
3
+ }) => Promise<void>;
4
+ export default _default;
@@ -1,6 +1,7 @@
1
1
  'use strict';
2
+ Object.defineProperty(exports, "__esModule", { value: true });
2
3
  console.log('strapi-plugin-elasticsearch : 00 Initializing strapi-plugin-elasticsearch plugin.');
3
- module.exports = async ({ strapi }) => {
4
+ exports.default = async ({ strapi }) => {
4
5
  const pluginConfig = await strapi.config.get('plugin.elasticsearch');
5
6
  const configureIndexingService = strapi.plugins['elasticsearch'].services.configureIndexing;
6
7
  const scheduleIndexingService = strapi.plugins['elasticsearch'].services.scheduleIndexing;
@@ -71,8 +72,7 @@ module.exports = async ({ strapi }) => {
71
72
  if (Object.keys(event.params.where.id).includes('$in')) {
72
73
  const updatedItemIds = event.params.where.id['$in'];
73
74
  //bulk unpublish
74
- if (typeof event.params.data.publishedAt === 'undefined' ||
75
- event.params.data.publishedAt === null) {
75
+ if (typeof event.params.data.publishedAt === 'undefined' || event.params.data.publishedAt === null) {
76
76
  for (let k = 0; k < updatedItemIds.length; k++) {
77
77
  await scheduleIndexingService.removeItemFromIndex({
78
78
  collectionUid: event.model.uid,
@@ -0,0 +1,5 @@
1
+ declare const _default: {
2
+ default: {};
3
+ validator(): void;
4
+ };
5
+ export default _default;
@@ -1,5 +1,6 @@
1
1
  'use strict';
2
- module.exports = {
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = {
3
4
  default: {},
4
5
  validator() { },
5
6
  };
@@ -1,2 +1,83 @@
1
- declare const task: any;
2
- declare const indexingLog: any;
1
+ declare const _default: {
2
+ task: {
3
+ schema: {
4
+ kind: string;
5
+ collectionName: string;
6
+ info: {
7
+ singularName: string;
8
+ pluralName: string;
9
+ displayName: string;
10
+ description: string;
11
+ };
12
+ options: {
13
+ draftAndPublish: boolean;
14
+ };
15
+ pluginOptions: {
16
+ 'content-manager': {
17
+ visible: boolean;
18
+ };
19
+ 'content-type-builder': {
20
+ visible: boolean;
21
+ };
22
+ };
23
+ attributes: {
24
+ collection_name: {
25
+ type: string;
26
+ required: boolean;
27
+ };
28
+ item_id: {
29
+ type: string;
30
+ };
31
+ indexing_status: {
32
+ type: string;
33
+ enum: string[];
34
+ required: boolean;
35
+ default: string;
36
+ };
37
+ full_site_indexing: {
38
+ type: string;
39
+ };
40
+ indexing_type: {
41
+ type: string;
42
+ enum: string[];
43
+ default: string;
44
+ required: boolean;
45
+ };
46
+ };
47
+ };
48
+ };
49
+ 'indexing-log': {
50
+ schema: {
51
+ kind: string;
52
+ collectionName: string;
53
+ info: {
54
+ singularName: string;
55
+ pluralName: string;
56
+ displayName: string;
57
+ description: string;
58
+ };
59
+ options: {
60
+ draftAndPublish: boolean;
61
+ };
62
+ pluginOptions: {
63
+ 'content-manager': {
64
+ visible: boolean;
65
+ };
66
+ 'content-type-builder': {
67
+ visible: boolean;
68
+ };
69
+ };
70
+ attributes: {
71
+ status: {
72
+ type: string;
73
+ enum: string[];
74
+ required: boolean;
75
+ };
76
+ details: {
77
+ type: string;
78
+ };
79
+ };
80
+ };
81
+ };
82
+ };
83
+ export default _default;
@@ -1,7 +1,11 @@
1
1
  'use strict';
2
- const task = require('./tasks');
3
- const indexingLog = require('./indexing-logs');
4
- module.exports = {
5
- 'task': { schema: task },
6
- 'indexing-log': { schema: indexingLog }
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const tasks_1 = __importDefault(require("./tasks"));
7
+ const indexing_logs_1 = __importDefault(require("./indexing-logs"));
8
+ exports.default = {
9
+ task: { schema: tasks_1.default },
10
+ 'indexing-log': { schema: indexing_logs_1.default },
7
11
  };