@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,24 @@
|
|
|
1
|
+
import type { CmsModel, CmsEntryValues, CmsEntryStorageOperationsUpdateParams } from "@webiny/api-headless-cms/types/index.js";
|
|
2
|
+
import { UpdateEntryStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/entry/UpdateEntryStorageOperation.js";
|
|
3
|
+
import { CmsDdbEsEntryEntity } from "../../abstractions/CmsDdbEsEntryEntity.js";
|
|
4
|
+
import { CmsDdbEsEntriesEsEntity } from "../../abstractions/CmsDdbEsEntriesEsEntity.js";
|
|
5
|
+
import { CmsDdbEsDataLoaders } from "../../abstractions/CmsDdbEsDataLoaders.js";
|
|
6
|
+
import { CmsStorageModelProvider } from "@webiny/api-headless-cms/features/shared/abstractions.js";
|
|
7
|
+
import { CmsEntryOpenSearchFieldIndexRegistry, CmsEntryOpenSearchValuesModifier, CmsModelOpenSearchIndexProvider } from "@webiny/api-headless-cms-utils-os/exports/api/cms/opensearch.js";
|
|
8
|
+
import { CompressionHandler } from "@webiny/utils/exports/api.js";
|
|
9
|
+
declare class DdbEsUpdateEntryImpl implements UpdateEntryStorageOperation.Interface {
|
|
10
|
+
private entity;
|
|
11
|
+
private esEntity;
|
|
12
|
+
private dataLoaders;
|
|
13
|
+
private storageModelProvider;
|
|
14
|
+
private fieldIndexRegistry;
|
|
15
|
+
private compressionHandler;
|
|
16
|
+
private indexProvider;
|
|
17
|
+
private valuesModifiers;
|
|
18
|
+
constructor(entity: CmsDdbEsEntryEntity.Interface, esEntity: CmsDdbEsEntriesEsEntity.Interface, dataLoaders: CmsDdbEsDataLoaders.Interface, storageModelProvider: CmsStorageModelProvider.Interface, fieldIndexRegistry: CmsEntryOpenSearchFieldIndexRegistry.Interface, compressionHandler: CompressionHandler.Interface, indexProvider: CmsModelOpenSearchIndexProvider.Interface, valuesModifiers: CmsEntryOpenSearchValuesModifier.Interface[]);
|
|
19
|
+
execute<T extends CmsEntryValues = CmsEntryValues>(initialModel: CmsModel, params: CmsEntryStorageOperationsUpdateParams<T>): Promise<import("@webiny/api-headless-cms/types/types.js").CmsStorageEntry<T>>;
|
|
20
|
+
}
|
|
21
|
+
export declare const DdbEsUpdateEntry: typeof DdbEsUpdateEntryImpl & {
|
|
22
|
+
__abstraction: import("@webiny/di").Abstraction<import("@webiny/api-headless-cms/features/shared/storageOperations/entry/UpdateEntryStorageOperation.js").IUpdateEntryStorageOperation>;
|
|
23
|
+
};
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import error from "@webiny/error";
|
|
2
|
+
import { UpdateEntryStorageOperation } from "@webiny/api-headless-cms/features/shared/storageOperations/entry/UpdateEntryStorageOperation.js";
|
|
3
|
+
import { CmsDdbEsEntryEntity } from "../../abstractions/CmsDdbEsEntryEntity.js";
|
|
4
|
+
import { CmsDdbEsEntriesEsEntity } from "../../abstractions/CmsDdbEsEntriesEsEntity.js";
|
|
5
|
+
import { CmsDdbEsDataLoaders } from "../../abstractions/CmsDdbEsDataLoaders.js";
|
|
6
|
+
import { CmsStorageModelProvider } from "@webiny/api-headless-cms/features/shared/abstractions.js";
|
|
7
|
+
import { CmsEntryOpenSearchFieldIndexRegistry, CmsEntryOpenSearchValuesModifier, CmsModelOpenSearchIndexProvider } from "@webiny/api-headless-cms-utils-os/exports/api/cms/opensearch.js";
|
|
8
|
+
import { CompressionHandler } from "@webiny/utils/exports/api.js";
|
|
9
|
+
import { createConfigurations } from "@webiny/api-headless-cms-utils-os/configurations.js";
|
|
10
|
+
import { createTransformer } from "./transformations/index.js";
|
|
11
|
+
import { createEntryLatestKeys, createEntryPublishedKeys, createEntryRevisionKeys, createPartitionKey, createRevisionSortKey } from "./keys.js";
|
|
12
|
+
import { isEntryLevelEntryMetaField, pickEntryMetaFields } from "@webiny/api-headless-cms/constants.js";
|
|
13
|
+
class DdbEsUpdateEntryImpl {
|
|
14
|
+
constructor(entity, esEntity, dataLoaders, storageModelProvider, fieldIndexRegistry, compressionHandler, indexProvider, valuesModifiers){
|
|
15
|
+
this.entity = entity;
|
|
16
|
+
this.esEntity = esEntity;
|
|
17
|
+
this.dataLoaders = dataLoaders;
|
|
18
|
+
this.storageModelProvider = storageModelProvider;
|
|
19
|
+
this.fieldIndexRegistry = fieldIndexRegistry;
|
|
20
|
+
this.compressionHandler = compressionHandler;
|
|
21
|
+
this.indexProvider = indexProvider;
|
|
22
|
+
this.valuesModifiers = valuesModifiers;
|
|
23
|
+
}
|
|
24
|
+
async execute(initialModel, params) {
|
|
25
|
+
const { entry: initialEntry, storageEntry: initialStorageEntry } = params;
|
|
26
|
+
const model = this.storageModelProvider.getModel(initialModel);
|
|
27
|
+
const transformer = createTransformer({
|
|
28
|
+
valuesModifiers: this.valuesModifiers,
|
|
29
|
+
model,
|
|
30
|
+
entry: initialEntry,
|
|
31
|
+
storageEntry: initialStorageEntry,
|
|
32
|
+
fieldIndexRegistry: this.fieldIndexRegistry,
|
|
33
|
+
compressionHandler: this.compressionHandler
|
|
34
|
+
});
|
|
35
|
+
const { entry, storageEntry } = transformer.transformEntryKeys();
|
|
36
|
+
const isPublished = "published" === entry.status;
|
|
37
|
+
const locked = isPublished ? true : entry.locked;
|
|
38
|
+
const revisionKeys = createEntryRevisionKeys(entry);
|
|
39
|
+
const latestKeys = createEntryLatestKeys(entry);
|
|
40
|
+
const publishedKeys = createEntryPublishedKeys(entry);
|
|
41
|
+
const [latestStorageEntry] = await this.dataLoaders.getLatestRevisionByEntryId({
|
|
42
|
+
model,
|
|
43
|
+
ids: [
|
|
44
|
+
entry.id
|
|
45
|
+
]
|
|
46
|
+
});
|
|
47
|
+
const [publishedStorageEntry] = await this.dataLoaders.getPublishedRevisionByEntryId({
|
|
48
|
+
model,
|
|
49
|
+
ids: [
|
|
50
|
+
entry.id
|
|
51
|
+
]
|
|
52
|
+
});
|
|
53
|
+
const entityBatch = this.entity.createEntityWriter({
|
|
54
|
+
put: [
|
|
55
|
+
{
|
|
56
|
+
...revisionKeys,
|
|
57
|
+
data: {
|
|
58
|
+
...storageEntry,
|
|
59
|
+
locked
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
]
|
|
63
|
+
});
|
|
64
|
+
if (isPublished) entityBatch.put({
|
|
65
|
+
...publishedKeys,
|
|
66
|
+
data: {
|
|
67
|
+
...storageEntry,
|
|
68
|
+
locked
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
const elasticsearchEntityBatch = this.esEntity.createEntityWriter();
|
|
72
|
+
const configurations = createConfigurations(this.indexProvider);
|
|
73
|
+
const { index: esIndex } = await configurations.es({
|
|
74
|
+
model
|
|
75
|
+
});
|
|
76
|
+
if (latestStorageEntry) {
|
|
77
|
+
const updatingLatestRevision = latestStorageEntry.id === entry.id;
|
|
78
|
+
if (updatingLatestRevision) {
|
|
79
|
+
entityBatch.put({
|
|
80
|
+
...latestKeys,
|
|
81
|
+
data: storageEntry
|
|
82
|
+
});
|
|
83
|
+
const elasticsearchLatestData = await transformer.getElasticsearchLatestEntryData();
|
|
84
|
+
elasticsearchEntityBatch.put({
|
|
85
|
+
...latestKeys,
|
|
86
|
+
index: esIndex,
|
|
87
|
+
data: elasticsearchLatestData
|
|
88
|
+
});
|
|
89
|
+
} else {
|
|
90
|
+
const updatedEntryLevelMetaFields = pickEntryMetaFields(entry, isEntryLevelEntryMetaField);
|
|
91
|
+
const updatedLatestStorageEntry = {
|
|
92
|
+
...latestKeys,
|
|
93
|
+
data: {
|
|
94
|
+
...latestStorageEntry,
|
|
95
|
+
...updatedEntryLevelMetaFields
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
entityBatch.put({
|
|
99
|
+
...updatedLatestStorageEntry,
|
|
100
|
+
PK: createPartitionKey({
|
|
101
|
+
id: latestStorageEntry.id,
|
|
102
|
+
tenant: model.tenant
|
|
103
|
+
}),
|
|
104
|
+
SK: createRevisionSortKey(latestStorageEntry)
|
|
105
|
+
});
|
|
106
|
+
entityBatch.put({
|
|
107
|
+
...updatedLatestStorageEntry
|
|
108
|
+
});
|
|
109
|
+
const latestEsEntry = await this.esEntity.getClean(latestKeys);
|
|
110
|
+
if (latestEsEntry) {
|
|
111
|
+
const latestEsEntryDataDecompressed = await this.compressionHandler.decompress(latestEsEntry.data);
|
|
112
|
+
const updatedLatestEntry = await this.compressionHandler.compress({
|
|
113
|
+
...latestEsEntryDataDecompressed,
|
|
114
|
+
...updatedEntryLevelMetaFields
|
|
115
|
+
});
|
|
116
|
+
elasticsearchEntityBatch.put({
|
|
117
|
+
...latestKeys,
|
|
118
|
+
index: esIndex,
|
|
119
|
+
data: updatedLatestEntry
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
if (isPublished && publishedStorageEntry?.id === entry.id) {
|
|
125
|
+
const elasticsearchPublishedData = await transformer.getElasticsearchPublishedEntryData();
|
|
126
|
+
elasticsearchEntityBatch.put({
|
|
127
|
+
...publishedKeys,
|
|
128
|
+
index: esIndex,
|
|
129
|
+
data: elasticsearchPublishedData
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
try {
|
|
133
|
+
await entityBatch.execute();
|
|
134
|
+
this.dataLoaders.clearAll({
|
|
135
|
+
tenant: entry.tenant
|
|
136
|
+
});
|
|
137
|
+
} catch (ex) {
|
|
138
|
+
throw new error(ex.message || "Could not update entry DynamoDB records.", ex.code || "UPDATE_ENTRY_ERROR", {
|
|
139
|
+
error: ex,
|
|
140
|
+
entry,
|
|
141
|
+
storageEntry
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
try {
|
|
145
|
+
await elasticsearchEntityBatch.execute();
|
|
146
|
+
} catch (ex) {
|
|
147
|
+
throw new error(ex.message || "Could not update entry DynamoDB Elasticsearch records.", ex.code || "UPDATE_ES_ENTRY_ERROR", {
|
|
148
|
+
error: ex,
|
|
149
|
+
entry
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
return initialStorageEntry;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
const DdbEsUpdateEntry = UpdateEntryStorageOperation.createImplementation({
|
|
156
|
+
implementation: DdbEsUpdateEntryImpl,
|
|
157
|
+
dependencies: [
|
|
158
|
+
CmsDdbEsEntryEntity,
|
|
159
|
+
CmsDdbEsEntriesEsEntity,
|
|
160
|
+
CmsDdbEsDataLoaders,
|
|
161
|
+
CmsStorageModelProvider,
|
|
162
|
+
CmsEntryOpenSearchFieldIndexRegistry,
|
|
163
|
+
CompressionHandler,
|
|
164
|
+
CmsModelOpenSearchIndexProvider,
|
|
165
|
+
[
|
|
166
|
+
CmsEntryOpenSearchValuesModifier,
|
|
167
|
+
{
|
|
168
|
+
multiple: true
|
|
169
|
+
}
|
|
170
|
+
]
|
|
171
|
+
]
|
|
172
|
+
});
|
|
173
|
+
export { DdbEsUpdateEntry };
|
|
174
|
+
|
|
175
|
+
//# sourceMappingURL=DdbEsUpdateEntry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operations/entry/DdbEsUpdateEntry.js","sources":["../../../src/operations/entry/DdbEsUpdateEntry.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport type {\n CmsModel,\n CmsEntryValues,\n CmsEntryStorageOperationsUpdateParams\n} from \"@webiny/api-headless-cms/types/index.js\";\nimport { UpdateEntryStorageOperation } from \"@webiny/api-headless-cms/features/shared/storageOperations/entry/UpdateEntryStorageOperation.js\";\nimport { CmsDdbEsEntryEntity } from \"~/abstractions/CmsDdbEsEntryEntity.js\";\nimport { CmsDdbEsEntriesEsEntity } from \"~/abstractions/CmsDdbEsEntriesEsEntity.js\";\nimport { CmsDdbEsDataLoaders } from \"~/abstractions/CmsDdbEsDataLoaders.js\";\nimport { CmsStorageModelProvider } from \"@webiny/api-headless-cms/features/shared/abstractions.js\";\nimport {\n CmsEntryOpenSearchFieldIndexRegistry,\n CmsEntryOpenSearchValuesModifier,\n CmsModelOpenSearchIndexProvider\n} from \"@webiny/api-headless-cms-utils-os/exports/api/cms/opensearch.js\";\nimport { CompressionHandler } from \"@webiny/utils/exports/api.js\";\nimport { createConfigurations } from \"@webiny/api-headless-cms-utils-os/configurations.js\";\nimport { createTransformer } from \"./transformations/index.js\";\nimport {\n createEntryLatestKeys,\n createEntryPublishedKeys,\n createEntryRevisionKeys,\n createPartitionKey,\n createRevisionSortKey\n} from \"./keys.js\";\nimport {\n isEntryLevelEntryMetaField,\n pickEntryMetaFields\n} from \"@webiny/api-headless-cms/constants.js\";\nimport type { IEntryEntityAttributes } from \"~/definitions/types.js\";\nimport type { CmsIndexEntry } from \"@webiny/api-headless-cms-utils-os/types.js\";\n\nclass DdbEsUpdateEntryImpl implements UpdateEntryStorageOperation.Interface {\n constructor(\n private entity: CmsDdbEsEntryEntity.Interface,\n private esEntity: CmsDdbEsEntriesEsEntity.Interface,\n private dataLoaders: CmsDdbEsDataLoaders.Interface,\n private storageModelProvider: CmsStorageModelProvider.Interface,\n private fieldIndexRegistry: CmsEntryOpenSearchFieldIndexRegistry.Interface,\n private compressionHandler: CompressionHandler.Interface,\n private indexProvider: CmsModelOpenSearchIndexProvider.Interface,\n private valuesModifiers: CmsEntryOpenSearchValuesModifier.Interface[]\n ) {}\n\n async execute<T extends CmsEntryValues = CmsEntryValues>(\n initialModel: CmsModel,\n params: CmsEntryStorageOperationsUpdateParams<T>\n ) {\n const { entry: initialEntry, storageEntry: initialStorageEntry } = params;\n const model = this.storageModelProvider.getModel(initialModel);\n\n const transformer = createTransformer({\n valuesModifiers: this.valuesModifiers,\n model,\n entry: initialEntry,\n storageEntry: initialStorageEntry,\n fieldIndexRegistry: this.fieldIndexRegistry,\n compressionHandler: this.compressionHandler\n });\n\n const { entry, storageEntry } = transformer.transformEntryKeys();\n\n const isPublished = entry.status === \"published\";\n const locked = isPublished ? true : entry.locked;\n\n const revisionKeys = createEntryRevisionKeys(entry);\n const latestKeys = createEntryLatestKeys(entry);\n const publishedKeys = createEntryPublishedKeys(entry);\n\n /**\n * We need the latest entry to check if it needs to be updated.\n */\n const [latestStorageEntry] = await this.dataLoaders.getLatestRevisionByEntryId({\n model,\n ids: [entry.id]\n });\n\n const [publishedStorageEntry] = await this.dataLoaders.getPublishedRevisionByEntryId({\n model,\n ids: [entry.id]\n });\n\n const entityBatch = this.entity.createEntityWriter({\n put: [\n {\n ...revisionKeys,\n data: {\n ...storageEntry,\n locked\n }\n }\n ]\n });\n\n if (isPublished) {\n entityBatch.put({\n ...publishedKeys,\n data: {\n ...storageEntry,\n locked\n }\n });\n }\n\n const elasticsearchEntityBatch = this.esEntity.createEntityWriter();\n\n const configurations = createConfigurations(this.indexProvider);\n const { index: esIndex } = await configurations.es({\n model\n });\n\n /**\n * If the latest entry is the one being updated, we need to create a new latest entry records.\n */\n if (latestStorageEntry) {\n const updatingLatestRevision = latestStorageEntry.id === entry.id;\n if (updatingLatestRevision) {\n /**\n * First we update the regular DynamoDB table.\n */\n entityBatch.put({\n ...latestKeys,\n data: storageEntry\n });\n\n /**\n * And then update the Elasticsearch table to propagate changes to the Elasticsearch\n */\n const elasticsearchLatestData = await transformer.getElasticsearchLatestEntryData();\n\n elasticsearchEntityBatch.put({\n ...latestKeys,\n index: esIndex,\n data: elasticsearchLatestData\n });\n } else {\n /**\n * If not updating latest revision, we still want to update the latest revision's\n * entry-level meta fields to match the current revision's entry-level meta fields.\n */\n const updatedEntryLevelMetaFields = pickEntryMetaFields(\n entry,\n isEntryLevelEntryMetaField\n );\n\n const updatedLatestStorageEntry: IEntryEntityAttributes = {\n ...latestKeys,\n data: {\n ...latestStorageEntry,\n ...updatedEntryLevelMetaFields\n }\n };\n\n /**\n * First we update the regular DynamoDB table. Two updates are needed:\n * - one for the actual revision record\n * - one for the latest record\n */\n entityBatch.put({\n ...updatedLatestStorageEntry,\n PK: createPartitionKey({\n id: latestStorageEntry.id,\n tenant: model.tenant\n }),\n SK: createRevisionSortKey(latestStorageEntry)\n });\n\n entityBatch.put({\n ...updatedLatestStorageEntry\n });\n\n /**\n * Update the Elasticsearch table to propagate changes to the Elasticsearch.\n */\n const latestEsEntry = await this.esEntity.getClean(latestKeys);\n\n if (latestEsEntry) {\n const latestEsEntryDataDecompressed = (await this.compressionHandler.decompress(\n latestEsEntry.data\n )) as CmsIndexEntry;\n\n const updatedLatestEntry = await this.compressionHandler.compress({\n ...latestEsEntryDataDecompressed,\n ...updatedEntryLevelMetaFields\n });\n\n elasticsearchEntityBatch.put({\n ...latestKeys,\n index: esIndex,\n data: updatedLatestEntry\n });\n }\n }\n }\n\n if (isPublished && publishedStorageEntry?.id === entry.id) {\n const elasticsearchPublishedData =\n await transformer.getElasticsearchPublishedEntryData();\n elasticsearchEntityBatch.put({\n ...publishedKeys,\n index: esIndex,\n data: elasticsearchPublishedData\n });\n }\n try {\n await entityBatch.execute();\n\n this.dataLoaders.clearAll({\n tenant: entry.tenant\n });\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not update entry DynamoDB records.\",\n ex.code || \"UPDATE_ENTRY_ERROR\",\n {\n error: ex,\n entry,\n storageEntry\n }\n );\n }\n try {\n await elasticsearchEntityBatch.execute();\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not update entry DynamoDB Elasticsearch records.\",\n ex.code || \"UPDATE_ES_ENTRY_ERROR\",\n {\n error: ex,\n entry\n }\n );\n }\n return initialStorageEntry;\n }\n}\n\nexport const DdbEsUpdateEntry = UpdateEntryStorageOperation.createImplementation({\n implementation: DdbEsUpdateEntryImpl,\n dependencies: [\n CmsDdbEsEntryEntity,\n CmsDdbEsEntriesEsEntity,\n CmsDdbEsDataLoaders,\n CmsStorageModelProvider,\n CmsEntryOpenSearchFieldIndexRegistry,\n CompressionHandler,\n CmsModelOpenSearchIndexProvider,\n [CmsEntryOpenSearchValuesModifier, { multiple: true }]\n ]\n});\n"],"names":["DdbEsUpdateEntryImpl","entity","esEntity","dataLoaders","storageModelProvider","fieldIndexRegistry","compressionHandler","indexProvider","valuesModifiers","initialModel","params","initialEntry","initialStorageEntry","model","transformer","createTransformer","entry","storageEntry","isPublished","locked","revisionKeys","createEntryRevisionKeys","latestKeys","createEntryLatestKeys","publishedKeys","createEntryPublishedKeys","latestStorageEntry","publishedStorageEntry","entityBatch","elasticsearchEntityBatch","configurations","createConfigurations","esIndex","updatingLatestRevision","elasticsearchLatestData","updatedEntryLevelMetaFields","pickEntryMetaFields","isEntryLevelEntryMetaField","updatedLatestStorageEntry","createPartitionKey","createRevisionSortKey","latestEsEntry","latestEsEntryDataDecompressed","updatedLatestEntry","elasticsearchPublishedData","ex","WebinyError","DdbEsUpdateEntry","UpdateEntryStorageOperation","CmsDdbEsEntryEntity","CmsDdbEsEntriesEsEntity","CmsDdbEsDataLoaders","CmsStorageModelProvider","CmsEntryOpenSearchFieldIndexRegistry","CompressionHandler","CmsModelOpenSearchIndexProvider","CmsEntryOpenSearchValuesModifier"],"mappings":"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"}
|
|
@@ -2,11 +2,10 @@ import type DataLoader from "dataloader";
|
|
|
2
2
|
export interface CacheKeyParams {
|
|
3
3
|
name: string;
|
|
4
4
|
tenant: string;
|
|
5
|
-
|
|
5
|
+
modelId: string;
|
|
6
6
|
}
|
|
7
7
|
export interface ClearAllParams {
|
|
8
8
|
tenant: string;
|
|
9
|
-
locale: string;
|
|
10
9
|
}
|
|
11
10
|
export declare class DataLoaderCache {
|
|
12
11
|
private readonly cache;
|
|
@@ -1,41 +1,27 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.DataLoaderCache = void 0;
|
|
7
1
|
class DataLoaderCache {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
2
|
+
getDataLoader(params) {
|
|
3
|
+
const key = this.createKey(params);
|
|
4
|
+
return this.cache[key] || null;
|
|
5
|
+
}
|
|
6
|
+
setDataLoader(params, dataLoader) {
|
|
7
|
+
const key = this.createKey(params);
|
|
8
|
+
this.cache[key] = dataLoader;
|
|
9
|
+
}
|
|
10
|
+
clearAll(params) {
|
|
11
|
+
if (!params) {
|
|
12
|
+
for(const current in this.cache)this.cache[current].clearAll();
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
const key = `${params.tenant}_`;
|
|
16
|
+
for(const current in this.cache)if (false !== current.startsWith(key)) this.cache[current].clearAll();
|
|
17
|
+
}
|
|
18
|
+
createKey(params) {
|
|
19
|
+
return `${params.tenant}_${params.modelId}_${params.name}`;
|
|
23
20
|
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
name: ""
|
|
27
|
-
});
|
|
28
|
-
for (const current in this.cache) {
|
|
29
|
-
if (current.startsWith(key) === false) {
|
|
30
|
-
continue;
|
|
31
|
-
}
|
|
32
|
-
this.cache[current].clearAll();
|
|
21
|
+
constructor(){
|
|
22
|
+
this.cache = {};
|
|
33
23
|
}
|
|
34
|
-
}
|
|
35
|
-
createKey(params) {
|
|
36
|
-
return `${params.tenant}_${params.locale}_${params.name}`;
|
|
37
|
-
}
|
|
38
24
|
}
|
|
39
|
-
|
|
25
|
+
export { DataLoaderCache };
|
|
40
26
|
|
|
41
27
|
//# sourceMappingURL=DataLoaderCache.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"operations/entry/dataLoader/DataLoaderCache.js","sources":["../../../../src/operations/entry/dataLoader/DataLoaderCache.ts"],"sourcesContent":["import type DataLoader from \"dataloader\";\n\nexport interface CacheKeyParams {\n name: string;\n tenant: string;\n modelId: string;\n}\n\nexport interface ClearAllParams {\n tenant: string;\n}\n\nexport class DataLoaderCache {\n private readonly cache: Record<string, DataLoader<any, any>> = {};\n\n public getDataLoader<I = any, R = any>(params: CacheKeyParams): DataLoader<I, R> | null {\n const key = this.createKey(params);\n\n return this.cache[key] || null;\n }\n\n public setDataLoader(params: CacheKeyParams, dataLoader: DataLoader<any, any>): void {\n const key = this.createKey(params);\n this.cache[key] = dataLoader;\n }\n\n public clearAll(params?: ClearAllParams): void {\n if (!params) {\n for (const current in this.cache) {\n this.cache[current].clearAll();\n }\n return;\n }\n const key = `${params.tenant}_`;\n for (const current in this.cache) {\n if (current.startsWith(key) === false) {\n continue;\n }\n this.cache[current].clearAll();\n }\n }\n\n private createKey(params: CacheKeyParams): string {\n return `${params.tenant}_${params.modelId}_${params.name}`;\n }\n}\n"],"names":["DataLoaderCache","params","key","dataLoader","current"],"mappings":"AAYO,MAAMA;IAGF,cAAgCC,MAAsB,EAA2B;QACpF,MAAMC,MAAM,IAAI,CAAC,SAAS,CAACD;QAE3B,OAAO,IAAI,CAAC,KAAK,CAACC,IAAI,IAAI;IAC9B;IAEO,cAAcD,MAAsB,EAAEE,UAAgC,EAAQ;QACjF,MAAMD,MAAM,IAAI,CAAC,SAAS,CAACD;QAC3B,IAAI,CAAC,KAAK,CAACC,IAAI,GAAGC;IACtB;IAEO,SAASF,MAAuB,EAAQ;QAC3C,IAAI,CAACA,QAAQ;YACT,IAAK,MAAMG,WAAW,IAAI,CAAC,KAAK,CAC5B,IAAI,CAAC,KAAK,CAACA,QAAQ,CAAC,QAAQ;YAEhC;QACJ;QACA,MAAMF,MAAM,GAAGD,OAAO,MAAM,CAAC,CAAC,CAAC;QAC/B,IAAK,MAAMG,WAAW,IAAI,CAAC,KAAK,CAC5B,IAAIA,AAA4B,UAA5BA,QAAQ,UAAU,CAACF,MAGvB,IAAI,CAAC,KAAK,CAACE,QAAQ,CAAC,QAAQ;IAEpC;IAEQ,UAAUH,MAAsB,EAAU;QAC9C,OAAO,GAAGA,OAAO,MAAM,CAAC,CAAC,EAAEA,OAAO,OAAO,CAAC,CAAC,EAAEA,OAAO,IAAI,EAAE;IAC9D;;aA/BiB,KAAK,GAAyC,CAAC;;AAgCpE"}
|
|
@@ -1,10 +1,5 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.CMS_ENTRY_BATCH_SCHEDULE_WAIT = void 0;
|
|
7
1
|
const batchScheduleWaitEnv = Number(process.env.WEBINY_API_CMS_ENTRY_BATCH_SCHEDULE_WAIT || "0");
|
|
8
|
-
const CMS_ENTRY_BATCH_SCHEDULE_WAIT =
|
|
2
|
+
const CMS_ENTRY_BATCH_SCHEDULE_WAIT = isNaN(batchScheduleWaitEnv) ? 0 : batchScheduleWaitEnv;
|
|
3
|
+
export { CMS_ENTRY_BATCH_SCHEDULE_WAIT };
|
|
9
4
|
|
|
10
5
|
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"operations/entry/dataLoader/constants.js","sources":["../../../../src/operations/entry/dataLoader/constants.ts"],"sourcesContent":["const batchScheduleWaitEnv = Number(process.env.WEBINY_API_CMS_ENTRY_BATCH_SCHEDULE_WAIT || \"0\");\nexport const CMS_ENTRY_BATCH_SCHEDULE_WAIT = isNaN(batchScheduleWaitEnv) ? 0 : batchScheduleWaitEnv;\n"],"names":["batchScheduleWaitEnv","Number","process","CMS_ENTRY_BATCH_SCHEDULE_WAIT","isNaN"],"mappings":"AAAA,MAAMA,uBAAuBC,OAAOC,QAAQ,GAAG,CAAC,wCAAwC,IAAI;AACrF,MAAMC,gCAAgCC,MAAMJ,wBAAwB,IAAIA"}
|
|
@@ -1,25 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
var _constants = require("./constants");
|
|
8
|
-
/**
|
|
9
|
-
* This is to be used when user wants to wait for a number of milliseconds before the batch is executed.
|
|
10
|
-
* Intended to be used internally or for a specific user case.
|
|
11
|
-
* Not to be documented and exposed to publish as it can slow the data loading a lot.
|
|
12
|
-
*
|
|
13
|
-
* https://github.com/graphql/dataloader#batch-scheduling
|
|
14
|
-
*/
|
|
15
|
-
const createBatchScheduleFn = () => {
|
|
16
|
-
if (_constants.CMS_ENTRY_BATCH_SCHEDULE_WAIT <= 0) {
|
|
17
|
-
return undefined;
|
|
18
|
-
}
|
|
19
|
-
return callback => {
|
|
20
|
-
setTimeout(callback, _constants.CMS_ENTRY_BATCH_SCHEDULE_WAIT);
|
|
21
|
-
};
|
|
1
|
+
import { CMS_ENTRY_BATCH_SCHEDULE_WAIT } from "./constants.js";
|
|
2
|
+
const createBatchScheduleFn = ()=>{
|
|
3
|
+
if (CMS_ENTRY_BATCH_SCHEDULE_WAIT <= 0) return;
|
|
4
|
+
return (callback)=>{
|
|
5
|
+
setTimeout(callback, CMS_ENTRY_BATCH_SCHEDULE_WAIT);
|
|
6
|
+
};
|
|
22
7
|
};
|
|
23
|
-
|
|
8
|
+
export { createBatchScheduleFn };
|
|
24
9
|
|
|
25
10
|
//# sourceMappingURL=createBatchScheduleFn.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"operations/entry/dataLoader/createBatchScheduleFn.js","sources":["../../../../src/operations/entry/dataLoader/createBatchScheduleFn.ts"],"sourcesContent":["import { CMS_ENTRY_BATCH_SCHEDULE_WAIT } from \"./constants.js\";\n\n/**\n * This is to be used when user wants to wait for a number of milliseconds before the batch is executed.\n * Intended to be used internally or for a specific user case.\n * Not to be documented and exposed to publish as it can slow the data loading a lot.\n *\n * https://github.com/graphql/dataloader#batch-scheduling\n */\nexport const createBatchScheduleFn = () => {\n if (CMS_ENTRY_BATCH_SCHEDULE_WAIT <= 0) {\n return undefined;\n }\n return (callback: () => void) => {\n setTimeout(callback, CMS_ENTRY_BATCH_SCHEDULE_WAIT);\n };\n};\n"],"names":["createBatchScheduleFn","CMS_ENTRY_BATCH_SCHEDULE_WAIT","callback","setTimeout"],"mappings":";AASO,MAAMA,wBAAwB;IACjC,IAAIC,iCAAiC,GACjC;IAEJ,OAAO,CAACC;QACJC,WAAWD,UAAUD;IACzB;AACJ"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import DataLoader from "dataloader";
|
|
2
|
-
import type { CmsStorageEntry } from "@webiny/api-headless-cms/types";
|
|
3
|
-
import type {
|
|
4
|
-
export declare const createGetAllEntryRevisions: (params:
|
|
2
|
+
import type { CmsStorageEntry } from "@webiny/api-headless-cms/types/index.js";
|
|
3
|
+
import type { IDataLoaderParams } from "./types.js";
|
|
4
|
+
export declare const createGetAllEntryRevisions: (params: IDataLoaderParams) => DataLoader<string, CmsStorageEntry<import("@webiny/api-headless-cms/types/types.js").CmsEntryValues>[], string>;
|
|
@@ -1,45 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
const results = {};
|
|
21
|
-
for (const id of ids) {
|
|
22
|
-
const queryAllParams = {
|
|
23
|
-
entity,
|
|
24
|
-
partitionKey: (0, _keys.createPartitionKey)({
|
|
25
|
-
tenant,
|
|
26
|
-
locale,
|
|
27
|
-
id
|
|
28
|
-
}),
|
|
29
|
-
options: {
|
|
30
|
-
beginsWith: "REV#"
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
const items = await (0, _query.queryAll)(queryAllParams);
|
|
34
|
-
results[id] = (0, _cleanup.cleanupItems)(entity, items);
|
|
35
|
-
}
|
|
36
|
-
return ids.map(entryId => {
|
|
37
|
-
return results[entryId] || [];
|
|
1
|
+
import dataloader from "dataloader";
|
|
2
|
+
import { createPartitionKey } from "../keys.js";
|
|
3
|
+
import { createBatchScheduleFn } from "./createBatchScheduleFn.js";
|
|
4
|
+
const createGetAllEntryRevisions = (params)=>{
|
|
5
|
+
const { entity, tenant, modelId } = params;
|
|
6
|
+
return new dataloader(async (ids)=>{
|
|
7
|
+
const results = {};
|
|
8
|
+
for (const id of ids)results[id] = (await entity.queryAllClean({
|
|
9
|
+
partitionKey: createPartitionKey({
|
|
10
|
+
tenant,
|
|
11
|
+
id
|
|
12
|
+
}),
|
|
13
|
+
options: {
|
|
14
|
+
beginsWith: "REV#"
|
|
15
|
+
}
|
|
16
|
+
})).map((item)=>item.data);
|
|
17
|
+
return ids.map((entryId)=>(results[entryId] || []).filter((item)=>item.modelId === modelId));
|
|
18
|
+
}, {
|
|
19
|
+
batchScheduleFn: createBatchScheduleFn()
|
|
38
20
|
});
|
|
39
|
-
}, {
|
|
40
|
-
batchScheduleFn: (0, _createBatchScheduleFn.createBatchScheduleFn)()
|
|
41
|
-
});
|
|
42
21
|
};
|
|
43
|
-
|
|
22
|
+
export { createGetAllEntryRevisions };
|
|
44
23
|
|
|
45
24
|
//# sourceMappingURL=getAllEntryRevisions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"operations/entry/dataLoader/getAllEntryRevisions.js","sources":["../../../../src/operations/entry/dataLoader/getAllEntryRevisions.ts"],"sourcesContent":["import DataLoader from \"dataloader\";\nimport type { CmsStorageEntry } from \"@webiny/api-headless-cms/types/index.js\";\nimport { createPartitionKey } from \"~/operations/entry/keys.js\";\nimport type { IDataLoaderParams } from \"./types.js\";\nimport { createBatchScheduleFn } from \"./createBatchScheduleFn.js\";\n\nexport const createGetAllEntryRevisions = (params: IDataLoaderParams) => {\n const { entity, tenant, modelId } = params;\n return new DataLoader<string, CmsStorageEntry[]>(\n async ids => {\n const results: Record<string, CmsStorageEntry[]> = {};\n\n for (const id of ids) {\n results[id] = (\n await entity.queryAllClean({\n partitionKey: createPartitionKey({\n tenant,\n id\n }),\n options: {\n beginsWith: \"REV#\"\n }\n })\n ).map(item => {\n return item.data;\n });\n }\n\n return ids.map(entryId => {\n return (results[entryId] || []).filter(item => {\n return item.modelId === modelId;\n });\n });\n },\n {\n batchScheduleFn: createBatchScheduleFn()\n }\n );\n};\n"],"names":["createGetAllEntryRevisions","params","entity","tenant","modelId","DataLoader","ids","results","id","createPartitionKey","item","entryId","createBatchScheduleFn"],"mappings":";;;AAMO,MAAMA,6BAA6B,CAACC;IACvC,MAAM,EAAEC,MAAM,EAAEC,MAAM,EAAEC,OAAO,EAAE,GAAGH;IACpC,OAAO,IAAII,WACP,OAAMC;QACF,MAAMC,UAA6C,CAAC;QAEpD,KAAK,MAAMC,MAAMF,IACbC,OAAO,CAACC,GAAG,GACP,OAAMN,OAAO,aAAa,CAAC;YACvB,cAAcO,mBAAmB;gBAC7BN;gBACAK;YACJ;YACA,SAAS;gBACL,YAAY;YAChB;QACJ,EAAC,EACH,GAAG,CAACE,CAAAA,OACKA,KAAK,IAAI;QAIxB,OAAOJ,IAAI,GAAG,CAACK,CAAAA,UACHJ,AAAAA,CAAAA,OAAO,CAACI,QAAQ,IAAI,EAAC,EAAG,MAAM,CAACD,CAAAA,OAC5BA,KAAK,OAAO,KAAKN;IAGpC,GACA;QACI,iBAAiBQ;IACrB;AAER"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import DataLoader from "dataloader";
|
|
2
|
-
import type { CmsStorageEntry } from "@webiny/api-headless-cms/types";
|
|
3
|
-
import type {
|
|
4
|
-
export declare const createGetLatestRevisionByEntryId: (params:
|
|
2
|
+
import type { CmsStorageEntry } from "@webiny/api-headless-cms/types/index.js";
|
|
3
|
+
import type { IDataLoaderParams } from "./types.js";
|
|
4
|
+
export declare const createGetLatestRevisionByEntryId: (params: IDataLoaderParams) => DataLoader<string, CmsStorageEntry<import("@webiny/api-headless-cms/types/types.js").CmsEntryValues>[], string>;
|
|
@@ -1,52 +1,34 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
collection[partitionKey] = entity.getBatch({
|
|
31
|
-
PK: partitionKey,
|
|
32
|
-
SK: latestKey
|
|
33
|
-
});
|
|
34
|
-
return collection;
|
|
35
|
-
}, {});
|
|
36
|
-
const records = await (0, _dbDynamodb.batchReadAll)({
|
|
37
|
-
table: entity.table,
|
|
38
|
-
items: Object.values(queries)
|
|
39
|
-
});
|
|
40
|
-
const items = (0, _cleanup.cleanupItems)(entity, records);
|
|
41
|
-
return ids.map(entryId => {
|
|
42
|
-
return items.filter(item => {
|
|
43
|
-
return entryId === item.entryId;
|
|
44
|
-
});
|
|
1
|
+
import dataloader from "dataloader";
|
|
2
|
+
import { createBatchScheduleFn } from "./createBatchScheduleFn.js";
|
|
3
|
+
import { createLatestSortKey, createPartitionKey } from "../keys.js";
|
|
4
|
+
const createGetLatestRevisionByEntryId = (params)=>{
|
|
5
|
+
const { entity, tenant, modelId } = params;
|
|
6
|
+
const latestKey = createLatestSortKey();
|
|
7
|
+
return new dataloader(async (ids)=>{
|
|
8
|
+
const reader = entity.createEntityReader();
|
|
9
|
+
const keys = new Set();
|
|
10
|
+
for (const id of ids){
|
|
11
|
+
const partitionKey = createPartitionKey({
|
|
12
|
+
tenant,
|
|
13
|
+
id
|
|
14
|
+
});
|
|
15
|
+
if (!keys.has(partitionKey)) {
|
|
16
|
+
keys.add(partitionKey);
|
|
17
|
+
reader.get({
|
|
18
|
+
PK: partitionKey,
|
|
19
|
+
SK: latestKey
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
const items = (await reader.execute()).map((item)=>item.data);
|
|
24
|
+
return ids.map((entryId)=>items.filter((item)=>{
|
|
25
|
+
if (item.modelId !== modelId) return false;
|
|
26
|
+
return entryId === item.entryId;
|
|
27
|
+
}));
|
|
28
|
+
}, {
|
|
29
|
+
batchScheduleFn: createBatchScheduleFn()
|
|
45
30
|
});
|
|
46
|
-
}, {
|
|
47
|
-
batchScheduleFn: (0, _createBatchScheduleFn.createBatchScheduleFn)()
|
|
48
|
-
});
|
|
49
31
|
};
|
|
50
|
-
|
|
32
|
+
export { createGetLatestRevisionByEntryId };
|
|
51
33
|
|
|
52
34
|
//# sourceMappingURL=getLatestRevisionByEntryId.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"operations/entry/dataLoader/getLatestRevisionByEntryId.js","sources":["../../../../src/operations/entry/dataLoader/getLatestRevisionByEntryId.ts"],"sourcesContent":["import DataLoader from \"dataloader\";\nimport type { CmsStorageEntry } from \"@webiny/api-headless-cms/types/index.js\";\nimport { createBatchScheduleFn } from \"./createBatchScheduleFn.js\";\nimport { createLatestSortKey, createPartitionKey } from \"~/operations/entry/keys.js\";\nimport type { IDataLoaderParams } from \"./types.js\";\n\nexport const createGetLatestRevisionByEntryId = (params: IDataLoaderParams) => {\n const { entity, tenant, modelId } = params;\n\n const latestKey = createLatestSortKey();\n\n return new DataLoader<string, CmsStorageEntry[]>(\n async ids => {\n const reader = entity.createEntityReader();\n\n const keys = new Set<string>();\n\n for (const id of ids) {\n const partitionKey = createPartitionKey({\n tenant,\n id\n });\n if (keys.has(partitionKey)) {\n continue;\n }\n keys.add(partitionKey);\n reader.get({\n PK: partitionKey,\n SK: latestKey\n });\n }\n\n const items = (await reader.execute()).map(item => {\n return item.data;\n });\n\n return ids.map(entryId => {\n return items.filter(item => {\n if (item.modelId !== modelId) {\n return false;\n }\n return entryId === item.entryId;\n });\n });\n },\n {\n batchScheduleFn: createBatchScheduleFn()\n }\n );\n};\n"],"names":["createGetLatestRevisionByEntryId","params","entity","tenant","modelId","latestKey","createLatestSortKey","DataLoader","ids","reader","keys","Set","id","partitionKey","createPartitionKey","items","item","entryId","createBatchScheduleFn"],"mappings":";;;AAMO,MAAMA,mCAAmC,CAACC;IAC7C,MAAM,EAAEC,MAAM,EAAEC,MAAM,EAAEC,OAAO,EAAE,GAAGH;IAEpC,MAAMI,YAAYC;IAElB,OAAO,IAAIC,WACP,OAAMC;QACF,MAAMC,SAASP,OAAO,kBAAkB;QAExC,MAAMQ,OAAO,IAAIC;QAEjB,KAAK,MAAMC,MAAMJ,IAAK;YAClB,MAAMK,eAAeC,mBAAmB;gBACpCX;gBACAS;YACJ;YACA,KAAIF,KAAK,GAAG,CAACG;gBAGbH,KAAK,GAAG,CAACG;gBACTJ,OAAO,GAAG,CAAC;oBACP,IAAII;oBACJ,IAAIR;gBACR;;QACJ;QAEA,MAAMU,QAAS,OAAMN,OAAO,OAAO,EAAC,EAAG,GAAG,CAACO,CAAAA,OAChCA,KAAK,IAAI;QAGpB,OAAOR,IAAI,GAAG,CAACS,CAAAA,UACJF,MAAM,MAAM,CAACC,CAAAA;gBAChB,IAAIA,KAAK,OAAO,KAAKZ,SACjB,OAAO;gBAEX,OAAOa,YAAYD,KAAK,OAAO;YACnC;IAER,GACA;QACI,iBAAiBE;IACrB;AAER"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import DataLoader from "dataloader";
|
|
2
|
-
import type { CmsStorageEntry } from "@webiny/api-headless-cms/types";
|
|
3
|
-
import type {
|
|
4
|
-
export declare const createGetPublishedRevisionByEntryId: (params:
|
|
2
|
+
import type { CmsStorageEntry } from "@webiny/api-headless-cms/types/index.js";
|
|
3
|
+
import type { IDataLoaderParams } from "./types.js";
|
|
4
|
+
export declare const createGetPublishedRevisionByEntryId: (params: IDataLoaderParams) => DataLoader<string, CmsStorageEntry<import("@webiny/api-headless-cms/types/types.js").CmsEntryValues>[], string>;
|