@webiny/api-form-builder-so-ddb 0.0.0-mt-3 → 0.0.0-unstable.085ff6572f

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 (44) hide show
  1. package/definitions/form.d.ts +2 -1
  2. package/definitions/form.js +3 -12
  3. package/definitions/form.js.map +1 -0
  4. package/definitions/settings.d.ts +2 -1
  5. package/definitions/settings.js +3 -12
  6. package/definitions/settings.js.map +1 -0
  7. package/definitions/submission.d.ts +2 -1
  8. package/definitions/submission.js +3 -12
  9. package/definitions/submission.js.map +1 -0
  10. package/definitions/system.d.ts +2 -1
  11. package/definitions/system.js +3 -12
  12. package/definitions/system.js.map +1 -0
  13. package/definitions/table.d.ts +3 -2
  14. package/definitions/table.js +0 -3
  15. package/definitions/table.js.map +1 -0
  16. package/index.d.ts +1 -0
  17. package/index.js +35 -43
  18. package/index.js.map +1 -0
  19. package/operations/form/fields.js +0 -3
  20. package/operations/form/fields.js.map +1 -0
  21. package/operations/form/index.d.ts +2 -2
  22. package/operations/form/index.js +25 -115
  23. package/operations/form/index.js.map +1 -0
  24. package/operations/settings/index.d.ts +2 -2
  25. package/operations/settings/index.js +5 -28
  26. package/operations/settings/index.js.map +1 -0
  27. package/operations/submission/fields.js +0 -3
  28. package/operations/submission/fields.js.map +1 -0
  29. package/operations/submission/index.d.ts +2 -2
  30. package/operations/submission/index.js +7 -45
  31. package/operations/submission/index.js.map +1 -0
  32. package/operations/system/index.d.ts +2 -2
  33. package/operations/system/index.js +4 -25
  34. package/operations/system/index.js.map +1 -0
  35. package/package.json +23 -23
  36. package/plugins/FormDynamoDbFieldPlugin.js +1 -6
  37. package/plugins/FormDynamoDbFieldPlugin.js.map +1 -0
  38. package/plugins/FormSubmissionDynamoDbFieldPlugin.js +1 -6
  39. package/plugins/FormSubmissionDynamoDbFieldPlugin.js.map +1 -0
  40. package/plugins/index.d.ts +2 -0
  41. package/plugins/index.js +27 -0
  42. package/plugins/index.js.map +1 -0
  43. package/types.js +0 -1
  44. package/types.js.map +1 -0
@@ -1,38 +1,21 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.createFormStorageOperations = void 0;
9
-
10
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
-
8
+ var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
12
9
  var _error = _interopRequireDefault(require("@webiny/error"));
13
-
14
10
  var _query = require("@webiny/db-dynamodb/utils/query");
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 _filter = require("@webiny/db-dynamodb/utils/filter");
21
-
22
14
  var _sort = require("@webiny/db-dynamodb/utils/sort");
23
-
24
15
  var _utils = require("@webiny/utils");
25
-
26
16
  var _FormDynamoDbFieldPlugin = require("../../plugins/FormDynamoDbFieldPlugin");
27
-
28
17
  var _cursor = require("@webiny/db-dynamodb/utils/cursor");
29
-
30
18
  var _get = require("@webiny/db-dynamodb/utils/get");
31
-
32
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
33
-
34
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
35
-
36
19
  const createFormStorageOperations = params => {
37
20
  const {
38
21
  entity,
@@ -40,7 +23,6 @@ const createFormStorageOperations = params => {
40
23
  plugins
41
24
  } = params;
42
25
  const formDynamoDbFields = plugins.byType(_FormDynamoDbFieldPlugin.FormDynamoDbFieldPlugin.type);
43
-
44
26
  const createFormPartitionKey = params => {
45
27
  const {
46
28
  tenant,
@@ -48,15 +30,12 @@ const createFormStorageOperations = params => {
48
30
  } = params;
49
31
  return `T#${tenant}#L#${locale}#FB#F`;
50
32
  };
51
-
52
33
  const createFormLatestPartitionKey = params => {
53
34
  return `${createFormPartitionKey(params)}#L`;
54
35
  };
55
-
56
36
  const createFormLatestPublishedPartitionKey = params => {
57
37
  return `${createFormPartitionKey(params)}#LP`;
58
38
  };
59
-
60
39
  const createFormGSIPartitionKey = params => {
61
40
  const {
62
41
  tenant,
@@ -68,13 +47,11 @@ const createFormStorageOperations = params => {
68
47
  } = (0, _utils.parseIdentifier)(targetId);
69
48
  return `T#${tenant}#L#${locale}#FB#F#${id}`;
70
49
  };
71
-
72
50
  const createRevisionSortKey = ({
73
51
  id
74
52
  }) => {
75
53
  return `${id}`;
76
54
  };
77
-
78
55
  const createFormLatestSortKey = ({
79
56
  id,
80
57
  formId
@@ -82,7 +59,6 @@ const createFormStorageOperations = params => {
82
59
  const value = (0, _utils.parseIdentifier)(id || formId);
83
60
  return value.id;
84
61
  };
85
-
86
62
  const createLatestPublishedSortKey = ({
87
63
  id,
88
64
  formId
@@ -90,51 +66,42 @@ const createFormStorageOperations = params => {
90
66
  const value = (0, _utils.parseIdentifier)(id || formId);
91
67
  return value.id;
92
68
  };
93
-
94
69
  const createGSISortKey = version => {
95
70
  return `${version}`;
96
71
  };
97
-
98
72
  const createFormType = () => {
99
73
  return "fb.form";
100
74
  };
101
-
102
75
  const createFormLatestType = () => {
103
76
  return "fb.form.latest";
104
77
  };
105
-
106
78
  const createFormLatestPublishedType = () => {
107
79
  return "fb.form.latestPublished";
108
80
  };
109
-
110
81
  const createRevisionKeys = form => {
111
82
  return {
112
83
  PK: createFormPartitionKey(form),
113
84
  SK: createRevisionSortKey(form)
114
85
  };
115
86
  };
116
-
117
87
  const createLatestKeys = form => {
118
88
  return {
119
89
  PK: createFormLatestPartitionKey(form),
120
90
  SK: createFormLatestSortKey(form)
121
91
  };
122
92
  };
123
-
124
93
  const createLatestPublishedKeys = form => {
125
94
  return {
126
95
  PK: createFormLatestPublishedPartitionKey(form),
127
96
  SK: createLatestPublishedSortKey(form)
128
97
  };
129
98
  };
130
-
131
99
  const createGSIKeys = form => {
132
100
  return {
133
101
  GSI1_PK: createFormGSIPartitionKey(form),
134
102
  GSI1_SK: createGSISortKey(form.version)
135
103
  };
136
104
  };
137
-
138
105
  const createForm = async params => {
139
106
  const {
140
107
  form
@@ -142,12 +109,11 @@ const createFormStorageOperations = params => {
142
109
  const revisionKeys = createRevisionKeys(form);
143
110
  const latestKeys = createLatestKeys(form);
144
111
  const gsiKeys = createGSIKeys(form);
145
- const items = [entity.putBatch(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, form), revisionKeys), gsiKeys), {}, {
112
+ const items = [entity.putBatch((0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({}, form), revisionKeys), gsiKeys), {}, {
146
113
  TYPE: createFormType()
147
- })), entity.putBatch(_objectSpread(_objectSpread(_objectSpread({}, form), latestKeys), {}, {
114
+ })), entity.putBatch((0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({}, form), latestKeys), {}, {
148
115
  TYPE: createFormLatestType()
149
116
  }))];
150
-
151
117
  try {
152
118
  await (0, _batchWrite.batchWriteAll)({
153
119
  table,
@@ -160,10 +126,8 @@ const createFormStorageOperations = params => {
160
126
  form
161
127
  });
162
128
  }
163
-
164
129
  return form;
165
130
  };
166
-
167
131
  const createFormFrom = async params => {
168
132
  const {
169
133
  form,
@@ -173,12 +137,11 @@ const createFormStorageOperations = params => {
173
137
  const revisionKeys = createRevisionKeys(form);
174
138
  const latestKeys = createLatestKeys(form);
175
139
  const gsiKeys = createGSIKeys(form);
176
- const items = [entity.putBatch(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, form), revisionKeys), gsiKeys), {}, {
140
+ const items = [entity.putBatch((0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({}, form), revisionKeys), gsiKeys), {}, {
177
141
  TYPE: createFormType()
178
- })), entity.putBatch(_objectSpread(_objectSpread(_objectSpread({}, form), latestKeys), {}, {
142
+ })), entity.putBatch((0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({}, form), latestKeys), {}, {
179
143
  TYPE: createFormLatestType()
180
144
  }))];
181
-
182
145
  try {
183
146
  await (0, _batchWrite.batchWriteAll)({
184
147
  table,
@@ -193,10 +156,8 @@ const createFormStorageOperations = params => {
193
156
  latest
194
157
  });
195
158
  }
196
-
197
159
  return form;
198
160
  };
199
-
200
161
  const updateForm = async params => {
201
162
  const {
202
163
  form,
@@ -219,16 +180,14 @@ const createFormStorageOperations = params => {
219
180
  }
220
181
  });
221
182
  const isLatestForm = latestForm ? latestForm.id === form.id : false;
222
- const items = [entity.putBatch(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, form), revisionKeys), gsiKeys), {}, {
183
+ const items = [entity.putBatch((0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({}, form), revisionKeys), gsiKeys), {}, {
223
184
  TYPE: createFormType()
224
185
  }))];
225
-
226
186
  if (isLatestForm) {
227
- items.push(entity.putBatch(_objectSpread(_objectSpread(_objectSpread({}, form), latestKeys), {}, {
187
+ items.push(entity.putBatch((0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({}, form), latestKeys), {}, {
228
188
  TYPE: createFormLatestType()
229
189
  })));
230
190
  }
231
-
232
191
  try {
233
192
  await (0, _batchWrite.batchWriteAll)({
234
193
  table,
@@ -243,10 +202,8 @@ const createFormStorageOperations = params => {
243
202
  latestForm
244
203
  });
245
204
  }
246
-
247
205
  return form;
248
206
  };
249
-
250
207
  const getForm = async params => {
251
208
  const {
252
209
  where
@@ -258,14 +215,11 @@ const createFormStorageOperations = params => {
258
215
  published,
259
216
  version
260
217
  } = where;
261
-
262
218
  if (latest && published) {
263
219
  throw new _error.default("Cannot have both latest and published params.");
264
220
  }
265
-
266
221
  let partitionKey;
267
222
  let sortKey;
268
-
269
223
  if (latest) {
270
224
  partitionKey = createFormLatestPartitionKey(where);
271
225
  sortKey = createFormLatestSortKey(where);
@@ -280,7 +234,7 @@ const createFormStorageOperations = params => {
280
234
  sortKey = createRevisionSortKey({
281
235
  id: id || (0, _utils.createIdentifier)({
282
236
  id: formId,
283
- version
237
+ version: version
284
238
  })
285
239
  });
286
240
  } else {
@@ -288,12 +242,10 @@ const createFormStorageOperations = params => {
288
242
  where
289
243
  });
290
244
  }
291
-
292
245
  const keys = {
293
246
  PK: partitionKey,
294
247
  SK: sortKey
295
248
  };
296
-
297
249
  try {
298
250
  const item = await (0, _get.get)({
299
251
  entity,
@@ -306,7 +258,6 @@ const createFormStorageOperations = params => {
306
258
  });
307
259
  }
308
260
  };
309
-
310
261
  const listForms = async params => {
311
262
  const {
312
263
  sort,
@@ -322,7 +273,6 @@ const createFormStorageOperations = params => {
322
273
  }
323
274
  };
324
275
  let results;
325
-
326
276
  try {
327
277
  results = await (0, _query.queryAll)(queryAllParams);
328
278
  } catch (ex) {
@@ -331,15 +281,11 @@ const createFormStorageOperations = params => {
331
281
  partitionKey: queryAllParams.partitionKey
332
282
  });
333
283
  }
334
-
335
284
  const totalCount = results.length;
336
-
337
- const where = _objectSpread({}, initialWhere);
285
+ const where = (0, _objectSpread2.default)({}, initialWhere);
338
286
  /**
339
287
  * We need to remove conditions so we do not filter by them again.
340
288
  */
341
-
342
-
343
289
  delete where.tenant;
344
290
  delete where.locale;
345
291
  const filteredItems = (0, _filter.filterItems)({
@@ -353,7 +299,7 @@ const createFormStorageOperations = params => {
353
299
  sort,
354
300
  fields: formDynamoDbFields
355
301
  });
356
- const start = (0, _cursor.decodeCursor)(after) || 0;
302
+ const start = parseInt((0, _cursor.decodeCursor)(after) || "0") || 0;
357
303
  const hasMoreItems = totalCount > start + limit;
358
304
  const end = limit > totalCount + start + limit ? undefined : start + limit;
359
305
  const items = sortedItems.slice(start, end);
@@ -361,7 +307,6 @@ const createFormStorageOperations = params => {
361
307
  * Although we do not need a cursor here, we will use it as such to keep it standardized.
362
308
  * Number is simply encoded.
363
309
  */
364
-
365
310
  const cursor = items.length > 0 ? (0, _cursor.encodeCursor)(start + limit) : null;
366
311
  const meta = {
367
312
  hasMoreItems,
@@ -373,7 +318,6 @@ const createFormStorageOperations = params => {
373
318
  meta
374
319
  };
375
320
  };
376
-
377
321
  const listFormRevisions = async params => {
378
322
  const {
379
323
  where: initialWhere,
@@ -398,7 +342,6 @@ const createFormStorageOperations = params => {
398
342
  }
399
343
  };
400
344
  let items = [];
401
-
402
345
  try {
403
346
  items = await (0, _query.queryAll)(queryAllParams);
404
347
  } catch (ex) {
@@ -407,13 +350,10 @@ const createFormStorageOperations = params => {
407
350
  options: queryAllParams.options
408
351
  });
409
352
  }
410
-
411
- const where = _objectSpread({}, initialWhere);
353
+ const where = (0, _objectSpread2.default)({}, initialWhere);
412
354
  /**
413
355
  * We need to remove conditions so we do not filter by them again.
414
356
  */
415
-
416
-
417
357
  delete where.id;
418
358
  delete where.formId;
419
359
  delete where.tenant;
@@ -430,24 +370,21 @@ const createFormStorageOperations = params => {
430
370
  fields: formDynamoDbFields
431
371
  });
432
372
  };
433
-
434
373
  const deleteForm = async params => {
435
374
  const {
436
375
  form
437
376
  } = params;
438
377
  let items;
439
378
  /**
440
- * This will find all form and submission records.
379
+ * This will find all form records.
441
380
  */
442
-
443
381
  const queryAllParams = {
444
382
  entity,
445
383
  partitionKey: createFormPartitionKey(form),
446
384
  options: {
447
- gte: " "
385
+ beginsWith: form.formId
448
386
  }
449
387
  };
450
-
451
388
  try {
452
389
  items = await (0, _query.queryAll)(queryAllParams);
453
390
  } catch (ex) {
@@ -456,25 +393,20 @@ const createFormStorageOperations = params => {
456
393
  options: queryAllParams.options
457
394
  });
458
395
  }
459
-
460
396
  let hasLatestPublishedRecord = false;
461
397
  const deleteItems = items.map(item => {
462
398
  if (!hasLatestPublishedRecord && item.published) {
463
399
  hasLatestPublishedRecord = true;
464
400
  }
465
-
466
401
  return entity.deleteBatch({
467
402
  PK: item.PK,
468
403
  SK: item.SK
469
404
  });
470
405
  });
471
-
472
406
  if (hasLatestPublishedRecord) {
473
407
  deleteItems.push(entity.deleteBatch(createLatestPublishedKeys(items[0])));
474
408
  }
475
-
476
409
  deleteItems.push(entity.deleteBatch(createLatestKeys(items[0])));
477
-
478
410
  try {
479
411
  await (0, _batchWrite.batchWriteAll)({
480
412
  table,
@@ -483,7 +415,6 @@ const createFormStorageOperations = params => {
483
415
  } catch (ex) {
484
416
  throw new _error.default(ex.message || "Could not delete form and it's submissions.", ex.code || "DELETE_FORM_AND_SUBMISSIONS_ERROR");
485
417
  }
486
-
487
418
  return form;
488
419
  };
489
420
  /**
@@ -492,8 +423,6 @@ const createFormStorageOperations = params => {
492
423
  * - get previously published revision and update the record if it exists or delete if it does not
493
424
  * - update latest record if current one is the latest
494
425
  */
495
-
496
-
497
426
  const deleteFormRevision = async params => {
498
427
  const {
499
428
  form,
@@ -507,7 +436,6 @@ const createFormStorageOperations = params => {
507
436
  const isLatest = latestForm ? latestForm.id === form.id : false;
508
437
  const isLatestPublished = latestPublishedForm ? latestPublishedForm.id === form.id : false;
509
438
  const items = [entity.deleteBatch(revisionKeys)];
510
-
511
439
  if (isLatest || isLatestPublished) {
512
440
  /**
513
441
  * Sort out the latest published record.
@@ -516,24 +444,21 @@ const createFormStorageOperations = params => {
516
444
  const previouslyPublishedForm = revisions.filter(f => !!f.publishedOn && f.version !== form.version).sort((a, b) => {
517
445
  return new Date(b.publishedOn).getTime() - new Date(a.publishedOn).getTime();
518
446
  }).shift();
519
-
520
447
  if (previouslyPublishedForm) {
521
- items.push(entity.putBatch(_objectSpread(_objectSpread(_objectSpread({}, previouslyPublishedForm), createLatestPublishedKeys(previouslyPublishedForm)), {}, {
448
+ items.push(entity.putBatch((0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({}, previouslyPublishedForm), createLatestPublishedKeys(previouslyPublishedForm)), {}, {
522
449
  GSI1_PK: null,
523
450
  GSI1_SK: null,
524
451
  TYPE: createFormLatestPublishedType()
525
452
  })));
526
453
  } else {
527
- items.push(entity.deleteBatch(createLatestPublishedKeys(previouslyPublishedForm)));
454
+ items.push(entity.deleteBatch(createLatestPublishedKeys(form)));
528
455
  }
529
456
  }
530
457
  /**
531
458
  * Sort out the latest record.
532
459
  */
533
-
534
-
535
460
  if (isLatest) {
536
- items.push(entity.putBatch(_objectSpread(_objectSpread(_objectSpread({}, previous), latestKeys), {}, {
461
+ items.push(entity.putBatch((0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({}, previous), latestKeys), {}, {
537
462
  GSI1_PK: null,
538
463
  GSI1_SK: null,
539
464
  TYPE: createFormLatestType()
@@ -543,8 +468,6 @@ const createFormStorageOperations = params => {
543
468
  /**
544
469
  * Now save the batch data.
545
470
  */
546
-
547
-
548
471
  try {
549
472
  await (0, _batchWrite.batchWriteAll)({
550
473
  table,
@@ -560,6 +483,7 @@ const createFormStorageOperations = params => {
560
483
  });
561
484
  }
562
485
  };
486
+
563
487
  /**
564
488
  * We need to save form in:
565
489
  * - regular form record
@@ -567,8 +491,6 @@ const createFormStorageOperations = params => {
567
491
  * - latest form record - if form is latest one
568
492
  * - elasticsearch latest form record
569
493
  */
570
-
571
-
572
494
  const publishForm = async params => {
573
495
  const {
574
496
  form,
@@ -598,22 +520,19 @@ const createFormStorageOperations = params => {
598
520
  /**
599
521
  * Update revision and latest published records
600
522
  */
601
-
602
- const items = [entity.putBatch(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, form), revisionKeys), gsiKeys), {}, {
523
+ const items = [entity.putBatch((0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({}, form), revisionKeys), gsiKeys), {}, {
603
524
  TYPE: createFormType()
604
- })), entity.putBatch(_objectSpread(_objectSpread(_objectSpread({}, form), latestPublishedKeys), {}, {
525
+ })), entity.putBatch((0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({}, form), latestPublishedKeys), {}, {
605
526
  TYPE: createFormLatestPublishedType()
606
527
  }))];
607
528
  /**
608
529
  * Update the latest form as well
609
530
  */
610
-
611
531
  if (isLatestForm) {
612
- items.push(entity.putBatch(_objectSpread(_objectSpread(_objectSpread({}, form), latestKeys), {}, {
532
+ items.push(entity.putBatch((0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({}, form), latestKeys), {}, {
613
533
  TYPE: createFormLatestType()
614
534
  })));
615
535
  }
616
-
617
536
  try {
618
537
  await (0, _batchWrite.batchWriteAll)({
619
538
  table,
@@ -629,17 +548,15 @@ const createFormStorageOperations = params => {
629
548
  latestPublishedKeys
630
549
  });
631
550
  }
632
-
633
551
  return form;
634
552
  };
553
+
635
554
  /**
636
555
  * We need to:
637
556
  * - update form revision record
638
557
  * - if latest published (LP) is current form, find the previously published record and update LP if there is some previously published, delete otherwise
639
558
  * - if is latest update the Elasticsearch record
640
559
  */
641
-
642
-
643
560
  const unpublishForm = async params => {
644
561
  const {
645
562
  form,
@@ -672,12 +589,11 @@ const createFormStorageOperations = params => {
672
589
  });
673
590
  const isLatest = latestForm ? latestForm.id === form.id : false;
674
591
  const isLatestPublished = latestPublishedForm ? latestPublishedForm.id === form.id : false;
675
- const items = [entity.putBatch(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, form), revisionKeys), gsiKeys), {}, {
592
+ const items = [entity.putBatch((0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({}, form), revisionKeys), gsiKeys), {}, {
676
593
  TYPE: createFormType()
677
594
  }))];
678
-
679
595
  if (isLatest) {
680
- entity.putBatch(_objectSpread(_objectSpread(_objectSpread({}, form), latestKeys), {}, {
596
+ entity.putBatch((0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({}, form), latestKeys), {}, {
681
597
  TYPE: createFormLatestType()
682
598
  }));
683
599
  }
@@ -685,8 +601,6 @@ const createFormStorageOperations = params => {
685
601
  * In case previously published revision exists, replace current one with that one.
686
602
  * And if it does not, delete the record.
687
603
  */
688
-
689
-
690
604
  if (isLatestPublished) {
691
605
  const revisions = await listFormRevisions({
692
606
  where: {
@@ -699,16 +613,14 @@ const createFormStorageOperations = params => {
699
613
  sort: ["savedOn_DESC"]
700
614
  });
701
615
  const previouslyPublishedRevision = revisions.shift();
702
-
703
616
  if (previouslyPublishedRevision) {
704
- items.push(entity.putBatch(_objectSpread(_objectSpread(_objectSpread({}, previouslyPublishedRevision), latestPublishedKeys), {}, {
617
+ items.push(entity.putBatch((0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({}, previouslyPublishedRevision), latestPublishedKeys), {}, {
705
618
  TYPE: createFormLatestPublishedType()
706
619
  })));
707
620
  } else {
708
621
  items.push(entity.deleteBatch(latestPublishedKeys));
709
622
  }
710
623
  }
711
-
712
624
  try {
713
625
  await (0, _batchWrite.batchWriteAll)({
714
626
  table,
@@ -726,7 +638,6 @@ const createFormStorageOperations = params => {
726
638
  });
727
639
  }
728
640
  };
729
-
730
641
  return {
731
642
  createForm,
732
643
  createFormFrom,
@@ -741,5 +652,4 @@ const createFormStorageOperations = params => {
741
652
  createFormPartitionKey
742
653
  };
743
654
  };
744
-
745
655
  exports.createFormStorageOperations = createFormStorageOperations;
@@ -0,0 +1 @@
1
+ {"version":3,"names":["createFormStorageOperations","params","entity","table","plugins","formDynamoDbFields","byType","FormDynamoDbFieldPlugin","type","createFormPartitionKey","tenant","locale","createFormLatestPartitionKey","createFormLatestPublishedPartitionKey","createFormGSIPartitionKey","id","targetId","parseIdentifier","createRevisionSortKey","createFormLatestSortKey","formId","value","createLatestPublishedSortKey","createGSISortKey","version","createFormType","createFormLatestType","createFormLatestPublishedType","createRevisionKeys","form","PK","SK","createLatestKeys","createLatestPublishedKeys","createGSIKeys","GSI1_PK","GSI1_SK","createForm","revisionKeys","latestKeys","gsiKeys","items","putBatch","TYPE","batchWriteAll","ex","WebinyError","message","code","createFormFrom","original","latest","updateForm","latestForm","getForm","where","isLatestForm","push","published","partitionKey","sortKey","createIdentifier","keys","item","get","cleanupItem","listForms","sort","limit","initialWhere","after","queryAllParams","options","gte","results","queryAll","totalCount","length","filteredItems","filterItems","fields","sortedItems","sortItems","start","parseInt","decodeCursor","hasMoreItems","end","undefined","slice","cursor","encodeCursor","meta","listFormRevisions","index","deleteForm","beginsWith","hasLatestPublishedRecord","deleteItems","map","deleteBatch","deleteFormRevision","revisions","previous","latestPublishedForm","find","rev","isLatest","isLatestPublished","previouslyPublishedForm","filter","f","publishedOn","a","b","Date","getTime","shift","publishForm","latestPublishedKeys","unpublishForm","version_not","publishedOn_not","previouslyPublishedRevision"],"sources":["index.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport {\n FbForm,\n FormBuilderStorageOperationsCreateFormFromParams,\n FormBuilderStorageOperationsCreateFormParams,\n FormBuilderStorageOperationsDeleteFormParams,\n FormBuilderStorageOperationsDeleteFormRevisionParams,\n FormBuilderStorageOperationsGetFormParams,\n FormBuilderStorageOperationsListFormRevisionsParams,\n FormBuilderStorageOperationsListFormRevisionsParamsWhere,\n FormBuilderStorageOperationsListFormsParams,\n FormBuilderStorageOperationsListFormsResponse,\n FormBuilderStorageOperationsPublishFormParams,\n FormBuilderStorageOperationsUnpublishFormParams,\n FormBuilderStorageOperationsUpdateFormParams\n} from \"@webiny/api-form-builder/types\";\nimport { Entity, Table } from \"dynamodb-toolbox\";\nimport { queryAll, QueryAllParams } from \"@webiny/db-dynamodb/utils/query\";\nimport { cleanupItem } from \"@webiny/db-dynamodb/utils/cleanup\";\nimport { batchWriteAll } from \"@webiny/db-dynamodb/utils/batchWrite\";\nimport { filterItems } from \"@webiny/db-dynamodb/utils/filter\";\nimport { sortItems } from \"@webiny/db-dynamodb/utils/sort\";\nimport { createIdentifier, parseIdentifier } from \"@webiny/utils\";\nimport { PluginsContainer } from \"@webiny/plugins\";\nimport {\n FormBuilderFormCreateGSIPartitionKeyParams,\n FormBuilderFormCreatePartitionKeyParams,\n FormBuilderFormStorageOperations\n} from \"~/types\";\nimport { FormDynamoDbFieldPlugin } from \"~/plugins/FormDynamoDbFieldPlugin\";\nimport { decodeCursor, encodeCursor } from \"@webiny/db-dynamodb/utils/cursor\";\nimport { get } from \"@webiny/db-dynamodb/utils/get\";\n\ntype DbRecord<T = any> = T & {\n PK: string;\n SK: string;\n TYPE: string;\n};\n\ninterface Keys {\n PK: string;\n SK: string;\n}\n\ninterface FormLatestSortKeyParams {\n id?: string;\n formId?: string;\n}\n\ninterface GsiKeys {\n GSI1_PK: string;\n GSI1_SK: string;\n}\n\nexport interface CreateFormStorageOperationsParams {\n entity: Entity<any>;\n table: Table;\n plugins: PluginsContainer;\n}\n\nexport const createFormStorageOperations = (\n params: CreateFormStorageOperationsParams\n): FormBuilderFormStorageOperations => {\n const { entity, table, plugins } = params;\n\n const formDynamoDbFields = plugins.byType<FormDynamoDbFieldPlugin>(\n FormDynamoDbFieldPlugin.type\n );\n\n const createFormPartitionKey = (params: FormBuilderFormCreatePartitionKeyParams): string => {\n const { tenant, locale } = params;\n\n return `T#${tenant}#L#${locale}#FB#F`;\n };\n\n const createFormLatestPartitionKey = (\n params: FormBuilderFormCreatePartitionKeyParams\n ): string => {\n return `${createFormPartitionKey(params)}#L`;\n };\n\n const createFormLatestPublishedPartitionKey = (\n params: FormBuilderFormCreatePartitionKeyParams\n ): string => {\n return `${createFormPartitionKey(params)}#LP`;\n };\n\n const createFormGSIPartitionKey = (\n params: FormBuilderFormCreateGSIPartitionKeyParams\n ): string => {\n const { tenant, locale, id: targetId } = params;\n const { id } = parseIdentifier(targetId);\n\n return `T#${tenant}#L#${locale}#FB#F#${id}`;\n };\n\n const createRevisionSortKey = ({ id }: { id: string }): string => {\n return `${id}`;\n };\n\n const createFormLatestSortKey = ({ id, formId }: FormLatestSortKeyParams): string => {\n const value = parseIdentifier(id || formId);\n return value.id;\n };\n\n const createLatestPublishedSortKey = ({ id, formId }: FormLatestSortKeyParams): string => {\n const value = parseIdentifier(id || formId);\n return value.id;\n };\n\n const createGSISortKey = (version: number) => {\n return `${version}`;\n };\n\n const createFormType = (): string => {\n return \"fb.form\";\n };\n\n const createFormLatestType = (): string => {\n return \"fb.form.latest\";\n };\n\n const createFormLatestPublishedType = (): string => {\n return \"fb.form.latestPublished\";\n };\n\n const createRevisionKeys = (form: FbForm): Keys => {\n return {\n PK: createFormPartitionKey(form),\n SK: createRevisionSortKey(form)\n };\n };\n\n const createLatestKeys = (form: FbForm): Keys => {\n return {\n PK: createFormLatestPartitionKey(form),\n SK: createFormLatestSortKey(form)\n };\n };\n\n const createLatestPublishedKeys = (form: FbForm): Keys => {\n return {\n PK: createFormLatestPublishedPartitionKey(form),\n SK: createLatestPublishedSortKey(form)\n };\n };\n\n const createGSIKeys = (form: FbForm): GsiKeys => {\n return {\n GSI1_PK: createFormGSIPartitionKey(form),\n GSI1_SK: createGSISortKey(form.version)\n };\n };\n\n const createForm = async (\n params: FormBuilderStorageOperationsCreateFormParams\n ): Promise<FbForm> => {\n const { form } = params;\n\n const revisionKeys = createRevisionKeys(form);\n const latestKeys = createLatestKeys(form);\n const gsiKeys = createGSIKeys(form);\n\n const items = [\n entity.putBatch({\n ...form,\n ...revisionKeys,\n ...gsiKeys,\n TYPE: createFormType()\n }),\n entity.putBatch({\n ...form,\n ...latestKeys,\n TYPE: createFormLatestType()\n })\n ];\n\n try {\n await batchWriteAll({\n table,\n items\n });\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not insert form data into table.\",\n ex.code || \"CREATE_FORM_ERROR\",\n {\n revisionKeys,\n latestKeys,\n form\n }\n );\n }\n return form;\n };\n\n const createFormFrom = async (\n params: FormBuilderStorageOperationsCreateFormFromParams\n ): Promise<FbForm> => {\n const { form, original, latest } = params;\n\n const revisionKeys = createRevisionKeys(form);\n const latestKeys = createLatestKeys(form);\n const gsiKeys = createGSIKeys(form);\n\n const items = [\n entity.putBatch({\n ...form,\n ...revisionKeys,\n ...gsiKeys,\n TYPE: createFormType()\n }),\n entity.putBatch({\n ...form,\n ...latestKeys,\n TYPE: createFormLatestType()\n })\n ];\n\n try {\n await batchWriteAll({\n table,\n items\n });\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not create form data in the table, from existing form.\",\n ex.code || \"CREATE_FORM_FROM_ERROR\",\n {\n revisionKeys,\n latestKeys,\n original,\n form,\n latest\n }\n );\n }\n\n return form;\n };\n\n const updateForm = async (\n params: FormBuilderStorageOperationsUpdateFormParams\n ): Promise<FbForm> => {\n const { form, original } = params;\n\n const revisionKeys = createRevisionKeys(form);\n const latestKeys = createLatestKeys(form);\n const gsiKeys = createGSIKeys(form);\n\n const { formId, tenant, locale } = form;\n\n const latestForm = await getForm({\n where: {\n formId,\n tenant,\n locale,\n latest: true\n }\n });\n const isLatestForm = latestForm ? latestForm.id === form.id : false;\n\n const items = [\n entity.putBatch({\n ...form,\n ...revisionKeys,\n ...gsiKeys,\n TYPE: createFormType()\n })\n ];\n if (isLatestForm) {\n items.push(\n entity.putBatch({\n ...form,\n ...latestKeys,\n TYPE: createFormLatestType()\n })\n );\n }\n try {\n await batchWriteAll({\n table,\n items\n });\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not update form data in the table.\",\n ex.code || \"UPDATE_FORM_ERROR\",\n {\n revisionKeys,\n latestKeys,\n original,\n form,\n latestForm\n }\n );\n }\n\n return form;\n };\n\n const getForm = async (\n params: FormBuilderStorageOperationsGetFormParams\n ): Promise<FbForm | null> => {\n const { where } = params;\n const { id, formId, latest, published, version } = where;\n if (latest && published) {\n throw new WebinyError(\"Cannot have both latest and published params.\");\n }\n let partitionKey: string;\n let sortKey: string;\n if (latest) {\n partitionKey = createFormLatestPartitionKey(where);\n sortKey = createFormLatestSortKey(where);\n } else if (published && !version) {\n /**\n * Because of the specifics how DynamoDB works, we must not load the published record if version is sent.\n */\n partitionKey = createFormLatestPublishedPartitionKey(where);\n sortKey = createLatestPublishedSortKey(where);\n } else if (id || version) {\n partitionKey = createFormPartitionKey(where);\n sortKey = createRevisionSortKey({\n id:\n id ||\n createIdentifier({\n id: formId as string,\n version: version as number\n })\n });\n } else {\n throw new WebinyError(\n \"Missing parameter to create a sort key.\",\n \"MISSING_WHERE_PARAMETER\",\n {\n where\n }\n );\n }\n\n const keys = {\n PK: partitionKey,\n SK: sortKey\n };\n\n try {\n const item = await get<FbForm>({ entity, keys });\n return cleanupItem(entity, item);\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not get form by keys.\",\n ex.code || \"GET_FORM_ERROR\",\n {\n keys\n }\n );\n }\n };\n\n const listForms = async (\n params: FormBuilderStorageOperationsListFormsParams\n ): Promise<FormBuilderStorageOperationsListFormsResponse> => {\n const { sort, limit, where: initialWhere, after } = params;\n\n const queryAllParams: QueryAllParams = {\n entity,\n partitionKey: createFormLatestPartitionKey(initialWhere),\n options: {\n gte: \" \"\n }\n };\n\n let results;\n try {\n results = await queryAll<FbForm>(queryAllParams);\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could list forms.\",\n ex.code || \"LIST_FORMS_ERROR\",\n {\n where: initialWhere,\n partitionKey: queryAllParams.partitionKey\n }\n );\n }\n const totalCount = results.length;\n\n const where: Partial<FormBuilderStorageOperationsListFormsParams[\"where\"]> = {\n ...initialWhere\n };\n /**\n * We need to remove conditions so we do not filter by them again.\n */\n delete where.tenant;\n delete where.locale;\n\n const filteredItems = filterItems({\n plugins,\n items: results,\n where,\n fields: formDynamoDbFields\n });\n\n const sortedItems = sortItems({\n items: filteredItems,\n sort,\n fields: formDynamoDbFields\n });\n\n const start = parseInt(decodeCursor(after) || \"0\") || 0;\n const hasMoreItems = totalCount > start + limit;\n const end = limit > totalCount + start + limit ? undefined : start + limit;\n const items = sortedItems.slice(start, end);\n /**\n * Although we do not need a cursor here, we will use it as such to keep it standardized.\n * Number is simply encoded.\n */\n const cursor = items.length > 0 ? encodeCursor(start + limit) : null;\n\n const meta = {\n hasMoreItems,\n totalCount,\n cursor\n };\n\n return {\n items,\n meta\n };\n };\n\n const listFormRevisions = async (\n params: FormBuilderStorageOperationsListFormRevisionsParams\n ): Promise<FbForm[]> => {\n const { where: initialWhere, sort } = params;\n const { id, formId, tenant, locale } = initialWhere;\n\n const queryAllParams: QueryAllParams = {\n entity,\n partitionKey: createFormGSIPartitionKey({\n tenant,\n locale,\n id: formId || id\n }),\n options: {\n index: \"GSI1\",\n gte: \" \"\n }\n };\n\n let items: FbForm[] = [];\n try {\n items = await queryAll<FbForm>(queryAllParams);\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not query forms by given params.\",\n ex.code || \"QUERY_FORMS_ERROR\",\n {\n partitionKey: queryAllParams.partitionKey,\n options: queryAllParams.options\n }\n );\n }\n const where: Partial<FormBuilderStorageOperationsListFormRevisionsParamsWhere> = {\n ...initialWhere\n };\n /**\n * We need to remove conditions so we do not filter by them again.\n */\n delete where.id;\n delete where.formId;\n delete where.tenant;\n delete where.locale;\n\n const filteredItems = filterItems({\n plugins,\n items,\n where,\n fields: formDynamoDbFields\n });\n return sortItems({\n items: filteredItems,\n sort,\n fields: formDynamoDbFields\n });\n };\n\n const deleteForm = async (\n params: FormBuilderStorageOperationsDeleteFormParams\n ): Promise<FbForm> => {\n const { form } = params;\n let items: any[];\n /**\n * This will find all form records.\n */\n const queryAllParams: QueryAllParams = {\n entity,\n partitionKey: createFormPartitionKey(form),\n options: {\n beginsWith: form.formId\n }\n };\n try {\n items = await queryAll<DbRecord>(queryAllParams);\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not query forms and submissions by given params.\",\n ex.code || \"QUERY_FORM_AND_SUBMISSIONS_ERROR\",\n {\n partitionKey: queryAllParams.partitionKey,\n options: queryAllParams.options\n }\n );\n }\n\n let hasLatestPublishedRecord = false;\n\n const deleteItems = items.map(item => {\n if (!hasLatestPublishedRecord && item.published) {\n hasLatestPublishedRecord = true;\n }\n return entity.deleteBatch({\n PK: item.PK,\n SK: item.SK\n });\n });\n if (hasLatestPublishedRecord) {\n deleteItems.push(entity.deleteBatch(createLatestPublishedKeys(items[0])));\n }\n\n deleteItems.push(entity.deleteBatch(createLatestKeys(items[0])));\n\n try {\n await batchWriteAll({\n table,\n items: deleteItems\n });\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not delete form and it's submissions.\",\n ex.code || \"DELETE_FORM_AND_SUBMISSIONS_ERROR\"\n );\n }\n return form;\n };\n /**\n * We need to:\n * - delete current revision\n * - get previously published revision and update the record if it exists or delete if it does not\n * - update latest record if current one is the latest\n */\n const deleteFormRevision = async (\n params: FormBuilderStorageOperationsDeleteFormRevisionParams\n ): Promise<FbForm> => {\n const { form, revisions, previous } = params;\n\n const revisionKeys = createRevisionKeys(form);\n const latestKeys = createLatestKeys(form);\n\n const latestForm = revisions[0];\n const latestPublishedForm = revisions.find(rev => rev.published === true);\n\n const isLatest = latestForm ? latestForm.id === form.id : false;\n const isLatestPublished = latestPublishedForm ? latestPublishedForm.id === form.id : false;\n\n const items = [entity.deleteBatch(revisionKeys)];\n\n if (isLatest || isLatestPublished) {\n /**\n * Sort out the latest published record.\n */\n if (isLatestPublished) {\n const previouslyPublishedForm = revisions\n .filter(f => !!f.publishedOn && f.version !== form.version)\n .sort((a, b) => {\n return (\n new Date(b.publishedOn as string).getTime() -\n new Date(a.publishedOn as string).getTime()\n );\n })\n .shift();\n if (previouslyPublishedForm) {\n items.push(\n entity.putBatch({\n ...previouslyPublishedForm,\n ...createLatestPublishedKeys(previouslyPublishedForm),\n GSI1_PK: null,\n GSI1_SK: null,\n TYPE: createFormLatestPublishedType()\n })\n );\n } else {\n items.push(entity.deleteBatch(createLatestPublishedKeys(form)));\n }\n }\n /**\n * Sort out the latest record.\n */\n if (isLatest) {\n items.push(\n entity.putBatch({\n ...previous,\n ...latestKeys,\n GSI1_PK: null,\n GSI1_SK: null,\n TYPE: createFormLatestType()\n })\n );\n }\n }\n /**\n * Now save the batch data.\n */\n try {\n await batchWriteAll({\n table,\n items\n });\n return form;\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not delete form revision from table.\",\n ex.code || \"DELETE_FORM_REVISION_ERROR\",\n {\n form,\n latestForm,\n revisionKeys,\n latestKeys\n }\n );\n }\n };\n\n /**\n * We need to save form in:\n * - regular form record\n * - latest published form record\n * - latest form record - if form is latest one\n * - elasticsearch latest form record\n */\n const publishForm = async (\n params: FormBuilderStorageOperationsPublishFormParams\n ): Promise<FbForm> => {\n const { form, original } = params;\n\n const revisionKeys = createRevisionKeys(form);\n\n const latestKeys = createLatestKeys(form);\n\n const latestPublishedKeys = createLatestPublishedKeys(form);\n\n const gsiKeys = {\n GSI1_PK: createFormGSIPartitionKey(form),\n GSI1_SK: createGSISortKey(form.version)\n };\n\n const { locale, tenant, formId } = form;\n\n const latestForm = await getForm({\n where: {\n formId,\n tenant,\n locale,\n latest: true\n }\n });\n\n const isLatestForm = latestForm ? latestForm.id === form.id : false;\n /**\n * Update revision and latest published records\n */\n const items = [\n entity.putBatch({\n ...form,\n ...revisionKeys,\n ...gsiKeys,\n TYPE: createFormType()\n }),\n entity.putBatch({\n ...form,\n ...latestPublishedKeys,\n TYPE: createFormLatestPublishedType()\n })\n ];\n /**\n * Update the latest form as well\n */\n if (isLatestForm) {\n items.push(\n entity.putBatch({\n ...form,\n ...latestKeys,\n TYPE: createFormLatestType()\n })\n );\n }\n\n try {\n await batchWriteAll({\n table,\n items\n });\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not publish form.\",\n ex.code || \"PUBLISH_FORM_ERROR\",\n {\n form,\n original,\n latestForm,\n revisionKeys,\n latestKeys,\n latestPublishedKeys\n }\n );\n }\n return form;\n };\n\n /**\n * We need to:\n * - update form revision record\n * - if latest published (LP) is current form, find the previously published record and update LP if there is some previously published, delete otherwise\n * - if is latest update the Elasticsearch record\n */\n const unpublishForm = async (\n params: FormBuilderStorageOperationsUnpublishFormParams\n ): Promise<FbForm> => {\n const { form, original } = params;\n\n const revisionKeys = createRevisionKeys(form);\n const latestKeys = createLatestKeys(form);\n const latestPublishedKeys = createLatestPublishedKeys(form);\n const gsiKeys = createGSIKeys(form);\n\n const { formId, tenant, locale } = form;\n\n const latestForm = await getForm({\n where: {\n formId,\n tenant,\n locale,\n latest: true\n }\n });\n\n const latestPublishedForm = await getForm({\n where: {\n formId,\n tenant,\n locale,\n published: true\n }\n });\n\n const isLatest = latestForm ? latestForm.id === form.id : false;\n const isLatestPublished = latestPublishedForm ? latestPublishedForm.id === form.id : false;\n\n const items = [\n entity.putBatch({\n ...form,\n ...revisionKeys,\n ...gsiKeys,\n TYPE: createFormType()\n })\n ];\n\n if (isLatest) {\n entity.putBatch({\n ...form,\n ...latestKeys,\n TYPE: createFormLatestType()\n });\n }\n /**\n * In case previously published revision exists, replace current one with that one.\n * And if it does not, delete the record.\n */\n if (isLatestPublished) {\n const revisions = await listFormRevisions({\n where: {\n formId,\n tenant,\n locale,\n version_not: form.version,\n publishedOn_not: null\n },\n sort: [\"savedOn_DESC\"]\n });\n\n const previouslyPublishedRevision = revisions.shift();\n if (previouslyPublishedRevision) {\n items.push(\n entity.putBatch({\n ...previouslyPublishedRevision,\n ...latestPublishedKeys,\n TYPE: createFormLatestPublishedType()\n })\n );\n } else {\n items.push(entity.deleteBatch(latestPublishedKeys));\n }\n }\n\n try {\n await batchWriteAll({\n table,\n items\n });\n return form;\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not unpublish form.\",\n ex.code || \"UNPUBLISH_FORM_ERROR\",\n {\n form,\n original,\n latestForm,\n revisionKeys,\n latestKeys,\n latestPublishedKeys\n }\n );\n }\n };\n\n return {\n createForm,\n createFormFrom,\n updateForm,\n listForms,\n listFormRevisions,\n getForm,\n deleteForm,\n deleteFormRevision,\n publishForm,\n unpublishForm,\n createFormPartitionKey\n };\n};\n"],"mappings":";;;;;;;;AAAA;AAiBA;AACA;AACA;AACA;AACA;AACA;AAOA;AACA;AACA;AA6BO,MAAMA,2BAA2B,GACpCC,MAAyC,IACN;EACnC,MAAM;IAAEC,MAAM;IAAEC,KAAK;IAAEC;EAAQ,CAAC,GAAGH,MAAM;EAEzC,MAAMI,kBAAkB,GAAGD,OAAO,CAACE,MAAM,CACrCC,gDAAuB,CAACC,IAAI,CAC/B;EAED,MAAMC,sBAAsB,GAAIR,MAA+C,IAAa;IACxF,MAAM;MAAES,MAAM;MAAEC;IAAO,CAAC,GAAGV,MAAM;IAEjC,OAAQ,KAAIS,MAAO,MAAKC,MAAO,OAAM;EACzC,CAAC;EAED,MAAMC,4BAA4B,GAC9BX,MAA+C,IACtC;IACT,OAAQ,GAAEQ,sBAAsB,CAACR,MAAM,CAAE,IAAG;EAChD,CAAC;EAED,MAAMY,qCAAqC,GACvCZ,MAA+C,IACtC;IACT,OAAQ,GAAEQ,sBAAsB,CAACR,MAAM,CAAE,KAAI;EACjD,CAAC;EAED,MAAMa,yBAAyB,GAC3Bb,MAAkD,IACzC;IACT,MAAM;MAAES,MAAM;MAAEC,MAAM;MAAEI,EAAE,EAAEC;IAAS,CAAC,GAAGf,MAAM;IAC/C,MAAM;MAAEc;IAAG,CAAC,GAAG,IAAAE,sBAAe,EAACD,QAAQ,CAAC;IAExC,OAAQ,KAAIN,MAAO,MAAKC,MAAO,SAAQI,EAAG,EAAC;EAC/C,CAAC;EAED,MAAMG,qBAAqB,GAAG,CAAC;IAAEH;EAAmB,CAAC,KAAa;IAC9D,OAAQ,GAAEA,EAAG,EAAC;EAClB,CAAC;EAED,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,CAAC;AACL,CAAC;AAAC"}
@@ -1,7 +1,7 @@
1
1
  import { Entity, Table } from "dynamodb-toolbox";
2
2
  import { FormBuilderSettingsStorageOperations } from "../../types";
3
- export interface Params {
3
+ export interface CreateSettingsStorageOperationsParams {
4
4
  entity: Entity<any>;
5
5
  table: Table;
6
6
  }
7
- export declare const createSettingsStorageOperations: (params: Params) => FormBuilderSettingsStorageOperations;
7
+ export declare const createSettingsStorageOperations: (params: CreateSettingsStorageOperationsParams) => FormBuilderSettingsStorageOperations;