@webiny/api-headless-cms-ddb-es 0.0.0-unstable.496cf268ac → 0.0.0-unstable.5387e5f7c8
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/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/definitions/entry.d.ts +4 -5
- package/definitions/entry.js +10 -87
- package/definitions/entry.js.map +1 -1
- package/definitions/group.d.ts +6 -6
- package/definitions/group.js +10 -64
- package/definitions/group.js.map +1 -1
- package/definitions/model.d.ts +6 -6
- package/definitions/model.js +10 -108
- package/definitions/model.js.map +1 -1
- package/definitions/types.d.ts +65 -0
- package/definitions/types.js +0 -0
- package/feature.d.ts +10 -0
- package/feature.js +69 -0
- package/feature.js.map +1 -0
- package/index.d.ts +1 -3
- package/index.js +1 -214
- package/operations/entry/DdbEsCreateEntry.d.ts +24 -0
- package/operations/entry/DdbEsCreateEntry.js +134 -0
- package/operations/entry/DdbEsCreateEntry.js.map +1 -0
- package/operations/entry/DdbEsCreateEntryRevisionFrom.d.ts +24 -0
- package/operations/entry/DdbEsCreateEntryRevisionFrom.js +139 -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 +24 -0
- package/operations/entry/DdbEsDeleteEntryRevision.js +136 -0
- package/operations/entry/DdbEsDeleteEntryRevision.js.map +1 -0
- package/operations/entry/DdbEsDeleteMultipleEntries.d.ts +18 -0
- package/operations/entry/DdbEsDeleteMultipleEntries.js +80 -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 +18 -0
- package/operations/entry/DdbEsGetUniqueFieldValues.js +76 -0
- package/operations/entry/DdbEsGetUniqueFieldValues.js.map +1 -0
- package/operations/entry/DdbEsListEntries.d.ts +25 -0
- package/operations/entry/DdbEsListEntries.js +91 -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 +24 -0
- package/operations/entry/DdbEsPublishEntry.js +231 -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 +24 -0
- package/operations/entry/DdbEsUnpublishEntry.js +127 -0
- package/operations/entry/DdbEsUnpublishEntry.js.map +1 -0
- package/operations/entry/DdbEsUpdateEntry.d.ts +24 -0
- package/operations/entry/DdbEsUpdateEntry.js +175 -0
- package/operations/entry/DdbEsUpdateEntry.js.map +1 -0
- 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 +18 -39
- package/operations/entry/dataLoaders.js +91 -306
- package/operations/entry/dataLoaders.js.map +1 -1
- package/operations/entry/feature.d.ts +4 -0
- package/operations/entry/feature.js +55 -0
- package/operations/entry/feature.js.map +1 -0
- package/operations/entry/keys.d.ts +31 -1
- package/operations/entry/keys.js +46 -27
- package/operations/entry/keys.js.map +1 -1
- package/operations/entry/recordType.js +5 -17
- package/operations/entry/recordType.js.map +1 -1
- 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/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 +32 -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/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/operations/group/feature.d.ts +4 -0
- 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 +16 -0
- package/operations/model/DdbEsCreateModel.js +56 -0
- package/operations/model/DdbEsCreateModel.js.map +1 -0
- package/operations/model/DdbEsDeleteModel.d.ts +12 -0
- package/operations/model/DdbEsDeleteModel.js +31 -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/operations/model/feature.d.ts +4 -0
- 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 +48 -41
- package/registry/CmsEntitiesDbRegistryDecorator.d.ts +27 -0
- package/registry/CmsEntitiesDbRegistryDecorator.js +46 -0
- package/registry/CmsEntitiesDbRegistryDecorator.js.map +1 -0
- package/tasks/CreateElasticsearchIndexTask.d.ts +13 -0
- package/tasks/CreateElasticsearchIndexTask.js +40 -0
- package/tasks/CreateElasticsearchIndexTask.js.map +1 -0
- package/types.d.ts +13 -155
- package/types.js +9 -41
- package/types.js.map +1 -1
- package/configurations.d.ts +0 -12
- package/configurations.js +0 -35
- package/configurations.js.map +0 -1
- package/definitions/entryElasticsearch.d.ts +0 -8
- package/definitions/entryElasticsearch.js +0 -37
- package/definitions/entryElasticsearch.js.map +0 -1
- package/definitions/settings.d.ts +0 -8
- package/definitions/settings.js +0 -53
- package/definitions/settings.js.map +0 -1
- package/definitions/system.d.ts +0 -8
- package/definitions/system.js +0 -41
- package/definitions/system.js.map +0 -1
- package/definitions/table.d.ts +0 -8
- package/definitions/table.js +0 -21
- package/definitions/table.js.map +0 -1
- package/definitions/tableElasticsearch.d.ts +0 -8
- package/definitions/tableElasticsearch.js +0 -21
- package/definitions/tableElasticsearch.js.map +0 -1
- package/dynamoDb/index.d.ts +0 -2
- package/dynamoDb/index.js +0 -11
- package/dynamoDb/index.js.map +0 -1
- package/dynamoDb/storage/date.d.ts +0 -3
- package/dynamoDb/storage/date.js +0 -86
- package/dynamoDb/storage/date.js.map +0 -1
- package/dynamoDb/storage/longText.d.ts +0 -10
- package/dynamoDb/storage/longText.js +0 -93
- package/dynamoDb/storage/longText.js.map +0 -1
- package/dynamoDb/storage/richText.d.ts +0 -7
- package/dynamoDb/storage/richText.js +0 -110
- package/dynamoDb/storage/richText.js.map +0 -1
- package/elasticsearch/createElasticsearchIndex.d.ts +0 -9
- package/elasticsearch/createElasticsearchIndex.js +0 -49
- package/elasticsearch/createElasticsearchIndex.js.map +0 -1
- package/elasticsearch/deleteElasticsearchIndex.d.ts +0 -8
- package/elasticsearch/deleteElasticsearchIndex.js +0 -36
- package/elasticsearch/deleteElasticsearchIndex.js.map +0 -1
- package/elasticsearch/index.d.ts +0 -2
- package/elasticsearch/index.js +0 -11
- package/elasticsearch/index.js.map +0 -1
- package/elasticsearch/indexing/dateTimeIndexing.d.ts +0 -3
- package/elasticsearch/indexing/dateTimeIndexing.js +0 -86
- package/elasticsearch/indexing/dateTimeIndexing.js.map +0 -1
- package/elasticsearch/indexing/defaultFieldIndexing.d.ts +0 -3
- package/elasticsearch/indexing/defaultFieldIndexing.js +0 -52
- package/elasticsearch/indexing/defaultFieldIndexing.js.map +0 -1
- package/elasticsearch/indexing/index.d.ts +0 -2
- package/elasticsearch/indexing/index.js +0 -15
- package/elasticsearch/indexing/index.js.map +0 -1
- package/elasticsearch/indexing/longTextIndexing.d.ts +0 -7
- package/elasticsearch/indexing/longTextIndexing.js +0 -46
- package/elasticsearch/indexing/longTextIndexing.js.map +0 -1
- package/elasticsearch/indexing/numberIndexing.d.ts +0 -3
- package/elasticsearch/indexing/numberIndexing.js +0 -39
- package/elasticsearch/indexing/numberIndexing.js.map +0 -1
- package/elasticsearch/indexing/objectIndexing.d.ts +0 -12
- package/elasticsearch/indexing/objectIndexing.js +0 -196
- package/elasticsearch/indexing/objectIndexing.js.map +0 -1
- package/elasticsearch/indexing/richTextIndexing.d.ts +0 -3
- package/elasticsearch/indexing/richTextIndexing.js +0 -29
- package/elasticsearch/indexing/richTextIndexing.js.map +0 -1
- package/elasticsearch/indices/base.d.ts +0 -2
- package/elasticsearch/indices/base.js +0 -12
- package/elasticsearch/indices/base.js.map +0 -1
- package/elasticsearch/indices/index.d.ts +0 -1
- package/elasticsearch/indices/index.js +0 -12
- package/elasticsearch/indices/index.js.map +0 -1
- package/elasticsearch/indices/japanese.d.ts +0 -2
- package/elasticsearch/indices/japanese.js +0 -13
- package/elasticsearch/indices/japanese.js.map +0 -1
- package/elasticsearch/search/index.d.ts +0 -3
- package/elasticsearch/search/index.js +0 -10
- package/elasticsearch/search/index.js.map +0 -1
- package/elasticsearch/search/refSearch.d.ts +0 -2
- package/elasticsearch/search/refSearch.js +0 -29
- package/elasticsearch/search/refSearch.js.map +0 -1
- package/elasticsearch/search/timeSearch.d.ts +0 -2
- package/elasticsearch/search/timeSearch.js +0 -26
- package/elasticsearch/search/timeSearch.js.map +0 -1
- package/helpers/entryIndexHelpers.d.ts +0 -18
- package/helpers/entryIndexHelpers.js +0 -175
- package/helpers/entryIndexHelpers.js.map +0 -1
- package/helpers/index.d.ts +0 -1
- package/helpers/index.js +0 -16
- package/helpers/index.js.map +0 -1
- package/index.js.map +0 -1
- package/operations/entry/elasticsearch/assignMinimumShouldMatchToQuery.d.ts +0 -18
- package/operations/entry/elasticsearch/assignMinimumShouldMatchToQuery.js +0 -32
- package/operations/entry/elasticsearch/assignMinimumShouldMatchToQuery.js.map +0 -1
- package/operations/entry/elasticsearch/body.d.ts +0 -13
- package/operations/entry/elasticsearch/body.js +0 -140
- package/operations/entry/elasticsearch/body.js.map +0 -1
- package/operations/entry/elasticsearch/fields.d.ts +0 -9
- package/operations/entry/elasticsearch/fields.js +0 -229
- package/operations/entry/elasticsearch/fields.js.map +0 -1
- package/operations/entry/elasticsearch/filtering/applyFiltering.d.ts +0 -8
- package/operations/entry/elasticsearch/filtering/applyFiltering.js +0 -57
- package/operations/entry/elasticsearch/filtering/applyFiltering.js.map +0 -1
- package/operations/entry/elasticsearch/filtering/exec.d.ts +0 -17
- package/operations/entry/elasticsearch/filtering/exec.js +0 -172
- 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 -16
- package/operations/entry/elasticsearch/filtering/index.js.map +0 -1
- package/operations/entry/elasticsearch/filtering/path.d.ts +0 -15
- package/operations/entry/elasticsearch/filtering/path.js +0 -44
- package/operations/entry/elasticsearch/filtering/path.js.map +0 -1
- package/operations/entry/elasticsearch/filtering/plugins/defaultFilterPlugin.d.ts +0 -2
- package/operations/entry/elasticsearch/filtering/plugins/defaultFilterPlugin.js +0 -28
- package/operations/entry/elasticsearch/filtering/plugins/defaultFilterPlugin.js.map +0 -1
- package/operations/entry/elasticsearch/filtering/plugins/index.d.ts +0 -1
- package/operations/entry/elasticsearch/filtering/plugins/index.js +0 -13
- package/operations/entry/elasticsearch/filtering/plugins/index.js.map +0 -1
- package/operations/entry/elasticsearch/filtering/plugins/objectFilterPlugin.d.ts +0 -2
- package/operations/entry/elasticsearch/filtering/plugins/objectFilterPlugin.js +0 -65
- package/operations/entry/elasticsearch/filtering/plugins/objectFilterPlugin.js.map +0 -1
- package/operations/entry/elasticsearch/filtering/plugins/refFilterPlugin.d.ts +0 -2
- package/operations/entry/elasticsearch/filtering/plugins/refFilterPlugin.js +0 -48
- package/operations/entry/elasticsearch/filtering/plugins/refFilterPlugin.js.map +0 -1
- package/operations/entry/elasticsearch/filtering/populated.d.ts +0 -2
- package/operations/entry/elasticsearch/filtering/populated.js +0 -23
- 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 -22
- package/operations/entry/elasticsearch/filtering/values.js.map +0 -1
- package/operations/entry/elasticsearch/fullTextSearch.d.ts +0 -12
- package/operations/entry/elasticsearch/fullTextSearch.js +0 -89
- 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 -25
- package/operations/entry/elasticsearch/fullTextSearchFields.js.map +0 -1
- package/operations/entry/elasticsearch/initialQuery.d.ts +0 -17
- package/operations/entry/elasticsearch/initialQuery.js +0 -103
- 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 -34
- package/operations/entry/elasticsearch/keyword.js.map +0 -1
- package/operations/entry/elasticsearch/plugins/bodyModifier.d.ts +0 -9
- package/operations/entry/elasticsearch/plugins/bodyModifier.js +0 -16
- package/operations/entry/elasticsearch/plugins/bodyModifier.js.map +0 -1
- package/operations/entry/elasticsearch/plugins/operator.d.ts +0 -8
- package/operations/entry/elasticsearch/plugins/operator.js +0 -37
- package/operations/entry/elasticsearch/plugins/operator.js.map +0 -1
- package/operations/entry/elasticsearch/plugins/queryModifier.d.ts +0 -9
- package/operations/entry/elasticsearch/plugins/queryModifier.js +0 -16
- package/operations/entry/elasticsearch/plugins/queryModifier.js.map +0 -1
- package/operations/entry/elasticsearch/plugins/search.d.ts +0 -7
- package/operations/entry/elasticsearch/plugins/search.js +0 -24
- package/operations/entry/elasticsearch/plugins/search.js.map +0 -1
- package/operations/entry/elasticsearch/plugins/sortModifier.d.ts +0 -9
- package/operations/entry/elasticsearch/plugins/sortModifier.js +0 -16
- package/operations/entry/elasticsearch/plugins/sortModifier.js.map +0 -1
- package/operations/entry/elasticsearch/sort.d.ts +0 -12
- package/operations/entry/elasticsearch/sort.js +0 -82
- package/operations/entry/elasticsearch/sort.js.map +0 -1
- package/operations/entry/elasticsearch/transformValueForSearch.d.ts +0 -16
- package/operations/entry/elasticsearch/transformValueForSearch.js +0 -30
- package/operations/entry/elasticsearch/transformValueForSearch.js.map +0 -1
- package/operations/entry/elasticsearch/types.d.ts +0 -41
- package/operations/entry/elasticsearch/types.js +0 -5
- package/operations/entry/elasticsearch/types.js.map +0 -1
- package/operations/entry/index.d.ts +0 -11
- package/operations/entry/index.js +0 -1128
- package/operations/entry/index.js.map +0 -1
- package/operations/group/index.d.ts +0 -8
- package/operations/group/index.js +0 -165
- package/operations/group/index.js.map +0 -1
- package/operations/model/index.d.ts +0 -8
- package/operations/model/index.js +0 -171
- package/operations/model/index.js.map +0 -1
- package/operations/settings/index.d.ts +0 -6
- package/operations/settings/index.js +0 -111
- package/operations/settings/index.js.map +0 -1
- package/operations/system/index.d.ts +0 -6
- package/operations/system/index.js +0 -82
- package/operations/system/index.js.map +0 -1
- package/plugins/CmsEntryElasticsearchBodyModifierPlugin.d.ts +0 -21
- package/plugins/CmsEntryElasticsearchBodyModifierPlugin.js +0 -22
- package/plugins/CmsEntryElasticsearchBodyModifierPlugin.js.map +0 -1
- package/plugins/CmsEntryElasticsearchFieldPlugin.d.ts +0 -12
- package/plugins/CmsEntryElasticsearchFieldPlugin.js +0 -18
- package/plugins/CmsEntryElasticsearchFieldPlugin.js.map +0 -1
- package/plugins/CmsEntryElasticsearchFullTextSearchPlugin.d.ts +0 -23
- package/plugins/CmsEntryElasticsearchFullTextSearchPlugin.js +0 -28
- package/plugins/CmsEntryElasticsearchFullTextSearchPlugin.js.map +0 -1
- package/plugins/CmsEntryElasticsearchIndexPlugin.d.ts +0 -4
- package/plugins/CmsEntryElasticsearchIndexPlugin.js +0 -12
- package/plugins/CmsEntryElasticsearchIndexPlugin.js.map +0 -1
- package/plugins/CmsEntryElasticsearchQueryBuilderValueSearchPlugin.d.ts +0 -31
- package/plugins/CmsEntryElasticsearchQueryBuilderValueSearchPlugin.js +0 -37
- package/plugins/CmsEntryElasticsearchQueryBuilderValueSearchPlugin.js.map +0 -1
- package/plugins/CmsEntryElasticsearchQueryModifierPlugin.d.ts +0 -18
- package/plugins/CmsEntryElasticsearchQueryModifierPlugin.js +0 -22
- package/plugins/CmsEntryElasticsearchQueryModifierPlugin.js.map +0 -1
- package/plugins/CmsEntryElasticsearchSortModifierPlugin.d.ts +0 -18
- package/plugins/CmsEntryElasticsearchSortModifierPlugin.js +0 -22
- package/plugins/CmsEntryElasticsearchSortModifierPlugin.js.map +0 -1
- package/plugins/CmsEntryFilterPlugin.d.ts +0 -49
- package/plugins/CmsEntryFilterPlugin.js +0 -24
- package/plugins/CmsEntryFilterPlugin.js.map +0 -1
- package/plugins/index.d.ts +0 -7
- package/plugins/index.js +0 -82
- package/plugins/index.js.map +0 -1
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { GetLatestRevisionByEntryIdStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/entry/GetLatestRevisionByEntryIdStorageOperation.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 DdbEsGetLatestRevisionByEntryIdImpl {
|
|
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 [entry] = await this.dataLoaders.getLatestRevisionByEntryId({
|
|
13
|
+
model,
|
|
14
|
+
ids: [
|
|
15
|
+
params.id
|
|
16
|
+
]
|
|
17
|
+
});
|
|
18
|
+
if (!entry) return null;
|
|
19
|
+
return convertEntryKeysFromStorage({
|
|
20
|
+
model,
|
|
21
|
+
entry
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
const DdbEsGetLatestRevisionByEntryId = GetLatestRevisionByEntryIdStorageOperation.createImplementation({
|
|
26
|
+
implementation: DdbEsGetLatestRevisionByEntryIdImpl,
|
|
27
|
+
dependencies: [
|
|
28
|
+
CmsDdbEsDataLoaders,
|
|
29
|
+
CmsStorageModelProvider
|
|
30
|
+
]
|
|
31
|
+
});
|
|
32
|
+
export { DdbEsGetLatestRevisionByEntryId };
|
|
33
|
+
|
|
34
|
+
//# sourceMappingURL=DdbEsGetLatestRevisionByEntryId.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operations/entry/DdbEsGetLatestRevisionByEntryId.js","sources":["../../../src/operations/entry/DdbEsGetLatestRevisionByEntryId.ts"],"sourcesContent":["import type {\n CmsModel,\n CmsEntryValues,\n CmsEntryStorageOperationsGetLatestRevisionParams\n} from \"@webiny/api-headless-cms/types/index.js\";\nimport { GetLatestRevisionByEntryIdStorageOperation } from \"@webiny/api-headless-cms/features/shared/storageOperations/entry/GetLatestRevisionByEntryIdStorageOperation.js\";\nimport { CmsDdbEsDataLoaders } from \"~/abstractions/CmsDdbEsDataLoaders.js\";\nimport { CmsStorageModelProvider } from \"@webiny/api-headless-cms/features/shared/abstractions.js\";\nimport { convertEntryKeysFromStorage } from \"./transformations/convertEntryKeys.js\";\n\nclass DdbEsGetLatestRevisionByEntryIdImpl\n implements GetLatestRevisionByEntryIdStorageOperation.Interface\n{\n constructor(\n private dataLoaders: CmsDdbEsDataLoaders.Interface,\n private storageModelProvider: CmsStorageModelProvider.Interface\n ) {}\n\n async execute<T extends CmsEntryValues = CmsEntryValues>(\n initialModel: CmsModel,\n params: CmsEntryStorageOperationsGetLatestRevisionParams\n ) {\n const model = this.storageModelProvider.getModel<T>(initialModel);\n\n const [entry] = await this.dataLoaders.getLatestRevisionByEntryId<T>({\n model,\n ids: [params.id]\n });\n if (!entry) {\n return null;\n }\n return convertEntryKeysFromStorage<T>({\n model,\n entry\n });\n }\n}\n\nexport const DdbEsGetLatestRevisionByEntryId =\n GetLatestRevisionByEntryIdStorageOperation.createImplementation({\n implementation: DdbEsGetLatestRevisionByEntryIdImpl,\n dependencies: [CmsDdbEsDataLoaders, CmsStorageModelProvider]\n });\n"],"names":["DdbEsGetLatestRevisionByEntryIdImpl","dataLoaders","storageModelProvider","initialModel","params","model","entry","convertEntryKeysFromStorage","DdbEsGetLatestRevisionByEntryId","GetLatestRevisionByEntryIdStorageOperation","CmsDdbEsDataLoaders","CmsStorageModelProvider"],"mappings":";;;;AAUA,MAAMA;IAGF,YACYC,WAA0C,EAC1CC,oBAAuD,CACjE;aAFUD,WAAW,GAAXA;aACAC,oBAAoB,GAApBA;IACT;IAEH,MAAM,QACFC,YAAsB,EACtBC,MAAwD,EAC1D;QACE,MAAMC,QAAQ,IAAI,CAAC,oBAAoB,CAAC,QAAQ,CAAIF;QAEpD,MAAM,CAACG,MAAM,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,0BAA0B,CAAI;YACjED;YACA,KAAK;gBAACD,OAAO,EAAE;aAAC;QACpB;QACA,IAAI,CAACE,OACD,OAAO;QAEX,OAAOC,4BAA+B;YAClCF;YACAC;QACJ;IACJ;AACJ;AAEO,MAAME,kCACTC,2CAA2C,oBAAoB,CAAC;IAC5D,gBAAgBT;IAChB,cAAc;QAACU;QAAqBC;KAAwB;AAChE"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { CmsModel, CmsEntryValues, CmsEntryStorageOperationsGetPreviousRevisionParams } from "@webiny/api-headless-cms/types/index.js";
|
|
2
|
+
import { GetPreviousRevisionStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/entry/GetPreviousRevisionStorageOperation.js";
|
|
3
|
+
import { CmsDdbEsEntryEntity } from "../../abstractions/CmsDdbEsEntryEntity.js";
|
|
4
|
+
import { CmsStorageModelProvider } from "@webiny/api-headless-cms/features/shared/abstractions.js";
|
|
5
|
+
declare class DdbEsGetPreviousRevisionImpl implements GetPreviousRevisionStorageOperation.Interface {
|
|
6
|
+
private entity;
|
|
7
|
+
private storageModelProvider;
|
|
8
|
+
constructor(entity: CmsDdbEsEntryEntity.Interface, storageModelProvider: CmsStorageModelProvider.Interface);
|
|
9
|
+
execute<T extends CmsEntryValues = CmsEntryValues>(initialModel: CmsModel, params: CmsEntryStorageOperationsGetPreviousRevisionParams): Promise<import("@webiny/api-headless-cms/types/types.js").CmsStorageEntry<T> | null>;
|
|
10
|
+
}
|
|
11
|
+
export declare const DdbEsGetPreviousRevision: typeof DdbEsGetPreviousRevisionImpl & {
|
|
12
|
+
__abstraction: import("@webiny/di").Abstraction<import("@webiny/api-headless-cms/features/shared/storageOperations/entry/GetPreviousRevisionStorageOperation.js").IGetPreviousRevisionStorageOperation>;
|
|
13
|
+
};
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import error from "@webiny/error";
|
|
2
|
+
import { GetPreviousRevisionStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/entry/GetPreviousRevisionStorageOperation.js";
|
|
3
|
+
import { CmsDdbEsEntryEntity } from "../../abstractions/CmsDdbEsEntryEntity.js";
|
|
4
|
+
import { CmsStorageModelProvider } from "@webiny/api-headless-cms/features/shared/abstractions.js";
|
|
5
|
+
import { createPartitionKey } from "./keys.js";
|
|
6
|
+
import { convertEntryKeysFromStorage } from "./transformations/convertEntryKeys.js";
|
|
7
|
+
class DdbEsGetPreviousRevisionImpl {
|
|
8
|
+
constructor(entity, storageModelProvider){
|
|
9
|
+
this.entity = entity;
|
|
10
|
+
this.storageModelProvider = storageModelProvider;
|
|
11
|
+
}
|
|
12
|
+
async execute(initialModel, params) {
|
|
13
|
+
const model = this.storageModelProvider.getModel(initialModel);
|
|
14
|
+
const { tenant } = model;
|
|
15
|
+
const { entryId, version } = params;
|
|
16
|
+
const partitionKey = createPartitionKey({
|
|
17
|
+
tenant,
|
|
18
|
+
id: entryId
|
|
19
|
+
});
|
|
20
|
+
const options = {
|
|
21
|
+
beginsWith: "REV#",
|
|
22
|
+
reverse: true
|
|
23
|
+
};
|
|
24
|
+
try {
|
|
25
|
+
const unfilteredEntries = (await this.entity.queryAll({
|
|
26
|
+
partitionKey,
|
|
27
|
+
options
|
|
28
|
+
})).map((item)=>item.data);
|
|
29
|
+
const entries = unfilteredEntries.filter((item)=>item.modelId === model.modelId && item.version < version);
|
|
30
|
+
const entry = entries[0];
|
|
31
|
+
if (!entry) return null;
|
|
32
|
+
return convertEntryKeysFromStorage({
|
|
33
|
+
entry,
|
|
34
|
+
model
|
|
35
|
+
});
|
|
36
|
+
} catch (ex) {
|
|
37
|
+
throw new error(ex.message || "Could not get previous version of given entry.", ex.code || "GET_PREVIOUS_VERSION_ERROR", {
|
|
38
|
+
...params,
|
|
39
|
+
error: ex,
|
|
40
|
+
partitionKey,
|
|
41
|
+
options,
|
|
42
|
+
model
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
const DdbEsGetPreviousRevision = GetPreviousRevisionStorageOperation.createImplementation({
|
|
48
|
+
implementation: DdbEsGetPreviousRevisionImpl,
|
|
49
|
+
dependencies: [
|
|
50
|
+
CmsDdbEsEntryEntity,
|
|
51
|
+
CmsStorageModelProvider
|
|
52
|
+
]
|
|
53
|
+
});
|
|
54
|
+
export { DdbEsGetPreviousRevision };
|
|
55
|
+
|
|
56
|
+
//# sourceMappingURL=DdbEsGetPreviousRevision.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operations/entry/DdbEsGetPreviousRevision.js","sources":["../../../src/operations/entry/DdbEsGetPreviousRevision.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport type {\n CmsModel,\n CmsEntryValues,\n CmsEntryStorageOperationsGetPreviousRevisionParams\n} from \"@webiny/api-headless-cms/types/index.js\";\nimport { GetPreviousRevisionStorageOperation } from \"@webiny/api-headless-cms/features/shared/storageOperations/entry/GetPreviousRevisionStorageOperation.js\";\nimport { CmsDdbEsEntryEntity } from \"~/abstractions/CmsDdbEsEntryEntity.js\";\nimport { CmsStorageModelProvider } from \"@webiny/api-headless-cms/features/shared/abstractions.js\";\nimport { createPartitionKey } from \"./keys.js\";\nimport { convertEntryKeysFromStorage } from \"./transformations/convertEntryKeys.js\";\nimport type { IEntityQueryAllParams } from \"@webiny/db-dynamodb\";\n\nclass DdbEsGetPreviousRevisionImpl implements GetPreviousRevisionStorageOperation.Interface {\n constructor(\n private entity: CmsDdbEsEntryEntity.Interface,\n private storageModelProvider: CmsStorageModelProvider.Interface\n ) {}\n\n async execute<T extends CmsEntryValues = CmsEntryValues>(\n initialModel: CmsModel,\n params: CmsEntryStorageOperationsGetPreviousRevisionParams\n ) {\n const model = this.storageModelProvider.getModel<T>(initialModel);\n\n const { tenant } = model;\n const { entryId, version } = params;\n\n const partitionKey = createPartitionKey({\n tenant,\n id: entryId\n });\n const options: IEntityQueryAllParams[\"options\"] = {\n beginsWith: `REV#`,\n reverse: true\n };\n\n try {\n const unfilteredEntries = (\n await this.entity.queryAll({\n partitionKey,\n options\n })\n ).map(item => {\n return item.data;\n });\n\n /**\n * The partition key does not include the model, so filter by it as well.\n */\n const entries = unfilteredEntries.filter(item => {\n return item.modelId === model.modelId && item.version < version;\n });\n\n const entry = entries[0];\n\n if (!entry) {\n return null;\n }\n return convertEntryKeysFromStorage<T>({\n entry,\n model\n });\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not get previous version of given entry.\",\n ex.code || \"GET_PREVIOUS_VERSION_ERROR\",\n {\n ...params,\n error: ex,\n partitionKey,\n options,\n model\n }\n );\n }\n }\n}\n\nexport const DdbEsGetPreviousRevision = GetPreviousRevisionStorageOperation.createImplementation({\n implementation: DdbEsGetPreviousRevisionImpl,\n dependencies: [CmsDdbEsEntryEntity, CmsStorageModelProvider]\n});\n"],"names":["DdbEsGetPreviousRevisionImpl","entity","storageModelProvider","initialModel","params","model","tenant","entryId","version","partitionKey","createPartitionKey","options","unfilteredEntries","item","entries","entry","convertEntryKeysFromStorage","ex","WebinyError","DdbEsGetPreviousRevision","GetPreviousRevisionStorageOperation","CmsDdbEsEntryEntity","CmsStorageModelProvider"],"mappings":";;;;;;AAaA,MAAMA;IACF,YACYC,MAAqC,EACrCC,oBAAuD,CACjE;aAFUD,MAAM,GAANA;aACAC,oBAAoB,GAApBA;IACT;IAEH,MAAM,QACFC,YAAsB,EACtBC,MAA0D,EAC5D;QACE,MAAMC,QAAQ,IAAI,CAAC,oBAAoB,CAAC,QAAQ,CAAIF;QAEpD,MAAM,EAAEG,MAAM,EAAE,GAAGD;QACnB,MAAM,EAAEE,OAAO,EAAEC,OAAO,EAAE,GAAGJ;QAE7B,MAAMK,eAAeC,mBAAmB;YACpCJ;YACA,IAAIC;QACR;QACA,MAAMI,UAA4C;YAC9C,YAAY;YACZ,SAAS;QACb;QAEA,IAAI;YACA,MAAMC,oBACF,OAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC;gBACvBH;gBACAE;YACJ,EAAC,EACH,GAAG,CAACE,CAAAA,OACKA,KAAK,IAAI;YAMpB,MAAMC,UAAUF,kBAAkB,MAAM,CAACC,CAAAA,OAC9BA,KAAK,OAAO,KAAKR,MAAM,OAAO,IAAIQ,KAAK,OAAO,GAAGL;YAG5D,MAAMO,QAAQD,OAAO,CAAC,EAAE;YAExB,IAAI,CAACC,OACD,OAAO;YAEX,OAAOC,4BAA+B;gBAClCD;gBACAV;YACJ;QACJ,EAAE,OAAOY,IAAI;YACT,MAAM,IAAIC,MACND,GAAG,OAAO,IAAI,kDACdA,GAAG,IAAI,IAAI,8BACX;gBACI,GAAGb,MAAM;gBACT,OAAOa;gBACPR;gBACAE;gBACAN;YACJ;QAER;IACJ;AACJ;AAEO,MAAMc,2BAA2BC,oCAAoC,oBAAoB,CAAC;IAC7F,gBAAgBpB;IAChB,cAAc;QAACqB;QAAqBC;KAAwB;AAChE"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { CmsModel, CmsEntryValues, CmsEntryStorageOperationsGetPublishedByIdsParams } from "@webiny/api-headless-cms/types/index.js";
|
|
2
|
+
import { GetPublishedEntriesByIdsStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/entry/GetPublishedEntriesByIdsStorageOperation.js";
|
|
3
|
+
import { CmsDdbEsDataLoaders } from "../../abstractions/CmsDdbEsDataLoaders.js";
|
|
4
|
+
import { CmsStorageModelProvider } from "@webiny/api-headless-cms/features/shared/abstractions.js";
|
|
5
|
+
declare class DdbEsGetPublishedEntriesByIdsImpl implements GetPublishedEntriesByIdsStorageOperation.Interface {
|
|
6
|
+
private dataLoaders;
|
|
7
|
+
private storageModelProvider;
|
|
8
|
+
constructor(dataLoaders: CmsDdbEsDataLoaders.Interface, storageModelProvider: CmsStorageModelProvider.Interface);
|
|
9
|
+
execute<T extends CmsEntryValues = CmsEntryValues>(initialModel: CmsModel, params: CmsEntryStorageOperationsGetPublishedByIdsParams): Promise<import("@webiny/api-headless-cms/types/types.js").CmsStorageEntry<T>[]>;
|
|
10
|
+
}
|
|
11
|
+
export declare const DdbEsGetPublishedEntriesByIds: typeof DdbEsGetPublishedEntriesByIdsImpl & {
|
|
12
|
+
__abstraction: import("@webiny/di").Abstraction<import("@webiny/api-headless-cms/features/shared/storageOperations/entry/GetPublishedEntriesByIdsStorageOperation.js").IGetPublishedEntriesByIdsStorageOperation>;
|
|
13
|
+
};
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { GetPublishedEntriesByIdsStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/entry/GetPublishedEntriesByIdsStorageOperation.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 DdbEsGetPublishedEntriesByIdsImpl {
|
|
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.getPublishedRevisionByEntryId({
|
|
13
|
+
model,
|
|
14
|
+
ids: params.ids
|
|
15
|
+
});
|
|
16
|
+
return entries.map((entry)=>convertEntryKeysFromStorage({
|
|
17
|
+
model,
|
|
18
|
+
entry
|
|
19
|
+
}));
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
const DdbEsGetPublishedEntriesByIds = GetPublishedEntriesByIdsStorageOperation.createImplementation({
|
|
23
|
+
implementation: DdbEsGetPublishedEntriesByIdsImpl,
|
|
24
|
+
dependencies: [
|
|
25
|
+
CmsDdbEsDataLoaders,
|
|
26
|
+
CmsStorageModelProvider
|
|
27
|
+
]
|
|
28
|
+
});
|
|
29
|
+
export { DdbEsGetPublishedEntriesByIds };
|
|
30
|
+
|
|
31
|
+
//# sourceMappingURL=DdbEsGetPublishedEntriesByIds.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operations/entry/DdbEsGetPublishedEntriesByIds.js","sources":["../../../src/operations/entry/DdbEsGetPublishedEntriesByIds.ts"],"sourcesContent":["import type {\n CmsModel,\n CmsEntryValues,\n CmsEntryStorageOperationsGetPublishedByIdsParams\n} from \"@webiny/api-headless-cms/types/index.js\";\nimport { GetPublishedEntriesByIdsStorageOperation } from \"@webiny/api-headless-cms/features/shared/storageOperations/entry/GetPublishedEntriesByIdsStorageOperation.js\";\nimport { CmsDdbEsDataLoaders } from \"~/abstractions/CmsDdbEsDataLoaders.js\";\nimport { CmsStorageModelProvider } from \"@webiny/api-headless-cms/features/shared/abstractions.js\";\nimport { convertEntryKeysFromStorage } from \"./transformations/convertEntryKeys.js\";\n\nclass DdbEsGetPublishedEntriesByIdsImpl\n implements GetPublishedEntriesByIdsStorageOperation.Interface\n{\n constructor(\n private dataLoaders: CmsDdbEsDataLoaders.Interface,\n private storageModelProvider: CmsStorageModelProvider.Interface\n ) {}\n\n async execute<T extends CmsEntryValues = CmsEntryValues>(\n initialModel: CmsModel,\n params: CmsEntryStorageOperationsGetPublishedByIdsParams\n ) {\n const model = this.storageModelProvider.getModel<T>(initialModel);\n\n const entries = await this.dataLoaders.getPublishedRevisionByEntryId<T>({\n model,\n ids: params.ids\n });\n\n return entries.map(entry => {\n return convertEntryKeysFromStorage<T>({\n model,\n entry\n });\n });\n }\n}\n\nexport const DdbEsGetPublishedEntriesByIds =\n GetPublishedEntriesByIdsStorageOperation.createImplementation({\n implementation: DdbEsGetPublishedEntriesByIdsImpl,\n dependencies: [CmsDdbEsDataLoaders, CmsStorageModelProvider]\n });\n"],"names":["DdbEsGetPublishedEntriesByIdsImpl","dataLoaders","storageModelProvider","initialModel","params","model","entries","entry","convertEntryKeysFromStorage","DdbEsGetPublishedEntriesByIds","GetPublishedEntriesByIdsStorageOperation","CmsDdbEsDataLoaders","CmsStorageModelProvider"],"mappings":";;;;AAUA,MAAMA;IAGF,YACYC,WAA0C,EAC1CC,oBAAuD,CACjE;aAFUD,WAAW,GAAXA;aACAC,oBAAoB,GAApBA;IACT;IAEH,MAAM,QACFC,YAAsB,EACtBC,MAAwD,EAC1D;QACE,MAAMC,QAAQ,IAAI,CAAC,oBAAoB,CAAC,QAAQ,CAAIF;QAEpD,MAAMG,UAAU,MAAM,IAAI,CAAC,WAAW,CAAC,6BAA6B,CAAI;YACpED;YACA,KAAKD,OAAO,GAAG;QACnB;QAEA,OAAOE,QAAQ,GAAG,CAACC,CAAAA,QACRC,4BAA+B;gBAClCH;gBACAE;YACJ;IAER;AACJ;AAEO,MAAME,gCACTC,yCAAyC,oBAAoB,CAAC;IAC1D,gBAAgBV;IAChB,cAAc;QAACW;QAAqBC;KAAwB;AAChE"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { CmsModel, CmsEntryValues, CmsEntryStorageOperationsGetPublishedRevisionParams } from "@webiny/api-headless-cms/types/index.js";
|
|
2
|
+
import { GetPublishedRevisionByEntryIdStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/entry/GetPublishedRevisionByEntryIdStorageOperation.js";
|
|
3
|
+
import { CmsDdbEsDataLoaders } from "../../abstractions/CmsDdbEsDataLoaders.js";
|
|
4
|
+
import { CmsStorageModelProvider } from "@webiny/api-headless-cms/features/shared/abstractions.js";
|
|
5
|
+
declare class DdbEsGetPublishedRevisionByEntryIdImpl implements GetPublishedRevisionByEntryIdStorageOperation.Interface {
|
|
6
|
+
private dataLoaders;
|
|
7
|
+
private storageModelProvider;
|
|
8
|
+
constructor(dataLoaders: CmsDdbEsDataLoaders.Interface, storageModelProvider: CmsStorageModelProvider.Interface);
|
|
9
|
+
execute<T extends CmsEntryValues = CmsEntryValues>(initialModel: CmsModel, params: CmsEntryStorageOperationsGetPublishedRevisionParams): Promise<import("@webiny/api-headless-cms/types/types.js").CmsStorageEntry<T> | null>;
|
|
10
|
+
}
|
|
11
|
+
export declare const DdbEsGetPublishedRevisionByEntryId: typeof DdbEsGetPublishedRevisionByEntryIdImpl & {
|
|
12
|
+
__abstraction: import("@webiny/di").Abstraction<import("@webiny/api-headless-cms/features/shared/storageOperations/entry/GetPublishedRevisionByEntryIdStorageOperation.js").IGetPublishedRevisionByEntryIdStorageOperation>;
|
|
13
|
+
};
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { GetPublishedRevisionByEntryIdStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/entry/GetPublishedRevisionByEntryIdStorageOperation.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 DdbEsGetPublishedRevisionByEntryIdImpl {
|
|
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 [entry] = await this.dataLoaders.getPublishedRevisionByEntryId({
|
|
13
|
+
model,
|
|
14
|
+
ids: [
|
|
15
|
+
params.id
|
|
16
|
+
]
|
|
17
|
+
});
|
|
18
|
+
if (!entry) return null;
|
|
19
|
+
return convertEntryKeysFromStorage({
|
|
20
|
+
model,
|
|
21
|
+
entry
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
const DdbEsGetPublishedRevisionByEntryId = GetPublishedRevisionByEntryIdStorageOperation.createImplementation({
|
|
26
|
+
implementation: DdbEsGetPublishedRevisionByEntryIdImpl,
|
|
27
|
+
dependencies: [
|
|
28
|
+
CmsDdbEsDataLoaders,
|
|
29
|
+
CmsStorageModelProvider
|
|
30
|
+
]
|
|
31
|
+
});
|
|
32
|
+
export { DdbEsGetPublishedRevisionByEntryId };
|
|
33
|
+
|
|
34
|
+
//# sourceMappingURL=DdbEsGetPublishedRevisionByEntryId.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operations/entry/DdbEsGetPublishedRevisionByEntryId.js","sources":["../../../src/operations/entry/DdbEsGetPublishedRevisionByEntryId.ts"],"sourcesContent":["import type {\n CmsModel,\n CmsEntryValues,\n CmsEntryStorageOperationsGetPublishedRevisionParams\n} from \"@webiny/api-headless-cms/types/index.js\";\nimport { GetPublishedRevisionByEntryIdStorageOperation } from \"@webiny/api-headless-cms/features/shared/storageOperations/entry/GetPublishedRevisionByEntryIdStorageOperation.js\";\nimport { CmsDdbEsDataLoaders } from \"~/abstractions/CmsDdbEsDataLoaders.js\";\nimport { CmsStorageModelProvider } from \"@webiny/api-headless-cms/features/shared/abstractions.js\";\nimport { convertEntryKeysFromStorage } from \"./transformations/convertEntryKeys.js\";\n\nclass DdbEsGetPublishedRevisionByEntryIdImpl\n implements GetPublishedRevisionByEntryIdStorageOperation.Interface\n{\n constructor(\n private dataLoaders: CmsDdbEsDataLoaders.Interface,\n private storageModelProvider: CmsStorageModelProvider.Interface\n ) {}\n\n async execute<T extends CmsEntryValues = CmsEntryValues>(\n initialModel: CmsModel,\n params: CmsEntryStorageOperationsGetPublishedRevisionParams\n ) {\n const model = this.storageModelProvider.getModel<T>(initialModel);\n\n const [entry] = await this.dataLoaders.getPublishedRevisionByEntryId<T>({\n model,\n ids: [params.id]\n });\n if (!entry) {\n return null;\n }\n return convertEntryKeysFromStorage<T>({\n model,\n entry\n });\n }\n}\n\nexport const DdbEsGetPublishedRevisionByEntryId =\n GetPublishedRevisionByEntryIdStorageOperation.createImplementation({\n implementation: DdbEsGetPublishedRevisionByEntryIdImpl,\n dependencies: [CmsDdbEsDataLoaders, CmsStorageModelProvider]\n });\n"],"names":["DdbEsGetPublishedRevisionByEntryIdImpl","dataLoaders","storageModelProvider","initialModel","params","model","entry","convertEntryKeysFromStorage","DdbEsGetPublishedRevisionByEntryId","GetPublishedRevisionByEntryIdStorageOperation","CmsDdbEsDataLoaders","CmsStorageModelProvider"],"mappings":";;;;AAUA,MAAMA;IAGF,YACYC,WAA0C,EAC1CC,oBAAuD,CACjE;aAFUD,WAAW,GAAXA;aACAC,oBAAoB,GAApBA;IACT;IAEH,MAAM,QACFC,YAAsB,EACtBC,MAA2D,EAC7D;QACE,MAAMC,QAAQ,IAAI,CAAC,oBAAoB,CAAC,QAAQ,CAAIF;QAEpD,MAAM,CAACG,MAAM,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,6BAA6B,CAAI;YACpED;YACA,KAAK;gBAACD,OAAO,EAAE;aAAC;QACpB;QACA,IAAI,CAACE,OACD,OAAO;QAEX,OAAOC,4BAA+B;YAClCF;YACAC;QACJ;IACJ;AACJ;AAEO,MAAME,qCACTC,8CAA8C,oBAAoB,CAAC;IAC/D,gBAAgBT;IAChB,cAAc;QAACU;QAAqBC;KAAwB;AAChE"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { CmsModel, CmsEntryValues, CmsEntryStorageOperationsGetRevisionParams } from "@webiny/api-headless-cms/types/index.js";
|
|
2
|
+
import { GetRevisionByIdStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/entry/GetRevisionByIdStorageOperation.js";
|
|
3
|
+
import { CmsDdbEsDataLoaders } from "../../abstractions/CmsDdbEsDataLoaders.js";
|
|
4
|
+
import { CmsStorageModelProvider } from "@webiny/api-headless-cms/features/shared/abstractions.js";
|
|
5
|
+
declare class DdbEsGetRevisionByIdImpl implements GetRevisionByIdStorageOperation.Interface {
|
|
6
|
+
private dataLoaders;
|
|
7
|
+
private storageModelProvider;
|
|
8
|
+
constructor(dataLoaders: CmsDdbEsDataLoaders.Interface, storageModelProvider: CmsStorageModelProvider.Interface);
|
|
9
|
+
execute<T extends CmsEntryValues = CmsEntryValues>(initialModel: CmsModel, params: CmsEntryStorageOperationsGetRevisionParams): Promise<import("@webiny/api-headless-cms/types/types.js").CmsStorageEntry<T> | null>;
|
|
10
|
+
}
|
|
11
|
+
export declare const DdbEsGetRevisionById: typeof DdbEsGetRevisionByIdImpl & {
|
|
12
|
+
__abstraction: import("@webiny/di").Abstraction<import("@webiny/api-headless-cms/features/shared/storageOperations/entry/GetRevisionByIdStorageOperation.js").IGetRevisionByIdStorageOperation>;
|
|
13
|
+
};
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { GetRevisionByIdStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/entry/GetRevisionByIdStorageOperation.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 DdbEsGetRevisionByIdImpl {
|
|
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 [entry] = await this.dataLoaders.getRevisionById({
|
|
13
|
+
model,
|
|
14
|
+
ids: [
|
|
15
|
+
params.id
|
|
16
|
+
]
|
|
17
|
+
});
|
|
18
|
+
if (!entry) return null;
|
|
19
|
+
return convertEntryKeysFromStorage({
|
|
20
|
+
model,
|
|
21
|
+
entry
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
const DdbEsGetRevisionById = GetRevisionByIdStorageOperation.createImplementation({
|
|
26
|
+
implementation: DdbEsGetRevisionByIdImpl,
|
|
27
|
+
dependencies: [
|
|
28
|
+
CmsDdbEsDataLoaders,
|
|
29
|
+
CmsStorageModelProvider
|
|
30
|
+
]
|
|
31
|
+
});
|
|
32
|
+
export { DdbEsGetRevisionById };
|
|
33
|
+
|
|
34
|
+
//# sourceMappingURL=DdbEsGetRevisionById.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operations/entry/DdbEsGetRevisionById.js","sources":["../../../src/operations/entry/DdbEsGetRevisionById.ts"],"sourcesContent":["import type {\n CmsModel,\n CmsEntryValues,\n CmsEntryStorageOperationsGetRevisionParams\n} from \"@webiny/api-headless-cms/types/index.js\";\nimport { GetRevisionByIdStorageOperation } from \"@webiny/api-headless-cms/features/shared/storageOperations/entry/GetRevisionByIdStorageOperation.js\";\nimport { CmsDdbEsDataLoaders } from \"~/abstractions/CmsDdbEsDataLoaders.js\";\nimport { CmsStorageModelProvider } from \"@webiny/api-headless-cms/features/shared/abstractions.js\";\nimport { convertEntryKeysFromStorage } from \"./transformations/convertEntryKeys.js\";\n\nclass DdbEsGetRevisionByIdImpl implements GetRevisionByIdStorageOperation.Interface {\n constructor(\n private dataLoaders: CmsDdbEsDataLoaders.Interface,\n private storageModelProvider: CmsStorageModelProvider.Interface\n ) {}\n\n async execute<T extends CmsEntryValues = CmsEntryValues>(\n initialModel: CmsModel,\n params: CmsEntryStorageOperationsGetRevisionParams\n ) {\n const model = this.storageModelProvider.getModel<T>(initialModel);\n\n const [entry] = await this.dataLoaders.getRevisionById<T>({\n model,\n ids: [params.id]\n });\n if (!entry) {\n return null;\n }\n return convertEntryKeysFromStorage<T>({\n model,\n entry\n });\n }\n}\n\nexport const DdbEsGetRevisionById = GetRevisionByIdStorageOperation.createImplementation({\n implementation: DdbEsGetRevisionByIdImpl,\n dependencies: [CmsDdbEsDataLoaders, CmsStorageModelProvider]\n});\n"],"names":["DdbEsGetRevisionByIdImpl","dataLoaders","storageModelProvider","initialModel","params","model","entry","convertEntryKeysFromStorage","DdbEsGetRevisionById","GetRevisionByIdStorageOperation","CmsDdbEsDataLoaders","CmsStorageModelProvider"],"mappings":";;;;AAUA,MAAMA;IACF,YACYC,WAA0C,EAC1CC,oBAAuD,CACjE;aAFUD,WAAW,GAAXA;aACAC,oBAAoB,GAApBA;IACT;IAEH,MAAM,QACFC,YAAsB,EACtBC,MAAkD,EACpD;QACE,MAAMC,QAAQ,IAAI,CAAC,oBAAoB,CAAC,QAAQ,CAAIF;QAEpD,MAAM,CAACG,MAAM,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,eAAe,CAAI;YACtDD;YACA,KAAK;gBAACD,OAAO,EAAE;aAAC;QACpB;QACA,IAAI,CAACE,OACD,OAAO;QAEX,OAAOC,4BAA+B;YAClCF;YACAC;QACJ;IACJ;AACJ;AAEO,MAAME,uBAAuBC,gCAAgC,oBAAoB,CAAC;IACrF,gBAAgBT;IAChB,cAAc;QAACU;QAAqBC;KAAwB;AAChE"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { CmsModel, CmsEntryValues, CmsEntryStorageOperationsGetRevisionsParams } from "@webiny/api-headless-cms/types/index.js";
|
|
2
|
+
import { GetRevisionsStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/entry/GetRevisionsStorageOperation.js";
|
|
3
|
+
import { CmsDdbEsDataLoaders } from "../../abstractions/CmsDdbEsDataLoaders.js";
|
|
4
|
+
import { CmsStorageModelProvider } from "@webiny/api-headless-cms/features/shared/abstractions.js";
|
|
5
|
+
declare class DdbEsGetRevisionsImpl implements GetRevisionsStorageOperation.Interface {
|
|
6
|
+
private dataLoaders;
|
|
7
|
+
private storageModelProvider;
|
|
8
|
+
constructor(dataLoaders: CmsDdbEsDataLoaders.Interface, storageModelProvider: CmsStorageModelProvider.Interface);
|
|
9
|
+
execute<T extends CmsEntryValues = CmsEntryValues>(initialModel: CmsModel, params: CmsEntryStorageOperationsGetRevisionsParams): Promise<import("@webiny/api-headless-cms/types/types.js").CmsStorageEntry<T>[]>;
|
|
10
|
+
}
|
|
11
|
+
export declare const DdbEsGetRevisions: typeof DdbEsGetRevisionsImpl & {
|
|
12
|
+
__abstraction: import("@webiny/di").Abstraction<import("@webiny/api-headless-cms/features/shared/storageOperations/entry/GetRevisionsStorageOperation.js").IGetRevisionsStorageOperation>;
|
|
13
|
+
};
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { GetRevisionsStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/entry/GetRevisionsStorageOperation.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 DdbEsGetRevisionsImpl {
|
|
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.getAllEntryRevisions({
|
|
13
|
+
model,
|
|
14
|
+
ids: [
|
|
15
|
+
params.id
|
|
16
|
+
]
|
|
17
|
+
});
|
|
18
|
+
return entries.map((entry)=>convertEntryKeysFromStorage({
|
|
19
|
+
model,
|
|
20
|
+
entry
|
|
21
|
+
}));
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
const DdbEsGetRevisions = GetRevisionsStorageOperation.createImplementation({
|
|
25
|
+
implementation: DdbEsGetRevisionsImpl,
|
|
26
|
+
dependencies: [
|
|
27
|
+
CmsDdbEsDataLoaders,
|
|
28
|
+
CmsStorageModelProvider
|
|
29
|
+
]
|
|
30
|
+
});
|
|
31
|
+
export { DdbEsGetRevisions };
|
|
32
|
+
|
|
33
|
+
//# sourceMappingURL=DdbEsGetRevisions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operations/entry/DdbEsGetRevisions.js","sources":["../../../src/operations/entry/DdbEsGetRevisions.ts"],"sourcesContent":["import type {\n CmsModel,\n CmsEntryValues,\n CmsEntryStorageOperationsGetRevisionsParams\n} from \"@webiny/api-headless-cms/types/index.js\";\nimport { GetRevisionsStorageOperation } from \"@webiny/api-headless-cms/features/shared/storageOperations/entry/GetRevisionsStorageOperation.js\";\nimport { CmsDdbEsDataLoaders } from \"~/abstractions/CmsDdbEsDataLoaders.js\";\nimport { CmsStorageModelProvider } from \"@webiny/api-headless-cms/features/shared/abstractions.js\";\nimport { convertEntryKeysFromStorage } from \"./transformations/convertEntryKeys.js\";\n\nclass DdbEsGetRevisionsImpl implements GetRevisionsStorageOperation.Interface {\n constructor(\n private dataLoaders: CmsDdbEsDataLoaders.Interface,\n private storageModelProvider: CmsStorageModelProvider.Interface\n ) {}\n\n async execute<T extends CmsEntryValues = CmsEntryValues>(\n initialModel: CmsModel,\n params: CmsEntryStorageOperationsGetRevisionsParams\n ) {\n const model = this.storageModelProvider.getModel<T>(initialModel);\n\n const entries = await this.dataLoaders.getAllEntryRevisions<T>({\n model,\n ids: [params.id]\n });\n\n return entries.map(entry => {\n return convertEntryKeysFromStorage<T>({\n model,\n entry\n });\n });\n }\n}\n\nexport const DdbEsGetRevisions = GetRevisionsStorageOperation.createImplementation({\n implementation: DdbEsGetRevisionsImpl,\n dependencies: [CmsDdbEsDataLoaders, CmsStorageModelProvider]\n});\n"],"names":["DdbEsGetRevisionsImpl","dataLoaders","storageModelProvider","initialModel","params","model","entries","entry","convertEntryKeysFromStorage","DdbEsGetRevisions","GetRevisionsStorageOperation","CmsDdbEsDataLoaders","CmsStorageModelProvider"],"mappings":";;;;AAUA,MAAMA;IACF,YACYC,WAA0C,EAC1CC,oBAAuD,CACjE;aAFUD,WAAW,GAAXA;aACAC,oBAAoB,GAApBA;IACT;IAEH,MAAM,QACFC,YAAsB,EACtBC,MAAmD,EACrD;QACE,MAAMC,QAAQ,IAAI,CAAC,oBAAoB,CAAC,QAAQ,CAAIF;QAEpD,MAAMG,UAAU,MAAM,IAAI,CAAC,WAAW,CAAC,oBAAoB,CAAI;YAC3DD;YACA,KAAK;gBAACD,OAAO,EAAE;aAAC;QACpB;QAEA,OAAOE,QAAQ,GAAG,CAACC,CAAAA,QACRC,4BAA+B;gBAClCH;gBACAE;YACJ;IAER;AACJ;AAEO,MAAME,oBAAoBC,6BAA6B,oBAAoB,CAAC;IAC/E,gBAAgBV;IAChB,cAAc;QAACW;QAAqBC;KAAwB;AAChE"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { CmsModel, CmsEntryStorageOperationsGetUniqueFieldValuesParams } from "@webiny/api-headless-cms/types/index.js";
|
|
2
|
+
import { GetUniqueFieldValuesStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/entry/GetUniqueFieldValuesStorageOperation.js";
|
|
3
|
+
import { OpenSearchClient } from "@webiny/api-opensearch/exports/api/opensearch.js";
|
|
4
|
+
import { CmsEntryOpenSearchBodyBuilder, CmsModelOpenSearchIndexProvider } from "@webiny/api-headless-cms-utils-os/exports/api/cms/opensearch.js";
|
|
5
|
+
declare class DdbEsGetUniqueFieldValuesImpl implements GetUniqueFieldValuesStorageOperation.Interface {
|
|
6
|
+
private bodyBuilder;
|
|
7
|
+
private indexProvider;
|
|
8
|
+
private elasticsearch;
|
|
9
|
+
constructor(bodyBuilder: CmsEntryOpenSearchBodyBuilder.Interface, openSearchClient: OpenSearchClient.Interface, indexProvider: CmsModelOpenSearchIndexProvider.Interface);
|
|
10
|
+
execute(model: CmsModel, params: CmsEntryStorageOperationsGetUniqueFieldValuesParams): Promise<{
|
|
11
|
+
value: string;
|
|
12
|
+
count: number;
|
|
13
|
+
}[]>;
|
|
14
|
+
}
|
|
15
|
+
export declare const DdbEsGetUniqueFieldValues: typeof DdbEsGetUniqueFieldValuesImpl & {
|
|
16
|
+
__abstraction: import("@webiny/di").Abstraction<import("@webiny/api-headless-cms/features/shared/storageOperations/entry/GetUniqueFieldValuesStorageOperation.js").IGetUniqueFieldValuesStorageOperation>;
|
|
17
|
+
};
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import _webiny_error from "@webiny/error";
|
|
2
|
+
import { GetUniqueFieldValuesStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/entry/GetUniqueFieldValuesStorageOperation.js";
|
|
3
|
+
import { OpenSearchClient } from "@webiny/api-opensearch/exports/api/opensearch.js";
|
|
4
|
+
import { createConfigurations } from "@webiny/api-headless-cms-utils-os/configurations.js";
|
|
5
|
+
import { shouldIgnoreEsResponseError } from "@webiny/api-headless-cms-utils-os/operations/entry/elasticsearch/shouldIgnoreEsResponseError.js";
|
|
6
|
+
import { CmsEntryOpenSearchBodyBuilder, CmsModelOpenSearchIndexProvider } from "@webiny/api-headless-cms-utils-os/exports/api/cms/opensearch.js";
|
|
7
|
+
class DdbEsGetUniqueFieldValuesImpl {
|
|
8
|
+
constructor(bodyBuilder, openSearchClient, indexProvider){
|
|
9
|
+
this.bodyBuilder = bodyBuilder;
|
|
10
|
+
this.indexProvider = indexProvider;
|
|
11
|
+
this.elasticsearch = openSearchClient.use();
|
|
12
|
+
}
|
|
13
|
+
async execute(model, params) {
|
|
14
|
+
const { where, fieldId } = params;
|
|
15
|
+
const configurations = createConfigurations(this.indexProvider);
|
|
16
|
+
const { index } = await configurations.es({
|
|
17
|
+
model
|
|
18
|
+
});
|
|
19
|
+
const initialBody = this.bodyBuilder.build({
|
|
20
|
+
model,
|
|
21
|
+
params: {
|
|
22
|
+
limit: 1,
|
|
23
|
+
where
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
const field = model.fields.find((f)=>f.fieldId === fieldId);
|
|
27
|
+
if (!field) throw new _webiny_error('Could not find field with given "fieldId" value.', "FIELD_NOT_FOUND", {
|
|
28
|
+
fieldId
|
|
29
|
+
});
|
|
30
|
+
const body = {
|
|
31
|
+
...initialBody,
|
|
32
|
+
size: 0,
|
|
33
|
+
aggregations: {
|
|
34
|
+
getUniqueFieldValues: {
|
|
35
|
+
terms: {
|
|
36
|
+
field: `values.${field.storageId}.keyword`,
|
|
37
|
+
size: 1000000
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
let response;
|
|
43
|
+
try {
|
|
44
|
+
response = await this.elasticsearch.search({
|
|
45
|
+
index,
|
|
46
|
+
body
|
|
47
|
+
});
|
|
48
|
+
} catch (error) {
|
|
49
|
+
if (shouldIgnoreEsResponseError(error)) return [];
|
|
50
|
+
throw new _webiny_error(error.message || "Error in the Elasticsearch query.", error.code || "OPENSEARCH_ERROR", {
|
|
51
|
+
error,
|
|
52
|
+
index,
|
|
53
|
+
model,
|
|
54
|
+
body
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
const aggregations = response.body.aggregations || {};
|
|
58
|
+
const agg = aggregations["getUniqueFieldValues"];
|
|
59
|
+
const buckets = agg && "buckets" in agg && Array.isArray(agg.buckets) ? agg.buckets : [];
|
|
60
|
+
return buckets.map((bucket)=>({
|
|
61
|
+
value: bucket.key,
|
|
62
|
+
count: bucket.doc_count
|
|
63
|
+
}));
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
const DdbEsGetUniqueFieldValues = GetUniqueFieldValuesStorageOperation.createImplementation({
|
|
67
|
+
implementation: DdbEsGetUniqueFieldValuesImpl,
|
|
68
|
+
dependencies: [
|
|
69
|
+
CmsEntryOpenSearchBodyBuilder,
|
|
70
|
+
OpenSearchClient,
|
|
71
|
+
CmsModelOpenSearchIndexProvider
|
|
72
|
+
]
|
|
73
|
+
});
|
|
74
|
+
export { DdbEsGetUniqueFieldValues };
|
|
75
|
+
|
|
76
|
+
//# sourceMappingURL=DdbEsGetUniqueFieldValues.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operations/entry/DdbEsGetUniqueFieldValues.js","sources":["../../../src/operations/entry/DdbEsGetUniqueFieldValues.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport type {\n CmsModel,\n CmsEntryStorageOperationsGetUniqueFieldValuesParams\n} from \"@webiny/api-headless-cms/types/index.js\";\nimport { GetUniqueFieldValuesStorageOperation } from \"@webiny/api-headless-cms/features/shared/storageOperations/entry/GetUniqueFieldValuesStorageOperation.js\";\nimport { OpenSearchClient } from \"@webiny/api-opensearch/exports/api/opensearch.js\";\nimport type { Client } from \"@webiny/api-opensearch\";\nimport type {\n OpenSearchSearchResponse,\n SearchBody as OpenSearchSearchBody\n} from \"@webiny/api-opensearch/types.js\";\nimport { createConfigurations } from \"@webiny/api-headless-cms-utils-os/configurations.js\";\nimport { shouldIgnoreEsResponseError } from \"@webiny/api-headless-cms-utils-os/operations/entry/elasticsearch/shouldIgnoreEsResponseError.js\";\nimport {\n CmsEntryOpenSearchBodyBuilder,\n CmsModelOpenSearchIndexProvider\n} from \"@webiny/api-headless-cms-utils-os/exports/api/cms/opensearch.js\";\n\nclass DdbEsGetUniqueFieldValuesImpl implements GetUniqueFieldValuesStorageOperation.Interface {\n private elasticsearch: Client;\n\n constructor(\n private bodyBuilder: CmsEntryOpenSearchBodyBuilder.Interface,\n openSearchClient: OpenSearchClient.Interface,\n private indexProvider: CmsModelOpenSearchIndexProvider.Interface\n ) {\n this.elasticsearch = openSearchClient.use();\n }\n\n async execute(model: CmsModel, params: CmsEntryStorageOperationsGetUniqueFieldValuesParams) {\n const { where, fieldId } = params;\n\n const configurations = createConfigurations(this.indexProvider);\n const { index } = await configurations.es({\n model\n });\n\n const initialBody = this.bodyBuilder.build({\n model,\n params: {\n limit: 1,\n where\n }\n });\n\n const field = model.fields.find(f => f.fieldId === fieldId);\n if (!field) {\n throw new WebinyError(\n `Could not find field with given \"fieldId\" value.`,\n \"FIELD_NOT_FOUND\",\n {\n fieldId\n }\n );\n }\n\n const body: OpenSearchSearchBody = {\n ...initialBody,\n /**\n * We do not need any hits returned, we only need the aggregations.\n */\n size: 0,\n aggregations: {\n getUniqueFieldValues: {\n terms: {\n field: `values.${field.storageId}.keyword`,\n size: 1000000\n }\n }\n }\n };\n\n let response: OpenSearchSearchResponse | undefined = undefined;\n\n try {\n response = await this.elasticsearch.search({\n index,\n body\n });\n } catch (error) {\n if (shouldIgnoreEsResponseError(error)) {\n return [];\n }\n\n throw new WebinyError(\n error.message || \"Error in the Elasticsearch query.\",\n error.code || \"OPENSEARCH_ERROR\",\n {\n error,\n index,\n model,\n body\n }\n );\n }\n\n const aggregations = response.body.aggregations || {};\n const agg = aggregations[\"getUniqueFieldValues\"];\n const buckets = agg && \"buckets\" in agg && Array.isArray(agg.buckets) ? agg.buckets : [];\n return buckets.map((bucket: { key: string; doc_count: number }) => {\n return {\n value: bucket.key,\n count: bucket.doc_count\n };\n });\n }\n}\n\nexport const DdbEsGetUniqueFieldValues = GetUniqueFieldValuesStorageOperation.createImplementation({\n implementation: DdbEsGetUniqueFieldValuesImpl,\n dependencies: [CmsEntryOpenSearchBodyBuilder, OpenSearchClient, CmsModelOpenSearchIndexProvider]\n});\n"],"names":["DdbEsGetUniqueFieldValuesImpl","bodyBuilder","openSearchClient","indexProvider","model","params","where","fieldId","configurations","createConfigurations","index","initialBody","field","f","WebinyError","body","response","error","shouldIgnoreEsResponseError","aggregations","agg","buckets","Array","bucket","DdbEsGetUniqueFieldValues","GetUniqueFieldValuesStorageOperation","CmsEntryOpenSearchBodyBuilder","OpenSearchClient","CmsModelOpenSearchIndexProvider"],"mappings":";;;;;;AAmBA,MAAMA;IAGF,YACYC,WAAoD,EAC5DC,gBAA4C,EACpCC,aAAwD,CAClE;aAHUF,WAAW,GAAXA;aAEAE,aAAa,GAAbA;QAER,IAAI,CAAC,aAAa,GAAGD,iBAAiB,GAAG;IAC7C;IAEA,MAAM,QAAQE,KAAe,EAAEC,MAA2D,EAAE;QACxF,MAAM,EAAEC,KAAK,EAAEC,OAAO,EAAE,GAAGF;QAE3B,MAAMG,iBAAiBC,qBAAqB,IAAI,CAAC,aAAa;QAC9D,MAAM,EAAEC,KAAK,EAAE,GAAG,MAAMF,eAAe,EAAE,CAAC;YACtCJ;QACJ;QAEA,MAAMO,cAAc,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC;YACvCP;YACA,QAAQ;gBACJ,OAAO;gBACPE;YACJ;QACJ;QAEA,MAAMM,QAAQR,MAAM,MAAM,CAAC,IAAI,CAACS,CAAAA,IAAKA,EAAE,OAAO,KAAKN;QACnD,IAAI,CAACK,OACD,MAAM,IAAIE,cACN,oDACA,mBACA;YACIP;QACJ;QAIR,MAAMQ,OAA6B;YAC/B,GAAGJ,WAAW;YAId,MAAM;YACN,cAAc;gBACV,sBAAsB;oBAClB,OAAO;wBACH,OAAO,CAAC,OAAO,EAAEC,MAAM,SAAS,CAAC,QAAQ,CAAC;wBAC1C,MAAM;oBACV;gBACJ;YACJ;QACJ;QAEA,IAAII;QAEJ,IAAI;YACAA,WAAW,MAAM,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC;gBACvCN;gBACAK;YACJ;QACJ,EAAE,OAAOE,OAAO;YACZ,IAAIC,4BAA4BD,QAC5B,OAAO,EAAE;YAGb,MAAM,IAAIH,cACNG,MAAM,OAAO,IAAI,qCACjBA,MAAM,IAAI,IAAI,oBACd;gBACIA;gBACAP;gBACAN;gBACAW;YACJ;QAER;QAEA,MAAMI,eAAeH,SAAS,IAAI,CAAC,YAAY,IAAI,CAAC;QACpD,MAAMI,MAAMD,YAAY,CAAC,uBAAuB;QAChD,MAAME,UAAUD,OAAO,aAAaA,OAAOE,MAAM,OAAO,CAACF,IAAI,OAAO,IAAIA,IAAI,OAAO,GAAG,EAAE;QACxF,OAAOC,QAAQ,GAAG,CAAC,CAACE,SACT;gBACH,OAAOA,OAAO,GAAG;gBACjB,OAAOA,OAAO,SAAS;YAC3B;IAER;AACJ;AAEO,MAAMC,4BAA4BC,qCAAqC,oBAAoB,CAAC;IAC/F,gBAAgBzB;IAChB,cAAc;QAAC0B;QAA+BC;QAAkBC;KAAgC;AACpG"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { CmsModel, CmsEntryValues, CmsEntryStorageOperationsListParams } from "@webiny/api-headless-cms/types/index.js";
|
|
2
|
+
import { ListEntriesStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/entry/ListEntriesStorageOperation.js";
|
|
3
|
+
import { CmsStorageModelProvider } from "@webiny/api-headless-cms/features/shared/abstractions.js";
|
|
4
|
+
import { CmsModelFieldToGraphQLRegistry } from "@webiny/api-headless-cms/exports/api/cms/graphql.js";
|
|
5
|
+
import { OpenSearchClient } from "@webiny/api-opensearch/exports/api/opensearch.js";
|
|
6
|
+
import { CmsEntryOpenSearchBodyBuilder, CmsEntryOpenSearchFieldIndexRegistry, CmsModelOpenSearchIndexProvider } from "@webiny/api-headless-cms-utils-os/exports/api/cms/opensearch.js";
|
|
7
|
+
declare class DdbEsListEntriesImpl implements ListEntriesStorageOperation.Interface {
|
|
8
|
+
private storageModelProvider;
|
|
9
|
+
private bodyBuilder;
|
|
10
|
+
private fieldRegistry;
|
|
11
|
+
private fieldIndexRegistry;
|
|
12
|
+
private indexProvider;
|
|
13
|
+
private elasticsearch;
|
|
14
|
+
constructor(storageModelProvider: CmsStorageModelProvider.Interface, bodyBuilder: CmsEntryOpenSearchBodyBuilder.Interface, fieldRegistry: CmsModelFieldToGraphQLRegistry.Interface, fieldIndexRegistry: CmsEntryOpenSearchFieldIndexRegistry.Interface, openSearchClient: OpenSearchClient.Interface, indexProvider: CmsModelOpenSearchIndexProvider.Interface);
|
|
15
|
+
execute<T extends CmsEntryValues = CmsEntryValues>(initialModel: CmsModel, params: CmsEntryStorageOperationsListParams): Promise<{
|
|
16
|
+
hasMoreItems: boolean;
|
|
17
|
+
totalCount: number;
|
|
18
|
+
cursor: string | null;
|
|
19
|
+
items: import("@webiny/api-headless-cms/types/types.js").CmsStorageEntry<T>[];
|
|
20
|
+
}>;
|
|
21
|
+
}
|
|
22
|
+
export declare const DdbEsListEntries: typeof DdbEsListEntriesImpl & {
|
|
23
|
+
__abstraction: import("@webiny/di").Abstraction<import("@webiny/api-headless-cms/features/shared/storageOperations/entry/ListEntriesStorageOperation.js").IListEntriesStorageOperation>;
|
|
24
|
+
};
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import _webiny_error from "@webiny/error";
|
|
2
|
+
import { ListEntriesStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/entry/ListEntriesStorageOperation.js";
|
|
3
|
+
import { CmsStorageModelProvider } from "@webiny/api-headless-cms/features/shared/abstractions.js";
|
|
4
|
+
import { CmsModelFieldToGraphQLRegistry } from "@webiny/api-headless-cms/exports/api/cms/graphql.js";
|
|
5
|
+
import { OpenSearchClient } from "@webiny/api-opensearch/exports/api/opensearch.js";
|
|
6
|
+
import { createLimit, decodeCursor, encodeCursor } from "@webiny/api-opensearch";
|
|
7
|
+
import { getTotalCount } from "@webiny/api-opensearch/types.js";
|
|
8
|
+
import { createConfigurations } from "@webiny/api-headless-cms-utils-os/configurations.js";
|
|
9
|
+
import { extractEntriesFromIndex } from "@webiny/api-headless-cms-utils-os/helpers/index.js";
|
|
10
|
+
import { shouldIgnoreEsResponseError } from "@webiny/api-headless-cms-utils-os/operations/entry/elasticsearch/shouldIgnoreEsResponseError.js";
|
|
11
|
+
import { CmsEntryOpenSearchBodyBuilder, CmsEntryOpenSearchFieldIndexRegistry, CmsModelOpenSearchIndexProvider } from "@webiny/api-headless-cms-utils-os/exports/api/cms/opensearch.js";
|
|
12
|
+
import { convertEntryKeysFromStorage } from "./transformations/convertEntryKeys.js";
|
|
13
|
+
class DdbEsListEntriesImpl {
|
|
14
|
+
constructor(storageModelProvider, bodyBuilder, fieldRegistry, fieldIndexRegistry, openSearchClient, indexProvider){
|
|
15
|
+
this.storageModelProvider = storageModelProvider;
|
|
16
|
+
this.bodyBuilder = bodyBuilder;
|
|
17
|
+
this.fieldRegistry = fieldRegistry;
|
|
18
|
+
this.fieldIndexRegistry = fieldIndexRegistry;
|
|
19
|
+
this.indexProvider = indexProvider;
|
|
20
|
+
this.elasticsearch = openSearchClient.use();
|
|
21
|
+
}
|
|
22
|
+
async execute(initialModel, params) {
|
|
23
|
+
const model = this.storageModelProvider.getModel(initialModel);
|
|
24
|
+
const limit = createLimit(params.limit, 50);
|
|
25
|
+
const configurations = createConfigurations(this.indexProvider);
|
|
26
|
+
const { index } = await configurations.es({
|
|
27
|
+
model
|
|
28
|
+
});
|
|
29
|
+
const body = this.bodyBuilder.build({
|
|
30
|
+
model,
|
|
31
|
+
params: {
|
|
32
|
+
...params,
|
|
33
|
+
limit,
|
|
34
|
+
after: decodeCursor(params.after)
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
let response;
|
|
38
|
+
try {
|
|
39
|
+
response = await this.elasticsearch.search({
|
|
40
|
+
index,
|
|
41
|
+
body
|
|
42
|
+
});
|
|
43
|
+
} catch (error) {
|
|
44
|
+
if (shouldIgnoreEsResponseError(error)) return {
|
|
45
|
+
hasMoreItems: false,
|
|
46
|
+
totalCount: 0,
|
|
47
|
+
cursor: null,
|
|
48
|
+
items: []
|
|
49
|
+
};
|
|
50
|
+
throw new _webiny_error(error.message, error.code || "OPENSEARCH_ERROR", {
|
|
51
|
+
error,
|
|
52
|
+
index,
|
|
53
|
+
body,
|
|
54
|
+
model
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
const { hits, total } = response.body.hits;
|
|
58
|
+
const items = extractEntriesFromIndex({
|
|
59
|
+
fieldRegistry: this.fieldRegistry,
|
|
60
|
+
fieldIndexRegistry: this.fieldIndexRegistry,
|
|
61
|
+
model,
|
|
62
|
+
entries: hits.map((item)=>item._source)
|
|
63
|
+
}).map((item)=>convertEntryKeysFromStorage({
|
|
64
|
+
model,
|
|
65
|
+
entry: item
|
|
66
|
+
}));
|
|
67
|
+
const hasMoreItems = items.length > limit;
|
|
68
|
+
if (hasMoreItems) items.pop();
|
|
69
|
+
const cursor = items.length > 0 ? encodeCursor(hits[items.length - 1].sort) || null : null;
|
|
70
|
+
return {
|
|
71
|
+
hasMoreItems,
|
|
72
|
+
totalCount: getTotalCount(total),
|
|
73
|
+
cursor,
|
|
74
|
+
items
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
const DdbEsListEntries = ListEntriesStorageOperation.createImplementation({
|
|
79
|
+
implementation: DdbEsListEntriesImpl,
|
|
80
|
+
dependencies: [
|
|
81
|
+
CmsStorageModelProvider,
|
|
82
|
+
CmsEntryOpenSearchBodyBuilder,
|
|
83
|
+
CmsModelFieldToGraphQLRegistry,
|
|
84
|
+
CmsEntryOpenSearchFieldIndexRegistry,
|
|
85
|
+
OpenSearchClient,
|
|
86
|
+
CmsModelOpenSearchIndexProvider
|
|
87
|
+
]
|
|
88
|
+
});
|
|
89
|
+
export { DdbEsListEntries };
|
|
90
|
+
|
|
91
|
+
//# sourceMappingURL=DdbEsListEntries.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operations/entry/DdbEsListEntries.js","sources":["../../../src/operations/entry/DdbEsListEntries.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport type {\n CmsModel,\n CmsEntryValues,\n CmsEntryStorageOperationsListParams\n} from \"@webiny/api-headless-cms/types/index.js\";\nimport { ListEntriesStorageOperation } from \"@webiny/api-headless-cms/features/shared/storageOperations/entry/ListEntriesStorageOperation.js\";\nimport { CmsStorageModelProvider } from \"@webiny/api-headless-cms/features/shared/abstractions.js\";\nimport { CmsModelFieldToGraphQLRegistry } from \"@webiny/api-headless-cms/exports/api/cms/graphql.js\";\nimport { OpenSearchClient } from \"@webiny/api-opensearch/exports/api/opensearch.js\";\nimport type { Client } from \"@webiny/api-opensearch\";\nimport { createLimit, decodeCursor, encodeCursor } from \"@webiny/api-opensearch\";\nimport type { OpenSearchSearchResponse } from \"@webiny/api-opensearch/types.js\";\nimport { getTotalCount } from \"@webiny/api-opensearch/types.js\";\nimport { createConfigurations } from \"@webiny/api-headless-cms-utils-os/configurations.js\";\nimport { extractEntriesFromIndex } from \"@webiny/api-headless-cms-utils-os/helpers/index.js\";\nimport { shouldIgnoreEsResponseError } from \"@webiny/api-headless-cms-utils-os/operations/entry/elasticsearch/shouldIgnoreEsResponseError.js\";\nimport {\n CmsEntryOpenSearchBodyBuilder,\n CmsEntryOpenSearchFieldIndexRegistry,\n CmsModelOpenSearchIndexProvider\n} from \"@webiny/api-headless-cms-utils-os/exports/api/cms/opensearch.js\";\nimport type { CmsIndexEntry } from \"@webiny/api-headless-cms-utils-os/types.js\";\nimport { convertEntryKeysFromStorage } from \"./transformations/convertEntryKeys.js\";\n\nclass DdbEsListEntriesImpl implements ListEntriesStorageOperation.Interface {\n private elasticsearch: Client;\n\n constructor(\n private storageModelProvider: CmsStorageModelProvider.Interface,\n private bodyBuilder: CmsEntryOpenSearchBodyBuilder.Interface,\n private fieldRegistry: CmsModelFieldToGraphQLRegistry.Interface,\n private fieldIndexRegistry: CmsEntryOpenSearchFieldIndexRegistry.Interface,\n openSearchClient: OpenSearchClient.Interface,\n private indexProvider: CmsModelOpenSearchIndexProvider.Interface\n ) {\n this.elasticsearch = openSearchClient.use();\n }\n\n async execute<T extends CmsEntryValues = CmsEntryValues>(\n initialModel: CmsModel,\n params: CmsEntryStorageOperationsListParams\n ) {\n const model = this.storageModelProvider.getModel<T>(initialModel);\n\n const limit = createLimit(params.limit, 50);\n const configurations = createConfigurations(this.indexProvider);\n const { index } = await configurations.es({\n model\n });\n\n const body = this.bodyBuilder.build({\n model,\n params: {\n ...params,\n limit,\n after: decodeCursor(params.after)\n }\n });\n\n let response: OpenSearchSearchResponse;\n try {\n response = await this.elasticsearch.search({\n index,\n body\n });\n } catch (error) {\n /**\n * We will silently ignore the `index_not_found_exception` error and return an empty result set.\n * This is because the index might not exist yet, and we don't want to throw an error.\n */\n if (shouldIgnoreEsResponseError(error)) {\n return {\n hasMoreItems: false,\n totalCount: 0,\n cursor: null,\n items: []\n };\n }\n\n throw new WebinyError(error.message, error.code || \"OPENSEARCH_ERROR\", {\n error,\n index,\n body,\n model\n });\n }\n\n const { hits, total } = response.body.hits;\n\n const items = extractEntriesFromIndex<T>({\n fieldRegistry: this.fieldRegistry,\n fieldIndexRegistry: this.fieldIndexRegistry,\n model,\n entries: hits.map(item => {\n return item._source as CmsIndexEntry<T>;\n })\n }).map(item => {\n return convertEntryKeysFromStorage<T>({\n model,\n entry: item\n });\n });\n\n const hasMoreItems = items.length > limit;\n if (hasMoreItems) {\n /**\n * Remove the last item from results, we don't want to include it.\n */\n items.pop();\n }\n /**\n * Cursor is the `sort` value of the last item in the array.\n * https://www.elastic.co/guide/en/elasticsearch/reference/current/paginate-search-results.html#search-after\n */\n /**\n * TODO expect errors over hit properties is required due to opensearch library narrowing types too much because of the _source: false. At least what Claude says, didnt go into it too much.\n * Properties are there, but types are not correct.\n */\n // @ts-expect-error\n const cursor = items.length > 0 ? encodeCursor(hits[items.length - 1].sort) || null : null;\n return {\n hasMoreItems,\n totalCount: getTotalCount(total),\n cursor,\n items\n };\n }\n}\n\nexport const DdbEsListEntries = ListEntriesStorageOperation.createImplementation({\n implementation: DdbEsListEntriesImpl,\n dependencies: [\n CmsStorageModelProvider,\n CmsEntryOpenSearchBodyBuilder,\n CmsModelFieldToGraphQLRegistry,\n CmsEntryOpenSearchFieldIndexRegistry,\n OpenSearchClient,\n CmsModelOpenSearchIndexProvider\n ]\n});\n"],"names":["DdbEsListEntriesImpl","storageModelProvider","bodyBuilder","fieldRegistry","fieldIndexRegistry","openSearchClient","indexProvider","initialModel","params","model","limit","createLimit","configurations","createConfigurations","index","body","decodeCursor","response","error","shouldIgnoreEsResponseError","WebinyError","hits","total","items","extractEntriesFromIndex","item","convertEntryKeysFromStorage","hasMoreItems","cursor","encodeCursor","getTotalCount","DdbEsListEntries","ListEntriesStorageOperation","CmsStorageModelProvider","CmsEntryOpenSearchBodyBuilder","CmsModelFieldToGraphQLRegistry","CmsEntryOpenSearchFieldIndexRegistry","OpenSearchClient","CmsModelOpenSearchIndexProvider"],"mappings":";;;;;;;;;;;;AAyBA,MAAMA;IAGF,YACYC,oBAAuD,EACvDC,WAAoD,EACpDC,aAAuD,EACvDC,kBAAkE,EAC1EC,gBAA4C,EACpCC,aAAwD,CAClE;aANUL,oBAAoB,GAApBA;aACAC,WAAW,GAAXA;aACAC,aAAa,GAAbA;aACAC,kBAAkB,GAAlBA;aAEAE,aAAa,GAAbA;QAER,IAAI,CAAC,aAAa,GAAGD,iBAAiB,GAAG;IAC7C;IAEA,MAAM,QACFE,YAAsB,EACtBC,MAA2C,EAC7C;QACE,MAAMC,QAAQ,IAAI,CAAC,oBAAoB,CAAC,QAAQ,CAAIF;QAEpD,MAAMG,QAAQC,YAAYH,OAAO,KAAK,EAAE;QACxC,MAAMI,iBAAiBC,qBAAqB,IAAI,CAAC,aAAa;QAC9D,MAAM,EAAEC,KAAK,EAAE,GAAG,MAAMF,eAAe,EAAE,CAAC;YACtCH;QACJ;QAEA,MAAMM,OAAO,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC;YAChCN;YACA,QAAQ;gBACJ,GAAGD,MAAM;gBACTE;gBACA,OAAOM,aAAaR,OAAO,KAAK;YACpC;QACJ;QAEA,IAAIS;QACJ,IAAI;YACAA,WAAW,MAAM,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC;gBACvCH;gBACAC;YACJ;QACJ,EAAE,OAAOG,OAAO;YAKZ,IAAIC,4BAA4BD,QAC5B,OAAO;gBACH,cAAc;gBACd,YAAY;gBACZ,QAAQ;gBACR,OAAO,EAAE;YACb;YAGJ,MAAM,IAAIE,cAAYF,MAAM,OAAO,EAAEA,MAAM,IAAI,IAAI,oBAAoB;gBACnEA;gBACAJ;gBACAC;gBACAN;YACJ;QACJ;QAEA,MAAM,EAAEY,IAAI,EAAEC,KAAK,EAAE,GAAGL,SAAS,IAAI,CAAC,IAAI;QAE1C,MAAMM,QAAQC,wBAA2B;YACrC,eAAe,IAAI,CAAC,aAAa;YACjC,oBAAoB,IAAI,CAAC,kBAAkB;YAC3Cf;YACA,SAASY,KAAK,GAAG,CAACI,CAAAA,OACPA,KAAK,OAAO;QAE3B,GAAG,GAAG,CAACA,CAAAA,OACIC,4BAA+B;gBAClCjB;gBACA,OAAOgB;YACX;QAGJ,MAAME,eAAeJ,MAAM,MAAM,GAAGb;QACpC,IAAIiB,cAIAJ,MAAM,GAAG;QAWb,MAAMK,SAASL,MAAM,MAAM,GAAG,IAAIM,aAAaR,IAAI,CAACE,MAAM,MAAM,GAAG,EAAE,CAAC,IAAI,KAAK,OAAO;QACtF,OAAO;YACHI;YACA,YAAYG,cAAcR;YAC1BM;YACAL;QACJ;IACJ;AACJ;AAEO,MAAMQ,mBAAmBC,4BAA4B,oBAAoB,CAAC;IAC7E,gBAAgBhC;IAChB,cAAc;QACViC;QACAC;QACAC;QACAC;QACAC;QACAC;KACH;AACL"}
|