@webiny/api-headless-cms-ddb-es 0.0.0-mt-3 → 0.0.0-unstable.06b2ede40f
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/configurations.d.ts +15 -8
- package/configurations.js +29 -12
- package/configurations.js.map +1 -0
- package/definitions/entry.d.ts +6 -5
- package/definitions/entry.js +111 -20
- package/definitions/entry.js.map +1 -0
- package/definitions/entryElasticsearch.d.ts +6 -5
- package/definitions/entryElasticsearch.js +11 -16
- package/definitions/entryElasticsearch.js.map +1 -0
- package/definitions/group.d.ts +6 -5
- package/definitions/group.js +8 -16
- package/definitions/group.js.map +1 -0
- package/definitions/model.d.ts +6 -5
- package/definitions/model.js +30 -16
- package/definitions/model.js.map +1 -0
- package/definitions/system.d.ts +6 -5
- package/definitions/system.js +8 -16
- package/definitions/system.js.map +1 -0
- package/definitions/table.d.ts +6 -6
- package/definitions/table.js +7 -6
- package/definitions/table.js.map +1 -0
- package/definitions/tableElasticsearch.d.ts +6 -6
- package/definitions/tableElasticsearch.js +7 -6
- package/definitions/tableElasticsearch.js.map +1 -0
- package/dynamoDb/index.d.ts +2 -1
- package/dynamoDb/index.js +10 -12
- package/dynamoDb/index.js.map +1 -0
- package/dynamoDb/storage/longText.d.ts +7 -4
- package/dynamoDb/storage/longText.js +75 -62
- package/dynamoDb/storage/longText.js.map +1 -0
- package/dynamoDb/storage/richText.d.ts +2 -8
- package/dynamoDb/storage/richText.js +49 -100
- package/dynamoDb/storage/richText.js.map +1 -0
- package/elasticsearch/createElasticsearchIndex.d.ts +9 -0
- package/elasticsearch/createElasticsearchIndex.js +40 -0
- package/elasticsearch/createElasticsearchIndex.js.map +1 -0
- package/elasticsearch/deleteElasticsearchIndex.d.ts +8 -0
- package/elasticsearch/deleteElasticsearchIndex.js +38 -0
- package/elasticsearch/deleteElasticsearchIndex.js.map +1 -0
- package/elasticsearch/index.d.ts +1 -1
- package/elasticsearch/index.js +3 -6
- package/elasticsearch/index.js.map +1 -0
- package/elasticsearch/indexing/dateTimeIndexing.d.ts +1 -1
- package/elasticsearch/indexing/dateTimeIndexing.js +21 -22
- package/elasticsearch/indexing/dateTimeIndexing.js.map +1 -0
- package/elasticsearch/indexing/defaultFieldIndexing.d.ts +1 -1
- package/elasticsearch/indexing/defaultFieldIndexing.js +17 -10
- package/elasticsearch/indexing/defaultFieldIndexing.js.map +1 -0
- package/elasticsearch/indexing/index.js +5 -11
- package/elasticsearch/indexing/index.js.map +1 -0
- package/elasticsearch/indexing/jsonIndexing.d.ts +2 -0
- package/elasticsearch/indexing/jsonIndexing.js +28 -0
- package/elasticsearch/indexing/jsonIndexing.js.map +1 -0
- package/elasticsearch/indexing/longTextIndexing.d.ts +5 -1
- package/elasticsearch/indexing/longTextIndexing.js +16 -10
- package/elasticsearch/indexing/longTextIndexing.js.map +1 -0
- package/elasticsearch/indexing/numberIndexing.d.ts +1 -1
- package/elasticsearch/indexing/numberIndexing.js +2 -9
- package/elasticsearch/indexing/numberIndexing.js.map +1 -0
- package/elasticsearch/indexing/objectIndexing.d.ts +10 -1
- package/elasticsearch/indexing/objectIndexing.js +37 -36
- package/elasticsearch/indexing/objectIndexing.js.map +1 -0
- package/elasticsearch/indexing/richTextIndexing.d.ts +1 -1
- package/elasticsearch/indexing/richTextIndexing.js +2 -5
- package/elasticsearch/indexing/richTextIndexing.js.map +1 -0
- package/elasticsearch/indices/base.d.ts +2 -0
- package/elasticsearch/indices/base.js +13 -0
- package/elasticsearch/indices/base.js.map +1 -0
- package/elasticsearch/indices/index.d.ts +1 -0
- package/elasticsearch/indices/index.js +14 -0
- package/elasticsearch/indices/index.js.map +1 -0
- package/elasticsearch/indices/japanese.d.ts +2 -0
- package/elasticsearch/indices/japanese.js +14 -0
- package/elasticsearch/indices/japanese.js.map +1 -0
- package/elasticsearch/search/index.d.ts +2 -2
- package/elasticsearch/search/index.js +6 -9
- package/elasticsearch/search/index.js.map +1 -0
- package/elasticsearch/search/refSearch.d.ts +2 -3
- package/elasticsearch/search/refSearch.js +24 -17
- package/elasticsearch/search/refSearch.js.map +1 -0
- package/elasticsearch/search/searchableJson.d.ts +2 -0
- package/elasticsearch/search/searchableJson.js +60 -0
- package/elasticsearch/search/searchableJson.js.map +1 -0
- package/elasticsearch/search/timeSearch.d.ts +2 -3
- package/elasticsearch/search/timeSearch.js +18 -16
- package/elasticsearch/search/timeSearch.js.map +1 -0
- package/helpers/entryIndexHelpers.d.ts +3 -3
- package/helpers/entryIndexHelpers.js +59 -58
- package/helpers/entryIndexHelpers.js.map +1 -0
- package/helpers/fieldIdentifier.d.ts +6 -0
- package/helpers/fieldIdentifier.js +43 -0
- package/helpers/fieldIdentifier.js.map +1 -0
- package/helpers/index.d.ts +1 -1
- package/helpers/index.js +11 -13
- package/helpers/index.js.map +1 -0
- package/index.d.ts +2 -1
- package/index.js +132 -78
- package/index.js.map +1 -0
- package/operations/entry/dataLoader/DataLoaderCache.d.ts +17 -0
- package/operations/entry/dataLoader/DataLoaderCache.js +41 -0
- package/operations/entry/dataLoader/DataLoaderCache.js.map +1 -0
- package/operations/entry/dataLoader/constants.d.ts +1 -0
- package/operations/entry/dataLoader/constants.js +10 -0
- package/operations/entry/dataLoader/constants.js.map +1 -0
- package/operations/entry/dataLoader/createBatchScheduleFn.d.ts +8 -0
- package/operations/entry/dataLoader/createBatchScheduleFn.js +25 -0
- package/operations/entry/dataLoader/createBatchScheduleFn.js.map +1 -0
- package/operations/entry/dataLoader/getAllEntryRevisions.d.ts +4 -0
- package/operations/entry/dataLoader/getAllEntryRevisions.js +45 -0
- package/operations/entry/dataLoader/getAllEntryRevisions.js.map +1 -0
- package/operations/entry/dataLoader/getLatestRevisionByEntryId.d.ts +4 -0
- package/operations/entry/dataLoader/getLatestRevisionByEntryId.js +52 -0
- package/operations/entry/dataLoader/getLatestRevisionByEntryId.js.map +1 -0
- package/operations/entry/dataLoader/getPublishedRevisionByEntryId.d.ts +4 -0
- package/operations/entry/dataLoader/getPublishedRevisionByEntryId.js +52 -0
- package/operations/entry/dataLoader/getPublishedRevisionByEntryId.js.map +1 -0
- package/operations/entry/dataLoader/getRevisionById.d.ts +4 -0
- package/operations/entry/dataLoader/getRevisionById.js +62 -0
- package/operations/entry/dataLoader/getRevisionById.js.map +1 -0
- package/operations/entry/dataLoader/index.d.ts +8 -0
- package/operations/entry/dataLoader/index.js +40 -0
- package/operations/entry/dataLoader/index.js.map +1 -0
- package/operations/entry/dataLoader/types.d.ts +6 -0
- package/operations/entry/dataLoader/types.js +7 -0
- package/operations/entry/dataLoader/types.js.map +1 -0
- package/operations/entry/dataLoaders.d.ts +21 -38
- package/operations/entry/dataLoaders.js +59 -290
- package/operations/entry/dataLoaders.js.map +1 -0
- package/operations/entry/elasticsearch/assignMinimumShouldMatchToQuery.d.ts +18 -0
- package/operations/entry/elasticsearch/assignMinimumShouldMatchToQuery.js +34 -0
- package/operations/entry/elasticsearch/assignMinimumShouldMatchToQuery.js.map +1 -0
- package/operations/entry/elasticsearch/body.d.ts +13 -0
- package/operations/entry/elasticsearch/body.js +142 -0
- package/operations/entry/elasticsearch/body.js.map +1 -0
- package/operations/entry/elasticsearch/fields.d.ts +10 -0
- package/operations/entry/elasticsearch/fields.js +315 -0
- package/operations/entry/elasticsearch/fields.js.map +1 -0
- package/operations/entry/elasticsearch/filtering/applyFiltering.d.ts +8 -0
- package/operations/entry/elasticsearch/filtering/applyFiltering.js +60 -0
- package/operations/entry/elasticsearch/filtering/applyFiltering.js.map +1 -0
- package/operations/entry/elasticsearch/filtering/exec.d.ts +17 -0
- package/operations/entry/elasticsearch/filtering/exec.js +175 -0
- package/operations/entry/elasticsearch/filtering/exec.js.map +1 -0
- package/operations/entry/elasticsearch/filtering/index.d.ts +1 -0
- package/operations/entry/elasticsearch/filtering/index.js +18 -0
- package/operations/entry/elasticsearch/filtering/index.js.map +1 -0
- package/operations/entry/elasticsearch/filtering/path.d.ts +16 -0
- package/operations/entry/elasticsearch/filtering/path.js +48 -0
- package/operations/entry/elasticsearch/filtering/path.js.map +1 -0
- package/operations/entry/elasticsearch/filtering/plugins/defaultFilterPlugin.d.ts +2 -0
- package/operations/entry/elasticsearch/filtering/plugins/defaultFilterPlugin.js +30 -0
- package/operations/entry/elasticsearch/filtering/plugins/defaultFilterPlugin.js.map +1 -0
- package/operations/entry/elasticsearch/filtering/plugins/index.d.ts +1 -0
- package/operations/entry/elasticsearch/filtering/plugins/index.js +15 -0
- package/operations/entry/elasticsearch/filtering/plugins/index.js.map +1 -0
- package/operations/entry/elasticsearch/filtering/plugins/objectFilterPlugin.d.ts +2 -0
- package/operations/entry/elasticsearch/filtering/plugins/objectFilterPlugin.js +69 -0
- package/operations/entry/elasticsearch/filtering/plugins/objectFilterPlugin.js.map +1 -0
- package/operations/entry/elasticsearch/filtering/plugins/refFilterPlugin.d.ts +2 -0
- package/operations/entry/elasticsearch/filtering/plugins/refFilterPlugin.js +57 -0
- package/operations/entry/elasticsearch/filtering/plugins/refFilterPlugin.js.map +1 -0
- package/operations/entry/elasticsearch/filtering/populated.d.ts +2 -0
- package/operations/entry/elasticsearch/filtering/populated.js +25 -0
- package/operations/entry/elasticsearch/filtering/populated.js.map +1 -0
- package/operations/entry/elasticsearch/filtering/values.d.ts +2 -0
- package/operations/entry/elasticsearch/filtering/values.js +24 -0
- package/operations/entry/elasticsearch/filtering/values.js.map +1 -0
- package/operations/entry/elasticsearch/fullTextSearch.d.ts +12 -0
- package/operations/entry/elasticsearch/fullTextSearch.js +91 -0
- package/operations/entry/elasticsearch/fullTextSearch.js.map +1 -0
- package/operations/entry/elasticsearch/fullTextSearchFields.d.ts +8 -0
- package/operations/entry/elasticsearch/fullTextSearchFields.js +27 -0
- package/operations/entry/elasticsearch/fullTextSearchFields.js.map +1 -0
- package/operations/entry/elasticsearch/initialQuery.d.ts +17 -0
- package/operations/entry/elasticsearch/initialQuery.js +106 -0
- package/operations/entry/elasticsearch/initialQuery.js.map +1 -0
- package/operations/entry/elasticsearch/keyword.d.ts +2 -0
- package/operations/entry/elasticsearch/keyword.js +36 -0
- package/operations/entry/elasticsearch/keyword.js.map +1 -0
- package/operations/entry/elasticsearch/logIgnoredEsResponseError.d.ts +9 -0
- package/operations/entry/elasticsearch/logIgnoredEsResponseError.js +26 -0
- package/operations/entry/elasticsearch/logIgnoredEsResponseError.js.map +1 -0
- package/operations/entry/elasticsearch/plugins/bodyModifier.d.ts +9 -0
- package/operations/entry/elasticsearch/plugins/bodyModifier.js +18 -0
- package/operations/entry/elasticsearch/plugins/bodyModifier.js.map +1 -0
- package/operations/entry/elasticsearch/plugins/operator.d.ts +8 -0
- package/operations/entry/elasticsearch/plugins/operator.js +39 -0
- package/operations/entry/elasticsearch/plugins/operator.js.map +1 -0
- package/operations/entry/elasticsearch/plugins/queryModifier.d.ts +9 -0
- package/operations/entry/elasticsearch/plugins/queryModifier.js +18 -0
- package/operations/entry/elasticsearch/plugins/queryModifier.js.map +1 -0
- package/operations/entry/elasticsearch/plugins/search.d.ts +7 -0
- package/{helpers/searchPluginsList.js → operations/entry/elasticsearch/plugins/search.js} +9 -9
- package/operations/entry/elasticsearch/plugins/search.js.map +1 -0
- package/operations/entry/elasticsearch/plugins/sortModifier.d.ts +9 -0
- package/operations/entry/elasticsearch/plugins/sortModifier.js +18 -0
- package/operations/entry/elasticsearch/plugins/sortModifier.js.map +1 -0
- package/operations/entry/elasticsearch/shouldIgnoreEsResponseError.d.ts +2 -0
- package/operations/entry/elasticsearch/shouldIgnoreEsResponseError.js +13 -0
- package/operations/entry/elasticsearch/shouldIgnoreEsResponseError.js.map +1 -0
- package/operations/entry/elasticsearch/sort.d.ts +12 -0
- package/operations/entry/elasticsearch/sort.js +89 -0
- package/operations/entry/elasticsearch/sort.js.map +1 -0
- package/operations/entry/elasticsearch/transformValueForSearch.d.ts +16 -0
- package/operations/entry/elasticsearch/transformValueForSearch.js +32 -0
- package/operations/entry/elasticsearch/transformValueForSearch.js.map +1 -0
- package/operations/entry/elasticsearch/types.d.ts +41 -0
- package/operations/entry/elasticsearch/types.js +7 -0
- package/operations/entry/elasticsearch/types.js.map +1 -0
- package/operations/entry/index.d.ts +6 -8
- package/operations/entry/index.js +1422 -693
- package/operations/entry/index.js.map +1 -0
- package/operations/entry/keys.js +2 -9
- package/operations/entry/keys.js.map +1 -0
- package/operations/entry/recordType.d.ts +3 -0
- package/operations/entry/recordType.js +20 -0
- package/operations/entry/recordType.js.map +1 -0
- package/operations/entry/transformations/convertEntryKeys.d.ts +8 -0
- package/operations/entry/transformations/convertEntryKeys.js +38 -0
- package/operations/entry/transformations/convertEntryKeys.js.map +1 -0
- package/operations/entry/transformations/index.d.ts +29 -0
- package/operations/entry/transformations/index.js +127 -0
- package/operations/entry/transformations/index.js.map +1 -0
- package/operations/entry/transformations/modifyEntryValues.d.ts +58 -0
- package/operations/entry/transformations/modifyEntryValues.js +28 -0
- package/operations/entry/transformations/modifyEntryValues.js.map +1 -0
- package/operations/entry/transformations/transformEntryKeys.d.ts +11 -0
- package/operations/entry/transformations/transformEntryKeys.js +27 -0
- package/operations/entry/transformations/transformEntryKeys.js.map +1 -0
- package/operations/entry/transformations/transformEntryToIndex.d.ts +10 -0
- package/operations/entry/transformations/transformEntryToIndex.js +31 -0
- package/operations/entry/transformations/transformEntryToIndex.js.map +1 -0
- package/operations/group/index.d.ts +5 -5
- package/operations/group/index.js +40 -63
- package/operations/group/index.js.map +1 -0
- package/operations/model/index.d.ts +5 -5
- package/operations/model/index.js +56 -78
- package/operations/model/index.js.map +1 -0
- package/operations/system/index.d.ts +4 -4
- package/operations/system/index.js +20 -31
- package/operations/system/index.js.map +1 -0
- package/operations/system/indexes.d.ts +10 -0
- package/operations/system/indexes.js +41 -0
- package/operations/system/indexes.js.map +1 -0
- package/package.json +38 -40
- package/plugins/CmsElasticsearchModelFieldPlugin.d.ts +69 -0
- package/plugins/CmsElasticsearchModelFieldPlugin.js +52 -0
- package/plugins/CmsElasticsearchModelFieldPlugin.js.map +1 -0
- package/plugins/CmsEntryElasticsearchBodyModifierPlugin.d.ts +9 -4
- package/plugins/CmsEntryElasticsearchBodyModifierPlugin.js +10 -13
- package/plugins/CmsEntryElasticsearchBodyModifierPlugin.js.map +1 -0
- package/plugins/CmsEntryElasticsearchFullTextSearchPlugin.d.ts +23 -0
- package/plugins/CmsEntryElasticsearchFullTextSearchPlugin.js +27 -0
- package/plugins/CmsEntryElasticsearchFullTextSearchPlugin.js.map +1 -0
- package/plugins/CmsEntryElasticsearchIndexPlugin.d.ts +4 -0
- package/plugins/CmsEntryElasticsearchIndexPlugin.js +13 -0
- package/plugins/CmsEntryElasticsearchIndexPlugin.js.map +1 -0
- package/plugins/CmsEntryElasticsearchQueryBuilderValueSearchPlugin.d.ts +32 -0
- package/plugins/CmsEntryElasticsearchQueryBuilderValueSearchPlugin.js +40 -0
- package/plugins/CmsEntryElasticsearchQueryBuilderValueSearchPlugin.js.map +1 -0
- package/plugins/CmsEntryElasticsearchQueryModifierPlugin.d.ts +6 -4
- package/plugins/CmsEntryElasticsearchQueryModifierPlugin.js +10 -13
- package/plugins/CmsEntryElasticsearchQueryModifierPlugin.js.map +1 -0
- package/plugins/CmsEntryElasticsearchSortModifierPlugin.d.ts +6 -4
- package/plugins/CmsEntryElasticsearchSortModifierPlugin.js +10 -13
- package/plugins/CmsEntryElasticsearchSortModifierPlugin.js.map +1 -0
- package/plugins/CmsEntryElasticsearchValuesModifier.d.ts +33 -0
- package/plugins/CmsEntryElasticsearchValuesModifier.js +50 -0
- package/plugins/CmsEntryElasticsearchValuesModifier.js.map +1 -0
- package/plugins/CmsEntryFilterPlugin.d.ts +49 -0
- package/plugins/CmsEntryFilterPlugin.js +22 -0
- package/plugins/CmsEntryFilterPlugin.js.map +1 -0
- package/plugins/index.d.ts +8 -0
- package/plugins/index.js +95 -0
- package/plugins/index.js.map +1 -0
- package/tasks/createIndexTaskPlugin.d.ts +2 -0
- package/tasks/createIndexTaskPlugin.js +67 -0
- package/tasks/createIndexTaskPlugin.js.map +1 -0
- package/types.d.ts +30 -52
- package/types.js +5 -23
- package/types.js.map +1 -0
- package/values/NoValueContainer.d.ts +5 -0
- package/values/NoValueContainer.js +20 -0
- package/values/NoValueContainer.js.map +1 -0
- package/definitions/settings.d.ts +0 -8
- package/definitions/settings.js +0 -62
- package/dynamoDb/storage/date.d.ts +0 -3
- package/dynamoDb/storage/date.js +0 -65
- package/helpers/createElasticsearchQueryBody.d.ts +0 -11
- package/helpers/createElasticsearchQueryBody.js +0 -375
- package/helpers/fields.d.ts +0 -77
- package/helpers/fields.js +0 -174
- package/helpers/operatorPluginsList.d.ts +0 -7
- package/helpers/operatorPluginsList.js +0 -30
- package/helpers/searchPluginsList.d.ts +0 -6
- package/helpers/transformValueForSearch.d.ts +0 -9
- package/helpers/transformValueForSearch.js +0 -26
- package/operations/entry/elasticsearchFields.d.ts +0 -2
- package/operations/entry/elasticsearchFields.js +0 -32
- package/operations/entry/fields.d.ts +0 -3
- package/operations/entry/fields.js +0 -60
- package/operations/settings/index.d.ts +0 -6
- package/operations/settings/index.js +0 -141
- package/operations/system/createElasticsearchTemplate.d.ts +0 -5
- package/operations/system/createElasticsearchTemplate.js +0 -62
- package/plugins/CmsEntryElasticsearchFieldPlugin.d.ts +0 -12
- package/plugins/CmsEntryElasticsearchFieldPlugin.js +0 -24
- package/upgrades/index.d.ts +0 -2
- package/upgrades/index.js +0 -16
- package/upgrades/utils.d.ts +0 -1
- package/upgrades/utils.js +0 -16
- package/upgrades/v5.0.0/cleanDatabaseRecord.d.ts +0 -6
- package/upgrades/v5.0.0/cleanDatabaseRecord.js +0 -16
- package/upgrades/v5.0.0/createOldVersionIndiceName.d.ts +0 -2
- package/upgrades/v5.0.0/createOldVersionIndiceName.js +0 -12
- package/upgrades/v5.0.0/entryValueFixer.d.ts +0 -4
- package/upgrades/v5.0.0/entryValueFixer.js +0 -124
- package/upgrades/v5.0.0/fieldFinder.d.ts +0 -6
- package/upgrades/v5.0.0/fieldFinder.js +0 -42
- package/upgrades/v5.0.0/helpers.d.ts +0 -4
- package/upgrades/v5.0.0/helpers.js +0 -57
- package/upgrades/v5.0.0/index.d.ts +0 -4
- package/upgrades/v5.0.0/index.js +0 -232
- package/upgrades/v5.8.0/index.d.ts +0 -4
- package/upgrades/v5.8.0/index.js +0 -426
|
@@ -1,347 +1,116 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.DataLoadersHandler = void 0;
|
|
9
|
-
|
|
10
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
-
|
|
12
|
-
var _dataloader = _interopRequireDefault(require("dataloader"));
|
|
13
|
-
|
|
14
8
|
var _error = _interopRequireDefault(require("@webiny/error"));
|
|
15
|
-
|
|
16
|
-
var
|
|
17
|
-
|
|
18
|
-
var _keys = require("./keys");
|
|
19
|
-
|
|
20
|
-
var _cleanup = require("@webiny/db-dynamodb/utils/cleanup");
|
|
21
|
-
|
|
9
|
+
var _DataLoaderCache = require("./dataLoader/DataLoaderCache");
|
|
10
|
+
var _dataLoader = require("./dataLoader");
|
|
22
11
|
var _utils = require("@webiny/utils");
|
|
23
|
-
|
|
24
|
-
var _batchRead = require("@webiny/db-dynamodb/utils/batchRead");
|
|
25
|
-
|
|
26
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
27
|
-
|
|
28
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
29
|
-
|
|
30
|
-
const getAllEntryRevisions = params => {
|
|
31
|
-
const {
|
|
32
|
-
entity,
|
|
33
|
-
model
|
|
34
|
-
} = params;
|
|
35
|
-
const {
|
|
36
|
-
tenant,
|
|
37
|
-
locale
|
|
38
|
-
} = model;
|
|
39
|
-
return new _dataloader.default(async ids => {
|
|
40
|
-
const results = [];
|
|
41
|
-
|
|
42
|
-
for (const id of ids) {
|
|
43
|
-
const queryAllParams = {
|
|
44
|
-
entity,
|
|
45
|
-
partitionKey: (0, _keys.createPartitionKey)({
|
|
46
|
-
tenant,
|
|
47
|
-
locale,
|
|
48
|
-
id
|
|
49
|
-
}),
|
|
50
|
-
options: {
|
|
51
|
-
beginsWith: "REV#"
|
|
52
|
-
}
|
|
53
|
-
};
|
|
54
|
-
const items = await (0, _query.queryAll)(queryAllParams);
|
|
55
|
-
const entries = (0, _cleanup.cleanupItems)(entity, items);
|
|
56
|
-
results.push(entries);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
return results;
|
|
60
|
-
});
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
const getRevisionById = params => {
|
|
64
|
-
const {
|
|
65
|
-
entity,
|
|
66
|
-
model
|
|
67
|
-
} = params;
|
|
68
|
-
const {
|
|
69
|
-
locale,
|
|
70
|
-
tenant
|
|
71
|
-
} = model;
|
|
72
|
-
return new _dataloader.default(async ids => {
|
|
73
|
-
const queries = ids.reduce((collection, id) => {
|
|
74
|
-
const partitionKey = (0, _keys.createPartitionKey)({
|
|
75
|
-
tenant,
|
|
76
|
-
locale,
|
|
77
|
-
id
|
|
78
|
-
});
|
|
79
|
-
const {
|
|
80
|
-
version
|
|
81
|
-
} = (0, _utils.parseIdentifier)(id);
|
|
82
|
-
const sortKey = (0, _keys.createRevisionSortKey)({
|
|
83
|
-
version
|
|
84
|
-
});
|
|
85
|
-
const keys = `${partitionKey}__${sortKey}`;
|
|
86
|
-
|
|
87
|
-
if (collection[keys]) {
|
|
88
|
-
return collection;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
collection[keys] = entity.getBatch({
|
|
92
|
-
PK: partitionKey,
|
|
93
|
-
SK: sortKey
|
|
94
|
-
});
|
|
95
|
-
return collection;
|
|
96
|
-
}, {});
|
|
97
|
-
const records = await (0, _batchRead.batchReadAll)({
|
|
98
|
-
table: entity.table,
|
|
99
|
-
items: Object.values(queries)
|
|
100
|
-
});
|
|
101
|
-
const items = (0, _cleanup.cleanupItems)(entity, records);
|
|
102
|
-
return ids.map(id => {
|
|
103
|
-
return items.filter(item => {
|
|
104
|
-
return id === item.id;
|
|
105
|
-
});
|
|
106
|
-
});
|
|
107
|
-
});
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
const getPublishedRevisionByEntryId = params => {
|
|
111
|
-
const {
|
|
112
|
-
entity,
|
|
113
|
-
model
|
|
114
|
-
} = params;
|
|
115
|
-
const {
|
|
116
|
-
locale,
|
|
117
|
-
tenant
|
|
118
|
-
} = model;
|
|
119
|
-
const publishedKey = (0, _keys.createPublishedSortKey)();
|
|
120
|
-
return new _dataloader.default(async ids => {
|
|
121
|
-
const queries = ids.reduce((collection, id) => {
|
|
122
|
-
const partitionKey = (0, _keys.createPartitionKey)({
|
|
123
|
-
tenant,
|
|
124
|
-
locale,
|
|
125
|
-
id
|
|
126
|
-
});
|
|
127
|
-
|
|
128
|
-
if (collection[partitionKey]) {
|
|
129
|
-
return collection;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
collection[partitionKey] = entity.getBatch({
|
|
133
|
-
PK: partitionKey,
|
|
134
|
-
SK: publishedKey
|
|
135
|
-
});
|
|
136
|
-
return collection;
|
|
137
|
-
}, {});
|
|
138
|
-
const records = await (0, _batchRead.batchReadAll)({
|
|
139
|
-
table: entity.table,
|
|
140
|
-
items: Object.values(queries)
|
|
141
|
-
});
|
|
142
|
-
const items = (0, _cleanup.cleanupItems)(entity, records);
|
|
143
|
-
return ids.map(id => {
|
|
144
|
-
const {
|
|
145
|
-
id: entryId
|
|
146
|
-
} = (0, _utils.parseIdentifier)(id);
|
|
147
|
-
return items.filter(item => {
|
|
148
|
-
return entryId === item.entryId;
|
|
149
|
-
});
|
|
150
|
-
});
|
|
151
|
-
});
|
|
152
|
-
};
|
|
153
|
-
|
|
154
|
-
const getLatestRevisionByEntryId = params => {
|
|
155
|
-
const {
|
|
156
|
-
entity,
|
|
157
|
-
model
|
|
158
|
-
} = params;
|
|
159
|
-
const {
|
|
160
|
-
locale,
|
|
161
|
-
tenant
|
|
162
|
-
} = model;
|
|
163
|
-
const latestKey = (0, _keys.createLatestSortKey)();
|
|
164
|
-
return new _dataloader.default(async ids => {
|
|
165
|
-
const queries = ids.reduce((collection, id) => {
|
|
166
|
-
const partitionKey = (0, _keys.createPartitionKey)({
|
|
167
|
-
tenant,
|
|
168
|
-
locale,
|
|
169
|
-
id
|
|
170
|
-
});
|
|
171
|
-
|
|
172
|
-
if (collection[partitionKey]) {
|
|
173
|
-
return collection;
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
collection[partitionKey] = entity.getBatch({
|
|
177
|
-
PK: partitionKey,
|
|
178
|
-
SK: latestKey
|
|
179
|
-
});
|
|
180
|
-
return collection;
|
|
181
|
-
}, {});
|
|
182
|
-
const records = await (0, _batchRead.batchReadAll)({
|
|
183
|
-
table: entity.table,
|
|
184
|
-
items: Object.values(queries)
|
|
185
|
-
});
|
|
186
|
-
const items = (0, _cleanup.cleanupItems)(entity, records);
|
|
187
|
-
return ids.map(id => {
|
|
188
|
-
const {
|
|
189
|
-
id: entryId
|
|
190
|
-
} = (0, _utils.parseIdentifier)(id);
|
|
191
|
-
return items.filter(item => {
|
|
192
|
-
return entryId === item.entryId;
|
|
193
|
-
});
|
|
194
|
-
});
|
|
195
|
-
});
|
|
196
|
-
};
|
|
197
|
-
|
|
198
|
-
const dataLoaders = {
|
|
199
|
-
getAllEntryRevisions,
|
|
200
|
-
getRevisionById,
|
|
201
|
-
getPublishedRevisionByEntryId,
|
|
202
|
-
getLatestRevisionByEntryId
|
|
203
|
-
};
|
|
204
|
-
const loaderNames = Object.keys(dataLoaders);
|
|
205
|
-
|
|
206
12
|
class DataLoadersHandler {
|
|
13
|
+
cache = new _DataLoaderCache.DataLoaderCache();
|
|
207
14
|
constructor(params) {
|
|
208
|
-
(0, _defineProperty2.default)(this, "loaders", new Map());
|
|
209
|
-
(0, _defineProperty2.default)(this, "entity", void 0);
|
|
210
15
|
this.entity = params.entity;
|
|
211
16
|
}
|
|
212
|
-
|
|
213
17
|
async getAllEntryRevisions(params) {
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
18
|
+
const ids = params.ids.map(id => {
|
|
19
|
+
const {
|
|
20
|
+
id: entryId
|
|
21
|
+
} = (0, _utils.parseIdentifier)(id);
|
|
22
|
+
return entryId;
|
|
23
|
+
});
|
|
24
|
+
return await this.loadMany("getAllEntryRevisions", params, ids);
|
|
219
25
|
}
|
|
220
|
-
|
|
221
26
|
async getRevisionById(params) {
|
|
222
27
|
return await this.loadMany("getRevisionById", params, params.ids);
|
|
223
28
|
}
|
|
224
|
-
|
|
225
|
-
clearRevisionById(params) {
|
|
226
|
-
this.clear("getRevisionById", params);
|
|
227
|
-
}
|
|
228
|
-
|
|
229
29
|
async getPublishedRevisionByEntryId(params) {
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
30
|
+
const ids = params.ids.map(id => {
|
|
31
|
+
const {
|
|
32
|
+
id: entryId
|
|
33
|
+
} = (0, _utils.parseIdentifier)(id);
|
|
34
|
+
return entryId;
|
|
35
|
+
});
|
|
36
|
+
return await this.loadMany("getPublishedRevisionByEntryId", params, ids);
|
|
235
37
|
}
|
|
236
|
-
|
|
237
38
|
async getLatestRevisionByEntryId(params) {
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
39
|
+
const ids = params.ids.map(id => {
|
|
40
|
+
const {
|
|
41
|
+
id: entryId
|
|
42
|
+
} = (0, _utils.parseIdentifier)(id);
|
|
43
|
+
return entryId;
|
|
44
|
+
});
|
|
45
|
+
return await this.loadMany("getLatestRevisionByEntryId", params, ids);
|
|
243
46
|
}
|
|
244
47
|
|
|
48
|
+
/**
|
|
49
|
+
* TODO @ts-refactor
|
|
50
|
+
* Maybe pass on the generics to DataLoader definition?
|
|
51
|
+
*/
|
|
245
52
|
getLoader(name, params) {
|
|
246
|
-
if (!dataLoaders[name]) {
|
|
247
|
-
throw new _error.default("Unknown data loader.", "UNKNOWN_DATA_LOADER", {
|
|
248
|
-
name
|
|
249
|
-
});
|
|
250
|
-
}
|
|
251
|
-
|
|
252
53
|
const {
|
|
253
54
|
model
|
|
254
55
|
} = params;
|
|
255
|
-
const {
|
|
256
|
-
tenant,
|
|
257
|
-
locale
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
if (
|
|
262
|
-
|
|
263
|
-
entity: this.entity
|
|
264
|
-
})));
|
|
56
|
+
const cacheParams = {
|
|
57
|
+
tenant: model.tenant,
|
|
58
|
+
locale: model.locale,
|
|
59
|
+
name
|
|
60
|
+
};
|
|
61
|
+
let loader = this.cache.getDataLoader(cacheParams);
|
|
62
|
+
if (loader) {
|
|
63
|
+
return loader;
|
|
265
64
|
}
|
|
266
|
-
|
|
267
|
-
|
|
65
|
+
const factory = (0, _dataLoader.getDataLoaderFactory)(name);
|
|
66
|
+
loader = factory({
|
|
67
|
+
entity: this.entity,
|
|
68
|
+
tenant: model.tenant,
|
|
69
|
+
locale: model.locale
|
|
70
|
+
});
|
|
71
|
+
this.cache.setDataLoader(cacheParams, loader);
|
|
72
|
+
return loader;
|
|
268
73
|
}
|
|
269
|
-
|
|
270
74
|
async loadMany(loader, params, ids) {
|
|
271
|
-
let results;
|
|
272
|
-
|
|
75
|
+
let results = [];
|
|
273
76
|
try {
|
|
274
77
|
results = await this.getLoader(loader, params).loadMany(ids);
|
|
275
|
-
|
|
276
78
|
if (Array.isArray(results) === true) {
|
|
277
79
|
return results.reduce((acc, res) => {
|
|
278
80
|
if (Array.isArray(res) === false) {
|
|
279
81
|
if (res && res.message) {
|
|
280
|
-
throw new _error.default(res.message, res.code,
|
|
82
|
+
throw new _error.default(res.message, res.code, {
|
|
83
|
+
...res,
|
|
281
84
|
data: JSON.stringify(res.data || {})
|
|
282
|
-
})
|
|
85
|
+
});
|
|
283
86
|
}
|
|
284
|
-
|
|
285
|
-
|
|
87
|
+
throw new _error.default("Result from the data loader must be an array of arrays which contain requested items.", "DATA_LOADER_RESULTS_ERROR", {
|
|
88
|
+
...params,
|
|
286
89
|
loader
|
|
287
|
-
})
|
|
90
|
+
});
|
|
288
91
|
}
|
|
289
|
-
|
|
290
92
|
acc.push(...res);
|
|
291
93
|
return acc;
|
|
292
94
|
}, []);
|
|
293
95
|
}
|
|
294
96
|
} catch (ex) {
|
|
295
|
-
throw new _error.default(ex.message || "Data loader error.", ex.code || "DATA_LOADER_ERROR",
|
|
296
|
-
error: ex
|
|
297
|
-
|
|
97
|
+
throw new _error.default(ex.message || "Data loader error.", ex.code || "DATA_LOADER_ERROR", {
|
|
98
|
+
error: ex,
|
|
99
|
+
...params,
|
|
298
100
|
loader,
|
|
299
101
|
ids
|
|
300
|
-
})
|
|
102
|
+
});
|
|
301
103
|
}
|
|
302
|
-
|
|
303
104
|
throw new _error.default(`Data loader did not return array of items or empty array.`, "INVALID_DATA_LOADER_RESULT", {
|
|
304
105
|
loader,
|
|
305
106
|
ids,
|
|
306
107
|
results
|
|
307
108
|
});
|
|
308
109
|
}
|
|
309
|
-
|
|
310
110
|
clearAll(params) {
|
|
311
|
-
|
|
312
|
-
const loader = this.getLoader(name, params);
|
|
313
|
-
loader.clearAll();
|
|
314
|
-
}
|
|
111
|
+
this.cache.clearAll(params?.model);
|
|
315
112
|
}
|
|
316
|
-
/**
|
|
317
|
-
* Helper to clear the cache for certain data loader.
|
|
318
|
-
* If entry is passed then clear target key only.
|
|
319
|
-
*/
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
clear(name, params) {
|
|
323
|
-
const {
|
|
324
|
-
entry
|
|
325
|
-
} = params;
|
|
326
|
-
const loader = this.getLoader(name, params);
|
|
327
|
-
|
|
328
|
-
if (!entry) {
|
|
329
|
-
loader.clearAll();
|
|
330
|
-
return;
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
loader.clear(entry.id);
|
|
334
|
-
const {
|
|
335
|
-
tenant,
|
|
336
|
-
locale
|
|
337
|
-
} = params.model;
|
|
338
|
-
loader.clear((0, _keys.createPartitionKey)({
|
|
339
|
-
tenant,
|
|
340
|
-
locale,
|
|
341
|
-
id: entry.id
|
|
342
|
-
}));
|
|
343
|
-
}
|
|
344
|
-
|
|
345
113
|
}
|
|
114
|
+
exports.DataLoadersHandler = DataLoadersHandler;
|
|
346
115
|
|
|
347
|
-
|
|
116
|
+
//# sourceMappingURL=dataLoaders.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_error","_interopRequireDefault","require","_DataLoaderCache","_dataLoader","_utils","DataLoadersHandler","cache","DataLoaderCache","constructor","params","entity","getAllEntryRevisions","ids","map","id","entryId","parseIdentifier","loadMany","getRevisionById","getPublishedRevisionByEntryId","getLatestRevisionByEntryId","getLoader","name","model","cacheParams","tenant","locale","loader","getDataLoader","factory","getDataLoaderFactory","setDataLoader","results","Array","isArray","reduce","acc","res","message","WebinyError","code","data","JSON","stringify","push","ex","error","clearAll","exports"],"sources":["dataLoaders.ts"],"sourcesContent":["import type DataLoader from \"dataloader\";\nimport WebinyError from \"@webiny/error\";\nimport type { CmsModel, CmsStorageEntry } from \"@webiny/api-headless-cms/types\";\nimport type { CacheKeyParams } from \"~/operations/entry/dataLoader/DataLoaderCache\";\nimport { DataLoaderCache } from \"~/operations/entry/dataLoader/DataLoaderCache\";\nimport type { Entity } from \"@webiny/db-dynamodb/toolbox\";\nimport type { DataLoaders } from \"~/operations/entry/dataLoader\";\nimport { getDataLoaderFactory } from \"~/operations/entry/dataLoader\";\nimport { parseIdentifier } from \"@webiny/utils\";\nimport type {\n DataLoadersHandlerInterface,\n DataLoadersHandlerInterfaceClearAllParams\n} from \"~/types\";\n\ninterface DataLoaderParams {\n model: Pick<CmsModel, \"tenant\" | \"locale\" | \"modelId\">;\n ids: readonly string[];\n}\n\ninterface GetLoaderParams {\n model: Pick<CmsModel, \"tenant\" | \"locale\" | \"modelId\">;\n}\n\ninterface DataLoadersHandlerParams {\n entity: Entity<any>;\n}\n\nexport interface ClearAllParams {\n model: Pick<CmsModel, \"tenant\" | \"locale\" | \"modelId\">;\n}\n\nexport class DataLoadersHandler implements DataLoadersHandlerInterface {\n private readonly entity: Entity<any>;\n private readonly cache: DataLoaderCache = new DataLoaderCache();\n\n public constructor(params: DataLoadersHandlerParams) {\n this.entity = params.entity;\n }\n\n public async getAllEntryRevisions(params: DataLoaderParams): Promise<CmsStorageEntry[]> {\n const ids = params.ids.map(id => {\n const { id: entryId } = parseIdentifier(id);\n return entryId;\n });\n return await this.loadMany(\"getAllEntryRevisions\", params, ids);\n }\n\n public async getRevisionById(params: DataLoaderParams): Promise<CmsStorageEntry[]> {\n return await this.loadMany(\"getRevisionById\", params, params.ids);\n }\n\n public async getPublishedRevisionByEntryId(\n params: DataLoaderParams\n ): Promise<CmsStorageEntry[]> {\n const ids = params.ids.map(id => {\n const { id: entryId } = parseIdentifier(id);\n return entryId;\n });\n return await this.loadMany(\"getPublishedRevisionByEntryId\", params, ids);\n }\n\n public async getLatestRevisionByEntryId(params: DataLoaderParams): Promise<CmsStorageEntry[]> {\n const ids = params.ids.map(id => {\n const { id: entryId } = parseIdentifier(id);\n return entryId;\n });\n return await this.loadMany(\"getLatestRevisionByEntryId\", params, ids);\n }\n\n /**\n * TODO @ts-refactor\n * Maybe pass on the generics to DataLoader definition?\n */\n private getLoader(name: DataLoaders, params: GetLoaderParams): DataLoader<any, any> {\n const { model } = params;\n const cacheParams: CacheKeyParams = {\n tenant: model.tenant,\n locale: model.locale,\n name\n };\n let loader = this.cache.getDataLoader(cacheParams);\n if (loader) {\n return loader;\n }\n const factory = getDataLoaderFactory(name);\n loader = factory({\n entity: this.entity,\n tenant: model.tenant,\n locale: model.locale\n });\n this.cache.setDataLoader(cacheParams, loader);\n return loader;\n }\n\n private async loadMany(\n loader: DataLoaders,\n params: GetLoaderParams,\n ids: readonly string[]\n ): Promise<CmsStorageEntry[]> {\n let results: any[] = [];\n try {\n results = await this.getLoader(loader, params).loadMany(ids);\n if (Array.isArray(results) === true) {\n return results.reduce((acc, res) => {\n if (Array.isArray(res) === false) {\n if (res && res.message) {\n throw new WebinyError(res.message, res.code, {\n ...res,\n data: JSON.stringify(res.data || {})\n });\n }\n throw new WebinyError(\n \"Result from the data loader must be an array of arrays which contain requested items.\",\n \"DATA_LOADER_RESULTS_ERROR\",\n {\n ...params,\n loader\n }\n );\n }\n acc.push(...res);\n return acc;\n }, []);\n }\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Data loader error.\",\n ex.code || \"DATA_LOADER_ERROR\",\n {\n error: ex,\n ...params,\n loader,\n ids\n }\n );\n }\n throw new WebinyError(\n `Data loader did not return array of items or empty array.`,\n \"INVALID_DATA_LOADER_RESULT\",\n {\n loader,\n ids,\n results\n }\n );\n }\n\n public clearAll(params?: DataLoadersHandlerInterfaceClearAllParams): void {\n this.cache.clearAll(params?.model);\n }\n}\n"],"mappings":";;;;;;;AACA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAGA,IAAAC,gBAAA,GAAAD,OAAA;AAGA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AAuBO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,IAAIC,cAAW,CAACF,GAAG,CAACC,OAAO,EAAED,GAAG,CAACG,IAAI,EAAE;gBACzC,GAAGH,GAAG;gBACNI,IAAI,EAAEC,IAAI,CAACC,SAAS,CAACN,GAAG,CAACI,IAAI,IAAI,CAAC,CAAC;cACvC,CAAC,CAAC;YACN;YACA,MAAM,IAAIF,cAAW,CACjB,uFAAuF,EACvF,2BAA2B,EAC3B;cACI,GAAG9B,MAAM;cACTkB;YACJ,CACJ,CAAC;UACL;UACAS,GAAG,CAACQ,IAAI,CAAC,GAAGP,GAAG,CAAC;UAChB,OAAOD,GAAG;QACd,CAAC,EAAE,EAAE,CAAC;MACV;IACJ,CAAC,CAAC,OAAOS,EAAE,EAAE;MACT,MAAM,IAAIN,cAAW,CACjBM,EAAE,CAACP,OAAO,IAAI,oBAAoB,EAClCO,EAAE,CAACL,IAAI,IAAI,mBAAmB,EAC9B;QACIM,KAAK,EAAED,EAAE;QACT,GAAGpC,MAAM;QACTkB,MAAM;QACNf;MACJ,CACJ,CAAC;IACL;IACA,MAAM,IAAI2B,cAAW,CACjB,2DAA2D,EAC3D,4BAA4B,EAC5B;MACIZ,MAAM;MACNf,GAAG;MACHoB;IACJ,CACJ,CAAC;EACL;EAEOe,QAAQA,CAACtC,MAAkD,EAAQ;IACtE,IAAI,CAACH,KAAK,CAACyC,QAAQ,CAACtC,MAAM,EAAEc,KAAK,CAAC;EACtC;AACJ;AAACyB,OAAA,CAAA3C,kBAAA,GAAAA,kBAAA","ignoreList":[]}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { BoolQueryConfig } from "@webiny/api-elasticsearch/types";
|
|
2
|
+
/**
|
|
3
|
+
* This function will assign a minimum_should_match for the query if conditions are met:
|
|
4
|
+
* * should is an array
|
|
5
|
+
* * it is not empty
|
|
6
|
+
* * minimum_should_match is not already set
|
|
7
|
+
*
|
|
8
|
+
*
|
|
9
|
+
* By the default we set it to 1 as we want at least one OR condition to produce results.
|
|
10
|
+
*
|
|
11
|
+
* Users can modify minimum_should_match value via the body or query modification plugins.
|
|
12
|
+
*/
|
|
13
|
+
interface Params {
|
|
14
|
+
query: BoolQueryConfig;
|
|
15
|
+
value?: number;
|
|
16
|
+
}
|
|
17
|
+
export declare const assignMinimumShouldMatchToQuery: ({ query, value }: Params) => void;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.assignMinimumShouldMatchToQuery = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* This function will assign a minimum_should_match for the query if conditions are met:
|
|
9
|
+
* * should is an array
|
|
10
|
+
* * it is not empty
|
|
11
|
+
* * minimum_should_match is not already set
|
|
12
|
+
*
|
|
13
|
+
*
|
|
14
|
+
* By the default we set it to 1 as we want at least one OR condition to produce results.
|
|
15
|
+
*
|
|
16
|
+
* Users can modify minimum_should_match value via the body or query modification plugins.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
const assignMinimumShouldMatchToQuery = ({
|
|
20
|
+
query,
|
|
21
|
+
value = 1
|
|
22
|
+
}) => {
|
|
23
|
+
if (!Array.isArray(query.should)) {
|
|
24
|
+
return;
|
|
25
|
+
} else if (query.should.length === 0) {
|
|
26
|
+
return;
|
|
27
|
+
} else if (query.minimum_should_match) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
query.minimum_should_match = value > 0 ? value : 1;
|
|
31
|
+
};
|
|
32
|
+
exports.assignMinimumShouldMatchToQuery = assignMinimumShouldMatchToQuery;
|
|
33
|
+
|
|
34
|
+
//# sourceMappingURL=assignMinimumShouldMatchToQuery.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["assignMinimumShouldMatchToQuery","query","value","Array","isArray","should","length","minimum_should_match","exports"],"sources":["assignMinimumShouldMatchToQuery.ts"],"sourcesContent":["import type { BoolQueryConfig } from \"@webiny/api-elasticsearch/types\";\n\n/**\n * This function will assign a minimum_should_match for the query if conditions are met:\n * * should is an array\n * * it is not empty\n * * minimum_should_match is not already set\n *\n *\n * By the default we set it to 1 as we want at least one OR condition to produce results.\n *\n * Users can modify minimum_should_match value via the body or query modification plugins.\n */\ninterface Params {\n query: BoolQueryConfig;\n value?: number;\n}\nexport const assignMinimumShouldMatchToQuery = ({ query, value = 1 }: Params): void => {\n if (!Array.isArray(query.should)) {\n return;\n } else if (query.should.length === 0) {\n return;\n } else if (query.minimum_should_match) {\n return;\n }\n query.minimum_should_match = value > 0 ? value : 1;\n};\n"],"mappings":";;;;;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAKO,MAAMA,+BAA+B,GAAGA,CAAC;EAAEC,KAAK;EAAEC,KAAK,GAAG;AAAU,CAAC,KAAW;EACnF,IAAI,CAACC,KAAK,CAACC,OAAO,CAACH,KAAK,CAACI,MAAM,CAAC,EAAE;IAC9B;EACJ,CAAC,MAAM,IAAIJ,KAAK,CAACI,MAAM,CAACC,MAAM,KAAK,CAAC,EAAE;IAClC;EACJ,CAAC,MAAM,IAAIL,KAAK,CAACM,oBAAoB,EAAE;IACnC;EACJ;EACAN,KAAK,CAACM,oBAAoB,GAAGL,KAAK,GAAG,CAAC,GAAGA,KAAK,GAAG,CAAC;AACtD,CAAC;AAACM,OAAA,CAAAR,+BAAA,GAAAA,+BAAA","ignoreList":[]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { PluginsContainer } from "@webiny/plugins";
|
|
2
|
+
import type { CmsEntryListParams, CmsEntryListWhere, CmsModel } from "@webiny/api-headless-cms/types";
|
|
3
|
+
import type { PrimitiveValue, SearchBody } from "@webiny/api-elasticsearch/types";
|
|
4
|
+
interface Params {
|
|
5
|
+
plugins: PluginsContainer;
|
|
6
|
+
model: CmsModel;
|
|
7
|
+
params: Omit<CmsEntryListParams, "where" | "after"> & {
|
|
8
|
+
where: CmsEntryListWhere;
|
|
9
|
+
after?: PrimitiveValue[];
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
export declare const createElasticsearchBody: ({ plugins, model, params }: Params) => SearchBody;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.createElasticsearchBody = void 0;
|
|
7
|
+
var _fields = require("./fields");
|
|
8
|
+
var _fullTextSearchFields = require("./fullTextSearchFields");
|
|
9
|
+
var _initialQuery = require("./initialQuery");
|
|
10
|
+
var _fullTextSearch = require("./fullTextSearch");
|
|
11
|
+
var _queryModifier = require("./plugins/queryModifier");
|
|
12
|
+
var _sortModifier = require("./plugins/sortModifier");
|
|
13
|
+
var _bodyModifier = require("./plugins/bodyModifier");
|
|
14
|
+
var _sort = require("./sort");
|
|
15
|
+
var _filtering = require("./filtering");
|
|
16
|
+
var _assignMinimumShouldMatchToQuery = require("./assignMinimumShouldMatchToQuery");
|
|
17
|
+
const createElasticsearchBody = ({
|
|
18
|
+
plugins,
|
|
19
|
+
model,
|
|
20
|
+
params
|
|
21
|
+
}) => {
|
|
22
|
+
const {
|
|
23
|
+
fields,
|
|
24
|
+
search: term,
|
|
25
|
+
where,
|
|
26
|
+
sort: initialSort,
|
|
27
|
+
after,
|
|
28
|
+
limit
|
|
29
|
+
} = params;
|
|
30
|
+
/**
|
|
31
|
+
* We need the model fields constructed as a key -> field value, so we do not need to iterate through array when we require some field.
|
|
32
|
+
*/
|
|
33
|
+
const modelFields = (0, _fields.createModelFields)({
|
|
34
|
+
plugins,
|
|
35
|
+
model
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* We need the query modifier plugins.
|
|
40
|
+
*/
|
|
41
|
+
const queryModifierPlugins = (0, _queryModifier.createQueryModifierPluginList)({
|
|
42
|
+
plugins,
|
|
43
|
+
model
|
|
44
|
+
});
|
|
45
|
+
/**
|
|
46
|
+
* We need the sort modifier plugins.
|
|
47
|
+
*/
|
|
48
|
+
const sortModifierPlugins = (0, _sortModifier.createSortModifierPluginList)({
|
|
49
|
+
plugins,
|
|
50
|
+
model
|
|
51
|
+
});
|
|
52
|
+
/**
|
|
53
|
+
* We need the body modifier plugins.
|
|
54
|
+
*/
|
|
55
|
+
const bodyModifierPlugins = (0, _bodyModifier.createBodyModifierPluginList)({
|
|
56
|
+
plugins,
|
|
57
|
+
model
|
|
58
|
+
});
|
|
59
|
+
/**
|
|
60
|
+
* We need the fields which we can search through via the full text search.
|
|
61
|
+
*
|
|
62
|
+
*/
|
|
63
|
+
const fullTextSearchFields = (0, _fullTextSearchFields.createFullTextSearchFields)({
|
|
64
|
+
model,
|
|
65
|
+
term,
|
|
66
|
+
fields
|
|
67
|
+
});
|
|
68
|
+
/**
|
|
69
|
+
* The initial elasticsearch query where we attach some default conditions we always need.
|
|
70
|
+
*/
|
|
71
|
+
const query = (0, _initialQuery.createInitialQuery)({
|
|
72
|
+
where,
|
|
73
|
+
model
|
|
74
|
+
});
|
|
75
|
+
/**
|
|
76
|
+
* Apply the full text search, if term is set.
|
|
77
|
+
*/
|
|
78
|
+
(0, _fullTextSearch.applyFullTextSearch)({
|
|
79
|
+
model,
|
|
80
|
+
plugins,
|
|
81
|
+
query,
|
|
82
|
+
term,
|
|
83
|
+
fields: fullTextSearchFields
|
|
84
|
+
});
|
|
85
|
+
const execFiltering = (0, _filtering.createExecFiltering)({
|
|
86
|
+
model,
|
|
87
|
+
fields: modelFields,
|
|
88
|
+
plugins
|
|
89
|
+
});
|
|
90
|
+
execFiltering({
|
|
91
|
+
where,
|
|
92
|
+
query
|
|
93
|
+
});
|
|
94
|
+
for (const pl of queryModifierPlugins) {
|
|
95
|
+
pl.modifyQuery({
|
|
96
|
+
query,
|
|
97
|
+
model,
|
|
98
|
+
where
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
const sort = (0, _sort.createElasticsearchSort)({
|
|
102
|
+
plugins,
|
|
103
|
+
sort: initialSort,
|
|
104
|
+
modelFields,
|
|
105
|
+
model
|
|
106
|
+
});
|
|
107
|
+
for (const pl of sortModifierPlugins) {
|
|
108
|
+
pl.modifySort({
|
|
109
|
+
sort,
|
|
110
|
+
model
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
const boolQuery = {
|
|
114
|
+
must: query.must.length > 0 ? query.must : undefined,
|
|
115
|
+
must_not: query.must_not.length > 0 ? query.must_not : undefined,
|
|
116
|
+
should: query.should.length > 0 ? query.should : undefined,
|
|
117
|
+
filter: query.filter.length > 0 ? query.filter : undefined
|
|
118
|
+
};
|
|
119
|
+
(0, _assignMinimumShouldMatchToQuery.assignMinimumShouldMatchToQuery)({
|
|
120
|
+
query: boolQuery
|
|
121
|
+
});
|
|
122
|
+
const body = {
|
|
123
|
+
query: {
|
|
124
|
+
bool: boolQuery
|
|
125
|
+
},
|
|
126
|
+
sort,
|
|
127
|
+
size: (limit || 0) + 1,
|
|
128
|
+
search_after: after,
|
|
129
|
+
track_total_hits: true
|
|
130
|
+
};
|
|
131
|
+
for (const pl of bodyModifierPlugins) {
|
|
132
|
+
pl.modifyBody({
|
|
133
|
+
body,
|
|
134
|
+
model,
|
|
135
|
+
where
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
return body;
|
|
139
|
+
};
|
|
140
|
+
exports.createElasticsearchBody = createElasticsearchBody;
|
|
141
|
+
|
|
142
|
+
//# sourceMappingURL=body.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_fields","require","_fullTextSearchFields","_initialQuery","_fullTextSearch","_queryModifier","_sortModifier","_bodyModifier","_sort","_filtering","_assignMinimumShouldMatchToQuery","createElasticsearchBody","plugins","model","params","fields","search","term","where","sort","initialSort","after","limit","modelFields","createModelFields","queryModifierPlugins","createQueryModifierPluginList","sortModifierPlugins","createSortModifierPluginList","bodyModifierPlugins","createBodyModifierPluginList","fullTextSearchFields","createFullTextSearchFields","query","createInitialQuery","applyFullTextSearch","execFiltering","createExecFiltering","pl","modifyQuery","createElasticsearchSort","modifySort","boolQuery","must","length","undefined","must_not","should","filter","assignMinimumShouldMatchToQuery","body","bool","size","search_after","track_total_hits","modifyBody","exports"],"sources":["body.ts"],"sourcesContent":["import type { PluginsContainer } from \"@webiny/plugins\";\nimport type {\n CmsEntryListParams,\n CmsEntryListWhere,\n CmsModel\n} from \"@webiny/api-headless-cms/types\";\nimport { createModelFields } from \"./fields\";\nimport { createFullTextSearchFields } from \"./fullTextSearchFields\";\nimport { createInitialQuery } from \"./initialQuery\";\nimport { applyFullTextSearch } from \"./fullTextSearch\";\nimport { createQueryModifierPluginList } from \"./plugins/queryModifier\";\nimport { createSortModifierPluginList } from \"./plugins/sortModifier\";\nimport { createBodyModifierPluginList } from \"./plugins/bodyModifier\";\nimport { createElasticsearchSort } from \"./sort\";\nimport type { PrimitiveValue, SearchBody, BoolQueryConfig } from \"@webiny/api-elasticsearch/types\";\nimport { createExecFiltering } from \"./filtering\";\nimport { assignMinimumShouldMatchToQuery } from \"./assignMinimumShouldMatchToQuery\";\n\ninterface Params {\n plugins: PluginsContainer;\n model: CmsModel;\n params: Omit<CmsEntryListParams, \"where\" | \"after\"> & {\n where: CmsEntryListWhere;\n after?: PrimitiveValue[];\n };\n}\nexport const createElasticsearchBody = ({ plugins, model, params }: Params): SearchBody => {\n const { fields, search: term, where, sort: initialSort, after, limit } = params;\n /**\n * We need the model fields constructed as a key -> field value, so we do not need to iterate through array when we require some field.\n */\n const modelFields = createModelFields({\n plugins,\n model\n });\n\n /**\n * We need the query modifier plugins.\n */\n const queryModifierPlugins = createQueryModifierPluginList({\n plugins,\n model\n });\n /**\n * We need the sort modifier plugins.\n */\n const sortModifierPlugins = createSortModifierPluginList({\n plugins,\n model\n });\n /**\n * We need the body modifier plugins.\n */\n const bodyModifierPlugins = createBodyModifierPluginList({\n plugins,\n model\n });\n /**\n * We need the fields which we can search through via the full text search.\n *\n */\n const fullTextSearchFields = createFullTextSearchFields({\n model,\n term,\n fields\n });\n /**\n * The initial elasticsearch query where we attach some default conditions we always need.\n */\n const query = createInitialQuery({\n where,\n model\n });\n /**\n * Apply the full text search, if term is set.\n */\n applyFullTextSearch({\n model,\n plugins,\n query,\n term,\n fields: fullTextSearchFields\n });\n\n const execFiltering = createExecFiltering({\n model,\n fields: modelFields,\n plugins\n });\n\n execFiltering({\n where,\n query\n });\n\n for (const pl of queryModifierPlugins) {\n pl.modifyQuery({ query, model, where });\n }\n\n const sort = createElasticsearchSort({\n plugins,\n sort: initialSort,\n modelFields,\n model\n });\n\n for (const pl of sortModifierPlugins) {\n pl.modifySort({\n sort,\n model\n });\n }\n\n const boolQuery: BoolQueryConfig = {\n must: query.must.length > 0 ? query.must : undefined,\n must_not: query.must_not.length > 0 ? query.must_not : undefined,\n should: query.should.length > 0 ? query.should : undefined,\n filter: query.filter.length > 0 ? query.filter : undefined\n };\n\n assignMinimumShouldMatchToQuery({\n query: boolQuery\n });\n\n const body: SearchBody = {\n query: {\n bool: boolQuery\n },\n sort,\n size: (limit || 0) + 1,\n search_after: after,\n track_total_hits: true\n };\n\n for (const pl of bodyModifierPlugins) {\n pl.modifyBody({\n body,\n model,\n where\n });\n }\n\n return body;\n};\n"],"mappings":";;;;;;AAMA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,qBAAA,GAAAD,OAAA;AACA,IAAAE,aAAA,GAAAF,OAAA;AACA,IAAAG,eAAA,GAAAH,OAAA;AACA,IAAAI,cAAA,GAAAJ,OAAA;AACA,IAAAK,aAAA,GAAAL,OAAA;AACA,IAAAM,aAAA,GAAAN,OAAA;AACA,IAAAO,KAAA,GAAAP,OAAA;AAEA,IAAAQ,UAAA,GAAAR,OAAA;AACA,IAAAS,gCAAA,GAAAT,OAAA;AAUO,MAAMU,uBAAuB,GAAGA,CAAC;EAAEC,OAAO;EAAEC,KAAK;EAAEC;AAAe,CAAC,KAA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iny/plugins";
|
|
2
|
+
import type { CmsModel } from "@webiny/api-headless-cms/types";
|
|
3
|
+
interface Params {
|
|
4
|
+
plugins: PluginsContainer;
|
|
5
|
+
model: CmsModel;
|
|
6
|
+
}
|
|
7
|
+
export declare const createModelFields: ({ plugins, model }: Params) => {
|
|
8
|
+
[x: string]: import("./types").ModelField;
|
|
9
|
+
};
|
|
10
|
+
export {};
|