@webiny/api-headless-cms-ddb-es 0.0.0-unstable.78f581c1d2 → 0.0.0-unstable.7be00a75a9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -30
- package/configurations.d.ts +13 -6
- package/configurations.js +28 -40
- package/configurations.js.map +1 -1
- package/definitions/entry.d.ts +4 -5
- package/definitions/entry.js +9 -88
- package/definitions/entry.js.map +1 -1
- package/definitions/group.d.ts +6 -6
- package/definitions/group.js +9 -68
- package/definitions/group.js.map +1 -1
- package/definitions/model.d.ts +6 -6
- package/definitions/model.js +9 -90
- package/definitions/model.js.map +1 -1
- package/definitions/types.d.ts +65 -0
- package/definitions/types.js +0 -0
- package/elasticsearch/createElasticsearchIndex.d.ts +5 -5
- package/elasticsearch/createElasticsearchIndex.js +53 -56
- package/elasticsearch/createElasticsearchIndex.js.map +1 -1
- package/elasticsearch/deleteElasticsearchIndex.d.ts +3 -3
- package/elasticsearch/deleteElasticsearchIndex.js +20 -40
- package/elasticsearch/deleteElasticsearchIndex.js.map +1 -1
- package/exports/api/cms/opensearch.d.ts +9 -0
- package/exports/api/cms/opensearch.js +9 -0
- package/feature.d.ts +1 -0
- package/feature.js +179 -0
- package/feature.js.map +1 -0
- package/features/CmsEntryOpenSearchBodyModifier/abstractions.d.ts +16 -0
- package/features/CmsEntryOpenSearchBodyModifier/abstractions.js +5 -0
- package/features/CmsEntryOpenSearchBodyModifier/abstractions.js.map +1 -0
- package/features/CmsEntryOpenSearchBodyModifier/index.d.ts +1 -0
- package/features/CmsEntryOpenSearchBodyModifier/index.js +1 -0
- package/features/CmsEntryOpenSearchFieldIndex/CmsEntryOpenSearchFieldIndexRegistry.d.ts +14 -0
- package/features/CmsEntryOpenSearchFieldIndex/CmsEntryOpenSearchFieldIndexRegistry.js +42 -0
- package/features/CmsEntryOpenSearchFieldIndex/CmsEntryOpenSearchFieldIndexRegistry.js.map +1 -0
- package/features/CmsEntryOpenSearchFieldIndex/abstractions/CmsEntryOpenSearchFieldIndex.d.ts +32 -0
- package/features/CmsEntryOpenSearchFieldIndex/abstractions/CmsEntryOpenSearchFieldIndex.js +5 -0
- package/features/CmsEntryOpenSearchFieldIndex/abstractions/CmsEntryOpenSearchFieldIndex.js.map +1 -0
- package/features/CmsEntryOpenSearchFieldIndex/abstractions/CmsEntryOpenSearchFieldIndexRegistry.d.ts +11 -0
- package/features/CmsEntryOpenSearchFieldIndex/abstractions/CmsEntryOpenSearchFieldIndexRegistry.js +5 -0
- package/features/CmsEntryOpenSearchFieldIndex/abstractions/CmsEntryOpenSearchFieldIndexRegistry.js.map +1 -0
- package/features/CmsEntryOpenSearchFieldIndex/constants.d.ts +1 -0
- package/features/CmsEntryOpenSearchFieldIndex/constants.js +4 -0
- package/features/CmsEntryOpenSearchFieldIndex/constants.js.map +1 -0
- package/features/CmsEntryOpenSearchFieldIndex/feature.d.ts +4 -0
- package/features/CmsEntryOpenSearchFieldIndex/feature.js +29 -0
- package/features/CmsEntryOpenSearchFieldIndex/feature.js.map +1 -0
- package/features/CmsEntryOpenSearchFieldIndex/fields/DateTimeFieldIndex.d.ts +11 -0
- package/features/CmsEntryOpenSearchFieldIndex/fields/DateTimeFieldIndex.js +60 -0
- package/features/CmsEntryOpenSearchFieldIndex/fields/DateTimeFieldIndex.js.map +1 -0
- package/features/CmsEntryOpenSearchFieldIndex/fields/DefaultFieldIndex.d.ts +13 -0
- package/features/CmsEntryOpenSearchFieldIndex/fields/DefaultFieldIndex.js +33 -0
- package/features/CmsEntryOpenSearchFieldIndex/fields/DefaultFieldIndex.js.map +1 -0
- package/features/CmsEntryOpenSearchFieldIndex/fields/JsonFieldIndex.d.ts +10 -0
- package/features/CmsEntryOpenSearchFieldIndex/fields/JsonFieldIndex.js +21 -0
- package/features/CmsEntryOpenSearchFieldIndex/fields/JsonFieldIndex.js.map +1 -0
- package/features/CmsEntryOpenSearchFieldIndex/fields/LongTextFieldIndex.d.ts +10 -0
- package/features/CmsEntryOpenSearchFieldIndex/fields/LongTextFieldIndex.js +22 -0
- package/features/CmsEntryOpenSearchFieldIndex/fields/LongTextFieldIndex.js.map +1 -0
- package/features/CmsEntryOpenSearchFieldIndex/fields/NumberFieldIndex.d.ts +11 -0
- package/features/CmsEntryOpenSearchFieldIndex/fields/NumberFieldIndex.js +32 -0
- package/features/CmsEntryOpenSearchFieldIndex/fields/NumberFieldIndex.js.map +1 -0
- package/features/CmsEntryOpenSearchFieldIndex/fields/ObjectFieldIndex.d.ts +12 -0
- package/features/CmsEntryOpenSearchFieldIndex/fields/ObjectFieldIndex.js +107 -0
- package/features/CmsEntryOpenSearchFieldIndex/fields/ObjectFieldIndex.js.map +1 -0
- package/features/CmsEntryOpenSearchFieldIndex/fields/RichTextFieldIndex.d.ts +10 -0
- package/features/CmsEntryOpenSearchFieldIndex/fields/RichTextFieldIndex.js +21 -0
- package/features/CmsEntryOpenSearchFieldIndex/fields/RichTextFieldIndex.js.map +1 -0
- package/features/CmsEntryOpenSearchFieldIndex/fields/TextCompressedFieldIndex.d.ts +15 -0
- package/features/CmsEntryOpenSearchFieldIndex/fields/TextCompressedFieldIndex.js +40 -0
- package/features/CmsEntryOpenSearchFieldIndex/fields/TextCompressedFieldIndex.js.map +1 -0
- package/features/CmsEntryOpenSearchFieldIndex/fields/TextEncryptedFieldIndex.d.ts +15 -0
- package/features/CmsEntryOpenSearchFieldIndex/fields/TextEncryptedFieldIndex.js +40 -0
- package/features/CmsEntryOpenSearchFieldIndex/fields/TextEncryptedFieldIndex.js.map +1 -0
- package/features/CmsEntryOpenSearchFieldIndex/index.d.ts +3 -0
- package/features/CmsEntryOpenSearchFieldIndex/index.js +3 -0
- package/features/CmsEntryOpenSearchFilter/CmsEntryOpenSearchFilterRegistry.d.ts +11 -0
- package/features/CmsEntryOpenSearchFilter/CmsEntryOpenSearchFilterRegistry.js +36 -0
- package/features/CmsEntryOpenSearchFilter/CmsEntryOpenSearchFilterRegistry.js.map +1 -0
- package/features/CmsEntryOpenSearchFilter/abstractions/CmsEntryOpenSearchFilter.d.ts +37 -0
- package/features/CmsEntryOpenSearchFilter/abstractions/CmsEntryOpenSearchFilter.js +5 -0
- package/features/CmsEntryOpenSearchFilter/abstractions/CmsEntryOpenSearchFilter.js.map +1 -0
- package/features/CmsEntryOpenSearchFilter/abstractions/CmsEntryOpenSearchFilterRegistry.d.ts +9 -0
- package/features/CmsEntryOpenSearchFilter/abstractions/CmsEntryOpenSearchFilterRegistry.js +5 -0
- package/features/CmsEntryOpenSearchFilter/abstractions/CmsEntryOpenSearchFilterRegistry.js.map +1 -0
- package/features/CmsEntryOpenSearchFilter/constants.d.ts +1 -0
- package/features/CmsEntryOpenSearchFilter/constants.js +4 -0
- package/features/CmsEntryOpenSearchFilter/constants.js.map +1 -0
- package/features/CmsEntryOpenSearchFilter/feature.d.ts +4 -0
- package/features/CmsEntryOpenSearchFilter/feature.js +17 -0
- package/features/CmsEntryOpenSearchFilter/feature.js.map +1 -0
- package/features/CmsEntryOpenSearchFilter/fields/DefaultFilter.d.ts +9 -0
- package/features/CmsEntryOpenSearchFilter/fields/DefaultFilter.js +26 -0
- package/features/CmsEntryOpenSearchFilter/fields/DefaultFilter.js.map +1 -0
- package/features/CmsEntryOpenSearchFilter/fields/ObjectFilter.d.ts +9 -0
- package/features/CmsEntryOpenSearchFilter/fields/ObjectFilter.js +43 -0
- package/features/CmsEntryOpenSearchFilter/fields/ObjectFilter.js.map +1 -0
- package/features/CmsEntryOpenSearchFilter/fields/RefFilter.d.ts +9 -0
- package/features/CmsEntryOpenSearchFilter/fields/RefFilter.js +36 -0
- package/features/CmsEntryOpenSearchFilter/fields/RefFilter.js.map +1 -0
- package/features/CmsEntryOpenSearchFilter/index.d.ts +3 -0
- package/features/CmsEntryOpenSearchFilter/index.js +3 -0
- package/features/CmsEntryOpenSearchFullTextSearch/abstractions.d.ts +20 -0
- package/features/CmsEntryOpenSearchFullTextSearch/abstractions.js +5 -0
- package/features/CmsEntryOpenSearchFullTextSearch/abstractions.js.map +1 -0
- package/features/CmsEntryOpenSearchFullTextSearch/index.d.ts +1 -0
- package/features/CmsEntryOpenSearchFullTextSearch/index.js +1 -0
- package/features/CmsEntryOpenSearchIndex/BaseOpenSearchIndex.d.ts +11 -0
- package/features/CmsEntryOpenSearchIndex/BaseOpenSearchIndex.js +17 -0
- package/features/CmsEntryOpenSearchIndex/BaseOpenSearchIndex.js.map +1 -0
- package/features/CmsEntryOpenSearchIndex/abstractions.d.ts +14 -0
- package/features/CmsEntryOpenSearchIndex/abstractions.js +5 -0
- package/features/CmsEntryOpenSearchIndex/abstractions.js.map +1 -0
- package/features/CmsEntryOpenSearchIndex/feature.d.ts +4 -0
- package/features/CmsEntryOpenSearchIndex/feature.js +11 -0
- package/features/CmsEntryOpenSearchIndex/feature.js.map +1 -0
- package/features/CmsEntryOpenSearchIndex/index.d.ts +3 -0
- package/features/CmsEntryOpenSearchIndex/index.js +3 -0
- package/features/CmsEntryOpenSearchQueryModifier/abstractions.d.ts +16 -0
- package/features/CmsEntryOpenSearchQueryModifier/abstractions.js +5 -0
- package/features/CmsEntryOpenSearchQueryModifier/abstractions.js.map +1 -0
- package/features/CmsEntryOpenSearchQueryModifier/index.d.ts +1 -0
- package/features/CmsEntryOpenSearchQueryModifier/index.js +1 -0
- package/features/CmsEntryOpenSearchSortModifier/abstractions.d.ts +15 -0
- package/features/CmsEntryOpenSearchSortModifier/abstractions.js +5 -0
- package/features/CmsEntryOpenSearchSortModifier/abstractions.js.map +1 -0
- package/features/CmsEntryOpenSearchSortModifier/index.d.ts +1 -0
- package/features/CmsEntryOpenSearchSortModifier/index.js +1 -0
- package/features/CmsEntryOpenSearchValueSearch/CmsEntryOpenSearchValueSearchRegistry.d.ts +12 -0
- package/features/CmsEntryOpenSearchValueSearch/CmsEntryOpenSearchValueSearchRegistry.js +31 -0
- package/features/CmsEntryOpenSearchValueSearch/CmsEntryOpenSearchValueSearchRegistry.js.map +1 -0
- package/features/CmsEntryOpenSearchValueSearch/abstractions/CmsEntryOpenSearchValueSearch.d.ts +22 -0
- package/features/CmsEntryOpenSearchValueSearch/abstractions/CmsEntryOpenSearchValueSearch.js +5 -0
- package/features/CmsEntryOpenSearchValueSearch/abstractions/CmsEntryOpenSearchValueSearch.js.map +1 -0
- package/features/CmsEntryOpenSearchValueSearch/abstractions/CmsEntryOpenSearchValueSearchRegistry.d.ts +10 -0
- package/features/CmsEntryOpenSearchValueSearch/abstractions/CmsEntryOpenSearchValueSearchRegistry.js +5 -0
- package/features/CmsEntryOpenSearchValueSearch/abstractions/CmsEntryOpenSearchValueSearchRegistry.js.map +1 -0
- package/features/CmsEntryOpenSearchValueSearch/feature.d.ts +4 -0
- package/features/CmsEntryOpenSearchValueSearch/feature.js +17 -0
- package/features/CmsEntryOpenSearchValueSearch/feature.js.map +1 -0
- package/features/CmsEntryOpenSearchValueSearch/fields/RefSearch.d.ts +10 -0
- package/features/CmsEntryOpenSearchValueSearch/fields/RefSearch.js +21 -0
- package/features/CmsEntryOpenSearchValueSearch/fields/RefSearch.js.map +1 -0
- package/features/CmsEntryOpenSearchValueSearch/fields/SearchableJsonSearch.d.ts +10 -0
- package/features/CmsEntryOpenSearchValueSearch/fields/SearchableJsonSearch.js +44 -0
- package/features/CmsEntryOpenSearchValueSearch/fields/SearchableJsonSearch.js.map +1 -0
- package/features/CmsEntryOpenSearchValueSearch/fields/TimeSearch.d.ts +10 -0
- package/features/CmsEntryOpenSearchValueSearch/fields/TimeSearch.js +22 -0
- package/features/CmsEntryOpenSearchValueSearch/fields/TimeSearch.js.map +1 -0
- package/features/CmsEntryOpenSearchValueSearch/index.d.ts +3 -0
- package/features/CmsEntryOpenSearchValueSearch/index.js +3 -0
- package/features/CmsEntryOpenSearchValuesModifier/abstractions.d.ts +23 -0
- package/features/CmsEntryOpenSearchValuesModifier/abstractions.js +5 -0
- package/features/CmsEntryOpenSearchValuesModifier/abstractions.js.map +1 -0
- package/features/CmsEntryOpenSearchValuesModifier/index.d.ts +1 -0
- package/features/CmsEntryOpenSearchValuesModifier/index.js +1 -0
- package/helpers/entryIndexHelpers.d.ts +13 -11
- package/helpers/entryIndexHelpers.js +72 -196
- package/helpers/entryIndexHelpers.js.map +1 -1
- package/helpers/fieldIdentifier.d.ts +6 -0
- package/helpers/fieldIdentifier.js +23 -0
- package/helpers/fieldIdentifier.js.map +1 -0
- package/helpers/index.d.ts +2 -2
- package/helpers/index.js +2 -31
- package/index.d.ts +1 -3
- package/index.js +1 -268
- package/operations/entry/dataLoader/DataLoaderCache.d.ts +16 -0
- package/operations/entry/dataLoader/DataLoaderCache.js +27 -0
- package/operations/entry/dataLoader/DataLoaderCache.js.map +1 -0
- package/operations/entry/dataLoader/constants.d.ts +1 -0
- package/operations/entry/dataLoader/constants.js +5 -0
- package/operations/entry/dataLoader/constants.js.map +1 -0
- package/operations/entry/dataLoader/createBatchScheduleFn.d.ts +8 -0
- package/operations/entry/dataLoader/createBatchScheduleFn.js +10 -0
- package/operations/entry/dataLoader/createBatchScheduleFn.js.map +1 -0
- package/operations/entry/dataLoader/getAllEntryRevisions.d.ts +4 -0
- package/operations/entry/dataLoader/getAllEntryRevisions.js +24 -0
- package/operations/entry/dataLoader/getAllEntryRevisions.js.map +1 -0
- package/operations/entry/dataLoader/getLatestRevisionByEntryId.d.ts +4 -0
- package/operations/entry/dataLoader/getLatestRevisionByEntryId.js +34 -0
- package/operations/entry/dataLoader/getLatestRevisionByEntryId.js.map +1 -0
- package/operations/entry/dataLoader/getPublishedRevisionByEntryId.d.ts +4 -0
- package/operations/entry/dataLoader/getPublishedRevisionByEntryId.js +34 -0
- package/operations/entry/dataLoader/getPublishedRevisionByEntryId.js.map +1 -0
- package/operations/entry/dataLoader/getRevisionById.d.ts +4 -0
- package/operations/entry/dataLoader/getRevisionById.js +40 -0
- package/operations/entry/dataLoader/getRevisionById.js.map +1 -0
- package/operations/entry/dataLoader/index.d.ts +8 -0
- package/operations/entry/dataLoader/index.js +18 -0
- package/operations/entry/dataLoader/index.js.map +1 -0
- package/operations/entry/dataLoader/types.d.ts +6 -0
- package/operations/entry/dataLoader/types.js +0 -0
- package/operations/entry/dataLoaders.d.ts +17 -38
- package/operations/entry/dataLoaders.js +82 -357
- package/operations/entry/dataLoaders.js.map +1 -1
- package/operations/entry/elasticsearch/assignMinimumShouldMatchToQuery.d.ts +18 -0
- package/operations/entry/elasticsearch/assignMinimumShouldMatchToQuery.js +9 -0
- package/operations/entry/elasticsearch/assignMinimumShouldMatchToQuery.js.map +1 -0
- package/operations/entry/elasticsearch/body.d.ts +29 -0
- package/operations/entry/elasticsearch/body.js +87 -0
- package/operations/entry/elasticsearch/body.js.map +1 -0
- package/operations/entry/elasticsearch/fields/createSystemField.d.ts +4 -0
- package/operations/entry/elasticsearch/fields/createSystemField.js +9 -0
- package/operations/entry/elasticsearch/fields/createSystemField.js.map +1 -0
- package/operations/entry/elasticsearch/fields/live.d.ts +2 -0
- package/operations/entry/elasticsearch/fields/live.js +50 -0
- package/operations/entry/elasticsearch/fields/live.js.map +1 -0
- package/operations/entry/elasticsearch/fields/location.d.ts +2 -0
- package/operations/entry/elasticsearch/fields/location.js +50 -0
- package/operations/entry/elasticsearch/fields/location.js.map +1 -0
- package/operations/entry/elasticsearch/fields/state.d.ts +2 -0
- package/operations/entry/elasticsearch/fields/state.js +104 -0
- package/operations/entry/elasticsearch/fields/state.js.map +1 -0
- package/operations/entry/elasticsearch/fields.d.ts +12 -0
- package/operations/entry/elasticsearch/fields.js +207 -0
- package/operations/entry/elasticsearch/fields.js.map +1 -0
- package/operations/entry/elasticsearch/filtering/applyFiltering.d.ts +9 -0
- package/operations/entry/elasticsearch/filtering/applyFiltering.js +39 -0
- package/operations/entry/elasticsearch/filtering/applyFiltering.js.map +1 -0
- package/operations/entry/elasticsearch/filtering/exec.d.ts +22 -0
- package/operations/entry/elasticsearch/filtering/exec.js +96 -0
- package/operations/entry/elasticsearch/filtering/exec.js.map +1 -0
- package/operations/entry/elasticsearch/filtering/index.d.ts +1 -0
- package/operations/entry/elasticsearch/filtering/index.js +1 -0
- package/operations/entry/elasticsearch/filtering/path.d.ts +17 -0
- package/operations/entry/elasticsearch/filtering/path.js +27 -0
- package/operations/entry/elasticsearch/filtering/path.js.map +1 -0
- package/operations/entry/elasticsearch/filtering/populated.d.ts +2 -0
- package/operations/entry/elasticsearch/filtering/populated.js +12 -0
- package/operations/entry/elasticsearch/filtering/populated.js.map +1 -0
- package/operations/entry/elasticsearch/filtering/values.d.ts +2 -0
- package/operations/entry/elasticsearch/filtering/values.js +15 -0
- package/operations/entry/elasticsearch/filtering/values.js.map +1 -0
- package/operations/entry/elasticsearch/fullTextSearch.d.ts +13 -0
- package/operations/entry/elasticsearch/fullTextSearch.js +51 -0
- package/operations/entry/elasticsearch/fullTextSearch.js.map +1 -0
- package/operations/entry/elasticsearch/fullTextSearchFields.d.ts +8 -0
- package/operations/entry/elasticsearch/fullTextSearchFields.js +10 -0
- package/operations/entry/elasticsearch/fullTextSearchFields.js.map +1 -0
- package/operations/entry/elasticsearch/initialQuery.d.ts +17 -0
- package/operations/entry/elasticsearch/initialQuery.js +45 -0
- package/operations/entry/elasticsearch/initialQuery.js.map +1 -0
- package/operations/entry/elasticsearch/keyword.d.ts +2 -0
- package/operations/entry/elasticsearch/keyword.js +17 -0
- package/operations/entry/elasticsearch/keyword.js.map +1 -0
- package/operations/entry/elasticsearch/plugins/operator.d.ts +7 -0
- package/operations/entry/elasticsearch/plugins/operator.js +13 -0
- package/operations/entry/elasticsearch/plugins/operator.js.map +1 -0
- package/operations/entry/elasticsearch/shouldIgnoreEsResponseError.d.ts +2 -0
- package/operations/entry/elasticsearch/shouldIgnoreEsResponseError.js +8 -0
- package/operations/entry/elasticsearch/shouldIgnoreEsResponseError.js.map +1 -0
- package/operations/entry/elasticsearch/sort.d.ts +12 -0
- package/operations/entry/elasticsearch/sort.js +80 -0
- package/operations/entry/elasticsearch/sort.js.map +1 -0
- package/operations/entry/elasticsearch/transformValueForSearch.d.ts +9 -0
- package/operations/entry/elasticsearch/transformValueForSearch.js +12 -0
- package/operations/entry/elasticsearch/transformValueForSearch.js.map +1 -0
- package/operations/entry/elasticsearch/types.d.ts +34 -0
- package/operations/entry/elasticsearch/types.js +0 -0
- package/operations/entry/index.d.ts +27 -8
- package/operations/entry/index.js +1344 -1245
- package/operations/entry/index.js.map +1 -1
- package/operations/entry/keys.d.ts +31 -1
- package/operations/entry/keys.js +45 -35
- package/operations/entry/keys.js.map +1 -1
- package/operations/entry/recordType.d.ts +3 -0
- package/operations/entry/recordType.js +6 -0
- package/operations/entry/recordType.js.map +1 -0
- package/operations/entry/transformations/convertEntryKeys.d.ts +8 -0
- package/operations/entry/transformations/convertEntryKeys.js +25 -0
- package/operations/entry/transformations/convertEntryKeys.js.map +1 -0
- package/operations/entry/transformations/index.d.ts +33 -0
- package/operations/entry/transformations/index.js +91 -0
- package/operations/entry/transformations/index.js.map +1 -0
- package/operations/entry/transformations/modifyEntryValues.d.ts +53 -0
- package/operations/entry/transformations/modifyEntryValues.js +16 -0
- package/operations/entry/transformations/modifyEntryValues.js.map +1 -0
- package/operations/entry/transformations/transformEntryKeys.d.ts +11 -0
- package/operations/entry/transformations/transformEntryKeys.js +17 -0
- package/operations/entry/transformations/transformEntryKeys.js.map +1 -0
- package/operations/entry/transformations/transformEntryToIndex.d.ts +10 -0
- package/operations/entry/transformations/transformEntryToIndex.js +20 -0
- package/operations/entry/transformations/transformEntryToIndex.js.map +1 -0
- package/operations/group/index.d.ts +7 -6
- package/operations/group/index.js +116 -190
- package/operations/group/index.js.map +1 -1
- package/operations/model/index.d.ts +4 -4
- package/operations/model/index.js +130 -199
- package/operations/model/index.js.map +1 -1
- package/package.json +44 -41
- package/tasks/createIndexTaskPlugin.d.ts +2 -0
- package/tasks/createIndexTaskPlugin.js +45 -0
- package/tasks/createIndexTaskPlugin.js.map +1 -0
- package/types.d.ts +34 -137
- package/types.js +10 -47
- package/types.js.map +1 -1
- package/values/NoValueContainer.d.ts +5 -0
- package/values/NoValueContainer.js +11 -0
- package/values/NoValueContainer.js.map +1 -0
- package/definitions/entryElasticsearch.d.ts +0 -8
- package/definitions/entryElasticsearch.js +0 -42
- package/definitions/entryElasticsearch.js.map +0 -1
- package/definitions/settings.d.ts +0 -8
- package/definitions/settings.js +0 -58
- package/definitions/settings.js.map +0 -1
- package/definitions/system.d.ts +0 -8
- package/definitions/system.js +0 -46
- package/definitions/system.js.map +0 -1
- package/definitions/table.d.ts +0 -8
- package/definitions/table.js +0 -24
- package/definitions/table.js.map +0 -1
- package/definitions/tableElasticsearch.d.ts +0 -8
- package/definitions/tableElasticsearch.js +0 -24
- package/definitions/tableElasticsearch.js.map +0 -1
- package/dynamoDb/index.d.ts +0 -2
- package/dynamoDb/index.js +0 -16
- package/dynamoDb/index.js.map +0 -1
- package/dynamoDb/storage/date.d.ts +0 -2
- package/dynamoDb/storage/date.js +0 -99
- package/dynamoDb/storage/date.js.map +0 -1
- package/dynamoDb/storage/longText.d.ts +0 -10
- package/dynamoDb/storage/longText.js +0 -101
- package/dynamoDb/storage/longText.js.map +0 -1
- package/dynamoDb/storage/richText.d.ts +0 -7
- package/dynamoDb/storage/richText.js +0 -128
- package/dynamoDb/storage/richText.js.map +0 -1
- package/elasticsearch/index.d.ts +0 -2
- package/elasticsearch/index.js +0 -16
- package/elasticsearch/index.js.map +0 -1
- package/elasticsearch/indexing/dateTimeIndexing.d.ts +0 -3
- package/elasticsearch/indexing/dateTimeIndexing.js +0 -103
- package/elasticsearch/indexing/dateTimeIndexing.js.map +0 -1
- package/elasticsearch/indexing/defaultFieldIndexing.d.ts +0 -3
- package/elasticsearch/indexing/defaultFieldIndexing.js +0 -47
- package/elasticsearch/indexing/defaultFieldIndexing.js.map +0 -1
- package/elasticsearch/indexing/index.d.ts +0 -2
- package/elasticsearch/indexing/index.js +0 -24
- package/elasticsearch/indexing/index.js.map +0 -1
- package/elasticsearch/indexing/longTextIndexing.d.ts +0 -3
- package/elasticsearch/indexing/longTextIndexing.js +0 -36
- package/elasticsearch/indexing/longTextIndexing.js.map +0 -1
- package/elasticsearch/indexing/numberIndexing.d.ts +0 -3
- package/elasticsearch/indexing/numberIndexing.js +0 -48
- package/elasticsearch/indexing/numberIndexing.js.map +0 -1
- package/elasticsearch/indexing/objectIndexing.d.ts +0 -12
- package/elasticsearch/indexing/objectIndexing.js +0 -223
- package/elasticsearch/indexing/objectIndexing.js.map +0 -1
- package/elasticsearch/indexing/richTextIndexing.d.ts +0 -3
- package/elasticsearch/indexing/richTextIndexing.js +0 -34
- package/elasticsearch/indexing/richTextIndexing.js.map +0 -1
- package/elasticsearch/indices/base.d.ts +0 -2
- package/elasticsearch/indices/base.js +0 -15
- package/elasticsearch/indices/base.js.map +0 -1
- package/elasticsearch/indices/index.d.ts +0 -1
- package/elasticsearch/indices/index.js +0 -16
- package/elasticsearch/indices/index.js.map +0 -1
- package/elasticsearch/indices/japanese.d.ts +0 -2
- package/elasticsearch/indices/japanese.js +0 -16
- package/elasticsearch/indices/japanese.js.map +0 -1
- package/elasticsearch/search/index.d.ts +0 -3
- package/elasticsearch/search/index.js +0 -14
- package/elasticsearch/search/index.js.map +0 -1
- package/elasticsearch/search/refSearch.d.ts +0 -2
- package/elasticsearch/search/refSearch.js +0 -33
- package/elasticsearch/search/refSearch.js.map +0 -1
- package/elasticsearch/search/timeSearch.d.ts +0 -2
- package/elasticsearch/search/timeSearch.js +0 -33
- package/elasticsearch/search/timeSearch.js.map +0 -1
- package/helpers/createElasticsearchQueryBody.d.ts +0 -11
- package/helpers/createElasticsearchQueryBody.js +0 -611
- package/helpers/createElasticsearchQueryBody.js.map +0 -1
- package/helpers/fields.d.ts +0 -19
- package/helpers/fields.js +0 -205
- package/helpers/fields.js.map +0 -1
- package/helpers/index.js.map +0 -1
- package/helpers/searchPluginsList.d.ts +0 -6
- package/helpers/searchPluginsList.js +0 -26
- package/helpers/searchPluginsList.js.map +0 -1
- package/helpers/transformValueForSearch.d.ts +0 -12
- package/helpers/transformValueForSearch.js +0 -29
- package/helpers/transformValueForSearch.js.map +0 -1
- package/index.js.map +0 -1
- package/operations/entry/elasticsearchFields.d.ts +0 -2
- package/operations/entry/elasticsearchFields.js +0 -38
- package/operations/entry/elasticsearchFields.js.map +0 -1
- package/operations/settings/index.d.ts +0 -6
- package/operations/settings/index.js +0 -135
- package/operations/settings/index.js.map +0 -1
- package/operations/system/index.d.ts +0 -6
- package/operations/system/index.js +0 -99
- package/operations/system/index.js.map +0 -1
- package/plugins/CmsEntryElasticsearchBodyModifierPlugin.d.ts +0 -20
- package/plugins/CmsEntryElasticsearchBodyModifierPlugin.js +0 -24
- package/plugins/CmsEntryElasticsearchBodyModifierPlugin.js.map +0 -1
- package/plugins/CmsEntryElasticsearchFieldPlugin.d.ts +0 -12
- package/plugins/CmsEntryElasticsearchFieldPlugin.js +0 -24
- package/plugins/CmsEntryElasticsearchFieldPlugin.js.map +0 -1
- package/plugins/CmsEntryElasticsearchIndexPlugin.d.ts +0 -4
- package/plugins/CmsEntryElasticsearchIndexPlugin.js +0 -17
- package/plugins/CmsEntryElasticsearchIndexPlugin.js.map +0 -1
- package/plugins/CmsEntryElasticsearchQueryBuilderValueSearchPlugin.d.ts +0 -30
- package/plugins/CmsEntryElasticsearchQueryBuilderValueSearchPlugin.js +0 -43
- package/plugins/CmsEntryElasticsearchQueryBuilderValueSearchPlugin.js.map +0 -1
- package/plugins/CmsEntryElasticsearchQueryModifierPlugin.d.ts +0 -17
- package/plugins/CmsEntryElasticsearchQueryModifierPlugin.js +0 -24
- package/plugins/CmsEntryElasticsearchQueryModifierPlugin.js.map +0 -1
- package/plugins/CmsEntryElasticsearchSortModifierPlugin.d.ts +0 -17
- package/plugins/CmsEntryElasticsearchSortModifierPlugin.js +0 -24
- package/plugins/CmsEntryElasticsearchSortModifierPlugin.js.map +0 -1
- package/plugins/index.d.ts +0 -6
- package/plugins/index.js +0 -83
- package/plugins/index.js.map +0 -1
package/helpers/fields.d.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { CmsModel, CmsModelField } from "@webiny/api-headless-cms/types";
|
|
2
|
-
import { PluginsContainer } from "@webiny/plugins";
|
|
3
|
-
declare type ModelFieldPath = string | ((value: string) => string);
|
|
4
|
-
export interface ModelField {
|
|
5
|
-
unmappedType?: string;
|
|
6
|
-
keyword?: boolean;
|
|
7
|
-
isSearchable: boolean;
|
|
8
|
-
isSortable: boolean;
|
|
9
|
-
type: string;
|
|
10
|
-
isSystemField?: boolean;
|
|
11
|
-
field: CmsModelField;
|
|
12
|
-
path?: ModelFieldPath;
|
|
13
|
-
}
|
|
14
|
-
export interface ModelFields {
|
|
15
|
-
[fieldId: string]: ModelField;
|
|
16
|
-
}
|
|
17
|
-
export declare const systemFields: ModelFields;
|
|
18
|
-
export declare const createModelFields: (plugins: PluginsContainer, model: CmsModel) => ModelFields;
|
|
19
|
-
export {};
|
package/helpers/fields.js
DELETED
|
@@ -1,205 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.systemFields = exports.createModelFields = void 0;
|
|
9
|
-
|
|
10
|
-
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
11
|
-
|
|
12
|
-
var _error = _interopRequireDefault(require("@webiny/error"));
|
|
13
|
-
|
|
14
|
-
var _cloneDeep = _interopRequireDefault(require("lodash/cloneDeep"));
|
|
15
|
-
|
|
16
|
-
const createSystemField = field => {
|
|
17
|
-
if (!field.storageId) {
|
|
18
|
-
throw new _error.default(`When creating system field it must have a "storageId".`, "SYSTEM_FIELD_ERROR", {
|
|
19
|
-
field
|
|
20
|
-
});
|
|
21
|
-
} else if (!field.fieldId) {
|
|
22
|
-
throw new _error.default(`When creating system field it must have a "fieldId".`, "SYSTEM_FIELD_ERROR", {
|
|
23
|
-
field
|
|
24
|
-
});
|
|
25
|
-
} else if (!field.type) {
|
|
26
|
-
throw new _error.default(`When creating system field it must have a "type".`, "SYSTEM_FIELD_ERROR", {
|
|
27
|
-
field
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, field), {}, {
|
|
32
|
-
id: field.fieldId,
|
|
33
|
-
label: field.fieldId
|
|
34
|
-
});
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
const systemFields = {
|
|
38
|
-
id: {
|
|
39
|
-
type: "text",
|
|
40
|
-
isSystemField: true,
|
|
41
|
-
isSearchable: true,
|
|
42
|
-
isSortable: true,
|
|
43
|
-
field: createSystemField({
|
|
44
|
-
storageId: "id",
|
|
45
|
-
fieldId: "id",
|
|
46
|
-
type: "text"
|
|
47
|
-
})
|
|
48
|
-
},
|
|
49
|
-
entryId: {
|
|
50
|
-
type: "text",
|
|
51
|
-
isSystemField: true,
|
|
52
|
-
isSearchable: true,
|
|
53
|
-
isSortable: true,
|
|
54
|
-
field: createSystemField({
|
|
55
|
-
storageId: "entryId",
|
|
56
|
-
fieldId: "entryId",
|
|
57
|
-
type: "text"
|
|
58
|
-
})
|
|
59
|
-
},
|
|
60
|
-
savedOn: {
|
|
61
|
-
type: "date",
|
|
62
|
-
unmappedType: "date",
|
|
63
|
-
keyword: false,
|
|
64
|
-
isSystemField: true,
|
|
65
|
-
isSearchable: true,
|
|
66
|
-
isSortable: true,
|
|
67
|
-
field: createSystemField({
|
|
68
|
-
storageId: "savedOn",
|
|
69
|
-
fieldId: "savedOn",
|
|
70
|
-
type: "datetime",
|
|
71
|
-
settings: {
|
|
72
|
-
type: "dateTimeWithoutTimezone"
|
|
73
|
-
}
|
|
74
|
-
})
|
|
75
|
-
},
|
|
76
|
-
createdOn: {
|
|
77
|
-
type: "date",
|
|
78
|
-
unmappedType: "date",
|
|
79
|
-
keyword: false,
|
|
80
|
-
isSystemField: true,
|
|
81
|
-
isSearchable: true,
|
|
82
|
-
isSortable: true,
|
|
83
|
-
field: createSystemField({
|
|
84
|
-
storageId: "createdOn",
|
|
85
|
-
fieldId: "createdOn",
|
|
86
|
-
type: "text",
|
|
87
|
-
settings: {
|
|
88
|
-
type: "dateTimeWithoutTimezone"
|
|
89
|
-
}
|
|
90
|
-
})
|
|
91
|
-
},
|
|
92
|
-
createdBy: {
|
|
93
|
-
type: "text",
|
|
94
|
-
unmappedType: undefined,
|
|
95
|
-
isSystemField: true,
|
|
96
|
-
isSearchable: true,
|
|
97
|
-
isSortable: false,
|
|
98
|
-
path: "createdBy.id",
|
|
99
|
-
field: createSystemField({
|
|
100
|
-
storageId: "createdBy",
|
|
101
|
-
fieldId: "createdBy",
|
|
102
|
-
type: "text"
|
|
103
|
-
})
|
|
104
|
-
},
|
|
105
|
-
ownedBy: {
|
|
106
|
-
type: "text",
|
|
107
|
-
unmappedType: undefined,
|
|
108
|
-
isSystemField: true,
|
|
109
|
-
isSearchable: true,
|
|
110
|
-
isSortable: false,
|
|
111
|
-
path: "ownedBy.id",
|
|
112
|
-
field: createSystemField({
|
|
113
|
-
storageId: "ownedBy",
|
|
114
|
-
fieldId: "ownedBy",
|
|
115
|
-
type: "text"
|
|
116
|
-
})
|
|
117
|
-
},
|
|
118
|
-
version: {
|
|
119
|
-
type: "number",
|
|
120
|
-
unmappedType: undefined,
|
|
121
|
-
keyword: false,
|
|
122
|
-
isSystemField: true,
|
|
123
|
-
isSearchable: true,
|
|
124
|
-
isSortable: true,
|
|
125
|
-
field: createSystemField({
|
|
126
|
-
storageId: "version",
|
|
127
|
-
fieldId: "version",
|
|
128
|
-
type: "number"
|
|
129
|
-
})
|
|
130
|
-
},
|
|
131
|
-
status: {
|
|
132
|
-
type: "string",
|
|
133
|
-
unmappedType: undefined,
|
|
134
|
-
keyword: false,
|
|
135
|
-
isSystemField: true,
|
|
136
|
-
isSearchable: true,
|
|
137
|
-
isSortable: false,
|
|
138
|
-
field: createSystemField({
|
|
139
|
-
storageId: "status",
|
|
140
|
-
fieldId: "status",
|
|
141
|
-
type: "string"
|
|
142
|
-
})
|
|
143
|
-
}
|
|
144
|
-
};
|
|
145
|
-
/*
|
|
146
|
-
* Create an object with key fieldType and options for that field
|
|
147
|
-
*/
|
|
148
|
-
|
|
149
|
-
exports.systemFields = systemFields;
|
|
150
|
-
|
|
151
|
-
const createModelFields = (plugins, model) => {
|
|
152
|
-
// collect all unmappedType from elastic plugins
|
|
153
|
-
const unmappedTypes = plugins.byType("cms-model-field-to-elastic-search").reduce((acc, plugin) => {
|
|
154
|
-
if (!plugin.unmappedType) {
|
|
155
|
-
return acc;
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
acc[plugin.fieldType] = plugin.unmappedType;
|
|
159
|
-
return acc;
|
|
160
|
-
}, {});
|
|
161
|
-
/**
|
|
162
|
-
* collect all field types from the plugins
|
|
163
|
-
*/
|
|
164
|
-
|
|
165
|
-
const fieldTypePlugins = plugins.byType("cms-model-field-to-graphql").reduce((types, plugin) => {
|
|
166
|
-
const {
|
|
167
|
-
fieldType,
|
|
168
|
-
isSearchable,
|
|
169
|
-
isSortable
|
|
170
|
-
} = plugin;
|
|
171
|
-
types[fieldType] = {
|
|
172
|
-
unmappedType: unmappedTypes[fieldType],
|
|
173
|
-
isSearchable,
|
|
174
|
-
isSortable
|
|
175
|
-
};
|
|
176
|
-
return types;
|
|
177
|
-
}, {});
|
|
178
|
-
return model.fields.reduce((fields, field) => {
|
|
179
|
-
const {
|
|
180
|
-
fieldId,
|
|
181
|
-
type
|
|
182
|
-
} = field;
|
|
183
|
-
|
|
184
|
-
if (!fieldTypePlugins[type]) {
|
|
185
|
-
throw new _error.default(`There is no plugin for field type "${type}".`);
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
const {
|
|
189
|
-
isSearchable,
|
|
190
|
-
isSortable,
|
|
191
|
-
unmappedType
|
|
192
|
-
} = fieldTypePlugins[type];
|
|
193
|
-
fields[fieldId] = {
|
|
194
|
-
type,
|
|
195
|
-
isSearchable,
|
|
196
|
-
isSortable,
|
|
197
|
-
unmappedType: typeof unmappedType === "function" ? unmappedType(field) : undefined,
|
|
198
|
-
isSystemField: false,
|
|
199
|
-
field
|
|
200
|
-
};
|
|
201
|
-
return fields;
|
|
202
|
-
}, (0, _cloneDeep.default)(systemFields));
|
|
203
|
-
};
|
|
204
|
-
|
|
205
|
-
exports.createModelFields = createModelFields;
|
package/helpers/fields.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["createSystemField","field","storageId","WebinyError","fieldId","type","id","label","systemFields","isSystemField","isSearchable","isSortable","entryId","savedOn","unmappedType","keyword","settings","createdOn","createdBy","undefined","path","ownedBy","version","status","createModelFields","plugins","model","unmappedTypes","byType","reduce","acc","plugin","fieldType","fieldTypePlugins","types","fields","lodashCloneDeep"],"sources":["fields.ts"],"sourcesContent":["import {\n CmsModel,\n CmsModelField,\n CmsModelFieldToGraphQLPlugin\n} from \"@webiny/api-headless-cms/types\";\nimport WebinyError from \"@webiny/error\";\nimport { CmsModelFieldToElasticsearchPlugin } from \"~/types\";\nimport { PluginsContainer } from \"@webiny/plugins\";\nimport lodashCloneDeep from \"lodash/cloneDeep\";\n\ntype ModelFieldPath = string | ((value: string) => string);\nexport interface ModelField {\n unmappedType?: string;\n keyword?: boolean;\n isSearchable: boolean;\n isSortable: boolean;\n type: string;\n isSystemField?: boolean;\n field: CmsModelField;\n path?: ModelFieldPath;\n}\n\nexport interface ModelFields {\n [fieldId: string]: ModelField;\n}\n\ntype UnmappedFieldTypes = {\n [type: string]: (field: CmsModelField) => string | undefined;\n};\n\ninterface FieldTypePlugin {\n unmappedType?: (field: CmsModelField) => string | undefined;\n isSearchable: boolean;\n isSortable: boolean;\n}\ntype FieldTypePlugins = Record<string, FieldTypePlugin>;\n\ntype PartialCmsModelField = Partial<CmsModelField> &\n Pick<CmsModelField, \"storageId\" | \"fieldId\" | \"type\">;\nconst createSystemField = (field: PartialCmsModelField): CmsModelField => {\n if (!field.storageId) {\n throw new WebinyError(\n `When creating system field it must have a \"storageId\".`,\n \"SYSTEM_FIELD_ERROR\",\n {\n field\n }\n );\n } else if (!field.fieldId) {\n throw new WebinyError(\n `When creating system field it must have a \"fieldId\".`,\n \"SYSTEM_FIELD_ERROR\",\n {\n field\n }\n );\n } else if (!field.type) {\n throw new WebinyError(\n `When creating system field it must have a \"type\".`,\n \"SYSTEM_FIELD_ERROR\",\n {\n field\n }\n );\n }\n return {\n ...field,\n id: field.fieldId,\n label: field.fieldId\n };\n};\n\nexport const systemFields: ModelFields = {\n id: {\n type: \"text\",\n isSystemField: true,\n isSearchable: true,\n isSortable: true,\n field: createSystemField({\n storageId: \"id\",\n fieldId: \"id\",\n type: \"text\"\n })\n },\n entryId: {\n type: \"text\",\n isSystemField: true,\n isSearchable: true,\n isSortable: true,\n field: createSystemField({\n storageId: \"entryId\",\n fieldId: \"entryId\",\n type: \"text\"\n })\n },\n savedOn: {\n type: \"date\",\n unmappedType: \"date\",\n keyword: false,\n isSystemField: true,\n isSearchable: true,\n isSortable: true,\n field: createSystemField({\n storageId: \"savedOn\",\n fieldId: \"savedOn\",\n type: \"datetime\",\n settings: {\n type: \"dateTimeWithoutTimezone\"\n }\n })\n },\n createdOn: {\n type: \"date\",\n unmappedType: \"date\",\n keyword: false,\n isSystemField: true,\n isSearchable: true,\n isSortable: true,\n field: createSystemField({\n storageId: \"createdOn\",\n fieldId: \"createdOn\",\n type: \"text\",\n settings: {\n type: \"dateTimeWithoutTimezone\"\n }\n })\n },\n createdBy: {\n type: \"text\",\n unmappedType: undefined,\n isSystemField: true,\n isSearchable: true,\n isSortable: false,\n path: \"createdBy.id\",\n field: createSystemField({\n storageId: \"createdBy\",\n fieldId: \"createdBy\",\n type: \"text\"\n })\n },\n ownedBy: {\n type: \"text\",\n unmappedType: undefined,\n isSystemField: true,\n isSearchable: true,\n isSortable: false,\n path: \"ownedBy.id\",\n field: createSystemField({\n storageId: \"ownedBy\",\n fieldId: \"ownedBy\",\n type: \"text\"\n })\n },\n version: {\n type: \"number\",\n unmappedType: undefined,\n keyword: false,\n isSystemField: true,\n isSearchable: true,\n isSortable: true,\n field: createSystemField({\n storageId: \"version\",\n fieldId: \"version\",\n type: \"number\"\n })\n },\n status: {\n type: \"string\",\n unmappedType: undefined,\n keyword: false,\n isSystemField: true,\n isSearchable: true,\n isSortable: false,\n field: createSystemField({\n storageId: \"status\",\n fieldId: \"status\",\n type: \"string\"\n })\n }\n};\n\n/*\n * Create an object with key fieldType and options for that field\n */\nexport const createModelFields = (plugins: PluginsContainer, model: CmsModel): ModelFields => {\n // collect all unmappedType from elastic plugins\n const unmappedTypes = plugins\n .byType<CmsModelFieldToElasticsearchPlugin>(\"cms-model-field-to-elastic-search\")\n .reduce((acc, plugin) => {\n if (!plugin.unmappedType) {\n return acc;\n }\n acc[plugin.fieldType] = plugin.unmappedType;\n return acc;\n }, {} as UnmappedFieldTypes);\n /**\n * collect all field types from the plugins\n */\n const fieldTypePlugins = plugins\n .byType<CmsModelFieldToGraphQLPlugin>(\"cms-model-field-to-graphql\")\n .reduce((types, plugin) => {\n const { fieldType, isSearchable, isSortable } = plugin;\n types[fieldType] = {\n unmappedType: unmappedTypes[fieldType],\n isSearchable,\n isSortable\n };\n return types;\n }, {} as FieldTypePlugins);\n\n return model.fields.reduce((fields, field) => {\n const { fieldId, type } = field;\n if (!fieldTypePlugins[type]) {\n throw new WebinyError(`There is no plugin for field type \"${type}\".`);\n }\n const { isSearchable, isSortable, unmappedType } = fieldTypePlugins[type];\n fields[fieldId] = {\n type,\n isSearchable,\n isSortable,\n unmappedType: typeof unmappedType === \"function\" ? unmappedType(field) : undefined,\n isSystemField: false,\n field\n };\n\n return fields;\n }, lodashCloneDeep(systemFields));\n};\n"],"mappings":";;;;;;;;;;;AAKA;;AAGA;;AA+BA,MAAMA,iBAAiB,GAAIC,KAAD,IAAgD;EACtE,IAAI,CAACA,KAAK,CAACC,SAAX,EAAsB;IACl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AN,CAAaN,MAAb,CAAoB,CAACM,MAAD,EAASlC,KAAT,KAAmB;IAC1C,MAAM;MAAEG,OAAF;MAAWC;IAAX,IAAoBJ,KAA1B;;IACA,IAAI,CAACgC,gBAAgB,CAAC5B,IAAD,CAArB,EAA6B;MACzB,MAAM,IAAIF,cAAJ,CAAiB,sCAAqCE,IAAK,IAA3D,CAAN;IACH;;IACD,MAAM;MAAEK,YAAF;MAAgBC,UAAhB;MAA4BG;IAA5B,IAA6CmB,gBAAgB,CAAC5B,IAAD,CAAnE;IACA8B,MAAM,CAAC/B,OAAD,CAAN,GAAkB;MACdC,IADc;MAEdK,YAFc;MAGdC,UAHc;MAIdG,YAAY,EAAE,OAAOA,YAAP,KAAwB,UAAxB,GAAqCA,YAAY,CAACb,KAAD,CAAjD,GAA2DkB,SAJ3D;MAKdV,aAAa,EAAE,KALD;MAMdR;IANc,CAAlB;IASA,OAAOkC,MAAP;EACH,CAhBM,EAgBJ,IAAAC,kBAAA,EAAgB5B,YAAhB,CAhBI,CAAP;AAiBH,CA3CM"}
|
package/helpers/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export * from \"./createElasticsearchQueryBody\";\nexport * from \"./entryIndexHelpers\";\n"],"mappings":";;;;;;AAAA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA;;AACA;;AAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { PluginsContainer } from "@webiny/plugins";
|
|
2
|
-
import { CmsEntryElasticsearchQueryBuilderValueSearchPlugin } from "../plugins/CmsEntryElasticsearchQueryBuilderValueSearchPlugin";
|
|
3
|
-
export interface ElasticsearchQuerySearchValuePlugins {
|
|
4
|
-
[fieldType: string]: CmsEntryElasticsearchQueryBuilderValueSearchPlugin;
|
|
5
|
-
}
|
|
6
|
-
export declare const searchPluginsList: (plugins: PluginsContainer) => ElasticsearchQuerySearchValuePlugins;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.searchPluginsList = void 0;
|
|
9
|
-
|
|
10
|
-
var _error = _interopRequireDefault(require("@webiny/error"));
|
|
11
|
-
|
|
12
|
-
const searchPluginsList = plugins => {
|
|
13
|
-
return plugins.byType("cms-elastic-search-query-builder-value-search").reduce((plugins, plugin) => {
|
|
14
|
-
if (plugins[plugin.fieldType]) {
|
|
15
|
-
throw new _error.default("There is a ElasticsearchQueryBuilderValueSearchPlugin defined for the field type.", "PLUGIN_ALREADY_EXISTS", {
|
|
16
|
-
fieldType: plugin.fieldType,
|
|
17
|
-
name: plugin.name || "unknown"
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
plugins[plugin.fieldType] = plugin;
|
|
22
|
-
return plugins;
|
|
23
|
-
}, {});
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
exports.searchPluginsList = searchPluginsList;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["searchPluginsList","plugins","byType","reduce","plugin","fieldType","WebinyError","name"],"sources":["searchPluginsList.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { PluginsContainer } from \"@webiny/plugins\";\nimport { CmsEntryElasticsearchQueryBuilderValueSearchPlugin } from \"~/plugins/CmsEntryElasticsearchQueryBuilderValueSearchPlugin\";\n\nexport interface ElasticsearchQuerySearchValuePlugins {\n [fieldType: string]: CmsEntryElasticsearchQueryBuilderValueSearchPlugin;\n}\n\nexport const searchPluginsList = (\n plugins: PluginsContainer\n): ElasticsearchQuerySearchValuePlugins => {\n return plugins\n .byType<CmsEntryElasticsearchQueryBuilderValueSearchPlugin>(\n \"cms-elastic-search-query-builder-value-search\"\n )\n .reduce((plugins, plugin) => {\n if (plugins[plugin.fieldType]) {\n throw new WebinyError(\n \"There is a ElasticsearchQueryBuilderValueSearchPlugin defined for the field type.\",\n \"PLUGIN_ALREADY_EXISTS\",\n {\n fieldType: plugin.fieldType,\n name: plugin.name || \"unknown\"\n }\n );\n }\n plugins[plugin.fieldType] = plugin;\n\n return plugins;\n }, {} as ElasticsearchQuerySearchValuePlugins);\n};\n"],"mappings":";;;;;;;;;AAAA;;AAQO,MAAMA,iBAAiB,GAC1BC,OAD6B,IAEU;EACvC,OAAOA,OAAO,CACTC,MADE,CAEC,+CAFD,EAIFC,MAJE,CAIK,CAACF,OAAD,EAAUG,MAAV,KAAqB;IACzB,IAAIH,OAAO,CAACG,MAAM,CAACC,SAAR,CAAX,EAA+B;MAC3B,MAAM,IAAIC,cAAJ,CACF,mFADE,EAEF,uBAFE,EAGF;QACID,SAAS,EAAED,MAAM,CAACC,SADtB;QAEIE,IAAI,EAAEH,MAAM,CAACG,IAAP,IAAe;MAFzB,CAHE,CAAN;IAQH;;IACDN,OAAO,CAACG,MAAM,CAACC,SAAR,CAAP,GAA4BD,MAA5B;IAEA,OAAOH,OAAP;EACH,CAlBE,EAkBA,EAlBA,CAAP;AAmBH,CAtBM"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { ElasticsearchQuerySearchValuePlugins } from "./searchPluginsList";
|
|
2
|
-
import { CmsModelField } from "@webiny/api-headless-cms/types";
|
|
3
|
-
interface TransformValueForSearchParams {
|
|
4
|
-
plugins: ElasticsearchQuerySearchValuePlugins;
|
|
5
|
-
field: CmsModelField;
|
|
6
|
-
value: any;
|
|
7
|
-
}
|
|
8
|
-
/**
|
|
9
|
-
* Transformed can be anything.
|
|
10
|
-
*/
|
|
11
|
-
export declare const transformValueForSearch: (args: TransformValueForSearchParams) => any;
|
|
12
|
-
export {};
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.transformValueForSearch = void 0;
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Transformed can be anything.
|
|
10
|
-
*/
|
|
11
|
-
const transformValueForSearch = args => {
|
|
12
|
-
const {
|
|
13
|
-
field,
|
|
14
|
-
plugins,
|
|
15
|
-
value
|
|
16
|
-
} = args;
|
|
17
|
-
const plugin = plugins[field.type];
|
|
18
|
-
|
|
19
|
-
if (!plugin) {
|
|
20
|
-
return value;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
return plugin.transform({
|
|
24
|
-
field,
|
|
25
|
-
value
|
|
26
|
-
});
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
exports.transformValueForSearch = transformValueForSearch;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["transformValueForSearch","args","field","plugins","value","plugin","type","transform"],"sources":["transformValueForSearch.ts"],"sourcesContent":["import { ElasticsearchQuerySearchValuePlugins } from \"./searchPluginsList\";\nimport { CmsModelField } from \"@webiny/api-headless-cms/types\";\n\ninterface TransformValueForSearchParams {\n plugins: ElasticsearchQuerySearchValuePlugins;\n field: CmsModelField;\n value: any;\n}\n\n/**\n * Transformed can be anything.\n */\nexport const transformValueForSearch = (args: TransformValueForSearchParams): any => {\n const { field, plugins, value } = args;\n const plugin = plugins[field.type];\n if (!plugin) {\n return value;\n }\n return plugin.transform({ field, value });\n};\n"],"mappings":";;;;;;;AASA;AACA;AACA;AACO,MAAMA,uBAAuB,GAAIC,IAAD,IAA8C;EACjF,MAAM;IAAEC,KAAF;IAASC,OAAT;IAAkBC;EAAlB,IAA4BH,IAAlC;EACA,MAAMI,MAAM,GAAGF,OAAO,CAACD,KAAK,CAACI,IAAP,CAAtB;;EACA,IAAI,CAACD,MAAL,EAAa;IACT,OAAOD,KAAP;EACH;;EACD,OAAOC,MAAM,CAACE,SAAP,CAAiB;IAAEL,KAAF;IAASE;EAAT,CAAjB,CAAP;AACH,CAPM"}
|
package/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["createStorageOperations","params","attributes","table","esTable","documentClient","elasticsearch","plugins","userPlugins","tableInstance","createTable","tableElasticsearchInstance","createElasticsearchTable","entities","settings","createSettingsEntity","entityName","ENTITIES","SETTINGS","system","createSystemEntity","SYSTEM","groups","createGroupEntity","GROUPS","models","createModelEntity","MODELS","entries","createEntryEntity","ENTRIES","entriesEs","createEntryElasticsearchEntity","ENTRIES_ES","PluginsContainer","cmsEntryElasticsearchFields","dynamoDbValueFilters","getElasticsearchOperators","dynamoDbPlugins","elasticsearchPlugins","elasticsearchIndexPlugins","beforeInit","context","fieldPlugins","byType","register","elasticsearchOperatorPlugins","ElasticsearchQueryBuilderOperatorPlugin","type","queryModifierPlugins","CmsEntryElasticsearchQueryModifierPlugin","sortModifierPlugins","CmsEntryElasticsearchSortModifierPlugin","bodyModifierPlugins","CmsEntryElasticsearchBodyModifierPlugin","init","cms","onModelBeforeCreate","subscribe","model","createElasticsearchIndex","onModelBeforeCreateFrom","onModelAfterDelete","deleteElasticsearchIndex","onModelInitialize","getEntities","getTable","getEsTable","createSystemStorageOperations","entity","createSettingsStorageOperations","createGroupsStorageOperations","createModelsStorageOperations","createEntriesStorageOperations","esEntity"],"sources":["index.ts"],"sourcesContent":["import dynamoDbValueFilters from \"@webiny/db-dynamodb/plugins/filters\";\nimport elasticsearchPlugins from \"./elasticsearch\";\nimport dynamoDbPlugins from \"./dynamoDb\";\nimport { createSettingsStorageOperations } from \"./operations/settings\";\nimport { createSystemStorageOperations } from \"./operations/system\";\nimport { createModelsStorageOperations } from \"./operations/model\";\nimport { createEntriesStorageOperations } from \"./operations/entry\";\nimport { ENTITIES, StorageOperationsFactory } from \"~/types\";\nimport { createTable } from \"~/definitions/table\";\nimport { createElasticsearchTable } from \"~/definitions/tableElasticsearch\";\nimport { createGroupEntity } from \"~/definitions/group\";\nimport { createModelEntity } from \"~/definitions/model\";\nimport { createEntryEntity } from \"~/definitions/entry\";\nimport { createEntryElasticsearchEntity } from \"~/definitions/entryElasticsearch\";\nimport { createSystemEntity } from \"~/definitions/system\";\nimport { createSettingsEntity } from \"~/definitions/settings\";\nimport { createElasticsearchIndex } from \"~/elasticsearch/createElasticsearchIndex\";\nimport { PluginsContainer } from \"@webiny/plugins\";\nimport { createGroupsStorageOperations } from \"~/operations/group\";\nimport {\n ElasticsearchQueryBuilderOperatorPlugin,\n getElasticsearchOperators\n} from \"@webiny/api-elasticsearch\";\nimport { elasticsearchFields as cmsEntryElasticsearchFields } from \"~/operations/entry/elasticsearchFields\";\nimport { elasticsearchIndexPlugins } from \"./elasticsearch/indices\";\nimport { deleteElasticsearchIndex } from \"./elasticsearch/deleteElasticsearchIndex\";\nimport { CmsModelFieldToGraphQLPlugin } from \"@webiny/api-headless-cms/types\";\nimport {\n CmsEntryElasticsearchBodyModifierPlugin,\n CmsEntryElasticsearchQueryModifierPlugin,\n CmsEntryElasticsearchSortModifierPlugin\n} from \"~/plugins\";\n\nexport * from \"./plugins\";\n\nexport const createStorageOperations: StorageOperationsFactory = params => {\n const {\n attributes,\n table,\n esTable,\n documentClient,\n elasticsearch,\n plugins: userPlugins\n } = params;\n\n const tableInstance = createTable({\n table,\n documentClient\n });\n const tableElasticsearchInstance = createElasticsearchTable({\n table: esTable,\n documentClient\n });\n\n const entities = {\n settings: createSettingsEntity({\n entityName: ENTITIES.SETTINGS,\n table: tableInstance,\n attributes: attributes ? attributes[ENTITIES.SETTINGS] : {}\n }),\n system: createSystemEntity({\n entityName: ENTITIES.SYSTEM,\n table: tableInstance,\n attributes: attributes ? attributes[ENTITIES.SYSTEM] : {}\n }),\n groups: createGroupEntity({\n entityName: ENTITIES.GROUPS,\n table: tableInstance,\n attributes: attributes ? attributes[ENTITIES.GROUPS] : {}\n }),\n models: createModelEntity({\n entityName: ENTITIES.MODELS,\n table: tableInstance,\n attributes: attributes ? attributes[ENTITIES.MODELS] : {}\n }),\n entries: createEntryEntity({\n entityName: ENTITIES.ENTRIES,\n table: tableInstance,\n attributes: attributes ? attributes[ENTITIES.ENTRIES] : {}\n }),\n entriesEs: createEntryElasticsearchEntity({\n entityName: ENTITIES.ENTRIES_ES,\n table: tableElasticsearchInstance,\n attributes: attributes ? attributes[ENTITIES.ENTRIES_ES] : {}\n })\n };\n\n const plugins = new PluginsContainer([\n /**\n * Plugins of type CmsModelFieldToGraphQLPlugin.\n */\n /**\n * Elasticsearch field definitions for the entry record.\n */\n cmsEntryElasticsearchFields,\n /**\n * DynamoDB filter plugins for the where conditions.\n */\n dynamoDbValueFilters(),\n /**\n * Elasticsearch operators.\n */\n getElasticsearchOperators(),\n /**\n * Field plugins for DynamoDB.\n */\n dynamoDbPlugins(),\n /**\n * Field plugins for Elasticsearch.\n */\n elasticsearchPlugins(),\n /**\n * Built-in Elasticsearch index templates.\n */\n elasticsearchIndexPlugins(),\n /**\n * User defined custom plugins.\n * They are at the end because we can then override existing plugins.\n */\n ...(userPlugins || [])\n ]);\n\n return {\n beforeInit: async context => {\n /**\n * Attach the elasticsearch into context if it is not already attached.\n */\n if (!context.elasticsearch) {\n context.elasticsearch = elasticsearch;\n }\n /**\n * Collect all required plugins from parent context.\n */\n const fieldPlugins = context.plugins.byType<CmsModelFieldToGraphQLPlugin>(\n \"cms-model-field-to-graphql\"\n );\n plugins.register(fieldPlugins);\n /**\n * We need to get all the operator plugins from the main plugin container.\n */\n const elasticsearchOperatorPlugins =\n context.plugins.byType<ElasticsearchQueryBuilderOperatorPlugin>(\n ElasticsearchQueryBuilderOperatorPlugin.type\n );\n plugins.register(elasticsearchOperatorPlugins);\n /**\n * We need to get all the query modifier plugins\n */\n const queryModifierPlugins =\n context.plugins.byType<CmsEntryElasticsearchQueryModifierPlugin>(\n CmsEntryElasticsearchQueryModifierPlugin.type\n );\n plugins.register(queryModifierPlugins);\n /**\n * We need to get all the sort modifier plugins\n */\n const sortModifierPlugins =\n context.plugins.byType<CmsEntryElasticsearchSortModifierPlugin>(\n CmsEntryElasticsearchSortModifierPlugin.type\n );\n plugins.register(sortModifierPlugins);\n /**\n * We need to get all the body modifier plugins\n */\n const bodyModifierPlugins =\n context.plugins.byType<CmsEntryElasticsearchBodyModifierPlugin>(\n CmsEntryElasticsearchBodyModifierPlugin.type\n );\n plugins.register(bodyModifierPlugins);\n\n /**\n * Pass the plugins to the parent context.\n */\n context.plugins.register([dynamoDbPlugins()]);\n },\n init: async context => {\n /**\n * We need to create indexes on before model create and on clone (create from).\n * Other apps create indexes on locale creation.\n */\n context.cms.onModelBeforeCreate.subscribe(async ({ model }) => {\n await createElasticsearchIndex({\n elasticsearch,\n model,\n plugins\n });\n });\n context.cms.onModelBeforeCreateFrom.subscribe(async ({ model }) => {\n await createElasticsearchIndex({\n elasticsearch,\n model,\n plugins\n });\n });\n context.cms.onModelAfterDelete.subscribe(async ({ model }) => {\n await deleteElasticsearchIndex({\n elasticsearch,\n model\n });\n });\n\n context.cms.onModelInitialize.subscribe(async ({ model }) => {\n await createElasticsearchIndex({\n elasticsearch,\n model,\n plugins\n });\n });\n },\n getEntities: () => entities,\n getTable: () => tableInstance,\n getEsTable: () => tableElasticsearchInstance,\n system: createSystemStorageOperations({\n entity: entities.system\n }),\n settings: createSettingsStorageOperations({\n entity: entities.settings\n }),\n groups: createGroupsStorageOperations({\n entity: entities.groups,\n plugins\n }),\n models: createModelsStorageOperations({\n entity: entities.models,\n elasticsearch\n }),\n entries: createEntriesStorageOperations({\n entity: entities.entries,\n esEntity: entities.entriesEs,\n plugins,\n elasticsearch\n })\n };\n};\n"],"mappings":";;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAIA;;AACA;;AACA;;AAEA;;AAMA;EAAA;EAAA;E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void 0;
|
|
7
|
-
|
|
8
|
-
var _CmsEntryElasticsearchFieldPlugin = require("../../plugins/CmsEntryElasticsearchFieldPlugin");
|
|
9
|
-
|
|
10
|
-
const elasticsearchFields = [new _CmsEntryElasticsearchFieldPlugin.CmsEntryElasticsearchFieldPlugin({
|
|
11
|
-
field: "createdOn",
|
|
12
|
-
unmappedType: "date"
|
|
13
|
-
}), new _CmsEntryElasticsearchFieldPlugin.CmsEntryElasticsearchFieldPlugin({
|
|
14
|
-
field: "savedOn",
|
|
15
|
-
unmappedType: "date"
|
|
16
|
-
}), new _CmsEntryElasticsearchFieldPlugin.CmsEntryElasticsearchFieldPlugin({
|
|
17
|
-
field: "publishedOn",
|
|
18
|
-
unmappedType: "date"
|
|
19
|
-
}), new _CmsEntryElasticsearchFieldPlugin.CmsEntryElasticsearchFieldPlugin({
|
|
20
|
-
field: "ownedBy",
|
|
21
|
-
path: "ownedBy.id"
|
|
22
|
-
}), new _CmsEntryElasticsearchFieldPlugin.CmsEntryElasticsearchFieldPlugin({
|
|
23
|
-
field: "createdBy",
|
|
24
|
-
path: "createdBy.id"
|
|
25
|
-
}), new _CmsEntryElasticsearchFieldPlugin.CmsEntryElasticsearchFieldPlugin({
|
|
26
|
-
field: "version",
|
|
27
|
-
path: "version"
|
|
28
|
-
}), new _CmsEntryElasticsearchFieldPlugin.CmsEntryElasticsearchFieldPlugin({
|
|
29
|
-
field: "status",
|
|
30
|
-
path: "status"
|
|
31
|
-
}),
|
|
32
|
-
/**
|
|
33
|
-
* Always add the ALL fields plugin because of the keyword/path build.
|
|
34
|
-
*/
|
|
35
|
-
new _CmsEntryElasticsearchFieldPlugin.CmsEntryElasticsearchFieldPlugin({
|
|
36
|
-
field: _CmsEntryElasticsearchFieldPlugin.CmsEntryElasticsearchFieldPlugin.ALL
|
|
37
|
-
})];
|
|
38
|
-
exports.elasticsearchFields = elasticsearchFields;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["elasticsearchFields","CmsEntryElasticsearchFieldPlugin","field","unmappedType","path","ALL"],"sources":["elasticsearchFields.ts"],"sourcesContent":["import { CmsEntryElasticsearchFieldPlugin } from \"~/plugins/CmsEntryElasticsearchFieldPlugin\";\n\nexport const elasticsearchFields = [\n new CmsEntryElasticsearchFieldPlugin({\n field: \"createdOn\",\n unmappedType: \"date\"\n }),\n new CmsEntryElasticsearchFieldPlugin({\n field: \"savedOn\",\n unmappedType: \"date\"\n }),\n new CmsEntryElasticsearchFieldPlugin({\n field: \"publishedOn\",\n unmappedType: \"date\"\n }),\n new CmsEntryElasticsearchFieldPlugin({\n field: \"ownedBy\",\n path: \"ownedBy.id\"\n }),\n new CmsEntryElasticsearchFieldPlugin({\n field: \"createdBy\",\n path: \"createdBy.id\"\n }),\n new CmsEntryElasticsearchFieldPlugin({\n field: \"version\",\n path: \"version\"\n }),\n new CmsEntryElasticsearchFieldPlugin({\n field: \"status\",\n path: \"status\"\n }),\n /**\n * Always add the ALL fields plugin because of the keyword/path build.\n */\n new CmsEntryElasticsearchFieldPlugin({\n field: CmsEntryElasticsearchFieldPlugin.ALL\n })\n];\n"],"mappings":";;;;;;;AAAA;;AAEO,MAAMA,mBAAmB,GAAG,CAC/B,IAAIC,kEAAJ,CAAqC;EACjCC,KAAK,EAAE,WAD0B;EAEjCC,YAAY,EAAE;AAFmB,CAArC,CAD+B,EAK/B,IAAIF,kEAAJ,CAAqC;EACjCC,KAAK,EAAE,SAD0B;EAEjCC,YAAY,EAAE;AAFmB,CAArC,CAL+B,EAS/B,IAAIF,kEAAJ,CAAqC;EACjCC,KAAK,EAAE,aAD0B;EAEjCC,YAAY,EAAE;AAFmB,CAArC,CAT+B,EAa/B,IAAIF,kEAAJ,CAAqC;EACjCC,KAAK,EAAE,SAD0B;EAEjCE,IAAI,EAAE;AAF2B,CAArC,CAb+B,EAiB/B,IAAIH,kEAAJ,CAAqC;EACjCC,KAAK,EAAE,WAD0B;EAEjCE,IAAI,EAAE;AAF2B,CAArC,CAjB+B,EAqB/B,IAAIH,kEAAJ,CAAqC;EACjCC,KAAK,EAAE,SAD0B;EAEjCE,IAAI,EAAE;AAF2B,CAArC,CArB+B,EAyB/B,IAAIH,kEAAJ,CAAqC;EACjCC,KAAK,EAAE,QAD0B;EAEjCE,IAAI,EAAE;AAF2B,CAArC,CAzB+B;AA6B/B;AACJ;AACA;AACI,IAAIH,kEAAJ,CAAqC;EACjCC,KAAK,EAAED,kEAAA,CAAiCI;AADP,CAArC,CAhC+B,CAA5B"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { CmsSettingsStorageOperations } from "@webiny/api-headless-cms/types";
|
|
2
|
-
import { Entity } from "dynamodb-toolbox";
|
|
3
|
-
export interface CreateSettingsStorageOperationsParams {
|
|
4
|
-
entity: Entity<any>;
|
|
5
|
-
}
|
|
6
|
-
export declare const createSettingsStorageOperations: (params: CreateSettingsStorageOperationsParams) => CmsSettingsStorageOperations;
|
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.createSettingsStorageOperations = void 0;
|
|
9
|
-
|
|
10
|
-
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
11
|
-
|
|
12
|
-
var _get = require("@webiny/db-dynamodb/utils/get");
|
|
13
|
-
|
|
14
|
-
var _error = _interopRequireDefault(require("@webiny/error"));
|
|
15
|
-
|
|
16
|
-
var _cleanup = require("@webiny/db-dynamodb/utils/cleanup");
|
|
17
|
-
|
|
18
|
-
const convertToDbData = settings => {
|
|
19
|
-
return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, settings), {}, {
|
|
20
|
-
contentModelLastChange: settings.contentModelLastChange.toISOString()
|
|
21
|
-
});
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
const convertFromDbData = settings => {
|
|
25
|
-
if (!settings) {
|
|
26
|
-
return null;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
let contentModelLastChange;
|
|
30
|
-
|
|
31
|
-
try {
|
|
32
|
-
contentModelLastChange = new Date(settings.contentModelLastChange);
|
|
33
|
-
} catch {
|
|
34
|
-
contentModelLastChange = new Date();
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, settings), {}, {
|
|
38
|
-
contentModelLastChange
|
|
39
|
-
});
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
const createPartitionKey = ({
|
|
43
|
-
tenant,
|
|
44
|
-
locale
|
|
45
|
-
}) => {
|
|
46
|
-
return `T#${tenant}#L#${locale}#CMS#SETTINGS`;
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
const createSortKey = () => {
|
|
50
|
-
return "settings";
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
const createKeys = params => {
|
|
54
|
-
return {
|
|
55
|
-
PK: createPartitionKey(params),
|
|
56
|
-
SK: createSortKey()
|
|
57
|
-
};
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
const createSettingsStorageOperations = params => {
|
|
61
|
-
const {
|
|
62
|
-
entity
|
|
63
|
-
} = params;
|
|
64
|
-
|
|
65
|
-
const create = async params => {
|
|
66
|
-
const {
|
|
67
|
-
settings
|
|
68
|
-
} = params;
|
|
69
|
-
const keys = createKeys(settings);
|
|
70
|
-
const dbSettings = convertToDbData(settings);
|
|
71
|
-
|
|
72
|
-
try {
|
|
73
|
-
await entity.put((0, _objectSpread2.default)((0, _objectSpread2.default)({}, dbSettings), keys));
|
|
74
|
-
return settings;
|
|
75
|
-
} catch (ex) {
|
|
76
|
-
throw new _error.default(ex.message || "Could not create settings.", ex.code || "CREATE_SETTINGS_ERROR", {
|
|
77
|
-
error: ex,
|
|
78
|
-
settings,
|
|
79
|
-
dbSettings,
|
|
80
|
-
keys
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
const update = async params => {
|
|
86
|
-
const {
|
|
87
|
-
settings
|
|
88
|
-
} = params;
|
|
89
|
-
const keys = createKeys(settings);
|
|
90
|
-
const dbSettings = convertToDbData(settings);
|
|
91
|
-
|
|
92
|
-
try {
|
|
93
|
-
await entity.put((0, _objectSpread2.default)((0, _objectSpread2.default)({}, dbSettings), keys));
|
|
94
|
-
return settings;
|
|
95
|
-
} catch (ex) {
|
|
96
|
-
throw new _error.default(ex.message || "Could not update settings.", ex.code || "UPDATE_SETTINGS_ERROR", {
|
|
97
|
-
error: ex,
|
|
98
|
-
settings,
|
|
99
|
-
dbSettings,
|
|
100
|
-
keys
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
const get = async params => {
|
|
106
|
-
const keys = createKeys(params);
|
|
107
|
-
|
|
108
|
-
try {
|
|
109
|
-
const record = await (0, _get.get)({
|
|
110
|
-
entity,
|
|
111
|
-
keys
|
|
112
|
-
});
|
|
113
|
-
|
|
114
|
-
if (!record) {
|
|
115
|
-
return null;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
const settings = (0, _cleanup.cleanupItem)(entity, record);
|
|
119
|
-
return convertFromDbData(settings);
|
|
120
|
-
} catch (ex) {
|
|
121
|
-
throw new _error.default(ex.message || "Could not get settings.", ex.code || "GET_SETTINGS_ERROR", {
|
|
122
|
-
error: ex,
|
|
123
|
-
keys
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
};
|
|
127
|
-
|
|
128
|
-
return {
|
|
129
|
-
create,
|
|
130
|
-
get,
|
|
131
|
-
update
|
|
132
|
-
};
|
|
133
|
-
};
|
|
134
|
-
|
|
135
|
-
exports.createSettingsStorageOperations = createSettingsStorageOperations;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["convertToDbData","settings","contentModelLastChange","toISOString","convertFromDbData","Date","createPartitionKey","tenant","locale","createSortKey","createKeys","params","PK","SK","createSettingsStorageOperations","entity","create","keys","dbSettings","put","ex","WebinyError","message","code","error","update","get","record","getRecord","cleanupItem"],"sources":["index.ts"],"sourcesContent":["import {\n CmsSettings,\n CmsSettingsStorageOperations,\n CmsSettingsStorageOperationsCreateParams,\n CmsSettingsStorageOperationsGetParams,\n CmsSettingsStorageOperationsUpdateParams\n} from \"@webiny/api-headless-cms/types\";\nimport { Entity } from \"dynamodb-toolbox\";\nimport { get as getRecord } from \"@webiny/db-dynamodb/utils/get\";\nimport WebinyError from \"@webiny/error\";\nimport { cleanupItem } from \"@webiny/db-dynamodb/utils/cleanup\";\n\ninterface CmsSettingsDb extends Omit<CmsSettings, \"contentModelLastChange\"> {\n contentModelLastChange: string;\n}\n\nconst convertToDbData = (settings: CmsSettings): CmsSettingsDb => {\n return {\n ...settings,\n contentModelLastChange: settings.contentModelLastChange.toISOString()\n };\n};\n\nconst convertFromDbData = (settings?: CmsSettingsDb): CmsSettings | null => {\n if (!settings) {\n return null;\n }\n let contentModelLastChange;\n try {\n contentModelLastChange = new Date(settings.contentModelLastChange);\n } catch {\n contentModelLastChange = new Date();\n }\n return {\n ...settings,\n contentModelLastChange\n };\n};\n\ninterface PartitionKeyParams {\n tenant: string;\n locale: string;\n}\n\nconst createPartitionKey = ({ tenant, locale }: PartitionKeyParams): string => {\n return `T#${tenant}#L#${locale}#CMS#SETTINGS`;\n};\n\nconst createSortKey = (): string => {\n return \"settings\";\n};\n\ninterface Keys {\n PK: string;\n SK: string;\n}\nconst createKeys = (params: PartitionKeyParams): Keys => {\n return {\n PK: createPartitionKey(params),\n SK: createSortKey()\n };\n};\n\nexport interface CreateSettingsStorageOperationsParams {\n entity: Entity<any>;\n}\n\nexport const createSettingsStorageOperations = (\n params: CreateSettingsStorageOperationsParams\n): CmsSettingsStorageOperations => {\n const { entity } = params;\n\n const create = async (params: CmsSettingsStorageOperationsCreateParams) => {\n const { settings } = params;\n const keys = createKeys(settings);\n\n const dbSettings: CmsSettingsDb = convertToDbData(settings);\n\n try {\n await entity.put({\n ...dbSettings,\n ...keys\n });\n return settings;\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not create settings.\",\n ex.code || \"CREATE_SETTINGS_ERROR\",\n {\n error: ex,\n settings,\n dbSettings,\n keys\n }\n );\n }\n };\n\n const update = async (params: CmsSettingsStorageOperationsUpdateParams) => {\n const { settings } = params;\n\n const keys = createKeys(settings);\n\n const dbSettings: CmsSettingsDb = convertToDbData(settings);\n\n try {\n await entity.put({\n ...dbSettings,\n ...keys\n });\n return settings;\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not update settings.\",\n ex.code || \"UPDATE_SETTINGS_ERROR\",\n {\n error: ex,\n settings,\n dbSettings,\n keys\n }\n );\n }\n };\n\n const get = async (params: CmsSettingsStorageOperationsGetParams) => {\n const keys = createKeys(params);\n try {\n const record = await getRecord<CmsSettingsDb>({\n entity,\n keys\n });\n if (!record) {\n return null;\n }\n const settings = cleanupItem(entity, record) as CmsSettingsDb;\n return convertFromDbData(settings);\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not get settings.\",\n ex.code || \"GET_SETTINGS_ERROR\",\n {\n error: ex,\n keys\n }\n );\n }\n };\n\n return {\n create,\n get,\n update\n };\n};\n"],"mappings":";;;;;;;;;;;AAQA;;AACA;;AACA;;AAMA,MAAMA,eAAe,GAAIC,QAAD,IAA0C;EAC9D,mEACOA,QADP;IAEIC,sBAAsB,EAAED,QAAQ,CAACC,sBAAT,CAAgCC,WAAhC;EAF5B;AAIH,CALD;;AAOA,MAAMC,iBAAiB,GAAIH,QAAD,IAAkD;EACxE,IAAI,CAACA,QAAL,EAAe;IACX,OAAO,IAAP;EACH;;EACD,IAAIC,sBAAJ;;EACA,IAAI;IACAA,sBAAsB,GAAG,IAAIG,IAAJ,CAASJ,QAAQ,CAACC,sBAAlB,CAAzB;EACH,CAFD,CAEE,MAAM;IACJA,sBAAs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;;IAEA,IAAI;MACA,MAAMc,MAAM,CAACI,GAAP,6DACCD,UADD,GAECD,IAFD,EAAN;MAIA,OAAOhB,QAAP;IACH,CAND,CAME,OAAOmB,EAAP,EAAW;MACT,MAAM,IAAIC,cAAJ,CACFD,EAAE,CAACE,OAAH,IAAc,4BADZ,EAEFF,EAAE,CAACG,IAAH,IAAW,uBAFT,EAGF;QACIC,KAAK,EAAEJ,EADX;QAEInB,QAFJ;QAGIiB,UAHJ;QAIID;MAJJ,CAHE,CAAN;IAUH;EACJ,CAzBD;;EA2BA,MAAMS,GAAG,GAAG,MAAOf,MAAP,IAAyD;IACjE,MAAMM,IAAI,GAAGP,UAAU,CAACC,MAAD,CAAvB;;IACA,IAAI;MACA,MAAMgB,MAAM,GAAG,MAAM,IAAAC,QAAA,EAAyB;QAC1Cb,MAD0C;QAE1CE;MAF0C,CAAzB,CAArB;;MAIA,IAAI,CAACU,MAAL,EAAa;QACT,OAAO,IAAP;MACH;;MACD,MAAM1B,QAAQ,GAAG,IAAA4B,oBAAA,EAAYd,MAAZ,EAAoBY,MAApB,CAAjB;MACA,OAAOvB,iBAAiB,CAACH,QAAD,CAAxB;IACH,CAVD,CAUE,OAAOmB,EAAP,EAAW;MACT,MAAM,IAAIC,cAAJ,CACFD,EAAE,CAACE,OAAH,IAAc,yBADZ,EAEFF,EAAE,CAACG,IAAH,IAAW,oBAFT,EAGF;QACIC,KAAK,EAAEJ,EADX;QAEIH;MAFJ,CAHE,CAAN;IAQH;EACJ,CAtBD;;EAwBA,OAAO;IACHD,MADG;IAEHU,GAFG;IAGHD;EAHG,CAAP;AAKH,CAvFM"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { CmsSystemStorageOperations } from "@webiny/api-headless-cms/types";
|
|
2
|
-
import { Entity } from "dynamodb-toolbox";
|
|
3
|
-
export interface CreateSystemStorageOperationsParams {
|
|
4
|
-
entity: Entity<any>;
|
|
5
|
-
}
|
|
6
|
-
export declare const createSystemStorageOperations: (params: CreateSystemStorageOperationsParams) => CmsSystemStorageOperations;
|