@webiny/api-headless-cms-ddb-es 0.0.0-unstable.e53eceafb5 → 0.0.0-unstable.e6f0dc8ca7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -30
- package/configurations.d.ts +7 -7
- package/configurations.js +16 -26
- package/configurations.js.map +1 -1
- package/definitions/entry.d.ts +4 -6
- package/definitions/entry.js +5 -174
- package/definitions/entry.js.map +1 -1
- package/definitions/group.d.ts +6 -7
- package/definitions/group.js +5 -58
- package/definitions/group.js.map +1 -1
- package/definitions/model.d.ts +6 -7
- package/definitions/model.js +5 -102
- package/definitions/model.js.map +1 -1
- package/definitions/types.d.ts +61 -0
- package/definitions/types.js +3 -0
- package/definitions/types.js.map +1 -0
- package/elasticsearch/createElasticsearchIndex.d.ts +4 -4
- package/elasticsearch/createElasticsearchIndex.js +61 -27
- package/elasticsearch/createElasticsearchIndex.js.map +1 -1
- package/elasticsearch/deleteElasticsearchIndex.d.ts +2 -2
- package/elasticsearch/deleteElasticsearchIndex.js +3 -10
- package/elasticsearch/deleteElasticsearchIndex.js.map +1 -1
- package/exports/api/cms/opensearch.d.ts +9 -0
- package/exports/api/cms/opensearch.js +11 -0
- package/exports/api/cms/opensearch.js.map +1 -0
- package/feature.d.ts +1 -0
- package/feature.js +188 -0
- package/feature.js.map +1 -0
- package/features/CmsEntryOpenSearchBodyModifier/abstractions.d.ts +16 -0
- package/features/CmsEntryOpenSearchBodyModifier/abstractions.js +4 -0
- package/features/CmsEntryOpenSearchBodyModifier/abstractions.js.map +1 -0
- package/features/CmsEntryOpenSearchBodyModifier/index.d.ts +1 -0
- package/features/CmsEntryOpenSearchBodyModifier/index.js +3 -0
- package/features/CmsEntryOpenSearchBodyModifier/index.js.map +1 -0
- package/features/CmsEntryOpenSearchFieldIndex/CmsEntryOpenSearchFieldIndexRegistry.d.ts +13 -0
- package/features/CmsEntryOpenSearchFieldIndex/CmsEntryOpenSearchFieldIndexRegistry.js +36 -0
- package/features/CmsEntryOpenSearchFieldIndex/CmsEntryOpenSearchFieldIndexRegistry.js.map +1 -0
- package/features/CmsEntryOpenSearchFieldIndex/abstractions/CmsEntryOpenSearchFieldIndex.d.ts +35 -0
- package/features/CmsEntryOpenSearchFieldIndex/abstractions/CmsEntryOpenSearchFieldIndex.js +4 -0
- package/features/CmsEntryOpenSearchFieldIndex/abstractions/CmsEntryOpenSearchFieldIndex.js.map +1 -0
- package/features/CmsEntryOpenSearchFieldIndex/abstractions/CmsEntryOpenSearchFieldIndexRegistry.d.ts +11 -0
- package/features/CmsEntryOpenSearchFieldIndex/abstractions/CmsEntryOpenSearchFieldIndexRegistry.js +4 -0
- package/features/CmsEntryOpenSearchFieldIndex/abstractions/CmsEntryOpenSearchFieldIndexRegistry.js.map +1 -0
- package/features/CmsEntryOpenSearchFieldIndex/constants.d.ts +1 -0
- package/features/CmsEntryOpenSearchFieldIndex/constants.js +3 -0
- package/features/CmsEntryOpenSearchFieldIndex/constants.js.map +1 -0
- package/features/CmsEntryOpenSearchFieldIndex/feature.d.ts +4 -0
- package/features/CmsEntryOpenSearchFieldIndex/feature.js +24 -0
- package/features/CmsEntryOpenSearchFieldIndex/feature.js.map +1 -0
- package/features/CmsEntryOpenSearchFieldIndex/fields/DateTimeFieldIndex.d.ts +11 -0
- package/{elasticsearch/indexing/dateTimeIndexing.js → features/CmsEntryOpenSearchFieldIndex/fields/DateTimeFieldIndex.js} +21 -32
- package/features/CmsEntryOpenSearchFieldIndex/fields/DateTimeFieldIndex.js.map +1 -0
- package/features/CmsEntryOpenSearchFieldIndex/fields/DefaultFieldIndex.d.ts +10 -0
- package/features/CmsEntryOpenSearchFieldIndex/fields/DefaultFieldIndex.js +39 -0
- package/features/CmsEntryOpenSearchFieldIndex/fields/DefaultFieldIndex.js.map +1 -0
- package/features/CmsEntryOpenSearchFieldIndex/fields/JsonFieldIndex.d.ts +10 -0
- package/features/CmsEntryOpenSearchFieldIndex/fields/JsonFieldIndex.js +22 -0
- package/features/CmsEntryOpenSearchFieldIndex/fields/JsonFieldIndex.js.map +1 -0
- package/features/CmsEntryOpenSearchFieldIndex/fields/LongTextFieldIndex.d.ts +10 -0
- package/features/CmsEntryOpenSearchFieldIndex/fields/LongTextFieldIndex.js +25 -0
- package/features/CmsEntryOpenSearchFieldIndex/fields/LongTextFieldIndex.js.map +1 -0
- package/features/CmsEntryOpenSearchFieldIndex/fields/NumberFieldIndex.d.ts +11 -0
- package/{elasticsearch/indexing/numberIndexing.js → features/CmsEntryOpenSearchFieldIndex/fields/NumberFieldIndex.js} +11 -15
- package/features/CmsEntryOpenSearchFieldIndex/fields/NumberFieldIndex.js.map +1 -0
- package/features/CmsEntryOpenSearchFieldIndex/fields/ObjectFieldIndex.d.ts +10 -0
- package/features/CmsEntryOpenSearchFieldIndex/fields/ObjectFieldIndex.js +158 -0
- package/features/CmsEntryOpenSearchFieldIndex/fields/ObjectFieldIndex.js.map +1 -0
- package/features/CmsEntryOpenSearchFieldIndex/fields/RichTextFieldIndex.d.ts +10 -0
- package/features/CmsEntryOpenSearchFieldIndex/fields/RichTextFieldIndex.js +22 -0
- package/features/CmsEntryOpenSearchFieldIndex/fields/RichTextFieldIndex.js.map +1 -0
- package/features/CmsEntryOpenSearchFieldIndex/index.d.ts +3 -0
- package/features/CmsEntryOpenSearchFieldIndex/index.js +5 -0
- package/features/CmsEntryOpenSearchFieldIndex/index.js.map +1 -0
- package/features/CmsEntryOpenSearchFilter/CmsEntryOpenSearchFilterRegistry.d.ts +11 -0
- package/features/CmsEntryOpenSearchFilter/CmsEntryOpenSearchFilterRegistry.js +38 -0
- package/features/CmsEntryOpenSearchFilter/CmsEntryOpenSearchFilterRegistry.js.map +1 -0
- package/features/CmsEntryOpenSearchFilter/abstractions/CmsEntryOpenSearchFilter.d.ts +37 -0
- package/features/CmsEntryOpenSearchFilter/abstractions/CmsEntryOpenSearchFilter.js +4 -0
- package/features/CmsEntryOpenSearchFilter/abstractions/CmsEntryOpenSearchFilter.js.map +1 -0
- package/features/CmsEntryOpenSearchFilter/abstractions/CmsEntryOpenSearchFilterRegistry.d.ts +9 -0
- package/features/CmsEntryOpenSearchFilter/abstractions/CmsEntryOpenSearchFilterRegistry.js +4 -0
- package/features/CmsEntryOpenSearchFilter/abstractions/CmsEntryOpenSearchFilterRegistry.js.map +1 -0
- package/features/CmsEntryOpenSearchFilter/constants.d.ts +1 -0
- package/features/CmsEntryOpenSearchFilter/constants.js +3 -0
- package/features/CmsEntryOpenSearchFilter/constants.js.map +1 -0
- package/features/CmsEntryOpenSearchFilter/feature.d.ts +4 -0
- package/features/CmsEntryOpenSearchFilter/feature.js +16 -0
- package/features/CmsEntryOpenSearchFilter/feature.js.map +1 -0
- package/features/CmsEntryOpenSearchFilter/fields/DefaultFilter.d.ts +9 -0
- package/features/CmsEntryOpenSearchFilter/fields/DefaultFilter.js +23 -0
- package/features/CmsEntryOpenSearchFilter/fields/DefaultFilter.js.map +1 -0
- package/features/CmsEntryOpenSearchFilter/fields/ObjectFilter.d.ts +9 -0
- package/features/CmsEntryOpenSearchFilter/fields/ObjectFilter.js +61 -0
- package/features/CmsEntryOpenSearchFilter/fields/ObjectFilter.js.map +1 -0
- package/features/CmsEntryOpenSearchFilter/fields/RefFilter.d.ts +9 -0
- package/features/CmsEntryOpenSearchFilter/fields/RefFilter.js +49 -0
- package/features/CmsEntryOpenSearchFilter/fields/RefFilter.js.map +1 -0
- package/features/CmsEntryOpenSearchFilter/index.d.ts +3 -0
- package/features/CmsEntryOpenSearchFilter/index.js +5 -0
- package/features/CmsEntryOpenSearchFilter/index.js.map +1 -0
- package/features/CmsEntryOpenSearchFullTextSearch/abstractions.d.ts +20 -0
- package/features/CmsEntryOpenSearchFullTextSearch/abstractions.js +4 -0
- package/features/CmsEntryOpenSearchFullTextSearch/abstractions.js.map +1 -0
- package/features/CmsEntryOpenSearchFullTextSearch/index.d.ts +1 -0
- package/features/CmsEntryOpenSearchFullTextSearch/index.js +3 -0
- package/features/CmsEntryOpenSearchFullTextSearch/index.js.map +1 -0
- package/features/CmsEntryOpenSearchIndex/BaseOpenSearchIndex.d.ts +11 -0
- package/features/CmsEntryOpenSearchIndex/BaseOpenSearchIndex.js +16 -0
- package/features/CmsEntryOpenSearchIndex/BaseOpenSearchIndex.js.map +1 -0
- package/features/CmsEntryOpenSearchIndex/abstractions.d.ts +14 -0
- package/features/CmsEntryOpenSearchIndex/abstractions.js +4 -0
- package/features/CmsEntryOpenSearchIndex/abstractions.js.map +1 -0
- package/features/CmsEntryOpenSearchIndex/feature.d.ts +4 -0
- package/features/CmsEntryOpenSearchIndex/feature.js +10 -0
- package/features/CmsEntryOpenSearchIndex/feature.js.map +1 -0
- package/features/CmsEntryOpenSearchIndex/index.d.ts +3 -0
- package/features/CmsEntryOpenSearchIndex/index.js +5 -0
- package/features/CmsEntryOpenSearchIndex/index.js.map +1 -0
- package/features/CmsEntryOpenSearchQueryModifier/abstractions.d.ts +16 -0
- package/features/CmsEntryOpenSearchQueryModifier/abstractions.js +4 -0
- package/features/CmsEntryOpenSearchQueryModifier/abstractions.js.map +1 -0
- package/features/CmsEntryOpenSearchQueryModifier/index.d.ts +1 -0
- package/features/CmsEntryOpenSearchQueryModifier/index.js +3 -0
- package/features/CmsEntryOpenSearchQueryModifier/index.js.map +1 -0
- package/features/CmsEntryOpenSearchSortModifier/abstractions.d.ts +15 -0
- package/features/CmsEntryOpenSearchSortModifier/abstractions.js +4 -0
- package/features/CmsEntryOpenSearchSortModifier/abstractions.js.map +1 -0
- package/features/CmsEntryOpenSearchSortModifier/index.d.ts +1 -0
- package/features/CmsEntryOpenSearchSortModifier/index.js +3 -0
- package/features/CmsEntryOpenSearchSortModifier/index.js.map +1 -0
- package/features/CmsEntryOpenSearchValueSearch/CmsEntryOpenSearchValueSearchRegistry.d.ts +12 -0
- package/features/CmsEntryOpenSearchValueSearch/CmsEntryOpenSearchValueSearchRegistry.js +27 -0
- package/features/CmsEntryOpenSearchValueSearch/CmsEntryOpenSearchValueSearchRegistry.js.map +1 -0
- package/features/CmsEntryOpenSearchValueSearch/abstractions/CmsEntryOpenSearchValueSearch.d.ts +22 -0
- package/features/CmsEntryOpenSearchValueSearch/abstractions/CmsEntryOpenSearchValueSearch.js +4 -0
- package/features/CmsEntryOpenSearchValueSearch/abstractions/CmsEntryOpenSearchValueSearch.js.map +1 -0
- package/features/CmsEntryOpenSearchValueSearch/abstractions/CmsEntryOpenSearchValueSearchRegistry.d.ts +10 -0
- package/features/CmsEntryOpenSearchValueSearch/abstractions/CmsEntryOpenSearchValueSearchRegistry.js +4 -0
- package/features/CmsEntryOpenSearchValueSearch/abstractions/CmsEntryOpenSearchValueSearchRegistry.js.map +1 -0
- package/features/CmsEntryOpenSearchValueSearch/feature.d.ts +4 -0
- package/features/CmsEntryOpenSearchValueSearch/feature.js +16 -0
- package/features/CmsEntryOpenSearchValueSearch/feature.js.map +1 -0
- package/features/CmsEntryOpenSearchValueSearch/fields/RefSearch.d.ts +10 -0
- package/features/CmsEntryOpenSearchValueSearch/fields/RefSearch.js +23 -0
- package/features/CmsEntryOpenSearchValueSearch/fields/RefSearch.js.map +1 -0
- package/features/CmsEntryOpenSearchValueSearch/fields/SearchableJsonSearch.d.ts +10 -0
- package/features/CmsEntryOpenSearchValueSearch/fields/SearchableJsonSearch.js +55 -0
- package/features/CmsEntryOpenSearchValueSearch/fields/SearchableJsonSearch.js.map +1 -0
- package/features/CmsEntryOpenSearchValueSearch/fields/TimeSearch.d.ts +10 -0
- package/features/CmsEntryOpenSearchValueSearch/fields/TimeSearch.js +24 -0
- package/features/CmsEntryOpenSearchValueSearch/fields/TimeSearch.js.map +1 -0
- package/features/CmsEntryOpenSearchValueSearch/index.d.ts +3 -0
- package/features/CmsEntryOpenSearchValueSearch/index.js +5 -0
- package/features/CmsEntryOpenSearchValueSearch/index.js.map +1 -0
- package/features/CmsEntryOpenSearchValuesModifier/abstractions.d.ts +23 -0
- package/features/CmsEntryOpenSearchValuesModifier/abstractions.js +4 -0
- package/features/CmsEntryOpenSearchValuesModifier/abstractions.js.map +1 -0
- package/features/CmsEntryOpenSearchValuesModifier/index.d.ts +1 -0
- package/features/CmsEntryOpenSearchValuesModifier/index.js +3 -0
- package/features/CmsEntryOpenSearchValuesModifier/index.js.map +1 -0
- package/helpers/entryIndexHelpers.d.ts +13 -11
- package/helpers/entryIndexHelpers.js +38 -94
- package/helpers/entryIndexHelpers.js.map +1 -1
- package/helpers/fieldIdentifier.d.ts +1 -1
- package/helpers/fieldIdentifier.js +2 -10
- package/helpers/fieldIdentifier.js.map +1 -1
- package/helpers/index.d.ts +2 -2
- package/helpers/index.js +2 -27
- package/helpers/index.js.map +1 -1
- package/index.d.ts +1 -3
- package/index.js +1 -223
- package/index.js.map +1 -1
- package/operations/entry/dataLoader/DataLoaderCache.d.ts +1 -2
- package/operations/entry/dataLoader/DataLoaderCache.js +3 -13
- package/operations/entry/dataLoader/DataLoaderCache.js.map +1 -1
- package/operations/entry/dataLoader/constants.js +1 -7
- package/operations/entry/dataLoader/constants.js.map +1 -1
- package/operations/entry/dataLoader/createBatchScheduleFn.js +4 -10
- package/operations/entry/dataLoader/createBatchScheduleFn.js.map +1 -1
- package/operations/entry/dataLoader/getAllEntryRevisions.d.ts +3 -3
- package/operations/entry/dataLoader/getAllEntryRevisions.js +16 -26
- package/operations/entry/dataLoader/getAllEntryRevisions.js.map +1 -1
- package/operations/entry/dataLoader/getLatestRevisionByEntryId.d.ts +3 -3
- package/operations/entry/dataLoader/getLatestRevisionByEntryId.js +23 -31
- package/operations/entry/dataLoader/getLatestRevisionByEntryId.js.map +1 -1
- package/operations/entry/dataLoader/getPublishedRevisionByEntryId.d.ts +3 -3
- package/operations/entry/dataLoader/getPublishedRevisionByEntryId.js +23 -31
- package/operations/entry/dataLoader/getPublishedRevisionByEntryId.js.map +1 -1
- package/operations/entry/dataLoader/getRevisionById.d.ts +3 -3
- package/operations/entry/dataLoader/getRevisionById.js +26 -34
- package/operations/entry/dataLoader/getRevisionById.js.map +1 -1
- package/operations/entry/dataLoader/index.d.ts +3 -3
- package/operations/entry/dataLoader/index.js +10 -31
- package/operations/entry/dataLoader/index.js.map +1 -1
- package/operations/entry/dataLoader/types.d.ts +4 -4
- package/operations/entry/dataLoader/types.js +1 -5
- package/operations/entry/dataLoader/types.js.map +1 -1
- package/operations/entry/dataLoaders.d.ts +13 -13
- package/operations/entry/dataLoaders.js +16 -24
- package/operations/entry/dataLoaders.js.map +1 -1
- package/operations/entry/elasticsearch/assignMinimumShouldMatchToQuery.d.ts +1 -1
- package/operations/entry/elasticsearch/assignMinimumShouldMatchToQuery.js +1 -8
- package/operations/entry/elasticsearch/assignMinimumShouldMatchToQuery.js.map +1 -1
- package/operations/entry/elasticsearch/body.d.ts +20 -4
- package/operations/entry/elasticsearch/body.js +49 -53
- package/operations/entry/elasticsearch/body.js.map +1 -1
- package/operations/entry/elasticsearch/fields/createSystemField.d.ts +4 -0
- package/operations/entry/elasticsearch/fields/createSystemField.js +10 -0
- package/operations/entry/elasticsearch/fields/createSystemField.js.map +1 -0
- package/operations/entry/elasticsearch/fields/live.d.ts +2 -0
- package/operations/entry/elasticsearch/fields/live.js +45 -0
- package/operations/entry/elasticsearch/fields/live.js.map +1 -0
- package/operations/entry/elasticsearch/fields/location.d.ts +2 -0
- package/operations/entry/elasticsearch/fields/location.js +45 -0
- package/operations/entry/elasticsearch/fields/location.js.map +1 -0
- package/operations/entry/elasticsearch/fields/state.d.ts +2 -0
- package/operations/entry/elasticsearch/fields/state.js +93 -0
- package/operations/entry/elasticsearch/fields/state.js.map +1 -0
- package/operations/entry/elasticsearch/fields.d.ts +8 -6
- package/operations/entry/elasticsearch/fields.js +38 -122
- package/operations/entry/elasticsearch/fields.js.map +1 -1
- package/operations/entry/elasticsearch/filtering/applyFiltering.d.ts +6 -5
- package/operations/entry/elasticsearch/filtering/applyFiltering.js +13 -20
- package/operations/entry/elasticsearch/filtering/applyFiltering.js.map +1 -1
- package/operations/entry/elasticsearch/filtering/exec.d.ts +11 -6
- package/operations/entry/elasticsearch/filtering/exec.js +47 -97
- package/operations/entry/elasticsearch/filtering/exec.js.map +1 -1
- package/operations/entry/elasticsearch/filtering/index.d.ts +1 -1
- package/operations/entry/elasticsearch/filtering/index.js +1 -16
- package/operations/entry/elasticsearch/filtering/index.js.map +1 -1
- package/operations/entry/elasticsearch/filtering/path.d.ts +5 -3
- package/operations/entry/elasticsearch/filtering/path.js +10 -20
- package/operations/entry/elasticsearch/filtering/path.js.map +1 -1
- package/operations/entry/elasticsearch/filtering/populated.d.ts +2 -2
- package/operations/entry/elasticsearch/filtering/populated.js +1 -8
- package/operations/entry/elasticsearch/filtering/populated.js.map +1 -1
- package/operations/entry/elasticsearch/filtering/values.d.ts +1 -1
- package/operations/entry/elasticsearch/filtering/values.js +4 -12
- package/operations/entry/elasticsearch/filtering/values.js.map +1 -1
- package/operations/entry/elasticsearch/fullTextSearch.d.ts +7 -6
- package/operations/entry/elasticsearch/fullTextSearch.js +39 -42
- package/operations/entry/elasticsearch/fullTextSearch.js.map +1 -1
- package/operations/entry/elasticsearch/fullTextSearchFields.d.ts +4 -4
- package/operations/entry/elasticsearch/fullTextSearchFields.js +11 -18
- package/operations/entry/elasticsearch/fullTextSearchFields.js.map +1 -1
- package/operations/entry/elasticsearch/initialQuery.d.ts +4 -4
- package/operations/entry/elasticsearch/initialQuery.js +9 -27
- package/operations/entry/elasticsearch/initialQuery.js.map +1 -1
- package/operations/entry/elasticsearch/keyword.d.ts +1 -1
- package/operations/entry/elasticsearch/keyword.js +4 -9
- package/operations/entry/elasticsearch/keyword.js.map +1 -1
- package/operations/entry/elasticsearch/plugins/operator.d.ts +2 -3
- package/operations/entry/elasticsearch/plugins/operator.js +4 -19
- package/operations/entry/elasticsearch/plugins/operator.js.map +1 -1
- package/operations/entry/elasticsearch/shouldIgnoreEsResponseError.js +2 -9
- package/operations/entry/elasticsearch/shouldIgnoreEsResponseError.js.map +1 -1
- package/operations/entry/elasticsearch/sort.d.ts +6 -6
- package/operations/entry/elasticsearch/sort.js +52 -36
- package/operations/entry/elasticsearch/sort.js.map +1 -1
- package/operations/entry/elasticsearch/transformValueForSearch.d.ts +3 -10
- package/operations/entry/elasticsearch/transformValueForSearch.js +5 -20
- package/operations/entry/elasticsearch/transformValueForSearch.js.map +1 -1
- package/operations/entry/elasticsearch/types.d.ts +4 -11
- package/operations/entry/elasticsearch/types.js +1 -5
- package/operations/entry/elasticsearch/types.js.map +1 -1
- package/operations/entry/index.d.ts +26 -5
- package/operations/entry/index.js +421 -541
- package/operations/entry/index.js.map +1 -1
- package/operations/entry/keys.d.ts +31 -1
- package/operations/entry/keys.js +56 -19
- package/operations/entry/keys.js.map +1 -1
- package/operations/entry/recordType.js +3 -12
- package/operations/entry/recordType.js.map +1 -1
- package/operations/entry/transformations/convertEntryKeys.d.ts +6 -6
- package/operations/entry/transformations/convertEntryKeys.js +2 -10
- package/operations/entry/transformations/convertEntryKeys.js.map +1 -1
- package/operations/entry/transformations/index.d.ts +24 -18
- package/operations/entry/transformations/index.js +31 -37
- package/operations/entry/transformations/index.js.map +1 -1
- package/operations/entry/transformations/modifyEntryValues.d.ts +30 -35
- package/operations/entry/transformations/modifyEntryValues.js +4 -11
- package/operations/entry/transformations/modifyEntryValues.js.map +1 -1
- package/operations/entry/transformations/transformEntryKeys.d.ts +8 -8
- package/operations/entry/transformations/transformEntryKeys.js +4 -11
- package/operations/entry/transformations/transformEntryKeys.js.map +1 -1
- package/operations/entry/transformations/transformEntryToIndex.d.ts +10 -8
- package/operations/entry/transformations/transformEntryToIndex.js +9 -14
- package/operations/entry/transformations/transformEntryToIndex.js.map +1 -1
- package/operations/group/index.d.ts +7 -6
- package/operations/group/index.js +41 -78
- package/operations/group/index.js.map +1 -1
- package/operations/model/index.d.ts +4 -4
- package/operations/model/index.js +38 -58
- package/operations/model/index.js.map +1 -1
- package/package.json +32 -34
- package/tasks/createIndexTaskPlugin.d.ts +2 -2
- package/tasks/createIndexTaskPlugin.js +41 -60
- package/tasks/createIndexTaskPlugin.js.map +1 -1
- package/types.d.ts +26 -134
- package/types.js +2 -28
- package/types.js.map +1 -1
- package/values/NoValueContainer.d.ts +5 -0
- package/values/NoValueContainer.js +13 -0
- package/values/NoValueContainer.js.map +1 -0
- 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/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.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.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 -12
- 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/timeSearch.d.ts +0 -2
- package/elasticsearch/search/timeSearch.js +0 -27
- package/elasticsearch/search/timeSearch.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/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/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/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 -31
- 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
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import type { CmsEntry, CmsStorageEntry, StorageOperationsCmsModel } from "@webiny/api-headless-cms/types";
|
|
2
|
-
interface TransformKeysParams {
|
|
3
|
-
model: StorageOperationsCmsModel
|
|
4
|
-
entry: CmsEntry
|
|
5
|
-
storageEntry: CmsStorageEntry
|
|
1
|
+
import type { CmsEntry, CmsEntryValues, CmsStorageEntry, StorageOperationsCmsModel } from "@webiny/api-headless-cms/types/index.js";
|
|
2
|
+
interface TransformKeysParams<T extends CmsEntryValues = CmsEntryValues> {
|
|
3
|
+
model: StorageOperationsCmsModel<T>;
|
|
4
|
+
entry: CmsEntry<T>;
|
|
5
|
+
storageEntry: CmsStorageEntry<T>;
|
|
6
6
|
}
|
|
7
|
-
export declare const transformEntryKeys: (params: TransformKeysParams) => {
|
|
8
|
-
entry: CmsStorageEntry
|
|
9
|
-
storageEntry: CmsStorageEntry
|
|
7
|
+
export declare const transformEntryKeys: <T extends CmsEntryValues = CmsEntryValues>(params: TransformKeysParams<T>) => {
|
|
8
|
+
entry: CmsStorageEntry<T>;
|
|
9
|
+
storageEntry: CmsStorageEntry<T>;
|
|
10
10
|
};
|
|
11
11
|
export {};
|
|
@@ -1,27 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.transformEntryKeys = void 0;
|
|
7
|
-
var _convertEntryKeys = require("./convertEntryKeys");
|
|
8
|
-
const transformEntryKeys = params => {
|
|
1
|
+
import { convertEntryKeysToStorage } from "./convertEntryKeys.js";
|
|
2
|
+
export const transformEntryKeys = params => {
|
|
9
3
|
const {
|
|
10
4
|
model,
|
|
11
5
|
entry,
|
|
12
6
|
storageEntry
|
|
13
7
|
} = params;
|
|
14
8
|
return {
|
|
15
|
-
entry:
|
|
9
|
+
entry: convertEntryKeysToStorage({
|
|
16
10
|
model,
|
|
17
11
|
entry
|
|
18
12
|
}),
|
|
19
|
-
storageEntry:
|
|
13
|
+
storageEntry: convertEntryKeysToStorage({
|
|
20
14
|
model,
|
|
21
15
|
entry: storageEntry
|
|
22
16
|
})
|
|
23
17
|
};
|
|
24
18
|
};
|
|
25
|
-
exports.transformEntryKeys = transformEntryKeys;
|
|
26
19
|
|
|
27
20
|
//# sourceMappingURL=transformEntryKeys.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["convertEntryKeysToStorage","transformEntryKeys","params","model","entry","storageEntry"],"sources":["transformEntryKeys.ts"],"sourcesContent":["import type {\n CmsEntry,\n CmsEntryValues,\n CmsStorageEntry,\n StorageOperationsCmsModel\n} from \"@webiny/api-headless-cms/types/index.js\";\nimport { convertEntryKeysToStorage } from \"./convertEntryKeys.js\";\n\ninterface TransformKeysParams<T extends CmsEntryValues = CmsEntryValues> {\n model: StorageOperationsCmsModel<T>;\n entry: CmsEntry<T>;\n storageEntry: CmsStorageEntry<T>;\n}\n\nexport const transformEntryKeys = <T extends CmsEntryValues = CmsEntryValues>(\n params: TransformKeysParams<T>\n) => {\n const { model, entry, storageEntry } = params;\n return {\n entry: convertEntryKeysToStorage<T>({\n model,\n entry\n }),\n storageEntry: convertEntryKeysToStorage<T>({\n model,\n entry: storageEntry\n })\n };\n};\n"],"mappings":"AAMA,SAASA,yBAAyB;AAQlC,OAAO,MAAMC,kBAAkB,GAC3BC,MAA8B,IAC7B;EACD,MAAM;IAAEC,KAAK;IAAEC,KAAK;IAAEC;EAAa,CAAC,GAAGH,MAAM;EAC7C,OAAO;IACHE,KAAK,EAAEJ,yBAAyB,CAAI;MAChCG,KAAK;MACLC;IACJ,CAAC,CAAC;IACFC,YAAY,EAAEL,yBAAyB,CAAI;MACvCG,KAAK;MACLC,KAAK,EAAEC;IACX,CAAC;EACL,CAAC;AACL,CAAC","ignoreList":[]}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
model: StorageOperationsCmsModel
|
|
6
|
-
entry: CmsEntry
|
|
7
|
-
storageEntry: CmsStorageEntry
|
|
1
|
+
import type { CmsEntry, CmsEntryValues, CmsStorageEntry, StorageOperationsCmsModel } from "@webiny/api-headless-cms/types/index.js";
|
|
2
|
+
import type { CmsModelFieldToGraphQLRegistry } from "@webiny/api-headless-cms/features/graphql/index.js";
|
|
3
|
+
import type { CmsEntryOpenSearchFieldIndexRegistry } from "../../../features/CmsEntryOpenSearchFieldIndex/index.js";
|
|
4
|
+
interface TransformEntryToIndexParams<T extends CmsEntryValues = CmsEntryValues> {
|
|
5
|
+
model: StorageOperationsCmsModel<T>;
|
|
6
|
+
entry: CmsEntry<T>;
|
|
7
|
+
storageEntry: CmsStorageEntry<T>;
|
|
8
|
+
fieldRegistry: CmsModelFieldToGraphQLRegistry.Interface;
|
|
9
|
+
fieldIndexRegistry: CmsEntryOpenSearchFieldIndexRegistry.Interface;
|
|
8
10
|
}
|
|
9
|
-
export declare const transformEntryToIndex: (params: TransformEntryToIndexParams) => import("../../../types").CmsIndexEntry
|
|
11
|
+
export declare const transformEntryToIndex: <T extends CmsEntryValues = CmsEntryValues>(params: TransformEntryToIndexParams<T>) => import("../../../types").CmsIndexEntry<T>;
|
|
10
12
|
export {};
|
|
@@ -1,22 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.transformEntryToIndex = void 0;
|
|
7
|
-
var _helpers = require("../../../helpers");
|
|
8
|
-
const transformEntryToIndex = params => {
|
|
1
|
+
import { prepareEntryToIndex } from "../../../helpers/index.js";
|
|
2
|
+
export const transformEntryToIndex = params => {
|
|
9
3
|
const {
|
|
10
|
-
plugins,
|
|
11
4
|
model,
|
|
12
5
|
entry,
|
|
13
|
-
storageEntry
|
|
6
|
+
storageEntry,
|
|
7
|
+
fieldRegistry,
|
|
8
|
+
fieldIndexRegistry
|
|
14
9
|
} = params;
|
|
15
|
-
const result =
|
|
16
|
-
plugins,
|
|
10
|
+
const result = prepareEntryToIndex({
|
|
17
11
|
model,
|
|
18
12
|
entry: structuredClone(entry),
|
|
19
|
-
storageEntry: structuredClone(storageEntry)
|
|
13
|
+
storageEntry: structuredClone(storageEntry),
|
|
14
|
+
fieldRegistry,
|
|
15
|
+
fieldIndexRegistry
|
|
20
16
|
});
|
|
21
17
|
delete result["PK"];
|
|
22
18
|
delete result["SK"];
|
|
@@ -26,6 +22,5 @@ const transformEntryToIndex = params => {
|
|
|
26
22
|
delete result["latest"];
|
|
27
23
|
return result;
|
|
28
24
|
};
|
|
29
|
-
exports.transformEntryToIndex = transformEntryToIndex;
|
|
30
25
|
|
|
31
26
|
//# sourceMappingURL=transformEntryToIndex.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["prepareEntryToIndex","transformEntryToIndex","params","model","entry","storageEntry","fieldRegistry","fieldIndexRegistry","result","structuredClone"],"sources":["transformEntryToIndex.ts"],"sourcesContent":["import type {\n CmsEntry,\n CmsEntryValues,\n CmsStorageEntry,\n StorageOperationsCmsModel\n} from \"@webiny/api-headless-cms/types/index.js\";\nimport { prepareEntryToIndex } from \"~/helpers/index.js\";\nimport type { CmsModelFieldToGraphQLRegistry } from \"@webiny/api-headless-cms/features/graphql/index.js\";\nimport type { CmsEntryOpenSearchFieldIndexRegistry } from \"~/features/CmsEntryOpenSearchFieldIndex/index.js\";\n\ninterface TransformEntryToIndexParams<T extends CmsEntryValues = CmsEntryValues> {\n model: StorageOperationsCmsModel<T>;\n entry: CmsEntry<T>;\n storageEntry: CmsStorageEntry<T>;\n fieldRegistry: CmsModelFieldToGraphQLRegistry.Interface;\n fieldIndexRegistry: CmsEntryOpenSearchFieldIndexRegistry.Interface;\n}\n\nexport const transformEntryToIndex = <T extends CmsEntryValues = CmsEntryValues>(\n params: TransformEntryToIndexParams<T>\n) => {\n const { model, entry, storageEntry, fieldRegistry, fieldIndexRegistry } = params;\n const result = prepareEntryToIndex<T>({\n model,\n entry: structuredClone(entry),\n storageEntry: structuredClone(storageEntry),\n fieldRegistry,\n fieldIndexRegistry\n });\n\n delete result[\"PK\"];\n delete result[\"SK\"];\n delete result[\"GSI1_PK\"];\n delete result[\"GSI1_SK\"];\n delete result[\"published\"];\n delete result[\"latest\"];\n\n return result;\n};\n"],"mappings":"AAMA,SAASA,mBAAmB;AAY5B,OAAO,MAAMC,qBAAqB,GAC9BC,MAAsC,IACrC;EACD,MAAM;IAAEC,KAAK;IAAEC,KAAK;IAAEC,YAAY;IAAEC,aAAa;IAAEC;EAAmB,CAAC,GAAGL,MAAM;EAChF,MAAMM,MAAM,GAAGR,mBAAmB,CAAI;IAClCG,KAAK;IACLC,KAAK,EAAEK,eAAe,CAACL,KAAK,CAAC;IAC7BC,YAAY,EAAEI,eAAe,CAACJ,YAAY,CAAC;IAC3CC,aAAa;IACbC;EACJ,CAAC,CAAC;EAEF,OAAOC,MAAM,CAAC,IAAI,CAAC;EACnB,OAAOA,MAAM,CAAC,IAAI,CAAC;EACnB,OAAOA,MAAM,CAAC,SAAS,CAAC;EACxB,OAAOA,MAAM,CAAC,SAAS,CAAC;EACxB,OAAOA,MAAM,CAAC,WAAW,CAAC;EAC1B,OAAOA,MAAM,CAAC,QAAQ,CAAC;EAEvB,OAAOA,MAAM;AACjB,CAAC","ignoreList":[]}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import type { CmsGroupStorageOperations } from "@webiny/api-headless-cms/types";
|
|
2
|
-
import
|
|
3
|
-
import type {
|
|
4
|
-
|
|
5
|
-
entity:
|
|
6
|
-
|
|
1
|
+
import type { CmsGroupStorageOperations } from "@webiny/api-headless-cms/types/index.js";
|
|
2
|
+
import { IGroupEntity } from "../../definitions/types.js";
|
|
3
|
+
import type { CmsContext } from "../../types.js";
|
|
4
|
+
interface CreateGroupsStorageOperationsParams {
|
|
5
|
+
entity: IGroupEntity;
|
|
6
|
+
container: CmsContext["container"];
|
|
7
7
|
}
|
|
8
8
|
export declare const createGroupsStorageOperations: (params: CreateGroupsStorageOperationsParams) => CmsGroupStorageOperations;
|
|
9
|
+
export {};
|
|
@@ -1,23 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.createGroupsStorageOperations = void 0;
|
|
8
|
-
var _error = _interopRequireDefault(require("@webiny/error"));
|
|
9
|
-
var _get = require("@webiny/db-dynamodb/utils/get");
|
|
10
|
-
var _query = require("@webiny/db-dynamodb/utils/query");
|
|
11
|
-
var _filter = require("@webiny/db-dynamodb/utils/filter");
|
|
12
|
-
var _ValueFilterPlugin = require("@webiny/db-dynamodb/plugins/definitions/ValueFilterPlugin");
|
|
13
|
-
var _sort = require("@webiny/db-dynamodb/utils/sort");
|
|
14
|
-
var _dbDynamodb = require("@webiny/db-dynamodb");
|
|
1
|
+
import WebinyError from "@webiny/error";
|
|
2
|
+
import { sortItems } from "@webiny/db-dynamodb";
|
|
3
|
+
import { FilterUtil } from "@webiny/db-dynamodb/exports/api/db.js";
|
|
15
4
|
const createPartitionKey = params => {
|
|
16
5
|
const {
|
|
17
|
-
tenant
|
|
18
|
-
locale
|
|
6
|
+
tenant
|
|
19
7
|
} = params;
|
|
20
|
-
return `T#${tenant}#
|
|
8
|
+
return `T#${tenant}#CMS#CMG`;
|
|
21
9
|
};
|
|
22
10
|
const createSortKeys = params => {
|
|
23
11
|
const {
|
|
@@ -28,38 +16,32 @@ const createSortKeys = params => {
|
|
|
28
16
|
const createKeys = params => {
|
|
29
17
|
return {
|
|
30
18
|
PK: createPartitionKey(params),
|
|
31
|
-
SK: createSortKeys(params)
|
|
19
|
+
SK: createSortKeys(params),
|
|
20
|
+
GSI_TENANT: params.tenant
|
|
32
21
|
};
|
|
33
22
|
};
|
|
34
23
|
const createType = () => {
|
|
35
24
|
return "cms.group";
|
|
36
25
|
};
|
|
37
|
-
const createGroupsStorageOperations = params => {
|
|
26
|
+
export const createGroupsStorageOperations = params => {
|
|
38
27
|
const {
|
|
39
28
|
entity,
|
|
40
|
-
|
|
29
|
+
container
|
|
41
30
|
} = params;
|
|
42
|
-
const
|
|
43
|
-
if (filteringPlugins.length === 0) {
|
|
44
|
-
throw new _error.default("DynamoDB filtering plugins not loaded.", "MISSING_DYNAMODB_FILTERING_PLUGINS");
|
|
45
|
-
}
|
|
31
|
+
const filterUtil = container.resolve(FilterUtil);
|
|
46
32
|
const create = async params => {
|
|
47
33
|
const {
|
|
48
34
|
group
|
|
49
35
|
} = params;
|
|
50
36
|
const keys = createKeys(group);
|
|
51
37
|
try {
|
|
52
|
-
await
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
TYPE: createType(),
|
|
57
|
-
...keys
|
|
58
|
-
}
|
|
38
|
+
await entity.put({
|
|
39
|
+
data: group,
|
|
40
|
+
TYPE: createType(),
|
|
41
|
+
...keys
|
|
59
42
|
});
|
|
60
|
-
return group;
|
|
61
43
|
} catch (ex) {
|
|
62
|
-
throw new
|
|
44
|
+
throw new WebinyError(ex.message || "Could not create group.", ex.code || "CREATE_GROUP_ERROR", {
|
|
63
45
|
error: ex,
|
|
64
46
|
group,
|
|
65
47
|
keys
|
|
@@ -72,17 +54,13 @@ const createGroupsStorageOperations = params => {
|
|
|
72
54
|
} = params;
|
|
73
55
|
const keys = createKeys(group);
|
|
74
56
|
try {
|
|
75
|
-
await
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
TYPE: createType(),
|
|
80
|
-
...keys
|
|
81
|
-
}
|
|
57
|
+
await entity.put({
|
|
58
|
+
data: group,
|
|
59
|
+
TYPE: createType(),
|
|
60
|
+
...keys
|
|
82
61
|
});
|
|
83
|
-
return group;
|
|
84
62
|
} catch (ex) {
|
|
85
|
-
throw new
|
|
63
|
+
throw new WebinyError(ex.message || "Could not update group.", ex.code || "UPDATE_GROUP_ERROR", {
|
|
86
64
|
error: ex,
|
|
87
65
|
group,
|
|
88
66
|
keys
|
|
@@ -95,13 +73,9 @@ const createGroupsStorageOperations = params => {
|
|
|
95
73
|
} = params;
|
|
96
74
|
const keys = createKeys(group);
|
|
97
75
|
try {
|
|
98
|
-
await (
|
|
99
|
-
entity,
|
|
100
|
-
keys
|
|
101
|
-
});
|
|
102
|
-
return group;
|
|
76
|
+
await entity.delete(keys);
|
|
103
77
|
} catch (ex) {
|
|
104
|
-
throw new
|
|
78
|
+
throw new WebinyError(ex.message || "Could not delete group.", ex.code || "DELETE_GROUP_ERROR", {
|
|
105
79
|
error: ex,
|
|
106
80
|
group,
|
|
107
81
|
keys
|
|
@@ -111,12 +85,10 @@ const createGroupsStorageOperations = params => {
|
|
|
111
85
|
const get = async params => {
|
|
112
86
|
const keys = createKeys(params);
|
|
113
87
|
try {
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
keys
|
|
117
|
-
});
|
|
88
|
+
const result = await entity.get(keys);
|
|
89
|
+
return result ? result.data : null;
|
|
118
90
|
} catch (ex) {
|
|
119
|
-
throw new
|
|
91
|
+
throw new WebinyError(ex.message || "Could not get group.", ex.code || "GET_GROUP_ERROR", {
|
|
120
92
|
error: ex,
|
|
121
93
|
...params,
|
|
122
94
|
keys
|
|
@@ -126,44 +98,36 @@ const createGroupsStorageOperations = params => {
|
|
|
126
98
|
const list = async params => {
|
|
127
99
|
const {
|
|
128
100
|
sort,
|
|
129
|
-
where
|
|
101
|
+
where
|
|
130
102
|
} = params;
|
|
131
|
-
const queryAllParams = {
|
|
132
|
-
entity,
|
|
133
|
-
partitionKey: createPartitionKey(initialWhere),
|
|
134
|
-
options: {
|
|
135
|
-
gte: " "
|
|
136
|
-
}
|
|
137
|
-
};
|
|
138
103
|
let records = [];
|
|
139
104
|
try {
|
|
140
|
-
|
|
105
|
+
const ddbRecords = await entity.queryAll({
|
|
106
|
+
partitionKey: createPartitionKey(where),
|
|
107
|
+
options: {
|
|
108
|
+
gte: " "
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
records = ddbRecords.map(item => item.data);
|
|
141
112
|
} catch (ex) {
|
|
142
|
-
throw new
|
|
113
|
+
throw new WebinyError(ex.message || "Could not list groups.", ex.code || "LIST_GROUP_ERROR", {
|
|
143
114
|
error: ex,
|
|
144
115
|
...params,
|
|
145
116
|
sort,
|
|
146
|
-
where
|
|
117
|
+
where
|
|
147
118
|
});
|
|
148
119
|
}
|
|
149
|
-
const
|
|
150
|
-
...initialWhere
|
|
151
|
-
};
|
|
152
|
-
delete where["tenant"];
|
|
153
|
-
delete where["locale"];
|
|
154
|
-
const filteredItems = (0, _dbDynamodb.cleanupItems)(entity, (0, _filter.filterItems)({
|
|
120
|
+
const filteredItems = filterUtil.filter({
|
|
155
121
|
items: records,
|
|
156
122
|
where,
|
|
157
|
-
fields: []
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
if (!sort || sort.length === 0 || filteredItems.length === 0) {
|
|
123
|
+
fields: []
|
|
124
|
+
});
|
|
125
|
+
if (!sort || sort.length === 0) {
|
|
161
126
|
return filteredItems;
|
|
162
127
|
}
|
|
163
|
-
return
|
|
128
|
+
return sortItems({
|
|
164
129
|
items: filteredItems,
|
|
165
|
-
sort
|
|
166
|
-
fields: []
|
|
130
|
+
sort
|
|
167
131
|
});
|
|
168
132
|
};
|
|
169
133
|
return {
|
|
@@ -174,6 +138,5 @@ const createGroupsStorageOperations = params => {
|
|
|
174
138
|
list
|
|
175
139
|
};
|
|
176
140
|
};
|
|
177
|
-
exports.createGroupsStorageOperations = createGroupsStorageOperations;
|
|
178
141
|
|
|
179
142
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_error","_interopRequireDefault","require","_get","_query","_filter","_ValueFilterPlugin","_sort","_dbDynamodb","createPartitionKey","params","tenant","locale","createSortKeys","id","createKeys","PK","SK","createType","createGroupsStorageOperations","entity","plugins","filteringPlugins","byType","ValueFilterPlugin","type","length","WebinyError","create","group","keys","put","item","TYPE","ex","message","code","error","update","deleteGroup","deleteItem","get","getClean","list","sort","where","initialWhere","queryAllParams","partitionKey","options","gte","records","queryAll","filteredItems","cleanupItems","filterItems","items","fields","sortItems","delete","exports"],"sources":["index.ts"],"sourcesContent":["import type {\n CmsGroup,\n CmsGroupStorageOperations,\n CmsGroupStorageOperationsCreateParams,\n CmsGroupStorageOperationsDeleteParams,\n CmsGroupStorageOperationsGetParams,\n CmsGroupStorageOperationsListParams,\n CmsGroupStorageOperationsUpdateParams\n} from \"@webiny/api-headless-cms/types\";\nimport type { Entity } from \"@webiny/db-dynamodb/toolbox\";\nimport WebinyError from \"@webiny/error\";\nimport { getClean } from \"@webiny/db-dynamodb/utils/get\";\nimport type { QueryAllParams } from \"@webiny/db-dynamodb/utils/query\";\nimport { queryAll } from \"@webiny/db-dynamodb/utils/query\";\nimport { filterItems } from \"@webiny/db-dynamodb/utils/filter\";\nimport type { PluginsContainer } from \"@webiny/plugins\";\nimport { ValueFilterPlugin } from \"@webiny/db-dynamodb/plugins/definitions/ValueFilterPlugin\";\nimport { sortItems } from \"@webiny/db-dynamodb/utils/sort\";\nimport { deleteItem, put, cleanupItems } from \"@webiny/db-dynamodb\";\n\ninterface PartitionKeyParams {\n tenant: string;\n locale: string;\n}\nconst createPartitionKey = (params: PartitionKeyParams): string => {\n const { tenant, locale } = params;\n return `T#${tenant}#L#${locale}#CMS#CMG`;\n};\n\ninterface SortKeyParams {\n id: string;\n}\nconst createSortKeys = (params: SortKeyParams): string => {\n const { id } = params;\n return id;\n};\n\ninterface Keys {\n PK: string;\n SK: string;\n}\nconst createKeys = (params: PartitionKeyParams & SortKeyParams): Keys => {\n return {\n PK: createPartitionKey(params),\n SK: createSortKeys(params)\n };\n};\n\nconst createType = (): string => {\n return \"cms.group\";\n};\n\nexport interface CreateGroupsStorageOperationsParams {\n entity: Entity<any>;\n plugins: PluginsContainer;\n}\nexport const createGroupsStorageOperations = (\n params: CreateGroupsStorageOperationsParams\n): CmsGroupStorageOperations => {\n const { entity, plugins } = params;\n\n const filteringPlugins = plugins.byType<ValueFilterPlugin>(ValueFilterPlugin.type);\n if (filteringPlugins.length === 0) {\n throw new WebinyError(\n \"DynamoDB filtering plugins not loaded.\",\n \"MISSING_DYNAMODB_FILTERING_PLUGINS\"\n );\n }\n\n const create = async (params: CmsGroupStorageOperationsCreateParams) => {\n const { group } = params;\n const keys = createKeys(group);\n try {\n await put({\n entity,\n item: {\n ...group,\n TYPE: createType(),\n ...keys\n }\n });\n return group;\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not create group.\",\n ex.code || \"CREATE_GROUP_ERROR\",\n {\n error: ex,\n group,\n keys\n }\n );\n }\n };\n const update = async (params: CmsGroupStorageOperationsUpdateParams) => {\n const { group } = params;\n const keys = createKeys(group);\n try {\n await put({\n entity,\n item: {\n ...group,\n TYPE: createType(),\n ...keys\n }\n });\n return group;\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not update group.\",\n ex.code || \"UPDATE_GROUP_ERROR\",\n {\n error: ex,\n group,\n keys\n }\n );\n }\n };\n const deleteGroup = async (params: CmsGroupStorageOperationsDeleteParams) => {\n const { group } = params;\n const keys = createKeys(group);\n try {\n await deleteItem({\n entity,\n keys\n });\n return group;\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not delete group.\",\n ex.code || \"DELETE_GROUP_ERROR\",\n {\n error: ex,\n group,\n keys\n }\n );\n }\n };\n const get = async (params: CmsGroupStorageOperationsGetParams) => {\n const keys = createKeys(params);\n try {\n return await getClean<CmsGroup>({\n entity,\n keys\n });\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not get group.\",\n ex.code || \"GET_GROUP_ERROR\",\n {\n error: ex,\n ...params,\n keys\n }\n );\n }\n };\n const list = async (params: CmsGroupStorageOperationsListParams) => {\n const { sort, where: initialWhere } = params;\n\n const queryAllParams: QueryAllParams = {\n entity,\n partitionKey: createPartitionKey(initialWhere),\n options: {\n gte: \" \"\n }\n };\n\n let records: CmsGroup[] = [];\n try {\n records = await queryAll(queryAllParams);\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not list groups.\",\n ex.code || \"LIST_GROUP_ERROR\",\n {\n error: ex,\n ...params,\n sort,\n where: initialWhere\n }\n );\n }\n\n const where: Partial<CmsGroupStorageOperationsListParams[\"where\"]> = {\n ...initialWhere\n };\n delete where[\"tenant\"];\n delete where[\"locale\"];\n\n const filteredItems = cleanupItems(\n entity,\n filterItems({\n items: records,\n where,\n fields: [],\n plugins\n })\n );\n\n if (!sort || sort.length === 0 || filteredItems.length === 0) {\n return filteredItems;\n }\n return sortItems({\n items: filteredItems,\n sort,\n fields: []\n });\n };\n\n return {\n create,\n update,\n delete: deleteGroup,\n get,\n list\n };\n};\n"],"mappings":";;;;;;;AAUA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,IAAA,GAAAD,OAAA;AAEA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AAEA,IAAAI,kBAAA,GAAAJ,OAAA;AACA,IAAAK,KAAA,GAAAL,OAAA;AACA,IAAAM,WAAA,GAAAN,OAAA;AAMA,MAAMO,kBAAkB,GAAIC,MAA0B,IAAa;EAC/D,MAAM;IAAEC,MAAM;IAAEC;EAAO,CAAC,GAAGF,MAAM;EACjC,OAAO,KAAKC,MAAM,MAAMC,MAAM,UAAU;AAC5C,CAAC;AAKD,MAAMC,cAAc,GAAIH,MAAqB,IAAa;EACtD,MAAM;IAAEI;EAAG,CAAC,GAAGJ,MAAM;EACrB,OAAOI,EAAE;AACb,CAAC;AAMD,MAAMC,UAAU,GAAIL,MAA0C,IAAW;EACrE,OAAO;IACHM,EAAE,EAAEP,kBAAkB,CAACC,MAAM,CAAC;IAC9BO,EAAE,EAAEJ,cAAc,CAACH,MAAM;EAC7B,CAAC;AACL,CAAC;AAED,MAAMQ,UAAU,GAAGA,CAAA,KAAc;EAC7B,OAAO,WAAW;AACtB,CAAC;AAMM,MAAMC,6BAA6B,GACtCT,MAA2C,IACf;EAC5B,MAAM;IAAEU,MAAM;IAAEC;EAAQ,CAAC,GAAGX,MAAM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AAC;IAED,IAAIC,OAAmB,GAAG,EAAE;IAC5B,IAAI;MACAA,OAAO,GAAG,MAAM,IAAAC,eAAQ,EAACL,cAAc,CAAC;IAC5C,CAAC,CAAC,OAAOb,EAAE,EAAE;MACT,MAAM,IAAIP,cAAW,CACjBO,EAAE,CAACC,OAAO,IAAI,wBAAwB,EACtCD,EAAE,CAACE,IAAI,IAAI,kBAAkB,EAC7B;QACIC,KAAK,EAAEH,EAAE;QACT,GAAGxB,MAAM;QACTkC,IAAI;QACJC,KAAK,EAAEC;MACX,CACJ,CAAC;IACL;IAEA,MAAMD,KAA4D,GAAG;MACjE,GAAGC;IACP,CAAC;IACD,OAAOD,KAAK,CAAC,QAAQ,CAAC;IACtB,OAAOA,KAAK,CAAC,QAAQ,CAAC;IAEtB,MAAMQ,aAAa,GAAG,IAAAC,wBAAY,EAC9BlC,MAAM,EACN,IAAAmC,mBAAW,EAAC;MACRC,KAAK,EAAEL,OAAO;MACdN,KAAK;MACLY,MAAM,EAAE,EAAE;MACVpC;IACJ,CAAC,CACL,CAAC;IAED,IAAI,CAACuB,IAAI,IAAIA,IAAI,CAAClB,MAAM,KAAK,CAAC,IAAI2B,aAAa,CAAC3B,MAAM,KAAK,CAAC,EAAE;MAC1D,OAAO2B,aAAa;IACxB;IACA,OAAO,IAAAK,eAAS,EAAC;MACbF,KAAK,EAAEH,aAAa;MACpBT,IAAI;MACJa,MAAM,EAAE;IACZ,CAAC,CAAC;EACN,CAAC;EAED,OAAO;IACH7B,MAAM;IACNU,MAAM;IACNqB,MAAM,EAAEpB,WAAW;IACnBE,GAAG;IACHE;EACJ,CAAC;AACL,CAAC;AAACiB,OAAA,CAAAzC,6BAAA,GAAAA,6BAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["WebinyError","sortItems","FilterUtil","createPartitionKey","params","tenant","createSortKeys","id","createKeys","PK","SK","GSI_TENANT","createType","createGroupsStorageOperations","entity","container","filterUtil","resolve","create","group","keys","put","data","TYPE","ex","message","code","error","update","deleteGroup","delete","get","result","list","sort","where","records","ddbRecords","queryAll","partitionKey","options","gte","map","item","filteredItems","filter","items","fields","length"],"sources":["index.ts"],"sourcesContent":["import type {\n CmsGroup,\n CmsGroupStorageOperations,\n CmsGroupStorageOperationsCreateParams,\n CmsGroupStorageOperationsDeleteParams,\n CmsGroupStorageOperationsGetParams,\n CmsGroupStorageOperationsListParams,\n CmsGroupStorageOperationsUpdateParams\n} from \"@webiny/api-headless-cms/types/index.js\";\nimport WebinyError from \"@webiny/error\";\nimport { sortItems } from \"@webiny/db-dynamodb\";\nimport { IGroupEntity } from \"~/definitions/types.js\";\nimport { FilterUtil } from \"@webiny/db-dynamodb/exports/api/db.js\";\nimport type { CmsContext } from \"~/types.js\";\n\ninterface PartitionKeyParams {\n tenant: string;\n}\nconst createPartitionKey = (params: PartitionKeyParams): string => {\n const { tenant } = params;\n return `T#${tenant}#CMS#CMG`;\n};\n\ninterface SortKeyParams {\n id: string;\n}\nconst createSortKeys = (params: SortKeyParams): string => {\n const { id } = params;\n return id;\n};\n\ninterface IDynamoDbTableKeys {\n PK: string;\n SK: string;\n GSI_TENANT: string;\n}\nconst createKeys = (params: PartitionKeyParams & SortKeyParams): IDynamoDbTableKeys => {\n return {\n PK: createPartitionKey(params),\n SK: createSortKeys(params),\n GSI_TENANT: params.tenant\n };\n};\n\nconst createType = (): string => {\n return \"cms.group\";\n};\n\ninterface CreateGroupsStorageOperationsParams {\n entity: IGroupEntity;\n container: CmsContext[\"container\"];\n}\nexport const createGroupsStorageOperations = (\n params: CreateGroupsStorageOperationsParams\n): CmsGroupStorageOperations => {\n const { entity, container } = params;\n\n const filterUtil = container.resolve(FilterUtil);\n\n const create = async (params: CmsGroupStorageOperationsCreateParams) => {\n const { group } = params;\n const keys = createKeys(group);\n try {\n await entity.put({\n data: group,\n TYPE: createType(),\n ...keys\n });\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not create group.\",\n ex.code || \"CREATE_GROUP_ERROR\",\n {\n error: ex,\n group,\n keys\n }\n );\n }\n };\n const update = async (params: CmsGroupStorageOperationsUpdateParams) => {\n const { group } = params;\n const keys = createKeys(group);\n try {\n await entity.put({\n data: group,\n TYPE: createType(),\n ...keys\n });\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not update group.\",\n ex.code || \"UPDATE_GROUP_ERROR\",\n {\n error: ex,\n group,\n keys\n }\n );\n }\n };\n const deleteGroup = async (params: CmsGroupStorageOperationsDeleteParams) => {\n const { group } = params;\n const keys = createKeys(group);\n try {\n await entity.delete(keys);\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not delete group.\",\n ex.code || \"DELETE_GROUP_ERROR\",\n {\n error: ex,\n group,\n keys\n }\n );\n }\n };\n const get = async (params: CmsGroupStorageOperationsGetParams) => {\n const keys = createKeys(params);\n\n try {\n const result = await entity.get(keys);\n\n return result ? result.data : null;\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not get group.\",\n ex.code || \"GET_GROUP_ERROR\",\n {\n error: ex,\n ...params,\n keys\n }\n );\n }\n };\n const list = async (params: CmsGroupStorageOperationsListParams) => {\n const { sort, where } = params;\n\n let records: CmsGroup[] = [];\n try {\n const ddbRecords = await entity.queryAll({\n partitionKey: createPartitionKey(where),\n options: {\n gte: \" \"\n }\n });\n records = ddbRecords.map(item => item.data);\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not list groups.\",\n ex.code || \"LIST_GROUP_ERROR\",\n {\n error: ex,\n ...params,\n sort,\n where\n }\n );\n }\n\n const filteredItems = filterUtil.filter({\n items: records,\n where,\n fields: []\n });\n if (!sort || sort.length === 0) {\n return filteredItems;\n }\n\n return sortItems({\n items: filteredItems,\n sort\n });\n };\n\n return {\n create,\n update,\n delete: deleteGroup,\n get,\n list\n };\n};\n"],"mappings":"AASA,OAAOA,WAAW,MAAM,eAAe;AACvC,SAASC,SAAS,QAAQ,qBAAqB;AAE/C,SAASC,UAAU,QAAQ,uCAAuC;AAMlE,MAAMC,kBAAk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8 @@
|
|
|
1
|
-
import type { CmsModelStorageOperations } from "@webiny/api-headless-cms/types";
|
|
2
|
-
import type {
|
|
3
|
-
import type {
|
|
1
|
+
import type { CmsModelStorageOperations } from "@webiny/api-headless-cms/types/index.js";
|
|
2
|
+
import type { Client } from "@webiny/api-opensearch";
|
|
3
|
+
import type { IModelEntity } from "../../definitions/types.js";
|
|
4
4
|
export interface CreateModelsStorageOperationsParams {
|
|
5
|
-
entity:
|
|
5
|
+
entity: IModelEntity;
|
|
6
6
|
elasticsearch: Client;
|
|
7
7
|
}
|
|
8
8
|
export declare const createModelsStorageOperations: (params: CreateModelsStorageOperationsParams) => CmsModelStorageOperations;
|
|
@@ -1,35 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.createModelsStorageOperations = void 0;
|
|
8
|
-
var _error = _interopRequireDefault(require("@webiny/error"));
|
|
9
|
-
var _configurations = require("../../configurations");
|
|
10
|
-
var _cleanup = require("@webiny/db-dynamodb/utils/cleanup");
|
|
11
|
-
var _query = require("@webiny/db-dynamodb/utils/query");
|
|
12
|
-
var _dbDynamodb = require("@webiny/db-dynamodb");
|
|
1
|
+
import WebinyError from "@webiny/error";
|
|
2
|
+
import { configurations } from "../../configurations.js";
|
|
13
3
|
const createPartitionKey = params => {
|
|
14
4
|
const {
|
|
15
|
-
tenant
|
|
16
|
-
locale
|
|
5
|
+
tenant
|
|
17
6
|
} = params;
|
|
18
|
-
return `T#${tenant}#
|
|
7
|
+
return `T#${tenant}#CMS#CM`;
|
|
19
8
|
};
|
|
20
9
|
const createSortKey = params => {
|
|
21
10
|
return params.modelId;
|
|
22
11
|
};
|
|
23
12
|
const createKeys = params => {
|
|
13
|
+
if (!params.tenant) {
|
|
14
|
+
throw new Error("Missing tenant when creating model keys!");
|
|
15
|
+
}
|
|
24
16
|
return {
|
|
25
17
|
PK: createPartitionKey(params),
|
|
26
|
-
SK: createSortKey(params)
|
|
18
|
+
SK: createSortKey(params),
|
|
19
|
+
GSI_TENANT: params.tenant
|
|
27
20
|
};
|
|
28
21
|
};
|
|
29
22
|
const createType = () => {
|
|
30
23
|
return "cms.model";
|
|
31
24
|
};
|
|
32
|
-
const createModelsStorageOperations = params => {
|
|
25
|
+
export const createModelsStorageOperations = params => {
|
|
33
26
|
const {
|
|
34
27
|
entity,
|
|
35
28
|
elasticsearch
|
|
@@ -40,19 +33,16 @@ const createModelsStorageOperations = params => {
|
|
|
40
33
|
} = params;
|
|
41
34
|
const {
|
|
42
35
|
index
|
|
43
|
-
} =
|
|
36
|
+
} = configurations.es({
|
|
44
37
|
model
|
|
45
38
|
});
|
|
46
39
|
const keys = createKeys(model);
|
|
47
40
|
let error;
|
|
48
41
|
try {
|
|
49
|
-
await
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
...keys,
|
|
54
|
-
TYPE: createType()
|
|
55
|
-
}
|
|
42
|
+
await entity.put({
|
|
43
|
+
data: model,
|
|
44
|
+
...keys,
|
|
45
|
+
TYPE: createType()
|
|
56
46
|
});
|
|
57
47
|
return model;
|
|
58
48
|
} catch (ex) {
|
|
@@ -67,7 +57,7 @@ const createModelsStorageOperations = params => {
|
|
|
67
57
|
ignore_unavailable: true
|
|
68
58
|
});
|
|
69
59
|
} catch (ex) {
|
|
70
|
-
throw new
|
|
60
|
+
throw new WebinyError(`Could not delete elasticsearch index "${index}" after model record failed to be created.`, "DELETE_MODEL_INDEX_ERROR", {
|
|
71
61
|
dynamodbError: error,
|
|
72
62
|
elasticsearchError: ex
|
|
73
63
|
});
|
|
@@ -80,17 +70,14 @@ const createModelsStorageOperations = params => {
|
|
|
80
70
|
} = params;
|
|
81
71
|
const keys = createKeys(model);
|
|
82
72
|
try {
|
|
83
|
-
await
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
...keys,
|
|
88
|
-
TYPE: createType()
|
|
89
|
-
}
|
|
73
|
+
await entity.put({
|
|
74
|
+
data: model,
|
|
75
|
+
...keys,
|
|
76
|
+
TYPE: createType()
|
|
90
77
|
});
|
|
91
78
|
return model;
|
|
92
79
|
} catch (ex) {
|
|
93
|
-
throw new
|
|
80
|
+
throw new WebinyError(ex.message || "Could not update model.", ex.code || "MODEL_UPDATE_ERROR", {
|
|
94
81
|
error: ex,
|
|
95
82
|
model,
|
|
96
83
|
keys
|
|
@@ -104,16 +91,13 @@ const createModelsStorageOperations = params => {
|
|
|
104
91
|
const keys = createKeys(model);
|
|
105
92
|
const {
|
|
106
93
|
index
|
|
107
|
-
} =
|
|
94
|
+
} = configurations.es({
|
|
108
95
|
model
|
|
109
96
|
});
|
|
110
97
|
try {
|
|
111
|
-
await (
|
|
112
|
-
entity,
|
|
113
|
-
keys
|
|
114
|
-
});
|
|
98
|
+
await entity.delete(keys);
|
|
115
99
|
} catch (ex) {
|
|
116
|
-
throw new
|
|
100
|
+
throw new WebinyError(ex.message || "Could not delete model.", ex.code || "MODEL_DELETE_ERROR", {
|
|
117
101
|
error: ex,
|
|
118
102
|
model,
|
|
119
103
|
keys
|
|
@@ -128,23 +112,20 @@ const createModelsStorageOperations = params => {
|
|
|
128
112
|
ignore_unavailable: true
|
|
129
113
|
});
|
|
130
114
|
} catch (ex) {
|
|
131
|
-
throw new
|
|
115
|
+
throw new WebinyError(`Could not delete elasticsearch index "${index}" after model record delete.`, "DELETE_MODEL_INDEX_ERROR", {
|
|
132
116
|
error: ex,
|
|
133
117
|
index,
|
|
134
118
|
model
|
|
135
119
|
});
|
|
136
120
|
}
|
|
137
|
-
return model;
|
|
138
121
|
};
|
|
139
122
|
const get = async params => {
|
|
140
123
|
const keys = createKeys(params);
|
|
141
124
|
try {
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
keys
|
|
145
|
-
});
|
|
125
|
+
const result = await entity.get(keys);
|
|
126
|
+
return result ? result.data : null;
|
|
146
127
|
} catch (ex) {
|
|
147
|
-
throw new
|
|
128
|
+
throw new WebinyError(ex.message || "Could not get model.", ex.code || "MODEL_GET_ERROR", {
|
|
148
129
|
error: ex,
|
|
149
130
|
keys
|
|
150
131
|
});
|
|
@@ -154,19 +135,19 @@ const createModelsStorageOperations = params => {
|
|
|
154
135
|
const {
|
|
155
136
|
where
|
|
156
137
|
} = params;
|
|
157
|
-
const
|
|
158
|
-
entity,
|
|
159
|
-
partitionKey: createPartitionKey(where),
|
|
160
|
-
options: {
|
|
161
|
-
gte: " "
|
|
162
|
-
}
|
|
163
|
-
};
|
|
138
|
+
const partitionKey = createPartitionKey(where);
|
|
164
139
|
try {
|
|
165
|
-
|
|
140
|
+
const result = await entity.queryAll({
|
|
141
|
+
partitionKey,
|
|
142
|
+
options: {
|
|
143
|
+
gte: " "
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
return result ? result.map(item => item.data) : [];
|
|
166
147
|
} catch (ex) {
|
|
167
|
-
throw new
|
|
148
|
+
throw new WebinyError(ex.message || "Could not list models.", ex.code || "MODEL_LIST_ERROR", {
|
|
168
149
|
error: ex,
|
|
169
|
-
partitionKey
|
|
150
|
+
partitionKey
|
|
170
151
|
});
|
|
171
152
|
}
|
|
172
153
|
};
|
|
@@ -178,6 +159,5 @@ const createModelsStorageOperations = params => {
|
|
|
178
159
|
list
|
|
179
160
|
};
|
|
180
161
|
};
|
|
181
|
-
exports.createModelsStorageOperations = createModelsStorageOperations;
|
|
182
162
|
|
|
183
163
|
//# sourceMappingURL=index.js.map
|