@webiny/api-headless-cms-ddb-es 0.0.0-mt-2 → 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,20 +1,12 @@
|
|
|
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.prepareEntryToIndex = exports.extractEntriesFromIndex = void 0;
|
|
9
|
-
|
|
10
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
-
|
|
12
8
|
var _error = _interopRequireDefault(require("@webiny/error"));
|
|
13
|
-
|
|
14
|
-
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; }
|
|
15
|
-
|
|
16
|
-
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; }
|
|
17
|
-
|
|
9
|
+
var _fieldIdentifier = require("./fieldIdentifier");
|
|
18
10
|
const prepareEntryToIndex = params => {
|
|
19
11
|
const {
|
|
20
12
|
plugins,
|
|
@@ -29,36 +21,33 @@ const prepareEntryToIndex = params => {
|
|
|
29
21
|
} = setupEntriesIndexHelpers({
|
|
30
22
|
plugins
|
|
31
23
|
});
|
|
32
|
-
|
|
33
24
|
function getFieldIndexPlugin(fieldType) {
|
|
34
25
|
return fieldIndexPlugins[fieldType] || defaultIndexFieldPlugin;
|
|
35
26
|
}
|
|
36
|
-
|
|
37
27
|
function getFieldTypePlugin(fieldType) {
|
|
38
28
|
const pl = fieldTypePlugins[fieldType];
|
|
39
|
-
|
|
40
29
|
if (pl) {
|
|
41
30
|
return pl;
|
|
42
31
|
}
|
|
43
|
-
|
|
44
32
|
throw new _error.default(`Missing field type plugin "${fieldType}". Prepare entry for index.`);
|
|
45
|
-
}
|
|
46
|
-
|
|
33
|
+
}
|
|
47
34
|
|
|
35
|
+
// These objects will contain values processed by field index plugins
|
|
48
36
|
const values = {};
|
|
49
|
-
const rawValues = {};
|
|
37
|
+
const rawValues = {};
|
|
50
38
|
|
|
39
|
+
// We're only interested in current model fields.
|
|
51
40
|
for (const field of model.fields) {
|
|
52
|
-
|
|
41
|
+
const identifier = (0, _fieldIdentifier.getFieldIdentifier)(storageEntry.values, field);
|
|
42
|
+
if (!identifier) {
|
|
53
43
|
continue;
|
|
54
44
|
}
|
|
45
|
+
const targetFieldPlugin = getFieldIndexPlugin(field.type);
|
|
55
46
|
|
|
56
|
-
|
|
57
|
-
|
|
47
|
+
// TODO: remove this `if` once we convert this plugin to proper plugin class
|
|
58
48
|
if (!targetFieldPlugin || !targetFieldPlugin.toIndex) {
|
|
59
49
|
continue;
|
|
60
50
|
}
|
|
61
|
-
|
|
62
51
|
const {
|
|
63
52
|
value,
|
|
64
53
|
rawValue
|
|
@@ -66,47 +55,42 @@ const prepareEntryToIndex = params => {
|
|
|
66
55
|
plugins,
|
|
67
56
|
model,
|
|
68
57
|
field,
|
|
69
|
-
rawValue: entry.values[
|
|
70
|
-
value: storageEntry.values[
|
|
58
|
+
rawValue: entry.values[identifier],
|
|
59
|
+
value: storageEntry.values[identifier],
|
|
71
60
|
getFieldIndexPlugin,
|
|
72
61
|
getFieldTypePlugin
|
|
73
62
|
});
|
|
74
|
-
|
|
75
63
|
if (typeof value !== "undefined") {
|
|
76
|
-
values[
|
|
64
|
+
values[identifier] = value;
|
|
77
65
|
}
|
|
78
|
-
|
|
79
66
|
if (typeof rawValue !== "undefined") {
|
|
80
|
-
rawValues[
|
|
67
|
+
rawValues[identifier] = rawValue;
|
|
81
68
|
}
|
|
82
69
|
}
|
|
83
|
-
|
|
84
|
-
|
|
70
|
+
return {
|
|
71
|
+
...storageEntry,
|
|
85
72
|
values,
|
|
86
73
|
rawValues
|
|
87
|
-
}
|
|
74
|
+
};
|
|
88
75
|
};
|
|
89
|
-
|
|
90
76
|
exports.prepareEntryToIndex = prepareEntryToIndex;
|
|
91
|
-
|
|
92
77
|
const setupEntriesIndexHelpers = ({
|
|
93
78
|
plugins: pluginsContainer
|
|
94
79
|
}) => {
|
|
95
80
|
const plugins = pluginsContainer.byType("cms-model-field-to-elastic-search");
|
|
96
81
|
const fieldIndexPlugins = {};
|
|
97
|
-
|
|
98
82
|
for (const plugin of plugins.reverse()) {
|
|
99
83
|
if (fieldIndexPlugins[plugin.fieldType]) {
|
|
100
84
|
continue;
|
|
101
85
|
}
|
|
102
|
-
|
|
103
86
|
fieldIndexPlugins[plugin.fieldType] = plugin;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
const defaultIndexFieldPlugin = plugins.find(plugin => plugin.fieldType === "*"); // CmsModelFieldToGraphQLPlugin plugins
|
|
87
|
+
}
|
|
88
|
+
// we will use this plugin if no targeted plugin found
|
|
89
|
+
const defaultIndexFieldPlugin = plugins.find(plugin => plugin.fieldType === "*");
|
|
108
90
|
|
|
109
|
-
|
|
91
|
+
// CmsModelFieldToGraphQLPlugin plugins
|
|
92
|
+
const fieldTypePlugins = pluginsContainer.byType("cms-model-field-to-graphql").reduce((plugins, plugin) => ({
|
|
93
|
+
...plugins,
|
|
110
94
|
[plugin.fieldType]: plugin
|
|
111
95
|
}), {});
|
|
112
96
|
return {
|
|
@@ -115,7 +99,6 @@ const setupEntriesIndexHelpers = ({
|
|
|
115
99
|
fieldTypePlugins
|
|
116
100
|
};
|
|
117
101
|
};
|
|
118
|
-
|
|
119
102
|
const extractEntriesFromIndex = ({
|
|
120
103
|
plugins,
|
|
121
104
|
entries,
|
|
@@ -128,47 +111,46 @@ const extractEntriesFromIndex = ({
|
|
|
128
111
|
} = setupEntriesIndexHelpers({
|
|
129
112
|
plugins
|
|
130
113
|
});
|
|
131
|
-
|
|
132
114
|
function getFieldIndexPlugin(fieldType) {
|
|
133
115
|
return fieldIndexPlugins[fieldType] || defaultIndexFieldPlugin;
|
|
134
116
|
}
|
|
135
|
-
|
|
136
117
|
function getFieldTypePlugin(fieldType) {
|
|
137
118
|
return fieldTypePlugins[fieldType];
|
|
138
119
|
}
|
|
139
|
-
|
|
140
120
|
const list = [];
|
|
141
|
-
|
|
142
121
|
for (const entry of entries) {
|
|
143
122
|
// This object will contain values processed by field index plugins
|
|
144
|
-
const indexValues = {};
|
|
123
|
+
const indexValues = {};
|
|
145
124
|
|
|
125
|
+
// We only consider fields that are present in the model
|
|
146
126
|
for (const field of model.fields) {
|
|
147
127
|
const fieldTypePlugin = fieldTypePlugins[field.type];
|
|
148
|
-
|
|
149
128
|
if (!fieldTypePlugin) {
|
|
150
129
|
throw new _error.default(`Missing field type plugin "${field.type}". Extract entries from index.`);
|
|
151
130
|
}
|
|
152
|
-
|
|
153
131
|
const targetFieldPlugin = getFieldIndexPlugin(field.type);
|
|
154
|
-
|
|
155
132
|
if (!targetFieldPlugin || !targetFieldPlugin.fromIndex) {
|
|
156
133
|
continue;
|
|
157
134
|
}
|
|
158
|
-
|
|
135
|
+
/**
|
|
136
|
+
* We can safely cast as the code will not continue in case of no identifiers.
|
|
137
|
+
*/
|
|
138
|
+
const identifiers = (0, _fieldIdentifier.getFieldIdentifiers)(entry.values, entry.rawValues, field);
|
|
139
|
+
if (!identifiers) {
|
|
140
|
+
continue;
|
|
141
|
+
}
|
|
159
142
|
try {
|
|
160
|
-
indexValues[
|
|
143
|
+
indexValues[identifiers.valueIdentifier] = targetFieldPlugin.fromIndex({
|
|
161
144
|
plugins,
|
|
162
145
|
model,
|
|
163
146
|
field,
|
|
164
147
|
getFieldIndexPlugin,
|
|
165
148
|
getFieldTypePlugin,
|
|
166
|
-
value: entry.values[
|
|
167
|
-
|
|
149
|
+
value: entry.values[identifiers.valueIdentifier || identifiers.rawValueIdentifier],
|
|
168
150
|
/**
|
|
169
151
|
* Possibly no rawValues so we must check for the existence of the field.
|
|
170
152
|
*/
|
|
171
|
-
rawValue: entry.rawValues ? entry.rawValues[
|
|
153
|
+
rawValue: entry.rawValues ? entry.rawValues[identifiers.rawValueIdentifier || identifiers.valueIdentifier] : null
|
|
172
154
|
});
|
|
173
155
|
} catch (ex) {
|
|
174
156
|
throw new _error.default(ex.message || "Could not transform entry field from index.", ex.code || "FIELD_FROM_INDEX_ERROR", {
|
|
@@ -177,13 +159,32 @@ const extractEntriesFromIndex = ({
|
|
|
177
159
|
});
|
|
178
160
|
}
|
|
179
161
|
}
|
|
180
|
-
|
|
181
|
-
|
|
162
|
+
/**
|
|
163
|
+
* Let's have a new entry so we do not modify the original one.
|
|
164
|
+
*/
|
|
165
|
+
const newEntry = {
|
|
166
|
+
...entry,
|
|
182
167
|
values: indexValues
|
|
183
|
-
}
|
|
168
|
+
};
|
|
169
|
+
/**
|
|
170
|
+
* If we want to remove the rawValues, TYPE, latest, published and __type, we must make them optional or ignore them.
|
|
171
|
+
*/
|
|
172
|
+
// @ts-expect-error
|
|
173
|
+
delete newEntry["rawValues"];
|
|
174
|
+
// @ts-expect-error
|
|
175
|
+
delete newEntry["TYPE"];
|
|
176
|
+
// @ts-expect-error
|
|
177
|
+
delete newEntry["__type"];
|
|
178
|
+
// @ts-expect-error
|
|
179
|
+
delete newEntry["latest"];
|
|
180
|
+
// @ts-expect-error
|
|
181
|
+
delete newEntry["published"];
|
|
182
|
+
list.push({
|
|
183
|
+
...newEntry
|
|
184
|
+
});
|
|
184
185
|
}
|
|
185
|
-
|
|
186
186
|
return list;
|
|
187
187
|
};
|
|
188
|
+
exports.extractEntriesFromIndex = extractEntriesFromIndex;
|
|
188
189
|
|
|
189
|
-
|
|
190
|
+
//# sourceMappingURL=entryIndexHelpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_error","_interopRequireDefault","require","_fieldIdentifier","prepareEntryToIndex","params","plugins","storageEntry","entry","model","fieldIndexPlugins","defaultIndexFieldPlugin","fieldTypePlugins","setupEntriesIndexHelpers","getFieldIndexPlugin","fieldType","getFieldTypePlugin","pl","WebinyError","values","rawValues","field","fields","identifier","getFieldIdentifier","targetFieldPlugin","type","toIndex","value","rawValue","exports","pluginsContainer","byType","plugin","reverse","find","reduce","extractEntriesFromIndex","entries","list","indexValues","fieldTypePlugin","fromIndex","identifiers","getFieldIdentifiers","valueIdentifier","rawValueIdentifier","ex","message","code","newEntry","push"],"sources":["entryIndexHelpers.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport type {\n CmsEntry,\n CmsModel,\n CmsModelFieldToGraphQLPlugin\n} from \"@webiny/api-headless-cms/types\";\nimport type { CmsIndexEntry, CmsModelFieldToElasticsearchPlugin } from \"~/types\";\nimport type { PluginsContainer } from \"@webiny/plugins\";\nimport { getFieldIdentifier, getFieldIdentifiers } from \"~/helpers/fieldIdentifier\";\n\ninterface SetupEntriesIndexHelpersParams {\n plugins: PluginsContainer;\n}\n\ninterface ExtractEntriesFromIndexParams extends SetupEntriesIndexHelpersParams {\n model: CmsModel;\n entries: CmsIndexEntry[];\n}\n\ninterface PrepareElasticsearchDataParams extends SetupEntriesIndexHelpersParams {\n model: CmsModel;\n entry: CmsEntry;\n storageEntry: CmsEntry;\n}\n\nexport const prepareEntryToIndex = (params: PrepareElasticsearchDataParams): CmsIndexEntry => {\n const { plugins, storageEntry, entry, model } = params;\n const { fieldIndexPlugins, defaultIndexFieldPlugin, fieldTypePlugins } =\n setupEntriesIndexHelpers({ plugins });\n\n function getFieldIndexPlugin(fieldType: string) {\n return fieldIndexPlugins[fieldType] || defaultIndexFieldPlugin;\n }\n\n function getFieldTypePlugin(fieldType: string) {\n const pl = fieldTypePlugins[fieldType];\n if (pl) {\n return pl;\n }\n throw new WebinyError(`Missing field type plugin \"${fieldType}\". Prepare entry for index.`);\n }\n\n // These objects will contain values processed by field index plugins\n const values: Record<string, string> = {};\n const rawValues: Record<string, string> = {};\n\n // We're only interested in current model fields.\n for (const field of model.fields) {\n const identifier = getFieldIdentifier(storageEntry.values, field);\n if (!identifier) {\n continue;\n }\n\n const targetFieldPlugin = getFieldIndexPlugin(field.type);\n\n // TODO: remove this `if` once we convert this plugin to proper plugin class\n if (!targetFieldPlugin || !targetFieldPlugin.toIndex) {\n continue;\n }\n\n const { value, rawValue } = targetFieldPlugin.toIndex({\n plugins,\n model,\n field,\n rawValue: entry.values[identifier],\n value: storageEntry.values[identifier],\n getFieldIndexPlugin,\n getFieldTypePlugin\n });\n\n if (typeof value !== \"undefined\") {\n values[identifier] = value;\n }\n\n if (typeof rawValue !== \"undefined\") {\n rawValues[identifier] = rawValue;\n }\n }\n return {\n ...storageEntry,\n values,\n rawValues\n } as CmsIndexEntry;\n};\n\nconst setupEntriesIndexHelpers = ({\n plugins: pluginsContainer\n}: SetupEntriesIndexHelpersParams) => {\n const plugins = pluginsContainer.byType<CmsModelFieldToElasticsearchPlugin>(\n \"cms-model-field-to-elastic-search\"\n );\n\n const fieldIndexPlugins: Record<string, CmsModelFieldToElasticsearchPlugin> = {};\n for (const plugin of plugins.reverse()) {\n if (fieldIndexPlugins[plugin.fieldType]) {\n continue;\n }\n fieldIndexPlugins[plugin.fieldType] = plugin;\n }\n // we will use this plugin if no targeted plugin found\n const defaultIndexFieldPlugin = plugins.find(plugin => plugin.fieldType === \"*\");\n\n // CmsModelFieldToGraphQLPlugin plugins\n const fieldTypePlugins: Record<string, CmsModelFieldToGraphQLPlugin> = pluginsContainer\n .byType<CmsModelFieldToGraphQLPlugin>(\"cms-model-field-to-graphql\")\n .reduce((plugins, plugin) => ({ ...plugins, [plugin.fieldType]: plugin }), {});\n\n return {\n fieldIndexPlugins,\n defaultIndexFieldPlugin,\n fieldTypePlugins\n };\n};\n\nexport const extractEntriesFromIndex = ({\n plugins,\n entries,\n model\n}: ExtractEntriesFromIndexParams): CmsEntry[] => {\n const { fieldIndexPlugins, defaultIndexFieldPlugin, fieldTypePlugins } =\n setupEntriesIndexHelpers({ plugins });\n\n function getFieldIndexPlugin(fieldType: string) {\n return fieldIndexPlugins[fieldType] || defaultIndexFieldPlugin;\n }\n\n function getFieldTypePlugin(fieldType: string) {\n return fieldTypePlugins[fieldType];\n }\n\n const list: CmsEntry[] = [];\n\n for (const entry of entries) {\n // This object will contain values processed by field index plugins\n const indexValues: Record<string, string> = {};\n\n // We only consider fields that are present in the model\n for (const field of model.fields) {\n const fieldTypePlugin = fieldTypePlugins[field.type];\n if (!fieldTypePlugin) {\n throw new WebinyError(\n `Missing field type plugin \"${field.type}\". Extract entries from index.`\n );\n }\n\n const targetFieldPlugin = getFieldIndexPlugin(field.type);\n if (!targetFieldPlugin || !targetFieldPlugin.fromIndex) {\n continue;\n }\n /**\n * We can safely cast as the code will not continue in case of no identifiers.\n */\n const identifiers = getFieldIdentifiers(entry.values, entry.rawValues, field);\n if (!identifiers) {\n continue;\n }\n\n try {\n indexValues[identifiers.valueIdentifier] = targetFieldPlugin.fromIndex({\n plugins,\n model,\n field,\n getFieldIndexPlugin,\n getFieldTypePlugin,\n value: entry.values[\n identifiers.valueIdentifier || identifiers.rawValueIdentifier\n ],\n /**\n * Possibly no rawValues so we must check for the existence of the field.\n */\n rawValue: entry.rawValues\n ? entry.rawValues[\n identifiers.rawValueIdentifier || identifiers.valueIdentifier\n ]\n : null\n });\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not transform entry field from index.\",\n ex.code || \"FIELD_FROM_INDEX_ERROR\",\n {\n field,\n entry\n }\n );\n }\n }\n /**\n * Let's have a new entry so we do not modify the original one.\n */\n const newEntry: CmsEntry = {\n ...entry,\n values: indexValues\n };\n /**\n * If we want to remove the rawValues, TYPE, latest, published and __type, we must make them optional or ignore them.\n */\n // @ts-expect-error\n delete newEntry[\"rawValues\"];\n // @ts-expect-error\n delete newEntry[\"TYPE\"];\n // @ts-expect-error\n delete newEntry[\"__type\"];\n // @ts-expect-error\n delete newEntry[\"latest\"];\n // @ts-expect-error\n delete newEntry[\"published\"];\n list.push({ ...newEntry });\n }\n\n return list;\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAQA,IAAAC,gBAAA,GAAAD,OAAA;AAiBO,MAAME,mBAAmB,GAAIC,MAAsC,IAAoB;EAC1F,MAAM;IAAEC,OAAO;IAAEC,YAAY;IAAEC,KAAK;IAAEC;EAAM,CAAC,GAAGJ,MAAM;EACtD,MAAM;IAAEK,iBAAiB;IAAEC,uBAAuB;IAAEC;EAAiB,CAAC,GAClEC,wBAAwB,CAAC;IAAEP;EAAQ,CAAC,CAAC;EAEzC,SAASQ,mBAAmBA,CAACC,SAAiB,EAAE;IAC5C,OAAOL,iBAAiB,CAACK,SAAS,CAAC,IAAIJ,uBAAuB;EAClE;EAEA,SAASK,kBAAkBA,CAACD,SAAiB,EAAE;IAC3C,MAAME,EAAE,GAAGL,gBAAgB,CAACG,SAAS,CAAC;IACtC,IAAIE,EAAE,EAAE;MACJ,OAAOA,EAAE;IACb;IACA,MAAM,IAAIC,cAAW,CAAC,8BAA8BH,SAAS,6BAA6B,CAAC;EAC/F;;EAEA;EACA,MAAMI,MAA8B,GAAG,CAAC,CAAC;EACzC,MAAMC,SAAiC,GAAG,CAAC,CAAC;;EAE5C;EACA,KAAK,MAAMC,KAAK,IAAIZ,KAAK,CAACa,MAAM,EAAE;IAC9B,MAAMC,UAAU,GAAG,IAAAC,mCAAkB,EAACjB,YAAY,CA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AAGD;IAAS,CAAC,CAAC;EAC9B;EAEA,OAAOX,IAAI;AACf,CAAC;AAACT,OAAA,CAAAO,uBAAA,GAAAA,uBAAA","ignoreList":[]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { CmsEntryValues, CmsModelField } from "@webiny/api-headless-cms/types";
|
|
2
|
+
export declare const getFieldIdentifier: (values: CmsEntryValues | null | undefined, field: CmsModelField) => string | undefined;
|
|
3
|
+
export declare const getFieldIdentifiers: (values: CmsEntryValues, rawValues: CmsEntryValues | null | undefined, field: CmsModelField) => {
|
|
4
|
+
valueIdentifier: string;
|
|
5
|
+
rawValueIdentifier: string;
|
|
6
|
+
} | null;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getFieldIdentifiers = exports.getFieldIdentifier = void 0;
|
|
7
|
+
const hasOwnProperty = (values = {}, property) => {
|
|
8
|
+
if (!values) {
|
|
9
|
+
return false;
|
|
10
|
+
} else if (values.hasOwnProperty) {
|
|
11
|
+
return values.hasOwnProperty(property);
|
|
12
|
+
}
|
|
13
|
+
return values[property] !== undefined;
|
|
14
|
+
};
|
|
15
|
+
const getFieldIdentifier = (values, field) => {
|
|
16
|
+
if (field.storageId && hasOwnProperty(values, field.storageId)) {
|
|
17
|
+
return field.storageId;
|
|
18
|
+
} else if (hasOwnProperty(values, field.fieldId)) {
|
|
19
|
+
return field.fieldId;
|
|
20
|
+
}
|
|
21
|
+
return undefined;
|
|
22
|
+
};
|
|
23
|
+
exports.getFieldIdentifier = getFieldIdentifier;
|
|
24
|
+
const getFieldIdentifiers = (values, rawValues, field) => {
|
|
25
|
+
let valueIdentifier = getFieldIdentifier(values, field);
|
|
26
|
+
let rawValueIdentifier = getFieldIdentifier(rawValues, field);
|
|
27
|
+
if (!valueIdentifier && !rawValueIdentifier) {
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
if (!valueIdentifier) {
|
|
31
|
+
valueIdentifier = rawValueIdentifier;
|
|
32
|
+
}
|
|
33
|
+
if (!rawValueIdentifier) {
|
|
34
|
+
rawValueIdentifier = valueIdentifier;
|
|
35
|
+
}
|
|
36
|
+
return {
|
|
37
|
+
valueIdentifier,
|
|
38
|
+
rawValueIdentifier
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
exports.getFieldIdentifiers = getFieldIdentifiers;
|
|
42
|
+
|
|
43
|
+
//# sourceMappingURL=fieldIdentifier.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["hasOwnProperty","values","property","undefined","getFieldIdentifier","field","storageId","fieldId","exports","getFieldIdentifiers","rawValues","valueIdentifier","rawValueIdentifier"],"sources":["fieldIdentifier.ts"],"sourcesContent":["import type { CmsEntryValues, CmsModelField } from \"@webiny/api-headless-cms/types\";\n\nconst hasOwnProperty = (\n values: CmsEntryValues | null | undefined = {},\n property: string\n): boolean => {\n if (!values) {\n return false;\n } else if (values.hasOwnProperty) {\n return values.hasOwnProperty(property);\n }\n return values[property] !== undefined;\n};\n\nexport const getFieldIdentifier = (\n values: CmsEntryValues | null | undefined,\n field: CmsModelField\n): string | undefined => {\n if (field.storageId && hasOwnProperty(values, field.storageId)) {\n return field.storageId;\n } else if (hasOwnProperty(values, field.fieldId)) {\n return field.fieldId;\n }\n return undefined;\n};\n\nexport const getFieldIdentifiers = (\n values: CmsEntryValues,\n rawValues: CmsEntryValues | null | undefined,\n field: CmsModelField\n) => {\n let valueIdentifier = getFieldIdentifier(values, field);\n let rawValueIdentifier = getFieldIdentifier(rawValues, field);\n if (!valueIdentifier && !rawValueIdentifier) {\n return null;\n }\n if (!valueIdentifier) {\n valueIdentifier = rawValueIdentifier as string;\n }\n if (!rawValueIdentifier) {\n rawValueIdentifier = valueIdentifier as string;\n }\n return {\n valueIdentifier,\n rawValueIdentifier\n };\n};\n"],"mappings":";;;;;;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/helpers/index.js
CHANGED
|
@@ -3,29 +3,27 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
Object.keys(_createElasticsearchQueryBody).forEach(function (key) {
|
|
6
|
+
var _entryIndexHelpers = require("./entryIndexHelpers");
|
|
7
|
+
Object.keys(_entryIndexHelpers).forEach(function (key) {
|
|
10
8
|
if (key === "default" || key === "__esModule") return;
|
|
11
|
-
if (key in exports && exports[key] ===
|
|
9
|
+
if (key in exports && exports[key] === _entryIndexHelpers[key]) return;
|
|
12
10
|
Object.defineProperty(exports, key, {
|
|
13
11
|
enumerable: true,
|
|
14
12
|
get: function () {
|
|
15
|
-
return
|
|
13
|
+
return _entryIndexHelpers[key];
|
|
16
14
|
}
|
|
17
15
|
});
|
|
18
16
|
});
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
Object.keys(_entryIndexHelpers).forEach(function (key) {
|
|
17
|
+
var _fieldIdentifier = require("./fieldIdentifier");
|
|
18
|
+
Object.keys(_fieldIdentifier).forEach(function (key) {
|
|
23
19
|
if (key === "default" || key === "__esModule") return;
|
|
24
|
-
if (key in exports && exports[key] ===
|
|
20
|
+
if (key in exports && exports[key] === _fieldIdentifier[key]) return;
|
|
25
21
|
Object.defineProperty(exports, key, {
|
|
26
22
|
enumerable: true,
|
|
27
23
|
get: function () {
|
|
28
|
-
return
|
|
24
|
+
return _fieldIdentifier[key];
|
|
29
25
|
}
|
|
30
26
|
});
|
|
31
|
-
});
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_entryIndexHelpers","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_fieldIdentifier"],"sources":["index.ts"],"sourcesContent":["export * from \"./entryIndexHelpers\";\nexport * from \"./fieldIdentifier\";\n"],"mappings":";;;;;AAAA,IAAAA,kBAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,kBAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,kBAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,kBAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAK,gBAAA,GAAAT,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAO,gBAAA,EAAAN,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAK,gBAAA,CAAAL,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,gBAAA,CAAAL,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
|
package/index.d.ts
CHANGED