@webiny/api-headless-cms-ddb-es 5.33.5 → 5.34.0-beta.0
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.js +1 -1
- package/definitions/entry.js +3 -7
- package/definitions/entry.js.map +1 -1
- package/definitions/entryElasticsearch.js +3 -7
- package/definitions/entryElasticsearch.js.map +1 -1
- package/definitions/group.js +3 -7
- package/definitions/group.js.map +1 -1
- package/definitions/model.js +8 -7
- package/definitions/model.js.map +1 -1
- package/definitions/settings.js +3 -7
- package/definitions/settings.js.map +1 -1
- package/definitions/system.js +3 -7
- package/definitions/system.js.map +1 -1
- package/dynamoDb/index.d.ts +1 -1
- package/dynamoDb/storage/date.d.ts +2 -1
- package/dynamoDb/storage/date.js +1 -1
- package/dynamoDb/storage/date.js.map +1 -1
- package/dynamoDb/storage/longText.d.ts +1 -1
- package/dynamoDb/storage/longText.js +8 -1
- package/dynamoDb/storage/longText.js.map +1 -1
- package/dynamoDb/storage/richText.d.ts +1 -1
- package/dynamoDb/storage/richText.js +1 -1
- package/elasticsearch/createElasticsearchIndex.js +1 -1
- package/elasticsearch/index.js +1 -1
- package/elasticsearch/indexing/index.js +1 -1
- package/elasticsearch/indexing/longTextIndexing.d.ts +4 -0
- package/elasticsearch/indexing/longTextIndexing.js +20 -4
- package/elasticsearch/indexing/longTextIndexing.js.map +1 -1
- package/elasticsearch/search/refSearch.js +4 -2
- package/elasticsearch/search/refSearch.js.map +1 -1
- package/helpers/entryIndexHelpers.js +6 -11
- package/helpers/entryIndexHelpers.js.map +1 -1
- package/helpers/index.d.ts +0 -1
- package/helpers/index.js +0 -13
- package/helpers/index.js.map +1 -1
- package/index.js +17 -10
- package/index.js.map +1 -1
- package/operations/entry/dataLoaders.js +7 -9
- package/operations/entry/dataLoaders.js.map +1 -1
- 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 +162 -0
- package/operations/entry/elasticsearch/body.js.map +1 -0
- package/operations/entry/elasticsearch/fields.d.ts +9 -0
- package/operations/entry/elasticsearch/fields.js +248 -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 +66 -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 +215 -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 +15 -0
- package/operations/entry/elasticsearch/filtering/path.js +52 -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 +35 -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 +18 -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 +78 -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 +58 -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 +30 -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 +28 -0
- package/operations/entry/elasticsearch/filtering/values.js.map +1 -0
- package/operations/entry/elasticsearch/fullTextSearch.d.ts +9 -0
- package/operations/entry/elasticsearch/fullTextSearch.js +34 -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 +52 -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 +117 -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 +38 -0
- package/operations/entry/elasticsearch/keyword.js.map +1 -0
- package/operations/entry/elasticsearch/plugins/bodyModifier.d.ts +9 -0
- package/operations/entry/elasticsearch/plugins/bodyModifier.js +19 -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 +45 -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 +19 -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 -5
- 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 +19 -0
- package/operations/entry/elasticsearch/plugins/sortModifier.js.map +1 -0
- package/operations/entry/elasticsearch/sort.d.ts +12 -0
- package/operations/entry/elasticsearch/sort.js +92 -0
- package/operations/entry/elasticsearch/sort.js.map +1 -0
- package/operations/entry/elasticsearch/transformValueForSearch.d.ts +16 -0
- package/{helpers → operations/entry/elasticsearch}/transformValueForSearch.js +8 -3
- package/operations/entry/elasticsearch/transformValueForSearch.js.map +1 -0
- package/operations/entry/elasticsearch/types.d.ts +41 -0
- package/operations/entry/elasticsearch/types.js +5 -0
- package/operations/entry/elasticsearch/types.js.map +1 -0
- package/operations/entry/elasticsearchFields.js +3 -0
- package/operations/entry/elasticsearchFields.js.map +1 -1
- package/operations/entry/index.d.ts +0 -2
- package/operations/entry/index.js +100 -310
- package/operations/entry/index.js.map +1 -1
- package/operations/entry/recordType.d.ts +3 -0
- package/operations/entry/recordType.js +24 -0
- package/operations/entry/recordType.js.map +1 -0
- package/operations/group/index.js +7 -12
- package/operations/group/index.js.map +1 -1
- package/operations/model/index.js +4 -8
- package/operations/model/index.js.map +1 -1
- package/operations/settings/index.js +6 -10
- package/operations/settings/index.js.map +1 -1
- package/operations/system/index.js +4 -8
- package/operations/system/index.js.map +1 -1
- package/package.json +18 -19
- package/plugins/CmsEntryElasticsearchBodyModifierPlugin.js +1 -1
- package/plugins/CmsEntryElasticsearchFieldPlugin.js +1 -1
- package/plugins/CmsEntryElasticsearchIndexPlugin.js +1 -1
- package/plugins/CmsEntryElasticsearchQueryBuilderValueSearchPlugin.js +1 -1
- package/plugins/CmsEntryElasticsearchQueryModifierPlugin.js +1 -1
- package/plugins/CmsEntryElasticsearchSortModifierPlugin.js +1 -1
- package/plugins/CmsEntryFilterPlugin.d.ts +49 -0
- package/plugins/CmsEntryFilterPlugin.js +31 -0
- package/plugins/CmsEntryFilterPlugin.js.map +1 -0
- package/helpers/createElasticsearchQueryBody.d.ts +0 -11
- package/helpers/createElasticsearchQueryBody.js +0 -618
- package/helpers/createElasticsearchQueryBody.js.map +0 -1
- package/helpers/fields.d.ts +0 -19
- package/helpers/fields.js +0 -196
- package/helpers/fields.js.map +0 -1
- package/helpers/searchPluginsList.d.ts +0 -6
- package/helpers/searchPluginsList.js.map +0 -1
- package/helpers/transformValueForSearch.d.ts +0 -12
- package/helpers/transformValueForSearch.js.map +0 -1
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
4
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.
|
|
8
|
+
exports.createEntriesStorageOperations = void 0;
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
11
|
+
|
|
12
|
+
var _cloneDeep = _interopRequireDefault(require("lodash/cloneDeep"));
|
|
13
|
+
|
|
14
|
+
var _error = _interopRequireDefault(require("@webiny/error"));
|
|
11
15
|
|
|
12
16
|
var _types = require("@webiny/api-headless-cms/types");
|
|
13
17
|
|
|
@@ -15,12 +19,6 @@ var _helpers = require("../../helpers");
|
|
|
15
19
|
|
|
16
20
|
var _configurations = require("../../configurations");
|
|
17
21
|
|
|
18
|
-
var _error = _interopRequireDefault(require("@webiny/error"));
|
|
19
|
-
|
|
20
|
-
var _cloneDeep = _interopRequireDefault(require("lodash/cloneDeep"));
|
|
21
|
-
|
|
22
|
-
var _omit = _interopRequireDefault(require("lodash/omit"));
|
|
23
|
-
|
|
24
22
|
var _batchWrite = require("@webiny/db-dynamodb/utils/batchWrite");
|
|
25
23
|
|
|
26
24
|
var _dataLoaders = require("./dataLoaders");
|
|
@@ -37,50 +35,36 @@ var _utils = require("@webiny/utils");
|
|
|
37
35
|
|
|
38
36
|
var _cleanup = require("@webiny/db-dynamodb/utils/cleanup");
|
|
39
37
|
|
|
40
|
-
|
|
38
|
+
var _body = require("./elasticsearch/body");
|
|
41
39
|
|
|
42
|
-
|
|
40
|
+
var _recordType = require("./recordType");
|
|
43
41
|
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
exports.createLatestType = createLatestType;
|
|
53
|
-
|
|
54
|
-
const createPublishedType = () => {
|
|
55
|
-
return `${createType()}.p`;
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
exports.createPublishedType = createPublishedType;
|
|
59
|
-
|
|
60
|
-
const getEntryData = entry => {
|
|
61
|
-
return _objectSpread(_objectSpread({}, (0, _omit.default)(entry, ["PK", "SK", "published", "latest"])), {}, {
|
|
62
|
-
TYPE: createType(),
|
|
63
|
-
__type: createType()
|
|
64
|
-
});
|
|
42
|
+
const getEntryData = input => {
|
|
43
|
+
const output = (0, _objectSpread2.default)({}, input);
|
|
44
|
+
delete output["PK"];
|
|
45
|
+
delete output["SK"];
|
|
46
|
+
delete output["published"];
|
|
47
|
+
delete output["latest"];
|
|
48
|
+
return output;
|
|
65
49
|
};
|
|
66
50
|
|
|
67
51
|
const getESLatestEntryData = async (plugins, entry) => {
|
|
68
|
-
return (0, _apiElasticsearch.compress)(plugins,
|
|
52
|
+
return (0, _apiElasticsearch.compress)(plugins, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, getEntryData(entry)), {}, {
|
|
69
53
|
latest: true,
|
|
70
|
-
TYPE:
|
|
71
|
-
__type:
|
|
54
|
+
TYPE: (0, _recordType.createLatestRecordType)(),
|
|
55
|
+
__type: (0, _recordType.createLatestRecordType)()
|
|
72
56
|
}));
|
|
73
57
|
};
|
|
74
58
|
|
|
75
59
|
const getESPublishedEntryData = async (plugins, entry) => {
|
|
76
|
-
return (0, _apiElasticsearch.compress)(plugins,
|
|
60
|
+
return (0, _apiElasticsearch.compress)(plugins, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, getEntryData(entry)), {}, {
|
|
77
61
|
published: true,
|
|
78
|
-
TYPE:
|
|
79
|
-
__type:
|
|
62
|
+
TYPE: (0, _recordType.createPublishedRecordType)(),
|
|
63
|
+
__type: (0, _recordType.createPublishedRecordType)()
|
|
80
64
|
}));
|
|
81
65
|
};
|
|
82
66
|
|
|
83
|
-
const
|
|
67
|
+
const convertEntryKeysToStorage = params => {
|
|
84
68
|
const {
|
|
85
69
|
model,
|
|
86
70
|
entry
|
|
@@ -89,12 +73,12 @@ const convertToStorageEntry = params => {
|
|
|
89
73
|
fields: model.fields,
|
|
90
74
|
values: entry.values
|
|
91
75
|
});
|
|
92
|
-
return
|
|
76
|
+
return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, entry), {}, {
|
|
93
77
|
values
|
|
94
78
|
});
|
|
95
79
|
};
|
|
96
80
|
|
|
97
|
-
const
|
|
81
|
+
const convertEntryKeysFromStorage = params => {
|
|
98
82
|
const {
|
|
99
83
|
model,
|
|
100
84
|
entry
|
|
@@ -103,7 +87,7 @@ const convertFromStorageEntry = params => {
|
|
|
103
87
|
fields: model.fields,
|
|
104
88
|
values: entry.values
|
|
105
89
|
});
|
|
106
|
-
return
|
|
90
|
+
return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, entry), {}, {
|
|
107
91
|
values
|
|
108
92
|
});
|
|
109
93
|
};
|
|
@@ -126,21 +110,21 @@ const createEntriesStorageOperations = params => {
|
|
|
126
110
|
} = params;
|
|
127
111
|
const isPublished = initialEntry.status === "published";
|
|
128
112
|
const locked = isPublished ? true : initialEntry.locked;
|
|
129
|
-
const entry =
|
|
113
|
+
const entry = convertEntryKeysToStorage({
|
|
130
114
|
model,
|
|
131
115
|
entry: initialEntry
|
|
132
116
|
});
|
|
133
|
-
const storageEntry =
|
|
117
|
+
const storageEntry = convertEntryKeysToStorage({
|
|
134
118
|
model,
|
|
135
119
|
entry: initialStorageEntry
|
|
136
120
|
});
|
|
137
121
|
const esEntry = (0, _helpers.prepareEntryToIndex)({
|
|
138
122
|
plugins,
|
|
139
123
|
model,
|
|
140
|
-
entry: (0, _cloneDeep.default)(
|
|
124
|
+
entry: (0, _cloneDeep.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({}, entry), {}, {
|
|
141
125
|
locked
|
|
142
126
|
})),
|
|
143
|
-
storageEntry: (0, _cloneDeep.default)(
|
|
127
|
+
storageEntry: (0, _cloneDeep.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({}, storageEntry), {}, {
|
|
144
128
|
locked
|
|
145
129
|
}))
|
|
146
130
|
});
|
|
@@ -177,21 +161,21 @@ const createEntriesStorageOperations = params => {
|
|
|
177
161
|
}),
|
|
178
162
|
SK: (0, _keys.createPublishedSortKey)()
|
|
179
163
|
};
|
|
180
|
-
const items = [entity.putBatch(
|
|
164
|
+
const items = [entity.putBatch((0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({}, storageEntry), {}, {
|
|
181
165
|
locked
|
|
182
166
|
}, revisionKeys), {}, {
|
|
183
|
-
TYPE:
|
|
184
|
-
})), entity.putBatch(
|
|
167
|
+
TYPE: (0, _recordType.createRecordType)()
|
|
168
|
+
})), entity.putBatch((0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({}, storageEntry), {}, {
|
|
185
169
|
locked
|
|
186
170
|
}, latestKeys), {}, {
|
|
187
|
-
TYPE:
|
|
171
|
+
TYPE: (0, _recordType.createLatestRecordType)()
|
|
188
172
|
}))];
|
|
189
173
|
|
|
190
174
|
if (isPublished) {
|
|
191
|
-
items.push(entity.putBatch(
|
|
175
|
+
items.push(entity.putBatch((0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({}, storageEntry), {}, {
|
|
192
176
|
locked
|
|
193
177
|
}, publishedKeys), {}, {
|
|
194
|
-
TYPE:
|
|
178
|
+
TYPE: (0, _recordType.createPublishedRecordType)()
|
|
195
179
|
})));
|
|
196
180
|
}
|
|
197
181
|
|
|
@@ -211,13 +195,13 @@ const createEntriesStorageOperations = params => {
|
|
|
211
195
|
});
|
|
212
196
|
}
|
|
213
197
|
|
|
214
|
-
const esItems = [esEntity.putBatch(
|
|
198
|
+
const esItems = [esEntity.putBatch((0, _objectSpread2.default)((0, _objectSpread2.default)({}, latestKeys), {}, {
|
|
215
199
|
index: esIndex,
|
|
216
200
|
data: esLatestData
|
|
217
201
|
}))];
|
|
218
202
|
|
|
219
203
|
if (isPublished) {
|
|
220
|
-
esItems.push(esEntity.putBatch(
|
|
204
|
+
esItems.push(esEntity.putBatch((0, _objectSpread2.default)((0, _objectSpread2.default)({}, publishedKeys), {}, {
|
|
221
205
|
index: esIndex,
|
|
222
206
|
data: esPublishedData
|
|
223
207
|
})));
|
|
@@ -244,11 +228,11 @@ const createEntriesStorageOperations = params => {
|
|
|
244
228
|
entry: initialEntry,
|
|
245
229
|
storageEntry: initialStorageEntry
|
|
246
230
|
} = params;
|
|
247
|
-
const entry =
|
|
231
|
+
const entry = convertEntryKeysToStorage({
|
|
248
232
|
model,
|
|
249
233
|
entry: initialEntry
|
|
250
234
|
});
|
|
251
|
-
const storageEntry =
|
|
235
|
+
const storageEntry = convertEntryKeysToStorage({
|
|
252
236
|
model,
|
|
253
237
|
entry: initialStorageEntry
|
|
254
238
|
});
|
|
@@ -275,10 +259,10 @@ const createEntriesStorageOperations = params => {
|
|
|
275
259
|
storageEntry: (0, _cloneDeep.default)(storageEntry)
|
|
276
260
|
});
|
|
277
261
|
const esLatestData = await getESLatestEntryData(plugins, esEntry);
|
|
278
|
-
const items = [entity.putBatch(
|
|
279
|
-
TYPE:
|
|
280
|
-
}, revisionKeys)), entity.putBatch(
|
|
281
|
-
TYPE:
|
|
262
|
+
const items = [entity.putBatch((0, _objectSpread2.default)((0, _objectSpread2.default)({}, storageEntry), {}, {
|
|
263
|
+
TYPE: (0, _recordType.createRecordType)()
|
|
264
|
+
}, revisionKeys)), entity.putBatch((0, _objectSpread2.default)((0, _objectSpread2.default)({}, storageEntry), {}, {
|
|
265
|
+
TYPE: (0, _recordType.createLatestRecordType)()
|
|
282
266
|
}, latestKeys))];
|
|
283
267
|
|
|
284
268
|
const {
|
|
@@ -308,7 +292,7 @@ const createEntriesStorageOperations = params => {
|
|
|
308
292
|
|
|
309
293
|
|
|
310
294
|
try {
|
|
311
|
-
await esEntity.put(
|
|
295
|
+
await esEntity.put((0, _objectSpread2.default)((0, _objectSpread2.default)({}, latestKeys), {}, {
|
|
312
296
|
index,
|
|
313
297
|
data: esLatestData
|
|
314
298
|
}));
|
|
@@ -331,11 +315,11 @@ const createEntriesStorageOperations = params => {
|
|
|
331
315
|
entry: initialEntry,
|
|
332
316
|
storageEntry: initialStorageEntry
|
|
333
317
|
} = params;
|
|
334
|
-
const entry =
|
|
318
|
+
const entry = convertEntryKeysToStorage({
|
|
335
319
|
model,
|
|
336
320
|
entry: initialEntry
|
|
337
321
|
});
|
|
338
|
-
const storageEntry =
|
|
322
|
+
const storageEntry = convertEntryKeysToStorage({
|
|
339
323
|
model,
|
|
340
324
|
entry: initialStorageEntry
|
|
341
325
|
});
|
|
@@ -377,17 +361,17 @@ const createEntriesStorageOperations = params => {
|
|
|
377
361
|
model,
|
|
378
362
|
ids: [entry.id]
|
|
379
363
|
});
|
|
380
|
-
const items = [entity.putBatch(
|
|
364
|
+
const items = [entity.putBatch((0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({}, storageEntry), {}, {
|
|
381
365
|
locked
|
|
382
366
|
}, revisionKeys), {}, {
|
|
383
|
-
TYPE:
|
|
367
|
+
TYPE: (0, _recordType.createRecordType)()
|
|
384
368
|
}))];
|
|
385
369
|
|
|
386
370
|
if (isPublished) {
|
|
387
|
-
items.push(entity.putBatch(
|
|
371
|
+
items.push(entity.putBatch((0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({}, storageEntry), {}, {
|
|
388
372
|
locked
|
|
389
373
|
}, publishedKeys), {}, {
|
|
390
|
-
TYPE:
|
|
374
|
+
TYPE: (0, _recordType.createPublishedRecordType)()
|
|
391
375
|
})));
|
|
392
376
|
}
|
|
393
377
|
|
|
@@ -414,7 +398,7 @@ const createEntriesStorageOperations = params => {
|
|
|
414
398
|
/**
|
|
415
399
|
* First we update the regular DynamoDB table
|
|
416
400
|
*/
|
|
417
|
-
items.push(entity.putBatch(
|
|
401
|
+
items.push(entity.putBatch((0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({}, storageEntry), latestKeys), {}, {
|
|
418
402
|
TYPE: (0, _keys.createLatestSortKey)()
|
|
419
403
|
})));
|
|
420
404
|
/**
|
|
@@ -424,15 +408,15 @@ const createEntriesStorageOperations = params => {
|
|
|
424
408
|
esEntry = (0, _helpers.prepareEntryToIndex)({
|
|
425
409
|
plugins,
|
|
426
410
|
model,
|
|
427
|
-
entry: (0, _cloneDeep.default)(
|
|
411
|
+
entry: (0, _cloneDeep.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({}, entry), {}, {
|
|
428
412
|
locked
|
|
429
413
|
})),
|
|
430
|
-
storageEntry: (0, _cloneDeep.default)(
|
|
414
|
+
storageEntry: (0, _cloneDeep.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({}, storageEntry), {}, {
|
|
431
415
|
locked
|
|
432
416
|
}))
|
|
433
417
|
});
|
|
434
418
|
elasticsearchLatestData = await getESLatestEntryData(plugins, esEntry);
|
|
435
|
-
esItems.push(esEntity.putBatch(
|
|
419
|
+
esItems.push(esEntity.putBatch((0, _objectSpread2.default)((0, _objectSpread2.default)({}, latestKeys), {}, {
|
|
436
420
|
index: esIndex,
|
|
437
421
|
data: elasticsearchLatestData
|
|
438
422
|
})));
|
|
@@ -449,10 +433,10 @@ const createEntriesStorageOperations = params => {
|
|
|
449
433
|
esEntry = (0, _helpers.prepareEntryToIndex)({
|
|
450
434
|
plugins,
|
|
451
435
|
model,
|
|
452
|
-
entry: (0, _cloneDeep.default)(
|
|
436
|
+
entry: (0, _cloneDeep.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({}, entry), {}, {
|
|
453
437
|
locked
|
|
454
438
|
})),
|
|
455
|
-
storageEntry: (0, _cloneDeep.default)(
|
|
439
|
+
storageEntry: (0, _cloneDeep.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({}, storageEntry), {}, {
|
|
456
440
|
locked
|
|
457
441
|
}))
|
|
458
442
|
});
|
|
@@ -460,15 +444,15 @@ const createEntriesStorageOperations = params => {
|
|
|
460
444
|
|
|
461
445
|
elasticsearchPublishedData = await getESPublishedEntryData(plugins, esEntry);
|
|
462
446
|
} else {
|
|
463
|
-
elasticsearchPublishedData =
|
|
447
|
+
elasticsearchPublishedData = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, elasticsearchLatestData), {}, {
|
|
464
448
|
published: true,
|
|
465
|
-
TYPE:
|
|
466
|
-
__type:
|
|
449
|
+
TYPE: (0, _recordType.createPublishedRecordType)(),
|
|
450
|
+
__type: (0, _recordType.createPublishedRecordType)()
|
|
467
451
|
});
|
|
468
452
|
delete elasticsearchPublishedData.latest;
|
|
469
453
|
}
|
|
470
454
|
|
|
471
|
-
esItems.push(esEntity.putBatch(
|
|
455
|
+
esItems.push(esEntity.putBatch((0, _objectSpread2.default)((0, _objectSpread2.default)({}, publishedKeys), {}, {
|
|
472
456
|
index: esIndex,
|
|
473
457
|
data: elasticsearchPublishedData
|
|
474
458
|
})));
|
|
@@ -639,10 +623,10 @@ const createEntriesStorageOperations = params => {
|
|
|
639
623
|
* In the end we need to set the new latest entry
|
|
640
624
|
*/
|
|
641
625
|
|
|
642
|
-
items.push(entity.putBatch(
|
|
626
|
+
items.push(entity.putBatch((0, _objectSpread2.default)((0, _objectSpread2.default)({}, latestStorageEntry), {}, {
|
|
643
627
|
PK: partitionKey,
|
|
644
628
|
SK: (0, _keys.createLatestSortKey)(),
|
|
645
|
-
TYPE:
|
|
629
|
+
TYPE: (0, _recordType.createLatestRecordType)()
|
|
646
630
|
})));
|
|
647
631
|
esItems.push(esEntity.putBatch({
|
|
648
632
|
PK: partitionKey,
|
|
@@ -689,6 +673,8 @@ const createEntriesStorageOperations = params => {
|
|
|
689
673
|
};
|
|
690
674
|
|
|
691
675
|
const list = async (model, params) => {
|
|
676
|
+
var _response, _response$body;
|
|
677
|
+
|
|
692
678
|
const limit = (0, _apiElasticsearch.createLimit)(params.limit, 50);
|
|
693
679
|
|
|
694
680
|
const {
|
|
@@ -702,7 +688,7 @@ const createEntriesStorageOperations = params => {
|
|
|
702
688
|
index
|
|
703
689
|
});
|
|
704
690
|
|
|
705
|
-
if (!result
|
|
691
|
+
if (!(result !== null && result !== void 0 && result.body)) {
|
|
706
692
|
return {
|
|
707
693
|
hasMoreItems: false,
|
|
708
694
|
totalCount: 0,
|
|
@@ -717,13 +703,13 @@ const createEntriesStorageOperations = params => {
|
|
|
717
703
|
});
|
|
718
704
|
}
|
|
719
705
|
|
|
720
|
-
const body = (0,
|
|
706
|
+
const body = (0, _body.createElasticsearchBody)({
|
|
721
707
|
model,
|
|
722
|
-
|
|
723
|
-
limit
|
|
708
|
+
params: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, params), {}, {
|
|
709
|
+
limit,
|
|
710
|
+
after: (0, _apiElasticsearch.decodeCursor)(params.after)
|
|
724
711
|
}),
|
|
725
|
-
plugins
|
|
726
|
-
parentPath: "values"
|
|
712
|
+
plugins
|
|
727
713
|
});
|
|
728
714
|
let response;
|
|
729
715
|
|
|
@@ -744,13 +730,13 @@ const createEntriesStorageOperations = params => {
|
|
|
744
730
|
const {
|
|
745
731
|
hits,
|
|
746
732
|
total
|
|
747
|
-
} = response.body.hits;
|
|
733
|
+
} = ((_response = response) === null || _response === void 0 ? void 0 : (_response$body = _response.body) === null || _response$body === void 0 ? void 0 : _response$body.hits) || {};
|
|
748
734
|
const items = (0, _helpers.extractEntriesFromIndex)({
|
|
749
735
|
plugins,
|
|
750
736
|
model,
|
|
751
737
|
entries: hits.map(item => item._source)
|
|
752
738
|
}).map(item => {
|
|
753
|
-
return
|
|
739
|
+
return convertEntryKeysFromStorage({
|
|
754
740
|
model,
|
|
755
741
|
entry: item
|
|
756
742
|
});
|
|
@@ -781,7 +767,7 @@ const createEntriesStorageOperations = params => {
|
|
|
781
767
|
const get = async (model, params) => {
|
|
782
768
|
const {
|
|
783
769
|
items
|
|
784
|
-
} = await list(model,
|
|
770
|
+
} = await list(model, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, params), {}, {
|
|
785
771
|
limit: 1
|
|
786
772
|
}));
|
|
787
773
|
return items.shift() || null;
|
|
@@ -792,11 +778,11 @@ const createEntriesStorageOperations = params => {
|
|
|
792
778
|
entry: initialEntry,
|
|
793
779
|
storageEntry: initialStorageEntry
|
|
794
780
|
} = params;
|
|
795
|
-
const entry =
|
|
781
|
+
const entry = convertEntryKeysToStorage({
|
|
796
782
|
model,
|
|
797
783
|
entry: initialEntry
|
|
798
784
|
});
|
|
799
|
-
const storageEntry =
|
|
785
|
+
const storageEntry = convertEntryKeysToStorage({
|
|
800
786
|
model,
|
|
801
787
|
entry: initialStorageEntry
|
|
802
788
|
});
|
|
@@ -847,8 +833,8 @@ const createEntriesStorageOperations = params => {
|
|
|
847
833
|
});
|
|
848
834
|
}
|
|
849
835
|
|
|
850
|
-
const items = [entity.putBatch(
|
|
851
|
-
TYPE:
|
|
836
|
+
const items = [entity.putBatch((0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({}, storageEntry), revisionKeys), {}, {
|
|
837
|
+
TYPE: (0, _recordType.createRecordType)()
|
|
852
838
|
}))];
|
|
853
839
|
const esItems = [];
|
|
854
840
|
|
|
@@ -869,20 +855,15 @@ const createEntriesStorageOperations = params => {
|
|
|
869
855
|
const [previouslyPublishedEntry] = await dataLoaders.getRevisionById({
|
|
870
856
|
model,
|
|
871
857
|
ids: [publishedStorageEntry.id]
|
|
872
|
-
});
|
|
873
|
-
// const previouslyPublishedEntry = convertToStorageEntry({
|
|
874
|
-
// model,
|
|
875
|
-
// entry: initialPreviouslyPublishedEntry
|
|
876
|
-
// });
|
|
877
|
-
|
|
858
|
+
});
|
|
878
859
|
items.push(
|
|
879
860
|
/**
|
|
880
861
|
* Update currently published entry (unpublish it)
|
|
881
862
|
*/
|
|
882
|
-
entity.putBatch(
|
|
863
|
+
entity.putBatch((0, _objectSpread2.default)((0, _objectSpread2.default)({}, previouslyPublishedEntry), {}, {
|
|
883
864
|
status: _types.CONTENT_ENTRY_STATUS.UNPUBLISHED,
|
|
884
865
|
savedOn: entry.savedOn,
|
|
885
|
-
TYPE:
|
|
866
|
+
TYPE: (0, _recordType.createRecordType)(),
|
|
886
867
|
PK: (0, _keys.createPartitionKey)(publishedStorageEntry),
|
|
887
868
|
SK: (0, _keys.createRevisionSortKey)(publishedStorageEntry)
|
|
888
869
|
})));
|
|
@@ -892,8 +873,8 @@ const createEntriesStorageOperations = params => {
|
|
|
892
873
|
*/
|
|
893
874
|
|
|
894
875
|
|
|
895
|
-
items.push(entity.putBatch(
|
|
896
|
-
TYPE:
|
|
876
|
+
items.push(entity.putBatch((0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({}, storageEntry), publishedKeys), {}, {
|
|
877
|
+
TYPE: (0, _recordType.createPublishedRecordType)()
|
|
897
878
|
})));
|
|
898
879
|
/**
|
|
899
880
|
* We need the latest entry to check if it needs to be updated as well in the Elasticsearch.
|
|
@@ -905,7 +886,7 @@ const createEntriesStorageOperations = params => {
|
|
|
905
886
|
});
|
|
906
887
|
|
|
907
888
|
if ((latestStorageEntry === null || latestStorageEntry === void 0 ? void 0 : latestStorageEntry.id) === entry.id) {
|
|
908
|
-
items.push(entity.putBatch(
|
|
889
|
+
items.push(entity.putBatch((0, _objectSpread2.default)((0, _objectSpread2.default)({}, storageEntry), latestKeys)));
|
|
909
890
|
}
|
|
910
891
|
/**
|
|
911
892
|
* If we are publishing the latest revision, let's also update the latest revision's status in ES.
|
|
@@ -923,7 +904,7 @@ const createEntriesStorageOperations = params => {
|
|
|
923
904
|
index,
|
|
924
905
|
PK: (0, _keys.createPartitionKey)(latestEsEntryDataDecompressed),
|
|
925
906
|
SK: (0, _keys.createLatestSortKey)(),
|
|
926
|
-
data: await getESLatestEntryData(plugins,
|
|
907
|
+
data: await getESLatestEntryData(plugins, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, latestEsEntryDataDecompressed), {}, {
|
|
927
908
|
status: _types.CONTENT_ENTRY_STATUS.PUBLISHED,
|
|
928
909
|
locked: true,
|
|
929
910
|
savedOn: entry.savedOn,
|
|
@@ -943,7 +924,7 @@ const createEntriesStorageOperations = params => {
|
|
|
943
924
|
*/
|
|
944
925
|
|
|
945
926
|
const esPublishedData = await getESPublishedEntryData(plugins, preparedEntryData);
|
|
946
|
-
esItems.push(esEntity.putBatch(
|
|
927
|
+
esItems.push(esEntity.putBatch((0, _objectSpread2.default)((0, _objectSpread2.default)({}, publishedKeys), {}, {
|
|
947
928
|
index,
|
|
948
929
|
data: esPublishedData
|
|
949
930
|
})));
|
|
@@ -994,11 +975,11 @@ const createEntriesStorageOperations = params => {
|
|
|
994
975
|
entry: initialEntry,
|
|
995
976
|
storageEntry: initialStorageEntry
|
|
996
977
|
} = params;
|
|
997
|
-
const entry =
|
|
978
|
+
const entry = convertEntryKeysToStorage({
|
|
998
979
|
model,
|
|
999
980
|
entry: initialEntry
|
|
1000
981
|
});
|
|
1001
|
-
const storageEntry =
|
|
982
|
+
const storageEntry = convertEntryKeysToStorage({
|
|
1002
983
|
model,
|
|
1003
984
|
entry: initialStorageEntry
|
|
1004
985
|
});
|
|
@@ -1018,10 +999,10 @@ const createEntriesStorageOperations = params => {
|
|
|
1018
999
|
const items = [entity.deleteBatch({
|
|
1019
1000
|
PK: partitionKey,
|
|
1020
1001
|
SK: (0, _keys.createPublishedSortKey)()
|
|
1021
|
-
}), entity.putBatch(
|
|
1002
|
+
}), entity.putBatch((0, _objectSpread2.default)((0, _objectSpread2.default)({}, storageEntry), {}, {
|
|
1022
1003
|
PK: partitionKey,
|
|
1023
1004
|
SK: (0, _keys.createRevisionSortKey)(entry),
|
|
1024
|
-
TYPE:
|
|
1005
|
+
TYPE: (0, _recordType.createRecordType)()
|
|
1025
1006
|
}))];
|
|
1026
1007
|
const esItems = [esEntity.deleteBatch({
|
|
1027
1008
|
PK: partitionKey,
|
|
@@ -1091,195 +1072,6 @@ const createEntriesStorageOperations = params => {
|
|
|
1091
1072
|
return initialStorageEntry;
|
|
1092
1073
|
};
|
|
1093
1074
|
|
|
1094
|
-
const requestReview = async (model, params) => {
|
|
1095
|
-
const {
|
|
1096
|
-
entry: initialEntry,
|
|
1097
|
-
storageEntry: initialStorageEntry
|
|
1098
|
-
} = params;
|
|
1099
|
-
const entry = convertToStorageEntry({
|
|
1100
|
-
model,
|
|
1101
|
-
entry: initialEntry
|
|
1102
|
-
});
|
|
1103
|
-
const storageEntry = convertToStorageEntry({
|
|
1104
|
-
model,
|
|
1105
|
-
entry: initialStorageEntry
|
|
1106
|
-
});
|
|
1107
|
-
/**
|
|
1108
|
-
* We need the latest entry to check if it needs to be updated.
|
|
1109
|
-
*/
|
|
1110
|
-
|
|
1111
|
-
const [latestStorageEntry] = await dataLoaders.getLatestRevisionByEntryId({
|
|
1112
|
-
model,
|
|
1113
|
-
ids: [entry.id]
|
|
1114
|
-
});
|
|
1115
|
-
const partitionKey = (0, _keys.createPartitionKey)({
|
|
1116
|
-
id: entry.id,
|
|
1117
|
-
locale: model.locale,
|
|
1118
|
-
tenant: model.tenant
|
|
1119
|
-
});
|
|
1120
|
-
/**
|
|
1121
|
-
* If we updated the latest version, then make sure the changes are propagated to ES too.
|
|
1122
|
-
*/
|
|
1123
|
-
|
|
1124
|
-
let esLatestData = null;
|
|
1125
|
-
|
|
1126
|
-
const {
|
|
1127
|
-
index
|
|
1128
|
-
} = _configurations.configurations.es({
|
|
1129
|
-
model
|
|
1130
|
-
});
|
|
1131
|
-
|
|
1132
|
-
if ((latestStorageEntry === null || latestStorageEntry === void 0 ? void 0 : latestStorageEntry.id) === entry.id) {
|
|
1133
|
-
const preparedEntryData = (0, _helpers.prepareEntryToIndex)({
|
|
1134
|
-
plugins,
|
|
1135
|
-
model,
|
|
1136
|
-
entry: (0, _cloneDeep.default)(entry),
|
|
1137
|
-
storageEntry: (0, _cloneDeep.default)(storageEntry)
|
|
1138
|
-
});
|
|
1139
|
-
esLatestData = await getESLatestEntryData(plugins, preparedEntryData);
|
|
1140
|
-
}
|
|
1141
|
-
|
|
1142
|
-
try {
|
|
1143
|
-
await entity.put(_objectSpread(_objectSpread({}, storageEntry), {}, {
|
|
1144
|
-
PK: partitionKey,
|
|
1145
|
-
SK: (0, _keys.createRevisionSortKey)(entry),
|
|
1146
|
-
TYPE: createType()
|
|
1147
|
-
}));
|
|
1148
|
-
dataLoaders.clearAll({
|
|
1149
|
-
model
|
|
1150
|
-
});
|
|
1151
|
-
} catch (ex) {
|
|
1152
|
-
throw new _error.default(ex.message || "Could not store request review entry record into DynamoDB table.", ex.code || "REQUEST_REVIEW_ERROR", {
|
|
1153
|
-
entry,
|
|
1154
|
-
storageEntry,
|
|
1155
|
-
latestStorageEntry
|
|
1156
|
-
});
|
|
1157
|
-
}
|
|
1158
|
-
/**
|
|
1159
|
-
* No need to proceed further if nothing to put into Elasticsearch.
|
|
1160
|
-
*/
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
if (!esLatestData) {
|
|
1164
|
-
return initialStorageEntry;
|
|
1165
|
-
}
|
|
1166
|
-
|
|
1167
|
-
try {
|
|
1168
|
-
await esEntity.put({
|
|
1169
|
-
PK: partitionKey,
|
|
1170
|
-
SK: (0, _keys.createLatestSortKey)(),
|
|
1171
|
-
index,
|
|
1172
|
-
data: esLatestData
|
|
1173
|
-
});
|
|
1174
|
-
} catch (ex) {
|
|
1175
|
-
throw new _error.default(ex.message || "Could not store request review entry record into DynamoDB Elasticsearch table.", ex.code || "REQUEST_REVIEW_ERROR", {
|
|
1176
|
-
entry,
|
|
1177
|
-
storageEntry,
|
|
1178
|
-
latestStorageEntry
|
|
1179
|
-
});
|
|
1180
|
-
}
|
|
1181
|
-
|
|
1182
|
-
return initialStorageEntry;
|
|
1183
|
-
};
|
|
1184
|
-
|
|
1185
|
-
const requestChanges = async (model, params) => {
|
|
1186
|
-
const {
|
|
1187
|
-
entry: initialEntry,
|
|
1188
|
-
storageEntry: initialStorageEntry
|
|
1189
|
-
} = params;
|
|
1190
|
-
const entry = convertToStorageEntry({
|
|
1191
|
-
model,
|
|
1192
|
-
entry: initialEntry
|
|
1193
|
-
});
|
|
1194
|
-
const storageEntry = convertToStorageEntry({
|
|
1195
|
-
model,
|
|
1196
|
-
entry: initialStorageEntry
|
|
1197
|
-
});
|
|
1198
|
-
/**
|
|
1199
|
-
* We need the latest entry to check if it needs to be updated.
|
|
1200
|
-
*/
|
|
1201
|
-
|
|
1202
|
-
const [latestStorageEntry] = await dataLoaders.getLatestRevisionByEntryId({
|
|
1203
|
-
model,
|
|
1204
|
-
ids: [entry.id]
|
|
1205
|
-
});
|
|
1206
|
-
const partitionKey = (0, _keys.createPartitionKey)({
|
|
1207
|
-
id: entry.id,
|
|
1208
|
-
locale: model.locale,
|
|
1209
|
-
tenant: model.tenant
|
|
1210
|
-
});
|
|
1211
|
-
const items = [entity.putBatch(_objectSpread(_objectSpread({}, storageEntry), {}, {
|
|
1212
|
-
PK: partitionKey,
|
|
1213
|
-
SK: (0, _keys.createRevisionSortKey)(entry),
|
|
1214
|
-
TYPE: createType()
|
|
1215
|
-
}))];
|
|
1216
|
-
/**
|
|
1217
|
-
* If we updated the latest version, then make sure the changes are propagated to ES too.
|
|
1218
|
-
*/
|
|
1219
|
-
|
|
1220
|
-
const {
|
|
1221
|
-
index
|
|
1222
|
-
} = _configurations.configurations.es({
|
|
1223
|
-
model
|
|
1224
|
-
});
|
|
1225
|
-
|
|
1226
|
-
let esLatestData = null;
|
|
1227
|
-
|
|
1228
|
-
if ((latestStorageEntry === null || latestStorageEntry === void 0 ? void 0 : latestStorageEntry.id) === entry.id) {
|
|
1229
|
-
items.push(entity.putBatch(_objectSpread(_objectSpread({}, storageEntry), {}, {
|
|
1230
|
-
PK: partitionKey,
|
|
1231
|
-
SK: (0, _keys.createLatestSortKey)(),
|
|
1232
|
-
TYPE: createLatestType()
|
|
1233
|
-
})));
|
|
1234
|
-
const preparedEntryData = (0, _helpers.prepareEntryToIndex)({
|
|
1235
|
-
plugins,
|
|
1236
|
-
model,
|
|
1237
|
-
entry: (0, _cloneDeep.default)(entry),
|
|
1238
|
-
storageEntry: (0, _cloneDeep.default)(storageEntry)
|
|
1239
|
-
});
|
|
1240
|
-
esLatestData = await getESLatestEntryData(plugins, preparedEntryData);
|
|
1241
|
-
}
|
|
1242
|
-
|
|
1243
|
-
try {
|
|
1244
|
-
await (0, _batchWrite.batchWriteAll)({
|
|
1245
|
-
table: entity.table,
|
|
1246
|
-
items
|
|
1247
|
-
});
|
|
1248
|
-
dataLoaders.clearAll({
|
|
1249
|
-
model
|
|
1250
|
-
});
|
|
1251
|
-
} catch (ex) {
|
|
1252
|
-
throw new _error.default(ex.message || "Could not store request changes entry record into DynamoDB table.", ex.code || "REQUEST_CHANGES_ERROR", {
|
|
1253
|
-
entry,
|
|
1254
|
-
latestStorageEntry
|
|
1255
|
-
});
|
|
1256
|
-
}
|
|
1257
|
-
/**
|
|
1258
|
-
* No need to proceed further if nothing to put into Elasticsearch.
|
|
1259
|
-
*/
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
if (!esLatestData) {
|
|
1263
|
-
return initialStorageEntry;
|
|
1264
|
-
}
|
|
1265
|
-
|
|
1266
|
-
try {
|
|
1267
|
-
await esEntity.put({
|
|
1268
|
-
PK: partitionKey,
|
|
1269
|
-
SK: (0, _keys.createLatestSortKey)(),
|
|
1270
|
-
index,
|
|
1271
|
-
data: esLatestData
|
|
1272
|
-
});
|
|
1273
|
-
} catch (ex) {
|
|
1274
|
-
throw new _error.default(ex.message || "Could not store request changes entry record into DynamoDB Elasticsearch table.", ex.code || "REQUEST_CHANGES_ERROR", {
|
|
1275
|
-
entry,
|
|
1276
|
-
latestStorageEntry
|
|
1277
|
-
});
|
|
1278
|
-
}
|
|
1279
|
-
|
|
1280
|
-
return initialStorageEntry;
|
|
1281
|
-
};
|
|
1282
|
-
|
|
1283
1075
|
const getLatestRevisionByEntryId = async (model, params) => {
|
|
1284
1076
|
const [entry] = await dataLoaders.getLatestRevisionByEntryId({
|
|
1285
1077
|
model,
|
|
@@ -1290,7 +1082,7 @@ const createEntriesStorageOperations = params => {
|
|
|
1290
1082
|
return null;
|
|
1291
1083
|
}
|
|
1292
1084
|
|
|
1293
|
-
return
|
|
1085
|
+
return convertEntryKeysFromStorage({
|
|
1294
1086
|
model,
|
|
1295
1087
|
entry
|
|
1296
1088
|
});
|
|
@@ -1306,7 +1098,7 @@ const createEntriesStorageOperations = params => {
|
|
|
1306
1098
|
return null;
|
|
1307
1099
|
}
|
|
1308
1100
|
|
|
1309
|
-
return
|
|
1101
|
+
return convertEntryKeysFromStorage({
|
|
1310
1102
|
model,
|
|
1311
1103
|
entry
|
|
1312
1104
|
});
|
|
@@ -1322,7 +1114,7 @@ const createEntriesStorageOperations = params => {
|
|
|
1322
1114
|
return null;
|
|
1323
1115
|
}
|
|
1324
1116
|
|
|
1325
|
-
return
|
|
1117
|
+
return convertEntryKeysFromStorage({
|
|
1326
1118
|
model,
|
|
1327
1119
|
entry
|
|
1328
1120
|
});
|
|
@@ -1334,7 +1126,7 @@ const createEntriesStorageOperations = params => {
|
|
|
1334
1126
|
ids: [params.id]
|
|
1335
1127
|
});
|
|
1336
1128
|
return entries.map(entry => {
|
|
1337
|
-
return
|
|
1129
|
+
return convertEntryKeysFromStorage({
|
|
1338
1130
|
model,
|
|
1339
1131
|
entry
|
|
1340
1132
|
});
|
|
@@ -1347,7 +1139,7 @@ const createEntriesStorageOperations = params => {
|
|
|
1347
1139
|
ids: params.ids
|
|
1348
1140
|
});
|
|
1349
1141
|
return entries.map(entry => {
|
|
1350
|
-
return
|
|
1142
|
+
return convertEntryKeysFromStorage({
|
|
1351
1143
|
model,
|
|
1352
1144
|
entry
|
|
1353
1145
|
});
|
|
@@ -1360,7 +1152,7 @@ const createEntriesStorageOperations = params => {
|
|
|
1360
1152
|
ids: params.ids
|
|
1361
1153
|
});
|
|
1362
1154
|
return entries.map(entry => {
|
|
1363
|
-
return
|
|
1155
|
+
return convertEntryKeysFromStorage({
|
|
1364
1156
|
model,
|
|
1365
1157
|
entry
|
|
1366
1158
|
});
|
|
@@ -1373,7 +1165,7 @@ const createEntriesStorageOperations = params => {
|
|
|
1373
1165
|
ids: params.ids
|
|
1374
1166
|
});
|
|
1375
1167
|
return entries.map(entry => {
|
|
1376
|
-
return
|
|
1168
|
+
return convertEntryKeysFromStorage({
|
|
1377
1169
|
model,
|
|
1378
1170
|
entry
|
|
1379
1171
|
});
|
|
@@ -1404,7 +1196,7 @@ const createEntriesStorageOperations = params => {
|
|
|
1404
1196
|
*/
|
|
1405
1197
|
filters: [{
|
|
1406
1198
|
attr: "TYPE",
|
|
1407
|
-
eq:
|
|
1199
|
+
eq: (0, _recordType.createRecordType)()
|
|
1408
1200
|
}, {
|
|
1409
1201
|
attr: "version",
|
|
1410
1202
|
lt: version
|
|
@@ -1421,12 +1213,12 @@ const createEntriesStorageOperations = params => {
|
|
|
1421
1213
|
return null;
|
|
1422
1214
|
}
|
|
1423
1215
|
|
|
1424
|
-
return
|
|
1216
|
+
return convertEntryKeysFromStorage({
|
|
1425
1217
|
entry,
|
|
1426
1218
|
model
|
|
1427
1219
|
});
|
|
1428
1220
|
} catch (ex) {
|
|
1429
|
-
throw new _error.default(ex.message || "Could not get previous version of given entry.", ex.code || "GET_PREVIOUS_VERSION_ERROR",
|
|
1221
|
+
throw new _error.default(ex.message || "Could not get previous version of given entry.", ex.code || "GET_PREVIOUS_VERSION_ERROR", (0, _objectSpread2.default)((0, _objectSpread2.default)({}, params), {}, {
|
|
1430
1222
|
error: ex,
|
|
1431
1223
|
partitionKey: queryParams.partitionKey,
|
|
1432
1224
|
options: queryParams.options,
|
|
@@ -1444,8 +1236,6 @@ const createEntriesStorageOperations = params => {
|
|
|
1444
1236
|
get,
|
|
1445
1237
|
publish,
|
|
1446
1238
|
unpublish,
|
|
1447
|
-
requestReview,
|
|
1448
|
-
requestChanges,
|
|
1449
1239
|
list,
|
|
1450
1240
|
getLatestRevisionByEntryId,
|
|
1451
1241
|
getPublishedRevisionByEntryId,
|