@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,32 @@
1
+ declare const _default: {
2
+ kind: string;
3
+ collectionName: string;
4
+ info: {
5
+ singularName: string;
6
+ pluralName: string;
7
+ displayName: string;
8
+ description: string;
9
+ };
10
+ options: {
11
+ draftAndPublish: boolean;
12
+ };
13
+ pluginOptions: {
14
+ 'content-manager': {
15
+ visible: boolean;
16
+ };
17
+ 'content-type-builder': {
18
+ visible: boolean;
19
+ };
20
+ };
21
+ attributes: {
22
+ status: {
23
+ type: string;
24
+ enum: string[];
25
+ required: boolean;
26
+ };
27
+ details: {
28
+ type: string;
29
+ };
30
+ };
31
+ };
32
+ export default _default;
@@ -1,35 +1,33 @@
1
1
  "use strict";
2
- module.exports = {
3
- "kind": "collectionType",
4
- "collectionName": "indexing-log",
5
- "info": {
6
- "singularName": "indexing-log",
7
- "pluralName": "indexing-logs",
8
- "displayName": "Indexing Logs",
9
- "description": "Logged runs of the indexing cron job"
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = {
4
+ kind: 'collectionType',
5
+ collectionName: 'indexing-log',
6
+ info: {
7
+ singularName: 'indexing-log',
8
+ pluralName: 'indexing-logs',
9
+ displayName: 'Indexing Logs',
10
+ description: 'Logged runs of the indexing cron job',
10
11
  },
11
- "options": {
12
- "draftAndPublish": false
12
+ options: {
13
+ draftAndPublish: false,
13
14
  },
14
- "pluginOptions": {
15
+ pluginOptions: {
15
16
  'content-manager': {
16
17
  visible: false,
17
18
  },
18
19
  'content-type-builder': {
19
20
  visible: false,
20
- }
21
+ },
21
22
  },
22
- "attributes": {
23
- "status": {
24
- "type": "enumeration",
25
- "enum": [
26
- "pass",
27
- "fail"
28
- ],
29
- "required": true
23
+ attributes: {
24
+ status: {
25
+ type: 'enumeration',
26
+ enum: ['pass', 'fail'],
27
+ required: true,
28
+ },
29
+ details: {
30
+ type: 'text',
30
31
  },
31
- "details": {
32
- "type": "text"
33
- }
34
- }
32
+ },
35
33
  };
@@ -0,0 +1,46 @@
1
+ declare const _default: {
2
+ kind: string;
3
+ collectionName: string;
4
+ info: {
5
+ singularName: string;
6
+ pluralName: string;
7
+ displayName: string;
8
+ description: string;
9
+ };
10
+ options: {
11
+ draftAndPublish: boolean;
12
+ };
13
+ pluginOptions: {
14
+ 'content-manager': {
15
+ visible: boolean;
16
+ };
17
+ 'content-type-builder': {
18
+ visible: boolean;
19
+ };
20
+ };
21
+ attributes: {
22
+ collection_name: {
23
+ type: string;
24
+ required: boolean;
25
+ };
26
+ item_id: {
27
+ type: string;
28
+ };
29
+ indexing_status: {
30
+ type: string;
31
+ enum: string[];
32
+ required: boolean;
33
+ default: string;
34
+ };
35
+ full_site_indexing: {
36
+ type: string;
37
+ };
38
+ indexing_type: {
39
+ type: string;
40
+ enum: string[];
41
+ default: string;
42
+ required: boolean;
43
+ };
44
+ };
45
+ };
46
+ export default _default;
@@ -1,52 +1,47 @@
1
1
  "use strict";
2
- module.exports = {
3
- "kind": "collectionType",
4
- "collectionName": "task",
5
- "info": {
6
- "singularName": "task",
7
- "pluralName": "tasks",
8
- "displayName": "Task",
9
- "description": "Search indexing tasks"
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = {
4
+ kind: 'collectionType',
5
+ collectionName: 'task',
6
+ info: {
7
+ singularName: 'task',
8
+ pluralName: 'tasks',
9
+ displayName: 'Task',
10
+ description: 'Search indexing tasks',
10
11
  },
11
- "options": {
12
- "draftAndPublish": false
12
+ options: {
13
+ draftAndPublish: false,
13
14
  },
14
- "pluginOptions": {
15
+ pluginOptions: {
15
16
  'content-manager': {
16
17
  visible: false,
17
18
  },
18
19
  'content-type-builder': {
19
20
  visible: false,
20
- }
21
+ },
21
22
  },
22
- "attributes": {
23
- "collection_name": {
24
- "type": "string",
25
- "required": true
23
+ attributes: {
24
+ collection_name: {
25
+ type: 'string',
26
+ required: true,
27
+ },
28
+ item_id: {
29
+ type: 'integer',
26
30
  },
27
- "item_id": {
28
- "type": "integer"
31
+ indexing_status: {
32
+ type: 'enumeration',
33
+ enum: ['to-be-done', 'done'],
34
+ required: true,
35
+ default: 'to-be-done',
29
36
  },
30
- "indexing_status": {
31
- "type": "enumeration",
32
- "enum": [
33
- "to-be-done",
34
- "done"
35
- ],
36
- "required": true,
37
- "default": "to-be-done"
37
+ full_site_indexing: {
38
+ type: 'boolean',
38
39
  },
39
- "full_site_indexing": {
40
- "type": "boolean"
40
+ indexing_type: {
41
+ type: 'enumeration',
42
+ enum: ['add-to-index', 'remove-from-index'],
43
+ default: 'add-to-index',
44
+ required: true,
41
45
  },
42
- "indexing_type": {
43
- "type": "enumeration",
44
- "enum": [
45
- "add-to-index",
46
- "remove-from-index"
47
- ],
48
- "default": "add-to-index",
49
- "required": true
50
- }
51
- }
46
+ },
52
47
  };
@@ -0,0 +1,11 @@
1
+ declare const _default: ({ strapi }: {
2
+ strapi: any;
3
+ }) => {
4
+ getContentConfig: (ctx: any) => Promise<any>;
5
+ setContentConfig: (ctx: any) => Promise<any>;
6
+ getCollectionConfig: (ctx: any) => Promise<any>;
7
+ saveCollectionConfig: (ctx: any) => Promise<any>;
8
+ exportContentConfig: (ctx: any) => Promise<any>;
9
+ importContentConfig: (ctx: any) => Promise<any>;
10
+ };
11
+ export default _default;
@@ -1,5 +1,6 @@
1
1
  'use strict';
2
- module.exports = ({ strapi }) => {
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = ({ strapi }) => {
3
4
  const configureIndexingService = strapi.plugins['elasticsearch'].services.configureIndexing;
4
5
  const getContentConfig = async (ctx) => {
5
6
  return configureIndexingService.getContentConfig();
@@ -53,6 +54,6 @@ module.exports = ({ strapi }) => {
53
54
  getCollectionConfig,
54
55
  saveCollectionConfig,
55
56
  exportContentConfig,
56
- importContentConfig
57
+ importContentConfig,
57
58
  };
58
59
  };
@@ -1,5 +1,33 @@
1
- declare const configureIndexing: any;
2
- declare const performSearch: any;
3
- declare const logIndexing: any;
4
- declare const setupInfo: any;
5
- declare const performIndexing: any;
1
+ declare const _default: {
2
+ configureIndexing: ({ strapi }: {
3
+ strapi: any;
4
+ }) => {
5
+ getContentConfig: (ctx: any) => Promise<any>;
6
+ setContentConfig: (ctx: any) => Promise<any>;
7
+ getCollectionConfig: (ctx: any) => Promise<any>;
8
+ saveCollectionConfig: (ctx: any) => Promise<any>;
9
+ exportContentConfig: (ctx: any) => Promise<any>;
10
+ importContentConfig: (ctx: any) => Promise<any>;
11
+ };
12
+ performSearch: {
13
+ search: (ctx: any) => Promise<void>;
14
+ };
15
+ logIndexing: ({ strapi }: {
16
+ strapi: any;
17
+ }) => {
18
+ fetchRecentRunsLog: (ctx: any) => Promise<any>;
19
+ };
20
+ setupInfo: ({ strapi }: {
21
+ strapi: any;
22
+ }) => {
23
+ getElasticsearchInfo: (ctx: any) => Promise<any>;
24
+ };
25
+ performIndexing: ({ strapi }: {
26
+ strapi: any;
27
+ }) => {
28
+ rebuildIndex: (ctx: any) => Promise<any>;
29
+ indexCollection: (ctx: any) => Promise<any>;
30
+ triggerIndexingTask: (ctx: any) => Promise<any>;
31
+ };
32
+ };
33
+ export default _default;
@@ -1,13 +1,17 @@
1
1
  'use strict';
2
- const configureIndexing = require('./configure-indexing');
3
- const performSearch = require('./perform-search');
4
- const logIndexing = require('./log-indexing');
5
- const setupInfo = require('./setup-info');
6
- const performIndexing = require('./perform-indexing');
7
- module.exports = {
8
- configureIndexing,
9
- performSearch,
10
- logIndexing,
11
- setupInfo,
12
- 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 log_indexing_1 = __importDefault(require("./log-indexing"));
9
+ const setup_info_1 = __importDefault(require("./setup-info"));
10
+ const perform_indexing_1 = __importDefault(require("./perform-indexing"));
11
+ exports.default = {
12
+ configureIndexing: configure_indexing_1.default,
13
+ performSearch: perform_search_1.default,
14
+ logIndexing: log_indexing_1.default,
15
+ setupInfo: setup_info_1.default,
16
+ performIndexing: perform_indexing_1.default,
13
17
  };
@@ -0,0 +1,6 @@
1
+ declare const _default: ({ strapi }: {
2
+ strapi: any;
3
+ }) => {
4
+ fetchRecentRunsLog: (ctx: any) => Promise<any>;
5
+ };
6
+ export default _default;
@@ -1,10 +1,11 @@
1
1
  "use strict";
2
- module.exports = ({ strapi }) => {
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = ({ strapi }) => {
3
4
  const logIndexingService = strapi.plugins['elasticsearch'].services.logIndexing;
4
5
  const fetchRecentRunsLog = async (ctx) => {
5
6
  return await logIndexingService.fetchIndexingLogs();
6
7
  };
7
8
  return {
8
- fetchRecentRunsLog
9
+ fetchRecentRunsLog,
9
10
  };
10
11
  };
@@ -0,0 +1,8 @@
1
+ declare const _default: ({ strapi }: {
2
+ strapi: any;
3
+ }) => {
4
+ rebuildIndex: (ctx: any) => Promise<any>;
5
+ indexCollection: (ctx: any) => Promise<any>;
6
+ triggerIndexingTask: (ctx: any) => Promise<any>;
7
+ };
8
+ export default _default;
@@ -1,5 +1,6 @@
1
1
  'use strict';
2
- module.exports = ({ strapi }) => {
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = ({ strapi }) => {
3
4
  const indexer = strapi.plugins['elasticsearch'].services.indexer;
4
5
  const scheduleIndexingService = strapi.plugins['elasticsearch'].services.scheduleIndexing;
5
6
  const rebuildIndex = async (ctx) => {
@@ -17,6 +18,6 @@ module.exports = ({ strapi }) => {
17
18
  return {
18
19
  rebuildIndex,
19
20
  indexCollection,
20
- triggerIndexingTask
21
+ triggerIndexingTask,
21
22
  };
22
23
  };
@@ -1 +1,4 @@
1
- declare const qs: any;
1
+ declare const _default: {
2
+ search: (ctx: any) => Promise<void>;
3
+ };
4
+ export default _default;
@@ -1,15 +1,18 @@
1
1
  'use strict';
2
- const qs = require('qs');
3
- module.exports = {
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 qs_1 = __importDefault(require("qs"));
7
+ exports.default = {
4
8
  search: async (ctx) => {
5
- var _a;
6
9
  try {
7
10
  const esInterface = strapi.plugins['elasticsearch'].services.esInterface;
8
11
  if (ctx.query.query) {
9
- const query = qs.parse(ctx.query.query);
12
+ const query = qs_1.default.parse(ctx.query.query);
10
13
  const resp = await esInterface.searchData(query);
11
- if ((_a = resp === null || resp === void 0 ? void 0 : resp.hits) === null || _a === void 0 ? void 0 : _a.hits) {
12
- const filteredData = resp.hits.hits.filter(dt => dt._source !== null);
14
+ if (resp?.hits?.hits) {
15
+ const filteredData = resp.hits.hits.filter((dt) => dt._source !== null);
13
16
  const filteredMatches = filteredData.map((dt) => dt['_source']);
14
17
  ctx.body = filteredMatches;
15
18
  }
@@ -21,9 +24,9 @@ module.exports = {
21
24
  }
22
25
  catch (err) {
23
26
  ctx.response.status = 500;
24
- ctx.body = "An error was encountered while processing the search request.";
27
+ ctx.body = 'An error was encountered while processing the search request.';
25
28
  console.log('An error was encountered while processing the search request.');
26
29
  console.log(err);
27
30
  }
28
- }
31
+ },
29
32
  };
@@ -0,0 +1,6 @@
1
+ declare const _default: ({ strapi }: {
2
+ strapi: any;
3
+ }) => {
4
+ getElasticsearchInfo: (ctx: any) => Promise<any>;
5
+ };
6
+ export default _default;
@@ -1,5 +1,6 @@
1
1
  'use strict';
2
- module.exports = ({ strapi }) => {
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.default = ({ strapi }) => {
3
4
  const helperService = strapi.plugins['elasticsearch'].services.helper;
4
5
  const getElasticsearchInfo = async (ctx) => {
5
6
  return helperService.getElasticsearchInfo();
@@ -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
  // destroy phase
4
5
  };