@webiny/api-page-builder-so-ddb-es 5.39.0-beta.0 → 5.39.0-beta.2
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/definitions/blockCategoryEntity.d.ts +2 -2
- package/definitions/blockCategoryEntity.js +6 -7
- package/definitions/blockCategoryEntity.js.map +1 -1
- package/definitions/categoryEntity.d.ts +2 -2
- package/definitions/categoryEntity.js +6 -7
- package/definitions/categoryEntity.js.map +1 -1
- package/definitions/menuEntity.d.ts +2 -2
- package/definitions/menuEntity.js +6 -7
- package/definitions/menuEntity.js.map +1 -1
- package/definitions/pageBlockEntity.d.ts +2 -2
- package/definitions/pageBlockEntity.js +6 -7
- package/definitions/pageBlockEntity.js.map +1 -1
- package/definitions/pageElasticsearchEntity.d.ts +2 -2
- package/definitions/pageElasticsearchEntity.js +6 -7
- package/definitions/pageElasticsearchEntity.js.map +1 -1
- package/definitions/pageElementEntity.d.ts +2 -2
- package/definitions/pageElementEntity.js +6 -7
- package/definitions/pageElementEntity.js.map +1 -1
- package/definitions/pageEntity.d.ts +2 -2
- package/definitions/pageEntity.js +6 -7
- package/definitions/pageEntity.js.map +1 -1
- package/definitions/pageTemplateEntity.d.ts +2 -2
- package/definitions/pageTemplateEntity.js +6 -7
- package/definitions/pageTemplateEntity.js.map +1 -1
- package/definitions/settingsEntity.d.ts +2 -2
- package/definitions/settingsEntity.js +2 -2
- package/definitions/settingsEntity.js.map +1 -1
- package/definitions/systemEntity.d.ts +2 -2
- package/definitions/systemEntity.js +6 -7
- package/definitions/systemEntity.js.map +1 -1
- package/definitions/table.d.ts +4 -4
- package/definitions/table.js +5 -3
- package/definitions/table.js.map +1 -1
- package/definitions/tableElasticsearch.d.ts +4 -4
- package/definitions/tableElasticsearch.js +5 -3
- package/definitions/tableElasticsearch.js.map +1 -1
- package/operations/blockCategory/dataLoader.d.ts +1 -1
- package/operations/blockCategory/dataLoader.js +1 -3
- package/operations/blockCategory/dataLoader.js.map +1 -1
- package/operations/blockCategory/index.d.ts +1 -1
- package/operations/blockCategory/index.js +25 -14
- package/operations/blockCategory/index.js.map +1 -1
- package/operations/category/dataLoader.d.ts +1 -1
- package/operations/category/dataLoader.js +1 -3
- package/operations/category/dataLoader.js.map +1 -1
- package/operations/category/index.d.ts +1 -1
- package/operations/category/index.js +25 -14
- package/operations/category/index.js.map +1 -1
- package/operations/menu/index.d.ts +1 -1
- package/operations/menu/index.js +29 -19
- package/operations/menu/index.js.map +1 -1
- package/operations/pageBlock/compression.js +6 -6
- package/operations/pageBlock/compression.js.map +1 -1
- package/operations/pageBlock/dataLoader.d.ts +1 -1
- package/operations/pageBlock/dataLoader.js +1 -3
- package/operations/pageBlock/dataLoader.js.map +1 -1
- package/operations/pageBlock/index.d.ts +1 -1
- package/operations/pageBlock/index.js +28 -19
- package/operations/pageBlock/index.js.map +1 -1
- package/operations/pageElement/index.d.ts +1 -1
- package/operations/pageElement/index.js +29 -19
- package/operations/pageElement/index.js.map +1 -1
- package/operations/pageTemplate/dataLoader.d.ts +1 -1
- package/operations/pageTemplate/dataLoader.js +1 -3
- package/operations/pageTemplate/dataLoader.js.map +1 -1
- package/operations/pageTemplate/index.d.ts +1 -1
- package/operations/pageTemplate/index.js +27 -20
- package/operations/pageTemplate/index.js.map +1 -1
- package/operations/pages/elasticsearchQueryBody.js +9 -10
- package/operations/pages/elasticsearchQueryBody.js.map +1 -1
- package/operations/pages/helpers.js +6 -5
- package/operations/pages/helpers.js.map +1 -1
- package/operations/pages/index.d.ts +1 -1
- package/operations/pages/index.js +116 -71
- package/operations/pages/index.js.map +1 -1
- package/operations/settings/index.d.ts +8 -2
- package/operations/settings/index.js +26 -19
- package/operations/settings/index.js.map +1 -1
- package/operations/system/index.d.ts +1 -1
- package/operations/system/index.js +19 -9
- package/operations/system/index.js.map +1 -1
- package/package.json +33 -30
- package/plugins/definitions/BlockCategoryDynamoDbElasticFieldPlugin.js +3 -4
- package/plugins/definitions/BlockCategoryDynamoDbElasticFieldPlugin.js.map +1 -1
- package/plugins/definitions/CategoryDynamoDbElasticFieldPlugin.js +3 -4
- package/plugins/definitions/CategoryDynamoDbElasticFieldPlugin.js.map +1 -1
- package/plugins/definitions/IndexPageDataPlugin.js +1 -4
- package/plugins/definitions/IndexPageDataPlugin.js.map +1 -1
- package/plugins/definitions/MenuDynamoDbElasticFieldPlugin.js +3 -4
- package/plugins/definitions/MenuDynamoDbElasticFieldPlugin.js.map +1 -1
- package/plugins/definitions/PageBlockDynamoDbFieldPlugin.js +3 -4
- package/plugins/definitions/PageBlockDynamoDbFieldPlugin.js.map +1 -1
- package/plugins/definitions/PageDynamoDbElasticsearchFieldPlugin.js +3 -4
- package/plugins/definitions/PageDynamoDbElasticsearchFieldPlugin.js.map +1 -1
- package/plugins/definitions/PageElasticsearchBodyModifierPlugin.js +3 -4
- package/plugins/definitions/PageElasticsearchBodyModifierPlugin.js.map +1 -1
- package/plugins/definitions/PageElasticsearchFieldPlugin.js +3 -4
- package/plugins/definitions/PageElasticsearchFieldPlugin.js.map +1 -1
- package/plugins/definitions/PageElasticsearchIndexPlugin.js +3 -4
- package/plugins/definitions/PageElasticsearchIndexPlugin.js.map +1 -1
- package/plugins/definitions/PageElasticsearchQueryModifierPlugin.js +3 -4
- package/plugins/definitions/PageElasticsearchQueryModifierPlugin.js.map +1 -1
- package/plugins/definitions/PageElasticsearchSortModifierPlugin.js +3 -4
- package/plugins/definitions/PageElasticsearchSortModifierPlugin.js.map +1 -1
- package/plugins/definitions/PageElementDynamoDbElasticFieldPlugin.js +3 -4
- package/plugins/definitions/PageElementDynamoDbElasticFieldPlugin.js.map +1 -1
- package/plugins/definitions/PageTemplateDynamoDbElasticFieldPlugin.js +3 -4
- package/plugins/definitions/PageTemplateDynamoDbElasticFieldPlugin.js.map +1 -1
- package/plugins/definitions/SearchLatestPagesPlugin.js +3 -4
- package/plugins/definitions/SearchLatestPagesPlugin.js.map +1 -1
- package/plugins/definitions/SearchPagesPlugin.js +0 -3
- package/plugins/definitions/SearchPagesPlugin.js.map +1 -1
- package/plugins/definitions/SearchPublishedPagesPlugin.js +3 -4
- package/plugins/definitions/SearchPublishedPagesPlugin.js.map +1 -1
- package/types.d.ts +8 -9
- package/types.js.map +1 -1
|
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.createPageStorageOperations = void 0;
|
|
8
|
-
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
9
8
|
var _omit = _interopRequireDefault(require("lodash/omit"));
|
|
10
9
|
var _error = _interopRequireDefault(require("@webiny/error"));
|
|
11
10
|
var _cleanup = require("@webiny/db-dynamodb/utils/cleanup");
|
|
@@ -20,6 +19,7 @@ var _helpers = require("./helpers");
|
|
|
20
19
|
var _keys = require("./keys");
|
|
21
20
|
var _sort = require("@webiny/db-dynamodb/utils/sort");
|
|
22
21
|
var _PageDynamoDbElasticsearchFieldPlugin = require("../../plugins/definitions/PageDynamoDbElasticsearchFieldPlugin");
|
|
22
|
+
var _dbDynamodb = require("@webiny/db-dynamodb");
|
|
23
23
|
/**
|
|
24
24
|
* This function removes attributes that were once present in the Page record, which we no longer need.
|
|
25
25
|
*/
|
|
@@ -42,24 +42,33 @@ const createPageStorageOperations = params => {
|
|
|
42
42
|
PK: (0, _keys.createPartitionKey)(page),
|
|
43
43
|
SK: (0, _keys.createSortKey)(page)
|
|
44
44
|
};
|
|
45
|
-
const latestKeys =
|
|
45
|
+
const latestKeys = {
|
|
46
|
+
...versionKeys,
|
|
46
47
|
SK: (0, _keys.createLatestSortKey)()
|
|
47
|
-
}
|
|
48
|
-
const items = [entity.putBatch(
|
|
48
|
+
};
|
|
49
|
+
const items = [entity.putBatch({
|
|
50
|
+
...page,
|
|
51
|
+
...versionKeys,
|
|
49
52
|
TYPE: (0, _keys.createBasicType)()
|
|
50
|
-
})
|
|
53
|
+
}), entity.putBatch({
|
|
54
|
+
...page,
|
|
55
|
+
...latestKeys,
|
|
51
56
|
TYPE: (0, _keys.createLatestType)()
|
|
52
|
-
})
|
|
57
|
+
})];
|
|
53
58
|
const esData = (0, _helpers.getESLatestPageData)(plugins, page, input);
|
|
54
59
|
try {
|
|
55
60
|
await (0, _batchWrite.batchWriteAll)({
|
|
56
61
|
table: entity.table,
|
|
57
62
|
items: items
|
|
58
63
|
});
|
|
59
|
-
await
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
64
|
+
await (0, _dbDynamodb.put)({
|
|
65
|
+
entity: esEntity,
|
|
66
|
+
item: {
|
|
67
|
+
index: _configurations.configurations.es(page).index,
|
|
68
|
+
data: esData,
|
|
69
|
+
...latestKeys
|
|
70
|
+
}
|
|
71
|
+
});
|
|
63
72
|
return page;
|
|
64
73
|
} catch (ex) {
|
|
65
74
|
throw new _error.default(ex.message || "Could not create new page.", ex.code || "CREATE_PAGE_ERROR", {
|
|
@@ -79,24 +88,33 @@ const createPageStorageOperations = params => {
|
|
|
79
88
|
PK: (0, _keys.createPartitionKey)(page),
|
|
80
89
|
SK: (0, _keys.createSortKey)(page)
|
|
81
90
|
};
|
|
82
|
-
const latestKeys =
|
|
91
|
+
const latestKeys = {
|
|
92
|
+
...versionKeys,
|
|
83
93
|
SK: (0, _keys.createLatestSortKey)()
|
|
84
|
-
}
|
|
85
|
-
const items = [entity.putBatch(
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
},
|
|
94
|
+
};
|
|
95
|
+
const items = [entity.putBatch({
|
|
96
|
+
...page,
|
|
97
|
+
TYPE: (0, _keys.createBasicType)(),
|
|
98
|
+
...versionKeys
|
|
99
|
+
}), entity.putBatch({
|
|
100
|
+
...page,
|
|
101
|
+
TYPE: (0, _keys.createLatestType)(),
|
|
102
|
+
...latestKeys
|
|
103
|
+
})];
|
|
90
104
|
const esData = (0, _helpers.getESLatestPageData)(plugins, page);
|
|
91
105
|
try {
|
|
92
106
|
await (0, _batchWrite.batchWriteAll)({
|
|
93
107
|
table: entity.table,
|
|
94
108
|
items
|
|
95
109
|
});
|
|
96
|
-
await
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
110
|
+
await (0, _dbDynamodb.put)({
|
|
111
|
+
entity: esEntity,
|
|
112
|
+
item: {
|
|
113
|
+
index: _configurations.configurations.es(page).index,
|
|
114
|
+
data: esData,
|
|
115
|
+
...latestKeys
|
|
116
|
+
}
|
|
117
|
+
});
|
|
100
118
|
return page;
|
|
101
119
|
} catch (ex) {
|
|
102
120
|
throw new _error.default(ex.message || "Could not create new page from existing page.", ex.code || "CREATE_PAGE_FROM_ERROR", {
|
|
@@ -118,22 +136,29 @@ const createPageStorageOperations = params => {
|
|
|
118
136
|
PK: (0, _keys.createPartitionKey)(page),
|
|
119
137
|
SK: (0, _keys.createSortKey)(page)
|
|
120
138
|
};
|
|
121
|
-
const latestKeys =
|
|
139
|
+
const latestKeys = {
|
|
140
|
+
...keys,
|
|
122
141
|
SK: (0, _keys.createLatestSortKey)()
|
|
142
|
+
};
|
|
143
|
+
const latestPage = await (0, _dbDynamodb.getClean)({
|
|
144
|
+
entity,
|
|
145
|
+
keys: latestKeys
|
|
123
146
|
});
|
|
124
|
-
const
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
}
|
|
147
|
+
const items = [entity.putBatch({
|
|
148
|
+
...page,
|
|
149
|
+
TYPE: (0, _keys.createBasicType)(),
|
|
150
|
+
...keys
|
|
151
|
+
})];
|
|
129
152
|
const esData = (0, _helpers.getESLatestPageData)(plugins, page, input);
|
|
130
|
-
if (latestPage && latestPage
|
|
153
|
+
if (latestPage && latestPage?.id === page.id) {
|
|
131
154
|
/**
|
|
132
155
|
* We also update the regular record.
|
|
133
156
|
*/
|
|
134
|
-
items.push(entity.putBatch(
|
|
135
|
-
|
|
136
|
-
|
|
157
|
+
items.push(entity.putBatch({
|
|
158
|
+
...page,
|
|
159
|
+
TYPE: (0, _keys.createLatestType)(),
|
|
160
|
+
...latestKeys
|
|
161
|
+
}));
|
|
137
162
|
}
|
|
138
163
|
/**
|
|
139
164
|
* Unfortunately we cannot push regular and es record in the batch write because they are two separate tables.
|
|
@@ -143,10 +168,14 @@ const createPageStorageOperations = params => {
|
|
|
143
168
|
table: entity.table,
|
|
144
169
|
items
|
|
145
170
|
});
|
|
146
|
-
await
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
171
|
+
await (0, _dbDynamodb.put)({
|
|
172
|
+
entity: esEntity,
|
|
173
|
+
item: {
|
|
174
|
+
index: _configurations.configurations.es(page).index,
|
|
175
|
+
data: esData,
|
|
176
|
+
...latestKeys
|
|
177
|
+
}
|
|
178
|
+
});
|
|
150
179
|
return page;
|
|
151
180
|
} catch (ex) {
|
|
152
181
|
throw new _error.default(ex.message || "Could not update existing page.", ex.code || "UPDATE_PAGE_ERROR", {
|
|
@@ -203,11 +232,12 @@ const createPageStorageOperations = params => {
|
|
|
203
232
|
}
|
|
204
233
|
});
|
|
205
234
|
if (previousLatestRecord) {
|
|
206
|
-
items.push(entity.putBatch(
|
|
235
|
+
items.push(entity.putBatch({
|
|
236
|
+
...previousLatestRecord,
|
|
207
237
|
TYPE: (0, _keys.createLatestType)(),
|
|
208
238
|
PK: partitionKey,
|
|
209
239
|
SK: (0, _keys.createLatestSortKey)()
|
|
210
|
-
}))
|
|
240
|
+
}));
|
|
211
241
|
esItems.push(esEntity.putBatch({
|
|
212
242
|
PK: partitionKey,
|
|
213
243
|
SK: (0, _keys.createLatestSortKey)(),
|
|
@@ -330,22 +360,24 @@ const createPageStorageOperations = params => {
|
|
|
330
360
|
/**
|
|
331
361
|
* Update the given revision of the page.
|
|
332
362
|
*/
|
|
333
|
-
const items = [entity.putBatch(
|
|
363
|
+
const items = [entity.putBatch({
|
|
364
|
+
...page,
|
|
334
365
|
TYPE: (0, _keys.createBasicType)(),
|
|
335
366
|
PK: (0, _keys.createPartitionKey)(page),
|
|
336
367
|
SK: (0, _keys.createSortKey)(page)
|
|
337
|
-
})
|
|
368
|
+
})];
|
|
338
369
|
const esItems = [];
|
|
339
370
|
/**
|
|
340
371
|
* If we are publishing the latest revision, update the latest revision
|
|
341
372
|
* status in ES. We also need to update the latest page revision entry in ES.
|
|
342
373
|
*/
|
|
343
374
|
if (latestPage.id === page.id) {
|
|
344
|
-
items.push(entity.putBatch(
|
|
375
|
+
items.push(entity.putBatch({
|
|
376
|
+
...page,
|
|
345
377
|
TYPE: (0, _keys.createLatestType)(),
|
|
346
378
|
PK: (0, _keys.createPartitionKey)(page),
|
|
347
379
|
SK: (0, _keys.createLatestSortKey)()
|
|
348
|
-
}))
|
|
380
|
+
}));
|
|
349
381
|
esItems.push(esEntity.putBatch({
|
|
350
382
|
PK: (0, _keys.createPartitionKey)(page),
|
|
351
383
|
SK: (0, _keys.createLatestSortKey)(),
|
|
@@ -358,11 +390,12 @@ const createPageStorageOperations = params => {
|
|
|
358
390
|
* - set the existing published revision to "unpublished"
|
|
359
391
|
*/
|
|
360
392
|
if (publishedPage && publishedPage.id !== page.id) {
|
|
361
|
-
items.push(entity.putBatch(
|
|
393
|
+
items.push(entity.putBatch({
|
|
394
|
+
...publishedPage,
|
|
362
395
|
status: "unpublished",
|
|
363
396
|
PK: (0, _keys.createPartitionKey)(publishedPage),
|
|
364
397
|
SK: (0, _keys.createSortKey)(publishedPage)
|
|
365
|
-
}))
|
|
398
|
+
}));
|
|
366
399
|
/**
|
|
367
400
|
* Remove old published path if required.
|
|
368
401
|
*/
|
|
@@ -383,19 +416,21 @@ const createPageStorageOperations = params => {
|
|
|
383
416
|
/**
|
|
384
417
|
* Update or insert published path.
|
|
385
418
|
*/
|
|
386
|
-
items.push(entity.putBatch(
|
|
419
|
+
items.push(entity.putBatch({
|
|
420
|
+
...page,
|
|
387
421
|
TYPE: (0, _keys.createPublishedPathType)(),
|
|
388
422
|
PK: (0, _keys.createPathPartitionKey)(page),
|
|
389
423
|
SK: (0, _keys.createPathSortKey)(page)
|
|
390
|
-
}))
|
|
424
|
+
}));
|
|
391
425
|
/**
|
|
392
426
|
* Update or insert published page.
|
|
393
427
|
*/
|
|
394
|
-
items.push(entity.putBatch(
|
|
428
|
+
items.push(entity.putBatch({
|
|
429
|
+
...page,
|
|
395
430
|
TYPE: (0, _keys.createPublishedType)(),
|
|
396
431
|
PK: (0, _keys.createPartitionKey)(page),
|
|
397
432
|
SK: (0, _keys.createPublishedSortKey)()
|
|
398
|
-
}))
|
|
433
|
+
}));
|
|
399
434
|
try {
|
|
400
435
|
await (0, _batchWrite.batchWriteAll)({
|
|
401
436
|
table: entity.table,
|
|
@@ -432,21 +467,23 @@ const createPageStorageOperations = params => {
|
|
|
432
467
|
}), entity.deleteBatch({
|
|
433
468
|
PK: (0, _keys.createPathPartitionKey)(page),
|
|
434
469
|
SK: (0, _keys.createPathSortKey)(page)
|
|
435
|
-
}), entity.putBatch(
|
|
470
|
+
}), entity.putBatch({
|
|
471
|
+
...page,
|
|
436
472
|
TYPE: (0, _keys.createBasicType)(),
|
|
437
473
|
PK: (0, _keys.createPartitionKey)(page),
|
|
438
474
|
SK: (0, _keys.createSortKey)(page)
|
|
439
|
-
})
|
|
475
|
+
})];
|
|
440
476
|
const esItems = [];
|
|
441
477
|
/*
|
|
442
478
|
* If we are unpublishing the latest revision, let's also update the latest revision entry's status in ES.
|
|
443
479
|
*/
|
|
444
480
|
if (latestPage.id === page.id) {
|
|
445
|
-
items.push(entity.putBatch(
|
|
481
|
+
items.push(entity.putBatch({
|
|
482
|
+
...page,
|
|
446
483
|
TYPE: (0, _keys.createLatestType)(),
|
|
447
484
|
PK: (0, _keys.createPartitionKey)(page),
|
|
448
485
|
SK: (0, _keys.createLatestSortKey)()
|
|
449
|
-
}))
|
|
486
|
+
}));
|
|
450
487
|
esItems.push(esEntity.putBatch({
|
|
451
488
|
PK: (0, _keys.createPartitionKey)(page),
|
|
452
489
|
SK: (0, _keys.createLatestSortKey)(),
|
|
@@ -519,20 +556,20 @@ const createPageStorageOperations = params => {
|
|
|
519
556
|
* If partition key is still undefined, create one with id or pid
|
|
520
557
|
*/
|
|
521
558
|
if (!partitionKey) {
|
|
522
|
-
partitionKey = (0, _keys.createPartitionKey)(
|
|
559
|
+
partitionKey = (0, _keys.createPartitionKey)({
|
|
560
|
+
...where,
|
|
523
561
|
id: pid || id
|
|
524
|
-
})
|
|
562
|
+
});
|
|
525
563
|
}
|
|
526
564
|
const keys = {
|
|
527
565
|
PK: partitionKey,
|
|
528
566
|
SK: sortKey
|
|
529
567
|
};
|
|
530
568
|
try {
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
}
|
|
535
|
-
return (0, _cleanup.cleanupItem)(entity, result.Item);
|
|
569
|
+
return await (0, _dbDynamodb.getClean)({
|
|
570
|
+
entity,
|
|
571
|
+
keys
|
|
572
|
+
});
|
|
536
573
|
} catch (ex) {
|
|
537
574
|
throw new _error.default(ex.message || "Could not load page by given params.", ex.code || "GET_PAGE_ERROR", {
|
|
538
575
|
where,
|
|
@@ -555,12 +592,15 @@ const createPageStorageOperations = params => {
|
|
|
555
592
|
limit: initialLimit
|
|
556
593
|
} = params;
|
|
557
594
|
const limit = (0, _apiElasticsearch.createLimit)(initialLimit, 50);
|
|
558
|
-
const body = (0, _elasticsearchQueryBody.createElasticsearchQueryBody)(
|
|
559
|
-
|
|
595
|
+
const body = (0, _elasticsearchQueryBody.createElasticsearchQueryBody)({
|
|
596
|
+
...params,
|
|
597
|
+
where: {
|
|
598
|
+
...params.where
|
|
599
|
+
},
|
|
560
600
|
limit,
|
|
561
601
|
after: previousCursor,
|
|
562
602
|
plugins
|
|
563
|
-
})
|
|
603
|
+
});
|
|
564
604
|
let searchPlugins = [];
|
|
565
605
|
if (params.where.published) {
|
|
566
606
|
searchPlugins = plugins.byType(_SearchPublishedPagesPlugin.SearchPublishedPagesPlugin.type);
|
|
@@ -593,9 +633,10 @@ const createPageStorageOperations = params => {
|
|
|
593
633
|
let response;
|
|
594
634
|
const esConfig = _configurations.configurations.es(params.where);
|
|
595
635
|
try {
|
|
596
|
-
response = await elasticsearch.search(
|
|
636
|
+
response = await elasticsearch.search({
|
|
637
|
+
...esConfig,
|
|
597
638
|
body
|
|
598
|
-
})
|
|
639
|
+
});
|
|
599
640
|
} catch (ex) {
|
|
600
641
|
/**
|
|
601
642
|
* Do not throw the error if Elasticsearch index does not exist.
|
|
@@ -646,7 +687,8 @@ const createPageStorageOperations = params => {
|
|
|
646
687
|
where
|
|
647
688
|
} = params;
|
|
648
689
|
const tenant = where.tenant;
|
|
649
|
-
const body = (0, _elasticsearchQueryBody.createElasticsearchQueryBody)(
|
|
690
|
+
const body = (0, _elasticsearchQueryBody.createElasticsearchQueryBody)({
|
|
691
|
+
...params,
|
|
650
692
|
where: {
|
|
651
693
|
locale: where.locale,
|
|
652
694
|
search: undefined,
|
|
@@ -656,11 +698,13 @@ const createPageStorageOperations = params => {
|
|
|
656
698
|
after: null,
|
|
657
699
|
limit: 100000,
|
|
658
700
|
plugins
|
|
659
|
-
})
|
|
701
|
+
});
|
|
660
702
|
const esConfig = _configurations.configurations.es(where);
|
|
661
703
|
try {
|
|
662
|
-
const response = await elasticsearch.search(
|
|
663
|
-
|
|
704
|
+
const response = await elasticsearch.search({
|
|
705
|
+
...esConfig,
|
|
706
|
+
body: {
|
|
707
|
+
...body,
|
|
664
708
|
sort: undefined,
|
|
665
709
|
limit: undefined,
|
|
666
710
|
size: 0,
|
|
@@ -673,8 +717,8 @@ const createPageStorageOperations = params => {
|
|
|
673
717
|
}
|
|
674
718
|
}
|
|
675
719
|
}
|
|
676
|
-
}
|
|
677
|
-
})
|
|
720
|
+
}
|
|
721
|
+
});
|
|
678
722
|
const tags = response.body.aggregations["tags"];
|
|
679
723
|
if (!tags || Array.isArray(tags.buckets) === false) {
|
|
680
724
|
return [];
|
|
@@ -694,9 +738,10 @@ const createPageStorageOperations = params => {
|
|
|
694
738
|
} = params;
|
|
695
739
|
const queryAllParams = {
|
|
696
740
|
entity,
|
|
697
|
-
partitionKey: (0, _keys.createPartitionKey)(
|
|
741
|
+
partitionKey: (0, _keys.createPartitionKey)({
|
|
742
|
+
...where,
|
|
698
743
|
id: where.pid
|
|
699
|
-
})
|
|
744
|
+
}),
|
|
700
745
|
options: {
|
|
701
746
|
beginsWith: "REV#",
|
|
702
747
|
reverse: false
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_omit","_interopRequireDefault","require","_error","_cleanup","_configurations","_apiElasticsearch","_elasticsearchQueryBody","_SearchLatestPagesPlugin","_SearchPublishedPagesPlugin","_query","_batchWrite","_helpers","_keys","_sort","_PageDynamoDbElasticsearchFieldPlugin","removePageAttributes","item","omit","createPageStorageOperations","params","entity","esEntity","elasticsearch","plugins","create","page","input","versionKeys","PK","createPartitionKey","SK","createSortKey","latestKeys","_objectSpread2","default","createLatestSortKey","items","putBatch","TYPE","createBasicType","createLatestType","esData","getESLatestPageData","batchWriteAll","table","put","index","configurations","es","data","ex","WebinyError","message","code","createFrom","latestPage","original","update","keys","latestPageResult","get","cleanupItem","Item","id","push","deleteOne","publishedPage","partitionKey","deleteBatch","esItems","createPublishedSortKey","createPathPartitionKey","createPathSortKey","previousLatestPage","previousLatestRecord","queryOne","options","lt","reverse","length","deleteAll","queryAllParams","gte","revisions","queryAll","publishedPathEntryDeleted","revision","status","path","publish","getESPublishedPageData","createPublishedPathType","createPublishedType","unpublish","where","pid","published","version","includes","Number","split","pop","sortKey","result","list","latest","after","previousCursor","limit","initialLimit","createLimit","body","createElasticsearchQueryBody","searchPlugins","byType","SearchPublishedPagesPlugin","type","SearchLatestPagesPlugin","plugin","modifyQuery","query","args","modifySort","sort","response","esConfig","search","meta","hasMoreItems","totalCount","cursor","hits","total","map","_source","encodeCursor","value","listTags","tenant","locale","undefined","size","aggs","tags","terms","field","include","aggregations","Array","isArray","buckets","key","listRevisions","beginsWith","fields","PageDynamoDbElasticsearchFieldPlugin","sortItems","delete","exports"],"sources":["index.ts"],"sourcesContent":["import {\n Page,\n PageStorageOperations,\n PageStorageOperationsCreateFromParams,\n PageStorageOperationsCreateParams,\n PageStorageOperationsDeleteAllParams,\n PageStorageOperationsDeleteParams,\n PageStorageOperationsGetParams,\n PageStorageOperationsListParams,\n PageStorageOperationsListResponse,\n PageStorageOperationsListRevisionsParams,\n PageStorageOperationsListTagsParams,\n PageStorageOperationsPublishParams,\n PageStorageOperationsUnpublishParams,\n PageStorageOperationsUpdateParams\n} from \"@webiny/api-page-builder/types\";\nimport { Entity } from \"dynamodb-toolbox\";\nimport omit from \"lodash/omit\";\nimport WebinyError from \"@webiny/error\";\nimport { cleanupItem } from \"@webiny/db-dynamodb/utils/cleanup\";\nimport { Client } from \"@elastic/elasticsearch\";\nimport {\n ElasticsearchBoolQueryConfig,\n ElasticsearchSearchResponse\n} from \"@webiny/api-elasticsearch/types\";\nimport { configurations } from \"~/configurations\";\nimport { encodeCursor, createLimit } from \"@webiny/api-elasticsearch\";\nimport { createElasticsearchQueryBody } from \"./elasticsearchQueryBody\";\nimport { SearchLatestPagesPlugin } from \"~/plugins/definitions/SearchLatestPagesPlugin\";\nimport { SearchPublishedPagesPlugin } from \"~/plugins/definitions/SearchPublishedPagesPlugin\";\nimport { DbItem, queryAll, QueryAllParams, queryOne } from \"@webiny/db-dynamodb/utils/query\";\nimport { SearchPagesPlugin } from \"~/plugins/definitions/SearchPagesPlugin\";\nimport { batchWriteAll } from \"@webiny/db-dynamodb/utils/batchWrite\";\nimport { getESLatestPageData, getESPublishedPageData } from \"./helpers\";\nimport { PluginsContainer } from \"@webiny/plugins\";\nimport {\n createBasicType,\n createLatestSortKey,\n createLatestType,\n createPartitionKey,\n createPathPartitionKey,\n createPathSortKey,\n createPublishedPathType,\n createPublishedSortKey,\n createPublishedType,\n createSortKey\n} from \"./keys\";\nimport { sortItems } from \"@webiny/db-dynamodb/utils/sort\";\nimport { PageDynamoDbElasticsearchFieldPlugin } from \"~/plugins/definitions/PageDynamoDbElasticsearchFieldPlugin\";\n\n/**\n * This function removes attributes that were once present in the Page record, which we no longer need.\n */\nfunction removePageAttributes(item: Page): Page {\n return omit(item, [\"home\", \"notFound\", \"visibility\"]) as Page;\n}\n\nexport interface CreatePageStorageOperationsParams {\n entity: Entity<any>;\n esEntity: Entity<any>;\n elasticsearch: Client;\n plugins: PluginsContainer;\n}\nexport const createPageStorageOperations = (\n params: CreatePageStorageOperationsParams\n): PageStorageOperations => {\n const { entity, esEntity, elasticsearch, plugins } = params;\n\n const create = async (params: PageStorageOperationsCreateParams): Promise<Page> => {\n const { page, input } = params;\n\n const versionKeys = {\n PK: createPartitionKey(page),\n SK: createSortKey(page)\n };\n const latestKeys = {\n ...versionKeys,\n SK: createLatestSortKey()\n };\n\n const items = [\n entity.putBatch({\n ...page,\n ...versionKeys,\n TYPE: createBasicType()\n }),\n entity.putBatch({\n ...page,\n ...latestKeys,\n TYPE: createLatestType()\n })\n ];\n const esData = getESLatestPageData(plugins, page, input);\n try {\n await batchWriteAll({\n table: entity.table,\n items: items\n });\n await esEntity.put({\n index: configurations.es(page).index,\n data: esData,\n ...latestKeys\n });\n return page;\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not create new page.\",\n ex.code || \"CREATE_PAGE_ERROR\",\n {\n versionKeys,\n latestKeys,\n page\n }\n );\n }\n };\n\n const createFrom = async (params: PageStorageOperationsCreateFromParams): Promise<Page> => {\n const { page, latestPage, original } = params;\n\n const versionKeys = {\n PK: createPartitionKey(page),\n SK: createSortKey(page)\n };\n const latestKeys = {\n ...versionKeys,\n SK: createLatestSortKey()\n };\n\n const items = [\n entity.putBatch({\n ...page,\n TYPE: createBasicType(),\n ...versionKeys\n }),\n entity.putBatch({\n ...page,\n TYPE: createLatestType(),\n ...latestKeys\n })\n ];\n\n const esData = getESLatestPageData(plugins, page);\n\n try {\n await batchWriteAll({\n table: entity.table,\n items\n });\n\n await esEntity.put({\n index: configurations.es(page).index,\n data: esData,\n ...latestKeys\n });\n return page;\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not create new page from existing page.\",\n ex.code || \"CREATE_PAGE_FROM_ERROR\",\n {\n versionKeys,\n latestKeys,\n latestPage,\n original,\n page\n }\n );\n }\n };\n\n const update = async (params: PageStorageOperationsUpdateParams): Promise<Page> => {\n const { original, page, input } = params;\n\n const keys = {\n PK: createPartitionKey(page),\n SK: createSortKey(page)\n };\n\n const latestKeys = {\n ...keys,\n SK: createLatestSortKey()\n };\n const latestPageResult = await entity.get(latestKeys);\n const latestPage = cleanupItem(entity, latestPageResult ? latestPageResult.Item : null);\n\n const items = [\n entity.putBatch({\n ...page,\n TYPE: createBasicType(),\n ...keys\n })\n ];\n\n const esData = getESLatestPageData(plugins, page, input);\n\n if (latestPage && latestPage.id === page.id) {\n /**\n * We also update the regular record.\n */\n items.push(\n entity.putBatch({\n ...page,\n TYPE: createLatestType(),\n ...latestKeys\n })\n );\n }\n /**\n * Unfortunately we cannot push regular and es record in the batch write because they are two separate tables.\n */\n try {\n await batchWriteAll({\n table: entity.table,\n items\n });\n\n await esEntity.put({\n index: configurations.es(page).index,\n data: esData,\n ...latestKeys\n });\n\n return page;\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not update existing page.\",\n ex.code || \"UPDATE_PAGE_ERROR\",\n {\n original,\n page,\n latestPage,\n latestKeys,\n keys\n }\n );\n }\n };\n\n /**\n * In case of delete, we must delete records:\n * - revision\n * - path if published\n * Update:\n * - latest\n */\n const deleteOne = async (\n params: PageStorageOperationsDeleteParams\n ): Promise<[Page, Page | null]> => {\n const { page, latestPage, publishedPage } = params;\n\n const partitionKey = createPartitionKey(page);\n\n const items = [\n entity.deleteBatch({\n PK: partitionKey,\n SK: createSortKey(page)\n })\n ];\n const esItems = [];\n if (publishedPage && publishedPage.id === page.id) {\n items.push(\n entity.deleteBatch({\n PK: partitionKey,\n SK: createPublishedSortKey()\n })\n );\n items.push(\n entity.deleteBatch({\n PK: createPathPartitionKey(page),\n SK: createPathSortKey(page)\n })\n );\n esItems.push(\n esEntity.deleteBatch({\n PK: partitionKey,\n SK: createPublishedSortKey()\n })\n );\n }\n let previousLatestPage: Page | null = null;\n if (latestPage && latestPage.id === page.id) {\n const previousLatestRecord = await queryOne<Page>({\n entity,\n partitionKey,\n options: {\n lt: createSortKey(latestPage),\n reverse: true\n }\n });\n if (previousLatestRecord) {\n items.push(\n entity.putBatch({\n ...previousLatestRecord,\n TYPE: createLatestType(),\n PK: partitionKey,\n SK: createLatestSortKey()\n })\n );\n esItems.push(\n esEntity.putBatch({\n PK: partitionKey,\n SK: createLatestSortKey(),\n index: configurations.es(page).index,\n data: getESLatestPageData(plugins, previousLatestRecord)\n })\n );\n previousLatestPage = cleanupItem(entity, previousLatestRecord);\n }\n }\n try {\n await batchWriteAll({\n table: entity.table,\n items\n });\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not batch write all the page records.\",\n ex.code || \"BATCH_WRITE_RECORDS_ERROR\"\n );\n }\n if (esItems.length === 0) {\n return [page, previousLatestPage];\n }\n try {\n await batchWriteAll({\n table: entity.table,\n items: esItems\n });\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not batch write all the page Elasticsearch records.\",\n ex.code || \"BATCH_WRITE_ELASTICSEARCH_RECORDS_ERROR\"\n );\n }\n return [page, previousLatestPage];\n };\n\n /**\n * In case of deleteAll, we must delete records:\n * - latest\n * - published\n * - path if published\n * - revision\n * - es latest\n * - es published\n */\n const deleteAll = async (params: PageStorageOperationsDeleteAllParams): Promise<[Page]> => {\n const { page } = params;\n\n const partitionKey = createPartitionKey(page);\n const queryAllParams = {\n entity,\n partitionKey,\n options: {\n gte: \" \"\n }\n };\n let revisions: DbItem<Page>[];\n try {\n revisions = await queryAll<Page>(queryAllParams);\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not query for all revisions of the page.\",\n ex.code || \"LIST_REVISIONS_ERROR\",\n {\n params: queryAllParams\n }\n );\n }\n\n /**\n * We need to go through all possible entries and delete them.\n * Also, delete the published entry path record.\n */\n const items = [];\n let publishedPathEntryDeleted = false;\n for (const revision of revisions) {\n if (revision.status === \"published\" && !publishedPathEntryDeleted) {\n publishedPathEntryDeleted = true;\n items.push(\n entity.deleteBatch({\n PK: createPathPartitionKey(page),\n SK: revision.path\n })\n );\n }\n items.push(\n entity.deleteBatch({\n PK: revision.PK,\n SK: revision.SK\n })\n );\n }\n const esItems = [\n esEntity.deleteBatch({\n PK: partitionKey,\n SK: createLatestSortKey()\n })\n ];\n /**\n * Delete published record if it is published.\n */\n if (publishedPathEntryDeleted) {\n esItems.push(\n esEntity.deleteBatch({\n PK: partitionKey,\n SK: createPublishedSortKey()\n })\n );\n }\n\n try {\n await batchWriteAll({\n table: entity.table,\n items\n });\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not delete all the page records.\",\n ex.code || \"DELETE_RECORDS_ERROR\"\n );\n }\n try {\n await batchWriteAll({\n table: entity.table,\n items: esItems\n });\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not delete all the page Elasticsearch records.\",\n ex.code || \"DELETE_ELASTICSEARCH_RECORDS_ERROR\"\n );\n }\n return [page];\n };\n\n const publish = async (params: PageStorageOperationsPublishParams): Promise<Page> => {\n const { page, latestPage, publishedPage } = params;\n\n page.status = \"published\";\n\n /**\n * Update the given revision of the page.\n */\n const items = [\n entity.putBatch({\n ...page,\n TYPE: createBasicType(),\n PK: createPartitionKey(page),\n SK: createSortKey(page)\n })\n ];\n const esItems = [];\n /**\n * If we are publishing the latest revision, update the latest revision\n * status in ES. We also need to update the latest page revision entry in ES.\n */\n if (latestPage.id === page.id) {\n items.push(\n entity.putBatch({\n ...page,\n TYPE: createLatestType(),\n PK: createPartitionKey(page),\n SK: createLatestSortKey()\n })\n );\n\n esItems.push(\n esEntity.putBatch({\n PK: createPartitionKey(page),\n SK: createLatestSortKey(),\n index: configurations.es(page).index,\n data: getESLatestPageData(plugins, page)\n })\n );\n }\n /**\n * If we already have a published revision, and it's not the revision being published:\n * - set the existing published revision to \"unpublished\"\n */\n if (publishedPage && publishedPage.id !== page.id) {\n items.push(\n entity.putBatch({\n ...publishedPage,\n status: \"unpublished\",\n PK: createPartitionKey(publishedPage),\n SK: createSortKey(publishedPage)\n })\n );\n /**\n * Remove old published path if required.\n */\n if (publishedPage.path !== page.path) {\n items.push(\n entity.deleteBatch({\n PK: createPathPartitionKey(page),\n SK: publishedPage.path\n })\n );\n }\n }\n\n esItems.push(\n esEntity.putBatch({\n PK: createPartitionKey(page),\n SK: createPublishedSortKey(),\n index: configurations.es(page).index,\n data: getESPublishedPageData(plugins, page)\n })\n );\n\n /**\n * Update or insert published path.\n */\n items.push(\n entity.putBatch({\n ...page,\n TYPE: createPublishedPathType(),\n PK: createPathPartitionKey(page),\n SK: createPathSortKey(page)\n })\n );\n /**\n * Update or insert published page.\n */\n items.push(\n entity.putBatch({\n ...page,\n TYPE: createPublishedType(),\n PK: createPartitionKey(page),\n SK: createPublishedSortKey()\n })\n );\n\n try {\n await batchWriteAll({\n table: entity.table,\n items\n });\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not update all the page records when publishing.\",\n ex.code || \"UPDATE_RECORDS_ERROR\"\n );\n }\n /**\n * No point in continuing if there are no items in Elasticsearch data\n */\n if (esItems.length === 0) {\n return page;\n }\n try {\n await batchWriteAll({\n table: esEntity.table,\n items: esItems\n });\n } catch (ex) {\n throw new WebinyError(\n ex.message ||\n \"Could not update all the page Elasticsearch records when publishing.\",\n ex.code || \"UPDATE_ELASTICSEARCH_RECORDS_ERROR\"\n );\n }\n return page;\n };\n\n const unpublish = async (params: PageStorageOperationsUnpublishParams): Promise<Page> => {\n const { page, latestPage } = params;\n\n page.status = \"unpublished\";\n\n const items = [\n entity.deleteBatch({\n PK: createPartitionKey(page),\n SK: createPublishedSortKey()\n }),\n entity.deleteBatch({\n PK: createPathPartitionKey(page),\n SK: createPathSortKey(page)\n }),\n entity.putBatch({\n ...page,\n TYPE: createBasicType(),\n PK: createPartitionKey(page),\n SK: createSortKey(page)\n })\n ];\n const esItems = [];\n /*\n * If we are unpublishing the latest revision, let's also update the latest revision entry's status in ES.\n */\n if (latestPage.id === page.id) {\n items.push(\n entity.putBatch({\n ...page,\n TYPE: createLatestType(),\n PK: createPartitionKey(page),\n SK: createLatestSortKey()\n })\n );\n esItems.push(\n esEntity.putBatch({\n PK: createPartitionKey(page),\n SK: createLatestSortKey(),\n index: configurations.es(page).index,\n data: getESLatestPageData(plugins, page)\n })\n );\n }\n\n esItems.push(\n esEntity.deleteBatch({\n PK: createPartitionKey(page),\n SK: createPublishedSortKey()\n })\n );\n\n try {\n await batchWriteAll({\n table: entity.table,\n items\n });\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not update all the page records when unpublishing.\",\n ex.code || \"UPDATE_RECORDS_ERROR\"\n );\n }\n /**\n * No need to go further if no Elasticsearch items to be applied.\n */\n if (esItems.length === 0) {\n return page;\n }\n try {\n await batchWriteAll({\n table: esEntity.table,\n items: esItems\n });\n } catch (ex) {\n throw new WebinyError(\n ex.message ||\n \"Could not update all the page Elasticsearch records when unpublishing.\",\n ex.code || \"UPDATE_ELASTICSEARCH_RECORDS_ERROR\"\n );\n }\n return page;\n };\n\n const get = async (params: PageStorageOperationsGetParams): Promise<Page | null> => {\n const { where } = params;\n const { pid, id, path, published } = where;\n let { version } = where;\n /**\n * In case of having full ID and not having version we can take the version from the id.\n */\n if (id && id.includes(\"#\") && !version) {\n version = Number(id.split(\"#\").pop());\n }\n let partitionKey: string | null = null;\n let sortKey: string;\n if (path) {\n partitionKey = createPathPartitionKey(where);\n sortKey = path;\n } else if (published) {\n sortKey = createPublishedSortKey();\n } else if (version) {\n sortKey = createSortKey({\n version\n });\n } else {\n sortKey = createLatestSortKey();\n }\n /**\n * If partition key is still undefined, create one with id or pid\n */\n if (!partitionKey) {\n partitionKey = createPartitionKey({\n ...where,\n id: pid || (id as string)\n });\n }\n const keys = {\n PK: partitionKey,\n SK: sortKey\n };\n try {\n const result = await entity.get(keys);\n if (!result || !result.Item) {\n return null;\n }\n return cleanupItem(entity, result.Item);\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not load page by given params.\",\n ex.code || \"GET_PAGE_ERROR\",\n {\n where,\n keys\n }\n );\n }\n };\n\n const list = async (\n params: PageStorageOperationsListParams\n ): Promise<PageStorageOperationsListResponse> => {\n /**\n * We do not allow loading both published and latest at the same time.\n * @see PageStorageOperationsListWhere\n */\n if (params.where.published && params.where.latest) {\n throw new WebinyError(\n \"Both published and latest cannot be defined at the same time.\",\n \"MALFORMED_WHERE_ERROR\",\n {\n where: params.where\n }\n );\n }\n\n const { after: previousCursor = null, limit: initialLimit } = params;\n\n const limit = createLimit(initialLimit, 50);\n const body = createElasticsearchQueryBody({\n ...params,\n where: {\n ...params.where\n },\n limit,\n after: previousCursor,\n plugins\n });\n\n let searchPlugins: SearchPagesPlugin[] = [];\n if (params.where.published) {\n searchPlugins = plugins.byType<SearchPublishedPagesPlugin>(\n SearchPublishedPagesPlugin.type\n );\n } else if (params.where.latest) {\n searchPlugins = plugins.byType<SearchLatestPagesPlugin>(SearchLatestPagesPlugin.type);\n } else {\n throw new WebinyError(\n \"Only published or latest can be listed. Missing where condition.\",\n \"MALFORMED_WHERE_ERROR\",\n {\n where: params.where\n }\n );\n }\n\n for (const plugin of searchPlugins) {\n /**\n * Apply query modifications\n */\n plugin.modifyQuery({\n query: body.query as unknown as ElasticsearchBoolQueryConfig,\n args: params,\n plugins\n });\n\n /**\n * Apply sort modifications\n */\n plugin.modifySort({\n sort: body.sort,\n args: params,\n plugins\n });\n }\n\n let response: ElasticsearchSearchResponse<Page>;\n const esConfig = configurations.es(params.where);\n try {\n response = await elasticsearch.search({\n ...esConfig,\n body\n });\n } catch (ex) {\n /**\n * Do not throw the error if Elasticsearch index does not exist.\n * In some CRUDs we try to get list of pages but index was not created yet.\n */\n if (ex.message === \"index_not_found_exception\") {\n return {\n items: [],\n meta: {\n hasMoreItems: false,\n totalCount: 0,\n cursor: null\n }\n };\n }\n throw new WebinyError(\n ex.message || \"Could not load pages by given Elasticsearch body.\",\n ex.code || \"LIST_PAGES_ERROR\",\n {\n body\n }\n );\n }\n const { hits, total } = response.body.hits;\n const items = hits.map(item => item._source).map(item => removePageAttributes(item));\n\n const hasMoreItems = items.length > limit;\n if (hasMoreItems) {\n /**\n * Remove the last item from results, we don't want to include it.\n */\n items.pop();\n }\n /**\n * Cursor is the `sort` value of the last item in the array.\n * https://www.elastic.co/guide/en/elasticsearch/reference/current/paginate-search-results.html#search-after\n */\n const cursor =\n items.length > 0 && hasMoreItems\n ? encodeCursor(hits[items.length - 1].sort) || null\n : null;\n return {\n items,\n meta: {\n hasMoreItems,\n totalCount: total.value,\n cursor\n }\n };\n };\n\n const listTags = async (params: PageStorageOperationsListTagsParams): Promise<string[]> => {\n const { where } = params;\n\n const tenant: string = where.tenant;\n const body = createElasticsearchQueryBody({\n ...params,\n where: {\n locale: where.locale,\n search: undefined,\n tenant\n },\n sort: [],\n after: null,\n limit: 100000,\n plugins\n });\n\n const esConfig = configurations.es(where);\n\n try {\n const response: ElasticsearchSearchResponse<string> = await elasticsearch.search({\n ...esConfig,\n body: {\n ...body,\n sort: undefined,\n limit: undefined,\n size: 0,\n aggs: {\n tags: {\n terms: {\n field: \"tags.keyword\",\n include: `.*${where.search}.*`,\n size: 10\n }\n }\n }\n }\n });\n\n const tags = response.body.aggregations[\"tags\"];\n if (!tags || Array.isArray(tags.buckets) === false) {\n return [];\n }\n return tags.buckets.map(item => item.key);\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not list tags by given parameters.\",\n ex.code || \"LIST_TAGS_ERROR\",\n {\n body,\n where\n }\n );\n }\n };\n\n const listRevisions = async (\n params: PageStorageOperationsListRevisionsParams\n ): Promise<Page[]> => {\n const { where, sort } = params;\n\n const queryAllParams: QueryAllParams = {\n entity,\n partitionKey: createPartitionKey({\n ...where,\n id: where.pid\n }),\n options: {\n beginsWith: \"REV#\",\n reverse: false\n }\n };\n\n let items: Page[] = [];\n try {\n items = await queryAll<Page>(queryAllParams);\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not load all the revisions from requested page.\",\n ex.code || \"LOAD_PAGE_REVISIONS_ERROR\",\n {\n params\n }\n );\n }\n\n const fields = plugins.byType<PageDynamoDbElasticsearchFieldPlugin>(\n PageDynamoDbElasticsearchFieldPlugin.type\n );\n\n return sortItems({\n items: items.map(item => removePageAttributes(item)),\n fields,\n sort\n });\n };\n\n return {\n create,\n createFrom,\n update,\n delete: deleteOne,\n deleteAll: deleteAll,\n publish,\n unpublish,\n get,\n list,\n listRevisions,\n listTags\n };\n};\n"],"mappings":";;;;;;;;AAiBA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AAMA,IAAAG,eAAA,GAAAH,OAAA;AACA,IAAAI,iBAAA,GAAAJ,OAAA;AACA,IAAAK,uBAAA,GAAAL,OAAA;AACA,IAAAM,wBAAA,GAAAN,OAAA;AACA,IAAAO,2BAAA,GAAAP,OAAA;AACA,IAAAQ,MAAA,GAAAR,OAAA;AAEA,IAAAS,WAAA,GAAAT,OAAA;AACA,IAAAU,QAAA,GAAAV,OAAA;AAEA,IAAAW,KAAA,GAAAX,OAAA;AAYA,IAAAY,KAAA,GAAAZ,OAAA;AACA,IAAAa,qCAAA,GAAAb,OAAA;AAEA;AACA;AACA;AACA,SAASc,oBAAoBA,CAACC,IAAU,EAAQ;EAC5C,OAAO,IAAAC,aAAI,EAACD,IAAI,EAAE,CAAC,MAAM,EAAE,UAAU,EAAE,YAAY,CAAC,CAAC;AACzD;AAQO,MAAME,2BAA2B,GACpCC,MAAyC,IACjB;EACxB,MAAM;IAAEC,MAAM;IAAEC,QAAQ;IAAEC,aAAa;IAAEC;EAAQ,CAAC,GAAGJ,MAAM;EAE3D,MAAMK,MAAM,GAAG,MAAOL,MAAyC,IAAoB;IAC/E,MAAM;MAAEM,IAAI;MAAEC;IAAM,CAAC,GAAGP,MAAM;IAE9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_configurations","_apiElasticsearch","_elasticsearchQueryBody","_SearchLatestPagesPlugin","_SearchPublishedPagesPlugin","_query","_batchWrite","_helpers","_keys","_sort","_PageDynamoDbElasticsearchFieldPlugin","_dbDynamodb","removePageAttributes","item","omit","createPageStorageOperations","params","entity","esEntity","elasticsearch","plugins","create","page","input","versionKeys","PK","createPartitionKey","SK","createSortKey","latestKeys","createLatestSortKey","items","putBatch","TYPE","createBasicType","createLatestType","esData","getESLatestPageData","batchWriteAll","table","put","index","configurations","es","data","ex","WebinyError","message","code","createFrom","latestPage","original","update","keys","getClean","id","push","deleteOne","publishedPage","partitionKey","deleteBatch","esItems","createPublishedSortKey","createPathPartitionKey","createPathSortKey","previousLatestPage","previousLatestRecord","queryOne","options","lt","reverse","cleanupItem","length","deleteAll","queryAllParams","gte","revisions","queryAll","publishedPathEntryDeleted","revision","status","path","publish","getESPublishedPageData","createPublishedPathType","createPublishedType","unpublish","get","where","pid","published","version","includes","Number","split","pop","sortKey","list","latest","after","previousCursor","limit","initialLimit","createLimit","body","createElasticsearchQueryBody","searchPlugins","byType","SearchPublishedPagesPlugin","type","SearchLatestPagesPlugin","plugin","modifyQuery","query","args","modifySort","sort","response","esConfig","search","meta","hasMoreItems","totalCount","cursor","hits","total","map","_source","encodeCursor","value","listTags","tenant","locale","undefined","size","aggs","tags","terms","field","include","aggregations","Array","isArray","buckets","key","listRevisions","beginsWith","fields","PageDynamoDbElasticsearchFieldPlugin","sortItems","delete","exports"],"sources":["index.ts"],"sourcesContent":["import {\n Page,\n PageStorageOperations,\n PageStorageOperationsCreateFromParams,\n PageStorageOperationsCreateParams,\n PageStorageOperationsDeleteAllParams,\n PageStorageOperationsDeleteParams,\n PageStorageOperationsGetParams,\n PageStorageOperationsListParams,\n PageStorageOperationsListResponse,\n PageStorageOperationsListRevisionsParams,\n PageStorageOperationsListTagsParams,\n PageStorageOperationsPublishParams,\n PageStorageOperationsUnpublishParams,\n PageStorageOperationsUpdateParams\n} from \"@webiny/api-page-builder/types\";\nimport { Entity } from \"@webiny/db-dynamodb/toolbox\";\nimport omit from \"lodash/omit\";\nimport WebinyError from \"@webiny/error\";\nimport { cleanupItem } from \"@webiny/db-dynamodb/utils/cleanup\";\nimport { Client } from \"@elastic/elasticsearch\";\nimport {\n ElasticsearchBoolQueryConfig,\n ElasticsearchSearchResponse\n} from \"@webiny/api-elasticsearch/types\";\nimport { configurations } from \"~/configurations\";\nimport { createLimit, encodeCursor } from \"@webiny/api-elasticsearch\";\nimport { createElasticsearchQueryBody } from \"./elasticsearchQueryBody\";\nimport { SearchLatestPagesPlugin } from \"~/plugins/definitions/SearchLatestPagesPlugin\";\nimport { SearchPublishedPagesPlugin } from \"~/plugins/definitions/SearchPublishedPagesPlugin\";\nimport { DbItem, queryAll, QueryAllParams, queryOne } from \"@webiny/db-dynamodb/utils/query\";\nimport { SearchPagesPlugin } from \"~/plugins/definitions/SearchPagesPlugin\";\nimport { batchWriteAll } from \"@webiny/db-dynamodb/utils/batchWrite\";\nimport { getESLatestPageData, getESPublishedPageData } from \"./helpers\";\nimport { PluginsContainer } from \"@webiny/plugins\";\nimport {\n createBasicType,\n createLatestSortKey,\n createLatestType,\n createPartitionKey,\n createPathPartitionKey,\n createPathSortKey,\n createPublishedPathType,\n createPublishedSortKey,\n createPublishedType,\n createSortKey\n} from \"./keys\";\nimport { sortItems } from \"@webiny/db-dynamodb/utils/sort\";\nimport { PageDynamoDbElasticsearchFieldPlugin } from \"~/plugins/definitions/PageDynamoDbElasticsearchFieldPlugin\";\nimport { getClean, put } from \"@webiny/db-dynamodb\";\n\n/**\n * This function removes attributes that were once present in the Page record, which we no longer need.\n */\nfunction removePageAttributes(item: Page): Page {\n return omit(item, [\"home\", \"notFound\", \"visibility\"]) as Page;\n}\n\nexport interface CreatePageStorageOperationsParams {\n entity: Entity<any>;\n esEntity: Entity<any>;\n elasticsearch: Client;\n plugins: PluginsContainer;\n}\nexport const createPageStorageOperations = (\n params: CreatePageStorageOperationsParams\n): PageStorageOperations => {\n const { entity, esEntity, elasticsearch, plugins } = params;\n\n const create = async (params: PageStorageOperationsCreateParams): Promise<Page> => {\n const { page, input } = params;\n\n const versionKeys = {\n PK: createPartitionKey(page),\n SK: createSortKey(page)\n };\n const latestKeys = {\n ...versionKeys,\n SK: createLatestSortKey()\n };\n\n const items = [\n entity.putBatch({\n ...page,\n ...versionKeys,\n TYPE: createBasicType()\n }),\n entity.putBatch({\n ...page,\n ...latestKeys,\n TYPE: createLatestType()\n })\n ];\n const esData = getESLatestPageData(plugins, page, input);\n try {\n await batchWriteAll({\n table: entity.table,\n items: items\n });\n await put({\n entity: esEntity,\n item: {\n index: configurations.es(page).index,\n data: esData,\n ...latestKeys\n }\n });\n return page;\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not create new page.\",\n ex.code || \"CREATE_PAGE_ERROR\",\n {\n versionKeys,\n latestKeys,\n page\n }\n );\n }\n };\n\n const createFrom = async (params: PageStorageOperationsCreateFromParams): Promise<Page> => {\n const { page, latestPage, original } = params;\n\n const versionKeys = {\n PK: createPartitionKey(page),\n SK: createSortKey(page)\n };\n const latestKeys = {\n ...versionKeys,\n SK: createLatestSortKey()\n };\n\n const items = [\n entity.putBatch({\n ...page,\n TYPE: createBasicType(),\n ...versionKeys\n }),\n entity.putBatch({\n ...page,\n TYPE: createLatestType(),\n ...latestKeys\n })\n ];\n\n const esData = getESLatestPageData(plugins, page);\n\n try {\n await batchWriteAll({\n table: entity.table,\n items\n });\n\n await put({\n entity: esEntity,\n item: {\n index: configurations.es(page).index,\n data: esData,\n ...latestKeys\n }\n });\n return page;\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not create new page from existing page.\",\n ex.code || \"CREATE_PAGE_FROM_ERROR\",\n {\n versionKeys,\n latestKeys,\n latestPage,\n original,\n page\n }\n );\n }\n };\n\n const update = async (params: PageStorageOperationsUpdateParams): Promise<Page> => {\n const { original, page, input } = params;\n\n const keys = {\n PK: createPartitionKey(page),\n SK: createSortKey(page)\n };\n\n const latestKeys = {\n ...keys,\n SK: createLatestSortKey()\n };\n const latestPage = await getClean<Page>({\n entity,\n keys: latestKeys\n });\n\n const items = [\n entity.putBatch({\n ...page,\n TYPE: createBasicType(),\n ...keys\n })\n ];\n\n const esData = getESLatestPageData(plugins, page, input);\n\n if (latestPage && latestPage?.id === page.id) {\n /**\n * We also update the regular record.\n */\n items.push(\n entity.putBatch({\n ...page,\n TYPE: createLatestType(),\n ...latestKeys\n })\n );\n }\n /**\n * Unfortunately we cannot push regular and es record in the batch write because they are two separate tables.\n */\n try {\n await batchWriteAll({\n table: entity.table,\n items\n });\n\n await put({\n entity: esEntity,\n item: {\n index: configurations.es(page).index,\n data: esData,\n ...latestKeys\n }\n });\n\n return page;\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not update existing page.\",\n ex.code || \"UPDATE_PAGE_ERROR\",\n {\n original,\n page,\n latestPage,\n latestKeys,\n keys\n }\n );\n }\n };\n\n /**\n * In case of delete, we must delete records:\n * - revision\n * - path if published\n * Update:\n * - latest\n */\n const deleteOne = async (\n params: PageStorageOperationsDeleteParams\n ): Promise<[Page, Page | null]> => {\n const { page, latestPage, publishedPage } = params;\n\n const partitionKey = createPartitionKey(page);\n\n const items = [\n entity.deleteBatch({\n PK: partitionKey,\n SK: createSortKey(page)\n })\n ];\n const esItems = [];\n if (publishedPage && publishedPage.id === page.id) {\n items.push(\n entity.deleteBatch({\n PK: partitionKey,\n SK: createPublishedSortKey()\n })\n );\n items.push(\n entity.deleteBatch({\n PK: createPathPartitionKey(page),\n SK: createPathSortKey(page)\n })\n );\n esItems.push(\n esEntity.deleteBatch({\n PK: partitionKey,\n SK: createPublishedSortKey()\n })\n );\n }\n let previousLatestPage: Page | null = null;\n if (latestPage && latestPage.id === page.id) {\n const previousLatestRecord = await queryOne<Page>({\n entity,\n partitionKey,\n options: {\n lt: createSortKey(latestPage),\n reverse: true\n }\n });\n if (previousLatestRecord) {\n items.push(\n entity.putBatch({\n ...previousLatestRecord,\n TYPE: createLatestType(),\n PK: partitionKey,\n SK: createLatestSortKey()\n })\n );\n esItems.push(\n esEntity.putBatch({\n PK: partitionKey,\n SK: createLatestSortKey(),\n index: configurations.es(page).index,\n data: getESLatestPageData(plugins, previousLatestRecord)\n })\n );\n previousLatestPage = cleanupItem(entity, previousLatestRecord);\n }\n }\n try {\n await batchWriteAll({\n table: entity.table,\n items\n });\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not batch write all the page records.\",\n ex.code || \"BATCH_WRITE_RECORDS_ERROR\"\n );\n }\n if (esItems.length === 0) {\n return [page, previousLatestPage];\n }\n try {\n await batchWriteAll({\n table: entity.table,\n items: esItems\n });\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not batch write all the page Elasticsearch records.\",\n ex.code || \"BATCH_WRITE_ELASTICSEARCH_RECORDS_ERROR\"\n );\n }\n return [page, previousLatestPage];\n };\n\n /**\n * In case of deleteAll, we must delete records:\n * - latest\n * - published\n * - path if published\n * - revision\n * - es latest\n * - es published\n */\n const deleteAll = async (params: PageStorageOperationsDeleteAllParams): Promise<[Page]> => {\n const { page } = params;\n\n const partitionKey = createPartitionKey(page);\n const queryAllParams = {\n entity,\n partitionKey,\n options: {\n gte: \" \"\n }\n };\n let revisions: DbItem<Page>[];\n try {\n revisions = await queryAll<Page>(queryAllParams);\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not query for all revisions of the page.\",\n ex.code || \"LIST_REVISIONS_ERROR\",\n {\n params: queryAllParams\n }\n );\n }\n\n /**\n * We need to go through all possible entries and delete them.\n * Also, delete the published entry path record.\n */\n const items = [];\n let publishedPathEntryDeleted = false;\n for (const revision of revisions) {\n if (revision.status === \"published\" && !publishedPathEntryDeleted) {\n publishedPathEntryDeleted = true;\n items.push(\n entity.deleteBatch({\n PK: createPathPartitionKey(page),\n SK: revision.path\n })\n );\n }\n items.push(\n entity.deleteBatch({\n PK: revision.PK,\n SK: revision.SK\n })\n );\n }\n const esItems = [\n esEntity.deleteBatch({\n PK: partitionKey,\n SK: createLatestSortKey()\n })\n ];\n /**\n * Delete published record if it is published.\n */\n if (publishedPathEntryDeleted) {\n esItems.push(\n esEntity.deleteBatch({\n PK: partitionKey,\n SK: createPublishedSortKey()\n })\n );\n }\n\n try {\n await batchWriteAll({\n table: entity.table,\n items\n });\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not delete all the page records.\",\n ex.code || \"DELETE_RECORDS_ERROR\"\n );\n }\n try {\n await batchWriteAll({\n table: entity.table,\n items: esItems\n });\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not delete all the page Elasticsearch records.\",\n ex.code || \"DELETE_ELASTICSEARCH_RECORDS_ERROR\"\n );\n }\n return [page];\n };\n\n const publish = async (params: PageStorageOperationsPublishParams): Promise<Page> => {\n const { page, latestPage, publishedPage } = params;\n\n page.status = \"published\";\n\n /**\n * Update the given revision of the page.\n */\n const items = [\n entity.putBatch({\n ...page,\n TYPE: createBasicType(),\n PK: createPartitionKey(page),\n SK: createSortKey(page)\n })\n ];\n const esItems = [];\n /**\n * If we are publishing the latest revision, update the latest revision\n * status in ES. We also need to update the latest page revision entry in ES.\n */\n if (latestPage.id === page.id) {\n items.push(\n entity.putBatch({\n ...page,\n TYPE: createLatestType(),\n PK: createPartitionKey(page),\n SK: createLatestSortKey()\n })\n );\n\n esItems.push(\n esEntity.putBatch({\n PK: createPartitionKey(page),\n SK: createLatestSortKey(),\n index: configurations.es(page).index,\n data: getESLatestPageData(plugins, page)\n })\n );\n }\n /**\n * If we already have a published revision, and it's not the revision being published:\n * - set the existing published revision to \"unpublished\"\n */\n if (publishedPage && publishedPage.id !== page.id) {\n items.push(\n entity.putBatch({\n ...publishedPage,\n status: \"unpublished\",\n PK: createPartitionKey(publishedPage),\n SK: createSortKey(publishedPage)\n })\n );\n /**\n * Remove old published path if required.\n */\n if (publishedPage.path !== page.path) {\n items.push(\n entity.deleteBatch({\n PK: createPathPartitionKey(page),\n SK: publishedPage.path\n })\n );\n }\n }\n\n esItems.push(\n esEntity.putBatch({\n PK: createPartitionKey(page),\n SK: createPublishedSortKey(),\n index: configurations.es(page).index,\n data: getESPublishedPageData(plugins, page)\n })\n );\n\n /**\n * Update or insert published path.\n */\n items.push(\n entity.putBatch({\n ...page,\n TYPE: createPublishedPathType(),\n PK: createPathPartitionKey(page),\n SK: createPathSortKey(page)\n })\n );\n /**\n * Update or insert published page.\n */\n items.push(\n entity.putBatch({\n ...page,\n TYPE: createPublishedType(),\n PK: createPartitionKey(page),\n SK: createPublishedSortKey()\n })\n );\n\n try {\n await batchWriteAll({\n table: entity.table,\n items\n });\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not update all the page records when publishing.\",\n ex.code || \"UPDATE_RECORDS_ERROR\"\n );\n }\n /**\n * No point in continuing if there are no items in Elasticsearch data\n */\n if (esItems.length === 0) {\n return page;\n }\n try {\n await batchWriteAll({\n table: esEntity.table,\n items: esItems\n });\n } catch (ex) {\n throw new WebinyError(\n ex.message ||\n \"Could not update all the page Elasticsearch records when publishing.\",\n ex.code || \"UPDATE_ELASTICSEARCH_RECORDS_ERROR\"\n );\n }\n return page;\n };\n\n const unpublish = async (params: PageStorageOperationsUnpublishParams): Promise<Page> => {\n const { page, latestPage } = params;\n\n page.status = \"unpublished\";\n\n const items = [\n entity.deleteBatch({\n PK: createPartitionKey(page),\n SK: createPublishedSortKey()\n }),\n entity.deleteBatch({\n PK: createPathPartitionKey(page),\n SK: createPathSortKey(page)\n }),\n entity.putBatch({\n ...page,\n TYPE: createBasicType(),\n PK: createPartitionKey(page),\n SK: createSortKey(page)\n })\n ];\n const esItems = [];\n /*\n * If we are unpublishing the latest revision, let's also update the latest revision entry's status in ES.\n */\n if (latestPage.id === page.id) {\n items.push(\n entity.putBatch({\n ...page,\n TYPE: createLatestType(),\n PK: createPartitionKey(page),\n SK: createLatestSortKey()\n })\n );\n esItems.push(\n esEntity.putBatch({\n PK: createPartitionKey(page),\n SK: createLatestSortKey(),\n index: configurations.es(page).index,\n data: getESLatestPageData(plugins, page)\n })\n );\n }\n\n esItems.push(\n esEntity.deleteBatch({\n PK: createPartitionKey(page),\n SK: createPublishedSortKey()\n })\n );\n\n try {\n await batchWriteAll({\n table: entity.table,\n items\n });\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not update all the page records when unpublishing.\",\n ex.code || \"UPDATE_RECORDS_ERROR\"\n );\n }\n /**\n * No need to go further if no Elasticsearch items to be applied.\n */\n if (esItems.length === 0) {\n return page;\n }\n try {\n await batchWriteAll({\n table: esEntity.table,\n items: esItems\n });\n } catch (ex) {\n throw new WebinyError(\n ex.message ||\n \"Could not update all the page Elasticsearch records when unpublishing.\",\n ex.code || \"UPDATE_ELASTICSEARCH_RECORDS_ERROR\"\n );\n }\n return page;\n };\n\n const get = async (params: PageStorageOperationsGetParams): Promise<Page | null> => {\n const { where } = params;\n const { pid, id, path, published } = where;\n let { version } = where;\n /**\n * In case of having full ID and not having version we can take the version from the id.\n */\n if (id && id.includes(\"#\") && !version) {\n version = Number(id.split(\"#\").pop());\n }\n let partitionKey: string | null = null;\n let sortKey: string;\n if (path) {\n partitionKey = createPathPartitionKey(where);\n sortKey = path;\n } else if (published) {\n sortKey = createPublishedSortKey();\n } else if (version) {\n sortKey = createSortKey({\n version\n });\n } else {\n sortKey = createLatestSortKey();\n }\n /**\n * If partition key is still undefined, create one with id or pid\n */\n if (!partitionKey) {\n partitionKey = createPartitionKey({\n ...where,\n id: pid || (id as string)\n });\n }\n const keys = {\n PK: partitionKey,\n SK: sortKey\n };\n try {\n return await getClean({\n entity,\n keys\n });\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not load page by given params.\",\n ex.code || \"GET_PAGE_ERROR\",\n {\n where,\n keys\n }\n );\n }\n };\n\n const list = async (\n params: PageStorageOperationsListParams\n ): Promise<PageStorageOperationsListResponse> => {\n /**\n * We do not allow loading both published and latest at the same time.\n * @see PageStorageOperationsListWhere\n */\n if (params.where.published && params.where.latest) {\n throw new WebinyError(\n \"Both published and latest cannot be defined at the same time.\",\n \"MALFORMED_WHERE_ERROR\",\n {\n where: params.where\n }\n );\n }\n\n const { after: previousCursor = null, limit: initialLimit } = params;\n\n const limit = createLimit(initialLimit, 50);\n const body = createElasticsearchQueryBody({\n ...params,\n where: {\n ...params.where\n },\n limit,\n after: previousCursor,\n plugins\n });\n\n let searchPlugins: SearchPagesPlugin[] = [];\n if (params.where.published) {\n searchPlugins = plugins.byType<SearchPublishedPagesPlugin>(\n SearchPublishedPagesPlugin.type\n );\n } else if (params.where.latest) {\n searchPlugins = plugins.byType<SearchLatestPagesPlugin>(SearchLatestPagesPlugin.type);\n } else {\n throw new WebinyError(\n \"Only published or latest can be listed. Missing where condition.\",\n \"MALFORMED_WHERE_ERROR\",\n {\n where: params.where\n }\n );\n }\n\n for (const plugin of searchPlugins) {\n /**\n * Apply query modifications\n */\n plugin.modifyQuery({\n query: body.query as unknown as ElasticsearchBoolQueryConfig,\n args: params,\n plugins\n });\n\n /**\n * Apply sort modifications\n */\n plugin.modifySort({\n sort: body.sort,\n args: params,\n plugins\n });\n }\n\n let response: ElasticsearchSearchResponse<Page>;\n const esConfig = configurations.es(params.where);\n try {\n response = await elasticsearch.search({\n ...esConfig,\n body\n });\n } catch (ex) {\n /**\n * Do not throw the error if Elasticsearch index does not exist.\n * In some CRUDs we try to get list of pages but index was not created yet.\n */\n if (ex.message === \"index_not_found_exception\") {\n return {\n items: [],\n meta: {\n hasMoreItems: false,\n totalCount: 0,\n cursor: null\n }\n };\n }\n throw new WebinyError(\n ex.message || \"Could not load pages by given Elasticsearch body.\",\n ex.code || \"LIST_PAGES_ERROR\",\n {\n body\n }\n );\n }\n const { hits, total } = response.body.hits;\n const items = hits.map(item => item._source).map(item => removePageAttributes(item));\n\n const hasMoreItems = items.length > limit;\n if (hasMoreItems) {\n /**\n * Remove the last item from results, we don't want to include it.\n */\n items.pop();\n }\n /**\n * Cursor is the `sort` value of the last item in the array.\n * https://www.elastic.co/guide/en/elasticsearch/reference/current/paginate-search-results.html#search-after\n */\n const cursor =\n items.length > 0 && hasMoreItems\n ? encodeCursor(hits[items.length - 1].sort) || null\n : null;\n return {\n items,\n meta: {\n hasMoreItems,\n totalCount: total.value,\n cursor\n }\n };\n };\n\n const listTags = async (params: PageStorageOperationsListTagsParams): Promise<string[]> => {\n const { where } = params;\n\n const tenant: string = where.tenant;\n const body = createElasticsearchQueryBody({\n ...params,\n where: {\n locale: where.locale,\n search: undefined,\n tenant\n },\n sort: [],\n after: null,\n limit: 100000,\n plugins\n });\n\n const esConfig = configurations.es(where);\n\n try {\n const response: ElasticsearchSearchResponse<string> = await elasticsearch.search({\n ...esConfig,\n body: {\n ...body,\n sort: undefined,\n limit: undefined,\n size: 0,\n aggs: {\n tags: {\n terms: {\n field: \"tags.keyword\",\n include: `.*${where.search}.*`,\n size: 10\n }\n }\n }\n }\n });\n\n const tags = response.body.aggregations[\"tags\"];\n if (!tags || Array.isArray(tags.buckets) === false) {\n return [];\n }\n return tags.buckets.map(item => item.key);\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not list tags by given parameters.\",\n ex.code || \"LIST_TAGS_ERROR\",\n {\n body,\n where\n }\n );\n }\n };\n\n const listRevisions = async (\n params: PageStorageOperationsListRevisionsParams\n ): Promise<Page[]> => {\n const { where, sort } = params;\n\n const queryAllParams: QueryAllParams = {\n entity,\n partitionKey: createPartitionKey({\n ...where,\n id: where.pid\n }),\n options: {\n beginsWith: \"REV#\",\n reverse: false\n }\n };\n\n let items: Page[] = [];\n try {\n items = await queryAll<Page>(queryAllParams);\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not load all the revisions from requested page.\",\n ex.code || \"LOAD_PAGE_REVISIONS_ERROR\",\n {\n params\n }\n );\n }\n\n const fields = plugins.byType<PageDynamoDbElasticsearchFieldPlugin>(\n PageDynamoDbElasticsearchFieldPlugin.type\n );\n\n return sortItems({\n items: items.map(item => removePageAttributes(item)),\n fields,\n sort\n });\n };\n\n return {\n create,\n createFrom,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