@webiny/api-headless-cms-ddb-es 0.0.0-mt-3 → 0.0.0-unstable.06b2ede40f
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.
- package/configurations.d.ts +15 -8
- package/configurations.js +29 -12
- package/configurations.js.map +1 -0
- package/definitions/entry.d.ts +6 -5
- package/definitions/entry.js +111 -20
- package/definitions/entry.js.map +1 -0
- package/definitions/entryElasticsearch.d.ts +6 -5
- package/definitions/entryElasticsearch.js +11 -16
- package/definitions/entryElasticsearch.js.map +1 -0
- package/definitions/group.d.ts +6 -5
- package/definitions/group.js +8 -16
- package/definitions/group.js.map +1 -0
- package/definitions/model.d.ts +6 -5
- package/definitions/model.js +30 -16
- package/definitions/model.js.map +1 -0
- package/definitions/system.d.ts +6 -5
- package/definitions/system.js +8 -16
- package/definitions/system.js.map +1 -0
- package/definitions/table.d.ts +6 -6
- package/definitions/table.js +7 -6
- package/definitions/table.js.map +1 -0
- package/definitions/tableElasticsearch.d.ts +6 -6
- package/definitions/tableElasticsearch.js +7 -6
- package/definitions/tableElasticsearch.js.map +1 -0
- package/dynamoDb/index.d.ts +2 -1
- package/dynamoDb/index.js +10 -12
- package/dynamoDb/index.js.map +1 -0
- package/dynamoDb/storage/longText.d.ts +7 -4
- package/dynamoDb/storage/longText.js +75 -62
- package/dynamoDb/storage/longText.js.map +1 -0
- package/dynamoDb/storage/richText.d.ts +2 -8
- package/dynamoDb/storage/richText.js +49 -100
- package/dynamoDb/storage/richText.js.map +1 -0
- package/elasticsearch/createElasticsearchIndex.d.ts +9 -0
- package/elasticsearch/createElasticsearchIndex.js +40 -0
- package/elasticsearch/createElasticsearchIndex.js.map +1 -0
- package/elasticsearch/deleteElasticsearchIndex.d.ts +8 -0
- package/elasticsearch/deleteElasticsearchIndex.js +38 -0
- package/elasticsearch/deleteElasticsearchIndex.js.map +1 -0
- package/elasticsearch/index.d.ts +1 -1
- package/elasticsearch/index.js +3 -6
- package/elasticsearch/index.js.map +1 -0
- package/elasticsearch/indexing/dateTimeIndexing.d.ts +1 -1
- package/elasticsearch/indexing/dateTimeIndexing.js +21 -22
- package/elasticsearch/indexing/dateTimeIndexing.js.map +1 -0
- package/elasticsearch/indexing/defaultFieldIndexing.d.ts +1 -1
- package/elasticsearch/indexing/defaultFieldIndexing.js +17 -10
- package/elasticsearch/indexing/defaultFieldIndexing.js.map +1 -0
- package/elasticsearch/indexing/index.js +5 -11
- package/elasticsearch/indexing/index.js.map +1 -0
- package/elasticsearch/indexing/jsonIndexing.d.ts +2 -0
- package/elasticsearch/indexing/jsonIndexing.js +28 -0
- package/elasticsearch/indexing/jsonIndexing.js.map +1 -0
- package/elasticsearch/indexing/longTextIndexing.d.ts +5 -1
- package/elasticsearch/indexing/longTextIndexing.js +16 -10
- package/elasticsearch/indexing/longTextIndexing.js.map +1 -0
- package/elasticsearch/indexing/numberIndexing.d.ts +1 -1
- package/elasticsearch/indexing/numberIndexing.js +2 -9
- package/elasticsearch/indexing/numberIndexing.js.map +1 -0
- package/elasticsearch/indexing/objectIndexing.d.ts +10 -1
- package/elasticsearch/indexing/objectIndexing.js +37 -36
- package/elasticsearch/indexing/objectIndexing.js.map +1 -0
- package/elasticsearch/indexing/richTextIndexing.d.ts +1 -1
- package/elasticsearch/indexing/richTextIndexing.js +2 -5
- package/elasticsearch/indexing/richTextIndexing.js.map +1 -0
- package/elasticsearch/indices/base.d.ts +2 -0
- package/elasticsearch/indices/base.js +13 -0
- package/elasticsearch/indices/base.js.map +1 -0
- package/elasticsearch/indices/index.d.ts +1 -0
- package/elasticsearch/indices/index.js +14 -0
- package/elasticsearch/indices/index.js.map +1 -0
- package/elasticsearch/indices/japanese.d.ts +2 -0
- package/elasticsearch/indices/japanese.js +14 -0
- package/elasticsearch/indices/japanese.js.map +1 -0
- package/elasticsearch/search/index.d.ts +2 -2
- package/elasticsearch/search/index.js +6 -9
- package/elasticsearch/search/index.js.map +1 -0
- package/elasticsearch/search/refSearch.d.ts +2 -3
- package/elasticsearch/search/refSearch.js +24 -17
- package/elasticsearch/search/refSearch.js.map +1 -0
- package/elasticsearch/search/searchableJson.d.ts +2 -0
- package/elasticsearch/search/searchableJson.js +60 -0
- package/elasticsearch/search/searchableJson.js.map +1 -0
- package/elasticsearch/search/timeSearch.d.ts +2 -3
- package/elasticsearch/search/timeSearch.js +18 -16
- package/elasticsearch/search/timeSearch.js.map +1 -0
- package/helpers/entryIndexHelpers.d.ts +3 -3
- package/helpers/entryIndexHelpers.js +59 -58
- package/helpers/entryIndexHelpers.js.map +1 -0
- package/helpers/fieldIdentifier.d.ts +6 -0
- package/helpers/fieldIdentifier.js +43 -0
- package/helpers/fieldIdentifier.js.map +1 -0
- package/helpers/index.d.ts +1 -1
- package/helpers/index.js +11 -13
- package/helpers/index.js.map +1 -0
- package/index.d.ts +2 -1
- package/index.js +132 -78
- package/index.js.map +1 -0
- package/operations/entry/dataLoader/DataLoaderCache.d.ts +17 -0
- package/operations/entry/dataLoader/DataLoaderCache.js +41 -0
- package/operations/entry/dataLoader/DataLoaderCache.js.map +1 -0
- package/operations/entry/dataLoader/constants.d.ts +1 -0
- package/operations/entry/dataLoader/constants.js +10 -0
- package/operations/entry/dataLoader/constants.js.map +1 -0
- package/operations/entry/dataLoader/createBatchScheduleFn.d.ts +8 -0
- package/operations/entry/dataLoader/createBatchScheduleFn.js +25 -0
- package/operations/entry/dataLoader/createBatchScheduleFn.js.map +1 -0
- package/operations/entry/dataLoader/getAllEntryRevisions.d.ts +4 -0
- package/operations/entry/dataLoader/getAllEntryRevisions.js +45 -0
- package/operations/entry/dataLoader/getAllEntryRevisions.js.map +1 -0
- package/operations/entry/dataLoader/getLatestRevisionByEntryId.d.ts +4 -0
- package/operations/entry/dataLoader/getLatestRevisionByEntryId.js +52 -0
- package/operations/entry/dataLoader/getLatestRevisionByEntryId.js.map +1 -0
- package/operations/entry/dataLoader/getPublishedRevisionByEntryId.d.ts +4 -0
- package/operations/entry/dataLoader/getPublishedRevisionByEntryId.js +52 -0
- package/operations/entry/dataLoader/getPublishedRevisionByEntryId.js.map +1 -0
- package/operations/entry/dataLoader/getRevisionById.d.ts +4 -0
- package/operations/entry/dataLoader/getRevisionById.js +62 -0
- package/operations/entry/dataLoader/getRevisionById.js.map +1 -0
- package/operations/entry/dataLoader/index.d.ts +8 -0
- package/operations/entry/dataLoader/index.js +40 -0
- package/operations/entry/dataLoader/index.js.map +1 -0
- package/operations/entry/dataLoader/types.d.ts +6 -0
- package/operations/entry/dataLoader/types.js +7 -0
- package/operations/entry/dataLoader/types.js.map +1 -0
- package/operations/entry/dataLoaders.d.ts +21 -38
- package/operations/entry/dataLoaders.js +59 -290
- package/operations/entry/dataLoaders.js.map +1 -0
- package/operations/entry/elasticsearch/assignMinimumShouldMatchToQuery.d.ts +18 -0
- package/operations/entry/elasticsearch/assignMinimumShouldMatchToQuery.js +34 -0
- package/operations/entry/elasticsearch/assignMinimumShouldMatchToQuery.js.map +1 -0
- package/operations/entry/elasticsearch/body.d.ts +13 -0
- package/operations/entry/elasticsearch/body.js +142 -0
- package/operations/entry/elasticsearch/body.js.map +1 -0
- package/operations/entry/elasticsearch/fields.d.ts +10 -0
- package/operations/entry/elasticsearch/fields.js +315 -0
- package/operations/entry/elasticsearch/fields.js.map +1 -0
- package/operations/entry/elasticsearch/filtering/applyFiltering.d.ts +8 -0
- package/operations/entry/elasticsearch/filtering/applyFiltering.js +60 -0
- package/operations/entry/elasticsearch/filtering/applyFiltering.js.map +1 -0
- package/operations/entry/elasticsearch/filtering/exec.d.ts +17 -0
- package/operations/entry/elasticsearch/filtering/exec.js +175 -0
- package/operations/entry/elasticsearch/filtering/exec.js.map +1 -0
- package/operations/entry/elasticsearch/filtering/index.d.ts +1 -0
- package/operations/entry/elasticsearch/filtering/index.js +18 -0
- package/operations/entry/elasticsearch/filtering/index.js.map +1 -0
- package/operations/entry/elasticsearch/filtering/path.d.ts +16 -0
- package/operations/entry/elasticsearch/filtering/path.js +48 -0
- package/operations/entry/elasticsearch/filtering/path.js.map +1 -0
- package/operations/entry/elasticsearch/filtering/plugins/defaultFilterPlugin.d.ts +2 -0
- package/operations/entry/elasticsearch/filtering/plugins/defaultFilterPlugin.js +30 -0
- package/operations/entry/elasticsearch/filtering/plugins/defaultFilterPlugin.js.map +1 -0
- package/operations/entry/elasticsearch/filtering/plugins/index.d.ts +1 -0
- package/operations/entry/elasticsearch/filtering/plugins/index.js +15 -0
- package/operations/entry/elasticsearch/filtering/plugins/index.js.map +1 -0
- package/operations/entry/elasticsearch/filtering/plugins/objectFilterPlugin.d.ts +2 -0
- package/operations/entry/elasticsearch/filtering/plugins/objectFilterPlugin.js +69 -0
- package/operations/entry/elasticsearch/filtering/plugins/objectFilterPlugin.js.map +1 -0
- package/operations/entry/elasticsearch/filtering/plugins/refFilterPlugin.d.ts +2 -0
- package/operations/entry/elasticsearch/filtering/plugins/refFilterPlugin.js +57 -0
- package/operations/entry/elasticsearch/filtering/plugins/refFilterPlugin.js.map +1 -0
- package/operations/entry/elasticsearch/filtering/populated.d.ts +2 -0
- package/operations/entry/elasticsearch/filtering/populated.js +25 -0
- package/operations/entry/elasticsearch/filtering/populated.js.map +1 -0
- package/operations/entry/elasticsearch/filtering/values.d.ts +2 -0
- package/operations/entry/elasticsearch/filtering/values.js +24 -0
- package/operations/entry/elasticsearch/filtering/values.js.map +1 -0
- package/operations/entry/elasticsearch/fullTextSearch.d.ts +12 -0
- package/operations/entry/elasticsearch/fullTextSearch.js +91 -0
- package/operations/entry/elasticsearch/fullTextSearch.js.map +1 -0
- package/operations/entry/elasticsearch/fullTextSearchFields.d.ts +8 -0
- package/operations/entry/elasticsearch/fullTextSearchFields.js +27 -0
- package/operations/entry/elasticsearch/fullTextSearchFields.js.map +1 -0
- package/operations/entry/elasticsearch/initialQuery.d.ts +17 -0
- package/operations/entry/elasticsearch/initialQuery.js +106 -0
- package/operations/entry/elasticsearch/initialQuery.js.map +1 -0
- package/operations/entry/elasticsearch/keyword.d.ts +2 -0
- package/operations/entry/elasticsearch/keyword.js +36 -0
- package/operations/entry/elasticsearch/keyword.js.map +1 -0
- package/operations/entry/elasticsearch/logIgnoredEsResponseError.d.ts +9 -0
- package/operations/entry/elasticsearch/logIgnoredEsResponseError.js +26 -0
- package/operations/entry/elasticsearch/logIgnoredEsResponseError.js.map +1 -0
- package/operations/entry/elasticsearch/plugins/bodyModifier.d.ts +9 -0
- package/operations/entry/elasticsearch/plugins/bodyModifier.js +18 -0
- package/operations/entry/elasticsearch/plugins/bodyModifier.js.map +1 -0
- package/operations/entry/elasticsearch/plugins/operator.d.ts +8 -0
- package/operations/entry/elasticsearch/plugins/operator.js +39 -0
- package/operations/entry/elasticsearch/plugins/operator.js.map +1 -0
- package/operations/entry/elasticsearch/plugins/queryModifier.d.ts +9 -0
- package/operations/entry/elasticsearch/plugins/queryModifier.js +18 -0
- package/operations/entry/elasticsearch/plugins/queryModifier.js.map +1 -0
- package/operations/entry/elasticsearch/plugins/search.d.ts +7 -0
- package/{helpers/searchPluginsList.js → operations/entry/elasticsearch/plugins/search.js} +9 -9
- package/operations/entry/elasticsearch/plugins/search.js.map +1 -0
- package/operations/entry/elasticsearch/plugins/sortModifier.d.ts +9 -0
- package/operations/entry/elasticsearch/plugins/sortModifier.js +18 -0
- package/operations/entry/elasticsearch/plugins/sortModifier.js.map +1 -0
- package/operations/entry/elasticsearch/shouldIgnoreEsResponseError.d.ts +2 -0
- package/operations/entry/elasticsearch/shouldIgnoreEsResponseError.js +13 -0
- package/operations/entry/elasticsearch/shouldIgnoreEsResponseError.js.map +1 -0
- package/operations/entry/elasticsearch/sort.d.ts +12 -0
- package/operations/entry/elasticsearch/sort.js +89 -0
- package/operations/entry/elasticsearch/sort.js.map +1 -0
- package/operations/entry/elasticsearch/transformValueForSearch.d.ts +16 -0
- package/operations/entry/elasticsearch/transformValueForSearch.js +32 -0
- package/operations/entry/elasticsearch/transformValueForSearch.js.map +1 -0
- package/operations/entry/elasticsearch/types.d.ts +41 -0
- package/operations/entry/elasticsearch/types.js +7 -0
- package/operations/entry/elasticsearch/types.js.map +1 -0
- package/operations/entry/index.d.ts +6 -8
- package/operations/entry/index.js +1422 -693
- package/operations/entry/index.js.map +1 -0
- package/operations/entry/keys.js +2 -9
- package/operations/entry/keys.js.map +1 -0
- package/operations/entry/recordType.d.ts +3 -0
- package/operations/entry/recordType.js +20 -0
- package/operations/entry/recordType.js.map +1 -0
- package/operations/entry/transformations/convertEntryKeys.d.ts +8 -0
- package/operations/entry/transformations/convertEntryKeys.js +38 -0
- package/operations/entry/transformations/convertEntryKeys.js.map +1 -0
- package/operations/entry/transformations/index.d.ts +29 -0
- package/operations/entry/transformations/index.js +127 -0
- package/operations/entry/transformations/index.js.map +1 -0
- package/operations/entry/transformations/modifyEntryValues.d.ts +58 -0
- package/operations/entry/transformations/modifyEntryValues.js +28 -0
- package/operations/entry/transformations/modifyEntryValues.js.map +1 -0
- package/operations/entry/transformations/transformEntryKeys.d.ts +11 -0
- package/operations/entry/transformations/transformEntryKeys.js +27 -0
- package/operations/entry/transformations/transformEntryKeys.js.map +1 -0
- package/operations/entry/transformations/transformEntryToIndex.d.ts +10 -0
- package/operations/entry/transformations/transformEntryToIndex.js +31 -0
- package/operations/entry/transformations/transformEntryToIndex.js.map +1 -0
- package/operations/group/index.d.ts +5 -5
- package/operations/group/index.js +40 -63
- package/operations/group/index.js.map +1 -0
- package/operations/model/index.d.ts +5 -5
- package/operations/model/index.js +56 -78
- package/operations/model/index.js.map +1 -0
- package/operations/system/index.d.ts +4 -4
- package/operations/system/index.js +20 -31
- package/operations/system/index.js.map +1 -0
- package/operations/system/indexes.d.ts +10 -0
- package/operations/system/indexes.js +41 -0
- package/operations/system/indexes.js.map +1 -0
- package/package.json +38 -40
- package/plugins/CmsElasticsearchModelFieldPlugin.d.ts +69 -0
- package/plugins/CmsElasticsearchModelFieldPlugin.js +52 -0
- package/plugins/CmsElasticsearchModelFieldPlugin.js.map +1 -0
- package/plugins/CmsEntryElasticsearchBodyModifierPlugin.d.ts +9 -4
- package/plugins/CmsEntryElasticsearchBodyModifierPlugin.js +10 -13
- package/plugins/CmsEntryElasticsearchBodyModifierPlugin.js.map +1 -0
- package/plugins/CmsEntryElasticsearchFullTextSearchPlugin.d.ts +23 -0
- package/plugins/CmsEntryElasticsearchFullTextSearchPlugin.js +27 -0
- package/plugins/CmsEntryElasticsearchFullTextSearchPlugin.js.map +1 -0
- package/plugins/CmsEntryElasticsearchIndexPlugin.d.ts +4 -0
- package/plugins/CmsEntryElasticsearchIndexPlugin.js +13 -0
- package/plugins/CmsEntryElasticsearchIndexPlugin.js.map +1 -0
- package/plugins/CmsEntryElasticsearchQueryBuilderValueSearchPlugin.d.ts +32 -0
- package/plugins/CmsEntryElasticsearchQueryBuilderValueSearchPlugin.js +40 -0
- package/plugins/CmsEntryElasticsearchQueryBuilderValueSearchPlugin.js.map +1 -0
- package/plugins/CmsEntryElasticsearchQueryModifierPlugin.d.ts +6 -4
- package/plugins/CmsEntryElasticsearchQueryModifierPlugin.js +10 -13
- package/plugins/CmsEntryElasticsearchQueryModifierPlugin.js.map +1 -0
- package/plugins/CmsEntryElasticsearchSortModifierPlugin.d.ts +6 -4
- package/plugins/CmsEntryElasticsearchSortModifierPlugin.js +10 -13
- package/plugins/CmsEntryElasticsearchSortModifierPlugin.js.map +1 -0
- package/plugins/CmsEntryElasticsearchValuesModifier.d.ts +33 -0
- package/plugins/CmsEntryElasticsearchValuesModifier.js +50 -0
- package/plugins/CmsEntryElasticsearchValuesModifier.js.map +1 -0
- package/plugins/CmsEntryFilterPlugin.d.ts +49 -0
- package/plugins/CmsEntryFilterPlugin.js +22 -0
- package/plugins/CmsEntryFilterPlugin.js.map +1 -0
- package/plugins/index.d.ts +8 -0
- package/plugins/index.js +95 -0
- package/plugins/index.js.map +1 -0
- package/tasks/createIndexTaskPlugin.d.ts +2 -0
- package/tasks/createIndexTaskPlugin.js +67 -0
- package/tasks/createIndexTaskPlugin.js.map +1 -0
- package/types.d.ts +30 -52
- package/types.js +5 -23
- package/types.js.map +1 -0
- package/values/NoValueContainer.d.ts +5 -0
- package/values/NoValueContainer.js +20 -0
- package/values/NoValueContainer.js.map +1 -0
- package/definitions/settings.d.ts +0 -8
- package/definitions/settings.js +0 -62
- package/dynamoDb/storage/date.d.ts +0 -3
- package/dynamoDb/storage/date.js +0 -65
- package/helpers/createElasticsearchQueryBody.d.ts +0 -11
- package/helpers/createElasticsearchQueryBody.js +0 -375
- package/helpers/fields.d.ts +0 -77
- package/helpers/fields.js +0 -174
- package/helpers/operatorPluginsList.d.ts +0 -7
- package/helpers/operatorPluginsList.js +0 -30
- package/helpers/searchPluginsList.d.ts +0 -6
- package/helpers/transformValueForSearch.d.ts +0 -9
- package/helpers/transformValueForSearch.js +0 -26
- package/operations/entry/elasticsearchFields.d.ts +0 -2
- package/operations/entry/elasticsearchFields.js +0 -32
- package/operations/entry/fields.d.ts +0 -3
- package/operations/entry/fields.js +0 -60
- package/operations/settings/index.d.ts +0 -6
- package/operations/settings/index.js +0 -141
- package/operations/system/createElasticsearchTemplate.d.ts +0 -5
- package/operations/system/createElasticsearchTemplate.js +0 -62
- package/plugins/CmsEntryElasticsearchFieldPlugin.d.ts +0 -12
- package/plugins/CmsEntryElasticsearchFieldPlugin.js +0 -24
- package/upgrades/index.d.ts +0 -2
- package/upgrades/index.js +0 -16
- package/upgrades/utils.d.ts +0 -1
- package/upgrades/utils.js +0 -16
- package/upgrades/v5.0.0/cleanDatabaseRecord.d.ts +0 -6
- package/upgrades/v5.0.0/cleanDatabaseRecord.js +0 -16
- package/upgrades/v5.0.0/createOldVersionIndiceName.d.ts +0 -2
- package/upgrades/v5.0.0/createOldVersionIndiceName.js +0 -12
- package/upgrades/v5.0.0/entryValueFixer.d.ts +0 -4
- package/upgrades/v5.0.0/entryValueFixer.js +0 -124
- package/upgrades/v5.0.0/fieldFinder.d.ts +0 -6
- package/upgrades/v5.0.0/fieldFinder.js +0 -42
- package/upgrades/v5.0.0/helpers.d.ts +0 -4
- package/upgrades/v5.0.0/helpers.js +0 -57
- package/upgrades/v5.0.0/index.d.ts +0 -4
- package/upgrades/v5.0.0/index.js +0 -232
- package/upgrades/v5.8.0/index.d.ts +0 -4
- package/upgrades/v5.8.0/index.js +0 -426
|
@@ -1,375 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.createElasticsearchQueryBody = void 0;
|
|
9
|
-
|
|
10
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
-
|
|
12
|
-
var _error = _interopRequireDefault(require("@webiny/error"));
|
|
13
|
-
|
|
14
|
-
var _operatorPluginsList = require("./operatorPluginsList");
|
|
15
|
-
|
|
16
|
-
var _transformValueForSearch = require("./transformValueForSearch");
|
|
17
|
-
|
|
18
|
-
var _searchPluginsList = require("./searchPluginsList");
|
|
19
|
-
|
|
20
|
-
var _cursors = require("@webiny/api-elasticsearch/cursors");
|
|
21
|
-
|
|
22
|
-
var _sort = require("@webiny/api-elasticsearch/sort");
|
|
23
|
-
|
|
24
|
-
var _fields = require("./fields");
|
|
25
|
-
|
|
26
|
-
var _CmsEntryElasticsearchFieldPlugin = require("../plugins/CmsEntryElasticsearchFieldPlugin");
|
|
27
|
-
|
|
28
|
-
var _where = require("@webiny/api-elasticsearch/where");
|
|
29
|
-
|
|
30
|
-
var _entry = require("../operations/entry");
|
|
31
|
-
|
|
32
|
-
var _CmsEntryElasticsearchQueryModifierPlugin = require("../plugins/CmsEntryElasticsearchQueryModifierPlugin");
|
|
33
|
-
|
|
34
|
-
var _CmsEntryElasticsearchSortModifierPlugin = require("../plugins/CmsEntryElasticsearchSortModifierPlugin");
|
|
35
|
-
|
|
36
|
-
var _CmsEntryElasticsearchBodyModifierPlugin = require("../plugins/CmsEntryElasticsearchBodyModifierPlugin");
|
|
37
|
-
|
|
38
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
39
|
-
|
|
40
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
41
|
-
|
|
42
|
-
const specialFields = ["published", "latest", "locale", "tenant"];
|
|
43
|
-
const noKeywordFields = ["date", "number", "boolean"];
|
|
44
|
-
|
|
45
|
-
const createElasticsearchSortParams = args => {
|
|
46
|
-
const {
|
|
47
|
-
sort,
|
|
48
|
-
modelFields,
|
|
49
|
-
parentPath,
|
|
50
|
-
searchPlugins
|
|
51
|
-
} = args;
|
|
52
|
-
|
|
53
|
-
if (!sort || sort.length === 0) {
|
|
54
|
-
return undefined;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
const sortPlugins = Object.values(modelFields).reduce((plugins, modelField) => {
|
|
58
|
-
const searchPlugin = searchPlugins[modelField.type];
|
|
59
|
-
plugins[modelField.field.fieldId] = new _CmsEntryElasticsearchFieldPlugin.CmsEntryElasticsearchFieldPlugin({
|
|
60
|
-
unmappedType: modelField.unmappedType,
|
|
61
|
-
keyword: hasKeyword(modelField),
|
|
62
|
-
sortable: modelField.isSortable,
|
|
63
|
-
searchable: modelField.isSearchable,
|
|
64
|
-
field: modelField.field.fieldId,
|
|
65
|
-
path: createFieldPath({
|
|
66
|
-
parentPath,
|
|
67
|
-
modelField: modelField,
|
|
68
|
-
searchPlugin
|
|
69
|
-
})
|
|
70
|
-
});
|
|
71
|
-
return plugins;
|
|
72
|
-
}, {});
|
|
73
|
-
return (0, _sort.createSort)({
|
|
74
|
-
fieldPlugins: sortPlugins,
|
|
75
|
-
sort
|
|
76
|
-
});
|
|
77
|
-
};
|
|
78
|
-
/**
|
|
79
|
-
* Latest and published are specific in Elasticsearch to that extend that they are tagged in the __type property.
|
|
80
|
-
* We allow either published or either latest.
|
|
81
|
-
* Latest is used in the manage API and published in the read API.
|
|
82
|
-
*/
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
const createInitialQueryValue = args => {
|
|
86
|
-
const {
|
|
87
|
-
where
|
|
88
|
-
} = args;
|
|
89
|
-
const query = {
|
|
90
|
-
must: [],
|
|
91
|
-
must_not: [],
|
|
92
|
-
should: [],
|
|
93
|
-
filter: []
|
|
94
|
-
}; // When ES index is shared between tenants, we need to filter records by tenant ID
|
|
95
|
-
|
|
96
|
-
const sharedIndex = process.env.ELASTICSEARCH_SHARED_INDEXES === "true";
|
|
97
|
-
|
|
98
|
-
if (sharedIndex) {
|
|
99
|
-
query.must.push({
|
|
100
|
-
term: {
|
|
101
|
-
"tenant.keyword": where.tenant
|
|
102
|
-
}
|
|
103
|
-
});
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
delete where["tenant"];
|
|
107
|
-
|
|
108
|
-
if (where.locale) {
|
|
109
|
-
query.must.push({
|
|
110
|
-
term: {
|
|
111
|
-
"locale.keyword": where.locale
|
|
112
|
-
}
|
|
113
|
-
});
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
delete where["locale"];
|
|
117
|
-
/**
|
|
118
|
-
* We must transform published and latest where args into something that is understandable by our Elasticsearch
|
|
119
|
-
*/
|
|
120
|
-
|
|
121
|
-
if (where.published === true) {
|
|
122
|
-
query.must.push({
|
|
123
|
-
term: {
|
|
124
|
-
"__type.keyword": (0, _entry.createPublishedType)()
|
|
125
|
-
}
|
|
126
|
-
});
|
|
127
|
-
} else if (where.latest === true) {
|
|
128
|
-
query.must.push({
|
|
129
|
-
term: {
|
|
130
|
-
"__type.keyword": (0, _entry.createLatestType)()
|
|
131
|
-
}
|
|
132
|
-
});
|
|
133
|
-
} // we do not allow not published and not latest
|
|
134
|
-
else if (where.published === false) {
|
|
135
|
-
throw new _error.default(`Cannot call Elasticsearch query with "published" set at false.`, "ELASTICSEARCH_UNSUPPORTED_QUERY", {
|
|
136
|
-
where
|
|
137
|
-
});
|
|
138
|
-
} else if (where.latest === false) {
|
|
139
|
-
throw new _error.default(`Cannot call Elasticsearch query with "latest" set at false.`, "ELASTICSEARCH_UNSUPPORTED_QUERY", {
|
|
140
|
-
where
|
|
141
|
-
});
|
|
142
|
-
} //
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
return query;
|
|
146
|
-
};
|
|
147
|
-
|
|
148
|
-
const createFieldPath = ({
|
|
149
|
-
modelField,
|
|
150
|
-
searchPlugin,
|
|
151
|
-
parentPath
|
|
152
|
-
}) => {
|
|
153
|
-
let path;
|
|
154
|
-
|
|
155
|
-
if (searchPlugin && typeof searchPlugin.createPath === "function") {
|
|
156
|
-
path = searchPlugin.createPath({
|
|
157
|
-
field: modelField.field
|
|
158
|
-
});
|
|
159
|
-
} else if (typeof modelField.path === "function") {
|
|
160
|
-
path = modelField.path(modelField.field.fieldId);
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
if (!path) {
|
|
164
|
-
path = modelField.path || modelField.field.fieldId || modelField.field.id;
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
return modelField.isSystemField || !parentPath || path.match(parentPath) ? path : `${parentPath}.${path}`;
|
|
168
|
-
};
|
|
169
|
-
|
|
170
|
-
const hasKeyword = modelField => {
|
|
171
|
-
/**
|
|
172
|
-
* We defined some field types that MUST have no keyword added to the field path
|
|
173
|
-
*/
|
|
174
|
-
if (noKeywordFields.includes(modelField.type)) {
|
|
175
|
-
return false;
|
|
176
|
-
} else if (modelField.unmappedType) {
|
|
177
|
-
/**
|
|
178
|
-
* If modelField has unmapped type defined, do not add keyword.
|
|
179
|
-
*/
|
|
180
|
-
return false;
|
|
181
|
-
} else if (modelField.keyword === false) {
|
|
182
|
-
/**
|
|
183
|
-
* And if specifically defined that modelField has no keyword, do not add it.
|
|
184
|
-
*/
|
|
185
|
-
return false;
|
|
186
|
-
}
|
|
187
|
-
/**
|
|
188
|
-
* All other fields have keyword added.
|
|
189
|
-
*/
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
return true;
|
|
193
|
-
};
|
|
194
|
-
/*
|
|
195
|
-
* Iterate through where keys and apply plugins where necessary
|
|
196
|
-
*/
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
const execElasticsearchBuildQueryPlugins = params => {
|
|
200
|
-
const {
|
|
201
|
-
where: initialWhere,
|
|
202
|
-
modelFields,
|
|
203
|
-
parentPath,
|
|
204
|
-
plugins,
|
|
205
|
-
searchPlugins
|
|
206
|
-
} = params;
|
|
207
|
-
|
|
208
|
-
const where = _objectSpread({}, initialWhere);
|
|
209
|
-
|
|
210
|
-
const query = createInitialQueryValue(_objectSpread(_objectSpread({}, params), {}, {
|
|
211
|
-
where
|
|
212
|
-
}));
|
|
213
|
-
/**
|
|
214
|
-
* Always remove special fields, as these do not exist in Elasticsearch.
|
|
215
|
-
*/
|
|
216
|
-
|
|
217
|
-
for (const sf of specialFields) {
|
|
218
|
-
delete where[sf];
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
if (Object.keys(where).length === 0) {
|
|
222
|
-
return query;
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
const operatorPlugins = (0, _operatorPluginsList.operatorPluginsList)(plugins);
|
|
226
|
-
|
|
227
|
-
for (const key in where) {
|
|
228
|
-
if (where.hasOwnProperty(key) === false) {
|
|
229
|
-
continue;
|
|
230
|
-
}
|
|
231
|
-
/**
|
|
232
|
-
* We do not need to go further if value is undefined.
|
|
233
|
-
* There are few hardcoded possibilities when value is undefined, for example, ownedBy.
|
|
234
|
-
*/
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
if (where[key] === undefined) {
|
|
238
|
-
continue;
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
const {
|
|
242
|
-
field,
|
|
243
|
-
operator
|
|
244
|
-
} = (0, _where.parseWhereKey)(key);
|
|
245
|
-
const modelField = modelFields[field];
|
|
246
|
-
|
|
247
|
-
if (!modelField) {
|
|
248
|
-
throw new _error.default(`There is no field "${field}".`);
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
const {
|
|
252
|
-
isSearchable = false,
|
|
253
|
-
field: cmsField
|
|
254
|
-
} = modelField;
|
|
255
|
-
|
|
256
|
-
if (!isSearchable) {
|
|
257
|
-
throw new _error.default(`Field "${field}" is not searchable.`);
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
const plugin = operatorPlugins[operator];
|
|
261
|
-
|
|
262
|
-
if (!plugin) {
|
|
263
|
-
throw new _error.default("Operator plugin missing.", "PLUGIN_MISSING", {
|
|
264
|
-
operator
|
|
265
|
-
});
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
const fieldSearchPlugin = searchPlugins[modelField.type];
|
|
269
|
-
const value = (0, _transformValueForSearch.transformValueForSearch)({
|
|
270
|
-
plugins: searchPlugins,
|
|
271
|
-
field: cmsField,
|
|
272
|
-
value: where[key]
|
|
273
|
-
});
|
|
274
|
-
const fieldPath = createFieldPath({
|
|
275
|
-
searchPlugin: fieldSearchPlugin,
|
|
276
|
-
modelField,
|
|
277
|
-
parentPath: parentPath
|
|
278
|
-
});
|
|
279
|
-
const keyword = hasKeyword(modelField);
|
|
280
|
-
plugin.apply(query, {
|
|
281
|
-
basePath: fieldPath,
|
|
282
|
-
path: keyword ? `${fieldPath}.keyword` : fieldPath,
|
|
283
|
-
value,
|
|
284
|
-
keyword
|
|
285
|
-
});
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
return query;
|
|
289
|
-
};
|
|
290
|
-
|
|
291
|
-
const createElasticsearchQueryBody = params => {
|
|
292
|
-
const {
|
|
293
|
-
plugins,
|
|
294
|
-
model,
|
|
295
|
-
args,
|
|
296
|
-
parentPath = null
|
|
297
|
-
} = params;
|
|
298
|
-
const {
|
|
299
|
-
where,
|
|
300
|
-
after,
|
|
301
|
-
limit,
|
|
302
|
-
sort: initialSort
|
|
303
|
-
} = args;
|
|
304
|
-
const modelFields = (0, _fields.createModelFields)(plugins, model);
|
|
305
|
-
const searchPlugins = (0, _searchPluginsList.searchPluginsList)(plugins);
|
|
306
|
-
const query = execElasticsearchBuildQueryPlugins({
|
|
307
|
-
model,
|
|
308
|
-
plugins,
|
|
309
|
-
where,
|
|
310
|
-
modelFields,
|
|
311
|
-
parentPath,
|
|
312
|
-
searchPlugins
|
|
313
|
-
});
|
|
314
|
-
const queryPlugins = plugins.byType(_CmsEntryElasticsearchQueryModifierPlugin.CmsEntryElasticsearchQueryModifierPlugin.type).filter(pl => {
|
|
315
|
-
return !pl.modelId || pl.modelId === model.modelId;
|
|
316
|
-
});
|
|
317
|
-
|
|
318
|
-
for (const pl of queryPlugins) {
|
|
319
|
-
pl.modifyQuery({
|
|
320
|
-
query,
|
|
321
|
-
model,
|
|
322
|
-
where
|
|
323
|
-
});
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
const sort = createElasticsearchSortParams({
|
|
327
|
-
plugins,
|
|
328
|
-
sort: initialSort,
|
|
329
|
-
modelFields,
|
|
330
|
-
parentPath,
|
|
331
|
-
model,
|
|
332
|
-
searchPlugins
|
|
333
|
-
});
|
|
334
|
-
const sortPlugins = plugins.byType(_CmsEntryElasticsearchSortModifierPlugin.CmsEntryElasticsearchSortModifierPlugin.type).filter(pl => {
|
|
335
|
-
return !pl.modelId || pl.modelId === model.modelId;
|
|
336
|
-
});
|
|
337
|
-
|
|
338
|
-
for (const pl of sortPlugins) {
|
|
339
|
-
pl.modifySort({
|
|
340
|
-
sort,
|
|
341
|
-
model
|
|
342
|
-
});
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
const body = {
|
|
346
|
-
query: {
|
|
347
|
-
bool: {
|
|
348
|
-
must: query.must.length > 0 ? query.must : undefined,
|
|
349
|
-
must_not: query.must_not.length > 0 ? query.must_not : undefined,
|
|
350
|
-
should: query.should.length > 0 ? query.should : undefined,
|
|
351
|
-
filter: query.filter.length > 0 ? query.filter : undefined
|
|
352
|
-
}
|
|
353
|
-
},
|
|
354
|
-
sort,
|
|
355
|
-
size: limit + 1,
|
|
356
|
-
// eslint-disable-next-line
|
|
357
|
-
search_after: (0, _cursors.decodeCursor)(after),
|
|
358
|
-
// eslint-disable-next-line
|
|
359
|
-
track_total_hits: true
|
|
360
|
-
};
|
|
361
|
-
const bodyPlugins = plugins.byType(_CmsEntryElasticsearchBodyModifierPlugin.CmsEntryElasticsearchBodyModifierPlugin.type).filter(pl => {
|
|
362
|
-
return !pl.modelId || pl.modelId === model.modelId;
|
|
363
|
-
});
|
|
364
|
-
|
|
365
|
-
for (const pl of bodyPlugins) {
|
|
366
|
-
pl.modifyBody({
|
|
367
|
-
body,
|
|
368
|
-
model
|
|
369
|
-
});
|
|
370
|
-
}
|
|
371
|
-
|
|
372
|
-
return body;
|
|
373
|
-
};
|
|
374
|
-
|
|
375
|
-
exports.createElasticsearchQueryBody = createElasticsearchQueryBody;
|
package/helpers/fields.d.ts
DELETED
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import { CmsModel, CmsModelField } from "@webiny/api-headless-cms/types";
|
|
2
|
-
import { PluginsContainer } from "@webiny/plugins";
|
|
3
|
-
declare type ModelFieldPath = string | ((value: string) => string);
|
|
4
|
-
export interface ModelField {
|
|
5
|
-
unmappedType?: string;
|
|
6
|
-
keyword?: boolean;
|
|
7
|
-
isSearchable: boolean;
|
|
8
|
-
isSortable: boolean;
|
|
9
|
-
type: string;
|
|
10
|
-
isSystemField?: boolean;
|
|
11
|
-
field: CmsModelField;
|
|
12
|
-
path?: ModelFieldPath;
|
|
13
|
-
}
|
|
14
|
-
export declare type ModelFields = Record<string, ModelField>;
|
|
15
|
-
export declare const systemFields: {
|
|
16
|
-
id: {
|
|
17
|
-
type: string;
|
|
18
|
-
isSystemField: boolean;
|
|
19
|
-
isSearchable: boolean;
|
|
20
|
-
isSortable: boolean;
|
|
21
|
-
field: CmsModelField;
|
|
22
|
-
};
|
|
23
|
-
entryId: {
|
|
24
|
-
type: string;
|
|
25
|
-
isSystemField: boolean;
|
|
26
|
-
isSearchable: boolean;
|
|
27
|
-
isSortable: boolean;
|
|
28
|
-
field: CmsModelField;
|
|
29
|
-
};
|
|
30
|
-
savedOn: {
|
|
31
|
-
type: string;
|
|
32
|
-
unmappedType: string;
|
|
33
|
-
keyword: boolean;
|
|
34
|
-
isSystemField: boolean;
|
|
35
|
-
isSearchable: boolean;
|
|
36
|
-
isSortable: boolean;
|
|
37
|
-
field: CmsModelField;
|
|
38
|
-
};
|
|
39
|
-
createdOn: {
|
|
40
|
-
type: string;
|
|
41
|
-
unmappedType: string;
|
|
42
|
-
keyword: boolean;
|
|
43
|
-
isSystemField: boolean;
|
|
44
|
-
isSearchable: boolean;
|
|
45
|
-
isSortable: boolean;
|
|
46
|
-
field: CmsModelField;
|
|
47
|
-
};
|
|
48
|
-
createdBy: {
|
|
49
|
-
type: string;
|
|
50
|
-
unmappedType: any;
|
|
51
|
-
isSystemField: boolean;
|
|
52
|
-
isSearchable: boolean;
|
|
53
|
-
isSortable: boolean;
|
|
54
|
-
path: string;
|
|
55
|
-
field: CmsModelField;
|
|
56
|
-
};
|
|
57
|
-
ownedBy: {
|
|
58
|
-
type: string;
|
|
59
|
-
unmappedType: any;
|
|
60
|
-
isSystemField: boolean;
|
|
61
|
-
isSearchable: boolean;
|
|
62
|
-
isSortable: boolean;
|
|
63
|
-
path: string;
|
|
64
|
-
field: CmsModelField;
|
|
65
|
-
};
|
|
66
|
-
version: {
|
|
67
|
-
type: string;
|
|
68
|
-
unmappedType: any;
|
|
69
|
-
keyword: boolean;
|
|
70
|
-
isSystemField: boolean;
|
|
71
|
-
isSearchable: boolean;
|
|
72
|
-
isSortable: boolean;
|
|
73
|
-
field: CmsModelField;
|
|
74
|
-
};
|
|
75
|
-
};
|
|
76
|
-
export declare const createModelFields: (plugins: PluginsContainer, model: CmsModel) => ModelFields;
|
|
77
|
-
export {};
|
package/helpers/fields.js
DELETED
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.systemFields = exports.createModelFields = void 0;
|
|
9
|
-
|
|
10
|
-
var _error = _interopRequireDefault(require("@webiny/error"));
|
|
11
|
-
|
|
12
|
-
const createSystemField = field => {
|
|
13
|
-
if (!field.fieldId) {
|
|
14
|
-
throw new _error.default(`When creating system field it must have a "entryId".`, "SYSTEM_FIELD_ERROR", {
|
|
15
|
-
field
|
|
16
|
-
});
|
|
17
|
-
} else if (!field.type) {
|
|
18
|
-
throw new _error.default(`When creating system field it must have a "type".`, "SYSTEM_FIELD_ERROR", {
|
|
19
|
-
field
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
return field;
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
const systemFields = {
|
|
27
|
-
id: {
|
|
28
|
-
type: "text",
|
|
29
|
-
isSystemField: true,
|
|
30
|
-
isSearchable: true,
|
|
31
|
-
isSortable: true,
|
|
32
|
-
field: createSystemField({
|
|
33
|
-
fieldId: "id",
|
|
34
|
-
type: "text"
|
|
35
|
-
})
|
|
36
|
-
},
|
|
37
|
-
entryId: {
|
|
38
|
-
type: "text",
|
|
39
|
-
isSystemField: true,
|
|
40
|
-
isSearchable: true,
|
|
41
|
-
isSortable: true,
|
|
42
|
-
field: createSystemField({
|
|
43
|
-
fieldId: "entryId",
|
|
44
|
-
type: "text"
|
|
45
|
-
})
|
|
46
|
-
},
|
|
47
|
-
savedOn: {
|
|
48
|
-
type: "date",
|
|
49
|
-
unmappedType: "date",
|
|
50
|
-
keyword: false,
|
|
51
|
-
isSystemField: true,
|
|
52
|
-
isSearchable: true,
|
|
53
|
-
isSortable: true,
|
|
54
|
-
field: createSystemField({
|
|
55
|
-
fieldId: "savedOn",
|
|
56
|
-
type: "date",
|
|
57
|
-
settings: {
|
|
58
|
-
type: "dateTimeWithoutTimezone"
|
|
59
|
-
}
|
|
60
|
-
})
|
|
61
|
-
},
|
|
62
|
-
createdOn: {
|
|
63
|
-
type: "date",
|
|
64
|
-
unmappedType: "date",
|
|
65
|
-
keyword: false,
|
|
66
|
-
isSystemField: true,
|
|
67
|
-
isSearchable: true,
|
|
68
|
-
isSortable: true,
|
|
69
|
-
field: createSystemField({
|
|
70
|
-
fieldId: "createdOn",
|
|
71
|
-
type: "text",
|
|
72
|
-
settings: {
|
|
73
|
-
type: "dateTimeWithoutTimezone"
|
|
74
|
-
}
|
|
75
|
-
})
|
|
76
|
-
},
|
|
77
|
-
createdBy: {
|
|
78
|
-
type: "text",
|
|
79
|
-
unmappedType: undefined,
|
|
80
|
-
isSystemField: true,
|
|
81
|
-
isSearchable: true,
|
|
82
|
-
isSortable: false,
|
|
83
|
-
path: "createdBy.id",
|
|
84
|
-
field: createSystemField({
|
|
85
|
-
fieldId: "createdBy",
|
|
86
|
-
type: "text"
|
|
87
|
-
})
|
|
88
|
-
},
|
|
89
|
-
ownedBy: {
|
|
90
|
-
type: "text",
|
|
91
|
-
unmappedType: undefined,
|
|
92
|
-
isSystemField: true,
|
|
93
|
-
isSearchable: true,
|
|
94
|
-
isSortable: false,
|
|
95
|
-
path: "ownedBy.id",
|
|
96
|
-
field: createSystemField({
|
|
97
|
-
fieldId: "ownedBy",
|
|
98
|
-
type: "text"
|
|
99
|
-
})
|
|
100
|
-
},
|
|
101
|
-
version: {
|
|
102
|
-
type: "number",
|
|
103
|
-
unmappedType: undefined,
|
|
104
|
-
keyword: false,
|
|
105
|
-
isSystemField: true,
|
|
106
|
-
isSearchable: true,
|
|
107
|
-
isSortable: true,
|
|
108
|
-
field: createSystemField({
|
|
109
|
-
fieldId: "version",
|
|
110
|
-
type: "number"
|
|
111
|
-
})
|
|
112
|
-
}
|
|
113
|
-
};
|
|
114
|
-
/*
|
|
115
|
-
* Create an object with key fieldType and options for that field
|
|
116
|
-
*/
|
|
117
|
-
|
|
118
|
-
exports.systemFields = systemFields;
|
|
119
|
-
|
|
120
|
-
const createModelFields = (plugins, model) => {
|
|
121
|
-
// collect all unmappedType from elastic plugins
|
|
122
|
-
const unmappedTypes = plugins.byType("cms-model-field-to-elastic-search").reduce((acc, plugin) => {
|
|
123
|
-
if (!plugin.unmappedType) {
|
|
124
|
-
return acc;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
acc[plugin.fieldType] = plugin.unmappedType;
|
|
128
|
-
return acc;
|
|
129
|
-
}, {});
|
|
130
|
-
/**
|
|
131
|
-
* collect all field types from the plugins
|
|
132
|
-
*/
|
|
133
|
-
|
|
134
|
-
const fieldTypePlugins = plugins.byType("cms-model-field-to-graphql").reduce((types, plugin) => {
|
|
135
|
-
const {
|
|
136
|
-
fieldType,
|
|
137
|
-
isSearchable,
|
|
138
|
-
isSortable
|
|
139
|
-
} = plugin;
|
|
140
|
-
types[fieldType] = {
|
|
141
|
-
unmappedType: unmappedTypes[fieldType],
|
|
142
|
-
isSearchable: isSearchable === true,
|
|
143
|
-
isSortable: isSortable === true
|
|
144
|
-
};
|
|
145
|
-
return types;
|
|
146
|
-
}, {});
|
|
147
|
-
return model.fields.reduce((fields, field) => {
|
|
148
|
-
const {
|
|
149
|
-
fieldId,
|
|
150
|
-
type
|
|
151
|
-
} = field;
|
|
152
|
-
|
|
153
|
-
if (!fieldTypePlugins[type]) {
|
|
154
|
-
throw new _error.default(`There is no plugin for field type "${type}".`);
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
const {
|
|
158
|
-
isSearchable,
|
|
159
|
-
isSortable,
|
|
160
|
-
unmappedType
|
|
161
|
-
} = fieldTypePlugins[type];
|
|
162
|
-
fields[fieldId] = {
|
|
163
|
-
type,
|
|
164
|
-
isSearchable,
|
|
165
|
-
isSortable,
|
|
166
|
-
unmappedType: typeof unmappedType === "function" ? unmappedType(field) : undefined,
|
|
167
|
-
isSystemField: false,
|
|
168
|
-
field
|
|
169
|
-
};
|
|
170
|
-
return fields;
|
|
171
|
-
}, systemFields);
|
|
172
|
-
};
|
|
173
|
-
|
|
174
|
-
exports.createModelFields = createModelFields;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { ElasticsearchQueryBuilderOperatorPlugin } from "@webiny/api-elasticsearch/plugins/definition/ElasticsearchQueryBuilderOperatorPlugin";
|
|
2
|
-
import { PluginsContainer } from "@webiny/plugins";
|
|
3
|
-
interface OperatorPlugins {
|
|
4
|
-
[operator: string]: ElasticsearchQueryBuilderOperatorPlugin;
|
|
5
|
-
}
|
|
6
|
-
export declare const operatorPluginsList: (plugins: PluginsContainer) => OperatorPlugins;
|
|
7
|
-
export {};
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.operatorPluginsList = void 0;
|
|
9
|
-
|
|
10
|
-
var _error = _interopRequireDefault(require("@webiny/error"));
|
|
11
|
-
|
|
12
|
-
var _ElasticsearchQueryBuilderOperatorPlugin = require("@webiny/api-elasticsearch/plugins/definition/ElasticsearchQueryBuilderOperatorPlugin");
|
|
13
|
-
|
|
14
|
-
const operatorPluginsList = plugins => {
|
|
15
|
-
return plugins.byType(_ElasticsearchQueryBuilderOperatorPlugin.ElasticsearchQueryBuilderOperatorPlugin.type).reduce((plugins, plugin) => {
|
|
16
|
-
const operator = plugin.getOperator();
|
|
17
|
-
|
|
18
|
-
if (plugins[operator]) {
|
|
19
|
-
throw new _error.default("There is a ElasticsearchQueryBuilderOperatorPlugin defined for the operator.", "PLUGIN_ALREADY_EXISTS", {
|
|
20
|
-
operator: operator,
|
|
21
|
-
name: plugin.name || "unknown"
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
plugins[operator] = plugin;
|
|
26
|
-
return plugins;
|
|
27
|
-
}, {});
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
exports.operatorPluginsList = operatorPluginsList;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { ElasticsearchQueryBuilderValueSearchPlugin } from "../types";
|
|
2
|
-
import { PluginsContainer } from "@webiny/plugins";
|
|
3
|
-
export interface ElasticsearchQuerySearchValuePlugins {
|
|
4
|
-
[fieldType: string]: ElasticsearchQueryBuilderValueSearchPlugin;
|
|
5
|
-
}
|
|
6
|
-
export declare const searchPluginsList: (plugins: PluginsContainer) => ElasticsearchQuerySearchValuePlugins;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { ElasticsearchQuerySearchValuePlugins } from "./searchPluginsList";
|
|
2
|
-
import { CmsModelField } from "@webiny/api-headless-cms/types";
|
|
3
|
-
interface Params {
|
|
4
|
-
plugins: ElasticsearchQuerySearchValuePlugins;
|
|
5
|
-
field: CmsModelField;
|
|
6
|
-
value: any;
|
|
7
|
-
}
|
|
8
|
-
export declare const transformValueForSearch: (args: Params) => any;
|
|
9
|
-
export {};
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.transformValueForSearch = void 0;
|
|
7
|
-
|
|
8
|
-
const transformValueForSearch = args => {
|
|
9
|
-
const {
|
|
10
|
-
field,
|
|
11
|
-
plugins,
|
|
12
|
-
value
|
|
13
|
-
} = args;
|
|
14
|
-
const plugin = plugins[field.type];
|
|
15
|
-
|
|
16
|
-
if (!plugin) {
|
|
17
|
-
return value;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
return plugin.transform({
|
|
21
|
-
field,
|
|
22
|
-
value
|
|
23
|
-
});
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
exports.transformValueForSearch = transformValueForSearch;
|