@vegan-friendly/strapi-plugin-elasticsearch 0.1.0-alpha.3 → 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 (97) hide show
  1. package/dist/admin/index.js +4 -4
  2. package/dist/admin/pluginId.js +1 -1
  3. package/dist/admin/src/components/Initializer/index.js +2 -1
  4. package/dist/admin/src/components/SubNavigation/index.js +10 -8
  5. package/dist/admin/src/pages/ConfigureCollectionList/index.js +40 -28
  6. package/dist/admin/src/pages/Homepage/index.js +20 -21
  7. package/dist/admin/src/pluginId.d.ts +1 -1
  8. package/dist/admin/src/utils/apiUrls.js +1 -0
  9. package/dist/admin/src/utils/axiosInstance.js +1 -2
  10. package/dist/package.json +63 -0
  11. package/dist/server/bootstrap.d.ts +4 -0
  12. package/dist/server/bootstrap.js +3 -3
  13. package/dist/server/config/index.d.ts +5 -0
  14. package/dist/server/config/index.js +2 -1
  15. package/dist/server/content-types/index.d.ts +83 -2
  16. package/dist/server/content-types/index.js +9 -5
  17. package/dist/server/content-types/indexing-logs.d.ts +32 -0
  18. package/dist/server/content-types/indexing-logs.js +22 -24
  19. package/dist/server/content-types/tasks.d.ts +46 -0
  20. package/dist/server/content-types/tasks.js +33 -38
  21. package/dist/server/controllers/configure-indexing.d.ts +11 -0
  22. package/dist/server/controllers/configure-indexing.js +3 -2
  23. package/dist/server/controllers/index.d.ts +33 -5
  24. package/dist/server/controllers/index.js +15 -11
  25. package/dist/server/controllers/log-indexing.d.ts +6 -0
  26. package/dist/server/controllers/log-indexing.js +3 -2
  27. package/dist/server/controllers/perform-indexing.d.ts +8 -0
  28. package/dist/server/controllers/perform-indexing.js +3 -2
  29. package/dist/server/controllers/perform-search.d.ts +4 -1
  30. package/dist/server/controllers/perform-search.js +11 -8
  31. package/dist/server/controllers/setup-info.d.ts +6 -0
  32. package/dist/server/controllers/setup-info.js +2 -1
  33. package/dist/server/destroy.d.ts +4 -0
  34. package/dist/server/destroy.js +2 -1
  35. package/dist/server/index.d.ts +312 -10
  36. package/dist/server/index.js +25 -21
  37. package/dist/server/middlewares/index.d.ts +2 -0
  38. package/dist/server/middlewares/index.js +2 -1
  39. package/dist/server/policies/index.d.ts +2 -0
  40. package/dist/server/policies/index.js +2 -1
  41. package/dist/server/register.d.ts +4 -0
  42. package/dist/server/register.js +2 -1
  43. package/dist/server/routes/configure-indexing.d.ts +12 -0
  44. package/dist/server/routes/configure-indexing.js +2 -1
  45. package/dist/server/routes/index.d.ts +58 -5
  46. package/dist/server/routes/index.js +15 -11
  47. package/dist/server/routes/perform-indexing.d.ts +12 -0
  48. package/dist/server/routes/perform-indexing.js +2 -1
  49. package/dist/server/routes/perform-search.d.ts +12 -0
  50. package/dist/server/routes/perform-search.js +4 -3
  51. package/dist/server/routes/run-log.d.ts +12 -0
  52. package/dist/server/routes/run-log.js +3 -2
  53. package/dist/server/routes/setup-info.d.ts +12 -0
  54. package/dist/server/routes/setup-info.js +3 -2
  55. package/dist/server/services/configure-indexing.d.ts +23 -23
  56. package/dist/server/services/configure-indexing.js +30 -18
  57. package/dist/server/services/es-interface.d.ts +27 -4
  58. package/dist/server/services/es-interface.js +13 -14
  59. package/dist/server/services/helper.d.ts +34 -33
  60. package/dist/server/services/helper.js +31 -23
  61. package/dist/server/services/index.d.ts +124 -7
  62. package/dist/server/services/index.js +19 -15
  63. package/dist/server/services/log-indexing.d.ts +8 -0
  64. package/dist/server/services/log-indexing.js +8 -7
  65. package/dist/server/services/perform-indexing.d.ts +8 -0
  66. package/dist/server/services/perform-indexing.js +29 -16
  67. package/dist/server/services/schedule-indexing.d.ts +19 -0
  68. package/dist/server/services/schedule-indexing.js +13 -12
  69. package/dist/server/services/transform-content.d.ts +7 -2
  70. package/dist/server/services/transform-content.js +4 -3
  71. package/package.json +4 -2
  72. package/dist/admin/components/Initializer/index.d.ts +0 -15
  73. package/dist/admin/components/Initializer/index.js +0 -25
  74. package/dist/admin/components/PluginIcon/index.d.ts +0 -8
  75. package/dist/admin/components/PluginIcon/index.js +0 -14
  76. package/dist/admin/components/SubNavigation/index.d.ts +0 -4
  77. package/dist/admin/components/SubNavigation/index.js +0 -40
  78. package/dist/admin/pages/App/index.d.ts +0 -9
  79. package/dist/admin/pages/App/index.js +0 -29
  80. package/dist/admin/pages/ConfigureCollection/index.d.ts +0 -3
  81. package/dist/admin/pages/ConfigureCollection/index.js +0 -193
  82. package/dist/admin/pages/ConfigureCollectionList/index.d.ts +0 -3
  83. package/dist/admin/pages/ConfigureCollectionList/index.js +0 -228
  84. package/dist/admin/pages/Homepage/index.d.ts +0 -3
  85. package/dist/admin/pages/Homepage/index.js +0 -155
  86. package/dist/admin/pages/ViewIndexingRunLog/index.d.ts +0 -3
  87. package/dist/admin/pages/ViewIndexingRunLog/index.js +0 -125
  88. package/dist/admin/utils/apiUrls.d.ts +0 -10
  89. package/dist/admin/utils/apiUrls.js +0 -20
  90. package/dist/admin/utils/axiosInstance.d.ts +0 -5
  91. package/dist/admin/utils/axiosInstance.js +0 -33
  92. package/dist/admin/utils/getTrad.d.ts +0 -2
  93. package/dist/admin/utils/getTrad.js +0 -8
  94. package/dist/strapi-admin.d.ts +0 -0
  95. package/dist/strapi-admin.js +0 -2
  96. package/dist/strapi-server.d.ts +0 -0
  97. package/dist/strapi-server.js +0 -2
@@ -1,23 +1,27 @@
1
1
  'use strict';
2
- const register = require('./register');
3
- const bootstrap = require('./bootstrap');
4
- const destroy = require('./destroy');
5
- const config = require('./config');
6
- const contentTypes = require('./content-types');
7
- const controllers = require('./controllers');
8
- const routes = require('./routes');
9
- const middlewares = require('./middlewares');
10
- const policies = require('./policies');
11
- const services = require('./services');
12
- module.exports = {
13
- register,
14
- bootstrap,
15
- destroy,
16
- config,
17
- controllers,
18
- routes,
19
- services,
20
- contentTypes,
21
- policies,
22
- middlewares,
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 register_1 = __importDefault(require("./register"));
7
+ const bootstrap_1 = __importDefault(require("./bootstrap"));
8
+ const destroy_1 = __importDefault(require("./destroy"));
9
+ const config_1 = __importDefault(require("./config"));
10
+ const content_types_1 = __importDefault(require("./content-types"));
11
+ const controllers_1 = __importDefault(require("./controllers"));
12
+ const routes_1 = __importDefault(require("./routes"));
13
+ const middlewares_1 = __importDefault(require("./middlewares"));
14
+ const policies_1 = __importDefault(require("./policies"));
15
+ const services_1 = __importDefault(require("./services"));
16
+ exports.default = {
17
+ register: register_1.default,
18
+ bootstrap: bootstrap_1.default,
19
+ destroy: destroy_1.default,
20
+ config: config_1.default,
21
+ controllers: controllers_1.default,
22
+ routes: routes_1.default,
23
+ services: services_1.default,
24
+ contentTypes: content_types_1.default,
25
+ policies: policies_1.default,
26
+ middlewares: middlewares_1.default,
23
27
  };
@@ -0,0 +1,2 @@
1
+ declare const _default: {};
2
+ export default _default;
@@ -1,2 +1,3 @@
1
1
  'use strict';
2
- module.exports = {};
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = {};
@@ -0,0 +1,2 @@
1
+ declare const _default: {};
2
+ export default _default;
@@ -1,2 +1,3 @@
1
1
  'use strict';
2
- module.exports = {};
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = {};
@@ -0,0 +1,4 @@
1
+ declare const _default: ({ strapi }: {
2
+ strapi: any;
3
+ }) => void;
4
+ export default _default;
@@ -1,4 +1,5 @@
1
1
  'use strict';
2
- module.exports = ({ strapi }) => {
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = ({ strapi }) => {
3
4
  // register phase
4
5
  };
@@ -0,0 +1,12 @@
1
+ declare const _default: {
2
+ type: string;
3
+ routes: {
4
+ method: string;
5
+ path: string;
6
+ handler: string;
7
+ config: {
8
+ policies: never[];
9
+ };
10
+ }[];
11
+ };
12
+ 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
  // accessible only from admin UI
4
5
  type: 'admin',
5
6
  routes: [
@@ -1,5 +1,58 @@
1
- declare const configureIndexingRoutes: any;
2
- declare const performSearch: any;
3
- declare const runLog: any;
4
- declare const setupInfo: any;
5
- declare const performIndexing: any;
1
+ declare const _default: {
2
+ config: {
3
+ type: string;
4
+ routes: {
5
+ method: string;
6
+ path: string;
7
+ handler: string;
8
+ config: {
9
+ policies: never[];
10
+ };
11
+ }[];
12
+ };
13
+ search: {
14
+ type: string;
15
+ routes: {
16
+ method: string;
17
+ path: string;
18
+ handler: string;
19
+ config: {
20
+ policies: never[];
21
+ };
22
+ }[];
23
+ };
24
+ runLog: {
25
+ type: string;
26
+ routes: {
27
+ method: string;
28
+ path: string;
29
+ handler: string;
30
+ config: {
31
+ policies: never[];
32
+ };
33
+ }[];
34
+ };
35
+ setupInfo: {
36
+ type: string;
37
+ routes: {
38
+ method: string;
39
+ path: string;
40
+ handler: string;
41
+ config: {
42
+ policies: never[];
43
+ };
44
+ }[];
45
+ };
46
+ performIndexing: {
47
+ type: string;
48
+ routes: {
49
+ method: string;
50
+ path: string;
51
+ handler: string;
52
+ config: {
53
+ policies: never[];
54
+ };
55
+ }[];
56
+ };
57
+ };
58
+ export default _default;
@@ -1,13 +1,17 @@
1
1
  "use strict";
2
- const configureIndexingRoutes = require('./configure-indexing');
3
- const performSearch = require('./perform-search');
4
- const runLog = require('./run-log');
5
- const setupInfo = require('./setup-info');
6
- const performIndexing = require('./perform-indexing');
7
- module.exports = {
8
- config: configureIndexingRoutes,
9
- search: performSearch,
10
- runLog: runLog,
11
- setupInfo: setupInfo,
12
- performIndexing: performIndexing
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 configure_indexing_1 = __importDefault(require("./configure-indexing"));
7
+ const perform_search_1 = __importDefault(require("./perform-search"));
8
+ const run_log_1 = __importDefault(require("./run-log"));
9
+ const setup_info_1 = __importDefault(require("./setup-info"));
10
+ const perform_indexing_1 = __importDefault(require("./perform-indexing"));
11
+ exports.default = {
12
+ config: configure_indexing_1.default,
13
+ search: perform_search_1.default,
14
+ runLog: run_log_1.default,
15
+ setupInfo: setup_info_1.default,
16
+ performIndexing: perform_indexing_1.default,
13
17
  };
@@ -0,0 +1,12 @@
1
+ declare const _default: {
2
+ type: string;
3
+ routes: {
4
+ method: string;
5
+ path: string;
6
+ handler: string;
7
+ config: {
8
+ policies: never[];
9
+ };
10
+ }[];
11
+ };
12
+ 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
  // accessible only from admin UI
4
5
  type: 'admin',
5
6
  routes: [
@@ -0,0 +1,12 @@
1
+ declare const _default: {
2
+ type: string;
3
+ routes: {
4
+ method: string;
5
+ path: string;
6
+ handler: string;
7
+ config: {
8
+ policies: never[];
9
+ };
10
+ }[];
11
+ };
12
+ 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
  // accessible only from admin UI
4
5
  type: 'content-api',
5
6
  routes: [
@@ -8,8 +9,8 @@ module.exports = {
8
9
  path: '/search',
9
10
  handler: 'performSearch.search',
10
11
  config: {
11
- policies: []
12
+ policies: [],
12
13
  },
13
- }
14
+ },
14
15
  ],
15
16
  };
@@ -0,0 +1,12 @@
1
+ declare const _default: {
2
+ type: string;
3
+ routes: {
4
+ method: string;
5
+ path: string;
6
+ handler: string;
7
+ config: {
8
+ policies: never[];
9
+ };
10
+ }[];
11
+ };
12
+ 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
  // accessible only from admin UI
4
5
  type: 'admin',
5
6
  routes: [
@@ -8,6 +9,6 @@ module.exports = {
8
9
  path: '/indexing-run-log',
9
10
  handler: 'logIndexing.fetchRecentRunsLog',
10
11
  config: { policies: [] },
11
- }
12
+ },
12
13
  ],
13
14
  };
@@ -0,0 +1,12 @@
1
+ declare const _default: {
2
+ type: string;
3
+ routes: {
4
+ method: string;
5
+ path: string;
6
+ handler: string;
7
+ config: {
8
+ policies: never[];
9
+ };
10
+ }[];
11
+ };
12
+ 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
  // accessible only from admin UI
4
5
  type: 'admin',
5
6
  routes: [
@@ -8,6 +9,6 @@ module.exports = {
8
9
  path: '/setup-info',
9
10
  handler: 'setupInfo.getElasticsearchInfo',
10
11
  config: { policies: [] },
11
- }
12
+ },
12
13
  ],
13
14
  };
@@ -1,24 +1,24 @@
1
- declare const getPluginStore: () => {
2
- get(params: Partial<{
3
- key: string;
4
- type?: string;
5
- environment?: string;
6
- name?: string;
7
- tag?: string;
8
- }>): Promise<unknown>;
9
- set(params: Partial<{
10
- key: string;
11
- value: unknown;
12
- type?: string;
13
- environment?: string;
14
- name?: string;
15
- tag?: string;
16
- }>): Promise<void>;
17
- delete(params: Partial<{
18
- key: string;
19
- type?: string;
20
- environment?: string;
21
- name?: string;
22
- tag?: string;
23
- }>): Promise<void>;
1
+ declare const _default: ({ strapi }: {
2
+ strapi: any;
3
+ }) => {
4
+ initializeStrapiElasticsearch(): Promise<void>;
5
+ markInitialized(): Promise<void>;
6
+ isInitialized(): any;
7
+ cacheConfig(): Promise<void>;
8
+ getCollectionConfig({ collectionName }: {
9
+ collectionName: any;
10
+ }): Promise<{} | null>;
11
+ getCollectionsConfiguredForIndexing(): Promise<string[]>;
12
+ isCollectionConfiguredToBeIndexed({ collectionName }: {
13
+ collectionName: any;
14
+ }): Promise<boolean>;
15
+ getContentConfig(): Promise<any>;
16
+ importContentConfig({ config }: {
17
+ config: any;
18
+ }): Promise<any>;
19
+ setContentConfig({ collection, config }: {
20
+ collection: any;
21
+ config: any;
22
+ }): Promise<any>;
24
23
  };
24
+ export default _default;
@@ -1,4 +1,5 @@
1
1
  'use strict';
2
+ Object.defineProperty(exports, "__esModule", { value: true });
2
3
  const getPluginStore = () => {
3
4
  return strapi.store({
4
5
  environment: '',
@@ -6,7 +7,7 @@ const getPluginStore = () => {
6
7
  name: 'elasticsearch',
7
8
  });
8
9
  };
9
- module.exports = ({ strapi }) => ({
10
+ exports.default = ({ strapi }) => ({
10
11
  async initializeStrapiElasticsearch() {
11
12
  await this.cacheConfig();
12
13
  },
@@ -16,8 +17,7 @@ module.exports = ({ strapi }) => ({
16
17
  strapi.elasticsearch.initialized = true;
17
18
  },
18
19
  isInitialized() {
19
- var _a;
20
- return ((_a = strapi.elasticsearch) === null || _a === void 0 ? void 0 : _a.initialized) || false;
20
+ return strapi.elasticsearch?.initialized || false;
21
21
  },
22
22
  async cacheConfig() {
23
23
  if (!strapi.elasticsearch)
@@ -57,7 +57,14 @@ module.exports = ({ strapi }) => ({
57
57
  return collectionsToIndex.includes(collectionName);
58
58
  },
59
59
  async getContentConfig() {
60
- const fieldsToExclude = ['createdAt', 'createdBy', 'publishedAt', 'publishedBy', 'updatedAt', 'updatedBy'];
60
+ const fieldsToExclude = [
61
+ 'createdAt',
62
+ 'createdBy',
63
+ 'publishedAt',
64
+ 'publishedBy',
65
+ 'updatedAt',
66
+ 'updatedBy',
67
+ ];
61
68
  const pluginStore = getPluginStore();
62
69
  const settings = await pluginStore.get({ key: 'configsettings' });
63
70
  const contentTypes = strapi.contentTypes;
@@ -69,16 +76,18 @@ module.exports = ({ strapi }) => ({
69
76
  const listOfAttributes = Object.keys(collectionAttributes).filter((i) => fieldsToExclude.includes(i) === false);
70
77
  for (let k = 0; k < listOfAttributes.length; k++) {
71
78
  const currentAttribute = listOfAttributes[k];
72
- let attributeType = "regular";
73
- if (typeof collectionAttributes[currentAttribute]["type"] !== "undefined"
74
- && collectionAttributes[currentAttribute]["type"] !== null) {
75
- if (collectionAttributes[currentAttribute]["type"] === "component")
76
- attributeType = "component";
77
- else if (collectionAttributes[currentAttribute]["type"] === "dynamiczone")
78
- attributeType = "dynamiczone";
79
+ let attributeType = 'regular';
80
+ if (typeof collectionAttributes[currentAttribute]['type'] !== 'undefined' &&
81
+ collectionAttributes[currentAttribute]['type'] !== null) {
82
+ if (collectionAttributes[currentAttribute]['type'] === 'component')
83
+ attributeType = 'component';
84
+ else if (collectionAttributes[currentAttribute]['type'] === 'dynamiczone')
85
+ attributeType = 'dynamiczone';
79
86
  }
80
- apiContentConfig[apiContentTypes[r]][listOfAttributes[k]] = { index: false,
81
- type: attributeType };
87
+ apiContentConfig[apiContentTypes[r]][listOfAttributes[k]] = {
88
+ index: false,
89
+ type: attributeType,
90
+ };
82
91
  }
83
92
  }
84
93
  if (settings) {
@@ -90,12 +99,15 @@ module.exports = ({ strapi }) => ({
90
99
  const attribsForCollection = Object.keys(apiContentConfig[collections[r]]);
91
100
  for (let s = 0; s < attribsForCollection.length; s++) {
92
101
  if (!Object.keys(objSettings['contentConfig'][collections[r]]).includes(attribsForCollection[s])) {
93
- objSettings['contentConfig'][collections[r]][attribsForCollection[s]] = { index: false,
94
- type: apiContentConfig[collections[r]][attribsForCollection[s]].type };
102
+ objSettings['contentConfig'][collections[r]][attribsForCollection[s]] = {
103
+ index: false,
104
+ type: apiContentConfig[collections[r]][attribsForCollection[s]].type,
105
+ };
95
106
  }
96
107
  else {
97
108
  if (!Object.keys(objSettings['contentConfig'][collections[r]][attribsForCollection[s]]).includes('type'))
98
- objSettings['contentConfig'][collections[r]][attribsForCollection[s]]['type'] = apiContentConfig[collections[r]][attribsForCollection[s]].type;
109
+ objSettings['contentConfig'][collections[r]][attribsForCollection[s]]['type'] =
110
+ apiContentConfig[collections[r]][attribsForCollection[s]].type;
99
111
  }
100
112
  }
101
113
  }
@@ -120,7 +132,7 @@ module.exports = ({ strapi }) => ({
120
132
  await pluginStore.set({ key: 'configsettings', value: stringifySettings });
121
133
  }
122
134
  else {
123
- const newSettings = JSON.stringify({ 'contentConfig': config });
135
+ const newSettings = JSON.stringify({ contentConfig: config });
124
136
  await pluginStore.set({ key: 'configsettings', value: newSettings });
125
137
  }
126
138
  const updatedSettings = await pluginStore.get({ key: 'configsettings' });
@@ -148,7 +160,7 @@ module.exports = ({ strapi }) => ({
148
160
  await pluginStore.set({ key: 'configsettings', value: stringifySettings });
149
161
  }
150
162
  else {
151
- const newSettings = JSON.stringify({ 'contentConfig': config });
163
+ const newSettings = JSON.stringify({ contentConfig: config });
152
164
  await pluginStore.set({ key: 'configsettings', value: newSettings });
153
165
  }
154
166
  const updatedSettings = await pluginStore.get({ key: 'configsettings' });
@@ -1,4 +1,27 @@
1
- declare const Client: any;
2
- declare const fs: any;
3
- declare const path: any;
4
- declare let client: null;
1
+ declare const _default: ({ strapi }: {
2
+ strapi: any;
3
+ }) => {
4
+ initializeSearchEngine({ host, uname, password, cert }: {
5
+ host: any;
6
+ uname: any;
7
+ password: any;
8
+ cert: any;
9
+ }): Promise<void>;
10
+ createIndex(indexName: any): Promise<void>;
11
+ deleteIndex(indexName: any): Promise<void>;
12
+ attachAliasToIndex(indexName: any): Promise<void>;
13
+ checkESConnection(): Promise<boolean>;
14
+ indexDataToSpecificIndex({ itemId, itemData }: {
15
+ itemId: any;
16
+ itemData: any;
17
+ }, iName: any): Promise<void>;
18
+ indexData({ itemId, itemData }: {
19
+ itemId: any;
20
+ itemData: any;
21
+ }): Promise<void>;
22
+ removeItemFromIndex({ itemId }: {
23
+ itemId: any;
24
+ }): Promise<void>;
25
+ searchData(searchQuery: any): Promise<any>;
26
+ };
27
+ export default _default;
@@ -1,21 +1,20 @@
1
1
  "use strict";
2
- const { Client } = require('@elastic/elasticsearch');
3
- const fs = require('fs');
4
- const path = require('path');
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const elasticsearch_1 = require("@elastic/elasticsearch");
5
4
  let client = null;
6
- module.exports = ({ strapi }) => ({
5
+ exports.default = ({ strapi }) => ({
7
6
  async initializeSearchEngine({ host, uname, password, cert }) {
8
7
  try {
9
- client = new Client({
8
+ client = new elasticsearch_1.Client({
10
9
  node: host,
11
10
  auth: {
12
11
  username: uname,
13
- password: password
12
+ password: password,
14
13
  },
15
14
  tls: {
16
15
  ca: cert,
17
- rejectUnauthorized: false
18
- }
16
+ rejectUnauthorized: false,
17
+ },
19
18
  });
20
19
  }
21
20
  catch (err) {
@@ -27,7 +26,7 @@ module.exports = ({ strapi }) => ({
27
26
  console.error('strapi-plugin-elasticsearch : Error while initializing connection to ElasticSearch.');
28
27
  console.error(err);
29
28
  }
30
- throw (err);
29
+ throw err;
31
30
  }
32
31
  },
33
32
  async createIndex(indexName) {
@@ -54,7 +53,7 @@ module.exports = ({ strapi }) => ({
54
53
  async deleteIndex(indexName) {
55
54
  try {
56
55
  await client.indices.delete({
57
- index: indexName
56
+ index: indexName,
58
57
  });
59
58
  }
60
59
  catch (err) {
@@ -112,7 +111,7 @@ module.exports = ({ strapi }) => ({
112
111
  await client.index({
113
112
  index: iName,
114
113
  id: itemId,
115
- document: itemData
114
+ document: itemData,
116
115
  });
117
116
  await client.indices.refresh({ index: iName });
118
117
  }
@@ -131,7 +130,7 @@ module.exports = ({ strapi }) => ({
131
130
  try {
132
131
  await client.delete({
133
132
  index: pluginConfig.indexAliasName,
134
- id: itemId
133
+ id: itemId,
135
134
  });
136
135
  await client.indices.refresh({ index: pluginConfig.indexAliasName });
137
136
  }
@@ -149,7 +148,7 @@ module.exports = ({ strapi }) => ({
149
148
  const pluginConfig = await strapi.config.get('plugin.elasticsearch');
150
149
  const result = await client.search({
151
150
  index: pluginConfig.indexAliasName,
152
- ...searchQuery
151
+ ...searchQuery,
153
152
  });
154
153
  return result;
155
154
  }
@@ -157,5 +156,5 @@ module.exports = ({ strapi }) => ({
157
156
  console.log('Search : elasticClient.searchData : Error encountered while making a search request to ElasticSearch.');
158
157
  throw err;
159
158
  }
160
- }
159
+ },
161
160
  });
@@ -1,34 +1,35 @@
1
- declare const isEmpty: any, merge: any;
2
- declare const transformServiceProvider: any;
3
- declare const getPluginStore: () => {
4
- get(params: Partial<{
5
- key: string;
6
- type?: string;
7
- environment?: string;
8
- name?: string;
9
- tag?: string;
10
- }>): Promise<unknown>;
11
- set(params: Partial<{
12
- key: string;
13
- value: unknown;
14
- type?: string;
15
- environment?: string;
16
- name?: string;
17
- tag?: string;
18
- }>): Promise<void>;
19
- delete(params: Partial<{
20
- key: string;
21
- type?: string;
22
- environment?: string;
23
- name?: string;
24
- tag?: string;
25
- }>): Promise<void>;
1
+ declare const _default: ({ strapi }: {
2
+ strapi: any;
3
+ }) => {
4
+ getElasticsearchInfo(): Promise<{
5
+ indexingCronSchedule: any;
6
+ elasticHost: any;
7
+ elasticUserName: any;
8
+ elasticCertificate: any;
9
+ elasticIndexAlias: any;
10
+ connected: any;
11
+ initialized: any;
12
+ }>;
13
+ isCollectionDraftPublish({ collectionName }: {
14
+ collectionName: any;
15
+ }): boolean;
16
+ getPopulateAttribute({ collectionName }: {
17
+ collectionName: any;
18
+ }): true | {
19
+ populate: never;
20
+ } | undefined;
21
+ getIndexItemId({ collectionName, itemId }: {
22
+ collectionName: any;
23
+ itemId: any;
24
+ }): string;
25
+ getCurrentIndexName(): Promise<string>;
26
+ getIncrementedIndexName(): Promise<string>;
27
+ storeCurrentIndexName(indexName: any): Promise<void>;
28
+ modifySubfieldsConfigForExtractor(collectionConfig: any): any;
29
+ extractDataToIndex({ collectionName, data, collectionConfig }: {
30
+ collectionName: any;
31
+ data: any;
32
+ collectionConfig: any;
33
+ }): {};
26
34
  };
27
- declare const getModelPopulationAttributes: (model: any) => any;
28
- declare const getFullPopulateObject: (modelUid: any, maxDepth: number | undefined, ignore: any) => true | {
29
- populate: {};
30
- } | undefined;
31
- declare function extractSubfieldData({ config, data }: {
32
- config: any;
33
- data: any;
34
- }): string;
35
+ export default _default;