@webiny/api-form-builder-so-ddb-es 5.34.8 → 5.35.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. package/configurations.js +0 -11
  2. package/configurations.js.map +1 -1
  3. package/definitions/elasticsearch.js +0 -5
  4. package/definitions/elasticsearch.js.map +1 -1
  5. package/definitions/form.js +0 -5
  6. package/definitions/form.js.map +1 -1
  7. package/definitions/settings.js +0 -5
  8. package/definitions/settings.js.map +1 -1
  9. package/definitions/submission.js +0 -5
  10. package/definitions/submission.js.map +1 -1
  11. package/definitions/system.js +0 -5
  12. package/definitions/system.js.map +1 -1
  13. package/definitions/table.js +0 -3
  14. package/definitions/table.js.map +1 -1
  15. package/definitions/tableElasticsearch.js +0 -3
  16. package/definitions/tableElasticsearch.js.map +1 -1
  17. package/elasticsearch/createElasticsearchIndex.js +0 -11
  18. package/elasticsearch/createElasticsearchIndex.js.map +1 -1
  19. package/elasticsearch/indices/base.js +0 -3
  20. package/elasticsearch/indices/base.js.map +1 -1
  21. package/elasticsearch/indices/index.d.ts +1 -1
  22. package/elasticsearch/indices/index.js +0 -4
  23. package/elasticsearch/indices/index.js.map +1 -1
  24. package/elasticsearch/indices/japanese.js +0 -3
  25. package/elasticsearch/indices/japanese.js.map +1 -1
  26. package/index.d.ts +1 -0
  27. package/index.js +25 -35
  28. package/index.js.map +1 -1
  29. package/operations/form/elasticsearchBody.js +0 -27
  30. package/operations/form/elasticsearchBody.js.map +1 -1
  31. package/operations/form/elasticsearchFields.js +0 -3
  32. package/operations/form/elasticsearchFields.js.map +1 -1
  33. package/operations/form/fields.js +0 -3
  34. package/operations/form/fields.js.map +1 -1
  35. package/operations/form/index.js +2 -103
  36. package/operations/form/index.js.map +1 -1
  37. package/operations/settings/index.js +0 -20
  38. package/operations/settings/index.js.map +1 -1
  39. package/operations/submission/elasticsearchBody.js +0 -29
  40. package/operations/submission/elasticsearchBody.js.map +1 -1
  41. package/operations/submission/elasticsearchFields.js +0 -3
  42. package/operations/submission/elasticsearchFields.js.map +1 -1
  43. package/operations/submission/index.js +1 -49
  44. package/operations/submission/index.js.map +1 -1
  45. package/operations/system/index.js +0 -18
  46. package/operations/system/index.js.map +1 -1
  47. package/package.json +15 -15
  48. package/plugins/FormDynamoDbFieldPlugin.js +0 -5
  49. package/plugins/FormDynamoDbFieldPlugin.js.map +1 -1
  50. package/plugins/FormElasticsearchBodyModifierPlugin.js +0 -5
  51. package/plugins/FormElasticsearchBodyModifierPlugin.js.map +1 -1
  52. package/plugins/FormElasticsearchFieldPlugin.js +0 -5
  53. package/plugins/FormElasticsearchFieldPlugin.js.map +1 -1
  54. package/plugins/FormElasticsearchIndexPlugin.js +0 -5
  55. package/plugins/FormElasticsearchIndexPlugin.js.map +1 -1
  56. package/plugins/FormElasticsearchQueryModifierPlugin.js +0 -5
  57. package/plugins/FormElasticsearchQueryModifierPlugin.js.map +1 -1
  58. package/plugins/FormElasticsearchSortModifierPlugin.js +0 -5
  59. package/plugins/FormElasticsearchSortModifierPlugin.js.map +1 -1
  60. package/plugins/SubmissionElasticsearchBodyModifierPlugin.js +0 -5
  61. package/plugins/SubmissionElasticsearchBodyModifierPlugin.js.map +1 -1
  62. package/plugins/SubmissionElasticsearchFieldPlugin.js +0 -5
  63. package/plugins/SubmissionElasticsearchFieldPlugin.js.map +1 -1
  64. package/plugins/SubmissionElasticsearchQueryModifierPlugin.js +0 -5
  65. package/plugins/SubmissionElasticsearchQueryModifierPlugin.js.map +1 -1
  66. package/plugins/SubmissionElasticsearchSortModifierPlugin.js +0 -5
  67. package/plugins/SubmissionElasticsearchSortModifierPlugin.js.map +1 -1
  68. package/plugins/index.d.ts +10 -0
  69. package/plugins/index.js +115 -0
  70. package/plugins/index.js.map +1 -0
  71. package/types.js +0 -1
  72. package/types.js.map +1 -1
@@ -1,36 +1,22 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.createFormStorageOperations = void 0;
9
-
10
8
  var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
11
-
12
9
  var _query = require("@webiny/db-dynamodb/utils/query");
13
-
14
10
  var _error = _interopRequireDefault(require("@webiny/error"));
15
-
16
11
  var _cleanup = require("@webiny/db-dynamodb/utils/cleanup");
17
-
18
12
  var _batchWrite = require("@webiny/db-dynamodb/utils/batchWrite");
19
-
20
13
  var _configurations = require("../../configurations");
21
-
22
14
  var _filter = require("@webiny/db-dynamodb/utils/filter");
23
-
24
15
  var _fields = _interopRequireDefault(require("./fields"));
25
-
26
16
  var _sort = require("@webiny/db-dynamodb/utils/sort");
27
-
28
17
  var _utils = require("@webiny/utils");
29
-
30
18
  var _elasticsearchBody = require("./elasticsearchBody");
31
-
32
19
  var _apiElasticsearch = require("@webiny/api-elasticsearch");
33
-
34
20
  const getESDataForLatestRevision = form => ({
35
21
  __type: (0, _elasticsearchBody.createFormElasticType)(),
36
22
  id: form.id,
@@ -50,7 +36,6 @@ const getESDataForLatestRevision = form => ({
50
36
  webinyVersion: form.webinyVersion,
51
37
  formId: form.formId
52
38
  });
53
-
54
39
  const createFormStorageOperations = params => {
55
40
  const {
56
41
  entity,
@@ -60,7 +45,6 @@ const createFormStorageOperations = params => {
60
45
  elasticsearch
61
46
  } = params;
62
47
  const formDynamoDbFields = (0, _fields.default)();
63
-
64
48
  const createFormPartitionKey = params => {
65
49
  const {
66
50
  tenant,
@@ -72,32 +56,25 @@ const createFormStorageOperations = params => {
72
56
  } = (0, _utils.parseIdentifier)(targetId);
73
57
  return `T#${tenant}#L#${locale}#FB#F#${id}`;
74
58
  };
75
-
76
59
  const createRevisionSortKey = value => {
77
60
  const version = typeof value === "number" ? Number(value) : (0, _utils.parseIdentifier)(value).version;
78
61
  return `REV#${(0, _utils.zeroPad)(version)}`;
79
62
  };
80
-
81
63
  const createLatestSortKey = () => {
82
64
  return "L";
83
65
  };
84
-
85
66
  const createLatestPublishedSortKey = () => {
86
67
  return "LP";
87
68
  };
88
-
89
69
  const createFormType = () => {
90
70
  return "fb.form";
91
71
  };
92
-
93
72
  const createFormLatestType = () => {
94
73
  return "fb.form.latest";
95
74
  };
96
-
97
75
  const createFormLatestPublishedType = () => {
98
76
  return "fb.form.latestPublished";
99
77
  };
100
-
101
78
  const createForm = async params => {
102
79
  const {
103
80
  form
@@ -115,7 +92,6 @@ const createFormStorageOperations = params => {
115
92
  }, revisionKeys)), entity.putBatch((0, _objectSpread2.default)((0, _objectSpread2.default)({}, form), {}, {
116
93
  TYPE: createFormLatestType()
117
94
  }, latestKeys))];
118
-
119
95
  try {
120
96
  await (0, _batchWrite.batchWriteAll)({
121
97
  table,
@@ -128,7 +104,6 @@ const createFormStorageOperations = params => {
128
104
  form
129
105
  });
130
106
  }
131
-
132
107
  try {
133
108
  const {
134
109
  index
@@ -136,7 +111,6 @@ const createFormStorageOperations = params => {
136
111
  tenant: form.tenant,
137
112
  locale: form.locale
138
113
  });
139
-
140
114
  await esEntity.put((0, _objectSpread2.default)({
141
115
  index,
142
116
  data: getESDataForLatestRevision(form),
@@ -148,10 +122,8 @@ const createFormStorageOperations = params => {
148
122
  form
149
123
  });
150
124
  }
151
-
152
125
  return form;
153
126
  };
154
-
155
127
  const createFormFrom = async params => {
156
128
  const {
157
129
  form,
@@ -171,7 +143,6 @@ const createFormStorageOperations = params => {
171
143
  })), entity.putBatch((0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({}, form), latestKeys), {}, {
172
144
  TYPE: createFormLatestType()
173
145
  }))];
174
-
175
146
  try {
176
147
  await (0, _batchWrite.batchWriteAll)({
177
148
  table,
@@ -186,7 +157,6 @@ const createFormStorageOperations = params => {
186
157
  latest
187
158
  });
188
159
  }
189
-
190
160
  try {
191
161
  const {
192
162
  index
@@ -194,7 +164,6 @@ const createFormStorageOperations = params => {
194
164
  tenant: form.tenant,
195
165
  locale: form.locale
196
166
  });
197
-
198
167
  await esEntity.put((0, _objectSpread2.default)({
199
168
  index,
200
169
  data: getESDataForLatestRevision(form),
@@ -208,10 +177,8 @@ const createFormStorageOperations = params => {
208
177
  original
209
178
  });
210
179
  }
211
-
212
180
  return form;
213
181
  };
214
-
215
182
  const updateForm = async params => {
216
183
  const {
217
184
  form,
@@ -242,13 +209,11 @@ const createFormStorageOperations = params => {
242
209
  const items = [entity.putBatch((0, _objectSpread2.default)((0, _objectSpread2.default)({}, form), {}, {
243
210
  TYPE: createFormType()
244
211
  }, revisionKeys))];
245
-
246
212
  if (isLatestForm) {
247
213
  items.push(entity.putBatch((0, _objectSpread2.default)((0, _objectSpread2.default)({}, form), {}, {
248
214
  TYPE: createFormLatestType()
249
215
  }, latestKeys)));
250
216
  }
251
-
252
217
  try {
253
218
  await (0, _batchWrite.batchWriteAll)({
254
219
  table,
@@ -266,12 +231,9 @@ const createFormStorageOperations = params => {
266
231
  /**
267
232
  * No need to go further if its not latest form.
268
233
  */
269
-
270
-
271
234
  if (!isLatestForm) {
272
235
  return form;
273
236
  }
274
-
275
237
  try {
276
238
  const {
277
239
  index
@@ -279,7 +241,6 @@ const createFormStorageOperations = params => {
279
241
  tenant: form.tenant,
280
242
  locale: form.locale
281
243
  });
282
-
283
244
  await esEntity.put((0, _objectSpread2.default)({
284
245
  index,
285
246
  data: getESDataForLatestRevision(form),
@@ -293,10 +254,8 @@ const createFormStorageOperations = params => {
293
254
  original
294
255
  });
295
256
  }
296
-
297
257
  return form;
298
258
  };
299
-
300
259
  const getForm = async params => {
301
260
  const {
302
261
  where
@@ -310,13 +269,10 @@ const createFormStorageOperations = params => {
310
269
  tenant,
311
270
  locale
312
271
  } = where;
313
-
314
272
  if (latest && published) {
315
273
  throw new _error.default("Cannot have both latest and published params.");
316
274
  }
317
-
318
275
  let sortKey;
319
-
320
276
  if (latest) {
321
277
  sortKey = createLatestSortKey();
322
278
  } else if (published && !version) {
@@ -331,7 +287,6 @@ const createFormStorageOperations = params => {
331
287
  where
332
288
  });
333
289
  }
334
-
335
290
  const keys = {
336
291
  PK: createFormPartitionKey({
337
292
  tenant,
@@ -340,14 +295,11 @@ const createFormStorageOperations = params => {
340
295
  }),
341
296
  SK: sortKey
342
297
  };
343
-
344
298
  try {
345
299
  const result = await entity.get(keys);
346
-
347
300
  if (!result || !result.Item) {
348
301
  return null;
349
302
  }
350
-
351
303
  return (0, _cleanup.cleanupItem)(entity, result.Item);
352
304
  } catch (ex) {
353
305
  throw new _error.default(ex.message || "Could not get form by keys.", ex.code || "GET_FORM_ERROR", {
@@ -355,7 +307,6 @@ const createFormStorageOperations = params => {
355
307
  });
356
308
  }
357
309
  };
358
-
359
310
  const listForms = async params => {
360
311
  const {
361
312
  sort,
@@ -370,17 +321,14 @@ const createFormStorageOperations = params => {
370
321
  where,
371
322
  after: (0, _apiElasticsearch.decodeCursor)(after)
372
323
  });
373
-
374
324
  const esConfig = _configurations.configurations.es({
375
325
  tenant: where.tenant,
376
326
  locale: where.locale
377
327
  });
378
-
379
328
  const query = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, esConfig), {}, {
380
329
  body
381
330
  });
382
331
  let response;
383
-
384
332
  try {
385
333
  response = await elasticsearch.search(query);
386
334
  } catch (ex) {
@@ -389,14 +337,12 @@ const createFormStorageOperations = params => {
389
337
  query
390
338
  });
391
339
  }
392
-
393
340
  const {
394
341
  hits,
395
342
  total
396
343
  } = response.body.hits;
397
344
  const items = hits.map(item => item._source);
398
345
  const hasMoreItems = items.length > limit;
399
-
400
346
  if (hasMoreItems) {
401
347
  /**
402
348
  * Remove the last item from results, we don't want to include it.
@@ -408,7 +354,6 @@ const createFormStorageOperations = params => {
408
354
  * https://www.elastic.co/guide/en/elasticsearch/reference/current/paginate-search-results.html#search-after
409
355
  */
410
356
 
411
-
412
357
  const meta = {
413
358
  hasMoreItems,
414
359
  totalCount: total.value,
@@ -419,7 +364,6 @@ const createFormStorageOperations = params => {
419
364
  meta
420
365
  };
421
366
  };
422
-
423
367
  const listFormRevisions = async params => {
424
368
  const {
425
369
  where: initialWhere,
@@ -443,7 +387,6 @@ const createFormStorageOperations = params => {
443
387
  }
444
388
  };
445
389
  let items = [];
446
-
447
390
  try {
448
391
  items = await (0, _query.queryAll)(queryAllParams);
449
392
  } catch (ex) {
@@ -452,7 +395,6 @@ const createFormStorageOperations = params => {
452
395
  options: queryAllParams.options
453
396
  });
454
397
  }
455
-
456
398
  const where = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, initialWhere), {}, {
457
399
  id: undefined,
458
400
  formId: undefined
@@ -463,18 +405,15 @@ const createFormStorageOperations = params => {
463
405
  where,
464
406
  fields: formDynamoDbFields
465
407
  });
466
-
467
408
  if (!sort || sort.length === 0) {
468
409
  return filteredItems;
469
410
  }
470
-
471
411
  return (0, _sort.sortItems)({
472
412
  items: filteredItems,
473
413
  sort,
474
414
  fields: formDynamoDbFields
475
415
  });
476
416
  };
477
-
478
417
  const deleteForm = async params => {
479
418
  const {
480
419
  form
@@ -483,7 +422,6 @@ const createFormStorageOperations = params => {
483
422
  /**
484
423
  * This will find all form and submission records.
485
424
  */
486
-
487
425
  const queryAllParams = {
488
426
  entity,
489
427
  partitionKey: createFormPartitionKey(form),
@@ -491,7 +429,6 @@ const createFormStorageOperations = params => {
491
429
  gte: " "
492
430
  }
493
431
  };
494
-
495
432
  try {
496
433
  items = await (0, _query.queryAll)(queryAllParams);
497
434
  } catch (ex) {
@@ -500,14 +437,12 @@ const createFormStorageOperations = params => {
500
437
  options: queryAllParams.options
501
438
  });
502
439
  }
503
-
504
440
  const deleteItems = items.map(item => {
505
441
  return entity.deleteBatch({
506
442
  PK: item.PK,
507
443
  SK: item.SK
508
444
  });
509
445
  });
510
-
511
446
  try {
512
447
  await (0, _batchWrite.batchWriteAll)({
513
448
  table,
@@ -516,12 +451,10 @@ const createFormStorageOperations = params => {
516
451
  } catch (ex) {
517
452
  throw new _error.default(ex.message || "Could not delete form and it's submissions.", ex.code || "DELETE_FORM_AND_SUBMISSIONS_ERROR");
518
453
  }
519
-
520
454
  const latestKeys = {
521
455
  PK: createFormPartitionKey(form),
522
456
  SK: createLatestSortKey()
523
457
  };
524
-
525
458
  try {
526
459
  await esEntity.delete(latestKeys);
527
460
  } catch (ex) {
@@ -529,7 +462,6 @@ const createFormStorageOperations = params => {
529
462
  latestKeys
530
463
  });
531
464
  }
532
-
533
465
  return form;
534
466
  };
535
467
  /**
@@ -538,8 +470,6 @@ const createFormStorageOperations = params => {
538
470
  * - get previously published revision and update the record if it exists or delete if it does not
539
471
  * - update latest record if current one is the latest
540
472
  */
541
-
542
-
543
473
  const deleteFormRevision = async params => {
544
474
  const {
545
475
  form,
@@ -560,7 +490,6 @@ const createFormStorageOperations = params => {
560
490
  const isLatestPublished = latestPublishedForm ? latestPublishedForm.id === form.id : false;
561
491
  const items = [entity.deleteBatch(revisionKeys)];
562
492
  let esDataItem = undefined;
563
-
564
493
  if (isLatest || isLatestPublished) {
565
494
  /**
566
495
  * Sort out the latest published record.
@@ -569,7 +498,6 @@ const createFormStorageOperations = params => {
569
498
  const previouslyPublishedForm = revisions.filter(f => !!f.publishedOn && f.version !== form.version).sort((a, b) => {
570
499
  return new Date(b.publishedOn).getTime() - new Date(a.publishedOn).getTime();
571
500
  }).shift();
572
-
573
501
  if (previouslyPublishedForm) {
574
502
  items.push(entity.putBatch((0, _objectSpread2.default)((0, _objectSpread2.default)({}, previouslyPublishedForm), {}, {
575
503
  PK: createFormPartitionKey(previouslyPublishedForm),
@@ -586,20 +514,16 @@ const createFormStorageOperations = params => {
586
514
  /**
587
515
  * Sort out the latest record.
588
516
  */
589
-
590
-
591
517
  if (isLatest && previous) {
592
518
  items.push(entity.putBatch((0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({}, previous), latestKeys), {}, {
593
519
  TYPE: createFormLatestType()
594
520
  })));
595
-
596
521
  const {
597
522
  index
598
523
  } = _configurations.configurations.es({
599
524
  tenant: previous.tenant,
600
525
  locale: previous.locale
601
526
  });
602
-
603
527
  esDataItem = (0, _objectSpread2.default)((0, _objectSpread2.default)({
604
528
  index
605
529
  }, latestKeys), {}, {
@@ -610,8 +534,6 @@ const createFormStorageOperations = params => {
610
534
  /**
611
535
  * Now save the batch data.
612
536
  */
613
-
614
-
615
537
  try {
616
538
  await (0, _batchWrite.batchWriteAll)({
617
539
  table,
@@ -628,12 +550,9 @@ const createFormStorageOperations = params => {
628
550
  /**
629
551
  * And then the Elasticsearch data, if any.
630
552
  */
631
-
632
-
633
553
  if (!esDataItem) {
634
554
  return form;
635
555
  }
636
-
637
556
  try {
638
557
  await esEntity.put(esDataItem);
639
558
  return form;
@@ -646,6 +565,7 @@ const createFormStorageOperations = params => {
646
565
  });
647
566
  }
648
567
  };
568
+
649
569
  /**
650
570
  * We need to save form in:
651
571
  * - regular form record
@@ -653,8 +573,6 @@ const createFormStorageOperations = params => {
653
573
  * - latest form record - if form is latest one
654
574
  * - elasticsearch latest form record
655
575
  */
656
-
657
-
658
576
  const publishForm = async params => {
659
577
  const {
660
578
  form,
@@ -689,7 +607,6 @@ const createFormStorageOperations = params => {
689
607
  /**
690
608
  * Update revision and latest published records
691
609
  */
692
-
693
610
  const items = [entity.putBatch((0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({}, form), revisionKeys), {}, {
694
611
  TYPE: createFormType()
695
612
  })), entity.putBatch((0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({}, form), latestPublishedKeys), {}, {
@@ -698,13 +615,11 @@ const createFormStorageOperations = params => {
698
615
  /**
699
616
  * Update the latest form as well
700
617
  */
701
-
702
618
  if (isLatestForm) {
703
619
  items.push(entity.putBatch((0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({}, form), latestKeys), {}, {
704
620
  TYPE: createFormLatestType()
705
621
  })));
706
622
  }
707
-
708
623
  try {
709
624
  await (0, _batchWrite.batchWriteAll)({
710
625
  table,
@@ -720,20 +635,16 @@ const createFormStorageOperations = params => {
720
635
  latestPublishedKeys
721
636
  });
722
637
  }
723
-
724
638
  if (!isLatestForm) {
725
639
  return form;
726
640
  }
727
-
728
641
  const {
729
642
  index
730
643
  } = _configurations.configurations.es({
731
644
  tenant: form.tenant,
732
645
  locale: form.locale
733
646
  });
734
-
735
647
  const esData = getESDataForLatestRevision(form);
736
-
737
648
  try {
738
649
  await esEntity.put((0, _objectSpread2.default)((0, _objectSpread2.default)({}, latestKeys), {}, {
739
650
  index,
@@ -752,14 +663,13 @@ const createFormStorageOperations = params => {
752
663
  });
753
664
  }
754
665
  };
666
+
755
667
  /**
756
668
  * We need to:
757
669
  * - update form revision record
758
670
  * - if latest published (LP) is current form, find the previously published record and update LP if there is some previously published, delete otherwise
759
671
  * - if is latest update the Elasticsearch record
760
672
  */
761
-
762
-
763
673
  const unpublishForm = async params => {
764
674
  const {
765
675
  form,
@@ -804,7 +714,6 @@ const createFormStorageOperations = params => {
804
714
  TYPE: createFormType()
805
715
  }))];
806
716
  let esData = undefined;
807
-
808
717
  if (isLatest) {
809
718
  esData = getESDataForLatestRevision(form);
810
719
  }
@@ -812,8 +721,6 @@ const createFormStorageOperations = params => {
812
721
  * In case previously published revision exists, replace current one with that one.
813
722
  * And if it does not, delete the record.
814
723
  */
815
-
816
-
817
724
  if (isLatestPublished) {
818
725
  const revisions = await listFormRevisions({
819
726
  where: {
@@ -826,7 +733,6 @@ const createFormStorageOperations = params => {
826
733
  sort: ["savedOn_DESC"]
827
734
  });
828
735
  const previouslyPublishedRevision = revisions.shift();
829
-
830
736
  if (previouslyPublishedRevision) {
831
737
  items.push(entity.putBatch((0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({}, previouslyPublishedRevision), latestPublishedKeys), {}, {
832
738
  TYPE: createFormLatestPublishedType()
@@ -835,7 +741,6 @@ const createFormStorageOperations = params => {
835
741
  items.push(entity.deleteBatch(latestPublishedKeys));
836
742
  }
837
743
  }
838
-
839
744
  try {
840
745
  await (0, _batchWrite.batchWriteAll)({
841
746
  table,
@@ -854,19 +759,15 @@ const createFormStorageOperations = params => {
854
759
  /**
855
760
  * No need to go further in case of non-existing Elasticsearch data.
856
761
  */
857
-
858
-
859
762
  if (!esData) {
860
763
  return form;
861
764
  }
862
-
863
765
  const {
864
766
  index
865
767
  } = _configurations.configurations.es({
866
768
  tenant: form.tenant,
867
769
  locale: form.locale
868
770
  });
869
-
870
771
  try {
871
772
  await esEntity.put((0, _objectSpread2.default)((0, _objectSpread2.default)({}, latestKeys), {}, {
872
773
  index,
@@ -885,7 +786,6 @@ const createFormStorageOperations = params => {
885
786
  });
886
787
  }
887
788
  };
888
-
889
789
  return {
890
790
  createForm,
891
791
  createFormFrom,
@@ -900,5 +800,4 @@ const createFormStorageOperations = params => {
900
800
  createFormPartitionKey
901
801
  };
902
802
  };
903
-
904
803
  exports.createFormStorageOperations = createFormStorageOperations;