@webiny/api-headless-cms-ddb-es 0.0.0-unstable.eb196ccd2f → 0.0.0-unstable.eb81deee7e
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 -6
- package/definitions/entry.js +8 -179
- package/definitions/entry.js.map +1 -1
- package/definitions/group.d.ts +6 -7
- package/definitions/group.js +8 -63
- package/definitions/group.js.map +1 -1
- package/definitions/model.d.ts +6 -7
- package/definitions/model.js +8 -107
- package/definitions/model.js.map +1 -1
- package/definitions/types.d.ts +65 -0
- package/definitions/types.js +0 -0
- package/feature.d.ts +9 -0
- package/feature.js +55 -0
- package/feature.js.map +1 -0
- package/index.d.ts +2 -3
- package/index.js +2 -225
- 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 +1 -2
- package/operations/entry/dataLoader/DataLoaderCache.js +21 -35
- package/operations/entry/dataLoader/DataLoaderCache.js.map +1 -1
- package/operations/entry/dataLoader/constants.js +2 -7
- package/operations/entry/dataLoader/constants.js.map +1 -1
- package/operations/entry/dataLoader/createBatchScheduleFn.js +7 -22
- package/operations/entry/dataLoader/createBatchScheduleFn.js.map +1 -1
- package/operations/entry/dataLoader/getAllEntryRevisions.d.ts +3 -3
- package/operations/entry/dataLoader/getAllEntryRevisions.js +20 -41
- package/operations/entry/dataLoader/getAllEntryRevisions.js.map +1 -1
- package/operations/entry/dataLoader/getLatestRevisionByEntryId.d.ts +3 -3
- package/operations/entry/dataLoader/getLatestRevisionByEntryId.js +30 -48
- package/operations/entry/dataLoader/getLatestRevisionByEntryId.js.map +1 -1
- package/operations/entry/dataLoader/getPublishedRevisionByEntryId.d.ts +3 -3
- package/operations/entry/dataLoader/getPublishedRevisionByEntryId.js +30 -48
- package/operations/entry/dataLoader/getPublishedRevisionByEntryId.js.map +1 -1
- package/operations/entry/dataLoader/getRevisionById.d.ts +3 -3
- package/operations/entry/dataLoader/getRevisionById.js +36 -58
- package/operations/entry/dataLoader/getRevisionById.js.map +1 -1
- package/operations/entry/dataLoader/index.d.ts +3 -3
- package/operations/entry/dataLoader/index.js +13 -35
- package/operations/entry/dataLoader/index.js.map +1 -1
- package/operations/entry/dataLoader/types.d.ts +4 -4
- package/operations/entry/dataLoader/types.js +0 -7
- package/operations/entry/dataLoaders.d.ts +14 -14
- package/operations/entry/dataLoaders.js +92 -110
- package/operations/entry/dataLoaders.js.map +1 -1
- package/operations/entry/feature.d.ts +4 -0
- package/operations/entry/feature.js +53 -0
- package/operations/entry/feature.js.map +1 -0
- package/operations/entry/keys.d.ts +31 -1
- package/operations/entry/keys.js +44 -27
- package/operations/entry/keys.js.map +1 -1
- package/operations/entry/recordType.js +4 -18
- 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 +6 -6
- package/operations/entry/transformations/convertEntryKeys.js +21 -34
- package/operations/entry/transformations/convertEntryKeys.js.map +1 -1
- package/operations/entry/transformations/index.d.ts +21 -18
- package/operations/entry/transformations/index.js +87 -123
- package/operations/entry/transformations/index.js.map +1 -1
- package/operations/entry/transformations/modifyEntryValues.d.ts +30 -35
- package/operations/entry/transformations/modifyEntryValues.js +12 -24
- package/operations/entry/transformations/modifyEntryValues.js.map +1 -1
- package/operations/entry/transformations/transformEntryKeys.d.ts +8 -8
- package/operations/entry/transformations/transformEntryKeys.js +14 -24
- package/operations/entry/transformations/transformEntryKeys.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/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 +40 -36
- package/requestFeature.d.ts +20 -0
- package/requestFeature.js +54 -0
- package/requestFeature.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 +12 -159
- package/types.js +7 -39
- package/types.js.map +1 -1
- package/configurations.d.ts +0 -19
- package/configurations.js +0 -49
- package/configurations.js.map +0 -1
- package/definitions/entryElasticsearch.d.ts +0 -9
- package/definitions/entryElasticsearch.js +0 -41
- package/definitions/entryElasticsearch.js.map +0 -1
- package/definitions/system.d.ts +0 -9
- package/definitions/system.js +0 -42
- package/definitions/system.js.map +0 -1
- package/definitions/table.d.ts +0 -8
- package/definitions/table.js +0 -25
- package/definitions/table.js.map +0 -1
- package/definitions/tableElasticsearch.d.ts +0 -8
- package/definitions/tableElasticsearch.js +0 -25
- package/definitions/tableElasticsearch.js.map +0 -1
- package/dynamoDb/index.d.ts +0 -3
- package/dynamoDb/index.js +0 -16
- package/dynamoDb/index.js.map +0 -1
- package/dynamoDb/storage/longText.d.ts +0 -10
- package/dynamoDb/storage/longText.js +0 -96
- package/dynamoDb/storage/longText.js.map +0 -1
- package/dynamoDb/storage/richText.d.ts +0 -2
- package/dynamoDb/storage/richText.js +0 -59
- package/dynamoDb/storage/richText.js.map +0 -1
- package/elasticsearch/createElasticsearchIndex.d.ts +0 -9
- package/elasticsearch/createElasticsearchIndex.js +0 -40
- package/elasticsearch/createElasticsearchIndex.js.map +0 -1
- package/elasticsearch/deleteElasticsearchIndex.d.ts +0 -8
- package/elasticsearch/deleteElasticsearchIndex.js +0 -38
- package/elasticsearch/deleteElasticsearchIndex.js.map +0 -1
- package/elasticsearch/index.d.ts +0 -2
- package/elasticsearch/index.js +0 -13
- package/elasticsearch/index.js.map +0 -1
- package/elasticsearch/indexing/dateTimeIndexing.d.ts +0 -3
- package/elasticsearch/indexing/dateTimeIndexing.js +0 -88
- package/elasticsearch/indexing/dateTimeIndexing.js.map +0 -1
- package/elasticsearch/indexing/defaultFieldIndexing.d.ts +0 -3
- package/elasticsearch/indexing/defaultFieldIndexing.js +0 -54
- package/elasticsearch/indexing/defaultFieldIndexing.js.map +0 -1
- package/elasticsearch/indexing/index.d.ts +0 -2
- package/elasticsearch/indexing/index.js +0 -18
- package/elasticsearch/indexing/index.js.map +0 -1
- package/elasticsearch/indexing/jsonIndexing.d.ts +0 -2
- package/elasticsearch/indexing/jsonIndexing.js +0 -28
- package/elasticsearch/indexing/jsonIndexing.js.map +0 -1
- package/elasticsearch/indexing/longTextIndexing.d.ts +0 -7
- package/elasticsearch/indexing/longTextIndexing.js +0 -42
- package/elasticsearch/indexing/longTextIndexing.js.map +0 -1
- package/elasticsearch/indexing/numberIndexing.d.ts +0 -3
- package/elasticsearch/indexing/numberIndexing.js +0 -41
- package/elasticsearch/indexing/numberIndexing.js.map +0 -1
- package/elasticsearch/indexing/objectIndexing.d.ts +0 -12
- package/elasticsearch/indexing/objectIndexing.js +0 -201
- package/elasticsearch/indexing/objectIndexing.js.map +0 -1
- package/elasticsearch/indexing/richTextIndexing.d.ts +0 -3
- package/elasticsearch/indexing/richTextIndexing.js +0 -31
- package/elasticsearch/indexing/richTextIndexing.js.map +0 -1
- package/elasticsearch/indices/base.d.ts +0 -2
- package/elasticsearch/indices/base.js +0 -13
- package/elasticsearch/indices/base.js.map +0 -1
- package/elasticsearch/indices/index.d.ts +0 -1
- package/elasticsearch/indices/index.js +0 -14
- package/elasticsearch/indices/index.js.map +0 -1
- package/elasticsearch/indices/japanese.d.ts +0 -2
- package/elasticsearch/indices/japanese.js +0 -14
- package/elasticsearch/indices/japanese.js.map +0 -1
- package/elasticsearch/search/index.d.ts +0 -3
- package/elasticsearch/search/index.js +0 -13
- package/elasticsearch/search/index.js.map +0 -1
- package/elasticsearch/search/refSearch.d.ts +0 -2
- package/elasticsearch/search/refSearch.js +0 -31
- package/elasticsearch/search/refSearch.js.map +0 -1
- package/elasticsearch/search/searchableJson.d.ts +0 -2
- package/elasticsearch/search/searchableJson.js +0 -60
- package/elasticsearch/search/searchableJson.js.map +0 -1
- package/elasticsearch/search/timeSearch.d.ts +0 -2
- package/elasticsearch/search/timeSearch.js +0 -27
- package/elasticsearch/search/timeSearch.js.map +0 -1
- package/helpers/entryIndexHelpers.d.ts +0 -18
- package/helpers/entryIndexHelpers.js +0 -190
- package/helpers/entryIndexHelpers.js.map +0 -1
- package/helpers/fieldIdentifier.d.ts +0 -6
- package/helpers/fieldIdentifier.js +0 -43
- package/helpers/fieldIdentifier.js.map +0 -1
- package/helpers/index.d.ts +0 -2
- package/helpers/index.js +0 -29
- package/helpers/index.js.map +0 -1
- package/index.js.map +0 -1
- package/operations/entry/dataLoader/types.js.map +0 -1
- package/operations/entry/elasticsearch/assignMinimumShouldMatchToQuery.d.ts +0 -18
- package/operations/entry/elasticsearch/assignMinimumShouldMatchToQuery.js +0 -34
- 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 -142
- package/operations/entry/elasticsearch/body.js.map +0 -1
- package/operations/entry/elasticsearch/fields.d.ts +0 -10
- package/operations/entry/elasticsearch/fields.js +0 -315
- 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 -60
- 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 -175
- 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 -18
- package/operations/entry/elasticsearch/filtering/index.js.map +0 -1
- package/operations/entry/elasticsearch/filtering/path.d.ts +0 -16
- package/operations/entry/elasticsearch/filtering/path.js +0 -48
- 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 -30
- 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 -15
- 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 -69
- 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 -57
- 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 -25
- 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 -24
- 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 -91
- 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 -27
- 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 -106
- 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 -36
- package/operations/entry/elasticsearch/keyword.js.map +0 -1
- package/operations/entry/elasticsearch/logIgnoredEsResponseError.d.ts +0 -9
- package/operations/entry/elasticsearch/logIgnoredEsResponseError.js +0 -26
- package/operations/entry/elasticsearch/logIgnoredEsResponseError.js.map +0 -1
- package/operations/entry/elasticsearch/plugins/bodyModifier.d.ts +0 -9
- package/operations/entry/elasticsearch/plugins/bodyModifier.js +0 -18
- 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 -39
- 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 -18
- 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 -26
- 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 -18
- package/operations/entry/elasticsearch/plugins/sortModifier.js.map +0 -1
- package/operations/entry/elasticsearch/shouldIgnoreEsResponseError.d.ts +0 -2
- package/operations/entry/elasticsearch/shouldIgnoreEsResponseError.js +0 -13
- 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 -89
- 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 -32
- 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 -7
- package/operations/entry/elasticsearch/types.js.map +0 -1
- package/operations/entry/index.d.ts +0 -11
- package/operations/entry/index.js +0 -1881
- package/operations/entry/index.js.map +0 -1
- package/operations/entry/transformations/transformEntryToIndex.d.ts +0 -10
- package/operations/entry/transformations/transformEntryToIndex.js +0 -31
- package/operations/entry/transformations/transformEntryToIndex.js.map +0 -1
- package/operations/group/index.d.ts +0 -8
- package/operations/group/index.js +0 -179
- package/operations/group/index.js.map +0 -1
- package/operations/model/index.d.ts +0 -8
- package/operations/model/index.js +0 -183
- package/operations/model/index.js.map +0 -1
- package/operations/system/index.d.ts +0 -6
- package/operations/system/index.js +0 -94
- package/operations/system/index.js.map +0 -1
- package/operations/system/indexes.d.ts +0 -10
- package/operations/system/indexes.js +0 -41
- package/operations/system/indexes.js.map +0 -1
- package/plugins/CmsElasticsearchModelFieldPlugin.d.ts +0 -69
- package/plugins/CmsElasticsearchModelFieldPlugin.js +0 -52
- package/plugins/CmsElasticsearchModelFieldPlugin.js.map +0 -1
- package/plugins/CmsEntryElasticsearchBodyModifierPlugin.d.ts +0 -22
- package/plugins/CmsEntryElasticsearchBodyModifierPlugin.js +0 -21
- package/plugins/CmsEntryElasticsearchBodyModifierPlugin.js.map +0 -1
- package/plugins/CmsEntryElasticsearchFullTextSearchPlugin.d.ts +0 -23
- package/plugins/CmsEntryElasticsearchFullTextSearchPlugin.js +0 -27
- package/plugins/CmsEntryElasticsearchFullTextSearchPlugin.js.map +0 -1
- package/plugins/CmsEntryElasticsearchIndexPlugin.d.ts +0 -4
- package/plugins/CmsEntryElasticsearchIndexPlugin.js +0 -13
- package/plugins/CmsEntryElasticsearchIndexPlugin.js.map +0 -1
- package/plugins/CmsEntryElasticsearchQueryBuilderValueSearchPlugin.d.ts +0 -32
- package/plugins/CmsEntryElasticsearchQueryBuilderValueSearchPlugin.js +0 -40
- package/plugins/CmsEntryElasticsearchQueryBuilderValueSearchPlugin.js.map +0 -1
- package/plugins/CmsEntryElasticsearchQueryModifierPlugin.d.ts +0 -19
- package/plugins/CmsEntryElasticsearchQueryModifierPlugin.js +0 -21
- package/plugins/CmsEntryElasticsearchQueryModifierPlugin.js.map +0 -1
- package/plugins/CmsEntryElasticsearchSortModifierPlugin.d.ts +0 -19
- package/plugins/CmsEntryElasticsearchSortModifierPlugin.js +0 -21
- package/plugins/CmsEntryElasticsearchSortModifierPlugin.js.map +0 -1
- package/plugins/CmsEntryElasticsearchValuesModifier.d.ts +0 -33
- package/plugins/CmsEntryElasticsearchValuesModifier.js +0 -50
- package/plugins/CmsEntryElasticsearchValuesModifier.js.map +0 -1
- package/plugins/CmsEntryFilterPlugin.d.ts +0 -49
- package/plugins/CmsEntryFilterPlugin.js +0 -22
- package/plugins/CmsEntryFilterPlugin.js.map +0 -1
- package/plugins/index.d.ts +0 -8
- package/plugins/index.js +0 -95
- package/plugins/index.js.map +0 -1
- package/tasks/createIndexTaskPlugin.d.ts +0 -2
- package/tasks/createIndexTaskPlugin.js +0 -67
- package/tasks/createIndexTaskPlugin.js.map +0 -1
- package/values/NoValueContainer.d.ts +0 -5
- package/values/NoValueContainer.js +0 -20
- package/values/NoValueContainer.js.map +0 -1
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { CmsModel, CmsEntryValues, CmsEntryStorageOperationsGetParams } from "@webiny/api-headless-cms/types/index.js";
|
|
2
|
+
import { GetEntryStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/entry/GetEntryStorageOperation.js";
|
|
3
|
+
import { ListEntriesStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/entry/ListEntriesStorageOperation.js";
|
|
4
|
+
import { CmsStorageModelProvider } from "@webiny/api-headless-cms/features/shared/abstractions.js";
|
|
5
|
+
declare class DdbEsGetEntryImpl implements GetEntryStorageOperation.Interface {
|
|
6
|
+
private listEntries;
|
|
7
|
+
private storageModelProvider;
|
|
8
|
+
constructor(listEntries: ListEntriesStorageOperation.Interface, storageModelProvider: CmsStorageModelProvider.Interface);
|
|
9
|
+
execute<T extends CmsEntryValues = CmsEntryValues>(initialModel: CmsModel, params: CmsEntryStorageOperationsGetParams): Promise<import("@webiny/api-headless-cms/types/types").CmsEntry<T> | null>;
|
|
10
|
+
}
|
|
11
|
+
export declare const DdbEsGetEntry: typeof DdbEsGetEntryImpl & {
|
|
12
|
+
__abstraction: import("@webiny/di").Abstraction<import("@webiny/api-headless-cms/features/shared/storageOperations/entry/GetEntryStorageOperation.js").IGetEntryStorageOperation>;
|
|
13
|
+
};
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { GetEntryStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/entry/GetEntryStorageOperation.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
|
+
class DdbEsGetEntryImpl {
|
|
5
|
+
constructor(listEntries, storageModelProvider){
|
|
6
|
+
this.listEntries = listEntries;
|
|
7
|
+
this.storageModelProvider = storageModelProvider;
|
|
8
|
+
}
|
|
9
|
+
async execute(initialModel, params) {
|
|
10
|
+
const model = this.storageModelProvider.getModel(initialModel);
|
|
11
|
+
const { items } = await this.listEntries.execute(model, {
|
|
12
|
+
...params,
|
|
13
|
+
limit: 1
|
|
14
|
+
});
|
|
15
|
+
return items.shift() || null;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
const DdbEsGetEntry = GetEntryStorageOperation.createImplementation({
|
|
19
|
+
implementation: DdbEsGetEntryImpl,
|
|
20
|
+
dependencies: [
|
|
21
|
+
ListEntriesStorageOperation,
|
|
22
|
+
CmsStorageModelProvider
|
|
23
|
+
]
|
|
24
|
+
});
|
|
25
|
+
export { DdbEsGetEntry };
|
|
26
|
+
|
|
27
|
+
//# sourceMappingURL=DdbEsGetEntry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operations/entry/DdbEsGetEntry.js","sources":["../../../src/operations/entry/DdbEsGetEntry.ts"],"sourcesContent":["import type {\n CmsModel,\n CmsEntryValues,\n CmsEntryStorageOperationsGetParams\n} from \"@webiny/api-headless-cms/types/index.js\";\nimport { GetEntryStorageOperation } from \"@webiny/api-headless-cms/features/shared/storageOperations/entry/GetEntryStorageOperation.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\";\n\nclass DdbEsGetEntryImpl implements GetEntryStorageOperation.Interface {\n constructor(\n private listEntries: ListEntriesStorageOperation.Interface,\n private storageModelProvider: CmsStorageModelProvider.Interface\n ) {}\n\n async execute<T extends CmsEntryValues = CmsEntryValues>(\n initialModel: CmsModel,\n params: CmsEntryStorageOperationsGetParams\n ) {\n const model = this.storageModelProvider.getModel(initialModel);\n\n const { items } = await this.listEntries.execute<T>(model, {\n ...params,\n limit: 1\n });\n return items.shift() || null;\n }\n}\n\nexport const DdbEsGetEntry = GetEntryStorageOperation.createImplementation({\n implementation: DdbEsGetEntryImpl,\n dependencies: [ListEntriesStorageOperation, CmsStorageModelProvider]\n});\n"],"names":["DdbEsGetEntryImpl","listEntries","storageModelProvider","initialModel","params","model","items","DdbEsGetEntry","GetEntryStorageOperation","ListEntriesStorageOperation","CmsStorageModelProvider"],"mappings":";;;AASA,MAAMA;IACF,YACYC,WAAkD,EAClDC,oBAAuD,CACjE;aAFUD,WAAW,GAAXA;aACAC,oBAAoB,GAApBA;IACT;IAEH,MAAM,QACFC,YAAsB,EACtBC,MAA0C,EAC5C;QACE,MAAMC,QAAQ,IAAI,CAAC,oBAAoB,CAAC,QAAQ,CAACF;QAEjD,MAAM,EAAEG,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,OAAO,CAAID,OAAO;YACvD,GAAGD,MAAM;YACT,OAAO;QACX;QACA,OAAOE,MAAM,KAAK,MAAM;IAC5B;AACJ;AAEO,MAAMC,gBAAgBC,yBAAyB,oBAAoB,CAAC;IACvE,gBAAgBR;IAChB,cAAc;QAACS;QAA6BC;KAAwB;AACxE"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { CmsModel, CmsEntryValues, CmsEntryStorageOperationsGetLatestByIdsParams } from "@webiny/api-headless-cms/types/index.js";
|
|
2
|
+
import { GetLatestEntriesByIdsStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/entry/GetLatestEntriesByIdsStorageOperation.js";
|
|
3
|
+
import { CmsDdbEsDataLoaders } from "../../abstractions/CmsDdbEsDataLoaders.js";
|
|
4
|
+
import { CmsStorageModelProvider } from "@webiny/api-headless-cms/features/shared/abstractions.js";
|
|
5
|
+
declare class DdbEsGetLatestEntriesByIdsImpl implements GetLatestEntriesByIdsStorageOperation.Interface {
|
|
6
|
+
private dataLoaders;
|
|
7
|
+
private storageModelProvider;
|
|
8
|
+
constructor(dataLoaders: CmsDdbEsDataLoaders.Interface, storageModelProvider: CmsStorageModelProvider.Interface);
|
|
9
|
+
execute<T extends CmsEntryValues = CmsEntryValues>(initialModel: CmsModel, params: CmsEntryStorageOperationsGetLatestByIdsParams): Promise<import("@webiny/api-headless-cms/types/types.js").CmsStorageEntry<T>[]>;
|
|
10
|
+
}
|
|
11
|
+
export declare const DdbEsGetLatestEntriesByIds: typeof DdbEsGetLatestEntriesByIdsImpl & {
|
|
12
|
+
__abstraction: import("@webiny/di").Abstraction<import("@webiny/api-headless-cms/features/shared/storageOperations/entry/GetLatestEntriesByIdsStorageOperation.js").IGetLatestEntriesByIdsStorageOperation>;
|
|
13
|
+
};
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { GetLatestEntriesByIdsStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/entry/GetLatestEntriesByIdsStorageOperation.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 DdbEsGetLatestEntriesByIdsImpl {
|
|
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.getLatestRevisionByEntryId({
|
|
13
|
+
model,
|
|
14
|
+
ids: params.ids
|
|
15
|
+
});
|
|
16
|
+
return entries.map((entry)=>convertEntryKeysFromStorage({
|
|
17
|
+
model,
|
|
18
|
+
entry
|
|
19
|
+
}));
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
const DdbEsGetLatestEntriesByIds = GetLatestEntriesByIdsStorageOperation.createImplementation({
|
|
23
|
+
implementation: DdbEsGetLatestEntriesByIdsImpl,
|
|
24
|
+
dependencies: [
|
|
25
|
+
CmsDdbEsDataLoaders,
|
|
26
|
+
CmsStorageModelProvider
|
|
27
|
+
]
|
|
28
|
+
});
|
|
29
|
+
export { DdbEsGetLatestEntriesByIds };
|
|
30
|
+
|
|
31
|
+
//# sourceMappingURL=DdbEsGetLatestEntriesByIds.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operations/entry/DdbEsGetLatestEntriesByIds.js","sources":["../../../src/operations/entry/DdbEsGetLatestEntriesByIds.ts"],"sourcesContent":["import type {\n CmsModel,\n CmsEntryValues,\n CmsEntryStorageOperationsGetLatestByIdsParams\n} from \"@webiny/api-headless-cms/types/index.js\";\nimport { GetLatestEntriesByIdsStorageOperation } from \"@webiny/api-headless-cms/features/shared/storageOperations/entry/GetLatestEntriesByIdsStorageOperation.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 DdbEsGetLatestEntriesByIdsImpl implements GetLatestEntriesByIdsStorageOperation.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: CmsEntryStorageOperationsGetLatestByIdsParams\n ) {\n const model = this.storageModelProvider.getModel<T>(initialModel);\n\n const entries = await this.dataLoaders.getLatestRevisionByEntryId<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 DdbEsGetLatestEntriesByIds =\n GetLatestEntriesByIdsStorageOperation.createImplementation({\n implementation: DdbEsGetLatestEntriesByIdsImpl,\n dependencies: [CmsDdbEsDataLoaders, CmsStorageModelProvider]\n });\n"],"names":["DdbEsGetLatestEntriesByIdsImpl","dataLoaders","storageModelProvider","initialModel","params","model","entries","entry","convertEntryKeysFromStorage","DdbEsGetLatestEntriesByIds","GetLatestEntriesByIdsStorageOperation","CmsDdbEsDataLoaders","CmsStorageModelProvider"],"mappings":";;;;AAUA,MAAMA;IACF,YACYC,WAA0C,EAC1CC,oBAAuD,CACjE;aAFUD,WAAW,GAAXA;aACAC,oBAAoB,GAApBA;IACT;IAEH,MAAM,QACFC,YAAsB,EACtBC,MAAqD,EACvD;QACE,MAAMC,QAAQ,IAAI,CAAC,oBAAoB,CAAC,QAAQ,CAAIF;QAEpD,MAAMG,UAAU,MAAM,IAAI,CAAC,WAAW,CAAC,0BAA0B,CAAI;YACjED;YACA,KAAKD,OAAO,GAAG;QACnB;QAEA,OAAOE,QAAQ,GAAG,CAACC,CAAAA,QACRC,4BAA+B;gBAClCH;gBACAE;YACJ;IAER;AACJ;AAEO,MAAME,6BACTC,sCAAsC,oBAAoB,CAAC;IACvD,gBAAgBV;IAChB,cAAc;QAACW;QAAqBC;KAAwB;AAChE"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { CmsModel, CmsEntryValues, CmsEntryStorageOperationsGetLatestRevisionParams } from "@webiny/api-headless-cms/types/index.js";
|
|
2
|
+
import { GetLatestRevisionByEntryIdStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/entry/GetLatestRevisionByEntryIdStorageOperation.js";
|
|
3
|
+
import { CmsDdbEsDataLoaders } from "../../abstractions/CmsDdbEsDataLoaders.js";
|
|
4
|
+
import { CmsStorageModelProvider } from "@webiny/api-headless-cms/features/shared/abstractions.js";
|
|
5
|
+
declare class DdbEsGetLatestRevisionByEntryIdImpl implements GetLatestRevisionByEntryIdStorageOperation.Interface {
|
|
6
|
+
private dataLoaders;
|
|
7
|
+
private storageModelProvider;
|
|
8
|
+
constructor(dataLoaders: CmsDdbEsDataLoaders.Interface, storageModelProvider: CmsStorageModelProvider.Interface);
|
|
9
|
+
execute<T extends CmsEntryValues = CmsEntryValues>(initialModel: CmsModel, params: CmsEntryStorageOperationsGetLatestRevisionParams): Promise<import("@webiny/api-headless-cms/types/types.js").CmsStorageEntry<T> | null>;
|
|
10
|
+
}
|
|
11
|
+
export declare const DdbEsGetLatestRevisionByEntryId: typeof DdbEsGetLatestRevisionByEntryIdImpl & {
|
|
12
|
+
__abstraction: import("@webiny/di").Abstraction<import("@webiny/api-headless-cms/features/shared/storageOperations/entry/GetLatestRevisionByEntryIdStorageOperation.js").IGetLatestRevisionByEntryIdStorageOperation>;
|
|
13
|
+
};
|
|
14
|
+
export {};
|
|
@@ -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"}
|