@webiny/api-headless-cms-ddb-es 6.0.0-beta.0 → 6.0.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -30
- package/configurations.d.ts +4 -5
- package/configurations.js +12 -24
- package/configurations.js.map +1 -1
- package/definitions/entry.d.ts +4 -5
- package/definitions/entry.js +5 -174
- package/definitions/entry.js.map +1 -1
- package/definitions/group.d.ts +6 -6
- package/definitions/group.js +5 -58
- package/definitions/group.js.map +1 -1
- package/definitions/model.d.ts +6 -6
- package/definitions/model.js +5 -102
- package/definitions/model.js.map +1 -1
- package/definitions/types.d.ts +59 -0
- package/definitions/types.js +3 -0
- package/definitions/types.js.map +1 -0
- package/dynamoDb/index.d.ts +2 -2
- package/dynamoDb/index.js +5 -14
- package/dynamoDb/index.js.map +1 -1
- package/dynamoDb/storage/longText.js +11 -18
- package/dynamoDb/storage/longText.js.map +1 -1
- package/dynamoDb/storage/richText.d.ts +0 -5
- package/dynamoDb/storage/richText.js +25 -80
- package/dynamoDb/storage/richText.js.map +1 -1
- package/elasticsearch/createElasticsearchIndex.d.ts +3 -3
- package/elasticsearch/createElasticsearchIndex.js +7 -15
- package/elasticsearch/createElasticsearchIndex.js.map +1 -1
- package/elasticsearch/deleteElasticsearchIndex.d.ts +2 -2
- package/elasticsearch/deleteElasticsearchIndex.js +3 -10
- package/elasticsearch/deleteElasticsearchIndex.js.map +1 -1
- package/elasticsearch/index.d.ts +1 -1
- package/elasticsearch/index.js +3 -11
- package/elasticsearch/index.js.map +1 -1
- package/elasticsearch/indexing/dateTimeIndexing.d.ts +1 -1
- package/elasticsearch/indexing/dateTimeIndexing.js +1 -8
- package/elasticsearch/indexing/dateTimeIndexing.js.map +1 -1
- package/elasticsearch/indexing/defaultFieldIndexing.d.ts +1 -1
- package/elasticsearch/indexing/defaultFieldIndexing.js +1 -8
- package/elasticsearch/indexing/defaultFieldIndexing.js.map +1 -1
- package/elasticsearch/indexing/index.d.ts +1 -1
- package/elasticsearch/indexing/index.js +8 -16
- package/elasticsearch/indexing/index.js.map +1 -1
- package/elasticsearch/indexing/jsonIndexing.d.ts +1 -1
- package/elasticsearch/indexing/jsonIndexing.js +1 -8
- package/elasticsearch/indexing/jsonIndexing.js.map +1 -1
- package/elasticsearch/indexing/longTextIndexing.d.ts +1 -1
- package/elasticsearch/indexing/longTextIndexing.js +1 -8
- package/elasticsearch/indexing/longTextIndexing.js.map +1 -1
- package/elasticsearch/indexing/numberIndexing.d.ts +1 -1
- package/elasticsearch/indexing/numberIndexing.js +1 -8
- package/elasticsearch/indexing/numberIndexing.js.map +1 -1
- package/elasticsearch/indexing/objectIndexing.d.ts +1 -1
- package/elasticsearch/indexing/objectIndexing.js +6 -13
- package/elasticsearch/indexing/objectIndexing.js.map +1 -1
- package/elasticsearch/indexing/richTextIndexing.d.ts +1 -1
- package/elasticsearch/indexing/richTextIndexing.js +1 -8
- package/elasticsearch/indexing/richTextIndexing.js.map +1 -1
- package/elasticsearch/indices/base.d.ts +1 -1
- package/elasticsearch/indices/base.js +4 -10
- package/elasticsearch/indices/base.js.map +1 -1
- package/elasticsearch/indices/index.d.ts +1 -1
- package/elasticsearch/indices/index.js +3 -11
- package/elasticsearch/indices/index.js.map +1 -1
- package/elasticsearch/search/index.d.ts +1 -1
- package/elasticsearch/search/index.js +4 -10
- package/elasticsearch/search/index.js.map +1 -1
- package/elasticsearch/search/refSearch.d.ts +1 -1
- package/elasticsearch/search/refSearch.js +3 -10
- package/elasticsearch/search/refSearch.js.map +1 -1
- package/elasticsearch/search/searchableJson.d.ts +2 -0
- package/elasticsearch/search/searchableJson.js +53 -0
- package/elasticsearch/search/searchableJson.js.map +1 -0
- package/elasticsearch/search/timeSearch.d.ts +1 -1
- package/elasticsearch/search/timeSearch.js +3 -10
- package/elasticsearch/search/timeSearch.js.map +1 -1
- package/helpers/entryIndexHelpers.d.ts +10 -10
- package/helpers/entryIndexHelpers.js +32 -26
- package/helpers/entryIndexHelpers.js.map +1 -1
- package/helpers/fieldIdentifier.d.ts +1 -1
- package/helpers/fieldIdentifier.js +2 -10
- package/helpers/fieldIdentifier.js.map +1 -1
- package/helpers/index.d.ts +2 -2
- package/helpers/index.js +2 -27
- package/helpers/index.js.map +1 -1
- package/index.d.ts +2 -2
- package/index.js +108 -134
- package/index.js.map +1 -1
- package/operations/entry/dataLoader/DataLoaderCache.d.ts +1 -3
- package/operations/entry/dataLoader/DataLoaderCache.js +2 -9
- package/operations/entry/dataLoader/DataLoaderCache.js.map +1 -1
- package/operations/entry/dataLoader/constants.js +1 -7
- package/operations/entry/dataLoader/constants.js.map +1 -1
- package/operations/entry/dataLoader/createBatchScheduleFn.js +4 -10
- package/operations/entry/dataLoader/createBatchScheduleFn.js.map +1 -1
- package/operations/entry/dataLoader/getAllEntryRevisions.d.ts +3 -3
- package/operations/entry/dataLoader/getAllEntryRevisions.js +11 -24
- package/operations/entry/dataLoader/getAllEntryRevisions.js.map +1 -1
- package/operations/entry/dataLoader/getLatestRevisionByEntryId.d.ts +3 -3
- package/operations/entry/dataLoader/getLatestRevisionByEntryId.js +18 -30
- package/operations/entry/dataLoader/getLatestRevisionByEntryId.js.map +1 -1
- package/operations/entry/dataLoader/getPublishedRevisionByEntryId.d.ts +3 -3
- package/operations/entry/dataLoader/getPublishedRevisionByEntryId.js +18 -30
- package/operations/entry/dataLoader/getPublishedRevisionByEntryId.js.map +1 -1
- package/operations/entry/dataLoader/getRevisionById.d.ts +3 -3
- package/operations/entry/dataLoader/getRevisionById.js +23 -35
- package/operations/entry/dataLoader/getRevisionById.js.map +1 -1
- package/operations/entry/dataLoader/index.d.ts +5 -5
- package/operations/entry/dataLoader/index.js +10 -31
- package/operations/entry/dataLoader/index.js.map +1 -1
- package/operations/entry/dataLoader/types.d.ts +3 -4
- package/operations/entry/dataLoader/types.js +1 -5
- package/operations/entry/dataLoader/types.js.map +1 -1
- package/operations/entry/dataLoaders.d.ts +13 -13
- package/operations/entry/dataLoaders.js +15 -25
- package/operations/entry/dataLoaders.js.map +1 -1
- package/operations/entry/elasticsearch/assignMinimumShouldMatchToQuery.d.ts +1 -1
- package/operations/entry/elasticsearch/assignMinimumShouldMatchToQuery.js +1 -8
- package/operations/entry/elasticsearch/assignMinimumShouldMatchToQuery.js.map +1 -1
- package/operations/entry/elasticsearch/body.d.ts +3 -3
- package/operations/entry/elasticsearch/body.js +21 -28
- package/operations/entry/elasticsearch/body.js.map +1 -1
- package/operations/entry/elasticsearch/fields.d.ts +3 -3
- package/operations/entry/elasticsearch/fields.js +110 -24
- package/operations/entry/elasticsearch/fields.js.map +1 -1
- package/operations/entry/elasticsearch/filtering/applyFiltering.d.ts +2 -2
- package/operations/entry/elasticsearch/filtering/applyFiltering.js +10 -17
- package/operations/entry/elasticsearch/filtering/applyFiltering.js.map +1 -1
- package/operations/entry/elasticsearch/filtering/exec.d.ts +7 -6
- package/operations/entry/elasticsearch/filtering/exec.js +48 -45
- package/operations/entry/elasticsearch/filtering/exec.js.map +1 -1
- package/operations/entry/elasticsearch/filtering/index.d.ts +1 -1
- package/operations/entry/elasticsearch/filtering/index.js +1 -16
- package/operations/entry/elasticsearch/filtering/index.js.map +1 -1
- package/operations/entry/elasticsearch/filtering/path.d.ts +2 -1
- package/operations/entry/elasticsearch/filtering/path.js +9 -17
- package/operations/entry/elasticsearch/filtering/path.js.map +1 -1
- package/operations/entry/elasticsearch/filtering/plugins/defaultFilterPlugin.d.ts +1 -1
- package/operations/entry/elasticsearch/filtering/plugins/defaultFilterPlugin.js +6 -14
- package/operations/entry/elasticsearch/filtering/plugins/defaultFilterPlugin.js.map +1 -1
- package/operations/entry/elasticsearch/filtering/plugins/index.d.ts +1 -1
- package/operations/entry/elasticsearch/filtering/plugins/index.js +5 -12
- package/operations/entry/elasticsearch/filtering/plugins/index.js.map +1 -1
- package/operations/entry/elasticsearch/filtering/plugins/objectFilterPlugin.d.ts +1 -1
- package/operations/entry/elasticsearch/filtering/plugins/objectFilterPlugin.js +7 -15
- package/operations/entry/elasticsearch/filtering/plugins/objectFilterPlugin.js.map +1 -1
- package/operations/entry/elasticsearch/filtering/plugins/refFilterPlugin.d.ts +1 -1
- package/operations/entry/elasticsearch/filtering/plugins/refFilterPlugin.js +15 -16
- package/operations/entry/elasticsearch/filtering/plugins/refFilterPlugin.js.map +1 -1
- package/operations/entry/elasticsearch/filtering/populated.d.ts +1 -1
- package/operations/entry/elasticsearch/filtering/populated.js +1 -8
- package/operations/entry/elasticsearch/filtering/populated.js.map +1 -1
- package/operations/entry/elasticsearch/filtering/values.d.ts +1 -1
- package/operations/entry/elasticsearch/filtering/values.js +4 -12
- package/operations/entry/elasticsearch/filtering/values.js.map +1 -1
- package/operations/entry/elasticsearch/fullTextSearch.d.ts +3 -3
- package/operations/entry/elasticsearch/fullTextSearch.js +6 -12
- package/operations/entry/elasticsearch/fullTextSearch.js.map +1 -1
- package/operations/entry/elasticsearch/fullTextSearchFields.d.ts +1 -1
- package/operations/entry/elasticsearch/fullTextSearchFields.js +1 -8
- package/operations/entry/elasticsearch/fullTextSearchFields.js.map +1 -1
- package/operations/entry/elasticsearch/initialQuery.d.ts +2 -2
- package/operations/entry/elasticsearch/initialQuery.js +9 -26
- package/operations/entry/elasticsearch/initialQuery.js.map +1 -1
- package/operations/entry/elasticsearch/keyword.d.ts +1 -1
- package/operations/entry/elasticsearch/keyword.js +4 -9
- package/operations/entry/elasticsearch/keyword.js.map +1 -1
- package/operations/entry/elasticsearch/plugins/bodyModifier.d.ts +4 -4
- package/operations/entry/elasticsearch/plugins/bodyModifier.js +3 -10
- package/operations/entry/elasticsearch/plugins/bodyModifier.js.map +1 -1
- package/operations/entry/elasticsearch/plugins/operator.d.ts +2 -3
- package/operations/entry/elasticsearch/plugins/operator.js +4 -19
- package/operations/entry/elasticsearch/plugins/operator.js.map +1 -1
- package/operations/entry/elasticsearch/plugins/queryModifier.d.ts +4 -4
- package/operations/entry/elasticsearch/plugins/queryModifier.js +3 -10
- package/operations/entry/elasticsearch/plugins/queryModifier.js.map +1 -1
- package/operations/entry/elasticsearch/plugins/search.d.ts +2 -2
- package/operations/entry/elasticsearch/plugins/search.js +5 -13
- package/operations/entry/elasticsearch/plugins/search.js.map +1 -1
- package/operations/entry/elasticsearch/plugins/sortModifier.d.ts +4 -4
- package/operations/entry/elasticsearch/plugins/sortModifier.js +3 -10
- package/operations/entry/elasticsearch/plugins/sortModifier.js.map +1 -1
- package/operations/entry/elasticsearch/shouldIgnoreEsResponseError.d.ts +2 -0
- package/operations/entry/elasticsearch/shouldIgnoreEsResponseError.js +6 -0
- package/operations/entry/elasticsearch/shouldIgnoreEsResponseError.js.map +1 -0
- package/operations/entry/elasticsearch/sort.d.ts +4 -4
- package/operations/entry/elasticsearch/sort.js +57 -33
- package/operations/entry/elasticsearch/sort.js.map +1 -1
- package/operations/entry/elasticsearch/transformValueForSearch.d.ts +2 -2
- package/operations/entry/elasticsearch/transformValueForSearch.js +4 -9
- package/operations/entry/elasticsearch/transformValueForSearch.js.map +1 -1
- package/operations/entry/elasticsearch/types.d.ts +5 -5
- package/operations/entry/elasticsearch/types.js +1 -5
- package/operations/entry/elasticsearch/types.js.map +1 -1
- package/operations/entry/index.d.ts +7 -6
- package/operations/entry/index.js +634 -735
- package/operations/entry/index.js.map +1 -1
- package/operations/entry/keys.d.ts +31 -1
- package/operations/entry/keys.js +56 -19
- package/operations/entry/keys.js.map +1 -1
- package/operations/entry/recordType.js +3 -12
- package/operations/entry/recordType.js.map +1 -1
- package/operations/entry/transformations/convertEntryKeys.d.ts +6 -6
- package/operations/entry/transformations/convertEntryKeys.js +2 -10
- package/operations/entry/transformations/convertEntryKeys.js.map +1 -1
- package/operations/entry/transformations/index.d.ts +17 -17
- package/operations/entry/transformations/index.js +22 -30
- package/operations/entry/transformations/index.js.map +1 -1
- package/operations/entry/transformations/modifyEntryValues.d.ts +27 -34
- package/operations/entry/transformations/modifyEntryValues.js +1 -8
- package/operations/entry/transformations/modifyEntryValues.js.map +1 -1
- package/operations/entry/transformations/transformEntryKeys.d.ts +8 -8
- package/operations/entry/transformations/transformEntryKeys.js +4 -11
- package/operations/entry/transformations/transformEntryKeys.js.map +1 -1
- package/operations/entry/transformations/transformEntryToIndex.d.ts +7 -7
- package/operations/entry/transformations/transformEntryToIndex.js +3 -10
- package/operations/entry/transformations/transformEntryToIndex.js.map +1 -1
- package/operations/group/index.d.ts +6 -5
- package/operations/group/index.js +39 -73
- package/operations/group/index.js.map +1 -1
- package/operations/model/index.d.ts +4 -4
- package/operations/model/index.js +38 -57
- package/operations/model/index.js.map +1 -1
- package/package.json +29 -41
- package/plugins/CmsElasticsearchModelFieldPlugin.d.ts +1 -1
- package/plugins/CmsElasticsearchModelFieldPlugin.js +2 -8
- package/plugins/CmsElasticsearchModelFieldPlugin.js.map +1 -1
- package/plugins/CmsEntryElasticsearchBodyModifierPlugin.d.ts +3 -2
- package/plugins/CmsEntryElasticsearchBodyModifierPlugin.js +3 -11
- package/plugins/CmsEntryElasticsearchBodyModifierPlugin.js.map +1 -1
- package/plugins/CmsEntryElasticsearchFullTextSearchPlugin.d.ts +2 -2
- package/plugins/CmsEntryElasticsearchFullTextSearchPlugin.js +3 -11
- package/plugins/CmsEntryElasticsearchFullTextSearchPlugin.js.map +1 -1
- package/plugins/CmsEntryElasticsearchIndexPlugin.js +2 -9
- package/plugins/CmsEntryElasticsearchIndexPlugin.js.map +1 -1
- package/plugins/CmsEntryElasticsearchQueryBuilderValueSearchPlugin.d.ts +3 -2
- package/plugins/CmsEntryElasticsearchQueryBuilderValueSearchPlugin.js +3 -11
- package/plugins/CmsEntryElasticsearchQueryBuilderValueSearchPlugin.js.map +1 -1
- package/plugins/CmsEntryElasticsearchQueryModifierPlugin.d.ts +3 -2
- package/plugins/CmsEntryElasticsearchQueryModifierPlugin.js +3 -11
- package/plugins/CmsEntryElasticsearchQueryModifierPlugin.js.map +1 -1
- package/plugins/CmsEntryElasticsearchSortModifierPlugin.d.ts +3 -2
- package/plugins/CmsEntryElasticsearchSortModifierPlugin.js +3 -11
- package/plugins/CmsEntryElasticsearchSortModifierPlugin.js.map +1 -1
- package/plugins/CmsEntryElasticsearchValuesModifier.d.ts +12 -12
- package/plugins/CmsEntryElasticsearchValuesModifier.js +4 -12
- package/plugins/CmsEntryElasticsearchValuesModifier.js.map +1 -1
- package/plugins/CmsEntryFilterPlugin.d.ts +3 -3
- package/plugins/CmsEntryFilterPlugin.js +2 -9
- package/plugins/CmsEntryFilterPlugin.js.map +1 -1
- package/plugins/index.d.ts +8 -8
- package/plugins/index.js +8 -93
- package/plugins/index.js.map +1 -1
- package/tasks/createIndexTaskPlugin.d.ts +2 -2
- package/tasks/createIndexTaskPlugin.js +36 -62
- package/tasks/createIndexTaskPlugin.js.map +1 -1
- package/types.d.ts +28 -33
- package/types.js +5 -8
- package/types.js.map +1 -1
- package/values/NoValueContainer.d.ts +5 -0
- package/values/NoValueContainer.js +13 -0
- package/values/NoValueContainer.js.map +1 -0
- package/definitions/entryElasticsearch.d.ts +0 -8
- package/definitions/entryElasticsearch.js +0 -38
- package/definitions/entryElasticsearch.js.map +0 -1
- package/definitions/system.d.ts +0 -8
- package/definitions/system.js +0 -42
- package/definitions/system.js.map +0 -1
- package/definitions/table.d.ts +0 -8
- package/definitions/table.js +0 -25
- package/definitions/table.js.map +0 -1
- package/definitions/tableElasticsearch.d.ts +0 -8
- package/definitions/tableElasticsearch.js +0 -25
- package/definitions/tableElasticsearch.js.map +0 -1
- package/dynamoDb/storage/date.d.ts +0 -3
- package/dynamoDb/storage/date.js +0 -84
- package/dynamoDb/storage/date.js.map +0 -1
- package/elasticsearch/indices/japanese.d.ts +0 -2
- package/elasticsearch/indices/japanese.js +0 -14
- package/elasticsearch/indices/japanese.js.map +0 -1
- package/operations/system/index.d.ts +0 -6
- package/operations/system/index.js +0 -94
- package/operations/system/index.js.map +0 -1
- package/operations/system/indexes.d.ts +0 -10
- package/operations/system/indexes.js +0 -41
- package/operations/system/indexes.js.map +0 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { CmsEntryElasticsearchQueryModifierPlugin } from "../../../../plugins";
|
|
2
|
-
import { PluginsContainer } from "@webiny/plugins";
|
|
3
|
-
import { CmsModel } from "@webiny/api-headless-cms/types";
|
|
1
|
+
import { CmsEntryElasticsearchQueryModifierPlugin } from "../../../../plugins/index.js";
|
|
2
|
+
import type { PluginsContainer } from "@webiny/plugins";
|
|
3
|
+
import type { CmsModel } from "@webiny/api-headless-cms/types/index.js";
|
|
4
4
|
interface Params {
|
|
5
5
|
plugins: PluginsContainer;
|
|
6
6
|
model: CmsModel;
|
|
7
7
|
}
|
|
8
|
-
export declare const createQueryModifierPluginList: ({ plugins, model }: Params) => CmsEntryElasticsearchQueryModifierPlugin[];
|
|
8
|
+
export declare const createQueryModifierPluginList: ({ plugins, model }: Params) => import("@webiny/plugins/PluginsContainer").WithName<CmsEntryElasticsearchQueryModifierPlugin>[];
|
|
9
9
|
export {};
|
|
@@ -1,18 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.createQueryModifierPluginList = void 0;
|
|
7
|
-
var _plugins = require("../../../../plugins");
|
|
8
|
-
const createQueryModifierPluginList = ({
|
|
1
|
+
import { CmsEntryElasticsearchQueryModifierPlugin } from "../../../../plugins/index.js";
|
|
2
|
+
export const createQueryModifierPluginList = ({
|
|
9
3
|
plugins,
|
|
10
4
|
model
|
|
11
5
|
}) => {
|
|
12
|
-
return plugins.byType(
|
|
6
|
+
return plugins.byType(CmsEntryElasticsearchQueryModifierPlugin.type).filter(pl => {
|
|
13
7
|
return !pl.modelId || pl.modelId === model.modelId;
|
|
14
8
|
});
|
|
15
9
|
};
|
|
16
|
-
exports.createQueryModifierPluginList = createQueryModifierPluginList;
|
|
17
10
|
|
|
18
11
|
//# sourceMappingURL=queryModifier.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["CmsEntryElasticsearchQueryModifierPlugin","createQueryModifierPluginList","plugins","model","byType","type","filter","pl","modelId"],"sources":["queryModifier.ts"],"sourcesContent":["import { CmsEntryElasticsearchQueryModifierPlugin } from \"~/plugins/index.js\";\nimport type { PluginsContainer } from \"@webiny/plugins\";\nimport type { CmsModel } from \"@webiny/api-headless-cms/types/index.js\";\n\ninterface Params {\n plugins: PluginsContainer;\n model: CmsModel;\n}\nexport const createQueryModifierPluginList = ({ plugins, model }: Params) => {\n return plugins\n .byType<CmsEntryElasticsearchQueryModifierPlugin>(\n CmsEntryElasticsearchQueryModifierPlugin.type\n )\n .filter(pl => {\n return !pl.modelId || pl.modelId === model.modelId;\n });\n};\n"],"mappings":"AAAA,SAASA,wCAAwC;AAQjD,OAAO,MAAMC,6BAA6B,GAAGA,CAAC;EAAEC,OAAO;EAAEC;AAAc,CAAC,KAAK;EACzE,OAAOD,OAAO,CACTE,MAAM,CACHJ,wCAAwC,CAACK,IAC7C,CAAC,CACAC,MAAM,CAACC,EAAE,IAAI;IACV,OAAO,CAACA,EAAE,CAACC,OAAO,IAAID,EAAE,CAACC,OAAO,KAAKL,KAAK,CAACK,OAAO;EACtD,CAAC,CAAC;AACV,CAAC","ignoreList":[]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { PluginsContainer } from "@webiny/plugins";
|
|
2
|
-
import { ElasticsearchQuerySearchValuePlugins } from "../types";
|
|
1
|
+
import type { PluginsContainer } from "@webiny/plugins";
|
|
2
|
+
import type { ElasticsearchQuerySearchValuePlugins } from "../types.js";
|
|
3
3
|
interface Params {
|
|
4
4
|
plugins: PluginsContainer;
|
|
5
5
|
}
|
|
@@ -1,18 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.createSearchPluginList = void 0;
|
|
8
|
-
var _error = _interopRequireDefault(require("@webiny/error"));
|
|
9
|
-
var _plugins = require("../../../../plugins");
|
|
10
|
-
const createSearchPluginList = ({
|
|
1
|
+
import WebinyError from "@webiny/error";
|
|
2
|
+
import { CmsEntryElasticsearchQueryBuilderValueSearchPlugin } from "../../../../plugins/index.js";
|
|
3
|
+
export const createSearchPluginList = ({
|
|
11
4
|
plugins
|
|
12
5
|
}) => {
|
|
13
|
-
return plugins.byType(
|
|
6
|
+
return plugins.byType(CmsEntryElasticsearchQueryBuilderValueSearchPlugin.type).reduce((plugins, plugin) => {
|
|
14
7
|
if (plugins[plugin.fieldType]) {
|
|
15
|
-
throw new
|
|
8
|
+
throw new WebinyError("There is a ElasticsearchQueryBuilderValueSearchPlugin defined for the field type.", "PLUGIN_ALREADY_EXISTS", {
|
|
16
9
|
fieldType: plugin.fieldType,
|
|
17
10
|
name: plugin.name || "unknown"
|
|
18
11
|
});
|
|
@@ -21,6 +14,5 @@ const createSearchPluginList = ({
|
|
|
21
14
|
return plugins;
|
|
22
15
|
}, {});
|
|
23
16
|
};
|
|
24
|
-
exports.createSearchPluginList = createSearchPluginList;
|
|
25
17
|
|
|
26
18
|
//# sourceMappingURL=search.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["WebinyError","CmsEntryElasticsearchQueryBuilderValueSearchPlugin","createSearchPluginList","plugins","byType","type","reduce","plugin","fieldType","name"],"sources":["search.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { CmsEntryElasticsearchQueryBuilderValueSearchPlugin } from \"~/plugins/index.js\";\nimport type { PluginsContainer } from \"@webiny/plugins\";\nimport type { ElasticsearchQuerySearchValuePlugins } from \"../types.js\";\n\ninterface Params {\n plugins: PluginsContainer;\n}\nexport const createSearchPluginList = ({\n plugins\n}: Params): ElasticsearchQuerySearchValuePlugins => {\n return plugins\n .byType<CmsEntryElasticsearchQueryBuilderValueSearchPlugin>(\n CmsEntryElasticsearchQueryBuilderValueSearchPlugin.type\n )\n .reduce<ElasticsearchQuerySearchValuePlugins>((plugins, plugin) => {\n if (plugins[plugin.fieldType]) {\n throw new WebinyError(\n \"There is a ElasticsearchQueryBuilderValueSearchPlugin defined for the field type.\",\n \"PLUGIN_ALREADY_EXISTS\",\n {\n fieldType: plugin.fieldType,\n name: plugin.name || \"unknown\"\n }\n );\n }\n plugins[plugin.fieldType] = plugin;\n\n return plugins;\n }, {});\n};\n"],"mappings":"AAAA,OAAOA,WAAW,MAAM,eAAe;AACvC,SAASC,kDAAkD;AAO3D,OAAO,MAAMC,sBAAsB,GAAGA,CAAC;EACnCC;AACI,CAAC,KAA2C;EAChD,OAAOA,OAAO,CACTC,MAAM,CACHH,kDAAkD,CAACI,IACvD,CAAC,CACAC,MAAM,CAAuC,CAACH,OAAO,EAAEI,MAAM,KAAK;IAC/D,IAAIJ,OAAO,CAACI,MAAM,CAACC,SAAS,CAAC,EAAE;MAC3B,MAAM,IAAIR,WAAW,CACjB,mFAAmF,EACnF,uBAAuB,EACvB;QACIQ,SAAS,EAAED,MAAM,CAACC,SAAS;QAC3BC,IAAI,EAAEF,MAAM,CAACE,IAAI,IAAI;MACzB,CACJ,CAAC;IACL;IACAN,OAAO,CAACI,MAAM,CAACC,SAAS,CAAC,GAAGD,MAAM;IAElC,OAAOJ,OAAO;EAClB,CAAC,EAAE,CAAC,CAAC,CAAC;AACd,CAAC","ignoreList":[]}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { CmsEntryElasticsearchSortModifierPlugin } from "../../../../plugins";
|
|
2
|
-
import { PluginsContainer } from "@webiny/plugins";
|
|
3
|
-
import { CmsModel } from "@webiny/api-headless-cms/types";
|
|
1
|
+
import { CmsEntryElasticsearchSortModifierPlugin } from "../../../../plugins/index.js";
|
|
2
|
+
import type { PluginsContainer } from "@webiny/plugins";
|
|
3
|
+
import type { CmsModel } from "@webiny/api-headless-cms/types/index.js";
|
|
4
4
|
interface Params {
|
|
5
5
|
plugins: PluginsContainer;
|
|
6
6
|
model: CmsModel;
|
|
7
7
|
}
|
|
8
|
-
export declare const createSortModifierPluginList: ({ plugins, model }: Params) => CmsEntryElasticsearchSortModifierPlugin[];
|
|
8
|
+
export declare const createSortModifierPluginList: ({ plugins, model }: Params) => import("@webiny/plugins/PluginsContainer").WithName<CmsEntryElasticsearchSortModifierPlugin>[];
|
|
9
9
|
export {};
|
|
@@ -1,18 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.createSortModifierPluginList = void 0;
|
|
7
|
-
var _plugins = require("../../../../plugins");
|
|
8
|
-
const createSortModifierPluginList = ({
|
|
1
|
+
import { CmsEntryElasticsearchSortModifierPlugin } from "../../../../plugins/index.js";
|
|
2
|
+
export const createSortModifierPluginList = ({
|
|
9
3
|
plugins,
|
|
10
4
|
model
|
|
11
5
|
}) => {
|
|
12
|
-
return plugins.byType(
|
|
6
|
+
return plugins.byType(CmsEntryElasticsearchSortModifierPlugin.type).filter(pl => {
|
|
13
7
|
return !pl.modelId || pl.modelId === model.modelId;
|
|
14
8
|
});
|
|
15
9
|
};
|
|
16
|
-
exports.createSortModifierPluginList = createSortModifierPluginList;
|
|
17
10
|
|
|
18
11
|
//# sourceMappingURL=sortModifier.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["CmsEntryElasticsearchSortModifierPlugin","createSortModifierPluginList","plugins","model","byType","type","filter","pl","modelId"],"sources":["sortModifier.ts"],"sourcesContent":["import { CmsEntryElasticsearchSortModifierPlugin } from \"~/plugins/index.js\";\nimport type { PluginsContainer } from \"@webiny/plugins\";\nimport type { CmsModel } from \"@webiny/api-headless-cms/types/index.js\";\n\ninterface Params {\n plugins: PluginsContainer;\n model: CmsModel;\n}\nexport const createSortModifierPluginList = ({ plugins, model }: Params) => {\n return plugins\n .byType<CmsEntryElasticsearchSortModifierPlugin>(\n CmsEntryElasticsearchSortModifierPlugin.type\n )\n .filter(pl => {\n return !pl.modelId || pl.modelId === model.modelId;\n });\n};\n"],"mappings":"AAAA,SAASA,uCAAuC;AAQhD,OAAO,MAAMC,4BAA4B,GAAGA,CAAC;EAAEC,OAAO;EAAEC;AAAc,CAAC,KAAK;EACxE,OAAOD,OAAO,CACTE,MAAM,CACHJ,uCAAuC,CAACK,IAC5C,CAAC,CACAC,MAAM,CAACC,EAAE,IAAI;IACV,OAAO,CAACA,EAAE,CAACC,OAAO,IAAID,EAAE,CAACC,OAAO,KAAKL,KAAK,CAACK,OAAO;EACtD,CAAC,CAAC;AACV,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
const IGNORED_ES_SEARCH_EXCEPTIONS = ["index_not_found_exception", "search_phase_execution_exception"];
|
|
2
|
+
export const shouldIgnoreEsResponseError = error => {
|
|
3
|
+
return IGNORED_ES_SEARCH_EXCEPTIONS.includes(error.message);
|
|
4
|
+
};
|
|
5
|
+
|
|
6
|
+
//# sourceMappingURL=shouldIgnoreEsResponseError.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["IGNORED_ES_SEARCH_EXCEPTIONS","shouldIgnoreEsResponseError","error","includes","message"],"sources":["shouldIgnoreEsResponseError.ts"],"sourcesContent":["import type WebinyError from \"@webiny/error\";\n\nconst IGNORED_ES_SEARCH_EXCEPTIONS = [\n \"index_not_found_exception\",\n \"search_phase_execution_exception\"\n];\n\nexport const shouldIgnoreEsResponseError = (error: WebinyError) => {\n return IGNORED_ES_SEARCH_EXCEPTIONS.includes(error.message);\n};\n"],"mappings":"AAEA,MAAMA,4BAA4B,GAAG,CACjC,2BAA2B,EAC3B,kCAAkC,CACrC;AAED,OAAO,MAAMC,2BAA2B,GAAIC,KAAkB,IAAK;EAC/D,OAAOF,4BAA4B,CAACG,QAAQ,CAACD,KAAK,CAACE,OAAO,CAAC;AAC/D,CAAC","ignoreList":[]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Sort as esSort } from "@webiny/api-elasticsearch/types";
|
|
2
|
-
import { PluginsContainer } from "@webiny/plugins";
|
|
3
|
-
import { CmsEntryListSort, CmsModel } from "@webiny/api-headless-cms/types";
|
|
4
|
-
import { ModelFields } from "./types";
|
|
1
|
+
import type { Sort as esSort } from "@webiny/api-elasticsearch/types.js";
|
|
2
|
+
import type { PluginsContainer } from "@webiny/plugins";
|
|
3
|
+
import type { CmsEntryListSort, CmsModel } from "@webiny/api-headless-cms/types/index.js";
|
|
4
|
+
import type { ModelFields } from "./types.js";
|
|
5
5
|
interface Params {
|
|
6
6
|
plugins: PluginsContainer;
|
|
7
7
|
sort?: CmsEntryListSort;
|
|
@@ -1,26 +1,46 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
import { createSort, ElasticsearchFieldPlugin } from "@webiny/api-elasticsearch";
|
|
2
|
+
import { hasKeyword } from "./keyword.js";
|
|
3
|
+
import { createSearchPluginList } from "./plugins/search.js";
|
|
4
|
+
import { createFieldPathFactory } from "./filtering/path.js";
|
|
5
|
+
import { NoValueContainer } from "../../../values/NoValueContainer.js";
|
|
6
|
+
const matchField = input => {
|
|
7
|
+
const valuesMatch = input.match(/^values_([a-zA-Z-0-9_]+)_(ASC|DESC)$/);
|
|
8
|
+
if (valuesMatch) {
|
|
9
|
+
const [, fieldId, order] = valuesMatch;
|
|
10
|
+
return {
|
|
11
|
+
fieldId,
|
|
12
|
+
isValues: true,
|
|
13
|
+
order: order
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
const nonValues = input.match(/^([a-zA-Z-0-9_]+)_(ASC|DESC)$/);
|
|
17
|
+
if (!nonValues) {
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
const [, fieldId, order] = nonValues;
|
|
21
|
+
return {
|
|
22
|
+
fieldId,
|
|
23
|
+
isValues: false,
|
|
24
|
+
order: order
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
export const createElasticsearchSort = params => {
|
|
12
28
|
const {
|
|
13
29
|
sort,
|
|
14
30
|
modelFields,
|
|
15
31
|
plugins
|
|
16
32
|
} = params;
|
|
17
33
|
if (!sort || sort.length === 0) {
|
|
18
|
-
return [
|
|
34
|
+
return [{
|
|
35
|
+
["id.keyword"]: {
|
|
36
|
+
order: "asc"
|
|
37
|
+
}
|
|
38
|
+
}];
|
|
19
39
|
}
|
|
20
|
-
const searchPlugins =
|
|
40
|
+
const searchPlugins = createSearchPluginList({
|
|
21
41
|
plugins
|
|
22
42
|
});
|
|
23
|
-
const createFieldPath =
|
|
43
|
+
const createFieldPath = createFieldPathFactory({
|
|
24
44
|
plugins: searchPlugins
|
|
25
45
|
});
|
|
26
46
|
const fieldIdToStorageIdIdMap = {};
|
|
@@ -28,28 +48,28 @@ const createElasticsearchSort = params => {
|
|
|
28
48
|
/**
|
|
29
49
|
* We do not support sorting by nested fields.
|
|
30
50
|
*/
|
|
31
|
-
|
|
51
|
+
const isValues = field.parents.length === 1 && field.parents[0].fieldId === "values";
|
|
52
|
+
if (field.parents.length > 0 && !isValues) {
|
|
32
53
|
return plugins;
|
|
33
54
|
}
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
} = field.field;
|
|
38
|
-
fieldIdToStorageIdIdMap[fieldId] = fieldId;
|
|
55
|
+
const fieldId = field.field.fieldId;
|
|
56
|
+
const fieldIdPath = isValues ? `values.${fieldId}` : fieldId;
|
|
57
|
+
fieldIdToStorageIdIdMap[fieldIdPath] = fieldIdPath;
|
|
39
58
|
const {
|
|
40
59
|
path
|
|
41
60
|
} = createFieldPath({
|
|
42
|
-
key: storageId,
|
|
61
|
+
key: field.field.storageId,
|
|
43
62
|
field,
|
|
44
|
-
value:
|
|
45
|
-
keyword: false
|
|
63
|
+
value: NoValueContainer.create(),
|
|
64
|
+
keyword: false,
|
|
65
|
+
originalValue: NoValueContainer.create()
|
|
46
66
|
});
|
|
47
67
|
/**
|
|
48
68
|
* Plugins must be stored with fieldId as key because it is later used to find the sorting plugin.
|
|
49
69
|
*/
|
|
50
|
-
plugins[
|
|
70
|
+
plugins[fieldIdPath] = new ElasticsearchFieldPlugin({
|
|
51
71
|
unmappedType: field.unmappedType,
|
|
52
|
-
keyword:
|
|
72
|
+
keyword: hasKeyword(field),
|
|
53
73
|
sortable: field.sortable,
|
|
54
74
|
searchable: field.searchable,
|
|
55
75
|
field: fieldId,
|
|
@@ -57,27 +77,31 @@ const createElasticsearchSort = params => {
|
|
|
57
77
|
});
|
|
58
78
|
return plugins;
|
|
59
79
|
}, {
|
|
60
|
-
["*"]: new
|
|
61
|
-
field:
|
|
80
|
+
["*"]: new ElasticsearchFieldPlugin({
|
|
81
|
+
field: ElasticsearchFieldPlugin.ALL,
|
|
62
82
|
keyword: false
|
|
63
83
|
})
|
|
64
84
|
});
|
|
65
85
|
const transformedSort = sort.map(value => {
|
|
66
|
-
const matched = value
|
|
86
|
+
const matched = matchField(value);
|
|
67
87
|
if (!matched) {
|
|
68
88
|
return null;
|
|
69
89
|
}
|
|
70
|
-
const
|
|
71
|
-
|
|
72
|
-
|
|
90
|
+
const {
|
|
91
|
+
fieldId,
|
|
92
|
+
order,
|
|
93
|
+
isValues
|
|
94
|
+
} = matched;
|
|
95
|
+
const key = isValues ? `values.${fieldId}` : fieldId;
|
|
96
|
+
if (fieldIdToStorageIdIdMap[key]) {
|
|
97
|
+
return `${fieldIdToStorageIdIdMap[key]}_${order}`;
|
|
73
98
|
}
|
|
74
99
|
return value;
|
|
75
100
|
}).filter(Boolean);
|
|
76
|
-
return
|
|
101
|
+
return createSort({
|
|
77
102
|
fieldPlugins: sortPlugins,
|
|
78
103
|
sort: transformedSort
|
|
79
104
|
});
|
|
80
105
|
};
|
|
81
|
-
exports.createElasticsearchSort = createElasticsearchSort;
|
|
82
106
|
|
|
83
107
|
//# sourceMappingURL=sort.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["createSort","ElasticsearchFieldPlugin","hasKeyword","createSearchPluginList","createFieldPathFactory","NoValueContainer","matchField","input","valuesMatch","match","fieldId","order","isValues","nonValues","createElasticsearchSort","params","sort","modelFields","plugins","length","searchPlugins","createFieldPath","fieldIdToStorageIdIdMap","sortPlugins","Object","values","reduce","field","parents","fieldIdPath","path","key","storageId","value","create","keyword","originalValue","unmappedType","sortable","searchable","ALL","transformedSort","map","matched","filter","Boolean","fieldPlugins"],"sources":["sort.ts"],"sourcesContent":["import type { Sort as esSort } from \"@webiny/api-elasticsearch/types.js\";\nimport { createSort, ElasticsearchFieldPlugin } from \"@webiny/api-elasticsearch\";\nimport type { PluginsContainer } from \"@webiny/plugins\";\nimport type { CmsEntryListSort, CmsModel } from \"@webiny/api-headless-cms/types/index.js\";\nimport type { ModelFields } from \"./types.js\";\nimport { hasKeyword } from \"~/operations/entry/elasticsearch/keyword.js\";\nimport { createSearchPluginList } from \"~/operations/entry/elasticsearch/plugins/search.js\";\nimport { createFieldPathFactory } from \"~/operations/entry/elasticsearch/filtering/path.js\";\nimport { NoValueContainer } from \"~/values/NoValueContainer.js\";\n\ninterface IMatchFieldResponse {\n fieldId: string;\n isValues: boolean;\n order: \"ASC\" | \"DESC\";\n}\n\nconst matchField = (input: string): IMatchFieldResponse | null => {\n const valuesMatch = input.match(/^values_([a-zA-Z-0-9_]+)_(ASC|DESC)$/);\n if (valuesMatch) {\n const [, fieldId, order] = valuesMatch;\n return {\n fieldId,\n isValues: true,\n order: order as \"ASC\" | \"DESC\"\n };\n }\n const nonValues = input.match(/^([a-zA-Z-0-9_]+)_(ASC|DESC)$/);\n if (!nonValues) {\n return null;\n }\n const [, fieldId, order] = nonValues;\n return {\n fieldId,\n isValues: false,\n order: order as \"ASC\" | \"DESC\"\n };\n};\n\ninterface Params {\n plugins: PluginsContainer;\n sort?: CmsEntryListSort;\n modelFields: ModelFields;\n model: CmsModel;\n}\n\nexport const createElasticsearchSort = (params: Params): esSort => {\n const { sort, modelFields, plugins } = params;\n\n if (!sort || sort.length === 0) {\n return [\n {\n [\"id.keyword\"]: {\n order: \"asc\"\n }\n }\n ];\n }\n\n const searchPlugins = createSearchPluginList({\n plugins\n });\n\n const createFieldPath = createFieldPathFactory({\n plugins: searchPlugins\n });\n\n const fieldIdToStorageIdIdMap: Record<string, string> = {};\n\n const sortPlugins = Object.values(modelFields).reduce<Record<string, ElasticsearchFieldPlugin>>(\n (plugins, field) => {\n /**\n * We do not support sorting by nested fields.\n */\n const isValues = field.parents.length === 1 && field.parents[0].fieldId === \"values\";\n if (field.parents.length > 0 && !isValues) {\n return plugins;\n }\n\n const fieldId = field.field.fieldId;\n const fieldIdPath = isValues ? `values.${fieldId}` : fieldId;\n\n fieldIdToStorageIdIdMap[fieldIdPath] = fieldIdPath;\n\n const { path } = createFieldPath({\n key: field.field.storageId,\n field,\n value: NoValueContainer.create(),\n keyword: false,\n originalValue: NoValueContainer.create()\n });\n /**\n * Plugins must be stored with fieldId as key because it is later used to find the sorting plugin.\n */\n plugins[fieldIdPath] = new ElasticsearchFieldPlugin({\n unmappedType: field.unmappedType,\n keyword: hasKeyword(field),\n sortable: field.sortable,\n searchable: field.searchable,\n field: fieldId,\n path\n });\n return plugins;\n },\n {\n [\"*\"]: new ElasticsearchFieldPlugin({\n field: ElasticsearchFieldPlugin.ALL,\n keyword: false\n })\n }\n );\n\n const transformedSort = sort\n .map(value => {\n const matched = matchField(value);\n if (!matched) {\n return null;\n }\n const { fieldId, order, isValues } = matched;\n const key = isValues ? `values.${fieldId}` : fieldId;\n if (fieldIdToStorageIdIdMap[key]) {\n return `${fieldIdToStorageIdIdMap[key]}_${order}`;\n }\n\n return value;\n })\n .filter(Boolean) as string[];\n return createSort({\n fieldPlugins: sortPlugins,\n sort: transformedSort\n });\n};\n"],"mappings":"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","ignoreList":[]}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* We use any for input and output because they really can be anything.
|
|
3
3
|
* Plugin, if exists, makes sure that response value is correct.
|
|
4
4
|
*/
|
|
5
|
-
import { CmsModelField } from "@webiny/api-headless-cms/types";
|
|
6
|
-
import { ElasticsearchQuerySearchValuePlugins } from "./types";
|
|
5
|
+
import type { CmsModelField } from "@webiny/api-headless-cms/types/index.js";
|
|
6
|
+
import type { ElasticsearchQuerySearchValuePlugins } from "./types.js";
|
|
7
7
|
interface Params {
|
|
8
8
|
plugins: ElasticsearchQuerySearchValuePlugins;
|
|
9
9
|
field: CmsModelField;
|
|
@@ -1,24 +1,20 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.transformValueForSearch = void 0;
|
|
7
1
|
/**
|
|
8
2
|
* We use any for input and output because they really can be anything.
|
|
9
3
|
* Plugin, if exists, makes sure that response value is correct.
|
|
10
4
|
*/
|
|
11
5
|
|
|
6
|
+
import { getBaseFieldType } from "@webiny/api-headless-cms/utils/getBaseFieldType.js";
|
|
12
7
|
/**
|
|
13
8
|
* Transformed value can be anything.
|
|
14
9
|
*/
|
|
15
|
-
const transformValueForSearch = params => {
|
|
10
|
+
export const transformValueForSearch = params => {
|
|
16
11
|
const {
|
|
17
12
|
field,
|
|
18
13
|
plugins,
|
|
19
14
|
value
|
|
20
15
|
} = params;
|
|
21
|
-
const
|
|
16
|
+
const fieldType = getBaseFieldType(field);
|
|
17
|
+
const plugin = plugins[fieldType];
|
|
22
18
|
if (!plugin) {
|
|
23
19
|
return value;
|
|
24
20
|
}
|
|
@@ -27,6 +23,5 @@ const transformValueForSearch = params => {
|
|
|
27
23
|
value
|
|
28
24
|
});
|
|
29
25
|
};
|
|
30
|
-
exports.transformValueForSearch = transformValueForSearch;
|
|
31
26
|
|
|
32
27
|
//# sourceMappingURL=transformValueForSearch.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["transformValueForSearch","params","field","plugins","value","
|
|
1
|
+
{"version":3,"names":["getBaseFieldType","transformValueForSearch","params","field","plugins","value","fieldType","plugin","transform"],"sources":["transformValueForSearch.ts"],"sourcesContent":["/**\n * We use any for input and output because they really can be anything.\n * Plugin, if exists, makes sure that response value is correct.\n */\nimport type { CmsModelField } from \"@webiny/api-headless-cms/types/index.js\";\nimport type { ElasticsearchQuerySearchValuePlugins } from \"./types.js\";\nimport { getBaseFieldType } from \"@webiny/api-headless-cms/utils/getBaseFieldType.js\";\n\ninterface Params {\n plugins: ElasticsearchQuerySearchValuePlugins;\n field: CmsModelField;\n value: any;\n}\n\n/**\n * Transformed value can be anything.\n */\nexport const transformValueForSearch = (params: Params): any => {\n const { field, plugins, value } = params;\n const fieldType = getBaseFieldType(field);\n const plugin = plugins[fieldType];\n if (!plugin) {\n return value;\n }\n return plugin.transform({ field, value });\n};\n"],"mappings":"AAAA;AACA;AACA;AACA;;AAGA,SAASA,gBAAgB,QAAQ,oDAAoD;AAQrF;AACA;AACA;AACA,OAAO,MAAMC,uBAAuB,GAAIC,MAAc,IAAU;EAC5D,MAAM;IAAEC,KAAK;IAAEC,OAAO;IAAEC;EAAM,CAAC,GAAGH,MAAM;EACxC,MAAMI,SAAS,GAAGN,gBAAgB,CAACG,KAAK,CAAC;EACzC,MAAMI,MAAM,GAAGH,OAAO,CAACE,SAAS,CAAC;EACjC,IAAI,CAACC,MAAM,EAAE;IACT,OAAOF,KAAK;EAChB;EACA,OAAOE,MAAM,CAACC,SAAS,CAAC;IAAEL,KAAK;IAAEE;EAAM,CAAC,CAAC;AAC7C,CAAC","ignoreList":[]}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { CmsEntryElasticsearchQueryBuilderValueSearchPlugin } from "../../../plugins";
|
|
2
|
-
import { ElasticsearchQueryBuilderOperatorPlugin } from "@webiny/api-elasticsearch";
|
|
3
|
-
import { CmsModelField } from "@webiny/api-headless-cms/types";
|
|
1
|
+
import type { CmsEntryElasticsearchQueryBuilderValueSearchPlugin } from "../../../plugins/index.js";
|
|
2
|
+
import type { ElasticsearchQueryBuilderOperatorPlugin } from "@webiny/api-elasticsearch";
|
|
3
|
+
import type { CmsModelField } from "@webiny/api-headless-cms/types/index.js";
|
|
4
4
|
/**
|
|
5
5
|
* ./fields
|
|
6
6
|
*/
|
|
7
|
-
|
|
8
|
-
export
|
|
7
|
+
type ModelFieldPath = string | ((value: string) => string);
|
|
8
|
+
export type FieldType = "text" | "date" | "datetime" | "time" | "number" | "boolean" | string;
|
|
9
9
|
export interface ModelFieldParent {
|
|
10
10
|
fieldId: string;
|
|
11
11
|
storageId: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import { CmsEntryElasticsearchQueryBuilderValueSearchPlugin } from \"~/plugins\";\nimport { ElasticsearchQueryBuilderOperatorPlugin } from \"@webiny/api-elasticsearch\";\nimport { CmsModelField } from \"@webiny/api-headless-cms/types\";\n\n/**\n * ./fields\n */\ntype ModelFieldPath = string | ((value: string) => string);\n\nexport type FieldType = \"text\" | \"date\" | \"datetime\" | \"time\" | \"number\" | \"boolean\" | string;\n\nexport interface ModelFieldParent {\n fieldId: string;\n storageId: string;\n type: FieldType;\n}\nexport interface ModelField {\n unmappedType?: string;\n keyword?: boolean;\n searchable: boolean;\n sortable: boolean;\n type: FieldType;\n systemField?: boolean;\n field: CmsModelField;\n path?: ModelFieldPath;\n fullTextSearch?: boolean;\n parents: ModelFieldParent[];\n}\n\nexport interface ModelFields {\n [fieldId: string]: ModelField;\n}\n\n/**\n * ./plugins/operator\n */\nexport interface ElasticsearchQueryBuilderOperatorPlugins {\n [key: string]: ElasticsearchQueryBuilderOperatorPlugin;\n}\n/**\n * ./plugins/search\n */\nexport interface ElasticsearchQuerySearchValuePlugins {\n [fieldType: string]: CmsEntryElasticsearchQueryBuilderValueSearchPlugin;\n}\n"],"mappings":"","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type { CmsEntryElasticsearchQueryBuilderValueSearchPlugin } from \"~/plugins/index.js\";\nimport type { ElasticsearchQueryBuilderOperatorPlugin } from \"@webiny/api-elasticsearch\";\nimport type { CmsModelField } from \"@webiny/api-headless-cms/types/index.js\";\n\n/**\n * ./fields\n */\ntype ModelFieldPath = string | ((value: string) => string);\n\nexport type FieldType = \"text\" | \"date\" | \"datetime\" | \"time\" | \"number\" | \"boolean\" | string;\n\nexport interface ModelFieldParent {\n fieldId: string;\n storageId: string;\n type: FieldType;\n}\nexport interface ModelField {\n unmappedType?: string;\n keyword?: boolean;\n searchable: boolean;\n sortable: boolean;\n type: FieldType;\n systemField?: boolean;\n field: CmsModelField;\n path?: ModelFieldPath;\n fullTextSearch?: boolean;\n parents: ModelFieldParent[];\n}\n\nexport interface ModelFields {\n [fieldId: string]: ModelField;\n}\n\n/**\n * ./plugins/operator\n */\nexport interface ElasticsearchQueryBuilderOperatorPlugins {\n [key: string]: ElasticsearchQueryBuilderOperatorPlugin;\n}\n/**\n * ./plugins/search\n */\nexport interface ElasticsearchQuerySearchValuePlugins {\n [fieldType: string]: CmsEntryElasticsearchQueryBuilderValueSearchPlugin;\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { CmsEntryStorageOperations } from "../../types";
|
|
1
|
+
import type { Client } from "@elastic/elasticsearch";
|
|
2
|
+
import type { PluginsContainer } from "@webiny/plugins";
|
|
3
|
+
import { type IElasticsearchEntity } from "@webiny/api-elasticsearch";
|
|
4
|
+
import type { CmsEntryStorageOperations } from "../../types.js";
|
|
5
|
+
import type { IEntryEntity } from "../../definitions/types.js";
|
|
5
6
|
export interface CreateEntriesStorageOperationsParams {
|
|
6
|
-
entity:
|
|
7
|
-
esEntity:
|
|
7
|
+
entity: IEntryEntity;
|
|
8
|
+
esEntity: IElasticsearchEntity;
|
|
8
9
|
elasticsearch: Client;
|
|
9
10
|
plugins: PluginsContainer;
|
|
10
11
|
}
|