@webiny/api-headless-cms-ddb-es 5.20.0-beta.0 → 5.20.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.
@@ -501,6 +501,33 @@ const createEntriesStorageOperations = params => {
501
501
 
502
502
  const list = async (model, params) => {
503
503
  const limit = (0, _limit.createLimit)(params.limit, 50);
504
+
505
+ const {
506
+ index
507
+ } = _configurations.default.es({
508
+ model
509
+ });
510
+
511
+ try {
512
+ const result = await elasticsearch.indices.exists({
513
+ index
514
+ });
515
+
516
+ if (!result || !result.body) {
517
+ return {
518
+ hasMoreItems: false,
519
+ totalCount: 0,
520
+ cursor: null,
521
+ items: []
522
+ };
523
+ }
524
+ } catch (ex) {
525
+ throw new _error.default("Could not determine if Elasticsearch index exists.", "ELASTICSEARCH_INDEX_CHECK_ERROR", {
526
+ error: ex,
527
+ index
528
+ });
529
+ }
530
+
504
531
  const body = (0, _helpers.createElasticsearchQueryBody)({
505
532
  model,
506
533
  args: _objectSpread(_objectSpread({}, params), {}, {
@@ -511,12 +538,6 @@ const createEntriesStorageOperations = params => {
511
538
  });
512
539
  let response;
513
540
 
514
- const {
515
- index
516
- } = _configurations.default.es({
517
- model
518
- });
519
-
520
541
  try {
521
542
  response = await elasticsearch.search({
522
543
  index,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webiny/api-headless-cms-ddb-es",
3
- "version": "5.20.0-beta.0",
3
+ "version": "5.20.0-beta.1",
4
4
  "main": "index.js",
5
5
  "keywords": [
6
6
  "@webiny/api-headless-cms",
@@ -23,15 +23,15 @@
23
23
  "license": "MIT",
24
24
  "dependencies": {
25
25
  "@babel/runtime": "7.16.3",
26
- "@webiny/api-headless-cms": "5.20.0-beta.0",
27
- "@webiny/api-upgrade": "5.20.0-beta.0",
28
- "@webiny/db-dynamodb": "5.20.0-beta.0",
29
- "@webiny/error": "5.20.0-beta.0",
30
- "@webiny/handler": "5.20.0-beta.0",
31
- "@webiny/handler-aws": "5.20.0-beta.0",
32
- "@webiny/handler-db": "5.20.0-beta.0",
33
- "@webiny/plugins": "5.20.0-beta.0",
34
- "@webiny/utils": "5.20.0-beta.0",
26
+ "@webiny/api-headless-cms": "5.20.0-beta.1",
27
+ "@webiny/api-upgrade": "5.20.0-beta.1",
28
+ "@webiny/db-dynamodb": "5.20.0-beta.1",
29
+ "@webiny/error": "5.20.0-beta.1",
30
+ "@webiny/handler": "5.20.0-beta.1",
31
+ "@webiny/handler-aws": "5.20.0-beta.1",
32
+ "@webiny/handler-db": "5.20.0-beta.1",
33
+ "@webiny/plugins": "5.20.0-beta.1",
34
+ "@webiny/utils": "5.20.0-beta.1",
35
35
  "dataloader": "2.0.0",
36
36
  "dynamodb-toolbox": "0.3.5",
37
37
  "jsonpack": "1.1.5",
@@ -47,10 +47,10 @@
47
47
  "@elastic/elasticsearch": "7.12.0",
48
48
  "@shelf/jest-elasticsearch": "^1.0.0",
49
49
  "@types/jsonpack": "^1.1.0",
50
- "@webiny/api-dynamodb-to-elasticsearch": "^5.20.0-beta.0",
51
- "@webiny/api-elasticsearch": "^5.20.0-beta.0",
52
- "@webiny/cli": "^5.20.0-beta.0",
53
- "@webiny/project-utils": "^5.20.0-beta.0",
50
+ "@webiny/api-dynamodb-to-elasticsearch": "^5.20.0-beta.1",
51
+ "@webiny/api-elasticsearch": "^5.20.0-beta.1",
52
+ "@webiny/cli": "^5.20.0-beta.1",
53
+ "@webiny/project-utils": "^5.20.0-beta.1",
54
54
  "jest": "^26.6.3",
55
55
  "jest-dynalite": "^3.2.0",
56
56
  "jest-environment-node": "^26.6.2",
@@ -69,5 +69,5 @@
69
69
  "build": "yarn webiny run build",
70
70
  "watch": "yarn webiny run watch"
71
71
  },
72
- "gitHead": "2de02bc113e15e3ffa8e1d82deb9d27417787188"
72
+ "gitHead": "40e30fb4c778d0bcc773b3b8231ce8e0861b6d52"
73
73
  }