@webiny/api-form-builder-so-ddb-es 5.39.0-beta.0 → 5.39.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/definitions/elasticsearch.d.ts +43 -3
  2. package/definitions/elasticsearch.js +6 -7
  3. package/definitions/elasticsearch.js.map +1 -1
  4. package/definitions/form.d.ts +2 -2
  5. package/definitions/form.js +6 -7
  6. package/definitions/form.js.map +1 -1
  7. package/definitions/settings.d.ts +2 -2
  8. package/definitions/settings.js +6 -7
  9. package/definitions/settings.js.map +1 -1
  10. package/definitions/submission.d.ts +2 -2
  11. package/definitions/submission.js +6 -7
  12. package/definitions/submission.js.map +1 -1
  13. package/definitions/system.d.ts +2 -2
  14. package/definitions/system.js +6 -7
  15. package/definitions/system.js.map +1 -1
  16. package/definitions/table.d.ts +4 -4
  17. package/definitions/table.js +5 -3
  18. package/definitions/table.js.map +1 -1
  19. package/definitions/tableElasticsearch.d.ts +4 -4
  20. package/definitions/tableElasticsearch.js +5 -3
  21. package/definitions/tableElasticsearch.js.map +1 -1
  22. package/index.js +25 -22
  23. package/index.js.map +1 -1
  24. package/operations/form/elasticsearchBody.d.ts +2 -2
  25. package/operations/form/elasticsearchBody.js +10 -12
  26. package/operations/form/elasticsearchBody.js.map +1 -1
  27. package/operations/form/index.d.ts +2 -2
  28. package/operations/form/index.js +120 -69
  29. package/operations/form/index.js.map +1 -1
  30. package/operations/settings/index.d.ts +2 -2
  31. package/operations/settings/index.js +23 -10
  32. package/operations/settings/index.js.map +1 -1
  33. package/operations/submission/elasticsearchBody.d.ts +2 -2
  34. package/operations/submission/elasticsearchBody.js +10 -12
  35. package/operations/submission/elasticsearchBody.js.map +1 -1
  36. package/operations/submission/index.d.ts +2 -2
  37. package/operations/submission/index.js +50 -26
  38. package/operations/submission/index.js.map +1 -1
  39. package/operations/system/index.d.ts +2 -2
  40. package/operations/system/index.js +19 -9
  41. package/operations/system/index.js.map +1 -1
  42. package/package.json +18 -15
  43. package/plugins/FormDynamoDbFieldPlugin.js +3 -4
  44. package/plugins/FormDynamoDbFieldPlugin.js.map +1 -1
  45. package/plugins/FormElasticsearchBodyModifierPlugin.js +3 -4
  46. package/plugins/FormElasticsearchBodyModifierPlugin.js.map +1 -1
  47. package/plugins/FormElasticsearchFieldPlugin.js +3 -4
  48. package/plugins/FormElasticsearchFieldPlugin.js.map +1 -1
  49. package/plugins/FormElasticsearchIndexPlugin.js +3 -4
  50. package/plugins/FormElasticsearchIndexPlugin.js.map +1 -1
  51. package/plugins/FormElasticsearchQueryModifierPlugin.js +3 -4
  52. package/plugins/FormElasticsearchQueryModifierPlugin.js.map +1 -1
  53. package/plugins/FormElasticsearchSortModifierPlugin.js +3 -4
  54. package/plugins/FormElasticsearchSortModifierPlugin.js.map +1 -1
  55. package/plugins/SubmissionElasticsearchBodyModifierPlugin.js +3 -4
  56. package/plugins/SubmissionElasticsearchBodyModifierPlugin.js.map +1 -1
  57. package/plugins/SubmissionElasticsearchFieldPlugin.js +3 -4
  58. package/plugins/SubmissionElasticsearchFieldPlugin.js.map +1 -1
  59. package/plugins/SubmissionElasticsearchQueryModifierPlugin.js +3 -4
  60. package/plugins/SubmissionElasticsearchQueryModifierPlugin.js.map +1 -1
  61. package/plugins/SubmissionElasticsearchSortModifierPlugin.js +3 -4
  62. package/plugins/SubmissionElasticsearchSortModifierPlugin.js.map +1 -1
  63. package/types.d.ts +6 -8
  64. package/types.js.map +1 -1
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.createSubmissionStorageOperations = void 0;
8
- var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
9
8
  var _error = _interopRequireDefault(require("@webiny/error"));
10
9
  var _batchRead = require("@webiny/db-dynamodb/utils/batchRead");
11
10
  var _sort = require("@webiny/db-dynamodb/utils/sort");
@@ -14,6 +13,7 @@ var _elasticsearchBody = require("./elasticsearchBody");
14
13
  var _configurations = require("../../configurations");
15
14
  var _cleanup = require("@webiny/db-dynamodb/utils/cleanup");
16
15
  var _utils = require("@webiny/utils");
16
+ var _dbDynamodb = require("@webiny/db-dynamodb");
17
17
  const createSubmissionStorageOperations = params => {
18
18
  const {
19
19
  entity,
@@ -49,9 +49,14 @@ const createSubmissionStorageOperations = params => {
49
49
  SK: createSubmissionSortKey(submission.id)
50
50
  };
51
51
  try {
52
- await entity.put((0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({}, submission), keys), {}, {
53
- TYPE: createSubmissionType()
54
- }));
52
+ await (0, _dbDynamodb.put)({
53
+ entity,
54
+ item: {
55
+ ...submission,
56
+ ...keys,
57
+ TYPE: createSubmissionType()
58
+ }
59
+ });
55
60
  } catch (ex) {
56
61
  throw new _error.default(ex.message || "Could not create form submission in the DynamoDB.", ex.code || "UPDATE_FORM_SUBMISSION_ERROR", {
57
62
  submission,
@@ -66,13 +71,18 @@ const createSubmissionStorageOperations = params => {
66
71
  tenant: form.tenant,
67
72
  locale: form.locale
68
73
  });
69
- await esEntity.put((0, _objectSpread2.default)({
70
- index,
71
- data: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, submission), {}, {
72
- __type: (0, _elasticsearchBody.createSubmissionElasticType)()
73
- }),
74
- TYPE: createSubmissionType()
75
- }, keys));
74
+ await (0, _dbDynamodb.put)({
75
+ entity: esEntity,
76
+ item: {
77
+ index,
78
+ data: {
79
+ ...submission,
80
+ __type: (0, _elasticsearchBody.createSubmissionElasticType)()
81
+ },
82
+ TYPE: createSubmissionType(),
83
+ ...keys
84
+ }
85
+ });
76
86
  } catch (ex) {
77
87
  throw new _error.default(ex.message || "Could not create form submission in the Elasticsearch.", ex.code || "UPDATE_FORM_SUBMISSION_ERROR", {
78
88
  submission,
@@ -96,9 +106,14 @@ const createSubmissionStorageOperations = params => {
96
106
  SK: createSubmissionSortKey(submission.id)
97
107
  };
98
108
  try {
99
- await entity.put((0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({}, submission), keys), {}, {
100
- TYPE: createSubmissionType()
101
- }));
109
+ await (0, _dbDynamodb.put)({
110
+ entity,
111
+ item: {
112
+ ...submission,
113
+ ...keys,
114
+ TYPE: createSubmissionType()
115
+ }
116
+ });
102
117
  return submission;
103
118
  } catch (ex) {
104
119
  throw new _error.default(ex.message || "Could not update form submission in the DynamoDB.", ex.code || "UPDATE_FORM_SUBMISSION_ERROR", {
@@ -119,7 +134,10 @@ const createSubmissionStorageOperations = params => {
119
134
  SK: createSubmissionSortKey(submission.id)
120
135
  };
121
136
  try {
122
- await entity.delete(keys);
137
+ await (0, _dbDynamodb.deleteItem)({
138
+ entity,
139
+ keys
140
+ });
123
141
  } catch (ex) {
124
142
  throw new _error.default(ex.message || "Could not delete form submission from DynamoDB.", ex.code || "DELETE_FORM_SUBMISSION_ERROR", {
125
143
  submission,
@@ -128,7 +146,10 @@ const createSubmissionStorageOperations = params => {
128
146
  });
129
147
  }
130
148
  try {
131
- await esEntity.delete(keys);
149
+ await (0, _dbDynamodb.deleteItem)({
150
+ entity: esEntity,
151
+ keys
152
+ });
132
153
  } catch (ex) {
133
154
  throw new _error.default(ex.message || "Could not delete form submission from Elasticsearch.", ex.code || "DELETE_FORM_SUBMISSION_ERROR", {
134
155
  submission,
@@ -152,7 +173,9 @@ const createSubmissionStorageOperations = params => {
152
173
  } = params;
153
174
  const items = (where.id_in || []).map(id => {
154
175
  return entity.getBatch({
155
- PK: createSubmissionPartitionKey((0, _objectSpread2.default)({}, where)),
176
+ PK: createSubmissionPartitionKey({
177
+ ...where
178
+ }),
156
179
  SK: createSubmissionSortKey(id)
157
180
  });
158
181
  });
@@ -213,9 +236,10 @@ const createSubmissionStorageOperations = params => {
213
236
  tenant: where.tenant,
214
237
  locale: where.locale
215
238
  });
216
- const query = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, esConfig), {}, {
239
+ const query = {
240
+ ...esConfig,
217
241
  body
218
- });
242
+ };
219
243
  let response;
220
244
  try {
221
245
  response = await elasticsearch.search(query);
@@ -256,17 +280,17 @@ const createSubmissionStorageOperations = params => {
256
280
  where
257
281
  } = params;
258
282
  const keys = {
259
- PK: createSubmissionPartitionKey((0, _objectSpread2.default)((0, _objectSpread2.default)({}, where), {}, {
283
+ PK: createSubmissionPartitionKey({
284
+ ...where,
260
285
  formId: where.formId
261
- })),
286
+ }),
262
287
  SK: createSubmissionSortKey(where.id)
263
288
  };
264
289
  try {
265
- const result = await entity.get(keys);
266
- if (!result || !result.Item) {
267
- return null;
268
- }
269
- return (0, _cleanup.cleanupItem)(entity, result.Item);
290
+ return await (0, _dbDynamodb.getClean)({
291
+ entity,
292
+ keys
293
+ });
270
294
  } catch (ex) {
271
295
  throw new _error.default(ex.message || "Could not oad submission.", ex.code || "GET_SUBMISSION_ERROR", {
272
296
  where,
@@ -1 +1 @@
1
- {"version":3,"names":["_error","_interopRequireDefault","require","_batchRead","_sort","_apiElasticsearch","_elasticsearchBody","_configurations","_cleanup","_utils","createSubmissionStorageOperations","params","entity","esEntity","table","elasticsearch","plugins","createSubmissionPartitionKey","tenant","locale","formId","id","parseIdentifier","createSubmissionSortKey","createSubmissionType","createSubmission","submission","form","keys","PK","SK","put","_objectSpread2","default","TYPE","ex","WebinyError","message","code","index","configurations","es","data","__type","createSubmissionElasticType","updateSubmission","original","deleteSubmission","delete","listSubmissionsByIds","where","sort","items","id_in","map","getBatch","results","batchReadAll","submissions","filter","Boolean","cleanupItem","sortItems","fields","listSubmissions","limit","initialLimit","after","meta","hasMoreItems","cursor","totalCount","length","createLimit","body","createElasticsearchBody","decodeCursor","esConfig","query","response","search","hits","total","item","_source","pop","value","encodeCursor","getSubmission","result","get","Item","exports"],"sources":["index.ts"],"sourcesContent":["import {\n FbSubmission,\n FormBuilderStorageOperationsCreateSubmissionParams,\n FormBuilderStorageOperationsDeleteSubmissionParams,\n FormBuilderStorageOperationsGetSubmissionParams,\n FormBuilderStorageOperationsListSubmissionsParams,\n FormBuilderStorageOperationsListSubmissionsResponse,\n FormBuilderStorageOperationsUpdateSubmissionParams\n} from \"@webiny/api-form-builder/types\";\nimport { Entity, Table } from \"dynamodb-toolbox\";\nimport { Client } from \"@elastic/elasticsearch\";\nimport WebinyError from \"@webiny/error\";\nimport { batchReadAll } from \"@webiny/db-dynamodb/utils/batchRead\";\nimport { sortItems } from \"@webiny/db-dynamodb/utils/sort\";\nimport { createLimit, encodeCursor, decodeCursor } from \"@webiny/api-elasticsearch\";\nimport {\n createElasticsearchBody,\n createSubmissionElasticType\n} from \"~/operations/submission/elasticsearchBody\";\nimport { PluginsContainer } from \"@webiny/plugins\";\nimport {\n FormBuilderSubmissionStorageOperations,\n FormBuilderSubmissionStorageOperationsCreatePartitionKeyParams\n} from \"~/types\";\nimport { configurations } from \"~/configurations\";\nimport { cleanupItem } from \"@webiny/db-dynamodb/utils/cleanup\";\nimport { parseIdentifier } from \"@webiny/utils\";\nimport { ElasticsearchSearchResponse } from \"@webiny/api-elasticsearch/types\";\n\nexport interface CreateSubmissionStorageOperationsParams {\n entity: Entity<any>;\n esEntity: Entity<any>;\n table: Table;\n elasticsearch: Client;\n plugins: PluginsContainer;\n}\n\nexport const createSubmissionStorageOperations = (\n params: CreateSubmissionStorageOperationsParams\n): FormBuilderSubmissionStorageOperations => {\n const { entity, esEntity, table, elasticsearch, plugins } = params;\n\n const createSubmissionPartitionKey = (\n params: FormBuilderSubmissionStorageOperationsCreatePartitionKeyParams\n ) => {\n const { tenant, locale, formId } = params;\n\n const { id } = parseIdentifier(formId);\n\n return `T#${tenant}#L#${locale}#FB#F#${id}`;\n };\n const createSubmissionSortKey = (id: string) => {\n return `FS#${id}`;\n };\n\n const createSubmissionType = () => {\n return \"fb.formSubmission\";\n };\n\n const createSubmission = async (\n params: FormBuilderStorageOperationsCreateSubmissionParams\n ): Promise<FbSubmission> => {\n const { submission, form } = params;\n const keys = {\n PK: createSubmissionPartitionKey(form),\n SK: createSubmissionSortKey(submission.id)\n };\n\n try {\n await entity.put({\n ...submission,\n ...keys,\n TYPE: createSubmissionType()\n });\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not create form submission in the DynamoDB.\",\n ex.code || \"UPDATE_FORM_SUBMISSION_ERROR\",\n {\n submission,\n form,\n keys\n }\n );\n }\n\n try {\n const { index } = configurations.es({\n tenant: form.tenant,\n locale: form.locale\n });\n await esEntity.put({\n index,\n data: {\n ...submission,\n __type: createSubmissionElasticType()\n },\n TYPE: createSubmissionType(),\n ...keys\n });\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not create form submission in the Elasticsearch.\",\n ex.code || \"UPDATE_FORM_SUBMISSION_ERROR\",\n {\n submission,\n form,\n keys\n }\n );\n }\n\n return submission;\n };\n /**\n * We do not save the data in the Elasticsearch because there is no need for that.\n */\n const updateSubmission = async (\n params: FormBuilderStorageOperationsUpdateSubmissionParams\n ): Promise<FbSubmission> => {\n const { submission, form, original } = params;\n const keys = {\n PK: createSubmissionPartitionKey(form),\n SK: createSubmissionSortKey(submission.id)\n };\n\n try {\n await entity.put({\n ...submission,\n ...keys,\n TYPE: createSubmissionType()\n });\n return submission;\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not update form submission in the DynamoDB.\",\n ex.code || \"UPDATE_FORM_SUBMISSION_ERROR\",\n {\n submission,\n original,\n form,\n keys\n }\n );\n }\n };\n\n const deleteSubmission = async (\n params: FormBuilderStorageOperationsDeleteSubmissionParams\n ): Promise<FbSubmission> => {\n const { submission, form } = params;\n\n const keys = {\n PK: createSubmissionPartitionKey(form),\n SK: createSubmissionSortKey(submission.id)\n };\n\n try {\n await entity.delete(keys);\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not delete form submission from DynamoDB.\",\n ex.code || \"DELETE_FORM_SUBMISSION_ERROR\",\n {\n submission,\n form,\n keys\n }\n );\n }\n\n try {\n await esEntity.delete(keys);\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not delete form submission from Elasticsearch.\",\n ex.code || \"DELETE_FORM_SUBMISSION_ERROR\",\n {\n submission,\n form,\n keys\n }\n );\n }\n\n return submission;\n };\n\n /**\n *\n * We are using this method because it is faster to fetch the exact data from the DynamoDB than Elasticsearch.\n *\n * @internal\n */\n const listSubmissionsByIds = async (\n params: FormBuilderStorageOperationsListSubmissionsParams\n ): Promise<FbSubmission[]> => {\n const { where, sort } = params;\n const items = (where.id_in || []).map(id => {\n return entity.getBatch({\n PK: createSubmissionPartitionKey({\n ...where\n }),\n SK: createSubmissionSortKey(id)\n });\n });\n\n let results: FbSubmission[] = [];\n\n try {\n results = await batchReadAll<FbSubmission>({\n table,\n items\n });\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not batch read form submissions.\",\n ex.code || \"BATCH_READ_SUBMISSIONS_ERROR\",\n {\n where,\n sort\n }\n );\n }\n /**\n * We need to remove empty results because it is a possibility that batch read returned null for non-existing record.\n */\n const submissions = results.filter(Boolean).map(submission => {\n return cleanupItem(entity, submission);\n }) as FbSubmission[];\n if (!sort) {\n return submissions;\n }\n return sortItems<FbSubmission>({\n items: submissions,\n sort,\n fields: []\n });\n };\n\n const listSubmissions = async (\n params: FormBuilderStorageOperationsListSubmissionsParams\n ): Promise<FormBuilderStorageOperationsListSubmissionsResponse> => {\n const { where, sort = [], limit: initialLimit, after } = params;\n\n if (where.id_in) {\n const items = await listSubmissionsByIds(params);\n\n return {\n items,\n meta: {\n hasMoreItems: false,\n cursor: null,\n totalCount: items.length\n }\n };\n }\n\n const limit = createLimit(initialLimit);\n\n const body = createElasticsearchBody({\n plugins,\n sort,\n limit: limit + 1,\n where,\n after: decodeCursor(after) as any\n });\n\n const esConfig = configurations.es({\n tenant: where.tenant,\n locale: where.locale\n });\n\n const query = {\n ...esConfig,\n body\n };\n\n let response: ElasticsearchSearchResponse<FbSubmission>;\n try {\n response = await elasticsearch.search(query);\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could list form submissions.\",\n ex.code || \"LIST_SUBMISSIONS_ERROR\",\n {\n where,\n query\n }\n );\n }\n\n const { hits, total } = response.body.hits;\n const items = hits.map(item => item._source);\n\n const hasMoreItems = items.length > limit;\n if (hasMoreItems) {\n /**\n * Remove the last item from results, we don't want to include it.\n */\n items.pop();\n }\n /**\n * Cursor is the `sort` value of the last item in the array.\n * https://www.elastic.co/guide/en/elasticsearch/reference/current/paginate-search-results.html#search-after\n */\n const meta = {\n hasMoreItems,\n totalCount: total.value,\n cursor: items.length > 0 ? encodeCursor(hits[items.length - 1].sort) || null : null\n };\n\n return {\n items,\n meta\n };\n };\n\n const getSubmission = async (\n params: FormBuilderStorageOperationsGetSubmissionParams\n ): Promise<FbSubmission | null> => {\n const { where } = params;\n\n const keys = {\n PK: createSubmissionPartitionKey({\n ...where,\n formId: where.formId as string\n }),\n SK: createSubmissionSortKey(where.id)\n };\n\n try {\n const result = await entity.get(keys);\n\n if (!result || !result.Item) {\n return null;\n }\n\n return cleanupItem(entity, result.Item);\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not oad submission.\",\n ex.code || \"GET_SUBMISSION_ERROR\",\n {\n where,\n keys\n }\n );\n }\n };\n\n return {\n createSubmission,\n deleteSubmission,\n updateSubmission,\n listSubmissions,\n getSubmission,\n createSubmissionPartitionKey,\n createSubmissionSortKey\n };\n};\n"],"mappings":";;;;;;;;AAWA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,iBAAA,GAAAH,OAAA;AACA,IAAAI,kBAAA,GAAAJ,OAAA;AASA,IAAAK,eAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;AACA,IAAAO,MAAA,GAAAP,OAAA;AAWO,MAAMQ,iCAAiC,GAC1CC,MAA+C,IACN;EACzC,MAAM;IAAEC,MAAM;IAAEC,QAAQ;IAAEC,KAAK;IAAEC,aAAa;IAAEC;EAAQ,CAAC,GAAGL,MAAM;EA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,GAAG;IACnF,CAAC;IAED,OAAO;MACHC,KAAK;MACLgB;IACJ,CAAC;EACL,CAAC;EAED,MAAMoB,aAAa,GAAG,MAClB7E,MAAuD,IACxB;IAC/B,MAAM;MAAEuC;IAAM,CAAC,GAAGvC,MAAM;IAExB,MAAMiB,IAAI,GAAG;MACTC,EAAE,EAAEZ,4BAA4B,KAAAe,cAAA,CAAAC,OAAA,MAAAD,cAAA,CAAAC,OAAA,MACzBiB,KAAK;QACR9B,MAAM,EAAE8B,KAAK,CAAC9B;MAAgB,EACjC,CAAC;MACFU,EAAE,EAAEP,uBAAuB,CAAC2B,KAAK,CAAC7B,EAAE;IACxC,CAAC;IAED,IAAI;MACA,MAAMoE,MAAM,GAAG,MAAM7E,MAAM,CAAC8E,GAAG,CAAC9D,IAAI,CAAC;MAErC,IAAI,CAAC6D,MAAM,IAAI,CAACA,MAAM,CAACE,IAAI,EAAE;QACzB,OAAO,IAAI;MACf;MAEA,OAAO,IAAA9B,oBAAW,EAACjD,MAAM,EAAE6E,MAAM,CAACE,IAAI,CAAC;IAC3C,CAAC,CAAC,OAAOxD,EAAE,EAAE;MACT,MAAM,IAAIC,cAAW,CACjBD,EAAE,CAACE,OAAO,IAAI,2BAA2B,EACzCF,EAAE,CAACG,IAAI,IAAI,sBAAsB,EACjC;QACIY,KAAK;QACLtB;MACJ,CACJ,CAAC;IACL;EACJ,CAAC;EAED,OAAO;IACHH,gBAAgB;IAChBsB,gBAAgB;IAChBF,gBAAgB;IAChBmB,eAAe;IACfwB,aAAa;IACbvE,4BAA4B;IAC5BM;EACJ,CAAC;AACL,CAAC;AAACqE,OAAA,CAAAlF,iCAAA,GAAAA,iCAAA"}
1
+ {"version":3,"names":["_error","_interopRequireDefault","require","_batchRead","_sort","_apiElasticsearch","_elasticsearchBody","_configurations","_cleanup","_utils","_dbDynamodb","createSubmissionStorageOperations","params","entity","esEntity","table","elasticsearch","plugins","createSubmissionPartitionKey","tenant","locale","formId","id","parseIdentifier","createSubmissionSortKey","createSubmissionType","createSubmission","submission","form","keys","PK","SK","put","item","TYPE","ex","WebinyError","message","code","index","configurations","es","data","__type","createSubmissionElasticType","updateSubmission","original","deleteSubmission","deleteItem","listSubmissionsByIds","where","sort","items","id_in","map","getBatch","results","batchReadAll","submissions","filter","Boolean","cleanupItem","sortItems","fields","listSubmissions","limit","initialLimit","after","meta","hasMoreItems","cursor","totalCount","length","createLimit","body","createElasticsearchBody","decodeCursor","esConfig","query","response","search","hits","total","_source","pop","value","encodeCursor","getSubmission","getClean","exports"],"sources":["index.ts"],"sourcesContent":["import {\n FbSubmission,\n FormBuilderStorageOperationsCreateSubmissionParams,\n FormBuilderStorageOperationsDeleteSubmissionParams,\n FormBuilderStorageOperationsGetSubmissionParams,\n FormBuilderStorageOperationsListSubmissionsParams,\n FormBuilderStorageOperationsListSubmissionsResponse,\n FormBuilderStorageOperationsUpdateSubmissionParams\n} from \"@webiny/api-form-builder/types\";\nimport { Entity, Table } from \"@webiny/db-dynamodb/toolbox\";\nimport { Client } from \"@elastic/elasticsearch\";\nimport WebinyError from \"@webiny/error\";\nimport { batchReadAll } from \"@webiny/db-dynamodb/utils/batchRead\";\nimport { sortItems } from \"@webiny/db-dynamodb/utils/sort\";\nimport { createLimit, decodeCursor, encodeCursor } from \"@webiny/api-elasticsearch\";\nimport {\n createElasticsearchBody,\n createSubmissionElasticType\n} from \"~/operations/submission/elasticsearchBody\";\nimport { PluginsContainer } from \"@webiny/plugins\";\nimport {\n FormBuilderSubmissionStorageOperations,\n FormBuilderSubmissionStorageOperationsCreatePartitionKeyParams\n} from \"~/types\";\nimport { configurations } from \"~/configurations\";\nimport { cleanupItem } from \"@webiny/db-dynamodb/utils/cleanup\";\nimport { parseIdentifier } from \"@webiny/utils\";\nimport { ElasticsearchSearchResponse } from \"@webiny/api-elasticsearch/types\";\nimport { deleteItem, getClean, put } from \"@webiny/db-dynamodb\";\n\nexport interface CreateSubmissionStorageOperationsParams {\n entity: Entity<any>;\n esEntity: Entity<any>;\n table: Table<string, string, string>;\n elasticsearch: Client;\n plugins: PluginsContainer;\n}\n\nexport const createSubmissionStorageOperations = (\n params: CreateSubmissionStorageOperationsParams\n): FormBuilderSubmissionStorageOperations => {\n const { entity, esEntity, table, elasticsearch, plugins } = params;\n\n const createSubmissionPartitionKey = (\n params: FormBuilderSubmissionStorageOperationsCreatePartitionKeyParams\n ) => {\n const { tenant, locale, formId } = params;\n\n const { id } = parseIdentifier(formId);\n\n return `T#${tenant}#L#${locale}#FB#F#${id}`;\n };\n const createSubmissionSortKey = (id: string) => {\n return `FS#${id}`;\n };\n\n const createSubmissionType = () => {\n return \"fb.formSubmission\";\n };\n\n const createSubmission = async (\n params: FormBuilderStorageOperationsCreateSubmissionParams\n ): Promise<FbSubmission> => {\n const { submission, form } = params;\n const keys = {\n PK: createSubmissionPartitionKey(form),\n SK: createSubmissionSortKey(submission.id)\n };\n\n try {\n await put({\n entity,\n item: {\n ...submission,\n ...keys,\n TYPE: createSubmissionType()\n }\n });\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not create form submission in the DynamoDB.\",\n ex.code || \"UPDATE_FORM_SUBMISSION_ERROR\",\n {\n submission,\n form,\n keys\n }\n );\n }\n\n try {\n const { index } = configurations.es({\n tenant: form.tenant,\n locale: form.locale\n });\n await put({\n entity: esEntity,\n item: {\n index,\n data: {\n ...submission,\n __type: createSubmissionElasticType()\n },\n TYPE: createSubmissionType(),\n ...keys\n }\n });\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not create form submission in the Elasticsearch.\",\n ex.code || \"UPDATE_FORM_SUBMISSION_ERROR\",\n {\n submission,\n form,\n keys\n }\n );\n }\n\n return submission;\n };\n /**\n * We do not save the data in the Elasticsearch because there is no need for that.\n */\n const updateSubmission = async (\n params: FormBuilderStorageOperationsUpdateSubmissionParams\n ): Promise<FbSubmission> => {\n const { submission, form, original } = params;\n const keys = {\n PK: createSubmissionPartitionKey(form),\n SK: createSubmissionSortKey(submission.id)\n };\n\n try {\n await put({\n entity,\n item: {\n ...submission,\n ...keys,\n TYPE: createSubmissionType()\n }\n });\n return submission;\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not update form submission in the DynamoDB.\",\n ex.code || \"UPDATE_FORM_SUBMISSION_ERROR\",\n {\n submission,\n original,\n form,\n keys\n }\n );\n }\n };\n\n const deleteSubmission = async (\n params: FormBuilderStorageOperationsDeleteSubmissionParams\n ): Promise<FbSubmission> => {\n const { submission, form } = params;\n\n const keys = {\n PK: createSubmissionPartitionKey(form),\n SK: createSubmissionSortKey(submission.id)\n };\n\n try {\n await deleteItem({\n entity,\n keys\n });\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not delete form submission from DynamoDB.\",\n ex.code || \"DELETE_FORM_SUBMISSION_ERROR\",\n {\n submission,\n form,\n keys\n }\n );\n }\n\n try {\n await deleteItem({\n entity: esEntity,\n keys\n });\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not delete form submission from Elasticsearch.\",\n ex.code || \"DELETE_FORM_SUBMISSION_ERROR\",\n {\n submission,\n form,\n keys\n }\n );\n }\n\n return submission;\n };\n\n /**\n *\n * We are using this method because it is faster to fetch the exact data from the DynamoDB than Elasticsearch.\n *\n * @internal\n */\n const listSubmissionsByIds = async (\n params: FormBuilderStorageOperationsListSubmissionsParams\n ): Promise<FbSubmission[]> => {\n const { where, sort } = params;\n const items = (where.id_in || []).map(id => {\n return entity.getBatch({\n PK: createSubmissionPartitionKey({\n ...where\n }),\n SK: createSubmissionSortKey(id)\n });\n });\n\n let results: FbSubmission[] = [];\n\n try {\n results = await batchReadAll<FbSubmission>({\n table,\n items\n });\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not batch read form submissions.\",\n ex.code || \"BATCH_READ_SUBMISSIONS_ERROR\",\n {\n where,\n sort\n }\n );\n }\n /**\n * We need to remove empty results because it is a possibility that batch read returned null for non-existing record.\n */\n const submissions = results.filter(Boolean).map(submission => {\n return cleanupItem(entity, submission);\n }) as FbSubmission[];\n if (!sort) {\n return submissions;\n }\n return sortItems<FbSubmission>({\n items: submissions,\n sort,\n fields: []\n });\n };\n\n const listSubmissions = async (\n params: FormBuilderStorageOperationsListSubmissionsParams\n ): Promise<FormBuilderStorageOperationsListSubmissionsResponse> => {\n const { where, sort = [], limit: initialLimit, after } = params;\n\n if (where.id_in) {\n const items = await listSubmissionsByIds(params);\n\n return {\n items,\n meta: {\n hasMoreItems: false,\n cursor: null,\n totalCount: items.length\n }\n };\n }\n\n const limit = createLimit(initialLimit);\n\n const body = createElasticsearchBody({\n plugins,\n sort,\n limit: limit + 1,\n where,\n after: decodeCursor(after)\n });\n\n const esConfig = configurations.es({\n tenant: where.tenant,\n locale: where.locale\n });\n\n const query = {\n ...esConfig,\n body\n };\n\n let response: ElasticsearchSearchResponse<FbSubmission>;\n try {\n response = await elasticsearch.search(query);\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could list form submissions.\",\n ex.code || \"LIST_SUBMISSIONS_ERROR\",\n {\n where,\n query\n }\n );\n }\n\n const { hits, total } = response.body.hits;\n const items = hits.map(item => item._source);\n\n const hasMoreItems = items.length > limit;\n if (hasMoreItems) {\n /**\n * Remove the last item from results, we don't want to include it.\n */\n items.pop();\n }\n /**\n * Cursor is the `sort` value of the last item in the array.\n * https://www.elastic.co/guide/en/elasticsearch/reference/current/paginate-search-results.html#search-after\n */\n const meta = {\n hasMoreItems,\n totalCount: total.value,\n cursor: items.length > 0 ? encodeCursor(hits[items.length - 1].sort) || null : null\n };\n\n return {\n items,\n meta\n };\n };\n\n const getSubmission = async (\n params: FormBuilderStorageOperationsGetSubmissionParams\n ): Promise<FbSubmission | null> => {\n const { where } = params;\n\n const keys = {\n PK: createSubmissionPartitionKey({\n ...where,\n formId: where.formId as string\n }),\n SK: createSubmissionSortKey(where.id)\n };\n\n try {\n return await getClean<FbSubmission>({\n entity,\n keys\n });\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not oad submission.\",\n ex.code || \"GET_SUBMISSION_ERROR\",\n {\n where,\n keys\n }\n );\n }\n };\n\n return {\n createSubmission,\n deleteSubmission,\n updateSubmission,\n listSubmissions,\n getSubmission,\n createSubmissionPartitionKey,\n createSubmissionSortKey\n };\n};\n"],"mappings":";;;;;;;AAWA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,iBAAA,GAAAH,OAAA;AACA,IAAAI,kBAAA,GAAAJ,OAAA;AASA,IAAAK,eAAA,GAAAL,OAAA;AACA,IAAAM,QAAA,GAAAN,OAAA;AACA,IAAAO,MAAA,GAAAP,OAAA;AAEA,IAAAQ,WAAA,GAAAR,OAAA;AAUO,MAAMS,iCAAiC,GAC1CC,MAA+C,IACN;EACzC,MAAM;IAAEC,MAAM;IAAEC,QAAQ;IAAEC,KAAK;IAAEC,aAAa;IAAEC;EAAQ,CAAC,GAAGL,MAAM;EAElE,MAAMM,4BAA4B,GAC9BN,MAAsE,IACrE;IACD,MAAM;MAAEO,MAAM;MAAEC,MAAM;MAAEC;IAAO,CAAC,GAAGT,MAAM;IAEzC,MAAM;MAAEU;IAAG,CAAC,GAAG,IAAAC,sBAAe,EAACF,MAAM,CAAC;IAEtC,OAAQ,KAAIF,MAAO,MAAKC,MAAO,SAAQE,EAAG,EAAC;EAC/C,CAAC;EACD,MAAME,uBAAuB,GAAIF,EAAU,IAAK;IAC5C,OAAQ,MAAKA,EAAG,EAAC;EACrB,CAAC;EAED,MAAMG,oBAAoB,GAAGA,CAAA,KAAM;IAC/B,OAAO,mBAAmB;EAC9B,CAAC;EAED,MAAMC,gBAAgB,GAAG,MACrBd,MAA0D,IAClC;IACxB,MAAM;MAAEe,UAAU;MAAEC;IAAK,CAAC,GAAGhB,MAAM;IACnC,MAAMiB,IAAI,GAAG;MACTC,EAAE,EAAEZ,4BAA4B,CAACU,IAAI,CAAC;MACtCG,EAAE,EAAEP,uBAAuB,CAACG,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,gBAAgB;IAChBmB,eAAe;IACfuB,aAAa;IACbrE,4BAA4B;IAC5BM;EACJ,CAAC;AACL,CAAC;AAACiE,OAAA,CAAA9E,iCAAA,GAAAA,iCAAA"}
@@ -1,7 +1,7 @@
1
- import { Entity, Table } from "dynamodb-toolbox";
1
+ import { Entity, Table } from "@webiny/db-dynamodb/toolbox";
2
2
  import { FormBuilderSystemStorageOperations } from "../../types";
3
3
  export interface CreateSystemStorageOperationsParams {
4
4
  entity: Entity<any>;
5
- table: Table;
5
+ table: Table<string, string, string>;
6
6
  }
7
7
  export declare const createSystemStorageOperations: (params: CreateSystemStorageOperationsParams) => FormBuilderSystemStorageOperations;
@@ -5,9 +5,8 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.createSystemStorageOperations = void 0;
8
- var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
9
- var _cleanup = require("@webiny/db-dynamodb/utils/cleanup");
10
8
  var _error = _interopRequireDefault(require("@webiny/error"));
9
+ var _dbDynamodb = require("@webiny/db-dynamodb");
11
10
  const createSystemStorageOperations = params => {
12
11
  const {
13
12
  entity
@@ -32,7 +31,13 @@ const createSystemStorageOperations = params => {
32
31
  } = params;
33
32
  const keys = createKeys(system);
34
33
  try {
35
- await entity.put((0, _objectSpread2.default)((0, _objectSpread2.default)({}, system), keys));
34
+ await (0, _dbDynamodb.put)({
35
+ entity,
36
+ item: {
37
+ ...system,
38
+ ...keys
39
+ }
40
+ });
36
41
  return system;
37
42
  } catch (ex) {
38
43
  throw new _error.default(ex.message || "Could not create the system record by given keys.", ex.code || "CREATE_SYSTEM_ERROR", {
@@ -44,11 +49,10 @@ const createSystemStorageOperations = params => {
44
49
  const getSystem = async params => {
45
50
  const keys = createKeys(params);
46
51
  try {
47
- const result = await entity.get(keys);
48
- if (!result || !result.Item) {
49
- return null;
50
- }
51
- return (0, _cleanup.cleanupItem)(entity, result.Item);
52
+ return await (0, _dbDynamodb.getClean)({
53
+ entity,
54
+ keys
55
+ });
52
56
  } catch (ex) {
53
57
  throw new _error.default(ex.message || "Could not get the system record by given keys.", ex.code || "LOAD_SYSTEM_ERROR", {
54
58
  keys
@@ -62,7 +66,13 @@ const createSystemStorageOperations = params => {
62
66
  } = params;
63
67
  const keys = createKeys(system);
64
68
  try {
65
- await entity.put((0, _objectSpread2.default)((0, _objectSpread2.default)({}, system), keys));
69
+ await (0, _dbDynamodb.put)({
70
+ entity,
71
+ item: {
72
+ ...system,
73
+ ...keys
74
+ }
75
+ });
66
76
  return system;
67
77
  } catch (ex) {
68
78
  throw new _error.default(ex.message || "Could not update the system record by given keys.", ex.code || "UPDATE_SYSTEM_ERROR", {
@@ -1 +1 @@
1
- {"version":3,"names":["_cleanup","require","_error","_interopRequireDefault","createSystemStorageOperations","params","entity","createSystemPartitionKey","tenant","createSystemSortKey","createKeys","PK","SK","createSystem","system","keys","put","_objectSpread2","default","ex","WebinyError","message","code","getSystem","result","get","Item","cleanupItem","updateSystem","original","exports"],"sources":["index.ts"],"sourcesContent":["import {\n FormBuilderStorageOperationsCreateSystemParams,\n FormBuilderStorageOperationsGetSystemParams,\n FormBuilderStorageOperationsUpdateSystemParams,\n System\n} from \"@webiny/api-form-builder/types\";\nimport { Entity, Table } from \"dynamodb-toolbox\";\nimport { FormBuilderSystemCreateKeysParams, FormBuilderSystemStorageOperations } from \"~/types\";\nimport { cleanupItem } from \"@webiny/db-dynamodb/utils/cleanup\";\nimport WebinyError from \"@webiny/error\";\n\nexport interface CreateSystemStorageOperationsParams {\n entity: Entity<any>;\n table: Table;\n}\n\nexport const createSystemStorageOperations = (\n params: CreateSystemStorageOperationsParams\n): FormBuilderSystemStorageOperations => {\n const { entity } = params;\n\n const createSystemPartitionKey = ({ tenant }: FormBuilderSystemCreateKeysParams): string => {\n return `T#${tenant}#SYSTEM`;\n };\n\n const createSystemSortKey = (): string => {\n return \"FB\";\n };\n\n const createKeys = (params: FormBuilderSystemCreateKeysParams) => {\n return {\n PK: createSystemPartitionKey(params),\n SK: createSystemSortKey()\n };\n };\n\n const createSystem = async (\n params: FormBuilderStorageOperationsCreateSystemParams\n ): Promise<System> => {\n const { system } = params;\n const keys = createKeys(system);\n\n try {\n await entity.put({\n ...system,\n ...keys\n });\n return system;\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not create the system record by given keys.\",\n ex.code || \"CREATE_SYSTEM_ERROR\",\n {\n keys,\n system\n }\n );\n }\n };\n\n const getSystem = async (\n params: FormBuilderStorageOperationsGetSystemParams\n ): Promise<System | null> => {\n const keys = createKeys(params);\n\n try {\n const result = await entity.get(keys);\n if (!result || !result.Item) {\n return null;\n }\n return cleanupItem(entity, result.Item);\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not get the system record by given keys.\",\n ex.code || \"LOAD_SYSTEM_ERROR\",\n {\n keys\n }\n );\n }\n };\n\n const updateSystem = async (\n params: FormBuilderStorageOperationsUpdateSystemParams\n ): Promise<System> => {\n const { system, original } = params;\n const keys = createKeys(system);\n\n try {\n await entity.put({\n ...system,\n ...keys\n });\n return system;\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not update the system record by given keys.\",\n ex.code || \"UPDATE_SYSTEM_ERROR\",\n {\n keys,\n original,\n system\n }\n );\n }\n };\n\n return {\n createSystem,\n getSystem,\n updateSystem,\n createSystemPartitionKey,\n createSystemSortKey\n };\n};\n"],"mappings":";;;;;;;;AAQA,IAAAA,QAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAC,sBAAA,CAAAF,OAAA;AAOO,MAAMG,6BAA6B,GACtCC,MAA2C,IACN;EACrC,MAAM;IAAEC;EAAO,CAAC,GAAGD,MAAM;EAEzB,MAAME,wBAAwB,GAAGA,CAAC;IAAEC;EAA0C,CAAC,KAAa;IACxF,OAAQ,KAAIA,MAAO,SAAQ;EAC/B,CAAC;EAED,MAAMC,mBAAmB,GAAGA,CAAA,KAAc;IACtC,OAAO,IAAI;EACf,CAAC;EAED,MAAMC,U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Ee;IAAS,CAAC,GAAGxB,MAAM;IACnC,MAAMU,IAAI,GAAGL,UAAU,CAACI,MAAM,CAAC;IAE/B,IAAI;MACA,MAAMR,MAAM,CAACU,GAAG,KAAAC,cAAA,CAAAC,OAAA,MAAAD,cAAA,CAAAC,OAAA,MACTJ,MAAM,GACNC,IAAI,CACV,CAAC;MACF,OAAOD,MAAM;IACjB,CAAC,CAAC,OAAOK,EAAE,EAAE;MACT,MAAM,IAAIC,cAAW,CACjBD,EAAE,CAACE,OAAO,IAAI,mDAAmD,EACjEF,EAAE,CAACG,IAAI,IAAI,qBAAqB,EAChC;QACIP,IAAI;QACJc,QAAQ;QACRf;MACJ,CACJ,CAAC;IACL;EACJ,CAAC;EAED,OAAO;IACHD,YAAY;IACZU,SAAS;IACTK,YAAY;IACZrB,wBAAwB;IACxBE;EACJ,CAAC;AACL,CAAC;AAACqB,OAAA,CAAA1B,6BAAA,GAAAA,6BAAA"}
1
+ {"version":3,"names":["_error","_interopRequireDefault","require","_dbDynamodb","createSystemStorageOperations","params","entity","createSystemPartitionKey","tenant","createSystemSortKey","createKeys","PK","SK","createSystem","system","keys","put","item","ex","WebinyError","message","code","getSystem","getClean","updateSystem","original","exports"],"sources":["index.ts"],"sourcesContent":["import {\n FormBuilderStorageOperationsCreateSystemParams,\n FormBuilderStorageOperationsGetSystemParams,\n FormBuilderStorageOperationsUpdateSystemParams,\n System\n} from \"@webiny/api-form-builder/types\";\nimport { Entity, Table } from \"@webiny/db-dynamodb/toolbox\";\nimport { FormBuilderSystemCreateKeysParams, FormBuilderSystemStorageOperations } from \"~/types\";\nimport WebinyError from \"@webiny/error\";\nimport { getClean, put } from \"@webiny/db-dynamodb\";\n\nexport interface CreateSystemStorageOperationsParams {\n entity: Entity<any>;\n table: Table<string, string, string>;\n}\n\nexport const createSystemStorageOperations = (\n params: CreateSystemStorageOperationsParams\n): FormBuilderSystemStorageOperations => {\n const { entity } = params;\n\n const createSystemPartitionKey = ({ tenant }: FormBuilderSystemCreateKeysParams): string => {\n return `T#${tenant}#SYSTEM`;\n };\n\n const createSystemSortKey = (): string => {\n return \"FB\";\n };\n\n const createKeys = (params: FormBuilderSystemCreateKeysParams) => {\n return {\n PK: createSystemPartitionKey(params),\n SK: createSystemSortKey()\n };\n };\n\n const createSystem = async (\n params: FormBuilderStorageOperationsCreateSystemParams\n ): Promise<System> => {\n const { system } = params;\n const keys = createKeys(system);\n\n try {\n await put({\n entity,\n item: {\n ...system,\n ...keys\n }\n });\n return system;\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not create the system record by given keys.\",\n ex.code || \"CREATE_SYSTEM_ERROR\",\n {\n keys,\n system\n }\n );\n }\n };\n\n const getSystem = async (\n params: FormBuilderStorageOperationsGetSystemParams\n ): Promise<System | null> => {\n const keys = createKeys(params);\n\n try {\n return await getClean<System>({\n entity,\n keys\n });\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not get the system record by given keys.\",\n ex.code || \"LOAD_SYSTEM_ERROR\",\n {\n keys\n }\n );\n }\n };\n\n const updateSystem = async (\n params: FormBuilderStorageOperationsUpdateSystemParams\n ): Promise<System> => {\n const { system, original } = params;\n const keys = createKeys(system);\n\n try {\n await put({\n entity,\n item: {\n ...system,\n ...keys\n }\n });\n return system;\n } catch (ex) {\n throw new WebinyError(\n ex.message || \"Could not update the system record by given keys.\",\n ex.code || \"UPDATE_SYSTEM_ERROR\",\n {\n keys,\n original,\n system\n }\n );\n }\n };\n\n return {\n createSystem,\n getSystem,\n updateSystem,\n createSystemPartitionKey,\n createSystemSortKey\n };\n};\n"],"mappings":";;;;;;;AAQA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAOO,MAAME,6BAA6B,GACtCC,MAA2C,IACN;EACrC,MAAM;IAAEC;EAAO,CAAC,GAAGD,MAAM;EAEzB,MAAME,wBAAwB,GAAGA,CAAC;IAAEC;EAA0C,CAAC,KAAa;IACxF,OAAQ,KAAIA,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AAI,GAAGL,UAAU,CAACI,MAAM,CAAC;IAE/B,IAAI;MACA,MAAM,IAAAE,eAAG,EAAC;QACNV,MAAM;QACNW,IAAI,EAAE;UACF,GAAGH,MAAM;UACT,GAAGC;QACP;MACJ,CAAC,CAAC;MACF,OAAOD,MAAM;IACjB,CAAC,CAAC,OAAOI,EAAE,EAAE;MACT,MAAM,IAAIC,cAAW,CACjBD,EAAE,CAACE,OAAO,IAAI,mDAAmD,EACjEF,EAAE,CAACG,IAAI,IAAI,qBAAqB,EAChC;QACIN,IAAI;QACJU,QAAQ;QACRX;MACJ,CACJ,CAAC;IACL;EACJ,CAAC;EAED,OAAO;IACHD,YAAY;IACZS,SAAS;IACTE,YAAY;IACZjB,wBAAwB;IACxBE;EACJ,CAAC;AACL,CAAC;AAACiB,OAAA,CAAAtB,6BAAA,GAAAA,6BAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webiny/api-form-builder-so-ddb-es",
3
- "version": "5.39.0-beta.0",
3
+ "version": "5.39.0-beta.2",
4
4
  "main": "index.js",
5
5
  "keywords": [
6
6
  "@webiny/api-form-builder",
@@ -8,7 +8,10 @@
8
8
  "dynamodb",
9
9
  "elasticsearch",
10
10
  "ddb-es",
11
- "fb:ddb-es"
11
+ "fb:ddb-es",
12
+ "opensearch",
13
+ "ddb-os",
14
+ "fb:ddb-os"
12
15
  ],
13
16
  "repository": {
14
17
  "type": "git",
@@ -24,13 +27,13 @@
24
27
  "dependencies": {
25
28
  "@babel/runtime": "7.22.6",
26
29
  "@elastic/elasticsearch": "7.12.0",
27
- "@webiny/api-elasticsearch": "5.39.0-beta.0",
28
- "@webiny/api-form-builder": "5.39.0-beta.0",
29
- "@webiny/db-dynamodb": "5.39.0-beta.0",
30
- "@webiny/error": "5.39.0-beta.0",
31
- "@webiny/plugins": "5.39.0-beta.0",
32
- "@webiny/utils": "5.39.0-beta.0",
33
- "dynamodb-toolbox": "0.3.5",
30
+ "@webiny/api-elasticsearch": "5.39.0-beta.2",
31
+ "@webiny/api-form-builder": "5.39.0-beta.2",
32
+ "@webiny/aws-sdk": "5.39.0-beta.2",
33
+ "@webiny/db-dynamodb": "5.39.0-beta.2",
34
+ "@webiny/error": "5.39.0-beta.2",
35
+ "@webiny/plugins": "5.39.0-beta.2",
36
+ "@webiny/utils": "5.39.0-beta.2",
34
37
  "elastic-ts": "0.8.0"
35
38
  },
36
39
  "devDependencies": {
@@ -38,11 +41,11 @@
38
41
  "@babel/core": "7.22.8",
39
42
  "@babel/preset-env": "7.22.7",
40
43
  "@babel/preset-typescript": "7.22.5",
41
- "@webiny/api-dynamodb-to-elasticsearch": "5.39.0-beta.0",
42
- "@webiny/cli": "5.39.0-beta.0",
43
- "@webiny/handler-aws": "5.39.0-beta.0",
44
- "@webiny/handler-db": "5.39.0-beta.0",
45
- "@webiny/project-utils": "5.39.0-beta.0",
44
+ "@webiny/api-dynamodb-to-elasticsearch": "5.39.0-beta.2",
45
+ "@webiny/cli": "5.39.0-beta.2",
46
+ "@webiny/handler-aws": "5.39.0-beta.2",
47
+ "@webiny/handler-db": "5.39.0-beta.2",
48
+ "@webiny/project-utils": "5.39.0-beta.2",
46
49
  "csvtojson": "2.0.10",
47
50
  "jest": "29.5.0",
48
51
  "jest-dynalite": "3.6.1",
@@ -58,5 +61,5 @@
58
61
  "build": "yarn webiny run build",
59
62
  "watch": "yarn webiny run watch"
60
63
  },
61
- "gitHead": "df94742fba6658ed3507e1e17ab53dc77bb66330"
64
+ "gitHead": "193039382160557448f23f43685f29136f58f87a"
62
65
  }
@@ -1,14 +1,13 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
3
  Object.defineProperty(exports, "__esModule", {
5
4
  value: true
6
5
  });
7
6
  exports.FormDynamoDbFieldPlugin = void 0;
8
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
7
  var _FieldPlugin = require("@webiny/db-dynamodb/plugins/definitions/FieldPlugin");
10
- class FormDynamoDbFieldPlugin extends _FieldPlugin.FieldPlugin {}
8
+ class FormDynamoDbFieldPlugin extends _FieldPlugin.FieldPlugin {
9
+ static type = "formBuilder.dynamodb.field.form";
10
+ }
11
11
  exports.FormDynamoDbFieldPlugin = FormDynamoDbFieldPlugin;
12
- (0, _defineProperty2.default)(FormDynamoDbFieldPlugin, "type", "formBuilder.dynamodb.field.form");
13
12
 
14
13
  //# sourceMappingURL=FormDynamoDbFieldPlugin.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_FieldPlugin","require","FormDynamoDbFieldPlugin","FieldPlugin","exports","_defineProperty2","default"],"sources":["FormDynamoDbFieldPlugin.ts"],"sourcesContent":["import { FieldPlugin } from \"@webiny/db-dynamodb/plugins/definitions/FieldPlugin\";\n\nexport class FormDynamoDbFieldPlugin extends FieldPlugin {\n public static override readonly type: string = \"formBuilder.dynamodb.field.form\";\n}\n"],"mappings":";;;;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAEO,MAAMC,uBAAuB,SAASC,wBAAW,CAAC;AAExDC,OAAA,CAAAF,uBAAA,GAAAA,uBAAA;AAAA,IAAAG,gBAAA,CAAAC,OAAA,EAFYJ,uBAAuB,UACe,iCAAiC"}
1
+ {"version":3,"names":["_FieldPlugin","require","FormDynamoDbFieldPlugin","FieldPlugin","type","exports"],"sources":["FormDynamoDbFieldPlugin.ts"],"sourcesContent":["import { FieldPlugin } from \"@webiny/db-dynamodb/plugins/definitions/FieldPlugin\";\n\nexport class FormDynamoDbFieldPlugin extends FieldPlugin {\n public static override readonly type: string = \"formBuilder.dynamodb.field.form\";\n}\n"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAEO,MAAMC,uBAAuB,SAASC,wBAAW,CAAC;EACrD,OAAgCC,IAAI,GAAW,iCAAiC;AACpF;AAACC,OAAA,CAAAH,uBAAA,GAAAA,uBAAA"}
@@ -1,14 +1,13 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
3
  Object.defineProperty(exports, "__esModule", {
5
4
  value: true
6
5
  });
7
6
  exports.FormElasticsearchBodyModifierPlugin = void 0;
8
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
7
  var _apiElasticsearch = require("@webiny/api-elasticsearch");
10
- class FormElasticsearchBodyModifierPlugin extends _apiElasticsearch.ElasticsearchBodyModifierPlugin {}
8
+ class FormElasticsearchBodyModifierPlugin extends _apiElasticsearch.ElasticsearchBodyModifierPlugin {
9
+ static type = "formBuilder.elasticsearch.modifier.body.form";
10
+ }
11
11
  exports.FormElasticsearchBodyModifierPlugin = FormElasticsearchBodyModifierPlugin;
12
- (0, _defineProperty2.default)(FormElasticsearchBodyModifierPlugin, "type", "formBuilder.elasticsearch.modifier.body.form");
13
12
 
14
13
  //# sourceMappingURL=FormElasticsearchBodyModifierPlugin.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_apiElasticsearch","require","FormElasticsearchBodyModifierPlugin","ElasticsearchBodyModifierPlugin","exports","_defineProperty2","default"],"sources":["FormElasticsearchBodyModifierPlugin.ts"],"sourcesContent":["import { ElasticsearchBodyModifierPlugin } from \"@webiny/api-elasticsearch\";\n\nexport class FormElasticsearchBodyModifierPlugin extends ElasticsearchBodyModifierPlugin {\n public static override readonly type: string = \"formBuilder.elasticsearch.modifier.body.form\";\n}\n"],"mappings":";;;;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AAEO,MAAMC,mCAAmC,SAASC,iDAA+B,CAAC;AAExFC,OAAA,CAAAF,mCAAA,GAAAA,mCAAA;AAAA,IAAAG,gBAAA,CAAAC,OAAA,EAFYJ,mCAAmC,UACG,8CAA8C"}
1
+ {"version":3,"names":["_apiElasticsearch","require","FormElasticsearchBodyModifierPlugin","ElasticsearchBodyModifierPlugin","type","exports"],"sources":["FormElasticsearchBodyModifierPlugin.ts"],"sourcesContent":["import { ElasticsearchBodyModifierPlugin } from \"@webiny/api-elasticsearch\";\n\nexport class FormElasticsearchBodyModifierPlugin extends ElasticsearchBodyModifierPlugin {\n public static override readonly type: string = \"formBuilder.elasticsearch.modifier.body.form\";\n}\n"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AAEO,MAAMC,mCAAmC,SAASC,iDAA+B,CAAC;EACrF,OAAgCC,IAAI,GAAW,8CAA8C;AACjG;AAACC,OAAA,CAAAH,mCAAA,GAAAA,mCAAA"}
@@ -1,14 +1,13 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
3
  Object.defineProperty(exports, "__esModule", {
5
4
  value: true
6
5
  });
7
6
  exports.FormElasticsearchFieldPlugin = void 0;
8
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
7
  var _apiElasticsearch = require("@webiny/api-elasticsearch");
10
- class FormElasticsearchFieldPlugin extends _apiElasticsearch.ElasticsearchFieldPlugin {}
8
+ class FormElasticsearchFieldPlugin extends _apiElasticsearch.ElasticsearchFieldPlugin {
9
+ static type = "formBuilder.elasticsearch.fieldDefinition.form";
10
+ }
11
11
  exports.FormElasticsearchFieldPlugin = FormElasticsearchFieldPlugin;
12
- (0, _defineProperty2.default)(FormElasticsearchFieldPlugin, "type", "formBuilder.elasticsearch.fieldDefinition.form");
13
12
 
14
13
  //# sourceMappingURL=FormElasticsearchFieldPlugin.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_apiElasticsearch","require","FormElasticsearchFieldPlugin","ElasticsearchFieldPlugin","exports","_defineProperty2","default"],"sources":["FormElasticsearchFieldPlugin.ts"],"sourcesContent":["import { ElasticsearchFieldPlugin } from \"@webiny/api-elasticsearch\";\n\nexport class FormElasticsearchFieldPlugin extends ElasticsearchFieldPlugin {\n public static override readonly type: string = \"formBuilder.elasticsearch.fieldDefinition.form\";\n}\n"],"mappings":";;;;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AAEO,MAAMC,4BAA4B,SAASC,0CAAwB,CAAC;AAE1EC,OAAA,CAAAF,4BAAA,GAAAA,4BAAA;AAAA,IAAAG,gBAAA,CAAAC,OAAA,EAFYJ,4BAA4B,UACU,gDAAgD"}
1
+ {"version":3,"names":["_apiElasticsearch","require","FormElasticsearchFieldPlugin","ElasticsearchFieldPlugin","type","exports"],"sources":["FormElasticsearchFieldPlugin.ts"],"sourcesContent":["import { ElasticsearchFieldPlugin } from \"@webiny/api-elasticsearch\";\n\nexport class FormElasticsearchFieldPlugin extends ElasticsearchFieldPlugin {\n public static override readonly type: string = \"formBuilder.elasticsearch.fieldDefinition.form\";\n}\n"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AAEO,MAAMC,4BAA4B,SAASC,0CAAwB,CAAC;EACvE,OAAgCC,IAAI,GAAW,gDAAgD;AACnG;AAACC,OAAA,CAAAH,4BAAA,GAAAA,4BAAA"}
@@ -1,14 +1,13 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
3
  Object.defineProperty(exports, "__esModule", {
5
4
  value: true
6
5
  });
7
6
  exports.FormElasticsearchIndexPlugin = void 0;
8
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
7
  var _apiElasticsearch = require("@webiny/api-elasticsearch");
10
- class FormElasticsearchIndexPlugin extends _apiElasticsearch.ElasticsearchIndexPlugin {}
8
+ class FormElasticsearchIndexPlugin extends _apiElasticsearch.ElasticsearchIndexPlugin {
9
+ static type = "formBuilder.form.elasticsearch.index";
10
+ }
11
11
  exports.FormElasticsearchIndexPlugin = FormElasticsearchIndexPlugin;
12
- (0, _defineProperty2.default)(FormElasticsearchIndexPlugin, "type", "formBuilder.form.elasticsearch.index");
13
12
 
14
13
  //# sourceMappingURL=FormElasticsearchIndexPlugin.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_apiElasticsearch","require","FormElasticsearchIndexPlugin","ElasticsearchIndexPlugin","exports","_defineProperty2","default"],"sources":["FormElasticsearchIndexPlugin.ts"],"sourcesContent":["import { ElasticsearchIndexPlugin } from \"@webiny/api-elasticsearch\";\n\nexport class FormElasticsearchIndexPlugin extends ElasticsearchIndexPlugin {\n public static override readonly type: string = \"formBuilder.form.elasticsearch.index\";\n}\n"],"mappings":";;;;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AAEO,MAAMC,4BAA4B,SAASC,0CAAwB,CAAC;AAE1EC,OAAA,CAAAF,4BAAA,GAAAA,4BAAA;AAAA,IAAAG,gBAAA,CAAAC,OAAA,EAFYJ,4BAA4B,UACU,sCAAsC"}
1
+ {"version":3,"names":["_apiElasticsearch","require","FormElasticsearchIndexPlugin","ElasticsearchIndexPlugin","type","exports"],"sources":["FormElasticsearchIndexPlugin.ts"],"sourcesContent":["import { ElasticsearchIndexPlugin } from \"@webiny/api-elasticsearch\";\n\nexport class FormElasticsearchIndexPlugin extends ElasticsearchIndexPlugin {\n public static override readonly type: string = \"formBuilder.form.elasticsearch.index\";\n}\n"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AAEO,MAAMC,4BAA4B,SAASC,0CAAwB,CAAC;EACvE,OAAgCC,IAAI,GAAW,sCAAsC;AACzF;AAACC,OAAA,CAAAH,4BAAA,GAAAA,4BAAA"}
@@ -1,14 +1,13 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
3
  Object.defineProperty(exports, "__esModule", {
5
4
  value: true
6
5
  });
7
6
  exports.FormElasticsearchQueryModifierPlugin = void 0;
8
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
7
  var _apiElasticsearch = require("@webiny/api-elasticsearch");
10
- class FormElasticsearchQueryModifierPlugin extends _apiElasticsearch.ElasticsearchQueryModifierPlugin {}
8
+ class FormElasticsearchQueryModifierPlugin extends _apiElasticsearch.ElasticsearchQueryModifierPlugin {
9
+ static type = "formBuilder.elasticsearch.modifier.query.form";
10
+ }
11
11
  exports.FormElasticsearchQueryModifierPlugin = FormElasticsearchQueryModifierPlugin;
12
- (0, _defineProperty2.default)(FormElasticsearchQueryModifierPlugin, "type", "formBuilder.elasticsearch.modifier.query.form");
13
12
 
14
13
  //# sourceMappingURL=FormElasticsearchQueryModifierPlugin.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_apiElasticsearch","require","FormElasticsearchQueryModifierPlugin","ElasticsearchQueryModifierPlugin","exports","_defineProperty2","default"],"sources":["FormElasticsearchQueryModifierPlugin.ts"],"sourcesContent":["import { ElasticsearchQueryModifierPlugin } from \"@webiny/api-elasticsearch\";\n\nexport class FormElasticsearchQueryModifierPlugin extends ElasticsearchQueryModifierPlugin {\n public static override readonly type: string = \"formBuilder.elasticsearch.modifier.query.form\";\n}\n"],"mappings":";;;;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AAEO,MAAMC,oCAAoC,SAASC,kDAAgC,CAAC;AAE1FC,OAAA,CAAAF,oCAAA,GAAAA,oCAAA;AAAA,IAAAG,gBAAA,CAAAC,OAAA,EAFYJ,oCAAoC,UACE,+CAA+C"}
1
+ {"version":3,"names":["_apiElasticsearch","require","FormElasticsearchQueryModifierPlugin","ElasticsearchQueryModifierPlugin","type","exports"],"sources":["FormElasticsearchQueryModifierPlugin.ts"],"sourcesContent":["import { ElasticsearchQueryModifierPlugin } from \"@webiny/api-elasticsearch\";\n\nexport class FormElasticsearchQueryModifierPlugin extends ElasticsearchQueryModifierPlugin {\n public static override readonly type: string = \"formBuilder.elasticsearch.modifier.query.form\";\n}\n"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AAEO,MAAMC,oCAAoC,SAASC,kDAAgC,CAAC;EACvF,OAAgCC,IAAI,GAAW,+CAA+C;AAClG;AAACC,OAAA,CAAAH,oCAAA,GAAAA,oCAAA"}
@@ -1,14 +1,13 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
3
  Object.defineProperty(exports, "__esModule", {
5
4
  value: true
6
5
  });
7
6
  exports.FormElasticsearchSortModifierPlugin = void 0;
8
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
7
  var _apiElasticsearch = require("@webiny/api-elasticsearch");
10
- class FormElasticsearchSortModifierPlugin extends _apiElasticsearch.ElasticsearchSortModifierPlugin {}
8
+ class FormElasticsearchSortModifierPlugin extends _apiElasticsearch.ElasticsearchSortModifierPlugin {
9
+ static type = "formBuilder.elasticsearch.modifier.sort.form";
10
+ }
11
11
  exports.FormElasticsearchSortModifierPlugin = FormElasticsearchSortModifierPlugin;
12
- (0, _defineProperty2.default)(FormElasticsearchSortModifierPlugin, "type", "formBuilder.elasticsearch.modifier.sort.form");
13
12
 
14
13
  //# sourceMappingURL=FormElasticsearchSortModifierPlugin.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_apiElasticsearch","require","FormElasticsearchSortModifierPlugin","ElasticsearchSortModifierPlugin","exports","_defineProperty2","default"],"sources":["FormElasticsearchSortModifierPlugin.ts"],"sourcesContent":["import { ElasticsearchSortModifierPlugin } from \"@webiny/api-elasticsearch\";\n\nexport class FormElasticsearchSortModifierPlugin extends ElasticsearchSortModifierPlugin {\n public static override readonly type: string = \"formBuilder.elasticsearch.modifier.sort.form\";\n}\n"],"mappings":";;;;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AAEO,MAAMC,mCAAmC,SAASC,iDAA+B,CAAC;AAExFC,OAAA,CAAAF,mCAAA,GAAAA,mCAAA;AAAA,IAAAG,gBAAA,CAAAC,OAAA,EAFYJ,mCAAmC,UACG,8CAA8C"}
1
+ {"version":3,"names":["_apiElasticsearch","require","FormElasticsearchSortModifierPlugin","ElasticsearchSortModifierPlugin","type","exports"],"sources":["FormElasticsearchSortModifierPlugin.ts"],"sourcesContent":["import { ElasticsearchSortModifierPlugin } from \"@webiny/api-elasticsearch\";\n\nexport class FormElasticsearchSortModifierPlugin extends ElasticsearchSortModifierPlugin {\n public static override readonly type: string = \"formBuilder.elasticsearch.modifier.sort.form\";\n}\n"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AAEO,MAAMC,mCAAmC,SAASC,iDAA+B,CAAC;EACrF,OAAgCC,IAAI,GAAW,8CAA8C;AACjG;AAACC,OAAA,CAAAH,mCAAA,GAAAA,mCAAA"}
@@ -1,14 +1,13 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
3
  Object.defineProperty(exports, "__esModule", {
5
4
  value: true
6
5
  });
7
6
  exports.SubmissionElasticsearchBodyModifierPlugin = void 0;
8
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
7
  var _apiElasticsearch = require("@webiny/api-elasticsearch");
10
- class SubmissionElasticsearchBodyModifierPlugin extends _apiElasticsearch.ElasticsearchBodyModifierPlugin {}
8
+ class SubmissionElasticsearchBodyModifierPlugin extends _apiElasticsearch.ElasticsearchBodyModifierPlugin {
9
+ static type = "formBuilder.elasticsearch.modifier.body.submission";
10
+ }
11
11
  exports.SubmissionElasticsearchBodyModifierPlugin = SubmissionElasticsearchBodyModifierPlugin;
12
- (0, _defineProperty2.default)(SubmissionElasticsearchBodyModifierPlugin, "type", "formBuilder.elasticsearch.modifier.body.submission");
13
12
 
14
13
  //# sourceMappingURL=SubmissionElasticsearchBodyModifierPlugin.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_apiElasticsearch","require","SubmissionElasticsearchBodyModifierPlugin","ElasticsearchBodyModifierPlugin","exports","_defineProperty2","default"],"sources":["SubmissionElasticsearchBodyModifierPlugin.ts"],"sourcesContent":["import { ElasticsearchBodyModifierPlugin } from \"@webiny/api-elasticsearch\";\n\nexport class SubmissionElasticsearchBodyModifierPlugin extends ElasticsearchBodyModifierPlugin {\n public static override readonly type: string =\n \"formBuilder.elasticsearch.modifier.body.submission\";\n}\n"],"mappings":";;;;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AAEO,MAAMC,yCAAyC,SAASC,iDAA+B,CAAC;AAG9FC,OAAA,CAAAF,yCAAA,GAAAA,yCAAA;AAAA,IAAAG,gBAAA,CAAAC,OAAA,EAHYJ,yCAAyC,UAE9C,oDAAoD"}
1
+ {"version":3,"names":["_apiElasticsearch","require","SubmissionElasticsearchBodyModifierPlugin","ElasticsearchBodyModifierPlugin","type","exports"],"sources":["SubmissionElasticsearchBodyModifierPlugin.ts"],"sourcesContent":["import { ElasticsearchBodyModifierPlugin } from \"@webiny/api-elasticsearch\";\n\nexport class SubmissionElasticsearchBodyModifierPlugin extends ElasticsearchBodyModifierPlugin {\n public static override readonly type: string =\n \"formBuilder.elasticsearch.modifier.body.submission\";\n}\n"],"mappings":";;;;;;AAAA,IAAAA,iBAAA,GAAAC,OAAA;AAEO,MAAMC,yCAAyC,SAASC,iDAA+B,CAAC;EAC3F,OAAgCC,IAAI,GAChC,oDAAoD;AAC5D;AAACC,OAAA,CAAAH,yCAAA,GAAAA,yCAAA"}
@@ -1,14 +1,13 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
3
  Object.defineProperty(exports, "__esModule", {
5
4
  value: true
6
5
  });
7
6
  exports.SubmissionElasticsearchFieldPlugin = void 0;
8
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
7
  var _apiElasticsearch = require("@webiny/api-elasticsearch");
10
- class SubmissionElasticsearchFieldPlugin extends _apiElasticsearch.ElasticsearchFieldPlugin {}
8
+ class SubmissionElasticsearchFieldPlugin extends _apiElasticsearch.ElasticsearchFieldPlugin {
9
+ static type = "formBuilder.elasticsearch.fieldDefinition.submission";
10
+ }
11
11
  exports.SubmissionElasticsearchFieldPlugin = SubmissionElasticsearchFieldPlugin;
12
- (0, _defineProperty2.default)(SubmissionElasticsearchFieldPlugin, "type", "formBuilder.elasticsearch.fieldDefinition.submission");
13
12
 
14
13
  //# sourceMappingURL=SubmissionElasticsearchFieldPlugin.js.map