@webiny/api-form-builder-so-ddb 5.41.4-beta.3 → 5.41.4-beta.5
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/operations/form/index.d.ts +3 -3
- package/operations/form/index.js +95 -95
- package/operations/form/index.js.map +1 -1
- package/package.json +11 -11
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Entity, Table } from "@webiny/db-dynamodb/toolbox";
|
|
2
|
-
import { PluginsContainer } from "@webiny/plugins";
|
|
3
|
-
import { FormBuilderFormStorageOperations } from "../../types";
|
|
1
|
+
import type { Entity, Table } from "@webiny/db-dynamodb/toolbox";
|
|
2
|
+
import type { PluginsContainer } from "@webiny/plugins";
|
|
3
|
+
import type { FormBuilderFormStorageOperations } from "../../types";
|
|
4
4
|
export interface CreateFormStorageOperationsParams {
|
|
5
5
|
entity: Entity<any>;
|
|
6
6
|
table: Table<string, string, string>;
|
package/operations/form/index.js
CHANGED
|
@@ -7,7 +7,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.createFormStorageOperations = void 0;
|
|
8
8
|
var _error = _interopRequireDefault(require("@webiny/error"));
|
|
9
9
|
var _query = require("@webiny/db-dynamodb/utils/query");
|
|
10
|
-
var
|
|
10
|
+
var _dbDynamodb = require("@webiny/db-dynamodb");
|
|
11
11
|
var _filter = require("@webiny/db-dynamodb/utils/filter");
|
|
12
12
|
var _sort = require("@webiny/db-dynamodb/utils/sort");
|
|
13
13
|
var _utils = require("@webiny/utils");
|
|
@@ -17,7 +17,6 @@ var _get = require("@webiny/db-dynamodb/utils/get");
|
|
|
17
17
|
const createFormStorageOperations = params => {
|
|
18
18
|
const {
|
|
19
19
|
entity,
|
|
20
|
-
table,
|
|
21
20
|
plugins
|
|
22
21
|
} = params;
|
|
23
22
|
const formDynamoDbFields = plugins.byType(_FormDynamoDbFieldPlugin.FormDynamoDbFieldPlugin.type);
|
|
@@ -107,21 +106,21 @@ const createFormStorageOperations = params => {
|
|
|
107
106
|
const revisionKeys = createRevisionKeys(form);
|
|
108
107
|
const latestKeys = createLatestKeys(form);
|
|
109
108
|
const gsiKeys = createGSIKeys(form);
|
|
110
|
-
const
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
109
|
+
const entityBatch = (0, _dbDynamodb.createEntityWriteBatch)({
|
|
110
|
+
entity,
|
|
111
|
+
put: [{
|
|
112
|
+
...form,
|
|
113
|
+
...revisionKeys,
|
|
114
|
+
...gsiKeys,
|
|
115
|
+
TYPE: createFormType()
|
|
116
|
+
}, {
|
|
117
|
+
...form,
|
|
118
|
+
...latestKeys,
|
|
119
|
+
TYPE: createFormLatestType()
|
|
120
|
+
}]
|
|
121
|
+
});
|
|
120
122
|
try {
|
|
121
|
-
await (
|
|
122
|
-
table,
|
|
123
|
-
items
|
|
124
|
-
});
|
|
123
|
+
await entityBatch.execute();
|
|
125
124
|
} catch (ex) {
|
|
126
125
|
throw new _error.default(ex.message || "Could not insert form data into table.", ex.code || "CREATE_FORM_ERROR", {
|
|
127
126
|
revisionKeys,
|
|
@@ -140,21 +139,21 @@ const createFormStorageOperations = params => {
|
|
|
140
139
|
const revisionKeys = createRevisionKeys(form);
|
|
141
140
|
const latestKeys = createLatestKeys(form);
|
|
142
141
|
const gsiKeys = createGSIKeys(form);
|
|
143
|
-
const
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
142
|
+
const entityBatch = (0, _dbDynamodb.createEntityWriteBatch)({
|
|
143
|
+
entity,
|
|
144
|
+
put: [{
|
|
145
|
+
...form,
|
|
146
|
+
...revisionKeys,
|
|
147
|
+
...gsiKeys,
|
|
148
|
+
TYPE: createFormType()
|
|
149
|
+
}, {
|
|
150
|
+
...form,
|
|
151
|
+
...latestKeys,
|
|
152
|
+
TYPE: createFormLatestType()
|
|
153
|
+
}]
|
|
154
|
+
});
|
|
153
155
|
try {
|
|
154
|
-
await (
|
|
155
|
-
table,
|
|
156
|
-
items
|
|
157
|
-
});
|
|
156
|
+
await entityBatch.execute();
|
|
158
157
|
} catch (ex) {
|
|
159
158
|
throw new _error.default(ex.message || "Could not create form data in the table, from existing form.", ex.code || "CREATE_FORM_FROM_ERROR", {
|
|
160
159
|
revisionKeys,
|
|
@@ -188,24 +187,24 @@ const createFormStorageOperations = params => {
|
|
|
188
187
|
}
|
|
189
188
|
});
|
|
190
189
|
const isLatestForm = latestForm ? latestForm.id === form.id : false;
|
|
191
|
-
const
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
190
|
+
const entityBatch = (0, _dbDynamodb.createEntityWriteBatch)({
|
|
191
|
+
entity,
|
|
192
|
+
put: [{
|
|
193
|
+
...form,
|
|
194
|
+
...revisionKeys,
|
|
195
|
+
...gsiKeys,
|
|
196
|
+
TYPE: createFormType()
|
|
197
|
+
}]
|
|
198
|
+
});
|
|
197
199
|
if (isLatestForm) {
|
|
198
|
-
|
|
200
|
+
entityBatch.put({
|
|
199
201
|
...form,
|
|
200
202
|
...latestKeys,
|
|
201
203
|
TYPE: createFormLatestType()
|
|
202
|
-
})
|
|
204
|
+
});
|
|
203
205
|
}
|
|
204
206
|
try {
|
|
205
|
-
await (
|
|
206
|
-
table,
|
|
207
|
-
items
|
|
208
|
-
});
|
|
207
|
+
await entityBatch.execute();
|
|
209
208
|
} catch (ex) {
|
|
210
209
|
throw new _error.default(ex.message || "Could not update form data in the table.", ex.code || "UPDATE_FORM_ERROR", {
|
|
211
210
|
revisionKeys,
|
|
@@ -409,25 +408,25 @@ const createFormStorageOperations = params => {
|
|
|
409
408
|
options: queryAllParams.options
|
|
410
409
|
});
|
|
411
410
|
}
|
|
412
|
-
let
|
|
413
|
-
const
|
|
414
|
-
|
|
415
|
-
|
|
411
|
+
let latestPublishedKeys;
|
|
412
|
+
const entityBatch = (0, _dbDynamodb.createEntityWriteBatch)({
|
|
413
|
+
entity,
|
|
414
|
+
delete: [createLatestKeys(form)]
|
|
415
|
+
});
|
|
416
|
+
for (const item of items) {
|
|
417
|
+
if (!latestPublishedKeys && item.published) {
|
|
418
|
+
latestPublishedKeys = createLatestPublishedKeys(item);
|
|
416
419
|
}
|
|
417
|
-
|
|
420
|
+
entityBatch.delete({
|
|
418
421
|
PK: item.PK,
|
|
419
422
|
SK: item.SK
|
|
420
423
|
});
|
|
421
|
-
});
|
|
422
|
-
if (hasLatestPublishedRecord) {
|
|
423
|
-
deleteItems.push(entity.deleteBatch(createLatestPublishedKeys(items[0])));
|
|
424
424
|
}
|
|
425
|
-
|
|
425
|
+
if (latestPublishedKeys) {
|
|
426
|
+
entityBatch.delete(latestPublishedKeys);
|
|
427
|
+
}
|
|
426
428
|
try {
|
|
427
|
-
await (
|
|
428
|
-
table,
|
|
429
|
-
items: deleteItems
|
|
430
|
-
});
|
|
429
|
+
await entityBatch.execute();
|
|
431
430
|
} catch (ex) {
|
|
432
431
|
throw new _error.default(ex.message || "Could not delete form and it's submissions.", ex.code || "DELETE_FORM_AND_SUBMISSIONS_ERROR");
|
|
433
432
|
}
|
|
@@ -451,7 +450,10 @@ const createFormStorageOperations = params => {
|
|
|
451
450
|
const latestPublishedForm = revisions.find(rev => rev.published === true);
|
|
452
451
|
const isLatest = latestForm ? latestForm.id === form.id : false;
|
|
453
452
|
const isLatestPublished = latestPublishedForm ? latestPublishedForm.id === form.id : false;
|
|
454
|
-
const
|
|
453
|
+
const entityBatch = (0, _dbDynamodb.createEntityWriteBatch)({
|
|
454
|
+
entity,
|
|
455
|
+
delete: [revisionKeys]
|
|
456
|
+
});
|
|
455
457
|
if (isLatest || isLatestPublished) {
|
|
456
458
|
/**
|
|
457
459
|
* Sort out the latest published record.
|
|
@@ -461,38 +463,35 @@ const createFormStorageOperations = params => {
|
|
|
461
463
|
return new Date(b.publishedOn).getTime() - new Date(a.publishedOn).getTime();
|
|
462
464
|
}).shift();
|
|
463
465
|
if (previouslyPublishedForm) {
|
|
464
|
-
|
|
466
|
+
entityBatch.put({
|
|
465
467
|
...previouslyPublishedForm,
|
|
466
468
|
...createLatestPublishedKeys(previouslyPublishedForm),
|
|
467
469
|
GSI1_PK: null,
|
|
468
470
|
GSI1_SK: null,
|
|
469
471
|
TYPE: createFormLatestPublishedType()
|
|
470
|
-
})
|
|
472
|
+
});
|
|
471
473
|
} else {
|
|
472
|
-
|
|
474
|
+
entityBatch.delete(createLatestPublishedKeys(form));
|
|
473
475
|
}
|
|
474
476
|
}
|
|
475
477
|
/**
|
|
476
478
|
* Sort out the latest record.
|
|
477
479
|
*/
|
|
478
480
|
if (isLatest) {
|
|
479
|
-
|
|
481
|
+
entityBatch.put({
|
|
480
482
|
...previous,
|
|
481
483
|
...latestKeys,
|
|
482
484
|
GSI1_PK: null,
|
|
483
485
|
GSI1_SK: null,
|
|
484
486
|
TYPE: createFormLatestType()
|
|
485
|
-
})
|
|
487
|
+
});
|
|
486
488
|
}
|
|
487
489
|
}
|
|
488
490
|
/**
|
|
489
491
|
* Now save the batch data.
|
|
490
492
|
*/
|
|
491
493
|
try {
|
|
492
|
-
await (
|
|
493
|
-
table,
|
|
494
|
-
items
|
|
495
|
-
});
|
|
494
|
+
await entityBatch.execute();
|
|
496
495
|
return form;
|
|
497
496
|
} catch (ex) {
|
|
498
497
|
throw new _error.default(ex.message || "Could not delete form revision from table.", ex.code || "DELETE_FORM_REVISION_ERROR", {
|
|
@@ -540,31 +539,32 @@ const createFormStorageOperations = params => {
|
|
|
540
539
|
/**
|
|
541
540
|
* Update revision and latest published records
|
|
542
541
|
*/
|
|
543
|
-
const
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
542
|
+
const entityBatch = (0, _dbDynamodb.createEntityWriteBatch)({
|
|
543
|
+
entity,
|
|
544
|
+
put: [{
|
|
545
|
+
...form,
|
|
546
|
+
...revisionKeys,
|
|
547
|
+
...gsiKeys,
|
|
548
|
+
TYPE: createFormType()
|
|
549
|
+
}, {
|
|
550
|
+
...form,
|
|
551
|
+
...latestPublishedKeys,
|
|
552
|
+
TYPE: createFormLatestPublishedType()
|
|
553
|
+
}]
|
|
554
|
+
});
|
|
555
|
+
|
|
553
556
|
/**
|
|
554
557
|
* Update the latest form as well
|
|
555
558
|
*/
|
|
556
559
|
if (isLatestForm) {
|
|
557
|
-
|
|
560
|
+
entityBatch.put({
|
|
558
561
|
...form,
|
|
559
562
|
...latestKeys,
|
|
560
563
|
TYPE: createFormLatestType()
|
|
561
|
-
})
|
|
564
|
+
});
|
|
562
565
|
}
|
|
563
566
|
try {
|
|
564
|
-
await (
|
|
565
|
-
table,
|
|
566
|
-
items
|
|
567
|
-
});
|
|
567
|
+
await entityBatch.execute();
|
|
568
568
|
} catch (ex) {
|
|
569
569
|
throw new _error.default(ex.message || "Could not publish form.", ex.code || "PUBLISH_FORM_ERROR", {
|
|
570
570
|
form,
|
|
@@ -616,14 +616,17 @@ const createFormStorageOperations = params => {
|
|
|
616
616
|
});
|
|
617
617
|
const isLatest = latestForm ? latestForm.id === form.id : false;
|
|
618
618
|
const isLatestPublished = latestPublishedForm ? latestPublishedForm.id === form.id : false;
|
|
619
|
-
const
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
619
|
+
const entityBatch = (0, _dbDynamodb.createEntityWriteBatch)({
|
|
620
|
+
entity,
|
|
621
|
+
put: [{
|
|
622
|
+
...form,
|
|
623
|
+
...revisionKeys,
|
|
624
|
+
...gsiKeys,
|
|
625
|
+
TYPE: createFormType()
|
|
626
|
+
}]
|
|
627
|
+
});
|
|
625
628
|
if (isLatest) {
|
|
626
|
-
|
|
629
|
+
entityBatch.put({
|
|
627
630
|
...form,
|
|
628
631
|
...latestKeys,
|
|
629
632
|
TYPE: createFormLatestType()
|
|
@@ -646,20 +649,17 @@ const createFormStorageOperations = params => {
|
|
|
646
649
|
});
|
|
647
650
|
const previouslyPublishedRevision = revisions.shift();
|
|
648
651
|
if (previouslyPublishedRevision) {
|
|
649
|
-
|
|
652
|
+
entityBatch.put({
|
|
650
653
|
...previouslyPublishedRevision,
|
|
651
654
|
...latestPublishedKeys,
|
|
652
655
|
TYPE: createFormLatestPublishedType()
|
|
653
|
-
})
|
|
656
|
+
});
|
|
654
657
|
} else {
|
|
655
|
-
|
|
658
|
+
entityBatch.delete(latestPublishedKeys);
|
|
656
659
|
}
|
|
657
660
|
}
|
|
658
661
|
try {
|
|
659
|
-
await (
|
|
660
|
-
table,
|
|
661
|
-
items
|
|
662
|
-
});
|
|
662
|
+
await entityBatch.execute();
|
|
663
663
|
return form;
|
|
664
664
|
} catch (ex) {
|
|
665
665
|
throw new _error.default(ex.message || "Could not unpublish form.", ex.code || "UNPUBLISH_FORM_ERROR", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_error","_interopRequireDefault","require","_query","_batchWrite","_filter","_sort","_utils","_FormDynamoDbFieldPlugin","_cursor","_get","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","getClean","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","item","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","exports"],"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 \"@webiny/db-dynamodb/toolbox\";\nimport { queryAll, QueryAllParams } from \"@webiny/db-dynamodb/utils/query\";\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 { getClean } 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<string, string, string>;\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 return await getClean<FbForm>({ entity, keys });\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 || undefined\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,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAiBA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AAOA,IAAAM,wBAAA,GAAAN,OAAA;AACA,IAAAO,OAAA,GAAAP,OA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ZC,UAAU;QACV+E;MACJ,CACJ,CAAC;IACL;EACJ,CAAC;EAED,OAAO;IACHjF,UAAU;IACVY,cAAc;IACdG,UAAU;IACVY,SAAS;IACT2B,iBAAiB;IACjBrC,OAAO;IACPuC,UAAU;IACVO,kBAAkB;IAClBiB,WAAW;IACXE,aAAa;IACb9G;EACJ,CAAC;AACL,CAAC;AAACkH,OAAA,CAAA3H,2BAAA,GAAAA,2BAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_error","_interopRequireDefault","require","_query","_dbDynamodb","_filter","_sort","_utils","_FormDynamoDbFieldPlugin","_cursor","_get","createFormStorageOperations","params","entity","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","entityBatch","createEntityWriteBatch","put","TYPE","execute","ex","WebinyError","message","code","createFormFrom","original","latest","updateForm","latestForm","getForm","where","isLatestForm","published","partitionKey","sortKey","createIdentifier","keys","getClean","listForms","sort","limit","initialWhere","after","queryAllParams","options","gte","results","queryAll","totalCount","length","filteredItems","filterItems","items","fields","sortedItems","sortItems","start","parseInt","decodeCursor","hasMoreItems","end","undefined","slice","cursor","encodeCursor","meta","listFormRevisions","index","deleteForm","beginsWith","latestPublishedKeys","delete","item","deleteFormRevision","revisions","previous","latestPublishedForm","find","rev","isLatest","isLatestPublished","previouslyPublishedForm","filter","f","publishedOn","a","b","Date","getTime","shift","publishForm","unpublishForm","version_not","publishedOn_not","previouslyPublishedRevision","exports"],"sources":["index.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport type {\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 type { Entity, Table } from \"@webiny/db-dynamodb/toolbox\";\nimport { queryAll, QueryAllParams } from \"@webiny/db-dynamodb/utils/query\";\nimport { createEntityWriteBatch } from \"@webiny/db-dynamodb\";\nimport { filterItems } from \"@webiny/db-dynamodb/utils/filter\";\nimport { sortItems } from \"@webiny/db-dynamodb/utils/sort\";\nimport { createIdentifier, parseIdentifier } from \"@webiny/utils\";\nimport type { PluginsContainer } from \"@webiny/plugins\";\nimport type {\n FormBuilderFormCreateGSIPartitionKeyParams,\n FormBuilderFormCreatePartitionKeyParams,\n FormBuilderFormStorageOperations\n} from \"~/types\";\nimport { FormDynamoDbFieldPlugin } from \"~/plugins/FormDynamoDbFieldPlugin\";\nimport { decodeCursor, encodeCursor } from \"@webiny/db-dynamodb/utils/cursor\";\nimport { getClean } 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<string, string, string>;\n plugins: PluginsContainer;\n}\n\nexport const createFormStorageOperations = (\n params: CreateFormStorageOperationsParams\n): FormBuilderFormStorageOperations => {\n const { entity, 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: Pick<FbForm, \"id\" | \"tenant\" | \"locale\">): Keys => {\n return {\n PK: createFormPartitionKey(form),\n SK: createRevisionSortKey(form)\n };\n };\n\n const createLatestKeys = (form: Pick<FbForm, \"tenant\" | \"locale\" | \"id\" | \"formId\">): Keys => {\n return {\n PK: createFormLatestPartitionKey(form),\n SK: createFormLatestSortKey(form)\n };\n };\n\n const createLatestPublishedKeys = (\n form: Pick<FbForm, \"tenant\" | \"locale\" | \"id\" | \"formId\">\n ): Keys => {\n return {\n PK: createFormLatestPublishedPartitionKey(form),\n SK: createLatestPublishedSortKey(form)\n };\n };\n\n const createGSIKeys = (form: Pick<FbForm, \"version\" | \"tenant\" | \"locale\">): 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 entityBatch = createEntityWriteBatch({\n entity,\n put: [\n {\n ...form,\n ...revisionKeys,\n ...gsiKeys,\n TYPE: createFormType()\n },\n {\n ...form,\n ...latestKeys,\n TYPE: createFormLatestType()\n }\n ]\n });\n\n try {\n await entityBatch.execute();\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 entityBatch = createEntityWriteBatch({\n entity,\n put: [\n {\n ...form,\n ...revisionKeys,\n ...gsiKeys,\n TYPE: createFormType()\n },\n {\n ...form,\n ...latestKeys,\n TYPE: createFormLatestType()\n }\n ]\n });\n\n try {\n await entityBatch.execute();\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 entityBatch = createEntityWriteBatch({\n entity,\n put: [\n {\n ...form,\n ...revisionKeys,\n ...gsiKeys,\n TYPE: createFormType()\n }\n ]\n });\n\n if (isLatestForm) {\n entityBatch.put({\n ...form,\n ...latestKeys,\n TYPE: createFormLatestType()\n });\n }\n try {\n await entityBatch.execute();\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 return await getClean<FbForm>({ entity, keys });\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 || undefined\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 let latestPublishedKeys: Keys | undefined;\n const entityBatch = createEntityWriteBatch({\n entity,\n delete: [createLatestKeys(form)]\n });\n\n for (const item of items) {\n if (!latestPublishedKeys && item.published) {\n latestPublishedKeys = createLatestPublishedKeys(item);\n }\n entityBatch.delete({\n PK: item.PK,\n SK: item.SK\n });\n }\n\n if (latestPublishedKeys) {\n entityBatch.delete(latestPublishedKeys);\n }\n\n try {\n await entityBatch.execute();\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 entityBatch = createEntityWriteBatch({\n entity,\n delete: [revisionKeys]\n });\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 entityBatch.put({\n ...previouslyPublishedForm,\n ...createLatestPublishedKeys(previouslyPublishedForm),\n GSI1_PK: null,\n GSI1_SK: null,\n TYPE: createFormLatestPublishedType()\n });\n } else {\n entityBatch.delete(createLatestPublishedKeys(form));\n }\n }\n /**\n * Sort out the latest record.\n */\n if (isLatest) {\n entityBatch.put({\n ...previous,\n ...latestKeys,\n GSI1_PK: null,\n GSI1_SK: null,\n TYPE: createFormLatestType()\n });\n }\n }\n /**\n * Now save the batch data.\n */\n try {\n await entityBatch.execute();\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 entityBatch = createEntityWriteBatch({\n entity,\n put: [\n {\n ...form,\n ...revisionKeys,\n ...gsiKeys,\n TYPE: createFormType()\n },\n {\n ...form,\n ...latestPublishedKeys,\n TYPE: createFormLatestPublishedType()\n }\n ]\n });\n\n /**\n * Update the latest form as well\n */\n if (isLatestForm) {\n entityBatch.put({\n ...form,\n ...latestKeys,\n TYPE: createFormLatestType()\n });\n }\n\n try {\n await entityBatch.execute();\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 entityBatch = createEntityWriteBatch({\n entity,\n put: [\n {\n ...form,\n ...revisionKeys,\n ...gsiKeys,\n TYPE: createFormType()\n }\n ]\n });\n\n if (isLatest) {\n entityBatch.put({\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 entityBatch.put({\n ...previouslyPublishedRevision,\n ...latestPublishedKeys,\n TYPE: createFormLatestPublishedType()\n });\n } else {\n entityBatch.delete(latestPublishedKeys);\n }\n }\n\n try {\n await entityBatch.execute();\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,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAiBA,IAAAC,MAAA,GAAAD,OAAA;AACA,IAAAE,WAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AAOA,IAAAM,wBAAA,GAAAN,OAAA;AACA,IAAAO,OAAA,GAAAP,OAAA;AACA,IAAAQ,IAAA,GAAAR,OAAA;AA6BO,MAAMS,2BAA2B,GACpCC,MAAyC,IACN;EACnC,MAAM;IAAEC,MAAM;IAAEC;EAAQ,CAAC,GAAGF,MAAM;EAElC,MAAMG,kBAAkB,GAAGD,OAAO,CAACE,MAAM,CACrCC,gDAAuB,CAACC,IAC5B,CAAC;EAED,MAAMC,sBAAsB,GAAIP,MAA+C,IAAa;IACxF,MAAM;MAAEQ,MA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AE;QAC7B/E,WAAW,CAACE,GAAG,CAAC;UACZ,GAAG6E,2BAA2B;UAC9B,GAAGxB,mBAAmB;UACtBpD,IAAI,EAAEjB,6BAA6B,CAAC;QACxC,CAAC,CAAC;MACN,CAAC,MAAM;QACHc,WAAW,CAACwD,MAAM,CAACD,mBAAmB,CAAC;MAC3C;IACJ;IAEA,IAAI;MACA,MAAMvD,WAAW,CAACI,OAAO,CAAC,CAAC;MAC3B,OAAOhB,IAAI;IACf,CAAC,CAAC,OAAOiB,EAAE,EAAE;MACT,MAAM,IAAIC,cAAW,CACjBD,EAAE,CAACE,OAAO,IAAI,2BAA2B,EACzCF,EAAE,CAACG,IAAI,IAAI,sBAAsB,EACjC;QACIpB,IAAI;QACJsB,QAAQ;QACRG,UAAU;QACVhB,YAAY;QACZC,UAAU;QACVyD;MACJ,CACJ,CAAC;IACL;EACJ,CAAC;EAED,OAAO;IACH3D,UAAU;IACVa,cAAc;IACdG,UAAU;IACVW,SAAS;IACT4B,iBAAiB;IACjBrC,OAAO;IACPuC,UAAU;IACVK,kBAAkB;IAClBiB,WAAW;IACXC,aAAa;IACb5G;EACJ,CAAC;AACL,CAAC;AAACgH,OAAA,CAAAxH,2BAAA,GAAAA,2BAAA","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webiny/api-form-builder-so-ddb",
|
|
3
|
-
"version": "5.41.4-beta.
|
|
3
|
+
"version": "5.41.4-beta.5",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"@webiny/api-form-builder",
|
|
@@ -22,21 +22,21 @@
|
|
|
22
22
|
"license": "MIT",
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"@babel/runtime": "7.24.1",
|
|
25
|
-
"@webiny/api-form-builder": "5.41.4-beta.
|
|
26
|
-
"@webiny/aws-sdk": "5.41.4-beta.
|
|
27
|
-
"@webiny/db-dynamodb": "5.41.4-beta.
|
|
28
|
-
"@webiny/error": "5.41.4-beta.
|
|
29
|
-
"@webiny/plugins": "5.41.4-beta.
|
|
30
|
-
"@webiny/utils": "5.41.4-beta.
|
|
25
|
+
"@webiny/api-form-builder": "5.41.4-beta.5",
|
|
26
|
+
"@webiny/aws-sdk": "5.41.4-beta.5",
|
|
27
|
+
"@webiny/db-dynamodb": "5.41.4-beta.5",
|
|
28
|
+
"@webiny/error": "5.41.4-beta.5",
|
|
29
|
+
"@webiny/plugins": "5.41.4-beta.5",
|
|
30
|
+
"@webiny/utils": "5.41.4-beta.5"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@babel/cli": "7.24.1",
|
|
34
34
|
"@babel/core": "7.24.3",
|
|
35
35
|
"@babel/preset-env": "7.24.3",
|
|
36
36
|
"@babel/preset-typescript": "7.24.1",
|
|
37
|
-
"@webiny/cli": "5.41.4-beta.
|
|
38
|
-
"@webiny/handler-db": "5.41.4-beta.
|
|
39
|
-
"@webiny/project-utils": "5.41.4-beta.
|
|
37
|
+
"@webiny/cli": "5.41.4-beta.5",
|
|
38
|
+
"@webiny/handler-db": "5.41.4-beta.5",
|
|
39
|
+
"@webiny/project-utils": "5.41.4-beta.5",
|
|
40
40
|
"csvtojson": "2.0.10",
|
|
41
41
|
"jest": "29.7.0",
|
|
42
42
|
"jest-dynalite": "3.6.1",
|
|
@@ -52,5 +52,5 @@
|
|
|
52
52
|
"build": "yarn webiny run build",
|
|
53
53
|
"watch": "yarn webiny run watch"
|
|
54
54
|
},
|
|
55
|
-
"gitHead": "
|
|
55
|
+
"gitHead": "e3f273ea63f0c426c2ddde0794d303bc8ffaa6c4"
|
|
56
56
|
}
|