@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
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.deleteElasticsearchIndex = void 0;
|
|
7
|
+
var _configurations = require("../configurations");
|
|
8
|
+
const deleteElasticsearchIndex = async params => {
|
|
9
|
+
const {
|
|
10
|
+
client,
|
|
11
|
+
model
|
|
12
|
+
} = params;
|
|
13
|
+
const {
|
|
14
|
+
index
|
|
15
|
+
} = _configurations.configurations.es({
|
|
16
|
+
model
|
|
17
|
+
});
|
|
18
|
+
const {
|
|
19
|
+
body: exists
|
|
20
|
+
} = await client.indices.exists({
|
|
21
|
+
index
|
|
22
|
+
});
|
|
23
|
+
if (!exists) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
try {
|
|
27
|
+
await client.indices.delete({
|
|
28
|
+
index,
|
|
29
|
+
ignore_unavailable: true
|
|
30
|
+
});
|
|
31
|
+
} catch (ex) {
|
|
32
|
+
console.log(`Could not delete Elasticsearch index "${index}". Please do it manually.`);
|
|
33
|
+
console.log(ex.message);
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
exports.deleteElasticsearchIndex = deleteElasticsearchIndex;
|
|
37
|
+
|
|
38
|
+
//# sourceMappingURL=deleteElasticsearchIndex.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_configurations","require","deleteElasticsearchIndex","params","client","model","index","configurations","es","body","exists","indices","delete","ignore_unavailable","ex","console","log","message","exports"],"sources":["deleteElasticsearchIndex.ts"],"sourcesContent":["import type { Client } from \"@elastic/elasticsearch\";\nimport type { CmsModel } from \"@webiny/api-headless-cms/types\";\nimport { configurations } from \"~/configurations\";\n\ninterface DeleteElasticsearchIndexParams {\n client: Client;\n model: CmsModel;\n}\n\nexport const deleteElasticsearchIndex = async (\n params: DeleteElasticsearchIndexParams\n): Promise<void> => {\n const { client, model } = params;\n\n const { index } = configurations.es({\n model\n });\n const { body: exists } = await client.indices.exists({\n index\n });\n if (!exists) {\n return;\n }\n\n try {\n await client.indices.delete({\n index,\n ignore_unavailable: true\n });\n } catch (ex) {\n console.log(`Could not delete Elasticsearch index \"${index}\". Please do it manually.`);\n console.log(ex.message);\n }\n};\n"],"mappings":";;;;;;AAEA,IAAAA,eAAA,GAAAC,OAAA;AAOO,MAAMC,wBAAwB,GAAG,MACpCC,MAAsC,IACtB;EAChB,MAAM;IAAEC,MAAM;IAAEC;EAAM,CAAC,GAAGF,MAAM;EAEhC,MAAM;IAAEG;EAAM,CAAC,GAAGC,8BAAc,CAACC,EAAE,CAAC;IAChCH;EACJ,CAAC,CAAC;EACF,MAAM;IAAEI,IAAI,EAAEC;EAAO,CAAC,GAAG,MAAMN,MAAM,CAACO,OAAO,CAACD,MAAM,CAAC;IACjDJ;EACJ,CAAC,CAAC;EACF,IAAI,CAACI,MAAM,EAAE;IACT;EACJ;EAEA,IAAI;IACA,MAAMN,MAAM,CAACO,OAAO,CAACC,MAAM,CAAC;MACxBN,KAAK;MACLO,kBAAkB,EAAE;IACxB,CAAC,CAAC;EACN,CAAC,CAAC,OAAOC,EAAE,EAAE;IACTC,OAAO,CAACC,GAAG,CAAC,yCAAyCV,KAAK,2BAA2B,CAAC;IACtFS,OAAO,CAACC,GAAG,CAACF,EAAE,CAACG,OAAO,CAAC;EAC3B;AACJ,CAAC;AAACC,OAAA,CAAAhB,wBAAA,GAAAA,wBAAA","ignoreList":[]}
|
package/elasticsearch/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: () => (import("../types").CmsModelFieldToElasticsearchPlugin[] | import("
|
|
1
|
+
declare const _default: () => (import("../types").CmsModelFieldToElasticsearchPlugin[] | import("..").CmsEntryElasticsearchQueryBuilderValueSearchPlugin[])[];
|
|
2
2
|
export default _default;
|
package/elasticsearch/index.js
CHANGED
|
@@ -1,16 +1,13 @@
|
|
|
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.default = void 0;
|
|
9
|
-
|
|
10
8
|
var _indexing = _interopRequireDefault(require("./indexing"));
|
|
11
|
-
|
|
12
9
|
var _search = _interopRequireDefault(require("./search"));
|
|
13
|
-
|
|
14
10
|
var _default = () => [(0, _indexing.default)(), (0, _search.default)()];
|
|
11
|
+
exports.default = _default;
|
|
15
12
|
|
|
16
|
-
|
|
13
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_indexing","_interopRequireDefault","require","_search","_default","elasticsearchIndexingPlugins","elasticsearchSearchPlugins","exports","default"],"sources":["index.ts"],"sourcesContent":["import elasticsearchIndexingPlugins from \"./indexing\";\nimport elasticsearchSearchPlugins from \"./search\";\n\nexport default () => [elasticsearchIndexingPlugins(), elasticsearchSearchPlugins()];\n"],"mappings":";;;;;;;AAAA,IAAAA,SAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAF,sBAAA,CAAAC,OAAA;AAAkD,IAAAE,QAAA,GAEnCA,CAAA,KAAM,CAAC,IAAAC,iBAA4B,EAAC,CAAC,EAAE,IAAAC,eAA0B,EAAC,CAAC,CAAC;AAAAC,OAAA,CAAAC,OAAA,GAAAJ,QAAA","ignoreList":[]}
|
|
@@ -4,37 +4,30 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
const convertTimeToNumber = time => {
|
|
9
8
|
if (!time) {
|
|
10
9
|
return null;
|
|
11
10
|
}
|
|
12
|
-
|
|
13
11
|
const [hours, minutes, seconds = 0] = time.split(":").map(Number);
|
|
14
12
|
return hours * 60 * 60 + minutes * 60 + seconds;
|
|
15
13
|
};
|
|
16
|
-
|
|
17
14
|
const convertNumberToTime = value => {
|
|
18
15
|
if (value === undefined || value === null) {
|
|
19
16
|
return null;
|
|
20
|
-
}
|
|
17
|
+
}
|
|
18
|
+
// TODO remove when v5 goes out
|
|
21
19
|
// this is a fix for pre beta.5
|
|
22
|
-
|
|
23
|
-
|
|
24
20
|
if (String(value).match(/^([0-9]{2}):([0-9]{2})/) !== null) {
|
|
25
21
|
return String(value);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
|
|
22
|
+
}
|
|
23
|
+
//
|
|
29
24
|
const hours = Math.floor(value / 60 / 60);
|
|
30
25
|
const minutes = Math.floor((value - hours * 60 * 60) / 60);
|
|
31
26
|
const seconds = Math.floor(value - hours * 60 * 60 - minutes * 60);
|
|
32
27
|
return [hours, minutes, seconds].map(v => String(v).padStart(2, "0")).join(":");
|
|
33
28
|
};
|
|
34
|
-
|
|
35
29
|
const convertValueFromIndex = (value, field) => {
|
|
36
|
-
const type = field.settings
|
|
37
|
-
|
|
30
|
+
const type = field.settings?.type;
|
|
38
31
|
if (type === "time") {
|
|
39
32
|
return convertNumberToTime(value);
|
|
40
33
|
} else if (!value) {
|
|
@@ -43,22 +36,18 @@ const convertValueFromIndex = (value, field) => {
|
|
|
43
36
|
return value;
|
|
44
37
|
} else if (type === "date") {
|
|
45
38
|
const dateValue = new Date(value);
|
|
46
|
-
return dateValue.toISOString().
|
|
39
|
+
return dateValue.toISOString().slice(0, 10);
|
|
47
40
|
}
|
|
48
|
-
|
|
49
41
|
return new Date(value).toISOString();
|
|
50
42
|
};
|
|
51
|
-
|
|
52
43
|
const convertValueToIndex = (value, field) => {
|
|
53
44
|
if (!value) {
|
|
54
45
|
return null;
|
|
55
|
-
} else if (field.settings
|
|
46
|
+
} else if (field.settings?.type === "time") {
|
|
56
47
|
return convertTimeToNumber(value);
|
|
57
48
|
}
|
|
58
|
-
|
|
59
49
|
return value;
|
|
60
50
|
};
|
|
61
|
-
|
|
62
51
|
var _default = () => ({
|
|
63
52
|
type: "cms-model-field-to-elastic-search",
|
|
64
53
|
name: "cms-model-field-to-elastic-search-datetime",
|
|
@@ -66,24 +55,34 @@ var _default = () => ({
|
|
|
66
55
|
unmappedType: () => {
|
|
67
56
|
return "date";
|
|
68
57
|
},
|
|
69
|
-
|
|
70
58
|
toIndex({
|
|
71
59
|
field,
|
|
72
60
|
value
|
|
73
61
|
}) {
|
|
62
|
+
if (Array.isArray(value) === true) {
|
|
63
|
+
return {
|
|
64
|
+
value: value.map(v => {
|
|
65
|
+
return convertValueToIndex(v, field);
|
|
66
|
+
})
|
|
67
|
+
};
|
|
68
|
+
}
|
|
74
69
|
const dateValue = convertValueToIndex(value, field);
|
|
75
70
|
return {
|
|
76
71
|
value: dateValue
|
|
77
72
|
};
|
|
78
73
|
},
|
|
79
|
-
|
|
80
74
|
fromIndex({
|
|
81
75
|
field,
|
|
82
76
|
value
|
|
83
77
|
}) {
|
|
78
|
+
if (Array.isArray(value)) {
|
|
79
|
+
return value.map(v => {
|
|
80
|
+
return convertValueFromIndex(v, field);
|
|
81
|
+
});
|
|
82
|
+
}
|
|
84
83
|
return convertValueFromIndex(value, field);
|
|
85
84
|
}
|
|
86
|
-
|
|
87
85
|
});
|
|
86
|
+
exports.default = _default;
|
|
88
87
|
|
|
89
|
-
|
|
88
|
+
//# sourceMappingURL=dateTimeIndexing.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["convertTimeToNumber","time","hours","minutes","seconds","split","map","Number","convertNumberToTime","value","undefined","String","match","Math","floor","v","padStart","join","convertValueFromIndex","field","type","settings","dateValue","Date","toISOString","slice","convertValueToIndex","_default","name","fieldType","unmappedType","toIndex","Array","isArray","fromIndex","exports","default"],"sources":["dateTimeIndexing.ts"],"sourcesContent":["import type { CmsModelDateTimeField } from \"@webiny/api-headless-cms/types\";\nimport type { CmsModelFieldToElasticsearchPlugin } from \"~/types\";\n\nconst convertTimeToNumber = (time?: string): number | null => {\n if (!time) {\n return null;\n }\n const [hours, minutes, seconds = 0] = time.split(\":\").map(Number);\n return hours * 60 * 60 + minutes * 60 + seconds;\n};\n\nconst convertNumberToTime = (value?: number): string | null => {\n if (value === undefined || value === null) {\n return null;\n }\n // TODO remove when v5 goes out\n // this is a fix for pre beta.5\n if (String(value).match(/^([0-9]{2}):([0-9]{2})/) !== null) {\n return String(value);\n }\n //\n const hours = Math.floor(value / 60 / 60);\n\n const minutes = Math.floor((value - hours * 60 * 60) / 60);\n\n const seconds = Math.floor(value - hours * 60 * 60 - minutes * 60);\n\n return [hours, minutes, seconds].map(v => String(v).padStart(2, \"0\")).join(\":\");\n};\n\nconst convertValueFromIndex = (\n value: string | number,\n field: CmsModelDateTimeField\n): string | null => {\n const type = field.settings?.type;\n if (type === \"time\") {\n return convertNumberToTime(value as number);\n } else if (!value) {\n return null;\n } else if (type === \"dateTimeWithTimezone\") {\n return value as string;\n } else if (type === \"date\") {\n const dateValue = new Date(value);\n return dateValue.toISOString().slice(0, 10);\n }\n return new Date(value).toISOString();\n};\n\nconst convertValueToIndex = (value: string, field: CmsModelDateTimeField) => {\n if (!value) {\n return null;\n } else if (field.settings?.type === \"time\") {\n return convertTimeToNumber(value);\n }\n return value;\n};\n\nexport default (): CmsModelFieldToElasticsearchPlugin => ({\n type: \"cms-model-field-to-elastic-search\",\n name: \"cms-model-field-to-elastic-search-datetime\",\n fieldType: \"datetime\",\n unmappedType: () => {\n return \"date\";\n },\n toIndex({ field, value }) {\n if (Array.isArray(value) === true) {\n return {\n value: value.map((v: string) => {\n return convertValueToIndex(v, field as CmsModelDateTimeField);\n })\n };\n }\n const dateValue = convertValueToIndex(value, field as CmsModelDateTimeField);\n return {\n value: dateValue\n };\n },\n fromIndex({ field, value }) {\n if (Array.isArray(value)) {\n return value.map((v: string) => {\n return convertValueFromIndex(v, field as CmsModelDateTimeField);\n });\n }\n return convertValueFromIndex(value, field as CmsModelDateTimeField);\n }\n});\n"],"mappings":"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","ignoreList":[]}
|
|
@@ -4,32 +4,30 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
var _default = () => ({
|
|
9
8
|
type: "cms-model-field-to-elastic-search",
|
|
10
9
|
name: "cms-model-field-to-elastic-search-default",
|
|
11
10
|
fieldType: "*",
|
|
12
|
-
|
|
13
11
|
toIndex({
|
|
14
12
|
field,
|
|
15
13
|
getFieldTypePlugin,
|
|
16
14
|
value
|
|
17
15
|
}) {
|
|
18
|
-
const fieldTypePlugin = getFieldTypePlugin(field.type);
|
|
16
|
+
const fieldTypePlugin = getFieldTypePlugin(field.type);
|
|
19
17
|
|
|
18
|
+
// when field is searchable, assign it to `values`
|
|
20
19
|
if (fieldTypePlugin.isSearchable === true) {
|
|
21
20
|
return {
|
|
22
21
|
value
|
|
23
22
|
};
|
|
24
|
-
}
|
|
25
|
-
// `rawValues` is a field in ES index that's not being indexed.
|
|
26
|
-
|
|
23
|
+
}
|
|
27
24
|
|
|
25
|
+
// when field is not searchable, move its value to `rawValues`.
|
|
26
|
+
// `rawValues` is a field in ES index that's not being indexed.
|
|
28
27
|
return {
|
|
29
28
|
rawValue: value
|
|
30
29
|
};
|
|
31
30
|
},
|
|
32
|
-
|
|
33
31
|
fromIndex({
|
|
34
32
|
field,
|
|
35
33
|
getFieldTypePlugin,
|
|
@@ -39,9 +37,18 @@ var _default = () => ({
|
|
|
39
37
|
const {
|
|
40
38
|
isSearchable
|
|
41
39
|
} = getFieldTypePlugin(field.type);
|
|
42
|
-
|
|
40
|
+
/**
|
|
41
|
+
* We will return the rawValue in case if not searchable and value in case of not searchable field.
|
|
42
|
+
* This is to make sure that changed isSearchable parameter does not make the data to be null / undefined.
|
|
43
|
+
*
|
|
44
|
+
* Users can change isSearchable parameter at any time on the GraphQL field - and that could create a problem for them.
|
|
45
|
+
*/
|
|
46
|
+
if (isSearchable) {
|
|
47
|
+
return value === undefined ? rawValue : value;
|
|
48
|
+
}
|
|
49
|
+
return rawValue === undefined ? value : rawValue;
|
|
43
50
|
}
|
|
44
|
-
|
|
45
51
|
});
|
|
52
|
+
exports.default = _default;
|
|
46
53
|
|
|
47
|
-
|
|
54
|
+
//# sourceMappingURL=defaultFieldIndexing.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_default","type","name","fieldType","toIndex","field","getFieldTypePlugin","value","fieldTypePlugin","isSearchable","rawValue","fromIndex","undefined","exports","default"],"sources":["defaultFieldIndexing.ts"],"sourcesContent":["import type { CmsModelFieldToElasticsearchPlugin } from \"~/types\";\n\nexport default (): CmsModelFieldToElasticsearchPlugin => ({\n type: \"cms-model-field-to-elastic-search\",\n name: \"cms-model-field-to-elastic-search-default\",\n fieldType: \"*\",\n toIndex({ field, getFieldTypePlugin, value }) {\n const fieldTypePlugin = getFieldTypePlugin(field.type);\n\n // when field is searchable, assign it to `values`\n if (fieldTypePlugin.isSearchable === true) {\n return { value };\n }\n\n // when field is not searchable, move its value to `rawValues`.\n // `rawValues` is a field in ES index that's not being indexed.\n return { rawValue: value };\n },\n fromIndex({ field, getFieldTypePlugin, value, rawValue }) {\n const { isSearchable } = getFieldTypePlugin(field.type);\n /**\n * We will return the rawValue in case if not searchable and value in case of not searchable field.\n * This is to make sure that changed isSearchable parameter does not make the data to be null / undefined.\n *\n * Users can change isSearchable parameter at any time on the GraphQL field - and that could create a problem for them.\n */\n if (isSearchable) {\n return value === undefined ? rawValue : value;\n }\n return rawValue === undefined ? value : rawValue;\n }\n});\n"],"mappings":";;;;;;eAEeA,CAAA,MAA2C;EACtDC,IAAI,EAAE,mCAAmC;EACzCC,IAAI,EAAE,2CAA2C;EACjDC,SAAS,EAAE,GAAG;EACdC,OAAOA,CAAC;IAAEC,KAAK;IAAEC,kBAAkB;IAAEC;EAAM,CAAC,EAAE;IAC1C,MAAMC,eAAe,GAAGF,kBAAkB,CAACD,KAAK,CAACJ,IAAI,CAAC;;IAEtD;IACA,IAAIO,eAAe,CAACC,YAAY,KAAK,IAAI,EAAE;MACvC,OAAO;QAAEF;MAAM,CAAC;IACpB;;IAEA;IACA;IACA,OAAO;MAAEG,QAAQ,EAAEH;IAAM,CAAC;EAC9B,CAAC;EACDI,SAASA,CAAC;IAAEN,KAAK;IAAEC,kBAAkB;IAAEC,KAAK;IAAEG;EAAS,CAAC,EAAE;IACtD,MAAM;MAAED;IAAa,CAAC,GAAGH,kBAAkB,CAACD,KAAK,CAACJ,IAAI,CAAC;IACvD;AACR;AACA;AACA;AACA;AACA;IACQ,IAAIQ,YAAY,EAAE;MACd,OAAOF,KAAK,KAAKK,SAAS,GAAGF,QAAQ,GAAGH,KAAK;IACjD;IACA,OAAOG,QAAQ,KAAKE,SAAS,GAAGL,KAAK,GAAGG,QAAQ;EACpD;AACJ,CAAC,CAAC;AAAAG,OAAA,CAAAC,OAAA,GAAAd,QAAA","ignoreList":[]}
|
|
@@ -1,24 +1,18 @@
|
|
|
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.default = void 0;
|
|
9
|
-
|
|
10
8
|
var _richTextIndexing = _interopRequireDefault(require("./richTextIndexing"));
|
|
11
|
-
|
|
12
9
|
var _longTextIndexing = _interopRequireDefault(require("./longTextIndexing"));
|
|
13
|
-
|
|
14
10
|
var _defaultFieldIndexing = _interopRequireDefault(require("./defaultFieldIndexing"));
|
|
15
|
-
|
|
16
11
|
var _dateTimeIndexing = _interopRequireDefault(require("./dateTimeIndexing"));
|
|
17
|
-
|
|
18
12
|
var _numberIndexing = _interopRequireDefault(require("./numberIndexing"));
|
|
19
|
-
|
|
20
13
|
var _objectIndexing = _interopRequireDefault(require("./objectIndexing"));
|
|
14
|
+
var _jsonIndexing = require("./jsonIndexing");
|
|
15
|
+
var _default = () => [(0, _dateTimeIndexing.default)(), (0, _richTextIndexing.default)(), (0, _longTextIndexing.default)(), (0, _defaultFieldIndexing.default)(), (0, _numberIndexing.default)(), (0, _objectIndexing.default)(), (0, _jsonIndexing.createJsonIndexing)()];
|
|
16
|
+
exports.default = _default;
|
|
21
17
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
exports.default = _default;
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_richTextIndexing","_interopRequireDefault","require","_longTextIndexing","_defaultFieldIndexing","_dateTimeIndexing","_numberIndexing","_objectIndexing","_jsonIndexing","_default","dateTimeIndexing","richTextIndexing","longTextIndexing","defaultFieldIndexing","numberIndexing","objectIndexing","createJsonIndexing","exports","default"],"sources":["index.ts"],"sourcesContent":["import richTextIndexing from \"./richTextIndexing\";\nimport longTextIndexing from \"./longTextIndexing\";\nimport defaultFieldIndexing from \"./defaultFieldIndexing\";\nimport dateTimeIndexing from \"./dateTimeIndexing\";\nimport numberIndexing from \"./numberIndexing\";\nimport objectIndexing from \"./objectIndexing\";\nimport { createJsonIndexing } from \"./jsonIndexing\";\n\nexport default () => [\n dateTimeIndexing(),\n richTextIndexing(),\n longTextIndexing(),\n defaultFieldIndexing(),\n numberIndexing(),\n objectIndexing(),\n createJsonIndexing()\n];\n"],"mappings":";;;;;;;AAAA,IAAAA,iBAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,qBAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,iBAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,eAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,eAAA,GAAAN,sBAAA,CAAAC,OAAA;AACA,IAAAM,aAAA,GAAAN,OAAA;AAAoD,IAAAO,QAAA,GAErCA,CAAA,KAAM,CACjB,IAAAC,yBAAgB,EAAC,CAAC,EAClB,IAAAC,yBAAgB,EAAC,CAAC,EAClB,IAAAC,yBAAgB,EAAC,CAAC,EAClB,IAAAC,6BAAoB,EAAC,CAAC,EACtB,IAAAC,uBAAc,EAAC,CAAC,EAChB,IAAAC,uBAAc,EAAC,CAAC,EAChB,IAAAC,gCAAkB,EAAC,CAAC,CACvB;AAAAC,OAAA,CAAAC,OAAA,GAAAT,QAAA","ignoreList":[]}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.createJsonIndexing = void 0;
|
|
7
|
+
const createJsonIndexing = () => {
|
|
8
|
+
return {
|
|
9
|
+
type: "cms-model-field-to-elastic-search",
|
|
10
|
+
name: "cms-model-field-to-elastic-search-json",
|
|
11
|
+
fieldType: "json",
|
|
12
|
+
toIndex({
|
|
13
|
+
value
|
|
14
|
+
}) {
|
|
15
|
+
return {
|
|
16
|
+
rawValue: value
|
|
17
|
+
};
|
|
18
|
+
},
|
|
19
|
+
fromIndex({
|
|
20
|
+
rawValue
|
|
21
|
+
}) {
|
|
22
|
+
return rawValue;
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
exports.createJsonIndexing = createJsonIndexing;
|
|
27
|
+
|
|
28
|
+
//# sourceMappingURL=jsonIndexing.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createJsonIndexing","type","name","fieldType","toIndex","value","rawValue","fromIndex","exports"],"sources":["jsonIndexing.ts"],"sourcesContent":["import type { CmsModelFieldToElasticsearchPlugin } from \"~/types\";\n\nexport const createJsonIndexing = (): CmsModelFieldToElasticsearchPlugin => {\n return {\n type: \"cms-model-field-to-elastic-search\",\n name: \"cms-model-field-to-elastic-search-json\",\n fieldType: \"json\",\n toIndex({ value }) {\n return {\n rawValue: value\n };\n },\n fromIndex({ rawValue }) {\n return rawValue;\n }\n };\n};\n"],"mappings":";;;;;;AAEO,MAAMA,kBAAkB,GAAGA,CAAA,KAA0C;EACxE,OAAO;IACHC,IAAI,EAAE,mCAAmC;IACzCC,IAAI,EAAE,wCAAwC;IAC9CC,SAAS,EAAE,MAAM;IACjBC,OAAOA,CAAC;MAAEC;IAAM,CAAC,EAAE;MACf,OAAO;QACHC,QAAQ,EAAED;MACd,CAAC;IACL,CAAC;IACDE,SAASA,CAAC;MAAED;IAAS,CAAC,EAAE;MACpB,OAAOA,QAAQ;IACnB;EACJ,CAAC;AACL,CAAC;AAACE,OAAA,CAAAR,kBAAA,GAAAA,kBAAA","ignoreList":[]}
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
-
import { CmsModelFieldToElasticsearchPlugin } from "../../types";
|
|
1
|
+
import type { CmsModelFieldToElasticsearchPlugin } from "../../types";
|
|
2
|
+
/**
|
|
3
|
+
* The long-text indexing plugin must take in consideration that users might have list of long-text fields.
|
|
4
|
+
* Also, we used to encode values, and we do not do that anymore - but we need to have backward compatibility.
|
|
5
|
+
*/
|
|
2
6
|
declare const _default: () => CmsModelFieldToElasticsearchPlugin;
|
|
3
7
|
export default _default;
|
|
@@ -4,33 +4,39 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
7
|
+
/**
|
|
8
|
+
* The long-text indexing plugin must take in consideration that users might have list of long-text fields.
|
|
9
|
+
* Also, we used to encode values, and we do not do that anymore - but we need to have backward compatibility.
|
|
10
|
+
*/
|
|
8
11
|
var _default = () => ({
|
|
9
12
|
type: "cms-model-field-to-elastic-search",
|
|
10
13
|
name: "cms-model-field-to-elastic-search-long-text",
|
|
11
14
|
fieldType: "long-text",
|
|
12
|
-
|
|
13
15
|
toIndex({
|
|
14
16
|
rawValue
|
|
15
17
|
}) {
|
|
16
18
|
/**
|
|
17
|
-
* We
|
|
18
|
-
* And we want to store prepared value into rawValue so it is not indexed.
|
|
19
|
+
* We take the raw value, before it was prepared via `transformToStorage` for storage (there might be some transform due to DynamoDB) and store it in the Elasticsearch to be indexed.
|
|
19
20
|
*/
|
|
20
21
|
return {
|
|
21
|
-
value: rawValue ?
|
|
22
|
+
value: Array.isArray(rawValue) ? rawValue : rawValue || ""
|
|
22
23
|
};
|
|
23
24
|
},
|
|
24
|
-
|
|
25
25
|
/**
|
|
26
|
-
* When
|
|
26
|
+
* When taking value from the index, we can return the original value.
|
|
27
|
+
* At that point the `transformFromStorage` does not need to do anything.
|
|
28
|
+
*
|
|
29
|
+
* We need to decode to support older systems.
|
|
27
30
|
*/
|
|
28
31
|
fromIndex({
|
|
29
32
|
value
|
|
30
33
|
}) {
|
|
31
|
-
|
|
34
|
+
if (Array.isArray(value)) {
|
|
35
|
+
return value;
|
|
36
|
+
}
|
|
37
|
+
return value || "";
|
|
32
38
|
}
|
|
33
|
-
|
|
34
39
|
});
|
|
40
|
+
exports.default = _default;
|
|
35
41
|
|
|
36
|
-
|
|
42
|
+
//# sourceMappingURL=longTextIndexing.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_default","type","name","fieldType","toIndex","rawValue","value","Array","isArray","fromIndex","exports","default"],"sources":["longTextIndexing.ts"],"sourcesContent":["import type { CmsModelFieldToElasticsearchPlugin } from \"~/types\";\n\n/**\n * The long-text indexing plugin must take in consideration that users might have list of long-text fields.\n * Also, we used to encode values, and we do not do that anymore - but we need to have backward compatibility.\n */\nexport default (): CmsModelFieldToElasticsearchPlugin => ({\n type: \"cms-model-field-to-elastic-search\",\n name: \"cms-model-field-to-elastic-search-long-text\",\n fieldType: \"long-text\",\n toIndex({ rawValue }) {\n /**\n * We take the raw value, before it was prepared via `transformToStorage` for storage (there might be some transform due to DynamoDB) and store it in the Elasticsearch to be indexed.\n */\n return {\n value: Array.isArray(rawValue) ? rawValue : rawValue || \"\"\n };\n },\n /**\n * When taking value from the index, we can return the original value.\n * At that point the `transformFromStorage` does not need to do anything.\n *\n * We need to decode to support older systems.\n */\n fromIndex({ value }) {\n if (Array.isArray(value)) {\n return value;\n }\n return value || \"\";\n }\n});\n"],"mappings":";;;;;;AAEA;AACA;AACA;AACA;AAHA,IAAAA,QAAA,GAIeA,CAAA,MAA2C;EACtDC,IAAI,EAAE,mCAAmC;EACzCC,IAAI,EAAE,6CAA6C;EACnDC,SAAS,EAAE,WAAW;EACtBC,OAAOA,CAAC;IAAEC;EAAS,CAAC,EAAE;IAClB;AACR;AACA;IACQ,OAAO;MACHC,KAAK,EAAEC,KAAK,CAACC,OAAO,CAACH,QAAQ,CAAC,GAAGA,QAAQ,GAAGA,QAAQ,IAAI;IAC5D,CAAC;EACL,CAAC;EACD;AACJ;AACA;AACA;AACA;AACA;EACII,SAASA,CAAC;IAAEH;EAAM,CAAC,EAAE;IACjB,IAAIC,KAAK,CAACC,OAAO,CAACF,KAAK,CAAC,EAAE;MACtB,OAAOA,KAAK;IAChB;IACA,OAAOA,KAAK,IAAI,EAAE;EACtB;AACJ,CAAC,CAAC;AAAAI,OAAA,CAAAC,OAAA,GAAAX,QAAA","ignoreList":[]}
|
|
@@ -4,23 +4,18 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
const convertToString = value => {
|
|
9
8
|
if (Array.isArray(value) === false) {
|
|
10
9
|
return value;
|
|
11
10
|
}
|
|
12
|
-
|
|
13
11
|
return value.map(String);
|
|
14
12
|
};
|
|
15
|
-
|
|
16
13
|
const convertToFloat = value => {
|
|
17
14
|
if (Array.isArray(value) === false) {
|
|
18
15
|
return typeof value === "string" ? parseFloat(value) : value;
|
|
19
16
|
}
|
|
20
|
-
|
|
21
17
|
return value.map(v => parseFloat(v));
|
|
22
18
|
};
|
|
23
|
-
|
|
24
19
|
var _default = () => ({
|
|
25
20
|
type: "cms-model-field-to-elastic-search",
|
|
26
21
|
name: "cms-model-field-to-elastic-search-number",
|
|
@@ -28,7 +23,6 @@ var _default = () => ({
|
|
|
28
23
|
unmappedType: () => {
|
|
29
24
|
return "float";
|
|
30
25
|
},
|
|
31
|
-
|
|
32
26
|
toIndex({
|
|
33
27
|
value
|
|
34
28
|
}) {
|
|
@@ -36,13 +30,12 @@ var _default = () => ({
|
|
|
36
30
|
value: convertToString(value)
|
|
37
31
|
};
|
|
38
32
|
},
|
|
39
|
-
|
|
40
33
|
fromIndex({
|
|
41
34
|
value
|
|
42
35
|
}) {
|
|
43
36
|
return convertToFloat(value);
|
|
44
37
|
}
|
|
45
|
-
|
|
46
38
|
});
|
|
39
|
+
exports.default = _default;
|
|
47
40
|
|
|
48
|
-
|
|
41
|
+
//# sourceMappingURL=numberIndexing.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["convertToString","value","Array","isArray","map","String","convertToFloat","parseFloat","v","_default","type","name","fieldType","unmappedType","toIndex","fromIndex","exports","default"],"sources":["numberIndexing.ts"],"sourcesContent":["import type { CmsModelFieldToElasticsearchPlugin } from \"~/types\";\n\nconst convertToString = (value: number[] | number) => {\n if (Array.isArray(value) === false) {\n return value;\n }\n return (value as number[]).map(String);\n};\n\nconst convertToFloat = (value: string[] | number) => {\n if (Array.isArray(value) === false) {\n return typeof value === \"string\" ? parseFloat(value) : value;\n }\n return (value as string[]).map(v => parseFloat(v));\n};\n\nexport default (): CmsModelFieldToElasticsearchPlugin => ({\n type: \"cms-model-field-to-elastic-search\",\n name: \"cms-model-field-to-elastic-search-number\",\n fieldType: \"number\",\n unmappedType: () => {\n return \"float\";\n },\n toIndex({ value }) {\n return {\n value: convertToString(value)\n };\n },\n fromIndex({ value }) {\n return convertToFloat(value);\n }\n});\n"],"mappings":";;;;;;AAEA,MAAMA,eAAe,GAAIC,KAAwB,IAAK;EAClD,IAAIC,KAAK,CAACC,OAAO,CAACF,KAAK,CAAC,KAAK,KAAK,EAAE;IAChC,OAAOA,KAAK;EAChB;EACA,OAAQA,KAAK,CAAcG,GAAG,CAACC,MAAM,CAAC;AAC1C,CAAC;AAED,MAAMC,cAAc,GAAIL,KAAwB,IAAK;EACjD,IAAIC,KAAK,CAACC,OAAO,CAACF,KAAK,CAAC,KAAK,KAAK,EAAE;IAChC,OAAO,OAAOA,KAAK,KAAK,QAAQ,GAAGM,UAAU,CAACN,KAAK,CAAC,GAAGA,KAAK;EAChE;EACA,OAAQA,KAAK,CAAcG,GAAG,CAACI,CAAC,IAAID,UAAU,CAACC,CAAC,CAAC,CAAC;AACtD,CAAC;AAAC,IAAAC,QAAA,GAEaA,CAAA,MAA2C;EACtDC,IAAI,EAAE,mCAAmC;EACzCC,IAAI,EAAE,0CAA0C;EAChDC,SAAS,EAAE,QAAQ;EACnBC,YAAY,EAAEA,CAAA,KAAM;IAChB,OAAO,OAAO;EAClB,CAAC;EACDC,OAAOA,CAAC;IAAEb;EAAM,CAAC,EAAE;IACf,OAAO;MACHA,KAAK,EAAED,eAAe,CAACC,KAAK;IAChC,CAAC;EACL,CAAC;EACDc,SAASA,CAAC;IAAEd;EAAM,CAAC,EAAE;IACjB,OAAOK,cAAc,CAACL,KAAK,CAAC;EAChC;AACJ,CAAC,CAAC;AAAAe,OAAA,CAAAC,OAAA,GAAAR,QAAA","ignoreList":[]}
|
|
@@ -1,3 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* TODO remove rawValue when field aliases and field types targeting will be active.
|
|
3
|
+
*
|
|
4
|
+
* Currently we use rawValue for the values that we do not want to be indexed.
|
|
5
|
+
* When field aliases and types in the value path will be active, we can target the keys directly.
|
|
6
|
+
*
|
|
7
|
+
* This change will be incompatible with the current systems so we will need to release a major version.
|
|
8
|
+
*
|
|
9
|
+
*/
|
|
10
|
+
import type { CmsModelFieldToElasticsearchPlugin } from "../../types";
|
|
2
11
|
declare const _default: () => CmsModelFieldToElasticsearchPlugin;
|
|
3
12
|
export default _default;
|