@webiny/api-headless-cms-ddb-es 0.0.0-mt-3 → 0.0.0-unstable.2af142b57e
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 +2 -2
- package/configurations.js +13 -10
- package/configurations.js.map +1 -0
- package/definitions/entry.d.ts +2 -2
- package/definitions/entry.js +6 -12
- package/definitions/entry.js.map +1 -0
- package/definitions/entryElasticsearch.d.ts +2 -2
- package/definitions/entryElasticsearch.js +3 -12
- package/definitions/entryElasticsearch.js.map +1 -0
- package/definitions/group.d.ts +2 -2
- package/definitions/group.js +3 -12
- package/definitions/group.js.map +1 -0
- package/definitions/model.d.ts +2 -2
- package/definitions/model.js +8 -12
- package/definitions/model.js.map +1 -0
- package/definitions/settings.d.ts +2 -2
- package/definitions/settings.js +3 -12
- package/definitions/settings.js.map +1 -0
- package/definitions/system.d.ts +2 -2
- package/definitions/system.js +3 -12
- package/definitions/system.js.map +1 -0
- package/definitions/table.d.ts +2 -2
- package/definitions/table.js +0 -3
- package/definitions/table.js.map +1 -0
- package/definitions/tableElasticsearch.d.ts +2 -2
- package/definitions/tableElasticsearch.js +0 -3
- package/definitions/tableElasticsearch.js.map +1 -0
- package/dynamoDb/index.d.ts +1 -1
- package/dynamoDb/index.js +4 -11
- package/dynamoDb/index.js.map +1 -0
- package/dynamoDb/storage/date.d.ts +3 -3
- package/dynamoDb/storage/date.js +73 -54
- package/dynamoDb/storage/date.js.map +1 -0
- package/dynamoDb/storage/longText.d.ts +7 -4
- package/dynamoDb/storage/longText.js +72 -64
- package/dynamoDb/storage/longText.js.map +1 -0
- package/dynamoDb/storage/richText.d.ts +2 -3
- package/dynamoDb/storage/richText.js +74 -78
- package/dynamoDb/storage/richText.js.map +1 -0
- package/elasticsearch/createElasticsearchIndex.d.ts +9 -0
- package/elasticsearch/createElasticsearchIndex.js +49 -0
- package/elasticsearch/createElasticsearchIndex.js.map +1 -0
- package/elasticsearch/deleteElasticsearchIndex.d.ts +8 -0
- package/elasticsearch/deleteElasticsearchIndex.js +36 -0
- package/elasticsearch/deleteElasticsearchIndex.js.map +1 -0
- package/elasticsearch/index.d.ts +1 -1
- package/elasticsearch/index.js +1 -6
- package/elasticsearch/index.js.map +1 -0
- package/elasticsearch/indexing/dateTimeIndexing.js +17 -20
- package/elasticsearch/indexing/dateTimeIndexing.js.map +1 -0
- package/elasticsearch/indexing/defaultFieldIndexing.js +5 -9
- package/elasticsearch/indexing/defaultFieldIndexing.js.map +1 -0
- package/elasticsearch/indexing/index.js +1 -10
- package/elasticsearch/indexing/index.js.map +1 -0
- package/elasticsearch/indexing/longTextIndexing.d.ts +4 -0
- package/elasticsearch/indexing/longTextIndexing.js +19 -9
- package/elasticsearch/indexing/longTextIndexing.js.map +1 -0
- package/elasticsearch/indexing/numberIndexing.js +0 -9
- package/elasticsearch/indexing/numberIndexing.js.map +1 -0
- package/elasticsearch/indexing/objectIndexing.d.ts +9 -0
- package/elasticsearch/indexing/objectIndexing.js +26 -30
- package/elasticsearch/indexing/objectIndexing.js.map +1 -0
- package/elasticsearch/indexing/richTextIndexing.js +0 -5
- package/elasticsearch/indexing/richTextIndexing.js.map +1 -0
- package/elasticsearch/indices/base.d.ts +2 -0
- package/elasticsearch/indices/base.js +12 -0
- package/elasticsearch/indices/base.js.map +1 -0
- package/elasticsearch/indices/index.d.ts +1 -0
- package/elasticsearch/indices/index.js +12 -0
- package/elasticsearch/indices/index.js.map +1 -0
- package/elasticsearch/indices/japanese.d.ts +2 -0
- package/elasticsearch/indices/japanese.js +13 -0
- package/elasticsearch/indices/japanese.js.map +1 -0
- package/elasticsearch/search/index.d.ts +2 -2
- package/elasticsearch/search/index.js +3 -9
- package/elasticsearch/search/index.js.map +1 -0
- package/elasticsearch/search/refSearch.d.ts +2 -3
- package/elasticsearch/search/refSearch.js +23 -18
- package/elasticsearch/search/refSearch.js.map +1 -0
- package/elasticsearch/search/timeSearch.d.ts +2 -3
- package/elasticsearch/search/timeSearch.js +18 -17
- package/elasticsearch/search/timeSearch.js.map +1 -0
- package/helpers/entryIndexHelpers.js +43 -57
- package/helpers/entryIndexHelpers.js.map +1 -0
- package/helpers/index.d.ts +0 -1
- package/helpers/index.js +0 -15
- package/helpers/index.js.map +1 -0
- package/index.d.ts +1 -0
- package/index.js +120 -58
- package/index.js.map +1 -0
- package/operations/entry/dataLoaders.d.ts +6 -2
- package/operations/entry/dataLoaders.js +27 -61
- package/operations/entry/dataLoaders.js.map +1 -0
- package/operations/entry/elasticsearch/assignMinimumShouldMatchToQuery.d.ts +18 -0
- package/operations/entry/elasticsearch/assignMinimumShouldMatchToQuery.js +32 -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 +140 -0
- package/operations/entry/elasticsearch/body.js.map +1 -0
- package/operations/entry/elasticsearch/fields.d.ts +9 -0
- package/operations/entry/elasticsearch/fields.js +229 -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 +57 -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 +172 -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 +16 -0
- package/operations/entry/elasticsearch/filtering/index.js.map +1 -0
- package/operations/entry/elasticsearch/filtering/path.d.ts +15 -0
- package/operations/entry/elasticsearch/filtering/path.js +44 -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 +28 -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 +13 -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 +65 -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 +48 -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 +23 -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 +22 -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 +89 -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 +25 -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 +103 -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 +34 -0
- package/operations/entry/elasticsearch/keyword.js.map +1 -0
- package/operations/entry/elasticsearch/plugins/bodyModifier.d.ts +9 -0
- package/operations/entry/elasticsearch/plugins/bodyModifier.js +16 -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 +37 -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 +16 -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} +8 -10
- 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 +16 -0
- package/operations/entry/elasticsearch/plugins/sortModifier.js.map +1 -0
- package/operations/entry/elasticsearch/sort.d.ts +12 -0
- package/operations/entry/elasticsearch/sort.js +82 -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 +30 -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 +5 -0
- package/operations/entry/elasticsearch/types.js.map +1 -0
- package/operations/entry/index.d.ts +2 -4
- package/operations/entry/index.js +457 -481
- package/operations/entry/index.js.map +1 -0
- package/operations/entry/keys.js +0 -9
- package/operations/entry/keys.js.map +1 -0
- package/operations/entry/recordType.d.ts +3 -0
- package/operations/entry/recordType.js +18 -0
- package/operations/entry/recordType.js.map +1 -0
- package/operations/group/index.d.ts +2 -2
- package/operations/group/index.js +10 -47
- package/operations/group/index.js.map +1 -0
- package/operations/model/index.d.ts +2 -2
- package/operations/model/index.js +34 -68
- package/operations/model/index.js.map +1 -0
- package/operations/settings/index.d.ts +2 -2
- package/operations/settings/index.js +7 -37
- package/operations/settings/index.js.map +1 -0
- package/operations/system/index.d.ts +2 -2
- package/operations/system/index.js +5 -28
- package/operations/system/index.js.map +1 -0
- package/package.json +24 -29
- package/plugins/CmsEntryElasticsearchBodyModifierPlugin.d.ts +7 -3
- package/plugins/CmsEntryElasticsearchBodyModifierPlugin.js +9 -11
- package/plugins/CmsEntryElasticsearchBodyModifierPlugin.js.map +1 -0
- package/plugins/CmsEntryElasticsearchFieldPlugin.d.ts +3 -3
- package/plugins/CmsEntryElasticsearchFieldPlugin.js +3 -9
- package/plugins/CmsEntryElasticsearchFieldPlugin.js.map +1 -0
- package/plugins/CmsEntryElasticsearchFullTextSearchPlugin.d.ts +23 -0
- package/plugins/CmsEntryElasticsearchFullTextSearchPlugin.js +28 -0
- package/plugins/CmsEntryElasticsearchFullTextSearchPlugin.js.map +1 -0
- package/plugins/CmsEntryElasticsearchIndexPlugin.d.ts +4 -0
- package/plugins/CmsEntryElasticsearchIndexPlugin.js +12 -0
- package/plugins/CmsEntryElasticsearchIndexPlugin.js.map +1 -0
- package/plugins/CmsEntryElasticsearchQueryBuilderValueSearchPlugin.d.ts +30 -0
- package/plugins/CmsEntryElasticsearchQueryBuilderValueSearchPlugin.js +33 -0
- package/plugins/CmsEntryElasticsearchQueryBuilderValueSearchPlugin.js.map +1 -0
- package/plugins/CmsEntryElasticsearchQueryModifierPlugin.d.ts +4 -3
- package/plugins/CmsEntryElasticsearchQueryModifierPlugin.js +9 -11
- package/plugins/CmsEntryElasticsearchQueryModifierPlugin.js.map +1 -0
- package/plugins/CmsEntryElasticsearchSortModifierPlugin.d.ts +4 -3
- package/plugins/CmsEntryElasticsearchSortModifierPlugin.js +9 -11
- package/plugins/CmsEntryElasticsearchSortModifierPlugin.js.map +1 -0
- package/plugins/CmsEntryFilterPlugin.d.ts +49 -0
- package/plugins/CmsEntryFilterPlugin.js +24 -0
- package/plugins/CmsEntryFilterPlugin.js.map +1 -0
- package/plugins/index.d.ts +7 -0
- package/plugins/index.js +82 -0
- package/plugins/index.js.map +1 -0
- package/types.d.ts +7 -34
- package/types.js +0 -18
- package/types.js.map +1 -0
- 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/system/createElasticsearchTemplate.d.ts +0 -5
- package/operations/system/createElasticsearchTemplate.js +0 -62
- 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
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { BoolQueryConfig } from "@webiny/api-elasticsearch/types";
|
|
2
|
+
/**
|
|
3
|
+
* This function will assign a minimum_should_match for the query if conditions are met:
|
|
4
|
+
* * should is an array
|
|
5
|
+
* * it is not empty
|
|
6
|
+
* * minimum_should_match is not already set
|
|
7
|
+
*
|
|
8
|
+
*
|
|
9
|
+
* By the default we set it to 1 as we want at least one OR condition to produce results.
|
|
10
|
+
*
|
|
11
|
+
* Users can modify minimum_should_match value via the body or query modification plugins.
|
|
12
|
+
*/
|
|
13
|
+
interface Params {
|
|
14
|
+
query: BoolQueryConfig;
|
|
15
|
+
value?: number;
|
|
16
|
+
}
|
|
17
|
+
export declare const assignMinimumShouldMatchToQuery: ({ query, value }: Params) => void;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.assignMinimumShouldMatchToQuery = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* This function will assign a minimum_should_match for the query if conditions are met:
|
|
9
|
+
* * should is an array
|
|
10
|
+
* * it is not empty
|
|
11
|
+
* * minimum_should_match is not already set
|
|
12
|
+
*
|
|
13
|
+
*
|
|
14
|
+
* By the default we set it to 1 as we want at least one OR condition to produce results.
|
|
15
|
+
*
|
|
16
|
+
* Users can modify minimum_should_match value via the body or query modification plugins.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
const assignMinimumShouldMatchToQuery = ({
|
|
20
|
+
query,
|
|
21
|
+
value = 1
|
|
22
|
+
}) => {
|
|
23
|
+
if (!Array.isArray(query.should)) {
|
|
24
|
+
return;
|
|
25
|
+
} else if (query.should.length === 0) {
|
|
26
|
+
return;
|
|
27
|
+
} else if (query.minimum_should_match) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
query.minimum_should_match = value > 0 ? value : 1;
|
|
31
|
+
};
|
|
32
|
+
exports.assignMinimumShouldMatchToQuery = assignMinimumShouldMatchToQuery;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["assignMinimumShouldMatchToQuery","query","value","Array","isArray","should","length","minimum_should_match"],"sources":["assignMinimumShouldMatchToQuery.ts"],"sourcesContent":["import { BoolQueryConfig } from \"@webiny/api-elasticsearch/types\";\n\n/**\n * This function will assign a minimum_should_match for the query if conditions are met:\n * * should is an array\n * * it is not empty\n * * minimum_should_match is not already set\n *\n *\n * By the default we set it to 1 as we want at least one OR condition to produce results.\n *\n * Users can modify minimum_should_match value via the body or query modification plugins.\n */\ninterface Params {\n query: BoolQueryConfig;\n value?: number;\n}\nexport const assignMinimumShouldMatchToQuery = ({ query, value = 1 }: Params): void => {\n if (!Array.isArray(query.should)) {\n return;\n } else if (query.should.length === 0) {\n return;\n } else if (query.minimum_should_match) {\n return;\n }\n query.minimum_should_match = value > 0 ? value : 1;\n};\n"],"mappings":";;;;;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAKO,MAAMA,+BAA+B,GAAG,CAAC;EAAEC,KAAK;EAAEC,KAAK,GAAG;AAAU,CAAC,KAAW;EACnF,IAAI,CAACC,KAAK,CAACC,OAAO,CAACH,KAAK,CAACI,MAAM,CAAC,EAAE;IAC9B;EACJ,CAAC,MAAM,IAAIJ,KAAK,CAACI,MAAM,CAACC,MAAM,KAAK,CAAC,EAAE;IAClC;EACJ,CAAC,MAAM,IAAIL,KAAK,CAACM,oBAAoB,EAAE;IACnC;EACJ;EACAN,KAAK,CAACM,oBAAoB,GAAGL,KAAK,GAAG,CAAC,GAAGA,KAAK,GAAG,CAAC;AACtD,CAAC;AAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { PluginsContainer } from "@webiny/plugins";
|
|
2
|
+
import { CmsEntryListParams, CmsEntryListWhere, CmsModel } from "@webiny/api-headless-cms/types";
|
|
3
|
+
import { PrimitiveValue, SearchBody } from "@webiny/api-elasticsearch/types";
|
|
4
|
+
interface Params {
|
|
5
|
+
plugins: PluginsContainer;
|
|
6
|
+
model: CmsModel;
|
|
7
|
+
params: Omit<CmsEntryListParams, "where" | "after"> & {
|
|
8
|
+
where: CmsEntryListWhere;
|
|
9
|
+
after?: PrimitiveValue[];
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
export declare const createElasticsearchBody: ({ plugins, model, params }: Params) => SearchBody;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.createElasticsearchBody = void 0;
|
|
7
|
+
var _fields = require("./fields");
|
|
8
|
+
var _fullTextSearchFields = require("./fullTextSearchFields");
|
|
9
|
+
var _initialQuery = require("./initialQuery");
|
|
10
|
+
var _fullTextSearch = require("./fullTextSearch");
|
|
11
|
+
var _queryModifier = require("./plugins/queryModifier");
|
|
12
|
+
var _sortModifier = require("./plugins/sortModifier");
|
|
13
|
+
var _bodyModifier = require("./plugins/bodyModifier");
|
|
14
|
+
var _sort = require("./sort");
|
|
15
|
+
var _filtering = require("./filtering");
|
|
16
|
+
var _assignMinimumShouldMatchToQuery = require("./assignMinimumShouldMatchToQuery");
|
|
17
|
+
const createElasticsearchBody = ({
|
|
18
|
+
plugins,
|
|
19
|
+
model,
|
|
20
|
+
params
|
|
21
|
+
}) => {
|
|
22
|
+
const {
|
|
23
|
+
fields,
|
|
24
|
+
search: term,
|
|
25
|
+
where,
|
|
26
|
+
sort: initialSort,
|
|
27
|
+
after,
|
|
28
|
+
limit
|
|
29
|
+
} = params;
|
|
30
|
+
/**
|
|
31
|
+
* We need the model fields constructed as a key -> field value, so we do not need to iterate through array when we require some field.
|
|
32
|
+
*/
|
|
33
|
+
const modelFields = (0, _fields.createModelFields)({
|
|
34
|
+
plugins,
|
|
35
|
+
fields: model.fields
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* We need the query modifier plugins.
|
|
40
|
+
*/
|
|
41
|
+
const queryModifierPlugins = (0, _queryModifier.createQueryModifierPluginList)({
|
|
42
|
+
plugins,
|
|
43
|
+
model
|
|
44
|
+
});
|
|
45
|
+
/**
|
|
46
|
+
* We need the sort modifier plugins.
|
|
47
|
+
*/
|
|
48
|
+
const sortModifierPlugins = (0, _sortModifier.createSortModifierPluginList)({
|
|
49
|
+
plugins,
|
|
50
|
+
model
|
|
51
|
+
});
|
|
52
|
+
/**
|
|
53
|
+
* We need the body modifier plugins.
|
|
54
|
+
*/
|
|
55
|
+
const bodyModifierPlugins = (0, _bodyModifier.createBodyModifierPluginList)({
|
|
56
|
+
plugins,
|
|
57
|
+
model
|
|
58
|
+
});
|
|
59
|
+
/**
|
|
60
|
+
* We need the fields which we can search through via the full text search.
|
|
61
|
+
*
|
|
62
|
+
*/
|
|
63
|
+
const fullTextSearchFields = (0, _fullTextSearchFields.createFullTextSearchFields)({
|
|
64
|
+
model,
|
|
65
|
+
term,
|
|
66
|
+
fields
|
|
67
|
+
});
|
|
68
|
+
/**
|
|
69
|
+
* The initial elasticsearch query where we attach some default conditions we always need.
|
|
70
|
+
*/
|
|
71
|
+
const query = (0, _initialQuery.createInitialQuery)({
|
|
72
|
+
where,
|
|
73
|
+
model
|
|
74
|
+
});
|
|
75
|
+
/**
|
|
76
|
+
* Apply the full text search, if term is set.
|
|
77
|
+
*/
|
|
78
|
+
(0, _fullTextSearch.applyFullTextSearch)({
|
|
79
|
+
model,
|
|
80
|
+
plugins,
|
|
81
|
+
query,
|
|
82
|
+
term,
|
|
83
|
+
fields: fullTextSearchFields
|
|
84
|
+
});
|
|
85
|
+
const execFiltering = (0, _filtering.createExecFiltering)({
|
|
86
|
+
model,
|
|
87
|
+
fields: modelFields,
|
|
88
|
+
plugins
|
|
89
|
+
});
|
|
90
|
+
execFiltering({
|
|
91
|
+
where,
|
|
92
|
+
query
|
|
93
|
+
});
|
|
94
|
+
for (const pl of queryModifierPlugins) {
|
|
95
|
+
pl.modifyQuery({
|
|
96
|
+
query,
|
|
97
|
+
model,
|
|
98
|
+
where
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
const sort = (0, _sort.createElasticsearchSort)({
|
|
102
|
+
plugins,
|
|
103
|
+
sort: initialSort,
|
|
104
|
+
modelFields,
|
|
105
|
+
model
|
|
106
|
+
});
|
|
107
|
+
for (const pl of sortModifierPlugins) {
|
|
108
|
+
pl.modifySort({
|
|
109
|
+
sort,
|
|
110
|
+
model
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
const boolQuery = {
|
|
114
|
+
must: query.must.length > 0 ? query.must : undefined,
|
|
115
|
+
must_not: query.must_not.length > 0 ? query.must_not : undefined,
|
|
116
|
+
should: query.should.length > 0 ? query.should : undefined,
|
|
117
|
+
filter: query.filter.length > 0 ? query.filter : undefined
|
|
118
|
+
};
|
|
119
|
+
(0, _assignMinimumShouldMatchToQuery.assignMinimumShouldMatchToQuery)({
|
|
120
|
+
query: boolQuery
|
|
121
|
+
});
|
|
122
|
+
const body = {
|
|
123
|
+
query: {
|
|
124
|
+
bool: boolQuery
|
|
125
|
+
},
|
|
126
|
+
sort,
|
|
127
|
+
size: (limit || 0) + 1,
|
|
128
|
+
search_after: after,
|
|
129
|
+
track_total_hits: true
|
|
130
|
+
};
|
|
131
|
+
for (const pl of bodyModifierPlugins) {
|
|
132
|
+
pl.modifyBody({
|
|
133
|
+
body,
|
|
134
|
+
model,
|
|
135
|
+
where
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
return body;
|
|
139
|
+
};
|
|
140
|
+
exports.createElasticsearchBody = createElasticsearchBody;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createElasticsearchBody","plugins","model","params","fields","search","term","where","sort","initialSort","after","limit","modelFields","createModelFields","queryModifierPlugins","createQueryModifierPluginList","sortModifierPlugins","createSortModifierPluginList","bodyModifierPlugins","createBodyModifierPluginList","fullTextSearchFields","createFullTextSearchFields","query","createInitialQuery","applyFullTextSearch","execFiltering","createExecFiltering","pl","modifyQuery","createElasticsearchSort","modifySort","boolQuery","must","length","undefined","must_not","should","filter","assignMinimumShouldMatchToQuery","body","bool","size","search_after","track_total_hits","modifyBody"],"sources":["body.ts"],"sourcesContent":["import { PluginsContainer } from \"@webiny/plugins\";\nimport { CmsEntryListParams, CmsEntryListWhere, CmsModel } from \"@webiny/api-headless-cms/types\";\nimport { createModelFields } from \"./fields\";\nimport { createFullTextSearchFields } from \"./fullTextSearchFields\";\nimport { createInitialQuery } from \"./initialQuery\";\nimport { applyFullTextSearch } from \"./fullTextSearch\";\nimport { createQueryModifierPluginList } from \"./plugins/queryModifier\";\nimport { createSortModifierPluginList } from \"./plugins/sortModifier\";\nimport { createBodyModifierPluginList } from \"./plugins/bodyModifier\";\nimport { createElasticsearchSort } from \"./sort\";\nimport { PrimitiveValue, SearchBody, BoolQueryConfig } from \"@webiny/api-elasticsearch/types\";\nimport { createExecFiltering } from \"./filtering\";\nimport { assignMinimumShouldMatchToQuery } from \"./assignMinimumShouldMatchToQuery\";\n\ninterface Params {\n plugins: PluginsContainer;\n model: CmsModel;\n params: Omit<CmsEntryListParams, \"where\" | \"after\"> & {\n where: CmsEntryListWhere;\n after?: PrimitiveValue[];\n };\n}\nexport const createElasticsearchBody = ({ plugins, model, params }: Params): SearchBody => {\n const { fields, search: term, where, sort: initialSort, after, limit } = params;\n /**\n * We need the model fields constructed as a key -> field value, so we do not need to iterate through array when we require some field.\n */\n const modelFields = createModelFields({\n plugins,\n fields: model.fields\n });\n\n /**\n * We need the query modifier plugins.\n */\n const queryModifierPlugins = createQueryModifierPluginList({\n plugins,\n model\n });\n /**\n * We need the sort modifier plugins.\n */\n const sortModifierPlugins = createSortModifierPluginList({\n plugins,\n model\n });\n /**\n * We need the body modifier plugins.\n */\n const bodyModifierPlugins = createBodyModifierPluginList({\n plugins,\n model\n });\n /**\n * We need the fields which we can search through via the full text search.\n *\n */\n const fullTextSearchFields = createFullTextSearchFields({\n model,\n term,\n fields\n });\n /**\n * The initial elasticsearch query where we attach some default conditions we always need.\n */\n const query = createInitialQuery({\n where,\n model\n });\n /**\n * Apply the full text search, if term is set.\n */\n applyFullTextSearch({\n model,\n plugins,\n query,\n term,\n fields: fullTextSearchFields\n });\n\n const execFiltering = createExecFiltering({\n model,\n fields: modelFields,\n plugins\n });\n\n execFiltering({\n where,\n query\n });\n\n for (const pl of queryModifierPlugins) {\n pl.modifyQuery({ query, model, where });\n }\n\n const sort = createElasticsearchSort({\n plugins,\n sort: initialSort,\n modelFields,\n model\n });\n\n for (const pl of sortModifierPlugins) {\n pl.modifySort({\n sort,\n model\n });\n }\n\n const boolQuery: BoolQueryConfig = {\n must: query.must.length > 0 ? query.must : undefined,\n must_not: query.must_not.length > 0 ? query.must_not : undefined,\n should: query.should.length > 0 ? query.should : undefined,\n filter: query.filter.length > 0 ? query.filter : undefined\n };\n\n assignMinimumShouldMatchToQuery({\n query: boolQuery\n });\n\n const body: SearchBody = {\n query: {\n bool: boolQuery\n },\n sort,\n size: (limit || 0) + 1,\n search_after: after,\n track_total_hits: true\n };\n\n for (const pl of bodyModifierPlugins) {\n pl.modifyBody({\n body,\n model,\n where\n });\n }\n\n return body;\n};\n"],"mappings":";;;;;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAUO,MAAMA,uBAAuB,GAAG,CAAC;EAAEC,OAAO;EAAEC,KAAK;EAAEC;AAAe,CAAC,KAAiB;EACvF,MAAM;IAAEC,MAAM;IAAEC,MAAM,EAAEC,IAAI;IAAEC,KAAK;IAAEC,IAAI,EAAEC,WAAW;IAAEC,KAAK;IAAEC;EAAM,CAAC,GAAGR,MAAM;EAC/E;AACJ;AACA;EACI,MAAMS,WAAW,GAAG,IAAAC,yBAAiB,EAAC;IAClCZ,OAAO;IACPG,MAAM,EAAEF,KAAK,CAACE;EAClB,CAAC,CAAC;;EAEF;AACJ;AACA;EACI,MAAMU,oBAAoB,GAAG,IAAAC,4CAA6B,EAAC;IACvDd,O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,CAAC,GAAGX,KAAK,CAACU,IAAI,GAAGE,SAAS;IACpDC,QAAQ,EAAEb,KAAK,CAACa,QAAQ,CAACF,MAAM,GAAG,CAAC,GAAGX,KAAK,CAACa,QAAQ,GAAGD,SAAS;IAChEE,MAAM,EAAEd,KAAK,CAACc,MAAM,CAACH,MAAM,GAAG,CAAC,GAAGX,KAAK,CAACc,MAAM,GAAGF,SAAS;IAC1DG,MAAM,EAAEf,KAAK,CAACe,MAAM,CAACJ,MAAM,GAAG,CAAC,GAAGX,KAAK,CAACe,MAAM,GAAGH;EACrD,CAAC;EAED,IAAAI,gEAA+B,EAAC;IAC5BhB,KAAK,EAAES;EACX,CAAC,CAAC;EAEF,MAAMQ,IAAgB,GAAG;IACrBjB,KAAK,EAAE;MACHkB,IAAI,EAAET;IACV,CAAC;IACDvB,IAAI;IACJiC,IAAI,EAAE,CAAC9B,KAAK,IAAI,CAAC,IAAI,CAAC;IACtB+B,YAAY,EAAEhC,KAAK;IACnBiC,gBAAgB,EAAE;EACtB,CAAC;EAED,KAAK,MAAMhB,EAAE,IAAIT,mBAAmB,EAAE;IAClCS,EAAE,CAACiB,UAAU,CAAC;MACVL,IAAI;MACJrC,KAAK;MACLK;IACJ,CAAC,CAAC;EACN;EAEA,OAAOgC,IAAI;AACf,CAAC;AAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { PluginsContainer } from "@webiny/plugins";
|
|
2
|
+
import { CmsModelField } from "@webiny/api-headless-cms/types";
|
|
3
|
+
import { ModelFields } from "./types";
|
|
4
|
+
interface Params {
|
|
5
|
+
plugins: PluginsContainer;
|
|
6
|
+
fields?: CmsModelField[];
|
|
7
|
+
}
|
|
8
|
+
export declare const createModelFields: ({ plugins, fields }: Params) => ModelFields;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.createModelFields = void 0;
|
|
8
|
+
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
9
|
+
var _error = _interopRequireDefault(require("@webiny/error"));
|
|
10
|
+
const createSystemField = field => {
|
|
11
|
+
return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, field), {}, {
|
|
12
|
+
id: field.fieldId,
|
|
13
|
+
label: field.fieldId
|
|
14
|
+
});
|
|
15
|
+
};
|
|
16
|
+
const createSystemFields = () => {
|
|
17
|
+
return {
|
|
18
|
+
id: {
|
|
19
|
+
type: "text",
|
|
20
|
+
isSystemField: true,
|
|
21
|
+
isSearchable: true,
|
|
22
|
+
isSortable: true,
|
|
23
|
+
field: createSystemField({
|
|
24
|
+
storageId: "id",
|
|
25
|
+
fieldId: "id",
|
|
26
|
+
type: "text"
|
|
27
|
+
}),
|
|
28
|
+
parents: []
|
|
29
|
+
},
|
|
30
|
+
entryId: {
|
|
31
|
+
type: "text",
|
|
32
|
+
isSystemField: true,
|
|
33
|
+
isSearchable: true,
|
|
34
|
+
isSortable: true,
|
|
35
|
+
field: createSystemField({
|
|
36
|
+
storageId: "entryId",
|
|
37
|
+
fieldId: "entryId",
|
|
38
|
+
type: "text"
|
|
39
|
+
}),
|
|
40
|
+
parents: []
|
|
41
|
+
},
|
|
42
|
+
savedOn: {
|
|
43
|
+
type: "date",
|
|
44
|
+
unmappedType: "date",
|
|
45
|
+
keyword: false,
|
|
46
|
+
isSystemField: true,
|
|
47
|
+
isSearchable: true,
|
|
48
|
+
isSortable: true,
|
|
49
|
+
field: createSystemField({
|
|
50
|
+
storageId: "savedOn",
|
|
51
|
+
fieldId: "savedOn",
|
|
52
|
+
type: "datetime",
|
|
53
|
+
settings: {
|
|
54
|
+
type: "dateTimeWithoutTimezone"
|
|
55
|
+
}
|
|
56
|
+
}),
|
|
57
|
+
parents: []
|
|
58
|
+
},
|
|
59
|
+
createdOn: {
|
|
60
|
+
type: "date",
|
|
61
|
+
unmappedType: "date",
|
|
62
|
+
keyword: false,
|
|
63
|
+
isSystemField: true,
|
|
64
|
+
isSearchable: true,
|
|
65
|
+
isSortable: true,
|
|
66
|
+
field: createSystemField({
|
|
67
|
+
storageId: "createdOn",
|
|
68
|
+
fieldId: "createdOn",
|
|
69
|
+
type: "text",
|
|
70
|
+
settings: {
|
|
71
|
+
type: "dateTimeWithoutTimezone"
|
|
72
|
+
}
|
|
73
|
+
}),
|
|
74
|
+
parents: []
|
|
75
|
+
},
|
|
76
|
+
createdBy: {
|
|
77
|
+
type: "text",
|
|
78
|
+
unmappedType: undefined,
|
|
79
|
+
isSystemField: true,
|
|
80
|
+
isSearchable: true,
|
|
81
|
+
isSortable: false,
|
|
82
|
+
path: "createdBy.id",
|
|
83
|
+
field: createSystemField({
|
|
84
|
+
storageId: "createdBy",
|
|
85
|
+
fieldId: "createdBy",
|
|
86
|
+
type: "text"
|
|
87
|
+
}),
|
|
88
|
+
parents: []
|
|
89
|
+
},
|
|
90
|
+
ownedBy: {
|
|
91
|
+
type: "text",
|
|
92
|
+
unmappedType: undefined,
|
|
93
|
+
isSystemField: true,
|
|
94
|
+
isSearchable: true,
|
|
95
|
+
isSortable: false,
|
|
96
|
+
path: "ownedBy.id",
|
|
97
|
+
field: createSystemField({
|
|
98
|
+
storageId: "ownedBy",
|
|
99
|
+
fieldId: "ownedBy",
|
|
100
|
+
type: "text"
|
|
101
|
+
}),
|
|
102
|
+
parents: []
|
|
103
|
+
},
|
|
104
|
+
version: {
|
|
105
|
+
type: "number",
|
|
106
|
+
unmappedType: undefined,
|
|
107
|
+
keyword: false,
|
|
108
|
+
isSystemField: true,
|
|
109
|
+
isSearchable: true,
|
|
110
|
+
isSortable: true,
|
|
111
|
+
field: createSystemField({
|
|
112
|
+
storageId: "version",
|
|
113
|
+
fieldId: "version",
|
|
114
|
+
type: "number"
|
|
115
|
+
}),
|
|
116
|
+
parents: []
|
|
117
|
+
},
|
|
118
|
+
status: {
|
|
119
|
+
type: "string",
|
|
120
|
+
unmappedType: undefined,
|
|
121
|
+
keyword: false,
|
|
122
|
+
isSystemField: true,
|
|
123
|
+
isSearchable: true,
|
|
124
|
+
isSortable: false,
|
|
125
|
+
field: createSystemField({
|
|
126
|
+
storageId: "status",
|
|
127
|
+
fieldId: "status",
|
|
128
|
+
type: "string"
|
|
129
|
+
}),
|
|
130
|
+
parents: []
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
};
|
|
134
|
+
const buildFieldsList = params => {
|
|
135
|
+
const {
|
|
136
|
+
plugins,
|
|
137
|
+
fields,
|
|
138
|
+
parents
|
|
139
|
+
} = params;
|
|
140
|
+
return fields.reduce((result, field) => {
|
|
141
|
+
var _field$settings;
|
|
142
|
+
const plugin = plugins[field.type];
|
|
143
|
+
if (!plugin) {
|
|
144
|
+
throw new _error.default(`There is no plugin for field type "${field.type}".`);
|
|
145
|
+
}
|
|
146
|
+
const {
|
|
147
|
+
isSearchable,
|
|
148
|
+
isSortable,
|
|
149
|
+
unmappedType,
|
|
150
|
+
fullTextSearch
|
|
151
|
+
} = plugin;
|
|
152
|
+
/**
|
|
153
|
+
* If a field has child fields, go through them and add them to a result.
|
|
154
|
+
*/
|
|
155
|
+
const childFields = ((_field$settings = field.settings) === null || _field$settings === void 0 ? void 0 : _field$settings.fields) || [];
|
|
156
|
+
if (childFields.length > 0) {
|
|
157
|
+
/**
|
|
158
|
+
* Let's build all the child fields
|
|
159
|
+
*/
|
|
160
|
+
const childResult = buildFieldsList({
|
|
161
|
+
fields: childFields,
|
|
162
|
+
plugins,
|
|
163
|
+
parents: [...parents, {
|
|
164
|
+
fieldId: field.fieldId,
|
|
165
|
+
storageId: field.storageId,
|
|
166
|
+
type: field.type
|
|
167
|
+
}]
|
|
168
|
+
});
|
|
169
|
+
/**
|
|
170
|
+
*
|
|
171
|
+
*/
|
|
172
|
+
Object.assign(result, childResult);
|
|
173
|
+
}
|
|
174
|
+
const identifier = [...parents.map(p => p.fieldId), field.fieldId].join(".");
|
|
175
|
+
result[identifier] = {
|
|
176
|
+
type: field.type,
|
|
177
|
+
parents,
|
|
178
|
+
isSearchable,
|
|
179
|
+
isSortable,
|
|
180
|
+
fullTextSearch,
|
|
181
|
+
unmappedType: typeof unmappedType === "function" ? unmappedType(field) : undefined,
|
|
182
|
+
isSystemField: false,
|
|
183
|
+
field
|
|
184
|
+
};
|
|
185
|
+
return result;
|
|
186
|
+
}, {});
|
|
187
|
+
};
|
|
188
|
+
const createModelFields = ({
|
|
189
|
+
plugins,
|
|
190
|
+
fields
|
|
191
|
+
}) => {
|
|
192
|
+
if (!fields || fields.length === 0) {
|
|
193
|
+
return createSystemFields();
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* Collect all unmappedType from elastic plugins.
|
|
197
|
+
*/
|
|
198
|
+
const unmappedTypes = plugins.byType("cms-model-field-to-elastic-search").reduce((acc, plugin) => {
|
|
199
|
+
if (!plugin.unmappedType) {
|
|
200
|
+
return acc;
|
|
201
|
+
}
|
|
202
|
+
acc[plugin.fieldType] = plugin.unmappedType;
|
|
203
|
+
return acc;
|
|
204
|
+
}, {});
|
|
205
|
+
/**
|
|
206
|
+
* Collect all field types from the plugins.
|
|
207
|
+
*/
|
|
208
|
+
const fieldTypePlugins = plugins.byType("cms-model-field-to-graphql").reduce((types, plugin) => {
|
|
209
|
+
const {
|
|
210
|
+
fieldType,
|
|
211
|
+
isSearchable,
|
|
212
|
+
isSortable,
|
|
213
|
+
fullTextSearch
|
|
214
|
+
} = plugin;
|
|
215
|
+
types[fieldType] = {
|
|
216
|
+
unmappedType: unmappedTypes[fieldType],
|
|
217
|
+
isSearchable,
|
|
218
|
+
isSortable,
|
|
219
|
+
fullTextSearch
|
|
220
|
+
};
|
|
221
|
+
return types;
|
|
222
|
+
}, {});
|
|
223
|
+
return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, createSystemFields()), buildFieldsList({
|
|
224
|
+
fields,
|
|
225
|
+
plugins: fieldTypePlugins,
|
|
226
|
+
parents: []
|
|
227
|
+
}));
|
|
228
|
+
};
|
|
229
|
+
exports.createModelFields = createModelFields;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createSystemField","field","id","fieldId","label","createSystemFields","type","isSystemField","isSearchable","isSortable","storageId","parents","entryId","savedOn","unmappedType","keyword","settings","createdOn","createdBy","undefined","path","ownedBy","version","status","buildFieldsList","params","plugins","fields","reduce","result","plugin","WebinyError","fullTextSearch","childFields","length","childResult","Object","assign","identifier","map","p","join","createModelFields","unmappedTypes","byType","acc","fieldType","fieldTypePlugins","types"],"sources":["fields.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { PluginsContainer } from \"@webiny/plugins\";\nimport { CmsModelField, CmsModelFieldToGraphQLPlugin } from \"@webiny/api-headless-cms/types\";\nimport { CmsModelFieldToElasticsearchPlugin } from \"~/types\";\nimport { ModelFieldParent, ModelFields } from \"./types\";\n\ntype PartialCmsModelField = Partial<CmsModelField> &\n Pick<CmsModelField, \"storageId\" | \"fieldId\" | \"type\">;\nconst createSystemField = (field: PartialCmsModelField): CmsModelField => {\n return {\n ...field,\n id: field.fieldId,\n label: field.fieldId\n };\n};\n\nconst createSystemFields = (): ModelFields => {\n return {\n id: {\n type: \"text\",\n isSystemField: true,\n isSearchable: true,\n isSortable: true,\n field: createSystemField({\n storageId: \"id\",\n fieldId: \"id\",\n type: \"text\"\n }),\n parents: []\n },\n entryId: {\n type: \"text\",\n isSystemField: true,\n isSearchable: true,\n isSortable: true,\n field: createSystemField({\n storageId: \"entryId\",\n fieldId: \"entryId\",\n type: \"text\"\n }),\n parents: []\n },\n savedOn: {\n type: \"date\",\n unmappedType: \"date\",\n keyword: false,\n isSystemField: true,\n isSearchable: true,\n isSortable: true,\n field: createSystemField({\n storageId: \"savedOn\",\n fieldId: \"savedOn\",\n type: \"datetime\",\n settings: {\n type: \"dateTimeWithoutTimezone\"\n }\n }),\n parents: []\n },\n createdOn: {\n type: \"date\",\n unmappedType: \"date\",\n keyword: false,\n isSystemField: true,\n isSearchable: true,\n isSortable: true,\n field: createSystemField({\n storageId: \"createdOn\",\n fieldId: \"createdOn\",\n type: \"text\",\n settings: {\n type: \"dateTimeWithoutTimezone\"\n }\n }),\n parents: []\n },\n createdBy: {\n type: \"text\",\n unmappedType: undefined,\n isSystemField: true,\n isSearchable: true,\n isSortable: false,\n path: \"createdBy.id\",\n field: createSystemField({\n storageId: \"createdBy\",\n fieldId: \"createdBy\",\n type: \"text\"\n }),\n parents: []\n },\n ownedBy: {\n type: \"text\",\n unmappedType: undefined,\n isSystemField: true,\n isSearchable: true,\n isSortable: false,\n path: \"ownedBy.id\",\n field: createSystemField({\n storageId: \"ownedBy\",\n fieldId: \"ownedBy\",\n type: \"text\"\n }),\n parents: []\n },\n version: {\n type: \"number\",\n unmappedType: undefined,\n keyword: false,\n isSystemField: true,\n isSearchable: true,\n isSortable: true,\n field: createSystemField({\n storageId: \"version\",\n fieldId: \"version\",\n type: \"number\"\n }),\n parents: []\n },\n status: {\n type: \"string\",\n unmappedType: undefined,\n keyword: false,\n isSystemField: true,\n isSearchable: true,\n isSortable: false,\n field: createSystemField({\n storageId: \"status\",\n fieldId: \"status\",\n type: \"string\"\n }),\n parents: []\n }\n };\n};\n\ninterface UnmappedFieldTypes {\n [type: string]: (field: CmsModelField) => string | undefined;\n}\n\ninterface FieldTypePlugin {\n unmappedType?: (field: CmsModelField) => string | undefined;\n isSearchable: boolean;\n isSortable: boolean;\n fullTextSearch?: boolean;\n}\ninterface FieldTypePlugins {\n [key: string]: FieldTypePlugin;\n}\n\ninterface BuildParams {\n plugins: FieldTypePlugins;\n fields: CmsModelField[];\n parents: ModelFieldParent[];\n}\nconst buildFieldsList = (params: BuildParams): ModelFields => {\n const { plugins, fields, parents } = params;\n\n return fields.reduce<ModelFields>((result, field) => {\n const plugin = plugins[field.type];\n if (!plugin) {\n throw new WebinyError(`There is no plugin for field type \"${field.type}\".`);\n }\n\n const { isSearchable, isSortable, unmappedType, fullTextSearch } = plugin;\n /**\n * If a field has child fields, go through them and add them to a result.\n */\n const childFields = field.settings?.fields || [];\n if (childFields.length > 0) {\n /**\n * Let's build all the child fields\n */\n const childResult = buildFieldsList({\n fields: childFields,\n plugins,\n parents: [\n ...parents,\n {\n fieldId: field.fieldId,\n storageId: field.storageId,\n type: field.type\n }\n ]\n });\n /**\n *\n */\n Object.assign(result, childResult);\n }\n\n const identifier = [...parents.map(p => p.fieldId), field.fieldId].join(\".\");\n\n result[identifier] = {\n type: field.type,\n parents,\n isSearchable,\n isSortable,\n fullTextSearch,\n unmappedType: typeof unmappedType === \"function\" ? unmappedType(field) : undefined,\n isSystemField: false,\n field\n };\n\n return result;\n }, {});\n};\n\ninterface Params {\n plugins: PluginsContainer;\n fields?: CmsModelField[];\n}\nexport const createModelFields = ({ plugins, fields }: Params) => {\n if (!fields || fields.length === 0) {\n return createSystemFields();\n }\n /**\n * Collect all unmappedType from elastic plugins.\n */\n const unmappedTypes = plugins\n .byType<CmsModelFieldToElasticsearchPlugin>(\"cms-model-field-to-elastic-search\")\n .reduce<UnmappedFieldTypes>((acc, plugin) => {\n if (!plugin.unmappedType) {\n return acc;\n }\n acc[plugin.fieldType] = plugin.unmappedType;\n return acc;\n }, {});\n /**\n * Collect all field types from the plugins.\n */\n const fieldTypePlugins = plugins\n .byType<CmsModelFieldToGraphQLPlugin>(\"cms-model-field-to-graphql\")\n .reduce<FieldTypePlugins>((types, plugin) => {\n const { fieldType, isSearchable, isSortable, fullTextSearch } = plugin;\n types[fieldType] = {\n unmappedType: unmappedTypes[fieldType],\n isSearchable,\n isSortable,\n fullTextSearch\n };\n return types;\n }, {});\n\n return {\n ...createSystemFields(),\n ...buildFieldsList({\n fields,\n plugins: fieldTypePlugins,\n parents: []\n })\n };\n};\n"],"mappings":";;;;;;;;AAAA;AAQA,MAAMA,iBAAiB,GAAIC,KAA2B,IAAoB;EACtE,mEACOA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ACF,SAAS,CAAC,GAAG;MACfhC,YAAY,EAAE6B,aAAa,CAACG,SAAS,CAAC;MACtCtC,YAAY;MACZC,UAAU;MACVuB;IACJ,CAAC;IACD,OAAOgB,KAAK;EAChB,CAAC,EAAE,CAAC,CAAC,CAAC;EAEV,mEACO3C,kBAAkB,EAAE,GACpBmB,eAAe,CAAC;IACfG,MAAM;IACND,OAAO,EAAEqB,gBAAgB;IACzBpC,OAAO,EAAE;EACb,CAAC,CAAC;AAEV,CAAC;AAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ElasticsearchQueryBuilderOperatorPlugins, ElasticsearchQuerySearchValuePlugins } from "../types";
|
|
2
|
+
import { ApplyFilteringCb } from "../../../../plugins/CmsEntryFilterPlugin";
|
|
3
|
+
interface CreateParams {
|
|
4
|
+
operatorPlugins: ElasticsearchQueryBuilderOperatorPlugins;
|
|
5
|
+
searchPlugins: ElasticsearchQuerySearchValuePlugins;
|
|
6
|
+
}
|
|
7
|
+
export declare const createApplyFiltering: ({ operatorPlugins, searchPlugins }: CreateParams) => ApplyFilteringCb;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.createApplyFiltering = void 0;
|
|
8
|
+
var _error = _interopRequireDefault(require("@webiny/error"));
|
|
9
|
+
var _transformValueForSearch = require("../transformValueForSearch");
|
|
10
|
+
var _keyword = require("../keyword");
|
|
11
|
+
var _path = require("./path");
|
|
12
|
+
const createApplyFiltering = ({
|
|
13
|
+
operatorPlugins,
|
|
14
|
+
searchPlugins
|
|
15
|
+
}) => {
|
|
16
|
+
const createFieldPath = (0, _path.createFieldPathFactory)({
|
|
17
|
+
plugins: searchPlugins
|
|
18
|
+
});
|
|
19
|
+
return params => {
|
|
20
|
+
const {
|
|
21
|
+
key,
|
|
22
|
+
value: initialValue,
|
|
23
|
+
query,
|
|
24
|
+
operator,
|
|
25
|
+
field
|
|
26
|
+
} = params;
|
|
27
|
+
const plugin = operatorPlugins[operator];
|
|
28
|
+
if (!plugin) {
|
|
29
|
+
throw new _error.default("Operator plugin missing.", "PLUGIN_MISSING", {
|
|
30
|
+
operator
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
const value = (0, _transformValueForSearch.transformValueForSearch)({
|
|
34
|
+
plugins: searchPlugins,
|
|
35
|
+
field: field.field,
|
|
36
|
+
value: initialValue
|
|
37
|
+
});
|
|
38
|
+
const keyword = (0, _keyword.hasKeyword)(field);
|
|
39
|
+
const {
|
|
40
|
+
basePath,
|
|
41
|
+
path
|
|
42
|
+
} = createFieldPath({
|
|
43
|
+
field,
|
|
44
|
+
value,
|
|
45
|
+
key,
|
|
46
|
+
keyword
|
|
47
|
+
});
|
|
48
|
+
plugin.apply(query, {
|
|
49
|
+
name: field.field.fieldId,
|
|
50
|
+
basePath,
|
|
51
|
+
path,
|
|
52
|
+
value,
|
|
53
|
+
keyword
|
|
54
|
+
});
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
exports.createApplyFiltering = createApplyFiltering;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createApplyFiltering","operatorPlugins","searchPlugins","createFieldPath","createFieldPathFactory","plugins","params","key","value","initialValue","query","operator","field","plugin","WebinyError","transformValueForSearch","keyword","hasKeyword","basePath","path","apply","name","fieldId"],"sources":["applyFiltering.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { transformValueForSearch } from \"~/operations/entry/elasticsearch/transformValueForSearch\";\nimport { hasKeyword } from \"~/operations/entry/elasticsearch/keyword\";\nimport {\n ElasticsearchQueryBuilderOperatorPlugins,\n ElasticsearchQuerySearchValuePlugins\n} from \"~/operations/entry/elasticsearch/types\";\nimport { createFieldPathFactory } from \"~/operations/entry/elasticsearch/filtering/path\";\nimport { ApplyFilteringCb } from \"~/plugins/CmsEntryFilterPlugin\";\n\ninterface CreateParams {\n operatorPlugins: ElasticsearchQueryBuilderOperatorPlugins;\n searchPlugins: ElasticsearchQuerySearchValuePlugins;\n}\n\nexport const createApplyFiltering = ({\n operatorPlugins,\n searchPlugins\n}: CreateParams): ApplyFilteringCb => {\n const createFieldPath = createFieldPathFactory({\n plugins: searchPlugins\n });\n\n return params => {\n const { key, value: initialValue, query, operator, field } = params;\n\n const plugin = operatorPlugins[operator];\n if (!plugin) {\n throw new WebinyError(\"Operator plugin missing.\", \"PLUGIN_MISSING\", {\n operator\n });\n }\n\n const value = transformValueForSearch({\n plugins: searchPlugins,\n field: field.field,\n value: initialValue\n });\n\n const keyword = hasKeyword(field);\n\n const { basePath, path } = createFieldPath({\n field,\n value,\n key,\n keyword\n });\n\n plugin.apply(query, {\n name: field.field.fieldId,\n basePath,\n path,\n value,\n keyword\n });\n };\n};\n"],"mappings":";;;;;;;AAAA;AACA;AACA;AAKA;AAQO,MAAMA,oBAAoB,GAAG,CAAC;EACjCC,eAAe;EACfC;AACU,CAAC,KAAuB;EAClC,MAAMC,eAAe,GAAG,IAAAC,4BAAsB,EAAC;IAC3CC,OAAO,EAAEH;EACb,CAAC,CAAC;EAEF,OAAOI,MAAM,IAAI;IACb,MAAM;MAAEC,GAAG;MAAEC,KAAK,EAAEC,YAAY;MAAEC,KAAK;MAAEC,QAAQ;MAAEC;IAAM,CAAC,GAAGN,MAAM;IAEnE,MAAMO,MAAM,GAAGZ,eAAe,CAACU,QAAQ,CAAC;IACxC,IAAI,CAACE,MAAM,EAAE;MACT,MAAM,IAAIC,cAAW,CAAC,0BAA0B,EAAE,gBAAgB,EAAE;QAChEH;MACJ,CAAC,CAAC;IACN;IAEA,MAAMH,KAAK,GAAG,IAAAO,gDAAuB,EAAC;MAClCV,OAAO,EAAEH,aAAa;MACtBU,KAAK,EAAEA,KAAK,CAACA,KAAK;MAClBJ,KAAK,EAAEC;IACX,CAAC,CAAC;IAEF,MAAMO,OAAO,GAAG,IAAAC,mBAAU,EAACL,KAAK,CAAC;IAEjC,MAAM;MAAEM,QAAQ;MAAEC;IAAK,CAAC,GAAGhB,eAAe,CAAC;MACvCS,KAAK;MACLJ,KAAK;MACLD,GAAG;MACHS;IACJ,CAAC,CAAC;IAEFH,MAAM,CAACO,KAAK,CAACV,KAAK,EAAE;MAChBW,IAAI,EAAET,KAAK,CAACA,KAAK,CAACU,OAAO;MACzBJ,QAAQ;MACRC,IAAI;MACJX,KAAK;MACLQ;IACJ,CAAC,CAAC;EACN,CAAC;AACL,CAAC;AAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { CmsEntryListWhere, CmsModel } from "@webiny/api-headless-cms/types";
|
|
2
|
+
import { ModelFields } from "../types";
|
|
3
|
+
import { PluginsContainer } from "@webiny/plugins";
|
|
4
|
+
import { ElasticsearchBoolQueryConfig } from "@webiny/api-elasticsearch/types";
|
|
5
|
+
export interface CreateExecParams {
|
|
6
|
+
model: CmsModel;
|
|
7
|
+
fields: ModelFields;
|
|
8
|
+
plugins: PluginsContainer;
|
|
9
|
+
}
|
|
10
|
+
export interface ExecParams {
|
|
11
|
+
where: CmsEntryListWhere;
|
|
12
|
+
query: ElasticsearchBoolQueryConfig;
|
|
13
|
+
}
|
|
14
|
+
export interface CreateExecFilteringResponse {
|
|
15
|
+
(params: ExecParams): void;
|
|
16
|
+
}
|
|
17
|
+
export declare const createExecFiltering: (params: CreateExecParams) => CreateExecFilteringResponse;
|