@webiny/api-headless-cms-ddb-es 5.37.8 → 5.38.0-beta.1
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 +3 -1
- package/definitions/entry.js +3 -1
- package/definitions/entryElasticsearch.js +3 -1
- package/definitions/group.js +3 -1
- package/definitions/model.js +3 -1
- package/definitions/system.js +3 -1
- package/definitions/table.js +3 -1
- package/definitions/tableElasticsearch.js +3 -1
- package/dynamoDb/index.js +3 -1
- package/dynamoDb/storage/date.js +3 -1
- package/dynamoDb/storage/longText.js +3 -1
- package/dynamoDb/storage/richText.js +3 -1
- package/elasticsearch/createElasticsearchIndex.d.ts +1 -1
- package/elasticsearch/createElasticsearchIndex.js +19 -29
- package/elasticsearch/createElasticsearchIndex.js.map +1 -1
- package/elasticsearch/deleteElasticsearchIndex.d.ts +1 -1
- package/elasticsearch/deleteElasticsearchIndex.js +6 -4
- package/elasticsearch/deleteElasticsearchIndex.js.map +1 -1
- package/elasticsearch/index.js +3 -1
- package/elasticsearch/indexing/dateTimeIndexing.js +3 -1
- package/elasticsearch/indexing/defaultFieldIndexing.js +3 -1
- package/elasticsearch/indexing/index.js +3 -1
- package/elasticsearch/indexing/longTextIndexing.js +3 -1
- package/elasticsearch/indexing/numberIndexing.js +3 -1
- package/elasticsearch/indexing/objectIndexing.js +3 -1
- package/elasticsearch/indexing/richTextIndexing.js +3 -1
- package/elasticsearch/indices/base.js +3 -1
- package/elasticsearch/indices/index.js +3 -1
- package/elasticsearch/indices/japanese.js +3 -1
- package/elasticsearch/search/index.js +3 -1
- package/elasticsearch/search/refSearch.js +3 -1
- package/elasticsearch/search/timeSearch.js +3 -1
- package/helpers/entryIndexHelpers.js +3 -1
- package/helpers/fieldIdentifier.js +3 -1
- package/helpers/index.js +3 -1
- package/index.js +14 -16
- package/index.js.map +1 -1
- package/operations/entry/dataLoader/DataLoaderCache.js +3 -1
- package/operations/entry/dataLoader/constants.js +3 -1
- package/operations/entry/dataLoader/createBatchScheduleFn.js +3 -1
- package/operations/entry/dataLoader/getAllEntryRevisions.js +3 -1
- package/operations/entry/dataLoader/getLatestRevisionByEntryId.js +3 -1
- package/operations/entry/dataLoader/getPublishedRevisionByEntryId.js +3 -1
- package/operations/entry/dataLoader/getRevisionById.js +3 -1
- package/operations/entry/dataLoader/index.js +3 -1
- package/operations/entry/dataLoader/types.js +3 -1
- package/operations/entry/dataLoaders.js +3 -1
- package/operations/entry/elasticsearch/assignMinimumShouldMatchToQuery.js +3 -1
- package/operations/entry/elasticsearch/body.js +3 -1
- package/operations/entry/elasticsearch/fields.js +3 -1
- package/operations/entry/elasticsearch/filtering/applyFiltering.js +3 -1
- package/operations/entry/elasticsearch/filtering/exec.js +3 -1
- package/operations/entry/elasticsearch/filtering/index.js +3 -1
- package/operations/entry/elasticsearch/filtering/path.js +3 -1
- package/operations/entry/elasticsearch/filtering/plugins/defaultFilterPlugin.js +3 -1
- package/operations/entry/elasticsearch/filtering/plugins/index.js +3 -1
- package/operations/entry/elasticsearch/filtering/plugins/objectFilterPlugin.js +3 -1
- package/operations/entry/elasticsearch/filtering/plugins/refFilterPlugin.js +3 -1
- package/operations/entry/elasticsearch/filtering/populated.js +3 -1
- package/operations/entry/elasticsearch/filtering/values.js +3 -1
- package/operations/entry/elasticsearch/fullTextSearch.js +3 -1
- package/operations/entry/elasticsearch/fullTextSearchFields.js +3 -1
- package/operations/entry/elasticsearch/initialQuery.js +3 -1
- package/operations/entry/elasticsearch/keyword.js +3 -1
- package/operations/entry/elasticsearch/plugins/bodyModifier.js +3 -1
- package/operations/entry/elasticsearch/plugins/operator.js +3 -1
- package/operations/entry/elasticsearch/plugins/queryModifier.js +3 -1
- package/operations/entry/elasticsearch/plugins/search.js +3 -1
- package/operations/entry/elasticsearch/plugins/sortModifier.js +3 -1
- package/operations/entry/elasticsearch/sort.js +3 -1
- package/operations/entry/elasticsearch/transformValueForSearch.js +3 -1
- package/operations/entry/elasticsearch/types.js +3 -1
- package/operations/entry/index.d.ts +0 -3
- package/operations/entry/index.js +80 -176
- package/operations/entry/index.js.map +1 -1
- package/operations/entry/keys.js +3 -1
- package/operations/entry/recordType.js +3 -1
- 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 +126 -0
- package/operations/entry/transformations/index.js.map +1 -0
- package/operations/entry/transformations/modifyEntryValues.d.ts +32 -0
- package/operations/entry/transformations/modifyEntryValues.js +29 -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 +33 -0
- package/operations/entry/transformations/transformEntryToIndex.js.map +1 -0
- package/operations/group/index.js +5 -3
- package/operations/group/index.js.map +1 -1
- package/operations/model/index.js +3 -1
- package/operations/system/index.js +3 -1
- package/operations/system/indexes.d.ts +10 -0
- package/operations/system/indexes.js +42 -0
- package/operations/system/indexes.js.map +1 -0
- package/package.json +19 -18
- package/plugins/CmsElasticsearchModelFieldPlugin.js +3 -1
- package/plugins/CmsEntryElasticsearchBodyModifierPlugin.js +3 -1
- package/plugins/CmsEntryElasticsearchFullTextSearchPlugin.js +3 -1
- package/plugins/CmsEntryElasticsearchIndexPlugin.js +3 -1
- package/plugins/CmsEntryElasticsearchQueryBuilderValueSearchPlugin.js +3 -1
- package/plugins/CmsEntryElasticsearchQueryModifierPlugin.js +3 -1
- package/plugins/CmsEntryElasticsearchSortModifierPlugin.js +3 -1
- package/plugins/CmsEntryElasticsearchValuesModifier.d.ts +33 -0
- package/plugins/CmsEntryElasticsearchValuesModifier.js +54 -0
- package/plugins/CmsEntryElasticsearchValuesModifier.js.map +1 -0
- package/plugins/CmsEntryFilterPlugin.js +3 -1
- package/plugins/index.d.ts +1 -0
- package/plugins/index.js +14 -1
- package/plugins/index.js.map +1 -1
- package/types.d.ts +1 -2
- package/types.js +3 -2
- package/types.js.map +1 -1
- package/definitions/settings.d.ts +0 -8
- package/definitions/settings.js +0 -53
- package/definitions/settings.js.map +0 -1
- package/operations/settings/index.d.ts +0 -6
- package/operations/settings/index.js +0 -111
- package/operations/settings/index.js.map +0 -1
|
@@ -4,9 +4,8 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.
|
|
7
|
+
exports.createEntriesStorageOperations = void 0;
|
|
8
8
|
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
9
|
-
var _cloneDeep = _interopRequireDefault(require("lodash/cloneDeep"));
|
|
10
9
|
var _error = _interopRequireDefault(require("@webiny/error"));
|
|
11
10
|
var _types = require("@webiny/api-headless-cms/types");
|
|
12
11
|
var _helpers = require("../../helpers");
|
|
@@ -23,56 +22,8 @@ var _body = require("./elasticsearch/body");
|
|
|
23
22
|
var _recordType = require("./recordType");
|
|
24
23
|
var _apiHeadlessCms = require("@webiny/api-headless-cms");
|
|
25
24
|
var _dbDynamodb = require("@webiny/db-dynamodb");
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
delete output["PK"];
|
|
29
|
-
delete output["SK"];
|
|
30
|
-
delete output["published"];
|
|
31
|
-
delete output["latest"];
|
|
32
|
-
return output;
|
|
33
|
-
};
|
|
34
|
-
const getESLatestEntryData = async (plugins, entry) => {
|
|
35
|
-
return (0, _apiElasticsearch.compress)(plugins, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, getEntryData(entry)), {}, {
|
|
36
|
-
latest: true,
|
|
37
|
-
TYPE: (0, _recordType.createLatestRecordType)(),
|
|
38
|
-
__type: (0, _recordType.createLatestRecordType)()
|
|
39
|
-
}));
|
|
40
|
-
};
|
|
41
|
-
exports.getESLatestEntryData = getESLatestEntryData;
|
|
42
|
-
const getESPublishedEntryData = async (plugins, entry) => {
|
|
43
|
-
return (0, _apiElasticsearch.compress)(plugins, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, getEntryData(entry)), {}, {
|
|
44
|
-
published: true,
|
|
45
|
-
TYPE: (0, _recordType.createPublishedRecordType)(),
|
|
46
|
-
__type: (0, _recordType.createPublishedRecordType)()
|
|
47
|
-
}));
|
|
48
|
-
};
|
|
49
|
-
exports.getESPublishedEntryData = getESPublishedEntryData;
|
|
50
|
-
const convertEntryKeysToStorage = params => {
|
|
51
|
-
const {
|
|
52
|
-
model,
|
|
53
|
-
entry
|
|
54
|
-
} = params;
|
|
55
|
-
const values = model.convertValueKeyToStorage({
|
|
56
|
-
fields: model.fields,
|
|
57
|
-
values: entry.values
|
|
58
|
-
});
|
|
59
|
-
return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, entry), {}, {
|
|
60
|
-
values
|
|
61
|
-
});
|
|
62
|
-
};
|
|
63
|
-
const convertEntryKeysFromStorage = params => {
|
|
64
|
-
const {
|
|
65
|
-
model,
|
|
66
|
-
entry
|
|
67
|
-
} = params;
|
|
68
|
-
const values = model.convertValueKeyFromStorage({
|
|
69
|
-
fields: model.fields,
|
|
70
|
-
values: entry.values
|
|
71
|
-
});
|
|
72
|
-
return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, entry), {}, {
|
|
73
|
-
values
|
|
74
|
-
});
|
|
75
|
-
};
|
|
25
|
+
var _transformations = require("./transformations");
|
|
26
|
+
var _convertEntryKeys = require("./transformations/convertEntryKeys");
|
|
76
27
|
const createEntriesStorageOperations = params => {
|
|
77
28
|
const {
|
|
78
29
|
entity,
|
|
@@ -103,31 +54,24 @@ const createEntriesStorageOperations = params => {
|
|
|
103
54
|
const model = getStorageOperationsModel(initialModel);
|
|
104
55
|
const isPublished = initialEntry.status === "published";
|
|
105
56
|
const locked = isPublished ? true : initialEntry.locked;
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
});
|
|
110
|
-
const storageEntry = convertEntryKeysToStorage({
|
|
111
|
-
model,
|
|
112
|
-
entry: initialStorageEntry
|
|
113
|
-
});
|
|
114
|
-
const esEntry = (0, _helpers.prepareEntryToIndex)({
|
|
57
|
+
initialEntry.locked = locked;
|
|
58
|
+
initialStorageEntry.locked = locked;
|
|
59
|
+
const transformer = (0, _transformations.createTransformer)({
|
|
115
60
|
plugins,
|
|
116
61
|
model,
|
|
117
|
-
entry:
|
|
118
|
-
|
|
119
|
-
})),
|
|
120
|
-
storageEntry: (0, _cloneDeep.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({}, storageEntry), {}, {
|
|
121
|
-
locked
|
|
122
|
-
}))
|
|
62
|
+
entry: initialEntry,
|
|
63
|
+
storageEntry: initialStorageEntry
|
|
123
64
|
});
|
|
65
|
+
const {
|
|
66
|
+
entry,
|
|
67
|
+
storageEntry
|
|
68
|
+
} = transformer.transformEntryKeys();
|
|
69
|
+
const esEntry = transformer.transformToIndex();
|
|
124
70
|
const {
|
|
125
71
|
index: esIndex
|
|
126
72
|
} = _configurations.configurations.es({
|
|
127
73
|
model
|
|
128
74
|
});
|
|
129
|
-
const esLatestData = await getESLatestEntryData(plugins, esEntry);
|
|
130
|
-
const esPublishedData = await getESPublishedEntryData(plugins, esEntry);
|
|
131
75
|
const revisionKeys = {
|
|
132
76
|
PK: (0, _keys.createPartitionKey)({
|
|
133
77
|
id: entry.id,
|
|
@@ -183,11 +127,13 @@ const createEntriesStorageOperations = params => {
|
|
|
183
127
|
storageEntry
|
|
184
128
|
});
|
|
185
129
|
}
|
|
130
|
+
const esLatestData = await transformer.getElasticsearchLatestEntryData();
|
|
186
131
|
const esItems = [esEntity.putBatch((0, _objectSpread2.default)((0, _objectSpread2.default)({}, latestKeys), {}, {
|
|
187
132
|
index: esIndex,
|
|
188
133
|
data: esLatestData
|
|
189
134
|
}))];
|
|
190
135
|
if (isPublished) {
|
|
136
|
+
const esPublishedData = await transformer.getElasticsearchPublishedEntryData();
|
|
191
137
|
esItems.push(esEntity.putBatch((0, _objectSpread2.default)((0, _objectSpread2.default)({}, publishedKeys), {}, {
|
|
192
138
|
index: esIndex,
|
|
193
139
|
data: esPublishedData
|
|
@@ -213,14 +159,16 @@ const createEntriesStorageOperations = params => {
|
|
|
213
159
|
storageEntry: initialStorageEntry
|
|
214
160
|
} = params;
|
|
215
161
|
const model = getStorageOperationsModel(initialModel);
|
|
216
|
-
const
|
|
217
|
-
|
|
218
|
-
entry: initialEntry
|
|
219
|
-
});
|
|
220
|
-
const storageEntry = convertEntryKeysToStorage({
|
|
162
|
+
const transformer = (0, _transformations.createTransformer)({
|
|
163
|
+
plugins,
|
|
221
164
|
model,
|
|
222
|
-
entry:
|
|
165
|
+
entry: initialEntry,
|
|
166
|
+
storageEntry: initialStorageEntry
|
|
223
167
|
});
|
|
168
|
+
const {
|
|
169
|
+
entry,
|
|
170
|
+
storageEntry
|
|
171
|
+
} = transformer.transformEntryKeys();
|
|
224
172
|
const revisionKeys = {
|
|
225
173
|
PK: (0, _keys.createPartitionKey)({
|
|
226
174
|
id: entry.id,
|
|
@@ -237,13 +185,7 @@ const createEntriesStorageOperations = params => {
|
|
|
237
185
|
}),
|
|
238
186
|
SK: (0, _keys.createLatestSortKey)()
|
|
239
187
|
};
|
|
240
|
-
const
|
|
241
|
-
plugins,
|
|
242
|
-
model,
|
|
243
|
-
entry: (0, _cloneDeep.default)(entry),
|
|
244
|
-
storageEntry: (0, _cloneDeep.default)(storageEntry)
|
|
245
|
-
});
|
|
246
|
-
const esLatestData = await getESLatestEntryData(plugins, esEntry);
|
|
188
|
+
const esLatestData = await transformer.getElasticsearchLatestEntryData();
|
|
247
189
|
const items = [entity.putBatch((0, _objectSpread2.default)((0, _objectSpread2.default)({}, storageEntry), {}, {
|
|
248
190
|
TYPE: (0, _recordType.createRecordType)()
|
|
249
191
|
}, revisionKeys)), entity.putBatch((0, _objectSpread2.default)((0, _objectSpread2.default)({}, storageEntry), {}, {
|
|
@@ -294,14 +236,16 @@ const createEntriesStorageOperations = params => {
|
|
|
294
236
|
storageEntry: initialStorageEntry
|
|
295
237
|
} = params;
|
|
296
238
|
const model = getStorageOperationsModel(initialModel);
|
|
297
|
-
const
|
|
298
|
-
|
|
299
|
-
entry: initialEntry
|
|
300
|
-
});
|
|
301
|
-
const storageEntry = convertEntryKeysToStorage({
|
|
239
|
+
const transformer = (0, _transformations.createTransformer)({
|
|
240
|
+
plugins,
|
|
302
241
|
model,
|
|
303
|
-
entry:
|
|
242
|
+
entry: initialEntry,
|
|
243
|
+
storageEntry: initialStorageEntry
|
|
304
244
|
});
|
|
245
|
+
const {
|
|
246
|
+
entry,
|
|
247
|
+
storageEntry
|
|
248
|
+
} = transformer.transformEntryKeys();
|
|
305
249
|
const isPublished = entry.status === "published";
|
|
306
250
|
const locked = isPublished ? true : entry.locked;
|
|
307
251
|
const revisionKeys = {
|
|
@@ -358,14 +302,9 @@ const createEntriesStorageOperations = params => {
|
|
|
358
302
|
} = _configurations.configurations.es({
|
|
359
303
|
model
|
|
360
304
|
});
|
|
361
|
-
/**
|
|
362
|
-
* Variable for the elasticsearch entry so we do not convert it more than once
|
|
363
|
-
*/
|
|
364
|
-
let esEntry = undefined;
|
|
365
305
|
/**
|
|
366
306
|
* If the latest entry is the one being updated, we need to create a new latest entry records.
|
|
367
307
|
*/
|
|
368
|
-
let elasticsearchLatestData = null;
|
|
369
308
|
if ((latestStorageEntry === null || latestStorageEntry === void 0 ? void 0 : latestStorageEntry.id) === entry.id) {
|
|
370
309
|
/**
|
|
371
310
|
* First we update the regular DynamoDB table
|
|
@@ -376,49 +315,14 @@ const createEntriesStorageOperations = params => {
|
|
|
376
315
|
/**
|
|
377
316
|
* And then update the Elasticsearch table to propagate changes to the Elasticsearch
|
|
378
317
|
*/
|
|
379
|
-
|
|
380
|
-
plugins,
|
|
381
|
-
model,
|
|
382
|
-
entry: (0, _cloneDeep.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({}, entry), {}, {
|
|
383
|
-
locked
|
|
384
|
-
})),
|
|
385
|
-
storageEntry: (0, _cloneDeep.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({}, storageEntry), {}, {
|
|
386
|
-
locked
|
|
387
|
-
}))
|
|
388
|
-
});
|
|
389
|
-
elasticsearchLatestData = await getESLatestEntryData(plugins, esEntry);
|
|
318
|
+
const elasticsearchLatestData = await transformer.getElasticsearchLatestEntryData();
|
|
390
319
|
esItems.push(esEntity.putBatch((0, _objectSpread2.default)((0, _objectSpread2.default)({}, latestKeys), {}, {
|
|
391
320
|
index: esIndex,
|
|
392
321
|
data: elasticsearchLatestData
|
|
393
322
|
})));
|
|
394
323
|
}
|
|
395
|
-
let elasticsearchPublishedData = null;
|
|
396
324
|
if (isPublished && (publishedStorageEntry === null || publishedStorageEntry === void 0 ? void 0 : publishedStorageEntry.id) === entry.id) {
|
|
397
|
-
|
|
398
|
-
/**
|
|
399
|
-
* And then update the Elasticsearch table to propagate changes to the Elasticsearch
|
|
400
|
-
*/
|
|
401
|
-
if (!esEntry) {
|
|
402
|
-
esEntry = (0, _helpers.prepareEntryToIndex)({
|
|
403
|
-
plugins,
|
|
404
|
-
model,
|
|
405
|
-
entry: (0, _cloneDeep.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({}, entry), {}, {
|
|
406
|
-
locked
|
|
407
|
-
})),
|
|
408
|
-
storageEntry: (0, _cloneDeep.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({}, storageEntry), {}, {
|
|
409
|
-
locked
|
|
410
|
-
}))
|
|
411
|
-
});
|
|
412
|
-
}
|
|
413
|
-
elasticsearchPublishedData = await getESPublishedEntryData(plugins, esEntry);
|
|
414
|
-
} else {
|
|
415
|
-
elasticsearchPublishedData = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, elasticsearchLatestData), {}, {
|
|
416
|
-
published: true,
|
|
417
|
-
TYPE: (0, _recordType.createPublishedRecordType)(),
|
|
418
|
-
__type: (0, _recordType.createPublishedRecordType)()
|
|
419
|
-
});
|
|
420
|
-
delete elasticsearchPublishedData.latest;
|
|
421
|
-
}
|
|
325
|
+
const elasticsearchPublishedData = await transformer.getElasticsearchPublishedEntryData();
|
|
422
326
|
esItems.push(esEntity.putBatch((0, _objectSpread2.default)((0, _objectSpread2.default)({}, publishedKeys), {}, {
|
|
423
327
|
index: esIndex,
|
|
424
328
|
data: elasticsearchPublishedData
|
|
@@ -678,13 +582,13 @@ const createEntriesStorageOperations = params => {
|
|
|
678
582
|
}));
|
|
679
583
|
}
|
|
680
584
|
if (latestEntry && latestStorageEntry) {
|
|
681
|
-
const
|
|
585
|
+
const latestTransformer = (0, _transformations.createTransformer)({
|
|
682
586
|
plugins,
|
|
683
587
|
model,
|
|
684
|
-
entry:
|
|
685
|
-
storageEntry:
|
|
588
|
+
entry: latestEntry,
|
|
589
|
+
storageEntry: latestStorageEntry
|
|
686
590
|
});
|
|
687
|
-
const esLatestData = await
|
|
591
|
+
const esLatestData = await latestTransformer.getElasticsearchLatestEntryData();
|
|
688
592
|
/**
|
|
689
593
|
* In the end we need to set the new latest entry
|
|
690
594
|
*/
|
|
@@ -872,7 +776,7 @@ const createEntriesStorageOperations = params => {
|
|
|
872
776
|
model,
|
|
873
777
|
entries: hits.map(item => item._source)
|
|
874
778
|
}).map(item => {
|
|
875
|
-
return convertEntryKeysFromStorage({
|
|
779
|
+
return (0, _convertEntryKeys.convertEntryKeysFromStorage)({
|
|
876
780
|
model,
|
|
877
781
|
entry: item
|
|
878
782
|
});
|
|
@@ -911,14 +815,16 @@ const createEntriesStorageOperations = params => {
|
|
|
911
815
|
storageEntry: initialStorageEntry
|
|
912
816
|
} = params;
|
|
913
817
|
const model = getStorageOperationsModel(initialModel);
|
|
914
|
-
const
|
|
915
|
-
|
|
916
|
-
entry: initialEntry
|
|
917
|
-
});
|
|
918
|
-
const storageEntry = convertEntryKeysToStorage({
|
|
818
|
+
const transformer = (0, _transformations.createTransformer)({
|
|
819
|
+
plugins,
|
|
919
820
|
model,
|
|
920
|
-
entry:
|
|
821
|
+
entry: initialEntry,
|
|
822
|
+
storageEntry: initialStorageEntry
|
|
921
823
|
});
|
|
824
|
+
const {
|
|
825
|
+
entry,
|
|
826
|
+
storageEntry
|
|
827
|
+
} = transformer.transformEntryKeys();
|
|
922
828
|
|
|
923
829
|
/**
|
|
924
830
|
* We need currently published entry to check if need to remove it.
|
|
@@ -1024,28 +930,28 @@ const createEntriesStorageOperations = params => {
|
|
|
1024
930
|
* No need to transform it for the storage because it was fetched directly from the Elasticsearch table, where it sits transformed.
|
|
1025
931
|
*/
|
|
1026
932
|
const latestEsEntryDataDecompressed = await (0, _apiElasticsearch.decompress)(plugins, latestEsEntry.data);
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
data: await getESLatestEntryData(plugins, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, latestEsEntryDataDecompressed), {}, {
|
|
933
|
+
const latestTransformer = (0, _transformations.createTransformer)({
|
|
934
|
+
plugins,
|
|
935
|
+
model,
|
|
936
|
+
transformedToIndex: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, latestEsEntryDataDecompressed), {}, {
|
|
1032
937
|
status: _types.CONTENT_ENTRY_STATUS.PUBLISHED,
|
|
1033
938
|
locked: true,
|
|
1034
939
|
savedOn: entry.savedOn,
|
|
1035
940
|
publishedOn: entry.publishedOn
|
|
1036
|
-
})
|
|
941
|
+
})
|
|
942
|
+
});
|
|
943
|
+
esItems.push(esEntity.putBatch({
|
|
944
|
+
index,
|
|
945
|
+
PK: (0, _keys.createPartitionKey)(latestEsEntryDataDecompressed),
|
|
946
|
+
SK: (0, _keys.createLatestSortKey)(),
|
|
947
|
+
data: await latestTransformer.getElasticsearchLatestEntryData()
|
|
1037
948
|
}));
|
|
1038
949
|
}
|
|
1039
|
-
|
|
1040
|
-
plugins,
|
|
1041
|
-
model,
|
|
1042
|
-
entry: (0, _cloneDeep.default)(entry),
|
|
1043
|
-
storageEntry: (0, _cloneDeep.default)(storageEntry)
|
|
1044
|
-
});
|
|
950
|
+
|
|
1045
951
|
/**
|
|
1046
952
|
* Update the published revision entry in ES.
|
|
1047
953
|
*/
|
|
1048
|
-
const esPublishedData = await
|
|
954
|
+
const esPublishedData = await transformer.getElasticsearchPublishedEntryData();
|
|
1049
955
|
esItems.push(esEntity.putBatch((0, _objectSpread2.default)((0, _objectSpread2.default)({}, publishedKeys), {}, {
|
|
1050
956
|
index,
|
|
1051
957
|
data: esPublishedData
|
|
@@ -1094,14 +1000,16 @@ const createEntriesStorageOperations = params => {
|
|
|
1094
1000
|
storageEntry: initialStorageEntry
|
|
1095
1001
|
} = params;
|
|
1096
1002
|
const model = getStorageOperationsModel(initialModel);
|
|
1097
|
-
const
|
|
1098
|
-
|
|
1099
|
-
entry: initialEntry
|
|
1100
|
-
});
|
|
1101
|
-
const storageEntry = convertEntryKeysToStorage({
|
|
1003
|
+
const transformer = (0, _transformations.createTransformer)({
|
|
1004
|
+
plugins,
|
|
1102
1005
|
model,
|
|
1103
|
-
entry:
|
|
1006
|
+
entry: initialEntry,
|
|
1007
|
+
storageEntry: initialStorageEntry
|
|
1104
1008
|
});
|
|
1009
|
+
const {
|
|
1010
|
+
entry,
|
|
1011
|
+
storageEntry
|
|
1012
|
+
} = await transformer.transformEntryKeys();
|
|
1105
1013
|
|
|
1106
1014
|
/**
|
|
1107
1015
|
* We need the latest entry to check if it needs to be updated.
|
|
@@ -1136,13 +1044,7 @@ const createEntriesStorageOperations = params => {
|
|
|
1136
1044
|
} = _configurations.configurations.es({
|
|
1137
1045
|
model
|
|
1138
1046
|
});
|
|
1139
|
-
const
|
|
1140
|
-
plugins,
|
|
1141
|
-
model,
|
|
1142
|
-
entry: (0, _cloneDeep.default)(entry),
|
|
1143
|
-
storageEntry: (0, _cloneDeep.default)(storageEntry)
|
|
1144
|
-
});
|
|
1145
|
-
const esLatestData = await getESLatestEntryData(plugins, preparedEntryData);
|
|
1047
|
+
const esLatestData = await transformer.getElasticsearchLatestEntryData();
|
|
1146
1048
|
esItems.push(esEntity.putBatch({
|
|
1147
1049
|
PK: partitionKey,
|
|
1148
1050
|
SK: (0, _keys.createLatestSortKey)(),
|
|
@@ -1193,7 +1095,7 @@ const createEntriesStorageOperations = params => {
|
|
|
1193
1095
|
if (!entry) {
|
|
1194
1096
|
return null;
|
|
1195
1097
|
}
|
|
1196
|
-
return convertEntryKeysFromStorage({
|
|
1098
|
+
return (0, _convertEntryKeys.convertEntryKeysFromStorage)({
|
|
1197
1099
|
model,
|
|
1198
1100
|
entry
|
|
1199
1101
|
});
|
|
@@ -1207,7 +1109,7 @@ const createEntriesStorageOperations = params => {
|
|
|
1207
1109
|
if (!entry) {
|
|
1208
1110
|
return null;
|
|
1209
1111
|
}
|
|
1210
|
-
return convertEntryKeysFromStorage({
|
|
1112
|
+
return (0, _convertEntryKeys.convertEntryKeysFromStorage)({
|
|
1211
1113
|
model,
|
|
1212
1114
|
entry
|
|
1213
1115
|
});
|
|
@@ -1221,7 +1123,7 @@ const createEntriesStorageOperations = params => {
|
|
|
1221
1123
|
if (!entry) {
|
|
1222
1124
|
return null;
|
|
1223
1125
|
}
|
|
1224
|
-
return convertEntryKeysFromStorage({
|
|
1126
|
+
return (0, _convertEntryKeys.convertEntryKeysFromStorage)({
|
|
1225
1127
|
model,
|
|
1226
1128
|
entry
|
|
1227
1129
|
});
|
|
@@ -1233,7 +1135,7 @@ const createEntriesStorageOperations = params => {
|
|
|
1233
1135
|
ids: [params.id]
|
|
1234
1136
|
});
|
|
1235
1137
|
return entries.map(entry => {
|
|
1236
|
-
return convertEntryKeysFromStorage({
|
|
1138
|
+
return (0, _convertEntryKeys.convertEntryKeysFromStorage)({
|
|
1237
1139
|
model,
|
|
1238
1140
|
entry
|
|
1239
1141
|
});
|
|
@@ -1246,7 +1148,7 @@ const createEntriesStorageOperations = params => {
|
|
|
1246
1148
|
ids: params.ids
|
|
1247
1149
|
});
|
|
1248
1150
|
return entries.map(entry => {
|
|
1249
|
-
return convertEntryKeysFromStorage({
|
|
1151
|
+
return (0, _convertEntryKeys.convertEntryKeysFromStorage)({
|
|
1250
1152
|
model,
|
|
1251
1153
|
entry
|
|
1252
1154
|
});
|
|
@@ -1259,7 +1161,7 @@ const createEntriesStorageOperations = params => {
|
|
|
1259
1161
|
ids: params.ids
|
|
1260
1162
|
});
|
|
1261
1163
|
return entries.map(entry => {
|
|
1262
|
-
return convertEntryKeysFromStorage({
|
|
1164
|
+
return (0, _convertEntryKeys.convertEntryKeysFromStorage)({
|
|
1263
1165
|
model,
|
|
1264
1166
|
entry
|
|
1265
1167
|
});
|
|
@@ -1272,7 +1174,7 @@ const createEntriesStorageOperations = params => {
|
|
|
1272
1174
|
ids: params.ids
|
|
1273
1175
|
});
|
|
1274
1176
|
return entries.map(entry => {
|
|
1275
|
-
return convertEntryKeysFromStorage({
|
|
1177
|
+
return (0, _convertEntryKeys.convertEntryKeysFromStorage)({
|
|
1276
1178
|
model,
|
|
1277
1179
|
entry
|
|
1278
1180
|
});
|
|
@@ -1316,7 +1218,7 @@ const createEntriesStorageOperations = params => {
|
|
|
1316
1218
|
if (!entry) {
|
|
1317
1219
|
return null;
|
|
1318
1220
|
}
|
|
1319
|
-
return convertEntryKeysFromStorage({
|
|
1221
|
+
return (0, _convertEntryKeys.convertEntryKeysFromStorage)({
|
|
1320
1222
|
entry,
|
|
1321
1223
|
model
|
|
1322
1224
|
});
|
|
@@ -1427,4 +1329,6 @@ const createEntriesStorageOperations = params => {
|
|
|
1427
1329
|
dataLoaders
|
|
1428
1330
|
};
|
|
1429
1331
|
};
|
|
1430
|
-
exports.createEntriesStorageOperations = createEntriesStorageOperations;
|
|
1332
|
+
exports.createEntriesStorageOperations = createEntriesStorageOperations;
|
|
1333
|
+
|
|
1334
|
+
//# sourceMappingURL=index.js.map
|