@webiny/api-headless-cms-ddb-es 0.0.0-mt-2 → 0.0.0-unstable.06b2ede40f
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/configurations.d.ts +15 -8
- package/configurations.js +29 -12
- package/configurations.js.map +1 -0
- package/definitions/entry.d.ts +6 -5
- package/definitions/entry.js +111 -20
- package/definitions/entry.js.map +1 -0
- package/definitions/entryElasticsearch.d.ts +6 -5
- package/definitions/entryElasticsearch.js +11 -16
- package/definitions/entryElasticsearch.js.map +1 -0
- package/definitions/group.d.ts +6 -5
- package/definitions/group.js +8 -16
- package/definitions/group.js.map +1 -0
- package/definitions/model.d.ts +6 -5
- package/definitions/model.js +30 -16
- package/definitions/model.js.map +1 -0
- package/definitions/system.d.ts +6 -5
- package/definitions/system.js +8 -16
- package/definitions/system.js.map +1 -0
- package/definitions/table.d.ts +6 -6
- package/definitions/table.js +7 -6
- package/definitions/table.js.map +1 -0
- package/definitions/tableElasticsearch.d.ts +6 -6
- package/definitions/tableElasticsearch.js +7 -6
- package/definitions/tableElasticsearch.js.map +1 -0
- package/dynamoDb/index.d.ts +2 -1
- package/dynamoDb/index.js +10 -12
- package/dynamoDb/index.js.map +1 -0
- package/dynamoDb/storage/longText.d.ts +7 -4
- package/dynamoDb/storage/longText.js +75 -62
- package/dynamoDb/storage/longText.js.map +1 -0
- package/dynamoDb/storage/richText.d.ts +2 -8
- package/dynamoDb/storage/richText.js +49 -100
- package/dynamoDb/storage/richText.js.map +1 -0
- package/elasticsearch/createElasticsearchIndex.d.ts +9 -0
- package/elasticsearch/createElasticsearchIndex.js +40 -0
- package/elasticsearch/createElasticsearchIndex.js.map +1 -0
- package/elasticsearch/deleteElasticsearchIndex.d.ts +8 -0
- package/elasticsearch/deleteElasticsearchIndex.js +38 -0
- package/elasticsearch/deleteElasticsearchIndex.js.map +1 -0
- package/elasticsearch/index.d.ts +1 -1
- package/elasticsearch/index.js +3 -6
- package/elasticsearch/index.js.map +1 -0
- package/elasticsearch/indexing/dateTimeIndexing.d.ts +1 -1
- package/elasticsearch/indexing/dateTimeIndexing.js +21 -22
- package/elasticsearch/indexing/dateTimeIndexing.js.map +1 -0
- package/elasticsearch/indexing/defaultFieldIndexing.d.ts +1 -1
- package/elasticsearch/indexing/defaultFieldIndexing.js +17 -10
- package/elasticsearch/indexing/defaultFieldIndexing.js.map +1 -0
- package/elasticsearch/indexing/index.js +5 -11
- package/elasticsearch/indexing/index.js.map +1 -0
- package/elasticsearch/indexing/jsonIndexing.d.ts +2 -0
- package/elasticsearch/indexing/jsonIndexing.js +28 -0
- package/elasticsearch/indexing/jsonIndexing.js.map +1 -0
- package/elasticsearch/indexing/longTextIndexing.d.ts +5 -1
- package/elasticsearch/indexing/longTextIndexing.js +16 -10
- package/elasticsearch/indexing/longTextIndexing.js.map +1 -0
- package/elasticsearch/indexing/numberIndexing.d.ts +1 -1
- package/elasticsearch/indexing/numberIndexing.js +2 -9
- package/elasticsearch/indexing/numberIndexing.js.map +1 -0
- package/elasticsearch/indexing/objectIndexing.d.ts +10 -1
- package/elasticsearch/indexing/objectIndexing.js +37 -36
- package/elasticsearch/indexing/objectIndexing.js.map +1 -0
- package/elasticsearch/indexing/richTextIndexing.d.ts +1 -1
- package/elasticsearch/indexing/richTextIndexing.js +2 -5
- package/elasticsearch/indexing/richTextIndexing.js.map +1 -0
- package/elasticsearch/indices/base.d.ts +2 -0
- package/elasticsearch/indices/base.js +13 -0
- package/elasticsearch/indices/base.js.map +1 -0
- package/elasticsearch/indices/index.d.ts +1 -0
- package/elasticsearch/indices/index.js +14 -0
- package/elasticsearch/indices/index.js.map +1 -0
- package/elasticsearch/indices/japanese.d.ts +2 -0
- package/elasticsearch/indices/japanese.js +14 -0
- package/elasticsearch/indices/japanese.js.map +1 -0
- package/elasticsearch/search/index.d.ts +2 -2
- package/elasticsearch/search/index.js +6 -9
- package/elasticsearch/search/index.js.map +1 -0
- package/elasticsearch/search/refSearch.d.ts +2 -3
- package/elasticsearch/search/refSearch.js +24 -17
- package/elasticsearch/search/refSearch.js.map +1 -0
- package/elasticsearch/search/searchableJson.d.ts +2 -0
- package/elasticsearch/search/searchableJson.js +60 -0
- package/elasticsearch/search/searchableJson.js.map +1 -0
- package/elasticsearch/search/timeSearch.d.ts +2 -3
- package/elasticsearch/search/timeSearch.js +18 -16
- package/elasticsearch/search/timeSearch.js.map +1 -0
- package/helpers/entryIndexHelpers.d.ts +3 -3
- package/helpers/entryIndexHelpers.js +59 -58
- package/helpers/entryIndexHelpers.js.map +1 -0
- package/helpers/fieldIdentifier.d.ts +6 -0
- package/helpers/fieldIdentifier.js +43 -0
- package/helpers/fieldIdentifier.js.map +1 -0
- package/helpers/index.d.ts +1 -1
- package/helpers/index.js +11 -13
- package/helpers/index.js.map +1 -0
- package/index.d.ts +2 -1
- package/index.js +132 -78
- package/index.js.map +1 -0
- package/operations/entry/dataLoader/DataLoaderCache.d.ts +17 -0
- package/operations/entry/dataLoader/DataLoaderCache.js +41 -0
- package/operations/entry/dataLoader/DataLoaderCache.js.map +1 -0
- package/operations/entry/dataLoader/constants.d.ts +1 -0
- package/operations/entry/dataLoader/constants.js +10 -0
- package/operations/entry/dataLoader/constants.js.map +1 -0
- package/operations/entry/dataLoader/createBatchScheduleFn.d.ts +8 -0
- package/operations/entry/dataLoader/createBatchScheduleFn.js +25 -0
- package/operations/entry/dataLoader/createBatchScheduleFn.js.map +1 -0
- package/operations/entry/dataLoader/getAllEntryRevisions.d.ts +4 -0
- package/operations/entry/dataLoader/getAllEntryRevisions.js +45 -0
- package/operations/entry/dataLoader/getAllEntryRevisions.js.map +1 -0
- package/operations/entry/dataLoader/getLatestRevisionByEntryId.d.ts +4 -0
- package/operations/entry/dataLoader/getLatestRevisionByEntryId.js +52 -0
- package/operations/entry/dataLoader/getLatestRevisionByEntryId.js.map +1 -0
- package/operations/entry/dataLoader/getPublishedRevisionByEntryId.d.ts +4 -0
- package/operations/entry/dataLoader/getPublishedRevisionByEntryId.js +52 -0
- package/operations/entry/dataLoader/getPublishedRevisionByEntryId.js.map +1 -0
- package/operations/entry/dataLoader/getRevisionById.d.ts +4 -0
- package/operations/entry/dataLoader/getRevisionById.js +62 -0
- package/operations/entry/dataLoader/getRevisionById.js.map +1 -0
- package/operations/entry/dataLoader/index.d.ts +8 -0
- package/operations/entry/dataLoader/index.js +40 -0
- package/operations/entry/dataLoader/index.js.map +1 -0
- package/operations/entry/dataLoader/types.d.ts +6 -0
- package/operations/entry/dataLoader/types.js +7 -0
- package/operations/entry/dataLoader/types.js.map +1 -0
- package/operations/entry/dataLoaders.d.ts +21 -38
- package/operations/entry/dataLoaders.js +59 -290
- package/operations/entry/dataLoaders.js.map +1 -0
- package/operations/entry/elasticsearch/assignMinimumShouldMatchToQuery.d.ts +18 -0
- package/operations/entry/elasticsearch/assignMinimumShouldMatchToQuery.js +34 -0
- package/operations/entry/elasticsearch/assignMinimumShouldMatchToQuery.js.map +1 -0
- package/operations/entry/elasticsearch/body.d.ts +13 -0
- package/operations/entry/elasticsearch/body.js +142 -0
- package/operations/entry/elasticsearch/body.js.map +1 -0
- package/operations/entry/elasticsearch/fields.d.ts +10 -0
- package/operations/entry/elasticsearch/fields.js +315 -0
- package/operations/entry/elasticsearch/fields.js.map +1 -0
- package/operations/entry/elasticsearch/filtering/applyFiltering.d.ts +8 -0
- package/operations/entry/elasticsearch/filtering/applyFiltering.js +60 -0
- package/operations/entry/elasticsearch/filtering/applyFiltering.js.map +1 -0
- package/operations/entry/elasticsearch/filtering/exec.d.ts +17 -0
- package/operations/entry/elasticsearch/filtering/exec.js +175 -0
- package/operations/entry/elasticsearch/filtering/exec.js.map +1 -0
- package/operations/entry/elasticsearch/filtering/index.d.ts +1 -0
- package/operations/entry/elasticsearch/filtering/index.js +18 -0
- package/operations/entry/elasticsearch/filtering/index.js.map +1 -0
- package/operations/entry/elasticsearch/filtering/path.d.ts +16 -0
- package/operations/entry/elasticsearch/filtering/path.js +48 -0
- package/operations/entry/elasticsearch/filtering/path.js.map +1 -0
- package/operations/entry/elasticsearch/filtering/plugins/defaultFilterPlugin.d.ts +2 -0
- package/operations/entry/elasticsearch/filtering/plugins/defaultFilterPlugin.js +30 -0
- package/operations/entry/elasticsearch/filtering/plugins/defaultFilterPlugin.js.map +1 -0
- package/operations/entry/elasticsearch/filtering/plugins/index.d.ts +1 -0
- package/operations/entry/elasticsearch/filtering/plugins/index.js +15 -0
- package/operations/entry/elasticsearch/filtering/plugins/index.js.map +1 -0
- package/operations/entry/elasticsearch/filtering/plugins/objectFilterPlugin.d.ts +2 -0
- package/operations/entry/elasticsearch/filtering/plugins/objectFilterPlugin.js +69 -0
- package/operations/entry/elasticsearch/filtering/plugins/objectFilterPlugin.js.map +1 -0
- package/operations/entry/elasticsearch/filtering/plugins/refFilterPlugin.d.ts +2 -0
- package/operations/entry/elasticsearch/filtering/plugins/refFilterPlugin.js +57 -0
- package/operations/entry/elasticsearch/filtering/plugins/refFilterPlugin.js.map +1 -0
- package/operations/entry/elasticsearch/filtering/populated.d.ts +2 -0
- package/operations/entry/elasticsearch/filtering/populated.js +25 -0
- package/operations/entry/elasticsearch/filtering/populated.js.map +1 -0
- package/operations/entry/elasticsearch/filtering/values.d.ts +2 -0
- package/operations/entry/elasticsearch/filtering/values.js +24 -0
- package/operations/entry/elasticsearch/filtering/values.js.map +1 -0
- package/operations/entry/elasticsearch/fullTextSearch.d.ts +12 -0
- package/operations/entry/elasticsearch/fullTextSearch.js +91 -0
- package/operations/entry/elasticsearch/fullTextSearch.js.map +1 -0
- package/operations/entry/elasticsearch/fullTextSearchFields.d.ts +8 -0
- package/operations/entry/elasticsearch/fullTextSearchFields.js +27 -0
- package/operations/entry/elasticsearch/fullTextSearchFields.js.map +1 -0
- package/operations/entry/elasticsearch/initialQuery.d.ts +17 -0
- package/operations/entry/elasticsearch/initialQuery.js +106 -0
- package/operations/entry/elasticsearch/initialQuery.js.map +1 -0
- package/operations/entry/elasticsearch/keyword.d.ts +2 -0
- package/operations/entry/elasticsearch/keyword.js +36 -0
- package/operations/entry/elasticsearch/keyword.js.map +1 -0
- package/operations/entry/elasticsearch/logIgnoredEsResponseError.d.ts +9 -0
- package/operations/entry/elasticsearch/logIgnoredEsResponseError.js +26 -0
- package/operations/entry/elasticsearch/logIgnoredEsResponseError.js.map +1 -0
- package/operations/entry/elasticsearch/plugins/bodyModifier.d.ts +9 -0
- package/operations/entry/elasticsearch/plugins/bodyModifier.js +18 -0
- package/operations/entry/elasticsearch/plugins/bodyModifier.js.map +1 -0
- package/operations/entry/elasticsearch/plugins/operator.d.ts +8 -0
- package/operations/entry/elasticsearch/plugins/operator.js +39 -0
- package/operations/entry/elasticsearch/plugins/operator.js.map +1 -0
- package/operations/entry/elasticsearch/plugins/queryModifier.d.ts +9 -0
- package/operations/entry/elasticsearch/plugins/queryModifier.js +18 -0
- package/operations/entry/elasticsearch/plugins/queryModifier.js.map +1 -0
- package/operations/entry/elasticsearch/plugins/search.d.ts +7 -0
- package/{helpers/searchPluginsList.js → operations/entry/elasticsearch/plugins/search.js} +9 -9
- package/operations/entry/elasticsearch/plugins/search.js.map +1 -0
- package/operations/entry/elasticsearch/plugins/sortModifier.d.ts +9 -0
- package/operations/entry/elasticsearch/plugins/sortModifier.js +18 -0
- package/operations/entry/elasticsearch/plugins/sortModifier.js.map +1 -0
- package/operations/entry/elasticsearch/shouldIgnoreEsResponseError.d.ts +2 -0
- package/operations/entry/elasticsearch/shouldIgnoreEsResponseError.js +13 -0
- package/operations/entry/elasticsearch/shouldIgnoreEsResponseError.js.map +1 -0
- package/operations/entry/elasticsearch/sort.d.ts +12 -0
- package/operations/entry/elasticsearch/sort.js +89 -0
- package/operations/entry/elasticsearch/sort.js.map +1 -0
- package/operations/entry/elasticsearch/transformValueForSearch.d.ts +16 -0
- package/operations/entry/elasticsearch/transformValueForSearch.js +32 -0
- package/operations/entry/elasticsearch/transformValueForSearch.js.map +1 -0
- package/operations/entry/elasticsearch/types.d.ts +41 -0
- package/operations/entry/elasticsearch/types.js +7 -0
- package/operations/entry/elasticsearch/types.js.map +1 -0
- package/operations/entry/index.d.ts +6 -8
- package/operations/entry/index.js +1422 -693
- package/operations/entry/index.js.map +1 -0
- package/operations/entry/keys.js +2 -9
- package/operations/entry/keys.js.map +1 -0
- package/operations/entry/recordType.d.ts +3 -0
- package/operations/entry/recordType.js +20 -0
- package/operations/entry/recordType.js.map +1 -0
- package/operations/entry/transformations/convertEntryKeys.d.ts +8 -0
- package/operations/entry/transformations/convertEntryKeys.js +38 -0
- package/operations/entry/transformations/convertEntryKeys.js.map +1 -0
- package/operations/entry/transformations/index.d.ts +29 -0
- package/operations/entry/transformations/index.js +127 -0
- package/operations/entry/transformations/index.js.map +1 -0
- package/operations/entry/transformations/modifyEntryValues.d.ts +58 -0
- package/operations/entry/transformations/modifyEntryValues.js +28 -0
- package/operations/entry/transformations/modifyEntryValues.js.map +1 -0
- package/operations/entry/transformations/transformEntryKeys.d.ts +11 -0
- package/operations/entry/transformations/transformEntryKeys.js +27 -0
- package/operations/entry/transformations/transformEntryKeys.js.map +1 -0
- package/operations/entry/transformations/transformEntryToIndex.d.ts +10 -0
- package/operations/entry/transformations/transformEntryToIndex.js +31 -0
- package/operations/entry/transformations/transformEntryToIndex.js.map +1 -0
- package/operations/group/index.d.ts +5 -5
- package/operations/group/index.js +40 -63
- package/operations/group/index.js.map +1 -0
- package/operations/model/index.d.ts +5 -5
- package/operations/model/index.js +56 -78
- package/operations/model/index.js.map +1 -0
- package/operations/system/index.d.ts +4 -4
- package/operations/system/index.js +20 -31
- package/operations/system/index.js.map +1 -0
- package/operations/system/indexes.d.ts +10 -0
- package/operations/system/indexes.js +41 -0
- package/operations/system/indexes.js.map +1 -0
- package/package.json +38 -40
- package/plugins/CmsElasticsearchModelFieldPlugin.d.ts +69 -0
- package/plugins/CmsElasticsearchModelFieldPlugin.js +52 -0
- package/plugins/CmsElasticsearchModelFieldPlugin.js.map +1 -0
- package/plugins/CmsEntryElasticsearchBodyModifierPlugin.d.ts +9 -4
- package/plugins/CmsEntryElasticsearchBodyModifierPlugin.js +10 -13
- package/plugins/CmsEntryElasticsearchBodyModifierPlugin.js.map +1 -0
- package/plugins/CmsEntryElasticsearchFullTextSearchPlugin.d.ts +23 -0
- package/plugins/CmsEntryElasticsearchFullTextSearchPlugin.js +27 -0
- package/plugins/CmsEntryElasticsearchFullTextSearchPlugin.js.map +1 -0
- package/plugins/CmsEntryElasticsearchIndexPlugin.d.ts +4 -0
- package/plugins/CmsEntryElasticsearchIndexPlugin.js +13 -0
- package/plugins/CmsEntryElasticsearchIndexPlugin.js.map +1 -0
- package/plugins/CmsEntryElasticsearchQueryBuilderValueSearchPlugin.d.ts +32 -0
- package/plugins/CmsEntryElasticsearchQueryBuilderValueSearchPlugin.js +40 -0
- package/plugins/CmsEntryElasticsearchQueryBuilderValueSearchPlugin.js.map +1 -0
- package/plugins/CmsEntryElasticsearchQueryModifierPlugin.d.ts +6 -4
- package/plugins/CmsEntryElasticsearchQueryModifierPlugin.js +10 -13
- package/plugins/CmsEntryElasticsearchQueryModifierPlugin.js.map +1 -0
- package/plugins/CmsEntryElasticsearchSortModifierPlugin.d.ts +6 -4
- package/plugins/CmsEntryElasticsearchSortModifierPlugin.js +10 -13
- package/plugins/CmsEntryElasticsearchSortModifierPlugin.js.map +1 -0
- package/plugins/CmsEntryElasticsearchValuesModifier.d.ts +33 -0
- package/plugins/CmsEntryElasticsearchValuesModifier.js +50 -0
- package/plugins/CmsEntryElasticsearchValuesModifier.js.map +1 -0
- package/plugins/CmsEntryFilterPlugin.d.ts +49 -0
- package/plugins/CmsEntryFilterPlugin.js +22 -0
- package/plugins/CmsEntryFilterPlugin.js.map +1 -0
- package/plugins/index.d.ts +8 -0
- package/plugins/index.js +95 -0
- package/plugins/index.js.map +1 -0
- package/tasks/createIndexTaskPlugin.d.ts +2 -0
- package/tasks/createIndexTaskPlugin.js +67 -0
- package/tasks/createIndexTaskPlugin.js.map +1 -0
- package/types.d.ts +30 -52
- package/types.js +5 -23
- package/types.js.map +1 -0
- package/values/NoValueContainer.d.ts +5 -0
- package/values/NoValueContainer.js +20 -0
- package/values/NoValueContainer.js.map +1 -0
- package/definitions/settings.d.ts +0 -8
- package/definitions/settings.js +0 -62
- package/dynamoDb/storage/date.d.ts +0 -3
- package/dynamoDb/storage/date.js +0 -65
- package/helpers/createElasticsearchQueryBody.d.ts +0 -11
- package/helpers/createElasticsearchQueryBody.js +0 -375
- package/helpers/fields.d.ts +0 -77
- package/helpers/fields.js +0 -174
- package/helpers/operatorPluginsList.d.ts +0 -7
- package/helpers/operatorPluginsList.js +0 -30
- package/helpers/searchPluginsList.d.ts +0 -6
- package/helpers/transformValueForSearch.d.ts +0 -9
- package/helpers/transformValueForSearch.js +0 -26
- package/operations/entry/elasticsearchFields.d.ts +0 -2
- package/operations/entry/elasticsearchFields.js +0 -32
- package/operations/entry/fields.d.ts +0 -3
- package/operations/entry/fields.js +0 -60
- package/operations/settings/index.d.ts +0 -6
- package/operations/settings/index.js +0 -141
- package/operations/system/createElasticsearchTemplate.d.ts +0 -5
- package/operations/system/createElasticsearchTemplate.js +0 -62
- package/plugins/CmsEntryElasticsearchFieldPlugin.d.ts +0 -12
- package/plugins/CmsEntryElasticsearchFieldPlugin.js +0 -24
- package/upgrades/index.d.ts +0 -2
- package/upgrades/index.js +0 -16
- package/upgrades/utils.d.ts +0 -1
- package/upgrades/utils.js +0 -16
- package/upgrades/v5.0.0/cleanDatabaseRecord.d.ts +0 -6
- package/upgrades/v5.0.0/cleanDatabaseRecord.js +0 -16
- package/upgrades/v5.0.0/createOldVersionIndiceName.d.ts +0 -2
- package/upgrades/v5.0.0/createOldVersionIndiceName.js +0 -12
- package/upgrades/v5.0.0/entryValueFixer.d.ts +0 -4
- package/upgrades/v5.0.0/entryValueFixer.js +0 -124
- package/upgrades/v5.0.0/fieldFinder.d.ts +0 -6
- package/upgrades/v5.0.0/fieldFinder.js +0 -42
- package/upgrades/v5.0.0/helpers.d.ts +0 -4
- package/upgrades/v5.0.0/helpers.js +0 -57
- package/upgrades/v5.0.0/index.d.ts +0 -4
- package/upgrades/v5.0.0/index.js +0 -232
- package/upgrades/v5.8.0/index.d.ts +0 -4
- package/upgrades/v5.8.0/index.js +0 -426
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { CmsEntry, StorageOperationsCmsModel } from "@webiny/api-headless-cms/types";
|
|
2
|
+
import type { CmsEntryElasticsearchValuesModifier } from "../../../plugins";
|
|
3
|
+
interface Params {
|
|
4
|
+
model: StorageOperationsCmsModel;
|
|
5
|
+
plugins: CmsEntryElasticsearchValuesModifier[];
|
|
6
|
+
entry: CmsEntry;
|
|
7
|
+
}
|
|
8
|
+
export declare const modifyEntryValues: (params: Params) => {
|
|
9
|
+
values: import("@webiny/api-headless-cms/types").CmsEntryValues;
|
|
10
|
+
webinyVersion: string;
|
|
11
|
+
tenant: string;
|
|
12
|
+
entryId: string;
|
|
13
|
+
id: string;
|
|
14
|
+
revisionCreatedOn: string;
|
|
15
|
+
revisionSavedOn: string;
|
|
16
|
+
revisionModifiedOn: string | null;
|
|
17
|
+
revisionDeletedOn: string | null;
|
|
18
|
+
revisionRestoredOn: string | null;
|
|
19
|
+
revisionFirstPublishedOn: string | null;
|
|
20
|
+
revisionLastPublishedOn: string | null;
|
|
21
|
+
revisionCreatedBy: import("@webiny/api-headless-cms/types").CmsIdentity;
|
|
22
|
+
revisionSavedBy: import("@webiny/api-headless-cms/types").CmsIdentity;
|
|
23
|
+
revisionModifiedBy: import("@webiny/api-headless-cms/types").CmsIdentity | null;
|
|
24
|
+
revisionDeletedBy: import("@webiny/api-headless-cms/types").CmsIdentity | null;
|
|
25
|
+
revisionRestoredBy: import("@webiny/api-headless-cms/types").CmsIdentity | null;
|
|
26
|
+
revisionFirstPublishedBy: import("@webiny/api-headless-cms/types").CmsIdentity | null;
|
|
27
|
+
revisionLastPublishedBy: import("@webiny/api-headless-cms/types").CmsIdentity | null;
|
|
28
|
+
createdOn: string;
|
|
29
|
+
savedOn: string;
|
|
30
|
+
modifiedOn: string | null;
|
|
31
|
+
deletedOn: string | null;
|
|
32
|
+
restoredOn: string | null;
|
|
33
|
+
firstPublishedOn: string | null;
|
|
34
|
+
lastPublishedOn: string | null;
|
|
35
|
+
createdBy: import("@webiny/api-headless-cms/types").CmsIdentity;
|
|
36
|
+
savedBy: import("@webiny/api-headless-cms/types").CmsIdentity;
|
|
37
|
+
modifiedBy: import("@webiny/api-headless-cms/types").CmsIdentity | null;
|
|
38
|
+
deletedBy: import("@webiny/api-headless-cms/types").CmsIdentity | null;
|
|
39
|
+
restoredBy: import("@webiny/api-headless-cms/types").CmsIdentity | null;
|
|
40
|
+
firstPublishedBy: import("@webiny/api-headless-cms/types").CmsIdentity | null;
|
|
41
|
+
lastPublishedBy: import("@webiny/api-headless-cms/types").CmsIdentity | null;
|
|
42
|
+
ownedBy?: import("@webiny/api-headless-cms/types").CmsIdentity | null | undefined;
|
|
43
|
+
publishedOn?: string | null | undefined;
|
|
44
|
+
modelId: string;
|
|
45
|
+
locale: string;
|
|
46
|
+
version: number;
|
|
47
|
+
locked: boolean;
|
|
48
|
+
status: import("@webiny/api-headless-cms/types").CmsEntryStatus;
|
|
49
|
+
location?: {
|
|
50
|
+
folderId?: string | null | undefined;
|
|
51
|
+
} | undefined;
|
|
52
|
+
meta?: {
|
|
53
|
+
[key: string]: any;
|
|
54
|
+
} | undefined;
|
|
55
|
+
wbyDeleted?: boolean | null | undefined;
|
|
56
|
+
binOriginalFolderId?: string | null | undefined;
|
|
57
|
+
};
|
|
58
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.modifyEntryValues = void 0;
|
|
7
|
+
const modifyEntryValues = params => {
|
|
8
|
+
const {
|
|
9
|
+
plugins,
|
|
10
|
+
model,
|
|
11
|
+
entry
|
|
12
|
+
} = params;
|
|
13
|
+
let values = entry.values;
|
|
14
|
+
for (const plugin of plugins) {
|
|
15
|
+
values = plugin.modify({
|
|
16
|
+
model,
|
|
17
|
+
entry,
|
|
18
|
+
values
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
return {
|
|
22
|
+
...entry,
|
|
23
|
+
values
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
exports.modifyEntryValues = modifyEntryValues;
|
|
27
|
+
|
|
28
|
+
//# sourceMappingURL=modifyEntryValues.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["modifyEntryValues","params","plugins","model","entry","values","plugin","modify","exports"],"sources":["modifyEntryValues.ts"],"sourcesContent":["import type { CmsEntry, StorageOperationsCmsModel } from \"@webiny/api-headless-cms/types\";\nimport type { CmsEntryElasticsearchValuesModifier } from \"~/plugins\";\n\ninterface Params {\n model: StorageOperationsCmsModel;\n plugins: CmsEntryElasticsearchValuesModifier[];\n entry: CmsEntry;\n}\n\nexport const modifyEntryValues = (params: Params) => {\n const { plugins, model, entry } = params;\n let values = entry.values;\n for (const plugin of plugins) {\n values = plugin.modify({\n model,\n entry,\n values\n });\n }\n return {\n ...entry,\n values\n };\n};\n"],"mappings":";;;;;;AASO,MAAMA,iBAAiB,GAAIC,MAAc,IAAK;EACjD,MAAM;IAAEC,OAAO;IAAEC,KAAK;IAAEC;EAAM,CAAC,GAAGH,MAAM;EACxC,IAAII,MAAM,GAAGD,KAAK,CAACC,MAAM;EACzB,KAAK,MAAMC,MAAM,IAAIJ,OAAO,EAAE;IAC1BG,MAAM,GAAGC,MAAM,CAACC,MAAM,CAAC;MACnBJ,KAAK;MACLC,KAAK;MACLC;IACJ,CAAC,CAAC;EACN;EACA,OAAO;IACH,GAAGD,KAAK;IACRC;EACJ,CAAC;AACL,CAAC;AAACG,OAAA,CAAAR,iBAAA,GAAAA,iBAAA","ignoreList":[]}
|
|
@@ -0,0 +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;
|
|
6
|
+
}
|
|
7
|
+
export declare const transformEntryKeys: (params: TransformKeysParams) => {
|
|
8
|
+
entry: CmsStorageEntry;
|
|
9
|
+
storageEntry: CmsStorageEntry;
|
|
10
|
+
};
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.transformEntryKeys = void 0;
|
|
7
|
+
var _convertEntryKeys = require("./convertEntryKeys");
|
|
8
|
+
const transformEntryKeys = params => {
|
|
9
|
+
const {
|
|
10
|
+
model,
|
|
11
|
+
entry,
|
|
12
|
+
storageEntry
|
|
13
|
+
} = params;
|
|
14
|
+
return {
|
|
15
|
+
entry: (0, _convertEntryKeys.convertEntryKeysToStorage)({
|
|
16
|
+
model,
|
|
17
|
+
entry
|
|
18
|
+
}),
|
|
19
|
+
storageEntry: (0, _convertEntryKeys.convertEntryKeysToStorage)({
|
|
20
|
+
model,
|
|
21
|
+
entry: storageEntry
|
|
22
|
+
})
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
exports.transformEntryKeys = transformEntryKeys;
|
|
26
|
+
|
|
27
|
+
//# sourceMappingURL=transformEntryKeys.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_convertEntryKeys","require","transformEntryKeys","params","model","entry","storageEntry","convertEntryKeysToStorage","exports"],"sources":["transformEntryKeys.ts"],"sourcesContent":["import type {\n CmsEntry,\n CmsStorageEntry,\n StorageOperationsCmsModel\n} from \"@webiny/api-headless-cms/types\";\nimport { convertEntryKeysToStorage } from \"./convertEntryKeys\";\n\ninterface TransformKeysParams {\n model: StorageOperationsCmsModel;\n entry: CmsEntry;\n storageEntry: CmsStorageEntry;\n}\n\nexport const transformEntryKeys = (params: TransformKeysParams) => {\n const { model, entry, storageEntry } = params;\n return {\n entry: convertEntryKeysToStorage({\n model,\n entry\n }),\n storageEntry: convertEntryKeysToStorage({\n model,\n entry: storageEntry\n })\n };\n};\n"],"mappings":";;;;;;AAKA,IAAAA,iBAAA,GAAAC,OAAA;AAQO,MAAMC,kBAAkB,GAAIC,MAA2B,IAAK;EAC/D,MAAM;IAAEC,KAAK;IAAEC,KAAK;IAAEC;EAAa,CAAC,GAAGH,MAAM;EAC7C,OAAO;IACHE,KAAK,EAAE,IAAAE,2CAAyB,EAAC;MAC7BH,KAAK;MACLC;IACJ,CAAC,CAAC;IACFC,YAAY,EAAE,IAAAC,2CAAyB,EAAC;MACpCH,KAAK;MACLC,KAAK,EAAEC;IACX,CAAC;EACL,CAAC;AACL,CAAC;AAACE,OAAA,CAAAN,kBAAA,GAAAA,kBAAA","ignoreList":[]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { PluginsContainer } from "@webiny/plugins";
|
|
2
|
+
import type { CmsEntry, CmsStorageEntry, StorageOperationsCmsModel } from "@webiny/api-headless-cms/types";
|
|
3
|
+
interface TransformEntryToIndexParams {
|
|
4
|
+
plugins: PluginsContainer;
|
|
5
|
+
model: StorageOperationsCmsModel;
|
|
6
|
+
entry: CmsEntry;
|
|
7
|
+
storageEntry: CmsStorageEntry;
|
|
8
|
+
}
|
|
9
|
+
export declare const transformEntryToIndex: (params: TransformEntryToIndexParams) => import("../../../types").CmsIndexEntry;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.transformEntryToIndex = void 0;
|
|
7
|
+
var _helpers = require("../../../helpers");
|
|
8
|
+
const transformEntryToIndex = params => {
|
|
9
|
+
const {
|
|
10
|
+
plugins,
|
|
11
|
+
model,
|
|
12
|
+
entry,
|
|
13
|
+
storageEntry
|
|
14
|
+
} = params;
|
|
15
|
+
const result = (0, _helpers.prepareEntryToIndex)({
|
|
16
|
+
plugins,
|
|
17
|
+
model,
|
|
18
|
+
entry: structuredClone(entry),
|
|
19
|
+
storageEntry: structuredClone(storageEntry)
|
|
20
|
+
});
|
|
21
|
+
delete result["PK"];
|
|
22
|
+
delete result["SK"];
|
|
23
|
+
delete result["GSI1_PK"];
|
|
24
|
+
delete result["GSI1_SK"];
|
|
25
|
+
delete result["published"];
|
|
26
|
+
delete result["latest"];
|
|
27
|
+
return result;
|
|
28
|
+
};
|
|
29
|
+
exports.transformEntryToIndex = transformEntryToIndex;
|
|
30
|
+
|
|
31
|
+
//# sourceMappingURL=transformEntryToIndex.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_helpers","require","transformEntryToIndex","params","plugins","model","entry","storageEntry","result","prepareEntryToIndex","structuredClone","exports"],"sources":["transformEntryToIndex.ts"],"sourcesContent":["import type { PluginsContainer } from \"@webiny/plugins\";\nimport type {\n CmsEntry,\n CmsStorageEntry,\n StorageOperationsCmsModel\n} from \"@webiny/api-headless-cms/types\";\nimport { prepareEntryToIndex } from \"~/helpers\";\n\ninterface TransformEntryToIndexParams {\n plugins: PluginsContainer;\n model: StorageOperationsCmsModel;\n entry: CmsEntry;\n storageEntry: CmsStorageEntry;\n}\n\nexport const transformEntryToIndex = (params: TransformEntryToIndexParams) => {\n const { plugins, model, entry, storageEntry } = params;\n const result = prepareEntryToIndex({\n plugins,\n model,\n entry: structuredClone(entry),\n storageEntry: structuredClone(storageEntry)\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,IAAAA,QAAA,GAAAC,OAAA;AASO,MAAMC,qBAAqB,GAAIC,MAAmC,IAAK;EAC1E,MAAM;IAAEC,OAAO;IAAEC,KAAK;IAAEC,KAAK;IAAEC;EAAa,CAAC,GAAGJ,MAAM;EACtD,MAAMK,MAAM,GAAG,IAAAC,4BAAmB,EAAC;IAC/BL,OAAO;IACPC,KAAK;IACLC,KAAK,EAAEI,eAAe,CAACJ,KAAK,CAAC;IAC7BC,YAAY,EAAEG,eAAe,CAACH,YAAY;EAC9C,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;AAACG,OAAA,CAAAT,qBAAA,GAAAA,qBAAA","ignoreList":[]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { CmsGroupStorageOperations } from "@webiny/api-headless-cms/types";
|
|
2
|
-
import { Entity } from "dynamodb
|
|
3
|
-
import { PluginsContainer } from "@webiny/plugins";
|
|
4
|
-
export interface
|
|
1
|
+
import type { CmsGroupStorageOperations } from "@webiny/api-headless-cms/types";
|
|
2
|
+
import type { Entity } from "@webiny/db-dynamodb/toolbox";
|
|
3
|
+
import type { PluginsContainer } from "@webiny/plugins";
|
|
4
|
+
export interface CreateGroupsStorageOperationsParams {
|
|
5
5
|
entity: Entity<any>;
|
|
6
6
|
plugins: PluginsContainer;
|
|
7
7
|
}
|
|
8
|
-
export declare const createGroupsStorageOperations: (params:
|
|
8
|
+
export declare const createGroupsStorageOperations: (params: CreateGroupsStorageOperationsParams) => CmsGroupStorageOperations;
|
|
@@ -1,32 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.createGroupsStorageOperations = void 0;
|
|
9
|
-
|
|
10
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
-
|
|
12
8
|
var _error = _interopRequireDefault(require("@webiny/error"));
|
|
13
|
-
|
|
14
9
|
var _get = require("@webiny/db-dynamodb/utils/get");
|
|
15
|
-
|
|
16
|
-
var _cleanup = require("@webiny/db-dynamodb/utils/cleanup");
|
|
17
|
-
|
|
18
10
|
var _query = require("@webiny/db-dynamodb/utils/query");
|
|
19
|
-
|
|
20
11
|
var _filter = require("@webiny/db-dynamodb/utils/filter");
|
|
21
|
-
|
|
22
12
|
var _ValueFilterPlugin = require("@webiny/db-dynamodb/plugins/definitions/ValueFilterPlugin");
|
|
23
|
-
|
|
24
13
|
var _sort = require("@webiny/db-dynamodb/utils/sort");
|
|
25
|
-
|
|
26
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
27
|
-
|
|
28
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
29
|
-
|
|
14
|
+
var _dbDynamodb = require("@webiny/db-dynamodb");
|
|
30
15
|
const createPartitionKey = params => {
|
|
31
16
|
const {
|
|
32
17
|
tenant,
|
|
@@ -34,46 +19,44 @@ const createPartitionKey = params => {
|
|
|
34
19
|
} = params;
|
|
35
20
|
return `T#${tenant}#L#${locale}#CMS#CMG`;
|
|
36
21
|
};
|
|
37
|
-
|
|
38
22
|
const createSortKeys = params => {
|
|
39
23
|
const {
|
|
40
24
|
id
|
|
41
25
|
} = params;
|
|
42
26
|
return id;
|
|
43
27
|
};
|
|
44
|
-
|
|
45
28
|
const createKeys = params => {
|
|
46
29
|
return {
|
|
47
30
|
PK: createPartitionKey(params),
|
|
48
31
|
SK: createSortKeys(params)
|
|
49
32
|
};
|
|
50
33
|
};
|
|
51
|
-
|
|
52
34
|
const createType = () => {
|
|
53
35
|
return "cms.group";
|
|
54
36
|
};
|
|
55
|
-
|
|
56
37
|
const createGroupsStorageOperations = params => {
|
|
57
38
|
const {
|
|
58
39
|
entity,
|
|
59
40
|
plugins
|
|
60
41
|
} = params;
|
|
61
42
|
const filteringPlugins = plugins.byType(_ValueFilterPlugin.ValueFilterPlugin.type);
|
|
62
|
-
|
|
63
43
|
if (filteringPlugins.length === 0) {
|
|
64
44
|
throw new _error.default("DynamoDB filtering plugins not loaded.", "MISSING_DYNAMODB_FILTERING_PLUGINS");
|
|
65
45
|
}
|
|
66
|
-
|
|
67
46
|
const create = async params => {
|
|
68
47
|
const {
|
|
69
48
|
group
|
|
70
49
|
} = params;
|
|
71
50
|
const keys = createKeys(group);
|
|
72
|
-
|
|
73
51
|
try {
|
|
74
|
-
await
|
|
75
|
-
|
|
76
|
-
|
|
52
|
+
await (0, _dbDynamodb.put)({
|
|
53
|
+
entity,
|
|
54
|
+
item: {
|
|
55
|
+
...group,
|
|
56
|
+
TYPE: createType(),
|
|
57
|
+
...keys
|
|
58
|
+
}
|
|
59
|
+
});
|
|
77
60
|
return group;
|
|
78
61
|
} catch (ex) {
|
|
79
62
|
throw new _error.default(ex.message || "Could not create group.", ex.code || "CREATE_GROUP_ERROR", {
|
|
@@ -83,38 +66,39 @@ const createGroupsStorageOperations = params => {
|
|
|
83
66
|
});
|
|
84
67
|
}
|
|
85
68
|
};
|
|
86
|
-
|
|
87
69
|
const update = async params => {
|
|
88
70
|
const {
|
|
89
|
-
group
|
|
90
|
-
original
|
|
71
|
+
group
|
|
91
72
|
} = params;
|
|
92
73
|
const keys = createKeys(group);
|
|
93
|
-
|
|
94
74
|
try {
|
|
95
|
-
await
|
|
96
|
-
|
|
97
|
-
|
|
75
|
+
await (0, _dbDynamodb.put)({
|
|
76
|
+
entity,
|
|
77
|
+
item: {
|
|
78
|
+
...group,
|
|
79
|
+
TYPE: createType(),
|
|
80
|
+
...keys
|
|
81
|
+
}
|
|
82
|
+
});
|
|
98
83
|
return group;
|
|
99
84
|
} catch (ex) {
|
|
100
85
|
throw new _error.default(ex.message || "Could not update group.", ex.code || "UPDATE_GROUP_ERROR", {
|
|
101
86
|
error: ex,
|
|
102
87
|
group,
|
|
103
|
-
original,
|
|
104
88
|
keys
|
|
105
89
|
});
|
|
106
90
|
}
|
|
107
91
|
};
|
|
108
|
-
|
|
109
92
|
const deleteGroup = async params => {
|
|
110
93
|
const {
|
|
111
94
|
group
|
|
112
|
-
} = params;
|
|
113
|
-
|
|
95
|
+
} = params;
|
|
114
96
|
const keys = createKeys(group);
|
|
115
|
-
|
|
116
97
|
try {
|
|
117
|
-
await
|
|
98
|
+
await (0, _dbDynamodb.deleteItem)({
|
|
99
|
+
entity,
|
|
100
|
+
keys
|
|
101
|
+
});
|
|
118
102
|
return group;
|
|
119
103
|
} catch (ex) {
|
|
120
104
|
throw new _error.default(ex.message || "Could not delete group.", ex.code || "DELETE_GROUP_ERROR", {
|
|
@@ -124,25 +108,21 @@ const createGroupsStorageOperations = params => {
|
|
|
124
108
|
});
|
|
125
109
|
}
|
|
126
110
|
};
|
|
127
|
-
|
|
128
111
|
const get = async params => {
|
|
129
112
|
const keys = createKeys(params);
|
|
130
|
-
|
|
131
113
|
try {
|
|
132
|
-
|
|
114
|
+
return await (0, _get.getClean)({
|
|
133
115
|
entity,
|
|
134
116
|
keys
|
|
135
117
|
});
|
|
136
|
-
return (0, _cleanup.cleanupItem)(entity, group);
|
|
137
118
|
} catch (ex) {
|
|
138
|
-
throw new _error.default(ex.message || "Could not get group.", ex.code || "GET_GROUP_ERROR",
|
|
139
|
-
error: ex
|
|
140
|
-
|
|
119
|
+
throw new _error.default(ex.message || "Could not get group.", ex.code || "GET_GROUP_ERROR", {
|
|
120
|
+
error: ex,
|
|
121
|
+
...params,
|
|
141
122
|
keys
|
|
142
|
-
})
|
|
123
|
+
});
|
|
143
124
|
}
|
|
144
125
|
};
|
|
145
|
-
|
|
146
126
|
const list = async params => {
|
|
147
127
|
const {
|
|
148
128
|
sort,
|
|
@@ -156,40 +136,36 @@ const createGroupsStorageOperations = params => {
|
|
|
156
136
|
}
|
|
157
137
|
};
|
|
158
138
|
let records = [];
|
|
159
|
-
|
|
160
139
|
try {
|
|
161
140
|
records = await (0, _query.queryAll)(queryAllParams);
|
|
162
141
|
} catch (ex) {
|
|
163
|
-
throw new _error.default(ex.message || "Could not list groups.", ex.code || "LIST_GROUP_ERROR",
|
|
164
|
-
error: ex
|
|
165
|
-
|
|
142
|
+
throw new _error.default(ex.message || "Could not list groups.", ex.code || "LIST_GROUP_ERROR", {
|
|
143
|
+
error: ex,
|
|
144
|
+
...params,
|
|
166
145
|
sort,
|
|
167
146
|
where: initialWhere
|
|
168
|
-
})
|
|
147
|
+
});
|
|
169
148
|
}
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
149
|
+
const where = {
|
|
150
|
+
...initialWhere
|
|
151
|
+
};
|
|
173
152
|
delete where["tenant"];
|
|
174
153
|
delete where["locale"];
|
|
175
|
-
const filteredItems = (0, _filter.filterItems)({
|
|
154
|
+
const filteredItems = (0, _dbDynamodb.cleanupItems)(entity, (0, _filter.filterItems)({
|
|
176
155
|
items: records,
|
|
177
156
|
where,
|
|
178
157
|
fields: [],
|
|
179
158
|
plugins
|
|
180
|
-
});
|
|
181
|
-
|
|
159
|
+
}));
|
|
182
160
|
if (!sort || sort.length === 0 || filteredItems.length === 0) {
|
|
183
161
|
return filteredItems;
|
|
184
162
|
}
|
|
185
|
-
|
|
186
163
|
return (0, _sort.sortItems)({
|
|
187
164
|
items: filteredItems,
|
|
188
165
|
sort,
|
|
189
166
|
fields: []
|
|
190
167
|
});
|
|
191
168
|
};
|
|
192
|
-
|
|
193
169
|
return {
|
|
194
170
|
create,
|
|
195
171
|
update,
|
|
@@ -198,5 +174,6 @@ const createGroupsStorageOperations = params => {
|
|
|
198
174
|
list
|
|
199
175
|
};
|
|
200
176
|
};
|
|
177
|
+
exports.createGroupsStorageOperations = createGroupsStorageOperations;
|
|
201
178
|
|
|
202
|
-
|
|
179
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +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 };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MD,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,8 +1,8 @@
|
|
|
1
|
-
import { CmsModelStorageOperations } from "@webiny/api-headless-cms/types";
|
|
2
|
-
import { Entity } from "dynamodb
|
|
3
|
-
import { Client } from "@elastic/elasticsearch";
|
|
4
|
-
export interface
|
|
1
|
+
import type { CmsModelStorageOperations } from "@webiny/api-headless-cms/types";
|
|
2
|
+
import type { Entity } from "@webiny/db-dynamodb/toolbox";
|
|
3
|
+
import type { Client } from "@elastic/elasticsearch";
|
|
4
|
+
export interface CreateModelsStorageOperationsParams {
|
|
5
5
|
entity: Entity<any>;
|
|
6
6
|
elasticsearch: Client;
|
|
7
7
|
}
|
|
8
|
-
export declare const createModelsStorageOperations: (params:
|
|
8
|
+
export declare const createModelsStorageOperations: (params: CreateModelsStorageOperationsParams) => CmsModelStorageOperations;
|