@webiny/api-headless-cms-ddb-es 6.4.5-beta.0 → 6.6.0-alpha.0
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/abstractions/CmsDdbEsDataLoaders.d.ts +5 -0
- package/abstractions/CmsDdbEsDataLoaders.js +5 -0
- package/abstractions/CmsDdbEsDataLoaders.js.map +1 -0
- package/abstractions/CmsDdbEsEntriesEsEntity.d.ts +5 -0
- package/abstractions/CmsDdbEsEntriesEsEntity.js +5 -0
- package/abstractions/CmsDdbEsEntriesEsEntity.js.map +1 -0
- package/abstractions/CmsDdbEsEntryEntity.d.ts +5 -0
- package/abstractions/CmsDdbEsEntryEntity.js +5 -0
- package/abstractions/CmsDdbEsEntryEntity.js.map +1 -0
- package/abstractions/CmsDdbEsGroupEntity.d.ts +5 -0
- package/abstractions/CmsDdbEsGroupEntity.js +5 -0
- package/abstractions/CmsDdbEsGroupEntity.js.map +1 -0
- package/abstractions/CmsDdbEsModelEntity.d.ts +5 -0
- package/abstractions/CmsDdbEsModelEntity.js +5 -0
- package/abstractions/CmsDdbEsModelEntity.js.map +1 -0
- package/abstractions/CmsDdbEsOsTable.d.ts +5 -0
- package/abstractions/CmsDdbEsOsTable.js +5 -0
- package/abstractions/CmsDdbEsOsTable.js.map +1 -0
- package/abstractions/CmsDdbEsTable.d.ts +5 -0
- package/abstractions/CmsDdbEsTable.js +5 -0
- package/abstractions/CmsDdbEsTable.js.map +1 -0
- package/feature.d.ts +4 -1
- package/feature.js +59 -157
- package/feature.js.map +1 -1
- package/index.d.ts +1 -1
- package/index.js +1 -1
- package/operations/entry/DdbEsCreateEntry.d.ts +23 -0
- package/operations/entry/DdbEsCreateEntry.js +131 -0
- package/operations/entry/DdbEsCreateEntry.js.map +1 -0
- package/operations/entry/DdbEsCreateEntryRevisionFrom.d.ts +23 -0
- package/operations/entry/DdbEsCreateEntryRevisionFrom.js +136 -0
- package/operations/entry/DdbEsCreateEntryRevisionFrom.js.map +1 -0
- package/operations/entry/DdbEsDeleteEntry.d.ts +18 -0
- package/operations/entry/DdbEsDeleteEntry.js +79 -0
- package/operations/entry/DdbEsDeleteEntry.js.map +1 -0
- package/operations/entry/DdbEsDeleteEntryRevision.d.ts +23 -0
- package/operations/entry/DdbEsDeleteEntryRevision.js +133 -0
- package/operations/entry/DdbEsDeleteEntryRevision.js.map +1 -0
- package/operations/entry/DdbEsDeleteMultipleEntries.d.ts +18 -0
- package/operations/entry/DdbEsDeleteMultipleEntries.js +77 -0
- package/operations/entry/DdbEsDeleteMultipleEntries.js.map +1 -0
- package/operations/entry/DdbEsGetEntriesByIds.d.ts +14 -0
- package/operations/entry/DdbEsGetEntriesByIds.js +31 -0
- package/operations/entry/DdbEsGetEntriesByIds.js.map +1 -0
- package/operations/entry/DdbEsGetEntry.d.ts +14 -0
- package/operations/entry/DdbEsGetEntry.js +27 -0
- package/operations/entry/DdbEsGetEntry.js.map +1 -0
- package/operations/entry/DdbEsGetLatestEntriesByIds.d.ts +14 -0
- package/operations/entry/DdbEsGetLatestEntriesByIds.js +31 -0
- package/operations/entry/DdbEsGetLatestEntriesByIds.js.map +1 -0
- package/operations/entry/DdbEsGetLatestRevisionByEntryId.d.ts +14 -0
- package/operations/entry/DdbEsGetLatestRevisionByEntryId.js +34 -0
- package/operations/entry/DdbEsGetLatestRevisionByEntryId.js.map +1 -0
- package/operations/entry/DdbEsGetPreviousRevision.d.ts +14 -0
- package/operations/entry/DdbEsGetPreviousRevision.js +56 -0
- package/operations/entry/DdbEsGetPreviousRevision.js.map +1 -0
- package/operations/entry/DdbEsGetPublishedEntriesByIds.d.ts +14 -0
- package/operations/entry/DdbEsGetPublishedEntriesByIds.js +31 -0
- package/operations/entry/DdbEsGetPublishedEntriesByIds.js.map +1 -0
- package/operations/entry/DdbEsGetPublishedRevisionByEntryId.d.ts +14 -0
- package/operations/entry/DdbEsGetPublishedRevisionByEntryId.js +34 -0
- package/operations/entry/DdbEsGetPublishedRevisionByEntryId.js.map +1 -0
- package/operations/entry/DdbEsGetRevisionById.d.ts +14 -0
- package/operations/entry/DdbEsGetRevisionById.js +34 -0
- package/operations/entry/DdbEsGetRevisionById.js.map +1 -0
- package/operations/entry/DdbEsGetRevisions.d.ts +14 -0
- package/operations/entry/DdbEsGetRevisions.js +33 -0
- package/operations/entry/DdbEsGetRevisions.js.map +1 -0
- package/operations/entry/DdbEsGetUniqueFieldValues.d.ts +17 -0
- package/operations/entry/DdbEsGetUniqueFieldValues.js +73 -0
- package/operations/entry/DdbEsGetUniqueFieldValues.js.map +1 -0
- package/operations/entry/DdbEsListEntries.d.ts +24 -0
- package/operations/entry/DdbEsListEntries.js +88 -0
- package/operations/entry/DdbEsListEntries.js.map +1 -0
- package/operations/entry/DdbEsMoveEntry.d.ts +20 -0
- package/operations/entry/DdbEsMoveEntry.js +113 -0
- package/operations/entry/DdbEsMoveEntry.js.map +1 -0
- package/operations/entry/DdbEsMoveToBin.d.ts +23 -0
- package/operations/entry/DdbEsMoveToBin.js +137 -0
- package/operations/entry/DdbEsMoveToBin.js.map +1 -0
- package/operations/entry/DdbEsPublishEntry.d.ts +23 -0
- package/operations/entry/DdbEsPublishEntry.js +228 -0
- package/operations/entry/DdbEsPublishEntry.js.map +1 -0
- package/operations/entry/DdbEsRestoreFromBin.d.ts +23 -0
- package/operations/entry/DdbEsRestoreFromBin.js +137 -0
- package/operations/entry/DdbEsRestoreFromBin.js.map +1 -0
- package/operations/entry/DdbEsUnpublishEntry.d.ts +23 -0
- package/operations/entry/DdbEsUnpublishEntry.js +124 -0
- package/operations/entry/DdbEsUnpublishEntry.js.map +1 -0
- package/operations/entry/DdbEsUpdateEntry.d.ts +23 -0
- package/operations/entry/DdbEsUpdateEntry.js +172 -0
- package/operations/entry/DdbEsUpdateEntry.js.map +1 -0
- package/operations/entry/dataLoaders.d.ts +5 -5
- package/operations/entry/dataLoaders.js +11 -3
- package/operations/entry/dataLoaders.js.map +1 -1
- package/{features/CmsModelOpenSearchIndex → operations/entry}/feature.d.ts +1 -1
- package/operations/entry/feature.js +55 -0
- package/operations/entry/feature.js.map +1 -0
- package/operations/entry/storageEntryUtils.d.ts +7 -0
- package/operations/entry/storageEntryUtils.js +14 -0
- package/operations/entry/storageEntryUtils.js.map +1 -0
- package/operations/entry/transformations/index.d.ts +2 -3
- package/operations/entry/transformations/index.js +1 -1
- package/operations/entry/transformations/index.js.map +1 -1
- package/operations/entry/transformations/modifyEntryValues.d.ts +2 -2
- package/operations/entry/transformations/modifyEntryValues.js.map +1 -1
- package/operations/group/DdbEsCreateGroup.d.ts +12 -0
- package/operations/group/DdbEsCreateGroup.js +35 -0
- package/operations/group/DdbEsCreateGroup.js.map +1 -0
- package/operations/group/DdbEsDeleteGroup.d.ts +12 -0
- package/operations/group/DdbEsDeleteGroup.js +31 -0
- package/operations/group/DdbEsDeleteGroup.js.map +1 -0
- package/operations/group/DdbEsGetGroup.d.ts +12 -0
- package/operations/group/DdbEsGetGroup.js +31 -0
- package/operations/group/DdbEsGetGroup.js.map +1 -0
- package/operations/group/DdbEsListGroups.d.ts +14 -0
- package/operations/group/DdbEsListGroups.js +52 -0
- package/operations/group/DdbEsListGroups.js.map +1 -0
- package/operations/group/DdbEsUpdateGroup.d.ts +12 -0
- package/operations/group/DdbEsUpdateGroup.js +35 -0
- package/operations/group/DdbEsUpdateGroup.js.map +1 -0
- package/{features/CmsEntryOpenSearchFilter → operations/group}/feature.d.ts +1 -1
- package/operations/group/feature.js +19 -0
- package/operations/group/feature.js.map +1 -0
- package/operations/group/keys.d.ts +15 -0
- package/operations/group/keys.js +17 -0
- package/operations/group/keys.js.map +1 -0
- package/operations/model/DdbEsCreateModel.d.ts +14 -0
- package/operations/model/DdbEsCreateModel.js +52 -0
- package/operations/model/DdbEsCreateModel.js.map +1 -0
- package/operations/model/DdbEsDeleteModel.d.ts +14 -0
- package/operations/model/DdbEsDeleteModel.js +50 -0
- package/operations/model/DdbEsDeleteModel.js.map +1 -0
- package/operations/model/DdbEsGetModel.d.ts +12 -0
- package/operations/model/DdbEsGetModel.js +30 -0
- package/operations/model/DdbEsGetModel.js.map +1 -0
- package/operations/model/DdbEsListModels.d.ts +12 -0
- package/operations/model/DdbEsListModels.js +36 -0
- package/operations/model/DdbEsListModels.js.map +1 -0
- package/operations/model/DdbEsUpdateModel.d.ts +12 -0
- package/operations/model/DdbEsUpdateModel.js +36 -0
- package/operations/model/DdbEsUpdateModel.js.map +1 -0
- package/{features/CmsEntryOpenSearchFieldIndex → operations/model}/feature.d.ts +1 -1
- package/operations/model/feature.js +19 -0
- package/operations/model/feature.js.map +1 -0
- package/operations/model/keys.d.ts +15 -0
- package/operations/model/keys.js +17 -0
- package/operations/model/keys.js.map +1 -0
- package/package.json +26 -22
- package/tasks/CreateElasticsearchIndexTask.d.ts +13 -0
- package/tasks/CreateElasticsearchIndexTask.js +49 -0
- package/tasks/CreateElasticsearchIndexTask.js.map +1 -0
- package/types.d.ts +10 -49
- package/types.js.map +1 -1
- package/configurations.d.ts +0 -22
- package/configurations.js +0 -37
- package/configurations.js.map +0 -1
- package/elasticsearch/createElasticsearchIndex.d.ts +0 -9
- package/elasticsearch/createElasticsearchIndex.js +0 -45
- package/elasticsearch/createElasticsearchIndex.js.map +0 -1
- package/elasticsearch/deleteElasticsearchIndex.d.ts +0 -10
- package/elasticsearch/deleteElasticsearchIndex.js +0 -23
- package/elasticsearch/deleteElasticsearchIndex.js.map +0 -1
- package/exports/api/cms/opensearch.d.ts +0 -9
- package/exports/api/cms/opensearch.js +0 -9
- package/features/CmsEntryOpenSearchBodyModifier/abstractions.d.ts +0 -16
- package/features/CmsEntryOpenSearchBodyModifier/abstractions.js +0 -5
- package/features/CmsEntryOpenSearchBodyModifier/abstractions.js.map +0 -1
- package/features/CmsEntryOpenSearchBodyModifier/index.d.ts +0 -1
- package/features/CmsEntryOpenSearchBodyModifier/index.js +0 -1
- package/features/CmsEntryOpenSearchFieldIndex/CmsEntryOpenSearchFieldIndexRegistry.d.ts +0 -14
- package/features/CmsEntryOpenSearchFieldIndex/CmsEntryOpenSearchFieldIndexRegistry.js +0 -42
- package/features/CmsEntryOpenSearchFieldIndex/CmsEntryOpenSearchFieldIndexRegistry.js.map +0 -1
- package/features/CmsEntryOpenSearchFieldIndex/abstractions/CmsEntryOpenSearchFieldIndex.d.ts +0 -32
- package/features/CmsEntryOpenSearchFieldIndex/abstractions/CmsEntryOpenSearchFieldIndex.js +0 -5
- package/features/CmsEntryOpenSearchFieldIndex/abstractions/CmsEntryOpenSearchFieldIndex.js.map +0 -1
- package/features/CmsEntryOpenSearchFieldIndex/abstractions/CmsEntryOpenSearchFieldIndexRegistry.d.ts +0 -11
- package/features/CmsEntryOpenSearchFieldIndex/abstractions/CmsEntryOpenSearchFieldIndexRegistry.js +0 -5
- package/features/CmsEntryOpenSearchFieldIndex/abstractions/CmsEntryOpenSearchFieldIndexRegistry.js.map +0 -1
- package/features/CmsEntryOpenSearchFieldIndex/constants.d.ts +0 -1
- package/features/CmsEntryOpenSearchFieldIndex/constants.js +0 -4
- package/features/CmsEntryOpenSearchFieldIndex/constants.js.map +0 -1
- package/features/CmsEntryOpenSearchFieldIndex/feature.js +0 -29
- package/features/CmsEntryOpenSearchFieldIndex/feature.js.map +0 -1
- package/features/CmsEntryOpenSearchFieldIndex/fields/DateTimeFieldIndex.d.ts +0 -11
- package/features/CmsEntryOpenSearchFieldIndex/fields/DateTimeFieldIndex.js +0 -60
- package/features/CmsEntryOpenSearchFieldIndex/fields/DateTimeFieldIndex.js.map +0 -1
- package/features/CmsEntryOpenSearchFieldIndex/fields/DefaultFieldIndex.d.ts +0 -13
- package/features/CmsEntryOpenSearchFieldIndex/fields/DefaultFieldIndex.js +0 -33
- package/features/CmsEntryOpenSearchFieldIndex/fields/DefaultFieldIndex.js.map +0 -1
- package/features/CmsEntryOpenSearchFieldIndex/fields/JsonFieldIndex.d.ts +0 -10
- package/features/CmsEntryOpenSearchFieldIndex/fields/JsonFieldIndex.js +0 -21
- package/features/CmsEntryOpenSearchFieldIndex/fields/JsonFieldIndex.js.map +0 -1
- package/features/CmsEntryOpenSearchFieldIndex/fields/LongTextFieldIndex.d.ts +0 -10
- package/features/CmsEntryOpenSearchFieldIndex/fields/LongTextFieldIndex.js +0 -22
- package/features/CmsEntryOpenSearchFieldIndex/fields/LongTextFieldIndex.js.map +0 -1
- package/features/CmsEntryOpenSearchFieldIndex/fields/NumberFieldIndex.d.ts +0 -11
- package/features/CmsEntryOpenSearchFieldIndex/fields/NumberFieldIndex.js +0 -32
- package/features/CmsEntryOpenSearchFieldIndex/fields/NumberFieldIndex.js.map +0 -1
- package/features/CmsEntryOpenSearchFieldIndex/fields/ObjectFieldIndex.d.ts +0 -12
- package/features/CmsEntryOpenSearchFieldIndex/fields/ObjectFieldIndex.js +0 -107
- package/features/CmsEntryOpenSearchFieldIndex/fields/ObjectFieldIndex.js.map +0 -1
- package/features/CmsEntryOpenSearchFieldIndex/fields/RichTextFieldIndex.d.ts +0 -10
- package/features/CmsEntryOpenSearchFieldIndex/fields/RichTextFieldIndex.js +0 -21
- package/features/CmsEntryOpenSearchFieldIndex/fields/RichTextFieldIndex.js.map +0 -1
- package/features/CmsEntryOpenSearchFieldIndex/fields/TextCompressedFieldIndex.d.ts +0 -15
- package/features/CmsEntryOpenSearchFieldIndex/fields/TextCompressedFieldIndex.js +0 -40
- package/features/CmsEntryOpenSearchFieldIndex/fields/TextCompressedFieldIndex.js.map +0 -1
- package/features/CmsEntryOpenSearchFieldIndex/fields/TextEncryptedFieldIndex.d.ts +0 -15
- package/features/CmsEntryOpenSearchFieldIndex/fields/TextEncryptedFieldIndex.js +0 -40
- package/features/CmsEntryOpenSearchFieldIndex/fields/TextEncryptedFieldIndex.js.map +0 -1
- package/features/CmsEntryOpenSearchFieldIndex/index.d.ts +0 -3
- package/features/CmsEntryOpenSearchFieldIndex/index.js +0 -3
- package/features/CmsEntryOpenSearchFilter/CmsEntryOpenSearchFilterRegistry.d.ts +0 -11
- package/features/CmsEntryOpenSearchFilter/CmsEntryOpenSearchFilterRegistry.js +0 -36
- package/features/CmsEntryOpenSearchFilter/CmsEntryOpenSearchFilterRegistry.js.map +0 -1
- package/features/CmsEntryOpenSearchFilter/abstractions/CmsEntryOpenSearchFilter.d.ts +0 -37
- package/features/CmsEntryOpenSearchFilter/abstractions/CmsEntryOpenSearchFilter.js +0 -5
- package/features/CmsEntryOpenSearchFilter/abstractions/CmsEntryOpenSearchFilter.js.map +0 -1
- package/features/CmsEntryOpenSearchFilter/abstractions/CmsEntryOpenSearchFilterRegistry.d.ts +0 -9
- package/features/CmsEntryOpenSearchFilter/abstractions/CmsEntryOpenSearchFilterRegistry.js +0 -5
- package/features/CmsEntryOpenSearchFilter/abstractions/CmsEntryOpenSearchFilterRegistry.js.map +0 -1
- package/features/CmsEntryOpenSearchFilter/constants.d.ts +0 -1
- package/features/CmsEntryOpenSearchFilter/constants.js +0 -4
- package/features/CmsEntryOpenSearchFilter/constants.js.map +0 -1
- package/features/CmsEntryOpenSearchFilter/feature.js +0 -17
- package/features/CmsEntryOpenSearchFilter/feature.js.map +0 -1
- package/features/CmsEntryOpenSearchFilter/fields/DefaultFilter.d.ts +0 -9
- package/features/CmsEntryOpenSearchFilter/fields/DefaultFilter.js +0 -26
- package/features/CmsEntryOpenSearchFilter/fields/DefaultFilter.js.map +0 -1
- package/features/CmsEntryOpenSearchFilter/fields/ObjectFilter.d.ts +0 -9
- package/features/CmsEntryOpenSearchFilter/fields/ObjectFilter.js +0 -43
- package/features/CmsEntryOpenSearchFilter/fields/ObjectFilter.js.map +0 -1
- package/features/CmsEntryOpenSearchFilter/fields/RefFilter.d.ts +0 -9
- package/features/CmsEntryOpenSearchFilter/fields/RefFilter.js +0 -36
- package/features/CmsEntryOpenSearchFilter/fields/RefFilter.js.map +0 -1
- package/features/CmsEntryOpenSearchFilter/index.d.ts +0 -3
- package/features/CmsEntryOpenSearchFilter/index.js +0 -3
- package/features/CmsEntryOpenSearchFullTextSearch/abstractions.d.ts +0 -20
- package/features/CmsEntryOpenSearchFullTextSearch/abstractions.js +0 -5
- package/features/CmsEntryOpenSearchFullTextSearch/abstractions.js.map +0 -1
- package/features/CmsEntryOpenSearchFullTextSearch/index.d.ts +0 -1
- package/features/CmsEntryOpenSearchFullTextSearch/index.js +0 -1
- package/features/CmsEntryOpenSearchQueryModifier/abstractions.d.ts +0 -16
- package/features/CmsEntryOpenSearchQueryModifier/abstractions.js +0 -5
- package/features/CmsEntryOpenSearchQueryModifier/abstractions.js.map +0 -1
- package/features/CmsEntryOpenSearchQueryModifier/index.d.ts +0 -1
- package/features/CmsEntryOpenSearchQueryModifier/index.js +0 -1
- package/features/CmsEntryOpenSearchSortModifier/abstractions.d.ts +0 -15
- package/features/CmsEntryOpenSearchSortModifier/abstractions.js +0 -5
- package/features/CmsEntryOpenSearchSortModifier/abstractions.js.map +0 -1
- package/features/CmsEntryOpenSearchSortModifier/index.d.ts +0 -1
- package/features/CmsEntryOpenSearchSortModifier/index.js +0 -1
- package/features/CmsEntryOpenSearchValueSearch/CmsEntryOpenSearchValueSearchRegistry.d.ts +0 -12
- package/features/CmsEntryOpenSearchValueSearch/CmsEntryOpenSearchValueSearchRegistry.js +0 -31
- package/features/CmsEntryOpenSearchValueSearch/CmsEntryOpenSearchValueSearchRegistry.js.map +0 -1
- package/features/CmsEntryOpenSearchValueSearch/abstractions/CmsEntryOpenSearchValueSearch.d.ts +0 -22
- package/features/CmsEntryOpenSearchValueSearch/abstractions/CmsEntryOpenSearchValueSearch.js +0 -5
- package/features/CmsEntryOpenSearchValueSearch/abstractions/CmsEntryOpenSearchValueSearch.js.map +0 -1
- package/features/CmsEntryOpenSearchValueSearch/abstractions/CmsEntryOpenSearchValueSearchRegistry.d.ts +0 -10
- package/features/CmsEntryOpenSearchValueSearch/abstractions/CmsEntryOpenSearchValueSearchRegistry.js +0 -5
- package/features/CmsEntryOpenSearchValueSearch/abstractions/CmsEntryOpenSearchValueSearchRegistry.js.map +0 -1
- package/features/CmsEntryOpenSearchValueSearch/feature.d.ts +0 -4
- package/features/CmsEntryOpenSearchValueSearch/feature.js +0 -17
- package/features/CmsEntryOpenSearchValueSearch/feature.js.map +0 -1
- package/features/CmsEntryOpenSearchValueSearch/fields/RefSearch.d.ts +0 -10
- package/features/CmsEntryOpenSearchValueSearch/fields/RefSearch.js +0 -21
- package/features/CmsEntryOpenSearchValueSearch/fields/RefSearch.js.map +0 -1
- package/features/CmsEntryOpenSearchValueSearch/fields/SearchableJsonSearch.d.ts +0 -10
- package/features/CmsEntryOpenSearchValueSearch/fields/SearchableJsonSearch.js +0 -44
- package/features/CmsEntryOpenSearchValueSearch/fields/SearchableJsonSearch.js.map +0 -1
- package/features/CmsEntryOpenSearchValueSearch/fields/TimeSearch.d.ts +0 -10
- package/features/CmsEntryOpenSearchValueSearch/fields/TimeSearch.js +0 -22
- package/features/CmsEntryOpenSearchValueSearch/fields/TimeSearch.js.map +0 -1
- package/features/CmsEntryOpenSearchValueSearch/index.d.ts +0 -3
- package/features/CmsEntryOpenSearchValueSearch/index.js +0 -3
- package/features/CmsEntryOpenSearchValuesModifier/abstractions.d.ts +0 -23
- package/features/CmsEntryOpenSearchValuesModifier/abstractions.js +0 -5
- package/features/CmsEntryOpenSearchValuesModifier/abstractions.js.map +0 -1
- package/features/CmsEntryOpenSearchValuesModifier/index.d.ts +0 -1
- package/features/CmsEntryOpenSearchValuesModifier/index.js +0 -1
- package/features/CmsModelOpenSearchIndex/CmsModelOpenSearchIndexProvider.d.ts +0 -25
- package/features/CmsModelOpenSearchIndex/CmsModelOpenSearchIndexProvider.js +0 -36
- package/features/CmsModelOpenSearchIndex/CmsModelOpenSearchIndexProvider.js.map +0 -1
- package/features/CmsModelOpenSearchIndex/DefaultCmsModelOpenSearchIndex.d.ts +0 -8
- package/features/CmsModelOpenSearchIndex/DefaultCmsModelOpenSearchIndex.js +0 -17
- package/features/CmsModelOpenSearchIndex/DefaultCmsModelOpenSearchIndex.js.map +0 -1
- package/features/CmsModelOpenSearchIndex/abstractions.d.ts +0 -20
- package/features/CmsModelOpenSearchIndex/abstractions.js +0 -5
- package/features/CmsModelOpenSearchIndex/abstractions.js.map +0 -1
- package/features/CmsModelOpenSearchIndex/feature.js +0 -13
- package/features/CmsModelOpenSearchIndex/feature.js.map +0 -1
- package/features/CmsModelOpenSearchIndex/index.d.ts +0 -3
- package/features/CmsModelOpenSearchIndex/index.js +0 -3
- package/helpers/entryIndexHelpers.d.ts +0 -20
- package/helpers/entryIndexHelpers.js +0 -80
- package/helpers/entryIndexHelpers.js.map +0 -1
- package/helpers/fieldIdentifier.d.ts +0 -6
- package/helpers/fieldIdentifier.js +0 -23
- package/helpers/fieldIdentifier.js.map +0 -1
- package/helpers/index.d.ts +0 -2
- package/helpers/index.js +0 -2
- package/operations/entry/elasticsearch/assignMinimumShouldMatchToQuery.d.ts +0 -18
- package/operations/entry/elasticsearch/assignMinimumShouldMatchToQuery.js +0 -9
- package/operations/entry/elasticsearch/assignMinimumShouldMatchToQuery.js.map +0 -1
- package/operations/entry/elasticsearch/body.d.ts +0 -30
- package/operations/entry/elasticsearch/body.js +0 -88
- package/operations/entry/elasticsearch/body.js.map +0 -1
- package/operations/entry/elasticsearch/fields/createSystemField.d.ts +0 -4
- package/operations/entry/elasticsearch/fields/createSystemField.js +0 -9
- package/operations/entry/elasticsearch/fields/createSystemField.js.map +0 -1
- package/operations/entry/elasticsearch/fields/live.d.ts +0 -2
- package/operations/entry/elasticsearch/fields/live.js +0 -50
- package/operations/entry/elasticsearch/fields/live.js.map +0 -1
- package/operations/entry/elasticsearch/fields/location.d.ts +0 -2
- package/operations/entry/elasticsearch/fields/location.js +0 -50
- package/operations/entry/elasticsearch/fields/location.js.map +0 -1
- package/operations/entry/elasticsearch/fields/state.d.ts +0 -2
- package/operations/entry/elasticsearch/fields/state.js +0 -104
- package/operations/entry/elasticsearch/fields/state.js.map +0 -1
- package/operations/entry/elasticsearch/fields.d.ts +0 -12
- package/operations/entry/elasticsearch/fields.js +0 -207
- package/operations/entry/elasticsearch/fields.js.map +0 -1
- package/operations/entry/elasticsearch/filtering/applyFiltering.d.ts +0 -9
- package/operations/entry/elasticsearch/filtering/applyFiltering.js +0 -39
- package/operations/entry/elasticsearch/filtering/applyFiltering.js.map +0 -1
- package/operations/entry/elasticsearch/filtering/exec.d.ts +0 -22
- package/operations/entry/elasticsearch/filtering/exec.js +0 -96
- package/operations/entry/elasticsearch/filtering/exec.js.map +0 -1
- package/operations/entry/elasticsearch/filtering/index.d.ts +0 -1
- package/operations/entry/elasticsearch/filtering/index.js +0 -1
- package/operations/entry/elasticsearch/filtering/path.d.ts +0 -17
- package/operations/entry/elasticsearch/filtering/path.js +0 -27
- package/operations/entry/elasticsearch/filtering/path.js.map +0 -1
- package/operations/entry/elasticsearch/filtering/populated.d.ts +0 -2
- package/operations/entry/elasticsearch/filtering/populated.js +0 -12
- package/operations/entry/elasticsearch/filtering/populated.js.map +0 -1
- package/operations/entry/elasticsearch/filtering/values.d.ts +0 -2
- package/operations/entry/elasticsearch/filtering/values.js +0 -15
- package/operations/entry/elasticsearch/filtering/values.js.map +0 -1
- package/operations/entry/elasticsearch/fullTextSearch.d.ts +0 -13
- package/operations/entry/elasticsearch/fullTextSearch.js +0 -51
- package/operations/entry/elasticsearch/fullTextSearch.js.map +0 -1
- package/operations/entry/elasticsearch/fullTextSearchFields.d.ts +0 -8
- package/operations/entry/elasticsearch/fullTextSearchFields.js +0 -10
- package/operations/entry/elasticsearch/fullTextSearchFields.js.map +0 -1
- package/operations/entry/elasticsearch/initialQuery.d.ts +0 -18
- package/operations/entry/elasticsearch/initialQuery.js +0 -43
- package/operations/entry/elasticsearch/initialQuery.js.map +0 -1
- package/operations/entry/elasticsearch/keyword.d.ts +0 -2
- package/operations/entry/elasticsearch/keyword.js +0 -17
- package/operations/entry/elasticsearch/keyword.js.map +0 -1
- package/operations/entry/elasticsearch/plugins/operator.d.ts +0 -7
- package/operations/entry/elasticsearch/plugins/operator.js +0 -13
- package/operations/entry/elasticsearch/plugins/operator.js.map +0 -1
- package/operations/entry/elasticsearch/shouldIgnoreEsResponseError.d.ts +0 -2
- package/operations/entry/elasticsearch/shouldIgnoreEsResponseError.js +0 -8
- package/operations/entry/elasticsearch/shouldIgnoreEsResponseError.js.map +0 -1
- package/operations/entry/elasticsearch/sort.d.ts +0 -12
- package/operations/entry/elasticsearch/sort.js +0 -80
- package/operations/entry/elasticsearch/sort.js.map +0 -1
- package/operations/entry/elasticsearch/transformValueForSearch.d.ts +0 -9
- package/operations/entry/elasticsearch/transformValueForSearch.js +0 -12
- package/operations/entry/elasticsearch/transformValueForSearch.js.map +0 -1
- package/operations/entry/elasticsearch/types.d.ts +0 -34
- package/operations/entry/elasticsearch/types.js +0 -0
- package/operations/entry/index.d.ts +0 -34
- package/operations/entry/index.js +0 -1366
- package/operations/entry/index.js.map +0 -1
- package/operations/entry/transformations/transformEntryToIndex.d.ts +0 -10
- package/operations/entry/transformations/transformEntryToIndex.js +0 -20
- package/operations/entry/transformations/transformEntryToIndex.js.map +0 -1
- package/operations/group/index.d.ts +0 -9
- package/operations/group/index.js +0 -121
- package/operations/group/index.js.map +0 -1
- package/operations/model/index.d.ts +0 -10
- package/operations/model/index.js +0 -119
- package/operations/model/index.js.map +0 -1
- package/tasks/createIndexTaskPlugin.d.ts +0 -2
- package/tasks/createIndexTaskPlugin.js +0 -36
- package/tasks/createIndexTaskPlugin.js.map +0 -1
- package/values/NoValueContainer.d.ts +0 -5
- package/values/NoValueContainer.js +0 -11
- package/values/NoValueContainer.js.map +0 -1
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { CmsModel, CmsEntryValues, CmsEntryStorageOperationsCreateRevisionFromParams } from "@webiny/api-headless-cms/types/index.js";
|
|
2
|
+
import { CreateEntryRevisionFromStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/entry/CreateEntryRevisionFromStorageOperation.js";
|
|
3
|
+
import { CmsDdbEsEntryEntity } from "../../abstractions/CmsDdbEsEntryEntity.js";
|
|
4
|
+
import { CmsDdbEsEntriesEsEntity } from "../../abstractions/CmsDdbEsEntriesEsEntity.js";
|
|
5
|
+
import { CmsDdbEsDataLoaders } from "../../abstractions/CmsDdbEsDataLoaders.js";
|
|
6
|
+
import { CmsStorageModelProvider } from "@webiny/api-headless-cms/features/shared/abstractions.js";
|
|
7
|
+
import { CmsEntryOpenSearchFieldIndexRegistry, CmsEntryOpenSearchValuesModifier } from "@webiny/api-headless-cms-utils-os/exports/api/cms/opensearch.js";
|
|
8
|
+
import { CompressionHandler } from "@webiny/utils/exports/api.js";
|
|
9
|
+
declare class DdbEsCreateEntryRevisionFromImpl implements CreateEntryRevisionFromStorageOperation.Interface {
|
|
10
|
+
private entity;
|
|
11
|
+
private esEntity;
|
|
12
|
+
private dataLoaders;
|
|
13
|
+
private storageModelProvider;
|
|
14
|
+
private fieldIndexRegistry;
|
|
15
|
+
private compressionHandler;
|
|
16
|
+
private valuesModifiers;
|
|
17
|
+
constructor(entity: CmsDdbEsEntryEntity.Interface, esEntity: CmsDdbEsEntriesEsEntity.Interface, dataLoaders: CmsDdbEsDataLoaders.Interface, storageModelProvider: CmsStorageModelProvider.Interface, fieldIndexRegistry: CmsEntryOpenSearchFieldIndexRegistry.Interface, compressionHandler: CompressionHandler.Interface, valuesModifiers: CmsEntryOpenSearchValuesModifier.Interface[]);
|
|
18
|
+
execute<T extends CmsEntryValues = CmsEntryValues>(initialModel: CmsModel, params: CmsEntryStorageOperationsCreateRevisionFromParams<T>): Promise<import("@webiny/api-headless-cms/types/types.js").CmsStorageEntry<T>>;
|
|
19
|
+
}
|
|
20
|
+
export declare const DdbEsCreateEntryRevisionFrom: typeof DdbEsCreateEntryRevisionFromImpl & {
|
|
21
|
+
__abstraction: import("@webiny/di").Abstraction<import("@webiny/api-headless-cms/features/shared/storageOperations/entry/CreateEntryRevisionFromStorageOperation.js").ICreateEntryRevisionFromStorageOperation>;
|
|
22
|
+
};
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import error from "@webiny/error";
|
|
2
|
+
import { CONTENT_ENTRY_STATUS } from "@webiny/api-headless-cms/types/index.js";
|
|
3
|
+
import { CreateEntryRevisionFromStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/entry/CreateEntryRevisionFromStorageOperation.js";
|
|
4
|
+
import { CmsDdbEsEntryEntity } from "../../abstractions/CmsDdbEsEntryEntity.js";
|
|
5
|
+
import { CmsDdbEsEntriesEsEntity } from "../../abstractions/CmsDdbEsEntriesEsEntity.js";
|
|
6
|
+
import { CmsDdbEsDataLoaders } from "../../abstractions/CmsDdbEsDataLoaders.js";
|
|
7
|
+
import { CmsStorageModelProvider } from "@webiny/api-headless-cms/features/shared/abstractions.js";
|
|
8
|
+
import { CmsEntryOpenSearchFieldIndexRegistry, CmsEntryOpenSearchValuesModifier } from "@webiny/api-headless-cms-utils-os/exports/api/cms/opensearch.js";
|
|
9
|
+
import { CompressionHandler } from "@webiny/utils/exports/api.js";
|
|
10
|
+
import { configurations } from "@webiny/api-headless-cms-utils-os/configurations.js";
|
|
11
|
+
import { createTransformer } from "./transformations/index.js";
|
|
12
|
+
import { createEntryLatestKeys, createEntryPublishedKeys, createEntryRevisionKeys } from "./keys.js";
|
|
13
|
+
class DdbEsCreateEntryRevisionFromImpl {
|
|
14
|
+
constructor(entity, esEntity, dataLoaders, storageModelProvider, fieldIndexRegistry, compressionHandler, valuesModifiers){
|
|
15
|
+
this.entity = entity;
|
|
16
|
+
this.esEntity = esEntity;
|
|
17
|
+
this.dataLoaders = dataLoaders;
|
|
18
|
+
this.storageModelProvider = storageModelProvider;
|
|
19
|
+
this.fieldIndexRegistry = fieldIndexRegistry;
|
|
20
|
+
this.compressionHandler = compressionHandler;
|
|
21
|
+
this.valuesModifiers = valuesModifiers;
|
|
22
|
+
}
|
|
23
|
+
async execute(initialModel, params) {
|
|
24
|
+
const { entry: initialEntry, storageEntry: initialStorageEntry } = params;
|
|
25
|
+
const model = this.storageModelProvider.getModel(initialModel);
|
|
26
|
+
const transformer = createTransformer({
|
|
27
|
+
model,
|
|
28
|
+
entry: initialEntry,
|
|
29
|
+
storageEntry: initialStorageEntry,
|
|
30
|
+
fieldIndexRegistry: this.fieldIndexRegistry,
|
|
31
|
+
compressionHandler: this.compressionHandler,
|
|
32
|
+
valuesModifiers: this.valuesModifiers
|
|
33
|
+
});
|
|
34
|
+
const { entry, storageEntry } = transformer.transformEntryKeys();
|
|
35
|
+
const revisionKeys = createEntryRevisionKeys(entry);
|
|
36
|
+
const latestKeys = createEntryLatestKeys(entry);
|
|
37
|
+
const publishedKeys = createEntryPublishedKeys(entry);
|
|
38
|
+
const isPublished = "published" === entry.status;
|
|
39
|
+
const esLatestData = await transformer.getElasticsearchLatestEntryData();
|
|
40
|
+
const entityBatch = this.entity.createEntityWriter({
|
|
41
|
+
put: [
|
|
42
|
+
{
|
|
43
|
+
...revisionKeys,
|
|
44
|
+
data: storageEntry
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
...latestKeys,
|
|
48
|
+
data: storageEntry
|
|
49
|
+
}
|
|
50
|
+
]
|
|
51
|
+
});
|
|
52
|
+
if (isPublished) {
|
|
53
|
+
entityBatch.put({
|
|
54
|
+
...publishedKeys,
|
|
55
|
+
data: storageEntry
|
|
56
|
+
});
|
|
57
|
+
const [publishedRevisionStorageEntry] = await this.dataLoaders.getPublishedRevisionByEntryId({
|
|
58
|
+
model,
|
|
59
|
+
ids: [
|
|
60
|
+
entry.id
|
|
61
|
+
]
|
|
62
|
+
});
|
|
63
|
+
if (publishedRevisionStorageEntry) {
|
|
64
|
+
const publishedRevisionKey = createEntryRevisionKeys(publishedRevisionStorageEntry);
|
|
65
|
+
entityBatch.put({
|
|
66
|
+
...publishedRevisionKey,
|
|
67
|
+
data: {
|
|
68
|
+
...publishedRevisionStorageEntry,
|
|
69
|
+
status: CONTENT_ENTRY_STATUS.UNPUBLISHED
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
try {
|
|
75
|
+
await entityBatch.execute();
|
|
76
|
+
this.dataLoaders.clearAll({
|
|
77
|
+
tenant: entry.tenant
|
|
78
|
+
});
|
|
79
|
+
} catch (ex) {
|
|
80
|
+
throw new error(ex.message || "Could not create revision from given entry in the DynamoDB table.", ex.code || "CREATE_REVISION_ERROR", {
|
|
81
|
+
error: ex,
|
|
82
|
+
entry,
|
|
83
|
+
storageEntry
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
const { index: esIndex } = configurations.es({
|
|
87
|
+
model
|
|
88
|
+
});
|
|
89
|
+
const elasticsearchEntityBatch = this.esEntity.createEntityWriter({
|
|
90
|
+
put: [
|
|
91
|
+
{
|
|
92
|
+
...latestKeys,
|
|
93
|
+
index: esIndex,
|
|
94
|
+
data: esLatestData
|
|
95
|
+
}
|
|
96
|
+
]
|
|
97
|
+
});
|
|
98
|
+
if (isPublished) {
|
|
99
|
+
const esPublishedData = await transformer.getElasticsearchPublishedEntryData();
|
|
100
|
+
elasticsearchEntityBatch.put({
|
|
101
|
+
...publishedKeys,
|
|
102
|
+
index: esIndex,
|
|
103
|
+
data: esPublishedData
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
try {
|
|
107
|
+
await elasticsearchEntityBatch.execute();
|
|
108
|
+
} catch (ex) {
|
|
109
|
+
throw new error(ex.message || "Could not update latest entry in the DynamoDB Elasticsearch table.", ex.code || "CREATE_REVISION_ERROR", {
|
|
110
|
+
error: ex,
|
|
111
|
+
entry
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
return initialStorageEntry;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
const DdbEsCreateEntryRevisionFrom = CreateEntryRevisionFromStorageOperation.createImplementation({
|
|
118
|
+
implementation: DdbEsCreateEntryRevisionFromImpl,
|
|
119
|
+
dependencies: [
|
|
120
|
+
CmsDdbEsEntryEntity,
|
|
121
|
+
CmsDdbEsEntriesEsEntity,
|
|
122
|
+
CmsDdbEsDataLoaders,
|
|
123
|
+
CmsStorageModelProvider,
|
|
124
|
+
CmsEntryOpenSearchFieldIndexRegistry,
|
|
125
|
+
CompressionHandler,
|
|
126
|
+
[
|
|
127
|
+
CmsEntryOpenSearchValuesModifier,
|
|
128
|
+
{
|
|
129
|
+
multiple: true
|
|
130
|
+
}
|
|
131
|
+
]
|
|
132
|
+
]
|
|
133
|
+
});
|
|
134
|
+
export { DdbEsCreateEntryRevisionFrom };
|
|
135
|
+
|
|
136
|
+
//# sourceMappingURL=DdbEsCreateEntryRevisionFrom.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operations/entry/DdbEsCreateEntryRevisionFrom.js","sources":["../../../src/operations/entry/DdbEsCreateEntryRevisionFrom.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport type {\n CmsModel,\n CmsEntryValues,\n CmsEntryStorageOperationsCreateRevisionFromParams\n} from \"@webiny/api-headless-cms/types/index.js\";\nimport { CONTENT_ENTRY_STATUS } from \"@webiny/api-headless-cms/types/index.js\";\nimport { CreateEntryRevisionFromStorageOperation } from \"@webiny/api-headless-cms/features/shared/storageOperations/entry/CreateEntryRevisionFromStorageOperation.js\";\nimport { CmsDdbEsEntryEntity } from \"~/abstractions/CmsDdbEsEntryEntity.js\";\nimport { CmsDdbEsEntriesEsEntity } from \"~/abstractions/CmsDdbEsEntriesEsEntity.js\";\nimport { CmsDdbEsDataLoaders } from \"~/abstractions/CmsDdbEsDataLoaders.js\";\nimport { CmsStorageModelProvider } from \"@webiny/api-headless-cms/features/shared/abstractions.js\";\nimport {\n CmsEntryOpenSearchFieldIndexRegistry,\n CmsEntryOpenSearchValuesModifier\n} from \"@webiny/api-headless-cms-utils-os/exports/api/cms/opensearch.js\";\nimport { CompressionHandler } from \"@webiny/utils/exports/api.js\";\nimport { configurations } from \"@webiny/api-headless-cms-utils-os/configurations.js\";\nimport { createTransformer } from \"./transformations/index.js\";\nimport {\n createEntryLatestKeys,\n createEntryPublishedKeys,\n createEntryRevisionKeys\n} from \"./keys.js\";\n\nclass DdbEsCreateEntryRevisionFromImpl\n implements CreateEntryRevisionFromStorageOperation.Interface\n{\n constructor(\n private entity: CmsDdbEsEntryEntity.Interface,\n private esEntity: CmsDdbEsEntriesEsEntity.Interface,\n private dataLoaders: CmsDdbEsDataLoaders.Interface,\n private storageModelProvider: CmsStorageModelProvider.Interface,\n private fieldIndexRegistry: CmsEntryOpenSearchFieldIndexRegistry.Interface,\n private compressionHandler: CompressionHandler.Interface,\n private valuesModifiers: CmsEntryOpenSearchValuesModifier.Interface[]\n ) {}\n\n async execute<T extends CmsEntryValues = CmsEntryValues>(\n initialModel: CmsModel,\n params: CmsEntryStorageOperationsCreateRevisionFromParams<T>\n ) {\n const { entry: initialEntry, storageEntry: initialStorageEntry } = params;\n const model = this.storageModelProvider.getModel<T>(initialModel);\n\n const transformer = createTransformer<T>({\n model,\n entry: initialEntry,\n storageEntry: initialStorageEntry,\n fieldIndexRegistry: this.fieldIndexRegistry,\n compressionHandler: this.compressionHandler,\n valuesModifiers: this.valuesModifiers\n });\n const { entry, storageEntry } = transformer.transformEntryKeys();\n\n const revisionKeys = createEntryRevisionKeys(entry);\n const latestKeys = createEntryLatestKeys(entry);\n const publishedKeys = createEntryPublishedKeys(entry);\n\n // We'll need this flag below.\n const isPublished = entry.status === \"published\";\n\n const esLatestData = await transformer.getElasticsearchLatestEntryData();\n\n const entityBatch = this.entity.createEntityWriter({\n put: [\n {\n ...revisionKeys,\n data: storageEntry\n },\n {\n ...latestKeys,\n data: storageEntry\n }\n ]\n });\n\n if (isPublished) {\n entityBatch.put({\n ...publishedKeys,\n data: storageEntry\n });\n\n // Unpublish previously published revision (if any).\n const [publishedRevisionStorageEntry] =\n await this.dataLoaders.getPublishedRevisionByEntryId({\n model,\n ids: [entry.id]\n });\n\n if (publishedRevisionStorageEntry) {\n const publishedRevisionKey = createEntryRevisionKeys(publishedRevisionStorageEntry);\n entityBatch.put({\n ...publishedRevisionKey,\n data: {\n ...publishedRevisionStorageEntry,\n status: CONTENT_ENTRY_STATUS.UNPUBLISHED\n }\n });\n }\n }\n\n try {\n await entityBatch.execute();\n\n this.dataLoaders.clearAll({\n tenant: entry.tenant\n });\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not create revision from given entry in the DynamoDB table.\",\n ex.code || \"CREATE_REVISION_ERROR\",\n {\n error: ex,\n entry,\n storageEntry\n }\n );\n }\n\n const { index: esIndex } = configurations.es({\n model\n });\n\n const elasticsearchEntityBatch = this.esEntity.createEntityWriter({\n put: [\n {\n ...latestKeys,\n index: esIndex,\n data: esLatestData\n }\n ]\n });\n\n if (isPublished) {\n const esPublishedData = await transformer.getElasticsearchPublishedEntryData();\n elasticsearchEntityBatch.put({\n ...publishedKeys,\n index: esIndex,\n data: esPublishedData\n });\n }\n\n try {\n await elasticsearchEntityBatch.execute();\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not update latest entry in the DynamoDB Elasticsearch table.\",\n ex.code || \"CREATE_REVISION_ERROR\",\n {\n error: ex,\n entry\n }\n );\n }\n /**\n * There are no modifications on the entry created so just return the data.\n */\n return initialStorageEntry;\n }\n}\n\nexport const DdbEsCreateEntryRevisionFrom =\n CreateEntryRevisionFromStorageOperation.createImplementation({\n implementation: DdbEsCreateEntryRevisionFromImpl,\n dependencies: [\n CmsDdbEsEntryEntity,\n CmsDdbEsEntriesEsEntity,\n CmsDdbEsDataLoaders,\n CmsStorageModelProvider,\n CmsEntryOpenSearchFieldIndexRegistry,\n CompressionHandler,\n [CmsEntryOpenSearchValuesModifier, { multiple: true }]\n ]\n });\n"],"names":["DdbEsCreateEntryRevisionFromImpl","entity","esEntity","dataLoaders","storageModelProvider","fieldIndexRegistry","compressionHandler","valuesModifiers","initialModel","params","initialEntry","initialStorageEntry","model","transformer","createTransformer","entry","storageEntry","revisionKeys","createEntryRevisionKeys","latestKeys","createEntryLatestKeys","publishedKeys","createEntryPublishedKeys","isPublished","esLatestData","entityBatch","publishedRevisionStorageEntry","publishedRevisionKey","CONTENT_ENTRY_STATUS","ex","WebinyError","esIndex","configurations","elasticsearchEntityBatch","esPublishedData","DdbEsCreateEntryRevisionFrom","CreateEntryRevisionFromStorageOperation","CmsDdbEsEntryEntity","CmsDdbEsEntriesEsEntity","CmsDdbEsDataLoaders","CmsStorageModelProvider","CmsEntryOpenSearchFieldIndexRegistry","CompressionHandler","CmsEntryOpenSearchValuesModifier"],"mappings":"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"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { CmsModel, CmsEntryStorageOperationsDeleteParams } from "@webiny/api-headless-cms/types/index.js";
|
|
2
|
+
import { DeleteEntryStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/entry/DeleteEntryStorageOperation.js";
|
|
3
|
+
import { CmsDdbEsEntryEntity } from "../../abstractions/CmsDdbEsEntryEntity.js";
|
|
4
|
+
import { CmsDdbEsEntriesEsEntity } from "../../abstractions/CmsDdbEsEntriesEsEntity.js";
|
|
5
|
+
import { CmsDdbEsDataLoaders } from "../../abstractions/CmsDdbEsDataLoaders.js";
|
|
6
|
+
import { CmsStorageModelProvider } from "@webiny/api-headless-cms/features/shared/abstractions.js";
|
|
7
|
+
declare class DdbEsDeleteEntryImpl implements DeleteEntryStorageOperation.Interface {
|
|
8
|
+
private entity;
|
|
9
|
+
private esEntity;
|
|
10
|
+
private dataLoaders;
|
|
11
|
+
private storageModelProvider;
|
|
12
|
+
constructor(entity: CmsDdbEsEntryEntity.Interface, esEntity: CmsDdbEsEntriesEsEntity.Interface, dataLoaders: CmsDdbEsDataLoaders.Interface, storageModelProvider: CmsStorageModelProvider.Interface);
|
|
13
|
+
execute(initialModel: CmsModel, params: CmsEntryStorageOperationsDeleteParams): Promise<void>;
|
|
14
|
+
}
|
|
15
|
+
export declare const DdbEsDeleteEntry: typeof DdbEsDeleteEntryImpl & {
|
|
16
|
+
__abstraction: import("@webiny/di").Abstraction<import("@webiny/api-headless-cms/features/shared/storageOperations/entry/DeleteEntryStorageOperation.js").IDeleteEntryStorageOperation>;
|
|
17
|
+
};
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import error from "@webiny/error";
|
|
2
|
+
import { DeleteEntryStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/entry/DeleteEntryStorageOperation.js";
|
|
3
|
+
import { CmsDdbEsEntryEntity } from "../../abstractions/CmsDdbEsEntryEntity.js";
|
|
4
|
+
import { CmsDdbEsEntriesEsEntity } from "../../abstractions/CmsDdbEsEntriesEsEntity.js";
|
|
5
|
+
import { CmsDdbEsDataLoaders } from "../../abstractions/CmsDdbEsDataLoaders.js";
|
|
6
|
+
import { CmsStorageModelProvider } from "@webiny/api-headless-cms/features/shared/abstractions.js";
|
|
7
|
+
import { createPartitionKey } from "./keys.js";
|
|
8
|
+
class DdbEsDeleteEntryImpl {
|
|
9
|
+
constructor(entity, esEntity, dataLoaders, storageModelProvider){
|
|
10
|
+
this.entity = entity;
|
|
11
|
+
this.esEntity = esEntity;
|
|
12
|
+
this.dataLoaders = dataLoaders;
|
|
13
|
+
this.storageModelProvider = storageModelProvider;
|
|
14
|
+
}
|
|
15
|
+
async execute(initialModel, params) {
|
|
16
|
+
const { entry } = params;
|
|
17
|
+
const id = entry.id || entry.entryId;
|
|
18
|
+
const model = this.storageModelProvider.getModel(initialModel);
|
|
19
|
+
const partitionKey = createPartitionKey({
|
|
20
|
+
id,
|
|
21
|
+
tenant: model.tenant
|
|
22
|
+
});
|
|
23
|
+
const items = await this.entity.queryAll({
|
|
24
|
+
partitionKey,
|
|
25
|
+
options: {
|
|
26
|
+
gte: " "
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
const esItems = await this.esEntity.queryAll({
|
|
30
|
+
partitionKey,
|
|
31
|
+
options: {
|
|
32
|
+
gte: " "
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
const entityBatch = this.entity.createEntityWriter({
|
|
36
|
+
delete: items.map((item)=>({
|
|
37
|
+
PK: item.PK,
|
|
38
|
+
SK: item.SK
|
|
39
|
+
}))
|
|
40
|
+
});
|
|
41
|
+
const elasticsearchEntityBatch = this.esEntity.createEntityWriter({
|
|
42
|
+
delete: esItems.map((item)=>({
|
|
43
|
+
PK: item.PK,
|
|
44
|
+
SK: item.SK
|
|
45
|
+
}))
|
|
46
|
+
});
|
|
47
|
+
try {
|
|
48
|
+
await entityBatch.execute();
|
|
49
|
+
this.dataLoaders.clearAll({
|
|
50
|
+
tenant: entry.tenant
|
|
51
|
+
});
|
|
52
|
+
} catch (ex) {
|
|
53
|
+
throw new error(ex.message || "Could not destroy entry records from DynamoDB table.", ex.code || "DELETE_ENTRY_ERROR", {
|
|
54
|
+
error: ex,
|
|
55
|
+
id
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
try {
|
|
59
|
+
await elasticsearchEntityBatch.execute();
|
|
60
|
+
} catch (ex) {
|
|
61
|
+
throw new error(ex.message || "Could not destroy entry records from DynamoDB Elasticsearch table.", ex.code || "DELETE_ENTRY_ERROR", {
|
|
62
|
+
error: ex,
|
|
63
|
+
id
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
const DdbEsDeleteEntry = DeleteEntryStorageOperation.createImplementation({
|
|
69
|
+
implementation: DdbEsDeleteEntryImpl,
|
|
70
|
+
dependencies: [
|
|
71
|
+
CmsDdbEsEntryEntity,
|
|
72
|
+
CmsDdbEsEntriesEsEntity,
|
|
73
|
+
CmsDdbEsDataLoaders,
|
|
74
|
+
CmsStorageModelProvider
|
|
75
|
+
]
|
|
76
|
+
});
|
|
77
|
+
export { DdbEsDeleteEntry };
|
|
78
|
+
|
|
79
|
+
//# sourceMappingURL=DdbEsDeleteEntry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operations/entry/DdbEsDeleteEntry.js","sources":["../../../src/operations/entry/DdbEsDeleteEntry.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport type {\n CmsModel,\n CmsEntryStorageOperationsDeleteParams\n} from \"@webiny/api-headless-cms/types/index.js\";\nimport { DeleteEntryStorageOperation } from \"@webiny/api-headless-cms/features/shared/storageOperations/entry/DeleteEntryStorageOperation.js\";\nimport { CmsDdbEsEntryEntity } from \"~/abstractions/CmsDdbEsEntryEntity.js\";\nimport { CmsDdbEsEntriesEsEntity } from \"~/abstractions/CmsDdbEsEntriesEsEntity.js\";\nimport { CmsDdbEsDataLoaders } from \"~/abstractions/CmsDdbEsDataLoaders.js\";\nimport { CmsStorageModelProvider } from \"@webiny/api-headless-cms/features/shared/abstractions.js\";\nimport { createPartitionKey } from \"./keys.js\";\n\nclass DdbEsDeleteEntryImpl implements DeleteEntryStorageOperation.Interface {\n constructor(\n private entity: CmsDdbEsEntryEntity.Interface,\n private esEntity: CmsDdbEsEntriesEsEntity.Interface,\n private dataLoaders: CmsDdbEsDataLoaders.Interface,\n private storageModelProvider: CmsStorageModelProvider.Interface\n ) {}\n\n async execute(initialModel: CmsModel, params: CmsEntryStorageOperationsDeleteParams) {\n const { entry } = params;\n const id = entry.id || entry.entryId;\n const model = this.storageModelProvider.getModel(initialModel);\n\n const partitionKey = createPartitionKey({\n id,\n tenant: model.tenant\n });\n\n const items = await this.entity.queryAll({\n partitionKey,\n options: {\n gte: \" \"\n }\n });\n\n const esItems = await this.esEntity.queryAll({\n partitionKey,\n options: {\n gte: \" \"\n }\n });\n\n const entityBatch = this.entity.createEntityWriter({\n delete: items.map(item => {\n return {\n PK: item.PK,\n SK: item.SK\n };\n })\n });\n\n const elasticsearchEntityBatch = this.esEntity.createEntityWriter({\n delete: esItems.map(item => {\n return {\n PK: item.PK,\n SK: item.SK\n };\n })\n });\n\n try {\n await entityBatch.execute();\n\n this.dataLoaders.clearAll({\n tenant: entry.tenant\n });\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not destroy entry records from DynamoDB table.\",\n ex.code || \"DELETE_ENTRY_ERROR\",\n {\n error: ex,\n id\n }\n );\n }\n\n try {\n await elasticsearchEntityBatch.execute();\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not destroy entry records from DynamoDB Elasticsearch table.\",\n ex.code || \"DELETE_ENTRY_ERROR\",\n {\n error: ex,\n id\n }\n );\n }\n }\n}\n\nexport const DdbEsDeleteEntry = DeleteEntryStorageOperation.createImplementation({\n implementation: DdbEsDeleteEntryImpl,\n dependencies: [\n CmsDdbEsEntryEntity,\n CmsDdbEsEntriesEsEntity,\n CmsDdbEsDataLoaders,\n CmsStorageModelProvider\n ]\n});\n"],"names":["DdbEsDeleteEntryImpl","entity","esEntity","dataLoaders","storageModelProvider","initialModel","params","entry","id","model","partitionKey","createPartitionKey","items","esItems","entityBatch","item","elasticsearchEntityBatch","ex","WebinyError","DdbEsDeleteEntry","DeleteEntryStorageOperation","CmsDdbEsEntryEntity","CmsDdbEsEntriesEsEntity","CmsDdbEsDataLoaders","CmsStorageModelProvider"],"mappings":";;;;;;;AAYA,MAAMA;IACF,YACYC,MAAqC,EACrCC,QAA2C,EAC3CC,WAA0C,EAC1CC,oBAAuD,CACjE;aAJUH,MAAM,GAANA;aACAC,QAAQ,GAARA;aACAC,WAAW,GAAXA;aACAC,oBAAoB,GAApBA;IACT;IAEH,MAAM,QAAQC,YAAsB,EAAEC,MAA6C,EAAE;QACjF,MAAM,EAAEC,KAAK,EAAE,GAAGD;QAClB,MAAME,KAAKD,MAAM,EAAE,IAAIA,MAAM,OAAO;QACpC,MAAME,QAAQ,IAAI,CAAC,oBAAoB,CAAC,QAAQ,CAACJ;QAEjD,MAAMK,eAAeC,mBAAmB;YACpCH;YACA,QAAQC,MAAM,MAAM;QACxB;QAEA,MAAMG,QAAQ,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC;YACrCF;YACA,SAAS;gBACL,KAAK;YACT;QACJ;QAEA,MAAMG,UAAU,MAAM,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC;YACzCH;YACA,SAAS;gBACL,KAAK;YACT;QACJ;QAEA,MAAMI,cAAc,IAAI,CAAC,MAAM,CAAC,kBAAkB,CAAC;YAC/C,QAAQF,MAAM,GAAG,CAACG,CAAAA,OACP;oBACH,IAAIA,KAAK,EAAE;oBACX,IAAIA,KAAK,EAAE;gBACf;QAER;QAEA,MAAMC,2BAA2B,IAAI,CAAC,QAAQ,CAAC,kBAAkB,CAAC;YAC9D,QAAQH,QAAQ,GAAG,CAACE,CAAAA,OACT;oBACH,IAAIA,KAAK,EAAE;oBACX,IAAIA,KAAK,EAAE;gBACf;QAER;QAEA,IAAI;YACA,MAAMD,YAAY,OAAO;YAEzB,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC;gBACtB,QAAQP,MAAM,MAAM;YACxB;QACJ,EAAE,OAAOU,IAAI;YACT,MAAM,IAAIC,MACND,GAAG,OAAO,IAAI,wDACdA,GAAG,IAAI,IAAI,sBACX;gBACI,OAAOA;gBACPT;YACJ;QAER;QAEA,IAAI;YACA,MAAMQ,yBAAyB,OAAO;QAC1C,EAAE,OAAOC,IAAI;YACT,MAAM,IAAIC,MACND,GAAG,OAAO,IAAI,sEACdA,GAAG,IAAI,IAAI,sBACX;gBACI,OAAOA;gBACPT;YACJ;QAER;IACJ;AACJ;AAEO,MAAMW,mBAAmBC,4BAA4B,oBAAoB,CAAC;IAC7E,gBAAgBpB;IAChB,cAAc;QACVqB;QACAC;QACAC;QACAC;KACH;AACL"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { CmsModel, CmsEntryValues, CmsEntryStorageOperationsDeleteRevisionParams } from "@webiny/api-headless-cms/types/index.js";
|
|
2
|
+
import { DeleteEntryRevisionStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/entry/DeleteEntryRevisionStorageOperation.js";
|
|
3
|
+
import { CmsDdbEsEntryEntity } from "../../abstractions/CmsDdbEsEntryEntity.js";
|
|
4
|
+
import { CmsDdbEsEntriesEsEntity } from "../../abstractions/CmsDdbEsEntriesEsEntity.js";
|
|
5
|
+
import { CmsDdbEsDataLoaders } from "../../abstractions/CmsDdbEsDataLoaders.js";
|
|
6
|
+
import { CmsStorageModelProvider } from "@webiny/api-headless-cms/features/shared/abstractions.js";
|
|
7
|
+
import { CmsEntryOpenSearchFieldIndexRegistry, CmsEntryOpenSearchValuesModifier } from "@webiny/api-headless-cms-utils-os/exports/api/cms/opensearch.js";
|
|
8
|
+
import { CompressionHandler } from "@webiny/utils/exports/api.js";
|
|
9
|
+
declare class DdbEsDeleteEntryRevisionImpl implements DeleteEntryRevisionStorageOperation.Interface {
|
|
10
|
+
private entity;
|
|
11
|
+
private esEntity;
|
|
12
|
+
private dataLoaders;
|
|
13
|
+
private storageModelProvider;
|
|
14
|
+
private fieldIndexRegistry;
|
|
15
|
+
private compressionHandler;
|
|
16
|
+
private valuesModifiers;
|
|
17
|
+
constructor(entity: CmsDdbEsEntryEntity.Interface, esEntity: CmsDdbEsEntriesEsEntity.Interface, dataLoaders: CmsDdbEsDataLoaders.Interface, storageModelProvider: CmsStorageModelProvider.Interface, fieldIndexRegistry: CmsEntryOpenSearchFieldIndexRegistry.Interface, compressionHandler: CompressionHandler.Interface, valuesModifiers: CmsEntryOpenSearchValuesModifier.Interface[]);
|
|
18
|
+
execute<T extends CmsEntryValues = CmsEntryValues>(initialModel: CmsModel, params: CmsEntryStorageOperationsDeleteRevisionParams<T>): Promise<void>;
|
|
19
|
+
}
|
|
20
|
+
export declare const DdbEsDeleteEntryRevision: typeof DdbEsDeleteEntryRevisionImpl & {
|
|
21
|
+
__abstraction: import("@webiny/di").Abstraction<import("@webiny/api-headless-cms/features/shared/storageOperations/entry/DeleteEntryRevisionStorageOperation.js").IDeleteEntryRevisionStorageOperation>;
|
|
22
|
+
};
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import error from "@webiny/error";
|
|
2
|
+
import { DeleteEntryRevisionStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/entry/DeleteEntryRevisionStorageOperation.js";
|
|
3
|
+
import { CmsDdbEsEntryEntity } from "../../abstractions/CmsDdbEsEntryEntity.js";
|
|
4
|
+
import { CmsDdbEsEntriesEsEntity } from "../../abstractions/CmsDdbEsEntriesEsEntity.js";
|
|
5
|
+
import { CmsDdbEsDataLoaders } from "../../abstractions/CmsDdbEsDataLoaders.js";
|
|
6
|
+
import { CmsStorageModelProvider } from "@webiny/api-headless-cms/features/shared/abstractions.js";
|
|
7
|
+
import { CmsEntryOpenSearchFieldIndexRegistry, CmsEntryOpenSearchValuesModifier } from "@webiny/api-headless-cms-utils-os/exports/api/cms/opensearch.js";
|
|
8
|
+
import { CompressionHandler } from "@webiny/utils/exports/api.js";
|
|
9
|
+
import { configurations } from "@webiny/api-headless-cms-utils-os/configurations.js";
|
|
10
|
+
import { createTransformer } from "./transformations/index.js";
|
|
11
|
+
import { createEntryLatestKeys, createEntryRevisionKeys, createPartitionKey, createPublishedSortKey, createRevisionSortKey } from "./keys.js";
|
|
12
|
+
import { convertToStorageEntry } from "./storageEntryUtils.js";
|
|
13
|
+
class DdbEsDeleteEntryRevisionImpl {
|
|
14
|
+
constructor(entity, esEntity, dataLoaders, storageModelProvider, fieldIndexRegistry, compressionHandler, valuesModifiers){
|
|
15
|
+
this.entity = entity;
|
|
16
|
+
this.esEntity = esEntity;
|
|
17
|
+
this.dataLoaders = dataLoaders;
|
|
18
|
+
this.storageModelProvider = storageModelProvider;
|
|
19
|
+
this.fieldIndexRegistry = fieldIndexRegistry;
|
|
20
|
+
this.compressionHandler = compressionHandler;
|
|
21
|
+
this.valuesModifiers = valuesModifiers;
|
|
22
|
+
}
|
|
23
|
+
async execute(initialModel, params) {
|
|
24
|
+
const { entry, latestEntry, latestStorageEntry: initialLatestStorageEntry } = params;
|
|
25
|
+
const model = this.storageModelProvider.getModel(initialModel);
|
|
26
|
+
const partitionKey = createPartitionKey({
|
|
27
|
+
id: entry.id,
|
|
28
|
+
tenant: model.tenant
|
|
29
|
+
});
|
|
30
|
+
const { index } = configurations.es({
|
|
31
|
+
model
|
|
32
|
+
});
|
|
33
|
+
const [publishedStorageEntry] = await this.dataLoaders.getPublishedRevisionByEntryId({
|
|
34
|
+
model,
|
|
35
|
+
ids: [
|
|
36
|
+
entry.id
|
|
37
|
+
]
|
|
38
|
+
});
|
|
39
|
+
const entityBatch = this.entity.createEntityWriter({
|
|
40
|
+
delete: [
|
|
41
|
+
{
|
|
42
|
+
PK: partitionKey,
|
|
43
|
+
SK: createRevisionSortKey(entry)
|
|
44
|
+
}
|
|
45
|
+
]
|
|
46
|
+
});
|
|
47
|
+
const elasticsearchEntityBatch = this.esEntity.createEntityWriter();
|
|
48
|
+
if (publishedStorageEntry?.id === entry.id) {
|
|
49
|
+
entityBatch.delete({
|
|
50
|
+
PK: partitionKey,
|
|
51
|
+
SK: createPublishedSortKey()
|
|
52
|
+
});
|
|
53
|
+
elasticsearchEntityBatch.delete({
|
|
54
|
+
PK: partitionKey,
|
|
55
|
+
SK: createPublishedSortKey()
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
if (latestEntry && initialLatestStorageEntry) {
|
|
59
|
+
const latestStorageEntry = convertToStorageEntry({
|
|
60
|
+
storageEntry: initialLatestStorageEntry,
|
|
61
|
+
model
|
|
62
|
+
});
|
|
63
|
+
const latestStorageEntryLatestKey = createEntryLatestKeys(latestStorageEntry);
|
|
64
|
+
entityBatch.put({
|
|
65
|
+
...latestStorageEntryLatestKey,
|
|
66
|
+
data: latestStorageEntry
|
|
67
|
+
});
|
|
68
|
+
const actualRevisionEntryKey = createEntryRevisionKeys(initialLatestStorageEntry);
|
|
69
|
+
entityBatch.put({
|
|
70
|
+
...actualRevisionEntryKey,
|
|
71
|
+
data: latestStorageEntry
|
|
72
|
+
});
|
|
73
|
+
const latestTransformer = createTransformer({
|
|
74
|
+
valuesModifiers: this.valuesModifiers,
|
|
75
|
+
model,
|
|
76
|
+
entry: latestEntry,
|
|
77
|
+
storageEntry: initialLatestStorageEntry,
|
|
78
|
+
fieldIndexRegistry: this.fieldIndexRegistry,
|
|
79
|
+
compressionHandler: this.compressionHandler
|
|
80
|
+
});
|
|
81
|
+
const esLatestData = await latestTransformer.getElasticsearchLatestEntryData();
|
|
82
|
+
const esLatestKeys = createEntryLatestKeys(latestEntry);
|
|
83
|
+
elasticsearchEntityBatch.put({
|
|
84
|
+
...esLatestKeys,
|
|
85
|
+
index,
|
|
86
|
+
data: esLatestData
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
try {
|
|
90
|
+
await entityBatch.execute();
|
|
91
|
+
this.dataLoaders.clearAll({
|
|
92
|
+
tenant: entry.tenant
|
|
93
|
+
});
|
|
94
|
+
} catch (ex) {
|
|
95
|
+
throw new error(ex.message || "Could not batch write entry records to DynamoDB table.", ex.code || "DELETE_REVISION_ERROR", {
|
|
96
|
+
error: ex,
|
|
97
|
+
entry,
|
|
98
|
+
latestEntry,
|
|
99
|
+
initialLatestStorageEntry
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
try {
|
|
103
|
+
await elasticsearchEntityBatch.execute();
|
|
104
|
+
} catch (ex) {
|
|
105
|
+
throw new error(ex.message || "Could not batch write entry records to DynamoDB Elasticsearch table.", ex.code || "DELETE_REVISION_ERROR", {
|
|
106
|
+
error: ex,
|
|
107
|
+
entry,
|
|
108
|
+
latestEntry,
|
|
109
|
+
initialLatestStorageEntry
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
const DdbEsDeleteEntryRevision = DeleteEntryRevisionStorageOperation.createImplementation({
|
|
115
|
+
implementation: DdbEsDeleteEntryRevisionImpl,
|
|
116
|
+
dependencies: [
|
|
117
|
+
CmsDdbEsEntryEntity,
|
|
118
|
+
CmsDdbEsEntriesEsEntity,
|
|
119
|
+
CmsDdbEsDataLoaders,
|
|
120
|
+
CmsStorageModelProvider,
|
|
121
|
+
CmsEntryOpenSearchFieldIndexRegistry,
|
|
122
|
+
CompressionHandler,
|
|
123
|
+
[
|
|
124
|
+
CmsEntryOpenSearchValuesModifier,
|
|
125
|
+
{
|
|
126
|
+
multiple: true
|
|
127
|
+
}
|
|
128
|
+
]
|
|
129
|
+
]
|
|
130
|
+
});
|
|
131
|
+
export { DdbEsDeleteEntryRevision };
|
|
132
|
+
|
|
133
|
+
//# sourceMappingURL=DdbEsDeleteEntryRevision.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operations/entry/DdbEsDeleteEntryRevision.js","sources":["../../../src/operations/entry/DdbEsDeleteEntryRevision.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport type {\n CmsModel,\n CmsEntryValues,\n CmsEntryStorageOperationsDeleteRevisionParams\n} from \"@webiny/api-headless-cms/types/index.js\";\nimport { DeleteEntryRevisionStorageOperation } from \"@webiny/api-headless-cms/features/shared/storageOperations/entry/DeleteEntryRevisionStorageOperation.js\";\nimport { CmsDdbEsEntryEntity } from \"~/abstractions/CmsDdbEsEntryEntity.js\";\nimport { CmsDdbEsEntriesEsEntity } from \"~/abstractions/CmsDdbEsEntriesEsEntity.js\";\nimport { CmsDdbEsDataLoaders } from \"~/abstractions/CmsDdbEsDataLoaders.js\";\nimport { CmsStorageModelProvider } from \"@webiny/api-headless-cms/features/shared/abstractions.js\";\nimport {\n CmsEntryOpenSearchFieldIndexRegistry,\n CmsEntryOpenSearchValuesModifier\n} from \"@webiny/api-headless-cms-utils-os/exports/api/cms/opensearch.js\";\nimport { CompressionHandler } from \"@webiny/utils/exports/api.js\";\nimport { configurations } from \"@webiny/api-headless-cms-utils-os/configurations.js\";\nimport { createTransformer } from \"./transformations/index.js\";\nimport {\n createEntryLatestKeys,\n createEntryRevisionKeys,\n createPartitionKey,\n createPublishedSortKey,\n createRevisionSortKey\n} from \"./keys.js\";\nimport { convertToStorageEntry } from \"./storageEntryUtils.js\";\n\nclass DdbEsDeleteEntryRevisionImpl implements DeleteEntryRevisionStorageOperation.Interface {\n constructor(\n private entity: CmsDdbEsEntryEntity.Interface,\n private esEntity: CmsDdbEsEntriesEsEntity.Interface,\n private dataLoaders: CmsDdbEsDataLoaders.Interface,\n private storageModelProvider: CmsStorageModelProvider.Interface,\n private fieldIndexRegistry: CmsEntryOpenSearchFieldIndexRegistry.Interface,\n private compressionHandler: CompressionHandler.Interface,\n private valuesModifiers: CmsEntryOpenSearchValuesModifier.Interface[]\n ) {}\n\n async execute<T extends CmsEntryValues = CmsEntryValues>(\n initialModel: CmsModel,\n params: CmsEntryStorageOperationsDeleteRevisionParams<T>\n ): Promise<void> {\n const { entry, latestEntry, latestStorageEntry: initialLatestStorageEntry } = params;\n const model = this.storageModelProvider.getModel(initialModel);\n\n const partitionKey = createPartitionKey({\n id: entry.id,\n tenant: model.tenant\n });\n\n const { index } = configurations.es({\n model\n });\n /**\n * We need published entry to delete it if necessary.\n */\n const [publishedStorageEntry] = await this.dataLoaders.getPublishedRevisionByEntryId({\n model,\n ids: [entry.id]\n });\n /**\n * We need to delete all existing records of the given entry revision.\n */\n const entityBatch = this.entity.createEntityWriter({\n delete: [\n {\n PK: partitionKey,\n SK: createRevisionSortKey(entry)\n }\n ]\n });\n\n const elasticsearchEntityBatch = this.esEntity.createEntityWriter();\n\n /**\n * If revision we are deleting is the published one as well, we need to delete those records as well.\n */\n if (publishedStorageEntry?.id === entry.id) {\n entityBatch.delete({\n PK: partitionKey,\n SK: createPublishedSortKey()\n });\n\n elasticsearchEntityBatch.delete({\n PK: partitionKey,\n SK: createPublishedSortKey()\n });\n }\n\n if (latestEntry && initialLatestStorageEntry) {\n const latestStorageEntry = convertToStorageEntry({\n storageEntry: initialLatestStorageEntry,\n model\n });\n\n /**\n * In the end we need to set the new latest entry.\n */\n const latestStorageEntryLatestKey = createEntryLatestKeys(latestStorageEntry);\n entityBatch.put({\n ...latestStorageEntryLatestKey,\n data: latestStorageEntry\n });\n\n /**\n * Also perform an update on the actual revision. This is needed\n * because of updates on the entry-level meta fields.\n */\n const actualRevisionEntryKey = createEntryRevisionKeys(initialLatestStorageEntry);\n entityBatch.put({\n ...actualRevisionEntryKey,\n data: latestStorageEntry\n });\n\n const latestTransformer = createTransformer({\n valuesModifiers: this.valuesModifiers,\n model,\n entry: latestEntry,\n storageEntry: initialLatestStorageEntry,\n fieldIndexRegistry: this.fieldIndexRegistry,\n compressionHandler: this.compressionHandler\n });\n\n const esLatestData = await latestTransformer.getElasticsearchLatestEntryData();\n\n const esLatestKeys = createEntryLatestKeys(latestEntry);\n elasticsearchEntityBatch.put({\n ...esLatestKeys,\n index,\n data: esLatestData\n });\n }\n\n try {\n await entityBatch.execute();\n\n this.dataLoaders.clearAll({\n tenant: entry.tenant\n });\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not batch write entry records to DynamoDB table.\",\n ex.code || \"DELETE_REVISION_ERROR\",\n {\n error: ex,\n entry,\n latestEntry,\n initialLatestStorageEntry\n }\n );\n }\n\n try {\n await elasticsearchEntityBatch.execute();\n } catch (ex) {\n throw new WebinyError(\n ex.message ||\n \"Could not batch write entry records to DynamoDB Elasticsearch table.\",\n ex.code || \"DELETE_REVISION_ERROR\",\n {\n error: ex,\n entry,\n latestEntry,\n initialLatestStorageEntry\n }\n );\n }\n }\n}\n\nexport const DdbEsDeleteEntryRevision = DeleteEntryRevisionStorageOperation.createImplementation({\n implementation: DdbEsDeleteEntryRevisionImpl,\n dependencies: [\n CmsDdbEsEntryEntity,\n CmsDdbEsEntriesEsEntity,\n CmsDdbEsDataLoaders,\n CmsStorageModelProvider,\n CmsEntryOpenSearchFieldIndexRegistry,\n CompressionHandler,\n [CmsEntryOpenSearchValuesModifier, { multiple: true }]\n ]\n});\n"],"names":["DdbEsDeleteEntryRevisionImpl","entity","esEntity","dataLoaders","storageModelProvider","fieldIndexRegistry","compressionHandler","valuesModifiers","initialModel","params","entry","latestEntry","initialLatestStorageEntry","model","partitionKey","createPartitionKey","index","configurations","publishedStorageEntry","entityBatch","createRevisionSortKey","elasticsearchEntityBatch","createPublishedSortKey","latestStorageEntry","convertToStorageEntry","latestStorageEntryLatestKey","createEntryLatestKeys","actualRevisionEntryKey","createEntryRevisionKeys","latestTransformer","createTransformer","esLatestData","esLatestKeys","ex","WebinyError","DdbEsDeleteEntryRevision","DeleteEntryRevisionStorageOperation","CmsDdbEsEntryEntity","CmsDdbEsEntriesEsEntity","CmsDdbEsDataLoaders","CmsStorageModelProvider","CmsEntryOpenSearchFieldIndexRegistry","CompressionHandler","CmsEntryOpenSearchValuesModifier"],"mappings":"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"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { CmsModel, CmsEntryStorageOperationsDeleteEntriesParams } from "@webiny/api-headless-cms/types/index.js";
|
|
2
|
+
import { DeleteMultipleEntriesStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/entry/DeleteMultipleEntriesStorageOperation.js";
|
|
3
|
+
import { CmsDdbEsEntryEntity } from "../../abstractions/CmsDdbEsEntryEntity.js";
|
|
4
|
+
import { CmsDdbEsEntriesEsEntity } from "../../abstractions/CmsDdbEsEntriesEsEntity.js";
|
|
5
|
+
import { CmsDdbEsDataLoaders } from "../../abstractions/CmsDdbEsDataLoaders.js";
|
|
6
|
+
import { CmsStorageModelProvider } from "@webiny/api-headless-cms/features/shared/abstractions.js";
|
|
7
|
+
declare class DdbEsDeleteMultipleEntriesImpl implements DeleteMultipleEntriesStorageOperation.Interface {
|
|
8
|
+
private entity;
|
|
9
|
+
private esEntity;
|
|
10
|
+
private dataLoaders;
|
|
11
|
+
private storageModelProvider;
|
|
12
|
+
constructor(entity: CmsDdbEsEntryEntity.Interface, esEntity: CmsDdbEsEntriesEsEntity.Interface, dataLoaders: CmsDdbEsDataLoaders.Interface, storageModelProvider: CmsStorageModelProvider.Interface);
|
|
13
|
+
execute(initialModel: CmsModel, params: CmsEntryStorageOperationsDeleteEntriesParams): Promise<void>;
|
|
14
|
+
}
|
|
15
|
+
export declare const DdbEsDeleteMultipleEntries: typeof DdbEsDeleteMultipleEntriesImpl & {
|
|
16
|
+
__abstraction: import("@webiny/di").Abstraction<import("@webiny/api-headless-cms/features/shared/storageOperations/entry/DeleteMultipleEntriesStorageOperation.js").IDeleteMultipleEntriesStorageOperation>;
|
|
17
|
+
};
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { DeleteMultipleEntriesStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/entry/DeleteMultipleEntriesStorageOperation.js";
|
|
2
|
+
import { CmsDdbEsEntryEntity } from "../../abstractions/CmsDdbEsEntryEntity.js";
|
|
3
|
+
import { CmsDdbEsEntriesEsEntity } from "../../abstractions/CmsDdbEsEntriesEsEntity.js";
|
|
4
|
+
import { CmsDdbEsDataLoaders } from "../../abstractions/CmsDdbEsDataLoaders.js";
|
|
5
|
+
import { CmsStorageModelProvider } from "@webiny/api-headless-cms/features/shared/abstractions.js";
|
|
6
|
+
import { createPartitionKey, createRevisionSortKey } from "./keys.js";
|
|
7
|
+
class DdbEsDeleteMultipleEntriesImpl {
|
|
8
|
+
constructor(entity, esEntity, dataLoaders, storageModelProvider){
|
|
9
|
+
this.entity = entity;
|
|
10
|
+
this.esEntity = esEntity;
|
|
11
|
+
this.dataLoaders = dataLoaders;
|
|
12
|
+
this.storageModelProvider = storageModelProvider;
|
|
13
|
+
}
|
|
14
|
+
async execute(initialModel, params) {
|
|
15
|
+
const { entries } = params;
|
|
16
|
+
const model = this.storageModelProvider.getModel(initialModel);
|
|
17
|
+
const revisions = await this.dataLoaders.getAllEntryRevisions({
|
|
18
|
+
model,
|
|
19
|
+
ids: entries
|
|
20
|
+
});
|
|
21
|
+
const entityBatch = this.entity.createEntityWriter();
|
|
22
|
+
const elasticsearchEntityBatch = this.esEntity.createEntityWriter();
|
|
23
|
+
for (const id of entries){
|
|
24
|
+
entityBatch.delete({
|
|
25
|
+
PK: createPartitionKey({
|
|
26
|
+
id,
|
|
27
|
+
tenant: model.tenant
|
|
28
|
+
}),
|
|
29
|
+
SK: "L"
|
|
30
|
+
});
|
|
31
|
+
elasticsearchEntityBatch.delete({
|
|
32
|
+
PK: createPartitionKey({
|
|
33
|
+
id,
|
|
34
|
+
tenant: model.tenant
|
|
35
|
+
}),
|
|
36
|
+
SK: "L"
|
|
37
|
+
});
|
|
38
|
+
entityBatch.delete({
|
|
39
|
+
PK: createPartitionKey({
|
|
40
|
+
id,
|
|
41
|
+
tenant: model.tenant
|
|
42
|
+
}),
|
|
43
|
+
SK: "P"
|
|
44
|
+
});
|
|
45
|
+
elasticsearchEntityBatch.delete({
|
|
46
|
+
PK: createPartitionKey({
|
|
47
|
+
id,
|
|
48
|
+
tenant: model.tenant
|
|
49
|
+
}),
|
|
50
|
+
SK: "P"
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
for (const revision of revisions)entityBatch.delete({
|
|
54
|
+
PK: createPartitionKey({
|
|
55
|
+
id: revision.id,
|
|
56
|
+
tenant: model.tenant
|
|
57
|
+
}),
|
|
58
|
+
SK: createRevisionSortKey({
|
|
59
|
+
version: revision.version
|
|
60
|
+
})
|
|
61
|
+
});
|
|
62
|
+
await entityBatch.execute();
|
|
63
|
+
await elasticsearchEntityBatch.execute();
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
const DdbEsDeleteMultipleEntries = DeleteMultipleEntriesStorageOperation.createImplementation({
|
|
67
|
+
implementation: DdbEsDeleteMultipleEntriesImpl,
|
|
68
|
+
dependencies: [
|
|
69
|
+
CmsDdbEsEntryEntity,
|
|
70
|
+
CmsDdbEsEntriesEsEntity,
|
|
71
|
+
CmsDdbEsDataLoaders,
|
|
72
|
+
CmsStorageModelProvider
|
|
73
|
+
]
|
|
74
|
+
});
|
|
75
|
+
export { DdbEsDeleteMultipleEntries };
|
|
76
|
+
|
|
77
|
+
//# sourceMappingURL=DdbEsDeleteMultipleEntries.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operations/entry/DdbEsDeleteMultipleEntries.js","sources":["../../../src/operations/entry/DdbEsDeleteMultipleEntries.ts"],"sourcesContent":["import type {\n CmsModel,\n CmsEntryStorageOperationsDeleteEntriesParams\n} from \"@webiny/api-headless-cms/types/index.js\";\nimport { DeleteMultipleEntriesStorageOperation } from \"@webiny/api-headless-cms/features/shared/storageOperations/entry/DeleteMultipleEntriesStorageOperation.js\";\nimport { CmsDdbEsEntryEntity } from \"~/abstractions/CmsDdbEsEntryEntity.js\";\nimport { CmsDdbEsEntriesEsEntity } from \"~/abstractions/CmsDdbEsEntriesEsEntity.js\";\nimport { CmsDdbEsDataLoaders } from \"~/abstractions/CmsDdbEsDataLoaders.js\";\nimport { CmsStorageModelProvider } from \"@webiny/api-headless-cms/features/shared/abstractions.js\";\nimport { createPartitionKey, createRevisionSortKey } from \"./keys.js\";\n\nclass DdbEsDeleteMultipleEntriesImpl implements DeleteMultipleEntriesStorageOperation.Interface {\n constructor(\n private entity: CmsDdbEsEntryEntity.Interface,\n private esEntity: CmsDdbEsEntriesEsEntity.Interface,\n private dataLoaders: CmsDdbEsDataLoaders.Interface,\n private storageModelProvider: CmsStorageModelProvider.Interface\n ) {}\n\n async execute(initialModel: CmsModel, params: CmsEntryStorageOperationsDeleteEntriesParams) {\n const { entries } = params;\n const model = this.storageModelProvider.getModel(initialModel);\n /**\n * First we need all the revisions of the entries we want to delete.\n */\n const revisions = await this.dataLoaders.getAllEntryRevisions({\n model,\n ids: entries\n });\n /**\n * Then we need to construct the queries for all the revisions and entries.\n */\n\n const entityBatch = this.entity.createEntityWriter();\n const elasticsearchEntityBatch = this.esEntity.createEntityWriter();\n for (const id of entries) {\n /**\n * Latest item.\n */\n entityBatch.delete({\n PK: createPartitionKey({\n id,\n tenant: model.tenant\n }),\n SK: \"L\"\n });\n\n elasticsearchEntityBatch.delete({\n PK: createPartitionKey({\n id,\n tenant: model.tenant\n }),\n SK: \"L\"\n });\n\n /**\n * Published item.\n */\n entityBatch.delete({\n PK: createPartitionKey({\n id,\n tenant: model.tenant\n }),\n SK: \"P\"\n });\n\n elasticsearchEntityBatch.delete({\n PK: createPartitionKey({\n id,\n tenant: model.tenant\n }),\n SK: \"P\"\n });\n }\n /**\n * Exact revisions of all the entries\n */\n for (const revision of revisions) {\n entityBatch.delete({\n PK: createPartitionKey({\n id: revision.id,\n tenant: model.tenant\n }),\n SK: createRevisionSortKey({\n version: revision.version\n })\n });\n }\n\n await entityBatch.execute();\n await elasticsearchEntityBatch.execute();\n }\n}\n\nexport const DdbEsDeleteMultipleEntries =\n DeleteMultipleEntriesStorageOperation.createImplementation({\n implementation: DdbEsDeleteMultipleEntriesImpl,\n dependencies: [\n CmsDdbEsEntryEntity,\n CmsDdbEsEntriesEsEntity,\n CmsDdbEsDataLoaders,\n CmsStorageModelProvider\n ]\n });\n"],"names":["DdbEsDeleteMultipleEntriesImpl","entity","esEntity","dataLoaders","storageModelProvider","initialModel","params","entries","model","revisions","entityBatch","elasticsearchEntityBatch","id","createPartitionKey","revision","createRevisionSortKey","DdbEsDeleteMultipleEntries","DeleteMultipleEntriesStorageOperation","CmsDdbEsEntryEntity","CmsDdbEsEntriesEsEntity","CmsDdbEsDataLoaders","CmsStorageModelProvider"],"mappings":";;;;;;AAWA,MAAMA;IACF,YACYC,MAAqC,EACrCC,QAA2C,EAC3CC,WAA0C,EAC1CC,oBAAuD,CACjE;aAJUH,MAAM,GAANA;aACAC,QAAQ,GAARA;aACAC,WAAW,GAAXA;aACAC,oBAAoB,GAApBA;IACT;IAEH,MAAM,QAAQC,YAAsB,EAAEC,MAAoD,EAAE;QACxF,MAAM,EAAEC,OAAO,EAAE,GAAGD;QACpB,MAAME,QAAQ,IAAI,CAAC,oBAAoB,CAAC,QAAQ,CAACH;QAIjD,MAAMI,YAAY,MAAM,IAAI,CAAC,WAAW,CAAC,oBAAoB,CAAC;YAC1DD;YACA,KAAKD;QACT;QAKA,MAAMG,cAAc,IAAI,CAAC,MAAM,CAAC,kBAAkB;QAClD,MAAMC,2BAA2B,IAAI,CAAC,QAAQ,CAAC,kBAAkB;QACjE,KAAK,MAAMC,MAAML,QAAS;YAItBG,YAAY,MAAM,CAAC;gBACf,IAAIG,mBAAmB;oBACnBD;oBACA,QAAQJ,MAAM,MAAM;gBACxB;gBACA,IAAI;YACR;YAEAG,yBAAyB,MAAM,CAAC;gBAC5B,IAAIE,mBAAmB;oBACnBD;oBACA,QAAQJ,MAAM,MAAM;gBACxB;gBACA,IAAI;YACR;YAKAE,YAAY,MAAM,CAAC;gBACf,IAAIG,mBAAmB;oBACnBD;oBACA,QAAQJ,MAAM,MAAM;gBACxB;gBACA,IAAI;YACR;YAEAG,yBAAyB,MAAM,CAAC;gBAC5B,IAAIE,mBAAmB;oBACnBD;oBACA,QAAQJ,MAAM,MAAM;gBACxB;gBACA,IAAI;YACR;QACJ;QAIA,KAAK,MAAMM,YAAYL,UACnBC,YAAY,MAAM,CAAC;YACf,IAAIG,mBAAmB;gBACnB,IAAIC,SAAS,EAAE;gBACf,QAAQN,MAAM,MAAM;YACxB;YACA,IAAIO,sBAAsB;gBACtB,SAASD,SAAS,OAAO;YAC7B;QACJ;QAGJ,MAAMJ,YAAY,OAAO;QACzB,MAAMC,yBAAyB,OAAO;IAC1C;AACJ;AAEO,MAAMK,6BACTC,sCAAsC,oBAAoB,CAAC;IACvD,gBAAgBjB;IAChB,cAAc;QACVkB;QACAC;QACAC;QACAC;KACH;AACL"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { CmsModel, CmsEntryValues, CmsEntryStorageOperationsGetByIdsParams } from "@webiny/api-headless-cms/types/index.js";
|
|
2
|
+
import { GetEntriesByIdsStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/entry/GetEntriesByIdsStorageOperation.js";
|
|
3
|
+
import { CmsDdbEsDataLoaders } from "../../abstractions/CmsDdbEsDataLoaders.js";
|
|
4
|
+
import { CmsStorageModelProvider } from "@webiny/api-headless-cms/features/shared/abstractions.js";
|
|
5
|
+
declare class DdbEsGetEntriesByIdsImpl implements GetEntriesByIdsStorageOperation.Interface {
|
|
6
|
+
private dataLoaders;
|
|
7
|
+
private storageModelProvider;
|
|
8
|
+
constructor(dataLoaders: CmsDdbEsDataLoaders.Interface, storageModelProvider: CmsStorageModelProvider.Interface);
|
|
9
|
+
execute<T extends CmsEntryValues = CmsEntryValues>(initialModel: CmsModel, params: CmsEntryStorageOperationsGetByIdsParams): Promise<import("@webiny/api-headless-cms/types/types.js").CmsStorageEntry<T>[]>;
|
|
10
|
+
}
|
|
11
|
+
export declare const DdbEsGetEntriesByIds: typeof DdbEsGetEntriesByIdsImpl & {
|
|
12
|
+
__abstraction: import("@webiny/di").Abstraction<import("@webiny/api-headless-cms/features/shared/storageOperations/entry/GetEntriesByIdsStorageOperation.js").IGetEntriesByIdsStorageOperation>;
|
|
13
|
+
};
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { GetEntriesByIdsStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/entry/GetEntriesByIdsStorageOperation.js";
|
|
2
|
+
import { CmsDdbEsDataLoaders } from "../../abstractions/CmsDdbEsDataLoaders.js";
|
|
3
|
+
import { CmsStorageModelProvider } from "@webiny/api-headless-cms/features/shared/abstractions.js";
|
|
4
|
+
import { convertEntryKeysFromStorage } from "./transformations/convertEntryKeys.js";
|
|
5
|
+
class DdbEsGetEntriesByIdsImpl {
|
|
6
|
+
constructor(dataLoaders, storageModelProvider){
|
|
7
|
+
this.dataLoaders = dataLoaders;
|
|
8
|
+
this.storageModelProvider = storageModelProvider;
|
|
9
|
+
}
|
|
10
|
+
async execute(initialModel, params) {
|
|
11
|
+
const model = this.storageModelProvider.getModel(initialModel);
|
|
12
|
+
const entries = await this.dataLoaders.getRevisionById({
|
|
13
|
+
model,
|
|
14
|
+
ids: params.ids
|
|
15
|
+
});
|
|
16
|
+
return entries.map((entry)=>convertEntryKeysFromStorage({
|
|
17
|
+
model,
|
|
18
|
+
entry
|
|
19
|
+
}));
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
const DdbEsGetEntriesByIds = GetEntriesByIdsStorageOperation.createImplementation({
|
|
23
|
+
implementation: DdbEsGetEntriesByIdsImpl,
|
|
24
|
+
dependencies: [
|
|
25
|
+
CmsDdbEsDataLoaders,
|
|
26
|
+
CmsStorageModelProvider
|
|
27
|
+
]
|
|
28
|
+
});
|
|
29
|
+
export { DdbEsGetEntriesByIds };
|
|
30
|
+
|
|
31
|
+
//# sourceMappingURL=DdbEsGetEntriesByIds.js.map
|