@webiny/api-headless-cms-ddb-es 0.0.0-unstable.78f581c1d2 → 0.0.0-unstable.7be00a75a9
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 +13 -6
- package/configurations.js +28 -40
- package/configurations.js.map +1 -1
- package/definitions/entry.d.ts +4 -5
- package/definitions/entry.js +9 -88
- package/definitions/entry.js.map +1 -1
- package/definitions/group.d.ts +6 -6
- package/definitions/group.js +9 -68
- package/definitions/group.js.map +1 -1
- package/definitions/model.d.ts +6 -6
- package/definitions/model.js +9 -90
- package/definitions/model.js.map +1 -1
- package/definitions/types.d.ts +65 -0
- package/definitions/types.js +0 -0
- package/elasticsearch/createElasticsearchIndex.d.ts +5 -5
- package/elasticsearch/createElasticsearchIndex.js +53 -56
- package/elasticsearch/createElasticsearchIndex.js.map +1 -1
- package/elasticsearch/deleteElasticsearchIndex.d.ts +3 -3
- package/elasticsearch/deleteElasticsearchIndex.js +20 -40
- package/elasticsearch/deleteElasticsearchIndex.js.map +1 -1
- package/exports/api/cms/opensearch.d.ts +9 -0
- package/exports/api/cms/opensearch.js +9 -0
- package/feature.d.ts +1 -0
- package/feature.js +179 -0
- package/feature.js.map +1 -0
- package/features/CmsEntryOpenSearchBodyModifier/abstractions.d.ts +16 -0
- package/features/CmsEntryOpenSearchBodyModifier/abstractions.js +5 -0
- package/features/CmsEntryOpenSearchBodyModifier/abstractions.js.map +1 -0
- package/features/CmsEntryOpenSearchBodyModifier/index.d.ts +1 -0
- package/features/CmsEntryOpenSearchBodyModifier/index.js +1 -0
- package/features/CmsEntryOpenSearchFieldIndex/CmsEntryOpenSearchFieldIndexRegistry.d.ts +14 -0
- package/features/CmsEntryOpenSearchFieldIndex/CmsEntryOpenSearchFieldIndexRegistry.js +42 -0
- package/features/CmsEntryOpenSearchFieldIndex/CmsEntryOpenSearchFieldIndexRegistry.js.map +1 -0
- package/features/CmsEntryOpenSearchFieldIndex/abstractions/CmsEntryOpenSearchFieldIndex.d.ts +32 -0
- package/features/CmsEntryOpenSearchFieldIndex/abstractions/CmsEntryOpenSearchFieldIndex.js +5 -0
- package/features/CmsEntryOpenSearchFieldIndex/abstractions/CmsEntryOpenSearchFieldIndex.js.map +1 -0
- package/features/CmsEntryOpenSearchFieldIndex/abstractions/CmsEntryOpenSearchFieldIndexRegistry.d.ts +11 -0
- package/features/CmsEntryOpenSearchFieldIndex/abstractions/CmsEntryOpenSearchFieldIndexRegistry.js +5 -0
- package/features/CmsEntryOpenSearchFieldIndex/abstractions/CmsEntryOpenSearchFieldIndexRegistry.js.map +1 -0
- package/features/CmsEntryOpenSearchFieldIndex/constants.d.ts +1 -0
- package/features/CmsEntryOpenSearchFieldIndex/constants.js +4 -0
- package/features/CmsEntryOpenSearchFieldIndex/constants.js.map +1 -0
- package/features/CmsEntryOpenSearchFieldIndex/feature.d.ts +4 -0
- package/features/CmsEntryOpenSearchFieldIndex/feature.js +29 -0
- package/features/CmsEntryOpenSearchFieldIndex/feature.js.map +1 -0
- package/features/CmsEntryOpenSearchFieldIndex/fields/DateTimeFieldIndex.d.ts +11 -0
- package/features/CmsEntryOpenSearchFieldIndex/fields/DateTimeFieldIndex.js +60 -0
- package/features/CmsEntryOpenSearchFieldIndex/fields/DateTimeFieldIndex.js.map +1 -0
- package/features/CmsEntryOpenSearchFieldIndex/fields/DefaultFieldIndex.d.ts +13 -0
- package/features/CmsEntryOpenSearchFieldIndex/fields/DefaultFieldIndex.js +33 -0
- package/features/CmsEntryOpenSearchFieldIndex/fields/DefaultFieldIndex.js.map +1 -0
- package/features/CmsEntryOpenSearchFieldIndex/fields/JsonFieldIndex.d.ts +10 -0
- package/features/CmsEntryOpenSearchFieldIndex/fields/JsonFieldIndex.js +21 -0
- package/features/CmsEntryOpenSearchFieldIndex/fields/JsonFieldIndex.js.map +1 -0
- package/features/CmsEntryOpenSearchFieldIndex/fields/LongTextFieldIndex.d.ts +10 -0
- package/features/CmsEntryOpenSearchFieldIndex/fields/LongTextFieldIndex.js +22 -0
- package/features/CmsEntryOpenSearchFieldIndex/fields/LongTextFieldIndex.js.map +1 -0
- package/features/CmsEntryOpenSearchFieldIndex/fields/NumberFieldIndex.d.ts +11 -0
- package/features/CmsEntryOpenSearchFieldIndex/fields/NumberFieldIndex.js +32 -0
- package/features/CmsEntryOpenSearchFieldIndex/fields/NumberFieldIndex.js.map +1 -0
- package/features/CmsEntryOpenSearchFieldIndex/fields/ObjectFieldIndex.d.ts +12 -0
- package/features/CmsEntryOpenSearchFieldIndex/fields/ObjectFieldIndex.js +107 -0
- package/features/CmsEntryOpenSearchFieldIndex/fields/ObjectFieldIndex.js.map +1 -0
- package/features/CmsEntryOpenSearchFieldIndex/fields/RichTextFieldIndex.d.ts +10 -0
- package/features/CmsEntryOpenSearchFieldIndex/fields/RichTextFieldIndex.js +21 -0
- package/features/CmsEntryOpenSearchFieldIndex/fields/RichTextFieldIndex.js.map +1 -0
- package/features/CmsEntryOpenSearchFieldIndex/fields/TextCompressedFieldIndex.d.ts +15 -0
- package/features/CmsEntryOpenSearchFieldIndex/fields/TextCompressedFieldIndex.js +40 -0
- package/features/CmsEntryOpenSearchFieldIndex/fields/TextCompressedFieldIndex.js.map +1 -0
- package/features/CmsEntryOpenSearchFieldIndex/fields/TextEncryptedFieldIndex.d.ts +15 -0
- package/features/CmsEntryOpenSearchFieldIndex/fields/TextEncryptedFieldIndex.js +40 -0
- package/features/CmsEntryOpenSearchFieldIndex/fields/TextEncryptedFieldIndex.js.map +1 -0
- package/features/CmsEntryOpenSearchFieldIndex/index.d.ts +3 -0
- package/features/CmsEntryOpenSearchFieldIndex/index.js +3 -0
- package/features/CmsEntryOpenSearchFilter/CmsEntryOpenSearchFilterRegistry.d.ts +11 -0
- package/features/CmsEntryOpenSearchFilter/CmsEntryOpenSearchFilterRegistry.js +36 -0
- package/features/CmsEntryOpenSearchFilter/CmsEntryOpenSearchFilterRegistry.js.map +1 -0
- package/features/CmsEntryOpenSearchFilter/abstractions/CmsEntryOpenSearchFilter.d.ts +37 -0
- package/features/CmsEntryOpenSearchFilter/abstractions/CmsEntryOpenSearchFilter.js +5 -0
- package/features/CmsEntryOpenSearchFilter/abstractions/CmsEntryOpenSearchFilter.js.map +1 -0
- package/features/CmsEntryOpenSearchFilter/abstractions/CmsEntryOpenSearchFilterRegistry.d.ts +9 -0
- package/features/CmsEntryOpenSearchFilter/abstractions/CmsEntryOpenSearchFilterRegistry.js +5 -0
- package/features/CmsEntryOpenSearchFilter/abstractions/CmsEntryOpenSearchFilterRegistry.js.map +1 -0
- package/features/CmsEntryOpenSearchFilter/constants.d.ts +1 -0
- package/features/CmsEntryOpenSearchFilter/constants.js +4 -0
- package/features/CmsEntryOpenSearchFilter/constants.js.map +1 -0
- package/features/CmsEntryOpenSearchFilter/feature.d.ts +4 -0
- package/features/CmsEntryOpenSearchFilter/feature.js +17 -0
- package/features/CmsEntryOpenSearchFilter/feature.js.map +1 -0
- package/features/CmsEntryOpenSearchFilter/fields/DefaultFilter.d.ts +9 -0
- package/features/CmsEntryOpenSearchFilter/fields/DefaultFilter.js +26 -0
- package/features/CmsEntryOpenSearchFilter/fields/DefaultFilter.js.map +1 -0
- package/features/CmsEntryOpenSearchFilter/fields/ObjectFilter.d.ts +9 -0
- package/features/CmsEntryOpenSearchFilter/fields/ObjectFilter.js +43 -0
- package/features/CmsEntryOpenSearchFilter/fields/ObjectFilter.js.map +1 -0
- package/features/CmsEntryOpenSearchFilter/fields/RefFilter.d.ts +9 -0
- package/features/CmsEntryOpenSearchFilter/fields/RefFilter.js +36 -0
- package/features/CmsEntryOpenSearchFilter/fields/RefFilter.js.map +1 -0
- package/features/CmsEntryOpenSearchFilter/index.d.ts +3 -0
- package/features/CmsEntryOpenSearchFilter/index.js +3 -0
- package/features/CmsEntryOpenSearchFullTextSearch/abstractions.d.ts +20 -0
- package/features/CmsEntryOpenSearchFullTextSearch/abstractions.js +5 -0
- package/features/CmsEntryOpenSearchFullTextSearch/abstractions.js.map +1 -0
- package/features/CmsEntryOpenSearchFullTextSearch/index.d.ts +1 -0
- package/features/CmsEntryOpenSearchFullTextSearch/index.js +1 -0
- package/features/CmsEntryOpenSearchIndex/BaseOpenSearchIndex.d.ts +11 -0
- package/features/CmsEntryOpenSearchIndex/BaseOpenSearchIndex.js +17 -0
- package/features/CmsEntryOpenSearchIndex/BaseOpenSearchIndex.js.map +1 -0
- package/features/CmsEntryOpenSearchIndex/abstractions.d.ts +14 -0
- package/features/CmsEntryOpenSearchIndex/abstractions.js +5 -0
- package/features/CmsEntryOpenSearchIndex/abstractions.js.map +1 -0
- package/features/CmsEntryOpenSearchIndex/feature.d.ts +4 -0
- package/features/CmsEntryOpenSearchIndex/feature.js +11 -0
- package/features/CmsEntryOpenSearchIndex/feature.js.map +1 -0
- package/features/CmsEntryOpenSearchIndex/index.d.ts +3 -0
- package/features/CmsEntryOpenSearchIndex/index.js +3 -0
- package/features/CmsEntryOpenSearchQueryModifier/abstractions.d.ts +16 -0
- package/features/CmsEntryOpenSearchQueryModifier/abstractions.js +5 -0
- package/features/CmsEntryOpenSearchQueryModifier/abstractions.js.map +1 -0
- package/features/CmsEntryOpenSearchQueryModifier/index.d.ts +1 -0
- package/features/CmsEntryOpenSearchQueryModifier/index.js +1 -0
- package/features/CmsEntryOpenSearchSortModifier/abstractions.d.ts +15 -0
- package/features/CmsEntryOpenSearchSortModifier/abstractions.js +5 -0
- package/features/CmsEntryOpenSearchSortModifier/abstractions.js.map +1 -0
- package/features/CmsEntryOpenSearchSortModifier/index.d.ts +1 -0
- package/features/CmsEntryOpenSearchSortModifier/index.js +1 -0
- package/features/CmsEntryOpenSearchValueSearch/CmsEntryOpenSearchValueSearchRegistry.d.ts +12 -0
- package/features/CmsEntryOpenSearchValueSearch/CmsEntryOpenSearchValueSearchRegistry.js +31 -0
- package/features/CmsEntryOpenSearchValueSearch/CmsEntryOpenSearchValueSearchRegistry.js.map +1 -0
- package/features/CmsEntryOpenSearchValueSearch/abstractions/CmsEntryOpenSearchValueSearch.d.ts +22 -0
- package/features/CmsEntryOpenSearchValueSearch/abstractions/CmsEntryOpenSearchValueSearch.js +5 -0
- package/features/CmsEntryOpenSearchValueSearch/abstractions/CmsEntryOpenSearchValueSearch.js.map +1 -0
- package/features/CmsEntryOpenSearchValueSearch/abstractions/CmsEntryOpenSearchValueSearchRegistry.d.ts +10 -0
- package/features/CmsEntryOpenSearchValueSearch/abstractions/CmsEntryOpenSearchValueSearchRegistry.js +5 -0
- package/features/CmsEntryOpenSearchValueSearch/abstractions/CmsEntryOpenSearchValueSearchRegistry.js.map +1 -0
- package/features/CmsEntryOpenSearchValueSearch/feature.d.ts +4 -0
- package/features/CmsEntryOpenSearchValueSearch/feature.js +17 -0
- package/features/CmsEntryOpenSearchValueSearch/feature.js.map +1 -0
- package/features/CmsEntryOpenSearchValueSearch/fields/RefSearch.d.ts +10 -0
- package/features/CmsEntryOpenSearchValueSearch/fields/RefSearch.js +21 -0
- package/features/CmsEntryOpenSearchValueSearch/fields/RefSearch.js.map +1 -0
- package/features/CmsEntryOpenSearchValueSearch/fields/SearchableJsonSearch.d.ts +10 -0
- package/features/CmsEntryOpenSearchValueSearch/fields/SearchableJsonSearch.js +44 -0
- package/features/CmsEntryOpenSearchValueSearch/fields/SearchableJsonSearch.js.map +1 -0
- package/features/CmsEntryOpenSearchValueSearch/fields/TimeSearch.d.ts +10 -0
- package/features/CmsEntryOpenSearchValueSearch/fields/TimeSearch.js +22 -0
- package/features/CmsEntryOpenSearchValueSearch/fields/TimeSearch.js.map +1 -0
- package/features/CmsEntryOpenSearchValueSearch/index.d.ts +3 -0
- package/features/CmsEntryOpenSearchValueSearch/index.js +3 -0
- package/features/CmsEntryOpenSearchValuesModifier/abstractions.d.ts +23 -0
- package/features/CmsEntryOpenSearchValuesModifier/abstractions.js +5 -0
- package/features/CmsEntryOpenSearchValuesModifier/abstractions.js.map +1 -0
- package/features/CmsEntryOpenSearchValuesModifier/index.d.ts +1 -0
- package/features/CmsEntryOpenSearchValuesModifier/index.js +1 -0
- package/helpers/entryIndexHelpers.d.ts +13 -11
- package/helpers/entryIndexHelpers.js +72 -196
- package/helpers/entryIndexHelpers.js.map +1 -1
- package/helpers/fieldIdentifier.d.ts +6 -0
- package/helpers/fieldIdentifier.js +23 -0
- package/helpers/fieldIdentifier.js.map +1 -0
- package/helpers/index.d.ts +2 -2
- package/helpers/index.js +2 -31
- package/index.d.ts +1 -3
- package/index.js +1 -268
- package/operations/entry/dataLoader/DataLoaderCache.d.ts +16 -0
- package/operations/entry/dataLoader/DataLoaderCache.js +27 -0
- package/operations/entry/dataLoader/DataLoaderCache.js.map +1 -0
- package/operations/entry/dataLoader/constants.d.ts +1 -0
- package/operations/entry/dataLoader/constants.js +5 -0
- package/operations/entry/dataLoader/constants.js.map +1 -0
- package/operations/entry/dataLoader/createBatchScheduleFn.d.ts +8 -0
- package/operations/entry/dataLoader/createBatchScheduleFn.js +10 -0
- package/operations/entry/dataLoader/createBatchScheduleFn.js.map +1 -0
- package/operations/entry/dataLoader/getAllEntryRevisions.d.ts +4 -0
- package/operations/entry/dataLoader/getAllEntryRevisions.js +24 -0
- package/operations/entry/dataLoader/getAllEntryRevisions.js.map +1 -0
- package/operations/entry/dataLoader/getLatestRevisionByEntryId.d.ts +4 -0
- package/operations/entry/dataLoader/getLatestRevisionByEntryId.js +34 -0
- package/operations/entry/dataLoader/getLatestRevisionByEntryId.js.map +1 -0
- package/operations/entry/dataLoader/getPublishedRevisionByEntryId.d.ts +4 -0
- package/operations/entry/dataLoader/getPublishedRevisionByEntryId.js +34 -0
- package/operations/entry/dataLoader/getPublishedRevisionByEntryId.js.map +1 -0
- package/operations/entry/dataLoader/getRevisionById.d.ts +4 -0
- package/operations/entry/dataLoader/getRevisionById.js +40 -0
- package/operations/entry/dataLoader/getRevisionById.js.map +1 -0
- package/operations/entry/dataLoader/index.d.ts +8 -0
- package/operations/entry/dataLoader/index.js +18 -0
- package/operations/entry/dataLoader/index.js.map +1 -0
- package/operations/entry/dataLoader/types.d.ts +6 -0
- package/operations/entry/dataLoader/types.js +0 -0
- package/operations/entry/dataLoaders.d.ts +17 -38
- package/operations/entry/dataLoaders.js +82 -357
- package/operations/entry/dataLoaders.js.map +1 -1
- package/operations/entry/elasticsearch/assignMinimumShouldMatchToQuery.d.ts +18 -0
- package/operations/entry/elasticsearch/assignMinimumShouldMatchToQuery.js +9 -0
- package/operations/entry/elasticsearch/assignMinimumShouldMatchToQuery.js.map +1 -0
- package/operations/entry/elasticsearch/body.d.ts +29 -0
- package/operations/entry/elasticsearch/body.js +87 -0
- package/operations/entry/elasticsearch/body.js.map +1 -0
- package/operations/entry/elasticsearch/fields/createSystemField.d.ts +4 -0
- package/operations/entry/elasticsearch/fields/createSystemField.js +9 -0
- package/operations/entry/elasticsearch/fields/createSystemField.js.map +1 -0
- package/operations/entry/elasticsearch/fields/live.d.ts +2 -0
- package/operations/entry/elasticsearch/fields/live.js +50 -0
- package/operations/entry/elasticsearch/fields/live.js.map +1 -0
- package/operations/entry/elasticsearch/fields/location.d.ts +2 -0
- package/operations/entry/elasticsearch/fields/location.js +50 -0
- package/operations/entry/elasticsearch/fields/location.js.map +1 -0
- package/operations/entry/elasticsearch/fields/state.d.ts +2 -0
- package/operations/entry/elasticsearch/fields/state.js +104 -0
- package/operations/entry/elasticsearch/fields/state.js.map +1 -0
- package/operations/entry/elasticsearch/fields.d.ts +12 -0
- package/operations/entry/elasticsearch/fields.js +207 -0
- package/operations/entry/elasticsearch/fields.js.map +1 -0
- package/operations/entry/elasticsearch/filtering/applyFiltering.d.ts +9 -0
- package/operations/entry/elasticsearch/filtering/applyFiltering.js +39 -0
- package/operations/entry/elasticsearch/filtering/applyFiltering.js.map +1 -0
- package/operations/entry/elasticsearch/filtering/exec.d.ts +22 -0
- package/operations/entry/elasticsearch/filtering/exec.js +96 -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 +1 -0
- package/operations/entry/elasticsearch/filtering/path.d.ts +17 -0
- package/operations/entry/elasticsearch/filtering/path.js +27 -0
- package/operations/entry/elasticsearch/filtering/path.js.map +1 -0
- package/operations/entry/elasticsearch/filtering/populated.d.ts +2 -0
- package/operations/entry/elasticsearch/filtering/populated.js +12 -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 +15 -0
- package/operations/entry/elasticsearch/filtering/values.js.map +1 -0
- package/operations/entry/elasticsearch/fullTextSearch.d.ts +13 -0
- package/operations/entry/elasticsearch/fullTextSearch.js +51 -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 +10 -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 +45 -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 +17 -0
- package/operations/entry/elasticsearch/keyword.js.map +1 -0
- package/operations/entry/elasticsearch/plugins/operator.d.ts +7 -0
- package/operations/entry/elasticsearch/plugins/operator.js +13 -0
- package/operations/entry/elasticsearch/plugins/operator.js.map +1 -0
- package/operations/entry/elasticsearch/shouldIgnoreEsResponseError.d.ts +2 -0
- package/operations/entry/elasticsearch/shouldIgnoreEsResponseError.js +8 -0
- package/operations/entry/elasticsearch/shouldIgnoreEsResponseError.js.map +1 -0
- package/operations/entry/elasticsearch/sort.d.ts +12 -0
- package/operations/entry/elasticsearch/sort.js +80 -0
- package/operations/entry/elasticsearch/sort.js.map +1 -0
- package/operations/entry/elasticsearch/transformValueForSearch.d.ts +9 -0
- package/operations/entry/elasticsearch/transformValueForSearch.js +12 -0
- package/operations/entry/elasticsearch/transformValueForSearch.js.map +1 -0
- package/operations/entry/elasticsearch/types.d.ts +34 -0
- package/operations/entry/elasticsearch/types.js +0 -0
- package/operations/entry/index.d.ts +27 -8
- package/operations/entry/index.js +1344 -1245
- package/operations/entry/index.js.map +1 -1
- package/operations/entry/keys.d.ts +31 -1
- package/operations/entry/keys.js +45 -35
- package/operations/entry/keys.js.map +1 -1
- package/operations/entry/recordType.d.ts +3 -0
- package/operations/entry/recordType.js +6 -0
- package/operations/entry/recordType.js.map +1 -0
- package/operations/entry/transformations/convertEntryKeys.d.ts +8 -0
- package/operations/entry/transformations/convertEntryKeys.js +25 -0
- package/operations/entry/transformations/convertEntryKeys.js.map +1 -0
- package/operations/entry/transformations/index.d.ts +33 -0
- package/operations/entry/transformations/index.js +91 -0
- package/operations/entry/transformations/index.js.map +1 -0
- package/operations/entry/transformations/modifyEntryValues.d.ts +53 -0
- package/operations/entry/transformations/modifyEntryValues.js +16 -0
- package/operations/entry/transformations/modifyEntryValues.js.map +1 -0
- package/operations/entry/transformations/transformEntryKeys.d.ts +11 -0
- package/operations/entry/transformations/transformEntryKeys.js +17 -0
- package/operations/entry/transformations/transformEntryKeys.js.map +1 -0
- package/operations/entry/transformations/transformEntryToIndex.d.ts +10 -0
- package/operations/entry/transformations/transformEntryToIndex.js +20 -0
- package/operations/entry/transformations/transformEntryToIndex.js.map +1 -0
- package/operations/group/index.d.ts +7 -6
- package/operations/group/index.js +116 -190
- package/operations/group/index.js.map +1 -1
- package/operations/model/index.d.ts +4 -4
- package/operations/model/index.js +130 -199
- package/operations/model/index.js.map +1 -1
- package/package.json +44 -41
- package/tasks/createIndexTaskPlugin.d.ts +2 -0
- package/tasks/createIndexTaskPlugin.js +45 -0
- package/tasks/createIndexTaskPlugin.js.map +1 -0
- package/types.d.ts +34 -137
- package/types.js +10 -47
- package/types.js.map +1 -1
- package/values/NoValueContainer.d.ts +5 -0
- package/values/NoValueContainer.js +11 -0
- package/values/NoValueContainer.js.map +1 -0
- package/definitions/entryElasticsearch.d.ts +0 -8
- package/definitions/entryElasticsearch.js +0 -42
- package/definitions/entryElasticsearch.js.map +0 -1
- package/definitions/settings.d.ts +0 -8
- package/definitions/settings.js +0 -58
- package/definitions/settings.js.map +0 -1
- package/definitions/system.d.ts +0 -8
- package/definitions/system.js +0 -46
- package/definitions/system.js.map +0 -1
- package/definitions/table.d.ts +0 -8
- package/definitions/table.js +0 -24
- package/definitions/table.js.map +0 -1
- package/definitions/tableElasticsearch.d.ts +0 -8
- package/definitions/tableElasticsearch.js +0 -24
- package/definitions/tableElasticsearch.js.map +0 -1
- package/dynamoDb/index.d.ts +0 -2
- package/dynamoDb/index.js +0 -16
- package/dynamoDb/index.js.map +0 -1
- package/dynamoDb/storage/date.d.ts +0 -2
- package/dynamoDb/storage/date.js +0 -99
- package/dynamoDb/storage/date.js.map +0 -1
- package/dynamoDb/storage/longText.d.ts +0 -10
- package/dynamoDb/storage/longText.js +0 -101
- package/dynamoDb/storage/longText.js.map +0 -1
- package/dynamoDb/storage/richText.d.ts +0 -7
- package/dynamoDb/storage/richText.js +0 -128
- package/dynamoDb/storage/richText.js.map +0 -1
- package/elasticsearch/index.d.ts +0 -2
- package/elasticsearch/index.js +0 -16
- package/elasticsearch/index.js.map +0 -1
- package/elasticsearch/indexing/dateTimeIndexing.d.ts +0 -3
- package/elasticsearch/indexing/dateTimeIndexing.js +0 -103
- package/elasticsearch/indexing/dateTimeIndexing.js.map +0 -1
- package/elasticsearch/indexing/defaultFieldIndexing.d.ts +0 -3
- package/elasticsearch/indexing/defaultFieldIndexing.js +0 -47
- package/elasticsearch/indexing/defaultFieldIndexing.js.map +0 -1
- package/elasticsearch/indexing/index.d.ts +0 -2
- package/elasticsearch/indexing/index.js +0 -24
- package/elasticsearch/indexing/index.js.map +0 -1
- package/elasticsearch/indexing/longTextIndexing.d.ts +0 -3
- package/elasticsearch/indexing/longTextIndexing.js +0 -36
- package/elasticsearch/indexing/longTextIndexing.js.map +0 -1
- package/elasticsearch/indexing/numberIndexing.d.ts +0 -3
- package/elasticsearch/indexing/numberIndexing.js +0 -48
- package/elasticsearch/indexing/numberIndexing.js.map +0 -1
- package/elasticsearch/indexing/objectIndexing.d.ts +0 -12
- package/elasticsearch/indexing/objectIndexing.js +0 -223
- package/elasticsearch/indexing/objectIndexing.js.map +0 -1
- package/elasticsearch/indexing/richTextIndexing.d.ts +0 -3
- package/elasticsearch/indexing/richTextIndexing.js +0 -34
- package/elasticsearch/indexing/richTextIndexing.js.map +0 -1
- package/elasticsearch/indices/base.d.ts +0 -2
- package/elasticsearch/indices/base.js +0 -15
- package/elasticsearch/indices/base.js.map +0 -1
- package/elasticsearch/indices/index.d.ts +0 -1
- package/elasticsearch/indices/index.js +0 -16
- package/elasticsearch/indices/index.js.map +0 -1
- package/elasticsearch/indices/japanese.d.ts +0 -2
- package/elasticsearch/indices/japanese.js +0 -16
- package/elasticsearch/indices/japanese.js.map +0 -1
- package/elasticsearch/search/index.d.ts +0 -3
- package/elasticsearch/search/index.js +0 -14
- package/elasticsearch/search/index.js.map +0 -1
- package/elasticsearch/search/refSearch.d.ts +0 -2
- package/elasticsearch/search/refSearch.js +0 -33
- package/elasticsearch/search/refSearch.js.map +0 -1
- package/elasticsearch/search/timeSearch.d.ts +0 -2
- package/elasticsearch/search/timeSearch.js +0 -33
- package/elasticsearch/search/timeSearch.js.map +0 -1
- package/helpers/createElasticsearchQueryBody.d.ts +0 -11
- package/helpers/createElasticsearchQueryBody.js +0 -611
- package/helpers/createElasticsearchQueryBody.js.map +0 -1
- package/helpers/fields.d.ts +0 -19
- package/helpers/fields.js +0 -205
- package/helpers/fields.js.map +0 -1
- package/helpers/index.js.map +0 -1
- package/helpers/searchPluginsList.d.ts +0 -6
- package/helpers/searchPluginsList.js +0 -26
- package/helpers/searchPluginsList.js.map +0 -1
- package/helpers/transformValueForSearch.d.ts +0 -12
- package/helpers/transformValueForSearch.js +0 -29
- package/helpers/transformValueForSearch.js.map +0 -1
- package/index.js.map +0 -1
- package/operations/entry/elasticsearchFields.d.ts +0 -2
- package/operations/entry/elasticsearchFields.js +0 -38
- package/operations/entry/elasticsearchFields.js.map +0 -1
- package/operations/settings/index.d.ts +0 -6
- package/operations/settings/index.js +0 -135
- package/operations/settings/index.js.map +0 -1
- package/operations/system/index.d.ts +0 -6
- package/operations/system/index.js +0 -99
- package/operations/system/index.js.map +0 -1
- package/plugins/CmsEntryElasticsearchBodyModifierPlugin.d.ts +0 -20
- package/plugins/CmsEntryElasticsearchBodyModifierPlugin.js +0 -24
- package/plugins/CmsEntryElasticsearchBodyModifierPlugin.js.map +0 -1
- package/plugins/CmsEntryElasticsearchFieldPlugin.d.ts +0 -12
- package/plugins/CmsEntryElasticsearchFieldPlugin.js +0 -24
- package/plugins/CmsEntryElasticsearchFieldPlugin.js.map +0 -1
- package/plugins/CmsEntryElasticsearchIndexPlugin.d.ts +0 -4
- package/plugins/CmsEntryElasticsearchIndexPlugin.js +0 -17
- package/plugins/CmsEntryElasticsearchIndexPlugin.js.map +0 -1
- package/plugins/CmsEntryElasticsearchQueryBuilderValueSearchPlugin.d.ts +0 -30
- package/plugins/CmsEntryElasticsearchQueryBuilderValueSearchPlugin.js +0 -43
- package/plugins/CmsEntryElasticsearchQueryBuilderValueSearchPlugin.js.map +0 -1
- package/plugins/CmsEntryElasticsearchQueryModifierPlugin.d.ts +0 -17
- package/plugins/CmsEntryElasticsearchQueryModifierPlugin.js +0 -24
- package/plugins/CmsEntryElasticsearchQueryModifierPlugin.js.map +0 -1
- package/plugins/CmsEntryElasticsearchSortModifierPlugin.d.ts +0 -17
- package/plugins/CmsEntryElasticsearchSortModifierPlugin.js +0 -24
- package/plugins/CmsEntryElasticsearchSortModifierPlugin.js.map +0 -1
- package/plugins/index.d.ts +0 -6
- package/plugins/index.js +0 -83
- package/plugins/index.js.map +0 -1
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import error from "@webiny/error";
|
|
2
|
+
import { transformValueForSearch } from "../transformValueForSearch.js";
|
|
3
|
+
import { hasKeyword } from "../keyword.js";
|
|
4
|
+
import { createFieldPathFactory } from "./path.js";
|
|
5
|
+
const createApplyFiltering = ({ operatorPlugins, valueSearchRegistry })=>{
|
|
6
|
+
const createFieldPath = createFieldPathFactory({
|
|
7
|
+
valueSearchRegistry
|
|
8
|
+
});
|
|
9
|
+
return (params)=>{
|
|
10
|
+
const { key, value: initialValue, query, operator, field } = params;
|
|
11
|
+
const plugin = operatorPlugins[operator];
|
|
12
|
+
if (!plugin) throw new error(`Elasticsearch operator "${operator}" plugin missing.`, "PLUGIN_MISSING", {
|
|
13
|
+
operator
|
|
14
|
+
});
|
|
15
|
+
const value = transformValueForSearch({
|
|
16
|
+
valueSearchRegistry,
|
|
17
|
+
field: field.field,
|
|
18
|
+
value: initialValue
|
|
19
|
+
});
|
|
20
|
+
const keyword = hasKeyword(field);
|
|
21
|
+
const { basePath, path } = createFieldPath({
|
|
22
|
+
field,
|
|
23
|
+
value,
|
|
24
|
+
originalValue: initialValue,
|
|
25
|
+
key,
|
|
26
|
+
keyword
|
|
27
|
+
});
|
|
28
|
+
plugin.apply(query, {
|
|
29
|
+
name: field.field.fieldId,
|
|
30
|
+
basePath,
|
|
31
|
+
path,
|
|
32
|
+
value,
|
|
33
|
+
keyword
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
export { createApplyFiltering };
|
|
38
|
+
|
|
39
|
+
//# sourceMappingURL=applyFiltering.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operations/entry/elasticsearch/filtering/applyFiltering.js","sources":["../../../../../src/operations/entry/elasticsearch/filtering/applyFiltering.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { transformValueForSearch } from \"~/operations/entry/elasticsearch/transformValueForSearch.js\";\nimport { hasKeyword } from \"~/operations/entry/elasticsearch/keyword.js\";\nimport type { OpenSearchQueryBuilderOperatorPlugins } from \"~/operations/entry/elasticsearch/types.js\";\nimport { createFieldPathFactory } from \"~/operations/entry/elasticsearch/filtering/path.js\";\nimport type { CmsEntryOpenSearchFilter } from \"~/features/CmsEntryOpenSearchFilter/index.js\";\nimport type { CmsEntryOpenSearchValueSearchRegistry } from \"~/features/CmsEntryOpenSearchValueSearch/index.js\";\n\ninterface CreateParams {\n operatorPlugins: OpenSearchQueryBuilderOperatorPlugins;\n valueSearchRegistry: CmsEntryOpenSearchValueSearchRegistry.Interface;\n}\n\nexport const createApplyFiltering = ({\n operatorPlugins,\n valueSearchRegistry\n}: CreateParams): CmsEntryOpenSearchFilter.ApplyFiltering => {\n const createFieldPath = createFieldPathFactory({\n valueSearchRegistry\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(\n `Elasticsearch operator \"${operator}\" plugin missing.`,\n \"PLUGIN_MISSING\",\n {\n operator\n }\n );\n }\n\n const value = transformValueForSearch({\n valueSearchRegistry,\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 originalValue: initialValue,\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"],"names":["createApplyFiltering","operatorPlugins","valueSearchRegistry","createFieldPath","createFieldPathFactory","params","key","initialValue","query","operator","field","plugin","WebinyError","value","transformValueForSearch","keyword","hasKeyword","basePath","path"],"mappings":";;;;AAaO,MAAMA,uBAAuB,CAAC,EACjCC,eAAe,EACfC,mBAAmB,EACR;IACX,MAAMC,kBAAkBC,uBAAuB;QAC3CF;IACJ;IAEA,OAAOG,CAAAA;QACH,MAAM,EAAEC,GAAG,EAAE,OAAOC,YAAY,EAAEC,KAAK,EAAEC,QAAQ,EAAEC,KAAK,EAAE,GAAGL;QAE7D,MAAMM,SAASV,eAAe,CAACQ,SAAS;QACxC,IAAI,CAACE,QACD,MAAM,IAAIC,MACN,CAAC,wBAAwB,EAAEH,SAAS,iBAAiB,CAAC,EACtD,kBACA;YACIA;QACJ;QAIR,MAAMI,QAAQC,wBAAwB;YAClCZ;YACA,OAAOQ,MAAM,KAAK;YAClB,OAAOH;QACX;QAEA,MAAMQ,UAAUC,WAAWN;QAE3B,MAAM,EAAEO,QAAQ,EAAEC,IAAI,EAAE,GAAGf,gBAAgB;YACvCO;YACAG;YACA,eAAeN;YACfD;YACAS;QACJ;QAEAJ,OAAO,KAAK,CAACH,OAAO;YAChB,MAAME,MAAM,KAAK,CAAC,OAAO;YACzBO;YACAC;YACAL;YACAE;QACJ;IACJ;AACJ"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { CmsEntryListWhere, CmsModel } from "@webiny/api-headless-cms/types/index.js";
|
|
2
|
+
import type { ModelFields } from "../../../../operations/entry/elasticsearch/types.js";
|
|
3
|
+
import type { PluginsContainer } from "@webiny/plugins";
|
|
4
|
+
import type { OpenSearchBoolQueryConfig } from "@webiny/api-opensearch/types.js";
|
|
5
|
+
import type { CmsEntryOpenSearchValueSearchRegistry } from "../../../../features/CmsEntryOpenSearchValueSearch/index.js";
|
|
6
|
+
import type { CmsEntryOpenSearchFilterRegistry } from "../../../../features/CmsEntryOpenSearchFilter/index.js";
|
|
7
|
+
export interface CreateExecParams {
|
|
8
|
+
model: CmsModel;
|
|
9
|
+
fields: ModelFields;
|
|
10
|
+
plugins: PluginsContainer;
|
|
11
|
+
valueSearchRegistry: CmsEntryOpenSearchValueSearchRegistry.Interface;
|
|
12
|
+
filterRegistry: CmsEntryOpenSearchFilterRegistry.Interface;
|
|
13
|
+
}
|
|
14
|
+
export interface IExecParams {
|
|
15
|
+
where: CmsEntryListWhere;
|
|
16
|
+
query: OpenSearchBoolQueryConfig;
|
|
17
|
+
isValues?: boolean;
|
|
18
|
+
}
|
|
19
|
+
export interface CreateExecFilteringResponse {
|
|
20
|
+
(params: IExecParams): void;
|
|
21
|
+
}
|
|
22
|
+
export declare const createExecFiltering: (params: CreateExecParams) => CreateExecFilteringResponse;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import error from "@webiny/error";
|
|
2
|
+
import { createOperatorPluginList } from "../plugins/operator.js";
|
|
3
|
+
import { createBaseQuery } from "../initialQuery.js";
|
|
4
|
+
import { parseWhereKey } from "@webiny/api-opensearch";
|
|
5
|
+
import { getWhereValues } from "./values.js";
|
|
6
|
+
import { getPopulated } from "./populated.js";
|
|
7
|
+
import { createApplyFiltering } from "./applyFiltering.js";
|
|
8
|
+
import { assignMinimumShouldMatchToQuery } from "../assignMinimumShouldMatchToQuery.js";
|
|
9
|
+
const createExecFiltering = (params)=>{
|
|
10
|
+
const { fields, plugins, model, valueSearchRegistry, filterRegistry } = params;
|
|
11
|
+
const operatorPlugins = createOperatorPluginList({
|
|
12
|
+
plugins
|
|
13
|
+
});
|
|
14
|
+
const applyFiltering = createApplyFiltering({
|
|
15
|
+
operatorPlugins,
|
|
16
|
+
valueSearchRegistry
|
|
17
|
+
});
|
|
18
|
+
const getFilter = (type)=>filterRegistry.get(type);
|
|
19
|
+
const execFiltering = (params)=>{
|
|
20
|
+
const { where: initialWhere, query, isValues = false } = params;
|
|
21
|
+
const keys = Object.keys(initialWhere);
|
|
22
|
+
if (0 === keys.length) return;
|
|
23
|
+
const where = structuredClone(initialWhere);
|
|
24
|
+
for(const key in where){
|
|
25
|
+
const value = where[key];
|
|
26
|
+
if (void 0 === value) continue;
|
|
27
|
+
if ("AND" === key) {
|
|
28
|
+
const childWhereList = getWhereValues(value, "AND");
|
|
29
|
+
const childQuery = createBaseQuery();
|
|
30
|
+
for (const childWhere of childWhereList)execFiltering({
|
|
31
|
+
query: childQuery,
|
|
32
|
+
where: childWhere,
|
|
33
|
+
isValues
|
|
34
|
+
});
|
|
35
|
+
const childQueryBool = getPopulated(childQuery);
|
|
36
|
+
if (0 === Object.keys(childQueryBool).length) continue;
|
|
37
|
+
query.filter.push({
|
|
38
|
+
bool: childQueryBool
|
|
39
|
+
});
|
|
40
|
+
continue;
|
|
41
|
+
}
|
|
42
|
+
if ("OR" === key) {
|
|
43
|
+
const childWhereList = getWhereValues(value, "OR");
|
|
44
|
+
const should = [];
|
|
45
|
+
for (const childWhere of childWhereList){
|
|
46
|
+
const childQuery = createBaseQuery();
|
|
47
|
+
execFiltering({
|
|
48
|
+
query: childQuery,
|
|
49
|
+
where: childWhere,
|
|
50
|
+
isValues
|
|
51
|
+
});
|
|
52
|
+
const childQueryBool = getPopulated(childQuery);
|
|
53
|
+
if (0 !== Object.keys(childQueryBool).length) should.push({
|
|
54
|
+
bool: childQueryBool
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
if (0 === should.length) continue;
|
|
58
|
+
query.should.push(...should);
|
|
59
|
+
assignMinimumShouldMatchToQuery({
|
|
60
|
+
query
|
|
61
|
+
});
|
|
62
|
+
continue;
|
|
63
|
+
} else if ("values" === key) {
|
|
64
|
+
execFiltering({
|
|
65
|
+
query,
|
|
66
|
+
where: where[key],
|
|
67
|
+
isValues: true
|
|
68
|
+
});
|
|
69
|
+
continue;
|
|
70
|
+
}
|
|
71
|
+
const { field: whereFieldId, operator } = parseWhereKey(key);
|
|
72
|
+
let fieldId = isValues ? `values.${whereFieldId}` : whereFieldId;
|
|
73
|
+
const cmsModelField = model.fields.find((f)=>f.fieldId === fieldId);
|
|
74
|
+
if (cmsModelField || fields[fieldId]) {
|
|
75
|
+
if (cmsModelField) fieldId = cmsModelField.fieldId;
|
|
76
|
+
} else throw new error(`There is no CMS Model Field "${fieldId}".`);
|
|
77
|
+
const field = fields[fieldId];
|
|
78
|
+
if (!field) throw new error(`There is no field "${fieldId}".`, "EXEC_FILTERING_ERROR");
|
|
79
|
+
const filter = getFilter(field.type);
|
|
80
|
+
filter.exec({
|
|
81
|
+
applyFiltering,
|
|
82
|
+
getFilter,
|
|
83
|
+
key,
|
|
84
|
+
value,
|
|
85
|
+
operator,
|
|
86
|
+
field,
|
|
87
|
+
fields,
|
|
88
|
+
query
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
return execFiltering;
|
|
93
|
+
};
|
|
94
|
+
export { createExecFiltering };
|
|
95
|
+
|
|
96
|
+
//# sourceMappingURL=exec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operations/entry/elasticsearch/filtering/exec.js","sources":["../../../../../src/operations/entry/elasticsearch/filtering/exec.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport type { CmsEntryListWhere, CmsModel } from \"@webiny/api-headless-cms/types/index.js\";\nimport type { ModelFields } from \"~/operations/entry/elasticsearch/types.js\";\nimport type { PluginsContainer } from \"@webiny/plugins\";\nimport type {\n OpenSearchBoolQueryConfig,\n QueryDslQueryContainer as Query\n} from \"@webiny/api-opensearch/types.js\";\nimport { createOperatorPluginList } from \"~/operations/entry/elasticsearch/plugins/operator.js\";\nimport { createBaseQuery } from \"~/operations/entry/elasticsearch/initialQuery.js\";\nimport { parseWhereKey } from \"@webiny/api-opensearch\";\nimport { getWhereValues } from \"./values.js\";\nimport { getPopulated } from \"./populated.js\";\nimport { createApplyFiltering } from \"./applyFiltering.js\";\nimport { assignMinimumShouldMatchToQuery } from \"~/operations/entry/elasticsearch/assignMinimumShouldMatchToQuery.js\";\nimport type { CmsEntryOpenSearchValueSearchRegistry } from \"~/features/CmsEntryOpenSearchValueSearch/index.js\";\nimport type { CmsEntryOpenSearchFilterRegistry } from \"~/features/CmsEntryOpenSearchFilter/index.js\";\n\nexport interface CreateExecParams {\n model: CmsModel;\n fields: ModelFields;\n plugins: PluginsContainer;\n valueSearchRegistry: CmsEntryOpenSearchValueSearchRegistry.Interface;\n filterRegistry: CmsEntryOpenSearchFilterRegistry.Interface;\n}\nexport interface IExecParams {\n where: CmsEntryListWhere;\n query: OpenSearchBoolQueryConfig;\n isValues?: boolean;\n}\nexport interface CreateExecFilteringResponse {\n (params: IExecParams): void;\n}\nexport const createExecFiltering = (params: CreateExecParams): CreateExecFilteringResponse => {\n const { fields, plugins, model, valueSearchRegistry, filterRegistry } = params;\n\n const operatorPlugins = createOperatorPluginList({\n plugins\n });\n\n const applyFiltering = createApplyFiltering({\n operatorPlugins,\n valueSearchRegistry\n });\n\n const getFilter = (type: string) => {\n return filterRegistry.get(type);\n };\n\n const execFiltering = (params: IExecParams) => {\n const { where: initialWhere, query, isValues = false } = params;\n const keys = Object.keys(initialWhere);\n if (keys.length === 0) {\n return;\n }\n const where = structuredClone(initialWhere);\n\n for (const key in where) {\n const value = where[key as keyof typeof where];\n if (value === undefined) {\n continue;\n } else if (key === \"AND\") {\n const childWhereList = getWhereValues(value, \"AND\");\n const childQuery = createBaseQuery();\n for (const childWhere of childWhereList) {\n execFiltering({ query: childQuery, where: childWhere, isValues });\n }\n const childQueryBool = getPopulated(childQuery);\n if (Object.keys(childQueryBool).length === 0) {\n continue;\n }\n query.filter.push({ bool: childQueryBool });\n continue;\n } else if (key === \"OR\") {\n const childWhereList = getWhereValues(value, \"OR\");\n const should: Query[] = [];\n for (const childWhere of childWhereList) {\n const childQuery = createBaseQuery();\n execFiltering({ query: childQuery, where: childWhere, isValues });\n const childQueryBool = getPopulated(childQuery);\n if (Object.keys(childQueryBool).length === 0) {\n continue;\n }\n should.push({ bool: childQueryBool });\n }\n if (should.length === 0) {\n continue;\n }\n query.should.push(...should);\n assignMinimumShouldMatchToQuery({ query });\n continue;\n } else if (key === \"values\") {\n execFiltering({\n query,\n where: where[key] as CmsEntryListWhere,\n isValues: true\n });\n continue;\n }\n const { field: whereFieldId, operator } = parseWhereKey(key);\n let fieldId: string = isValues ? `values.${whereFieldId}` : whereFieldId;\n\n const cmsModelField = model.fields.find(f => f.fieldId === fieldId);\n if (!cmsModelField && !fields[fieldId]) {\n throw new WebinyError(`There is no CMS Model Field \"${fieldId}\".`);\n } else if (cmsModelField) {\n fieldId = cmsModelField.fieldId;\n }\n\n const field = fields[fieldId];\n if (!field) {\n throw new WebinyError(`There is no field \"${fieldId}\".`, \"EXEC_FILTERING_ERROR\");\n }\n const filter = getFilter(field.type);\n\n filter.exec({\n applyFiltering,\n getFilter,\n key,\n value,\n operator,\n field,\n fields,\n query\n });\n }\n };\n\n return execFiltering;\n};\n"],"names":["createExecFiltering","params","fields","plugins","model","valueSearchRegistry","filterRegistry","operatorPlugins","createOperatorPluginList","applyFiltering","createApplyFiltering","getFilter","type","execFiltering","initialWhere","query","isValues","keys","Object","where","structuredClone","key","value","undefined","childWhereList","getWhereValues","childQuery","createBaseQuery","childWhere","childQueryBool","getPopulated","should","assignMinimumShouldMatchToQuery","whereFieldId","operator","parseWhereKey","fieldId","cmsModelField","f","WebinyError","field","filter"],"mappings":";;;;;;;;AAiCO,MAAMA,sBAAsB,CAACC;IAChC,MAAM,EAAEC,MAAM,EAAEC,OAAO,EAAEC,KAAK,EAAEC,mBAAmB,EAAEC,cAAc,EAAE,GAAGL;IAExE,MAAMM,kBAAkBC,yBAAyB;QAC7CL;IACJ;IAEA,MAAMM,iBAAiBC,qBAAqB;QACxCH;QACAF;IACJ;IAEA,MAAMM,YAAY,CAACC,OACRN,eAAe,GAAG,CAACM;IAG9B,MAAMC,gBAAgB,CAACZ;QACnB,MAAM,EAAE,OAAOa,YAAY,EAAEC,KAAK,EAAEC,WAAW,KAAK,EAAE,GAAGf;QACzD,MAAMgB,OAAOC,OAAO,IAAI,CAACJ;QACzB,IAAIG,AAAgB,MAAhBA,KAAK,MAAM,EACX;QAEJ,MAAME,QAAQC,gBAAgBN;QAE9B,IAAK,MAAMO,OAAOF,MAAO;YACrB,MAAMG,QAAQH,KAAK,CAACE,IAA0B;YAC9C,IAAIC,AAAUC,WAAVD,OACA;YACG,IAAID,AAAQ,UAARA,KAAe;gBACtB,MAAMG,iBAAiBC,eAAeH,OAAO;gBAC7C,MAAMI,aAAaC;gBACnB,KAAK,MAAMC,cAAcJ,eACrBX,cAAc;oBAAE,OAAOa;oBAAY,OAAOE;oBAAYZ;gBAAS;gBAEnE,MAAMa,iBAAiBC,aAAaJ;gBACpC,IAAIR,AAAuC,MAAvCA,OAAO,IAAI,CAACW,gBAAgB,MAAM,EAClC;gBAEJd,MAAM,MAAM,CAAC,IAAI,CAAC;oBAAE,MAAMc;gBAAe;gBACzC;YACJ;YAAO,IAAIR,AAAQ,SAARA,KAAc;gBACrB,MAAMG,iBAAiBC,eAAeH,OAAO;gBAC7C,MAAMS,SAAkB,EAAE;gBAC1B,KAAK,MAAMH,cAAcJ,eAAgB;oBACrC,MAAME,aAAaC;oBACnBd,cAAc;wBAAE,OAAOa;wBAAY,OAAOE;wBAAYZ;oBAAS;oBAC/D,MAAMa,iBAAiBC,aAAaJ;oBACpC,IAAIR,AAAuC,MAAvCA,OAAO,IAAI,CAACW,gBAAgB,MAAM,EAGtCE,OAAO,IAAI,CAAC;wBAAE,MAAMF;oBAAe;gBACvC;gBACA,IAAIE,AAAkB,MAAlBA,OAAO,MAAM,EACb;gBAEJhB,MAAM,MAAM,CAAC,IAAI,IAAIgB;gBACrBC,gCAAgC;oBAAEjB;gBAAM;gBACxC;YACJ,OAAO,IAAIM,AAAQ,aAARA,KAAkB;gBACzBR,cAAc;oBACVE;oBACA,OAAOI,KAAK,CAACE,IAAI;oBACjB,UAAU;gBACd;gBACA;YACJ;YACA,MAAM,EAAE,OAAOY,YAAY,EAAEC,QAAQ,EAAE,GAAGC,cAAcd;YACxD,IAAIe,UAAkBpB,WAAW,CAAC,OAAO,EAAEiB,cAAc,GAAGA;YAE5D,MAAMI,gBAAgBjC,MAAM,MAAM,CAAC,IAAI,CAACkC,CAAAA,IAAKA,EAAE,OAAO,KAAKF;YAC3D,IAAI,AAACC,iBAAkBnC,MAAM,CAACkC,QAAQ,EAE/B;gBAAA,IAAIC,eACPD,UAAUC,cAAc,OAAO;YACnC,OAHI,MAAM,IAAIE,MAAY,CAAC,6BAA6B,EAAEH,QAAQ,EAAE,CAAC;YAKrE,MAAMI,QAAQtC,MAAM,CAACkC,QAAQ;YAC7B,IAAI,CAACI,OACD,MAAM,IAAID,MAAY,CAAC,mBAAmB,EAAEH,QAAQ,EAAE,CAAC,EAAE;YAE7D,MAAMK,SAAS9B,UAAU6B,MAAM,IAAI;YAEnCC,OAAO,IAAI,CAAC;gBACRhC;gBACAE;gBACAU;gBACAC;gBACAY;gBACAM;gBACAtC;gBACAa;YACJ;QACJ;IACJ;IAEA,OAAOF;AACX"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./exec.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./exec.js";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ModelField } from "../../../../operations/entry/elasticsearch/types.js";
|
|
2
|
+
import type { CmsEntryOpenSearchValueSearchRegistry } from "../../../../features/CmsEntryOpenSearchValueSearch/index.js";
|
|
3
|
+
interface FieldPathFactoryParams {
|
|
4
|
+
valueSearchRegistry: CmsEntryOpenSearchValueSearchRegistry.Interface;
|
|
5
|
+
}
|
|
6
|
+
interface FieldPathParams {
|
|
7
|
+
field: ModelField;
|
|
8
|
+
key: string;
|
|
9
|
+
value: any;
|
|
10
|
+
originalValue: any;
|
|
11
|
+
keyword: boolean;
|
|
12
|
+
}
|
|
13
|
+
export declare const createFieldPathFactory: ({ valueSearchRegistry }: FieldPathFactoryParams) => (params: FieldPathParams) => {
|
|
14
|
+
basePath: string;
|
|
15
|
+
path: string;
|
|
16
|
+
};
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
const createFieldPathFactory = ({ valueSearchRegistry })=>(params)=>{
|
|
2
|
+
const { field, key, value, keyword, originalValue } = params;
|
|
3
|
+
const search = valueSearchRegistry.get(field.type);
|
|
4
|
+
let fieldPath = null;
|
|
5
|
+
if (search) fieldPath = search.createPath({
|
|
6
|
+
field: field.field,
|
|
7
|
+
value,
|
|
8
|
+
key,
|
|
9
|
+
originalValue
|
|
10
|
+
});
|
|
11
|
+
if (!fieldPath) {
|
|
12
|
+
fieldPath = field.field.storageId;
|
|
13
|
+
if (field.path) fieldPath = "function" == typeof field.path ? field.path(value) : field.path;
|
|
14
|
+
}
|
|
15
|
+
const result = field.parents.map((p)=>p.storageId).concat([
|
|
16
|
+
fieldPath
|
|
17
|
+
]);
|
|
18
|
+
return {
|
|
19
|
+
basePath: result.join("."),
|
|
20
|
+
path: result.concat(keyword ? [
|
|
21
|
+
"keyword"
|
|
22
|
+
] : []).join(".")
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
export { createFieldPathFactory };
|
|
26
|
+
|
|
27
|
+
//# sourceMappingURL=path.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operations/entry/elasticsearch/filtering/path.js","sources":["../../../../../src/operations/entry/elasticsearch/filtering/path.ts"],"sourcesContent":["import type { ModelField } from \"~/operations/entry/elasticsearch/types.js\";\nimport type { CmsEntryOpenSearchValueSearchRegistry } from \"~/features/CmsEntryOpenSearchValueSearch/index.js\";\n\ninterface FieldPathFactoryParams {\n valueSearchRegistry: CmsEntryOpenSearchValueSearchRegistry.Interface;\n}\ninterface FieldPathParams {\n field: ModelField;\n key: string;\n value: any;\n originalValue: any;\n keyword: boolean;\n}\n\nexport const createFieldPathFactory = ({ valueSearchRegistry }: FieldPathFactoryParams) => {\n return (params: FieldPathParams) => {\n const { field, key, value, keyword, originalValue } = params;\n const search = valueSearchRegistry.get(field.type);\n\n let fieldPath: string | null = null;\n if (search) {\n fieldPath = search.createPath({ field: field.field, value, key, originalValue });\n }\n if (!fieldPath) {\n fieldPath = field.field.storageId;\n if (field.path) {\n fieldPath = typeof field.path === \"function\" ? field.path(value) : field.path;\n }\n }\n\n const result: string[] = field.parents.map(p => p.storageId).concat([fieldPath]);\n\n return {\n basePath: result.join(\".\"),\n path: result.concat(keyword ? [\"keyword\"] : []).join(\".\")\n };\n };\n};\n"],"names":["createFieldPathFactory","valueSearchRegistry","params","field","key","value","keyword","originalValue","search","fieldPath","result","p"],"mappings":"AAcO,MAAMA,yBAAyB,CAAC,EAAEC,mBAAmB,EAA0B,GAC3E,CAACC;QACJ,MAAM,EAAEC,KAAK,EAAEC,GAAG,EAAEC,KAAK,EAAEC,OAAO,EAAEC,aAAa,EAAE,GAAGL;QACtD,MAAMM,SAASP,oBAAoB,GAAG,CAACE,MAAM,IAAI;QAEjD,IAAIM,YAA2B;QAC/B,IAAID,QACAC,YAAYD,OAAO,UAAU,CAAC;YAAE,OAAOL,MAAM,KAAK;YAAEE;YAAOD;YAAKG;QAAc;QAElF,IAAI,CAACE,WAAW;YACZA,YAAYN,MAAM,KAAK,CAAC,SAAS;YACjC,IAAIA,MAAM,IAAI,EACVM,YAAY,AAAsB,cAAtB,OAAON,MAAM,IAAI,GAAkBA,MAAM,IAAI,CAACE,SAASF,MAAM,IAAI;QAErF;QAEA,MAAMO,SAAmBP,MAAM,OAAO,CAAC,GAAG,CAACQ,CAAAA,IAAKA,EAAE,SAAS,EAAE,MAAM,CAAC;YAACF;SAAU;QAE/E,OAAO;YACH,UAAUC,OAAO,IAAI,CAAC;YACtB,MAAMA,OAAO,MAAM,CAACJ,UAAU;gBAAC;aAAU,GAAG,EAAE,EAAE,IAAI,CAAC;QACzD;IACJ"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
const getPopulated = (query)=>{
|
|
2
|
+
const result = {};
|
|
3
|
+
let key;
|
|
4
|
+
for(key in query){
|
|
5
|
+
const value = query[key];
|
|
6
|
+
if (!(void 0 === value || Array.isArray(value) && 0 === value.length)) result[key] = value;
|
|
7
|
+
}
|
|
8
|
+
return result;
|
|
9
|
+
};
|
|
10
|
+
export { getPopulated };
|
|
11
|
+
|
|
12
|
+
//# sourceMappingURL=populated.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operations/entry/elasticsearch/filtering/populated.js","sources":["../../../../../src/operations/entry/elasticsearch/filtering/populated.ts"],"sourcesContent":["import type { OpenSearchBoolQueryConfig } from \"@webiny/api-opensearch/types.js\";\n\nexport const getPopulated = (\n query: OpenSearchBoolQueryConfig\n): Partial<OpenSearchBoolQueryConfig> => {\n const result: Partial<OpenSearchBoolQueryConfig> = {};\n let key: keyof OpenSearchBoolQueryConfig;\n for (key in query) {\n const value = query[key];\n if (value === undefined || (Array.isArray(value) && value.length === 0)) {\n continue;\n }\n /**\n * TODO figure out better types.\n */\n // @ts-expect-error\n result[key] = value;\n }\n return result;\n};\n"],"names":["getPopulated","query","result","key","value","undefined","Array"],"mappings":"AAEO,MAAMA,eAAe,CACxBC;IAEA,MAAMC,SAA6C,CAAC;IACpD,IAAIC;IACJ,IAAKA,OAAOF,MAAO;QACf,MAAMG,QAAQH,KAAK,CAACE,IAAI;QACxB,KAAIC,CAAAA,AAAUC,WAAVD,SAAwBE,MAAM,OAAO,CAACF,UAAUA,AAAiB,MAAjBA,MAAM,MAAM,AAAK,GAOrEF,MAAM,CAACC,IAAI,GAAGC;IAClB;IACA,OAAOF;AACX"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import error from "@webiny/error";
|
|
2
|
+
const getWhereValues = (value, condition)=>{
|
|
3
|
+
const values = value;
|
|
4
|
+
if (Array.isArray(values)) {
|
|
5
|
+
if (0 === values.length) throw new error(`Trying to run filtering with "${condition}", but the value sent is empty array.`, `MALFORMED_${condition}_CONDITION`, {
|
|
6
|
+
value
|
|
7
|
+
});
|
|
8
|
+
} else throw new error(`Trying to run filtering with "${condition}", but the value sent is not an array.`, `MALFORMED_${condition}_CONDITION`, {
|
|
9
|
+
value
|
|
10
|
+
});
|
|
11
|
+
return values;
|
|
12
|
+
};
|
|
13
|
+
export { getWhereValues };
|
|
14
|
+
|
|
15
|
+
//# sourceMappingURL=values.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operations/entry/elasticsearch/filtering/values.js","sources":["../../../../../src/operations/entry/elasticsearch/filtering/values.ts"],"sourcesContent":["import type { CmsEntryListWhere } from \"@webiny/api-headless-cms/types/index.js\";\nimport WebinyError from \"@webiny/error\";\n\nexport const getWhereValues = (value: unknown, condition: \"AND\" | \"OR\") => {\n const values = value as CmsEntryListWhere[] | undefined;\n if (!Array.isArray(values)) {\n throw new WebinyError(\n `Trying to run filtering with \"${condition}\", but the value sent is not an array.`,\n `MALFORMED_${condition}_CONDITION`,\n {\n value\n }\n );\n } else if (values.length === 0) {\n throw new WebinyError(\n `Trying to run filtering with \"${condition}\", but the value sent is empty array.`,\n `MALFORMED_${condition}_CONDITION`,\n {\n value\n }\n );\n }\n return values;\n};\n"],"names":["getWhereValues","value","condition","values","Array","WebinyError"],"mappings":";AAGO,MAAMA,iBAAiB,CAACC,OAAgBC;IAC3C,MAAMC,SAASF;IACf,IAAKG,MAAM,OAAO,CAACD,SAQZ;QAAA,IAAIA,AAAkB,MAAlBA,OAAO,MAAM,EACpB,MAAM,IAAIE,MACN,CAAC,8BAA8B,EAAEH,UAAU,qCAAqC,CAAC,EACjF,CAAC,UAAU,EAAEA,UAAU,UAAU,CAAC,EAClC;YACID;QACJ;IAER,OAfI,MAAM,IAAII,MACN,CAAC,8BAA8B,EAAEH,UAAU,sCAAsC,CAAC,EAClF,CAAC,UAAU,EAAEA,UAAU,UAAU,CAAC,EAClC;QACID;IACJ;IAWR,OAAOE;AACX"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { OpenSearchBoolQueryConfig } from "@webiny/api-opensearch/types.js";
|
|
2
|
+
import type { CmsModel } from "@webiny/api-headless-cms/types/index.js";
|
|
3
|
+
import type { CmsEntryOpenSearchFullTextSearch } from "../../../features/CmsEntryOpenSearchFullTextSearch/index.js";
|
|
4
|
+
import type { ModelFields } from "../../../operations/entry/elasticsearch/types.js";
|
|
5
|
+
interface Params {
|
|
6
|
+
fullTextSearches: CmsEntryOpenSearchFullTextSearch.Interface[];
|
|
7
|
+
model: CmsModel;
|
|
8
|
+
query: OpenSearchBoolQueryConfig;
|
|
9
|
+
term?: string;
|
|
10
|
+
fields: ModelFields;
|
|
11
|
+
}
|
|
12
|
+
export declare const applyFullTextSearch: (params: Params) => void;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { normalizeValue } from "@webiny/api-opensearch";
|
|
2
|
+
const defaultFullTextSearch = {
|
|
3
|
+
apply: (params)=>{
|
|
4
|
+
const { query, term, fields, createFieldPath, prepareTerm } = params;
|
|
5
|
+
query.must.push({
|
|
6
|
+
query_string: {
|
|
7
|
+
allow_leading_wildcard: true,
|
|
8
|
+
fields: Object.values(fields).map(createFieldPath),
|
|
9
|
+
query: `*${prepareTerm(term)}*`,
|
|
10
|
+
default_operator: "and"
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
const getFullTextSearch = (params)=>{
|
|
16
|
+
const { fullTextSearches, model } = params;
|
|
17
|
+
const reversed = [
|
|
18
|
+
...fullTextSearches
|
|
19
|
+
].reverse();
|
|
20
|
+
let fallback = null;
|
|
21
|
+
for (const item of reversed){
|
|
22
|
+
const models = item.models || [];
|
|
23
|
+
if (models.includes(model.modelId)) return item;
|
|
24
|
+
if (!fallback && 0 === models.length) fallback = item;
|
|
25
|
+
}
|
|
26
|
+
return fallback || defaultFullTextSearch;
|
|
27
|
+
};
|
|
28
|
+
const applyFullTextSearch = (params)=>{
|
|
29
|
+
const { fullTextSearches, query, term, fields, model } = params;
|
|
30
|
+
const keys = Object.keys(fields);
|
|
31
|
+
if (!term || 0 === term.length || 0 === keys.length) return;
|
|
32
|
+
const fullTextSearch = getFullTextSearch({
|
|
33
|
+
fullTextSearches,
|
|
34
|
+
model
|
|
35
|
+
});
|
|
36
|
+
fullTextSearch.apply({
|
|
37
|
+
model,
|
|
38
|
+
createFieldPath: (field)=>{
|
|
39
|
+
if ("function" == typeof field.path) return field.path(term);
|
|
40
|
+
if (field.systemField) return field.path || field.field.storageId;
|
|
41
|
+
return `values.${field.path || field.field.storageId}`;
|
|
42
|
+
},
|
|
43
|
+
fields,
|
|
44
|
+
query,
|
|
45
|
+
term,
|
|
46
|
+
prepareTerm: normalizeValue
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
export { applyFullTextSearch };
|
|
50
|
+
|
|
51
|
+
//# sourceMappingURL=fullTextSearch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operations/entry/elasticsearch/fullTextSearch.js","sources":["../../../../src/operations/entry/elasticsearch/fullTextSearch.ts"],"sourcesContent":["import type { OpenSearchBoolQueryConfig } from \"@webiny/api-opensearch/types.js\";\nimport { normalizeValue } from \"@webiny/api-opensearch\";\nimport type { CmsModel } from \"@webiny/api-headless-cms/types/index.js\";\nimport type { CmsEntryOpenSearchFullTextSearch } from \"~/features/CmsEntryOpenSearchFullTextSearch/index.js\";\nimport type { ModelFields } from \"~/operations/entry/elasticsearch/types.js\";\n\n/**\n * Our default implementation works with the AND operator for the multiple words query string.\n */\nconst defaultFullTextSearch: CmsEntryOpenSearchFullTextSearch.Interface = {\n apply: params => {\n const { query, term, fields, createFieldPath, prepareTerm } = params;\n\n query.must.push({\n query_string: {\n allow_leading_wildcard: true,\n fields: Object.values(fields).map(createFieldPath),\n query: `*${prepareTerm(term)}*`,\n default_operator: \"and\"\n }\n });\n }\n};\n\ninterface GetFullTextSearchParams {\n fullTextSearches: CmsEntryOpenSearchFullTextSearch.Interface[];\n model: CmsModel;\n}\nconst getFullTextSearch = (\n params: GetFullTextSearchParams\n): CmsEntryOpenSearchFullTextSearch.Interface => {\n const { fullTextSearches, model } = params;\n /**\n * We need to reverse the list, so we can take the last one first - possibility to override existing implementations.\n */\n const reversed = [...fullTextSearches].reverse();\n /**\n * We need to find the most specific implementation for the given model.\n * Also, we need to use the first possible implementation if the specific one is not found.\n */\n let fallback: CmsEntryOpenSearchFullTextSearch.Interface | null = null;\n for (const item of reversed) {\n const models = item.models || [];\n /**\n * We take the first available implementation for the given model.\n */\n if (models.includes(model.modelId)) {\n return item;\n } else if (!fallback && models.length === 0) {\n /**\n * Then we set the first possible implementation, which has no models defined, as the default one.\n * It is important not to set the one which has models defined as they are specifically for the targeted model.\n */\n fallback = item;\n }\n }\n\n return fallback || defaultFullTextSearch;\n};\n\ninterface Params {\n fullTextSearches: CmsEntryOpenSearchFullTextSearch.Interface[];\n model: CmsModel;\n query: OpenSearchBoolQueryConfig;\n term?: string;\n fields: ModelFields;\n}\nexport const applyFullTextSearch = (params: Params): void => {\n const { fullTextSearches, query, term, fields, model } = params;\n const keys = Object.keys(fields);\n if (!term || term.length === 0 || keys.length === 0) {\n return;\n }\n\n const fullTextSearch = getFullTextSearch({\n fullTextSearches,\n model\n });\n\n fullTextSearch.apply({\n model,\n createFieldPath: field => {\n if (typeof field.path === \"function\") {\n return field.path(term);\n } else if (field.systemField) {\n return field.path || field.field.storageId;\n }\n return `values.${field.path || field.field.storageId}`;\n },\n fields,\n query,\n term,\n prepareTerm: normalizeValue\n });\n};\n"],"names":["defaultFullTextSearch","params","query","term","fields","createFieldPath","prepareTerm","Object","getFullTextSearch","fullTextSearches","model","reversed","fallback","item","models","applyFullTextSearch","keys","fullTextSearch","field","normalizeValue"],"mappings":";AASA,MAAMA,wBAAoE;IACtE,OAAOC,CAAAA;QACH,MAAM,EAAEC,KAAK,EAAEC,IAAI,EAAEC,MAAM,EAAEC,eAAe,EAAEC,WAAW,EAAE,GAAGL;QAE9DC,MAAM,IAAI,CAAC,IAAI,CAAC;YACZ,cAAc;gBACV,wBAAwB;gBACxB,QAAQK,OAAO,MAAM,CAACH,QAAQ,GAAG,CAACC;gBAClC,OAAO,CAAC,CAAC,EAAEC,YAAYH,MAAM,CAAC,CAAC;gBAC/B,kBAAkB;YACtB;QACJ;IACJ;AACJ;AAMA,MAAMK,oBAAoB,CACtBP;IAEA,MAAM,EAAEQ,gBAAgB,EAAEC,KAAK,EAAE,GAAGT;IAIpC,MAAMU,WAAW;WAAIF;KAAiB,CAAC,OAAO;IAK9C,IAAIG,WAA8D;IAClE,KAAK,MAAMC,QAAQF,SAAU;QACzB,MAAMG,SAASD,KAAK,MAAM,IAAI,EAAE;QAIhC,IAAIC,OAAO,QAAQ,CAACJ,MAAM,OAAO,GAC7B,OAAOG;QACJ,IAAI,CAACD,YAAYE,AAAkB,MAAlBA,OAAO,MAAM,EAKjCF,WAAWC;IAEnB;IAEA,OAAOD,YAAYZ;AACvB;AASO,MAAMe,sBAAsB,CAACd;IAChC,MAAM,EAAEQ,gBAAgB,EAAEP,KAAK,EAAEC,IAAI,EAAEC,MAAM,EAAEM,KAAK,EAAE,GAAGT;IACzD,MAAMe,OAAOT,OAAO,IAAI,CAACH;IACzB,IAAI,CAACD,QAAQA,AAAgB,MAAhBA,KAAK,MAAM,IAAUa,AAAgB,MAAhBA,KAAK,MAAM,EACzC;IAGJ,MAAMC,iBAAiBT,kBAAkB;QACrCC;QACAC;IACJ;IAEAO,eAAe,KAAK,CAAC;QACjBP;QACA,iBAAiBQ,CAAAA;YACb,IAAI,AAAsB,cAAtB,OAAOA,MAAM,IAAI,EACjB,OAAOA,MAAM,IAAI,CAACf;YACf,IAAIe,MAAM,WAAW,EACxB,OAAOA,MAAM,IAAI,IAAIA,MAAM,KAAK,CAAC,SAAS;YAE9C,OAAO,CAAC,OAAO,EAAEA,MAAM,IAAI,IAAIA,MAAM,KAAK,CAAC,SAAS,EAAE;QAC1D;QACAd;QACAF;QACAC;QACA,aAAagB;IACjB;AACJ"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ModelFields } from "../../../operations/entry/elasticsearch/types.js";
|
|
2
|
+
interface Params {
|
|
3
|
+
fields: ModelFields;
|
|
4
|
+
term?: string;
|
|
5
|
+
targets?: string[];
|
|
6
|
+
}
|
|
7
|
+
export declare const createFullTextSearchFields: (params: Params) => ModelFields;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
const createFullTextSearchFields = (params)=>{
|
|
2
|
+
const { term, targets, fields } = params;
|
|
3
|
+
if (!targets?.length || !term || 0 === term.trim().length) return {};
|
|
4
|
+
const result = {};
|
|
5
|
+
for(const key in fields)if (false !== targets.includes(key)) result[key] = fields[key];
|
|
6
|
+
return result;
|
|
7
|
+
};
|
|
8
|
+
export { createFullTextSearchFields };
|
|
9
|
+
|
|
10
|
+
//# sourceMappingURL=fullTextSearchFields.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operations/entry/elasticsearch/fullTextSearchFields.js","sources":["../../../../src/operations/entry/elasticsearch/fullTextSearchFields.ts"],"sourcesContent":["import type { ModelFields } from \"~/operations/entry/elasticsearch/types.js\";\n\ninterface Params {\n fields: ModelFields;\n term?: string;\n targets?: string[];\n}\nexport const createFullTextSearchFields = (params: Params): ModelFields => {\n const { term, targets, fields } = params;\n if (!targets?.length || !term || term.trim().length === 0) {\n return {};\n }\n\n const result: ModelFields = {};\n for (const key in fields) {\n if (targets.includes(key) === false) {\n continue;\n }\n result[key] = fields[key];\n }\n return result;\n};\n"],"names":["createFullTextSearchFields","params","term","targets","fields","result","key"],"mappings":"AAOO,MAAMA,6BAA6B,CAACC;IACvC,MAAM,EAAEC,IAAI,EAAEC,OAAO,EAAEC,MAAM,EAAE,GAAGH;IAClC,IAAI,CAACE,SAAS,UAAU,CAACD,QAAQA,AAAuB,MAAvBA,KAAK,IAAI,GAAG,MAAM,EAC/C,OAAO,CAAC;IAGZ,MAAMG,SAAsB,CAAC;IAC7B,IAAK,MAAMC,OAAOF,OACd,IAAID,AAA0B,UAA1BA,QAAQ,QAAQ,CAACG,MAGrBD,MAAM,CAACC,IAAI,GAAGF,MAAM,CAACE,IAAI;IAE7B,OAAOD;AACX"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { OpenSearchBoolQueryConfig } from "@webiny/api-opensearch/types.js";
|
|
2
|
+
import type { CmsEntryListWhere, CmsModel } from "@webiny/api-headless-cms/types/index.js";
|
|
3
|
+
export declare const createBaseQuery: () => OpenSearchBoolQueryConfig;
|
|
4
|
+
interface Params {
|
|
5
|
+
model: CmsModel;
|
|
6
|
+
where: CmsEntryListWhere;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Latest and published are specific in Elasticsearch to that extend that they are tagged in the __type property.
|
|
10
|
+
* We allow either published or either latest.
|
|
11
|
+
* Latest is used in the manage API and published in the read API.
|
|
12
|
+
*
|
|
13
|
+
*
|
|
14
|
+
* We add the query.filter terms because we do not need scored search here and it is a bit faster.
|
|
15
|
+
*/
|
|
16
|
+
export declare const createInitialQuery: (params: Params) => OpenSearchBoolQueryConfig;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import error from "@webiny/error";
|
|
2
|
+
import { createLatestRecordType, createPublishedRecordType } from "../recordType.js";
|
|
3
|
+
import { isSharedOpenSearchIndex } from "@webiny/api-opensearch";
|
|
4
|
+
const createBaseQuery = ()=>({
|
|
5
|
+
must: [],
|
|
6
|
+
must_not: [],
|
|
7
|
+
should: [],
|
|
8
|
+
filter: []
|
|
9
|
+
});
|
|
10
|
+
const createInitialQuery = (params)=>{
|
|
11
|
+
const { model, where } = params;
|
|
12
|
+
const query = createBaseQuery();
|
|
13
|
+
const sharedIndex = isSharedOpenSearchIndex();
|
|
14
|
+
if (sharedIndex) {
|
|
15
|
+
query.filter.push({
|
|
16
|
+
term: {
|
|
17
|
+
"tenant.keyword": model.tenant
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
query.filter.push({
|
|
21
|
+
term: {
|
|
22
|
+
"modelId.keyword": model.modelId
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
if (true === where.published) query.filter.push({
|
|
27
|
+
term: {
|
|
28
|
+
"__type.keyword": createPublishedRecordType()
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
else if (true === where.latest) query.filter.push({
|
|
32
|
+
term: {
|
|
33
|
+
"__type.keyword": createLatestRecordType()
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
else throw new error('Cannot call Elasticsearch query when not setting "published" or "latest".', "OPENSEARCH_UNSUPPORTED_QUERY", {
|
|
37
|
+
where
|
|
38
|
+
});
|
|
39
|
+
delete where.published;
|
|
40
|
+
delete where.latest;
|
|
41
|
+
return query;
|
|
42
|
+
};
|
|
43
|
+
export { createBaseQuery, createInitialQuery };
|
|
44
|
+
|
|
45
|
+
//# sourceMappingURL=initialQuery.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operations/entry/elasticsearch/initialQuery.js","sources":["../../../../src/operations/entry/elasticsearch/initialQuery.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport type { OpenSearchBoolQueryConfig } from \"@webiny/api-opensearch/types.js\";\nimport type { CmsEntryListWhere, CmsModel } from \"@webiny/api-headless-cms/types/index.js\";\nimport { createLatestRecordType, createPublishedRecordType } from \"../recordType.js\";\nimport { isSharedOpenSearchIndex as isSharedElasticsearchIndex } from \"@webiny/api-opensearch\";\n\nexport const createBaseQuery = (): OpenSearchBoolQueryConfig => {\n return {\n must: [],\n must_not: [],\n should: [],\n filter: []\n };\n};\n\ninterface Params {\n model: CmsModel;\n where: CmsEntryListWhere;\n}\n/**\n * Latest and published are specific in Elasticsearch to that extend that they are tagged in the __type property.\n * We allow either published or either latest.\n * Latest is used in the manage API and published in the read API.\n *\n *\n * We add the query.filter terms because we do not need scored search here and it is a bit faster.\n */\nexport const createInitialQuery = (params: Params): OpenSearchBoolQueryConfig => {\n const { model, where } = params;\n\n const query = createBaseQuery();\n\n /**\n * When ES index is shared between tenants, we need to filter records by tenant ID\n *\n * TODO determine if we want to search across tenants in shared index?\n */\n const sharedIndex = isSharedElasticsearchIndex();\n if (sharedIndex) {\n /**\n * Tenant for the filtering is taken from the model.\n *\n * TODO determine if we want to send it in the \"where\" parameter?\n */\n query.filter.push({\n term: {\n \"tenant.keyword\": model.tenant\n }\n });\n /**\n * Also, we must search only in selected model.\n */\n query.filter.push({\n term: {\n \"modelId.keyword\": model.modelId\n }\n });\n }\n\n /**\n * We must transform published and latest where args into something that is understandable by our Elasticsearch\n */\n if (where.published === true) {\n query.filter.push({\n term: {\n \"__type.keyword\": createPublishedRecordType()\n }\n });\n } else if (where.latest === true) {\n query.filter.push({\n term: {\n \"__type.keyword\": createLatestRecordType()\n }\n });\n }\n //\n /**\n * We do not allow filtering without the published or latest parameter.\n * Also, we do not want to set the default one, as there is a large possibility for user error when filtering.\n */\n else {\n throw new WebinyError(\n `Cannot call Elasticsearch query when not setting \"published\" or \"latest\".`,\n \"OPENSEARCH_UNSUPPORTED_QUERY\",\n {\n where\n }\n );\n }\n /**\n * We need to remove fields that actually do not exist on the record - it will break otherwise.\n * This will modify the original object, which is what we want.\n */\n delete where.published;\n delete where.latest;\n\n return query;\n};\n"],"names":["createBaseQuery","createInitialQuery","params","model","where","query","sharedIndex","isSharedElasticsearchIndex","createPublishedRecordType","createLatestRecordType","WebinyError"],"mappings":";;;AAMO,MAAMA,kBAAkB,IACpB;QACH,MAAM,EAAE;QACR,UAAU,EAAE;QACZ,QAAQ,EAAE;QACV,QAAQ,EAAE;IACd;AAeG,MAAMC,qBAAqB,CAACC;IAC/B,MAAM,EAAEC,KAAK,EAAEC,KAAK,EAAE,GAAGF;IAEzB,MAAMG,QAAQL;IAOd,MAAMM,cAAcC;IACpB,IAAID,aAAa;QAMbD,MAAM,MAAM,CAAC,IAAI,CAAC;YACd,MAAM;gBACF,kBAAkBF,MAAM,MAAM;YAClC;QACJ;QAIAE,MAAM,MAAM,CAAC,IAAI,CAAC;YACd,MAAM;gBACF,mBAAmBF,MAAM,OAAO;YACpC;QACJ;IACJ;IAKA,IAAIC,AAAoB,SAApBA,MAAM,SAAS,EACfC,MAAM,MAAM,CAAC,IAAI,CAAC;QACd,MAAM;YACF,kBAAkBG;QACtB;IACJ;SACG,IAAIJ,AAAiB,SAAjBA,MAAM,MAAM,EACnBC,MAAM,MAAM,CAAC,IAAI,CAAC;QACd,MAAM;YACF,kBAAkBI;QACtB;IACJ;SAQA,MAAM,IAAIC,MACN,6EACA,gCACA;QACIN;IACJ;IAOR,OAAOA,MAAM,SAAS;IACtB,OAAOA,MAAM,MAAM;IAEnB,OAAOC;AACX"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { getBaseFieldType } from "@webiny/api-headless-cms/utils/getBaseFieldType.js";
|
|
2
|
+
const noKeywordFields = [
|
|
3
|
+
"date",
|
|
4
|
+
"datetime",
|
|
5
|
+
"number",
|
|
6
|
+
"boolean"
|
|
7
|
+
];
|
|
8
|
+
const hasKeyword = (field)=>{
|
|
9
|
+
const fieldType = getBaseFieldType(field);
|
|
10
|
+
if (noKeywordFields.includes(fieldType)) return false;
|
|
11
|
+
if (field.unmappedType) return false;
|
|
12
|
+
if (false === field.keyword) return false;
|
|
13
|
+
return true;
|
|
14
|
+
};
|
|
15
|
+
export { hasKeyword };
|
|
16
|
+
|
|
17
|
+
//# sourceMappingURL=keyword.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operations/entry/elasticsearch/keyword.js","sources":["../../../../src/operations/entry/elasticsearch/keyword.ts"],"sourcesContent":["import type { ModelField } from \"./types.js\";\nimport { getBaseFieldType } from \"@webiny/api-headless-cms/utils/getBaseFieldType.js\";\n\nconst noKeywordFields: string[] = [\"date\", \"datetime\", \"number\", \"boolean\"];\nexport const hasKeyword = (field: ModelField): boolean => {\n const fieldType = getBaseFieldType(field);\n /**\n * We defined some field types that MUST have no keyword added to the field path\n */\n if (noKeywordFields.includes(fieldType)) {\n return false;\n }\n /**\n * If field has unmapped type defined, do not add keyword.\n */\n //\n else if (field.unmappedType) {\n return false;\n }\n /**\n * And if specifically defined that field has no keyword, do not add it.\n */\n //\n else if (field.keyword === false) {\n return false;\n }\n /**\n * All other fields have keyword added.\n */\n return true;\n};\n"],"names":["noKeywordFields","hasKeyword","field","fieldType","getBaseFieldType"],"mappings":";AAGA,MAAMA,kBAA4B;IAAC;IAAQ;IAAY;IAAU;CAAU;AACpE,MAAMC,aAAa,CAACC;IACvB,MAAMC,YAAYC,iBAAiBF;IAInC,IAAIF,gBAAgB,QAAQ,CAACG,YACzB,OAAO;IAMN,IAAID,MAAM,YAAY,EACvB,OAAO;IAMN,IAAIA,AAAkB,UAAlBA,MAAM,OAAO,EAClB,OAAO;IAKX,OAAO;AACX"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { PluginsContainer } from "@webiny/plugins";
|
|
2
|
+
import type { OpenSearchQueryBuilderOperatorPlugins } from "../types.js";
|
|
3
|
+
interface Params {
|
|
4
|
+
plugins: PluginsContainer;
|
|
5
|
+
}
|
|
6
|
+
export declare const createOperatorPluginList: (params: Params) => OpenSearchQueryBuilderOperatorPlugins;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { OpenSearchQueryBuilderOperatorPlugin } from "@webiny/api-opensearch";
|
|
2
|
+
const createOperatorPluginList = (params)=>{
|
|
3
|
+
const { plugins } = params;
|
|
4
|
+
return plugins.byType(OpenSearchQueryBuilderOperatorPlugin.type).reduce((acc, plugin)=>{
|
|
5
|
+
const operator = plugin.getOperator();
|
|
6
|
+
if (!!acc[operator] && (plugin.name || "").match(/\.default$/)) return acc;
|
|
7
|
+
acc[operator] = plugin;
|
|
8
|
+
return acc;
|
|
9
|
+
}, {});
|
|
10
|
+
};
|
|
11
|
+
export { createOperatorPluginList };
|
|
12
|
+
|
|
13
|
+
//# sourceMappingURL=operator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operations/entry/elasticsearch/plugins/operator.js","sources":["../../../../../src/operations/entry/elasticsearch/plugins/operator.ts"],"sourcesContent":["import type { PluginsContainer } from \"@webiny/plugins\";\nimport { OpenSearchQueryBuilderOperatorPlugin } from \"@webiny/api-opensearch\";\nimport type { OpenSearchQueryBuilderOperatorPlugins } from \"../types.js\";\n\ninterface Params {\n plugins: PluginsContainer;\n}\nexport const createOperatorPluginList = (params: Params): OpenSearchQueryBuilderOperatorPlugins => {\n const { plugins } = params;\n /**\n * We always set the last one operator plugin added.\n * This way user can override the plugins.\n */\n return plugins\n .byType<OpenSearchQueryBuilderOperatorPlugin>(OpenSearchQueryBuilderOperatorPlugin.type)\n .reduce<OpenSearchQueryBuilderOperatorPlugins>((acc, plugin) => {\n const operator = plugin.getOperator();\n /**\n * We also only allow the override of the plugins if the new plugin is NOT a default one.\n * If a user sets the plugin name ending with .default, we cannot do anything about it.\n */\n if (!!acc[operator] && (plugin.name || \"\").match(/\\.default$/)) {\n return acc;\n }\n acc[operator] = plugin;\n return acc;\n }, {});\n};\n"],"names":["createOperatorPluginList","params","plugins","OpenSearchQueryBuilderOperatorPlugin","acc","plugin","operator"],"mappings":";AAOO,MAAMA,2BAA2B,CAACC;IACrC,MAAM,EAAEC,OAAO,EAAE,GAAGD;IAKpB,OAAOC,QACF,MAAM,CAAuCC,qCAAqC,IAAI,EACtF,MAAM,CAAwC,CAACC,KAAKC;QACjD,MAAMC,WAAWD,OAAO,WAAW;QAKnC,IAAI,CAAC,CAACD,GAAG,CAACE,SAAS,IAAKD,AAAAA,CAAAA,OAAO,IAAI,IAAI,EAAC,EAAG,KAAK,CAAC,eAC7C,OAAOD;QAEXA,GAAG,CAACE,SAAS,GAAGD;QAChB,OAAOD;IACX,GAAG,CAAC;AACZ"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
const IGNORED_ES_SEARCH_EXCEPTIONS = [
|
|
2
|
+
"index_not_found_exception",
|
|
3
|
+
"search_phase_execution_exception"
|
|
4
|
+
];
|
|
5
|
+
const shouldIgnoreEsResponseError = (error)=>IGNORED_ES_SEARCH_EXCEPTIONS.some((ignoredMessage)=>error.message.includes(ignoredMessage));
|
|
6
|
+
export { shouldIgnoreEsResponseError };
|
|
7
|
+
|
|
8
|
+
//# sourceMappingURL=shouldIgnoreEsResponseError.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operations/entry/elasticsearch/shouldIgnoreEsResponseError.js","sources":["../../../../src/operations/entry/elasticsearch/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.some(ignoredMessage =>\n error.message.includes(ignoredMessage)\n );\n};\n"],"names":["IGNORED_ES_SEARCH_EXCEPTIONS","shouldIgnoreEsResponseError","error","ignoredMessage"],"mappings":"AAEA,MAAMA,+BAA+B;IACjC;IACA;CACH;AAEM,MAAMC,8BAA8B,CAACC,QACjCF,6BAA6B,IAAI,CAACG,CAAAA,iBACrCD,MAAM,OAAO,CAAC,QAAQ,CAACC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Sort as OpenSearchSort } from "@webiny/api-opensearch/types.js";
|
|
2
|
+
import type { CmsEntryListSort, CmsModel } from "@webiny/api-headless-cms/types/index.js";
|
|
3
|
+
import type { ModelFields } from "./types.js";
|
|
4
|
+
import type { CmsEntryOpenSearchValueSearchRegistry } from "../../../features/CmsEntryOpenSearchValueSearch/index.js";
|
|
5
|
+
interface Params {
|
|
6
|
+
sort?: CmsEntryListSort;
|
|
7
|
+
modelFields: ModelFields;
|
|
8
|
+
model: CmsModel;
|
|
9
|
+
valueSearchRegistry: CmsEntryOpenSearchValueSearchRegistry.Interface;
|
|
10
|
+
}
|
|
11
|
+
export declare const createElasticsearchSort: (params: Params) => OpenSearchSort;
|
|
12
|
+
export {};
|