@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
@@ -1,9 +1,49 @@
1
- import { Entity, Table } from "dynamodb-toolbox";
1
+ import { Entity, Table } from "@webiny/db-dynamodb/toolbox";
2
2
  import { Attributes } from "../types";
3
3
  interface Params {
4
- table: Table;
4
+ table: Table<string, string, string>;
5
5
  entityName: string;
6
6
  attributes: Attributes;
7
7
  }
8
- export declare const createElasticsearchEntity: (params: Params) => Entity<{}>;
8
+ export declare const createElasticsearchEntity: (params: Params) => Entity<string, import("dynamodb-toolbox/dist/cjs/classes/Entity").Overlay, import("dynamodb-toolbox/dist/cjs/classes/Entity").Overlay, Table<string, string, string>, boolean, boolean, boolean, string, string, string, boolean, {
9
+ PK: {
10
+ partitionKey: true;
11
+ };
12
+ SK: {
13
+ sortKey: true;
14
+ };
15
+ index: {
16
+ type: "string";
17
+ };
18
+ data: {
19
+ type: "map";
20
+ };
21
+ TYPE: {
22
+ type: "string";
23
+ };
24
+ }, {
25
+ PK: {
26
+ partitionKey: true;
27
+ };
28
+ SK: {
29
+ sortKey: true;
30
+ };
31
+ index: {
32
+ type: "string";
33
+ };
34
+ data: {
35
+ type: "map";
36
+ };
37
+ TYPE: {
38
+ type: "string";
39
+ };
40
+ }, import("dynamodb-toolbox/dist/cjs/classes/Entity").ParsedAttributes<import("ts-toolbelt/out/Any/Key").Key>, any, {
41
+ [x: string]: any;
42
+ [x: number]: any;
43
+ [x: symbol]: any;
44
+ }, {
45
+ [x: string]: any;
46
+ [x: number]: any;
47
+ [x: symbol]: any;
48
+ }>;
9
49
  export {};
@@ -1,22 +1,20 @@
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.createElasticsearchEntity = void 0;
8
- var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
9
- var _dynamodbToolbox = require("dynamodb-toolbox");
7
+ var _toolbox = require("@webiny/db-dynamodb/toolbox");
10
8
  const createElasticsearchEntity = params => {
11
9
  const {
12
10
  table,
13
11
  entityName,
14
12
  attributes
15
13
  } = params;
16
- return new _dynamodbToolbox.Entity({
14
+ return new _toolbox.Entity({
17
15
  name: entityName,
18
16
  table,
19
- attributes: (0, _objectSpread2.default)({
17
+ attributes: {
20
18
  PK: {
21
19
  partitionKey: true
22
20
  },
@@ -31,8 +29,9 @@ const createElasticsearchEntity = params => {
31
29
  },
32
30
  TYPE: {
33
31
  type: "string"
34
- }
35
- }, attributes || {})
32
+ },
33
+ ...(attributes || {})
34
+ }
36
35
  });
37
36
  };
38
37
  exports.createElasticsearchEntity = createElasticsearchEntity;
@@ -1 +1 @@
1
- {"version":3,"names":["_dynamodbToolbox","require","createElasticsearchEntity","params","table","entityName","attributes","Entity","name","_objectSpread2","default","PK","partitionKey","SK","sortKey","index","type","data","TYPE","exports"],"sources":["elasticsearch.ts"],"sourcesContent":["import { Entity, Table } from \"dynamodb-toolbox\";\nimport { Attributes } from \"~/types\";\n\ninterface Params {\n table: Table;\n entityName: string;\n attributes: Attributes;\n}\n\nexport const createElasticsearchEntity = (params: Params) => {\n const { table, entityName, attributes } = params;\n return new Entity({\n name: entityName,\n table,\n attributes: {\n PK: {\n partitionKey: true\n },\n SK: {\n sortKey: true\n },\n index: {\n type: \"string\"\n },\n data: {\n type: \"map\"\n },\n TYPE: {\n type: \"string\"\n },\n\n ...(attributes || {})\n }\n });\n};\n"],"mappings":";;;;;;;;AAAA,IAAAA,gBAAA,GAAAC,OAAA;AASO,MAAMC,yBAAyB,GAAIC,MAAc,IAAK;EACzD,MAAM;IAAEC,KAAK;IAAEC,UAAU;IAAEC;EAAW,CAAC,GAAGH,MAAM;EAChD,OAAO,IAAII,uBAAM,CAAC;IACdC,IAAI,EAAEH,UAAU;IAChBD,KAAK;IACLE,UAAU,MAAAG,cAAA,CAAAC,OAAA;MACNC,EAAE,EAAE;QACAC,YAAY,EAAE;MAClB,CAAC;MACDC,EAAE,EAAE;QACAC,OAAO,EAAE;MACb,CAAC;MACDC,KAAK,EAAE;QACHC,IAAI,EAAE;MACV,CAAC;MACDC,IAAI,EAAE;QACFD,IAAI,EAAE;MACV,CAAC;MACDE,IAAI,EAAE;QACFF,IAAI,EAAE;MACV;IAAC,GAEGV,UAAU,IAAI,CAAC,CAAC;EAE5B,CAAC,CAAC;AACN,CAAC;AAACa,OAAA,CAAAjB,yBAAA,GAAAA,yBAAA"}
1
+ {"version":3,"names":["_toolbox","require","createElasticsearchEntity","params","table","entityName","attributes","Entity","name","PK","partitionKey","SK","sortKey","index","type","data","TYPE","exports"],"sources":["elasticsearch.ts"],"sourcesContent":["import { Entity, Table } from \"@webiny/db-dynamodb/toolbox\";\nimport { Attributes } from \"~/types\";\n\ninterface Params {\n table: Table<string, string, string>;\n entityName: string;\n attributes: Attributes;\n}\n\nexport const createElasticsearchEntity = (params: Params) => {\n const { table, entityName, attributes } = params;\n return new Entity({\n name: entityName,\n table,\n attributes: {\n PK: {\n partitionKey: true\n },\n SK: {\n sortKey: true\n },\n index: {\n type: \"string\"\n },\n data: {\n type: \"map\"\n },\n TYPE: {\n type: \"string\"\n },\n\n ...(attributes || {})\n }\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AASO,MAAMC,yBAAyB,GAAIC,MAAc,IAAK;EACzD,MAAM;IAAEC,KAAK;IAAEC,UAAU;IAAEC;EAAW,CAAC,GAAGH,MAAM;EAChD,OAAO,IAAII,eAAM,CAAC;IACdC,IAAI,EAAEH,UAAU;IAChBD,KAAK;IACLE,UAAU,EAAE;MACRG,EAAE,EAAE;QACAC,YAAY,EAAE;MAClB,CAAC;MACDC,EAAE,EAAE;QACAC,OAAO,EAAE;MACb,CAAC;MACDC,KAAK,EAAE;QACHC,IAAI,EAAE;MACV,CAAC;MACDC,IAAI,EAAE;QACFD,IAAI,EAAE;MACV,CAAC;MACDE,IAAI,EAAE;QACFF,IAAI,EAAE;MACV,CAAC;MAED,IAAIR,UAAU,IAAI,CAAC,CAAC;IACxB;EACJ,CAAC,CAAC;AACN,CAAC;AAACW,OAAA,CAAAf,yBAAA,GAAAA,yBAAA"}
@@ -1,7 +1,7 @@
1
- import { Entity, Table } from "dynamodb-toolbox";
1
+ import { Entity, Table } from "@webiny/db-dynamodb/toolbox";
2
2
  import { Attributes } from "../types";
3
3
  interface Params {
4
- table: Table;
4
+ table: Table<string, string, string>;
5
5
  entityName: string;
6
6
  attributes: Attributes;
7
7
  }
@@ -1,22 +1,20 @@
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.createFormEntity = void 0;
8
- var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
9
- var _dynamodbToolbox = require("dynamodb-toolbox");
7
+ var _toolbox = require("@webiny/db-dynamodb/toolbox");
10
8
  const createFormEntity = params => {
11
9
  const {
12
10
  table,
13
11
  entityName,
14
12
  attributes
15
13
  } = params;
16
- return new _dynamodbToolbox.Entity({
14
+ return new _toolbox.Entity({
17
15
  table,
18
16
  name: entityName,
19
- attributes: (0, _objectSpread2.default)({
17
+ attributes: {
20
18
  PK: {
21
19
  partitionKey: true
22
20
  },
@@ -88,8 +86,9 @@ const createFormEntity = params => {
88
86
  },
89
87
  webinyVersion: {
90
88
  type: "string"
91
- }
92
- }, attributes || {})
89
+ },
90
+ ...(attributes || {})
91
+ }
93
92
  });
94
93
  };
95
94
  exports.createFormEntity = createFormEntity;
@@ -1 +1 @@
1
- {"version":3,"names":["_dynamodbToolbox","require","createFormEntity","params","table","entityName","attributes","Entity","name","_objectSpread2","default","PK","partitionKey","SK","sortKey","TYPE","type","id","formId","tenant","locale","createdBy","ownedBy","savedOn","createdOn","slug","version","locked","published","publishedOn","status","fields","steps","stats","settings","triggers","webinyVersion","exports"],"sources":["form.ts"],"sourcesContent":["import { Entity, Table } from \"dynamodb-toolbox\";\nimport { Attributes } from \"~/types\";\n\ninterface Params {\n table: Table;\n entityName: string;\n attributes: Attributes;\n}\n\nexport const createFormEntity = (params: Params): Entity<any> => {\n const { table, entityName, attributes } = params;\n return new Entity({\n table,\n name: entityName,\n attributes: {\n PK: {\n partitionKey: true\n },\n SK: {\n sortKey: true\n },\n TYPE: {\n type: \"string\"\n },\n id: {\n type: \"string\"\n },\n formId: {\n type: \"string\"\n },\n tenant: {\n type: \"string\"\n },\n locale: {\n type: \"string\"\n },\n createdBy: {\n type: \"map\"\n },\n ownedBy: {\n type: \"map\"\n },\n savedOn: {\n type: \"string\"\n },\n createdOn: {\n type: \"string\"\n },\n name: {\n type: \"string\"\n },\n slug: {\n type: \"string\"\n },\n version: {\n type: \"number\"\n },\n locked: {\n type: \"boolean\"\n },\n published: {\n type: \"boolean\"\n },\n publishedOn: {\n type: \"string\"\n },\n status: {\n type: \"string\"\n },\n fields: {\n type: \"list\"\n },\n steps: {\n type: \"list\"\n },\n stats: {\n type: \"map\"\n },\n settings: {\n type: \"map\"\n },\n triggers: {\n type: \"map\"\n },\n webinyVersion: {\n type: \"string\"\n },\n ...(attributes || {})\n }\n });\n};\n"],"mappings":";;;;;;;;AAAA,IAAAA,gBAAA,GAAAC,OAAA;AASO,MAAMC,gBAAgB,GAAIC,MAAc,IAAkB;EAC7D,MAAM;IAAEC,KAAK;IAAEC,UAAU;IAAEC;EAAW,CAAC,GAAGH,MAAM;EAChD,OAAO,IAAII,uBAAM,CAAC;IACdH,KAAK;IACLI,IAAI,EAAEH,UAAU;IAChBC,UAAU,MAAAG,cAAA,CAAAC,OAAA;MACNC,EAAE,EAAE;QACAC,YAAY,EAAE;MAClB,CAAC;MACDC,EAAE,EAAE;QACAC,OAAO,EAAE;MACb,CAAC;MACDC,IAAI,EAAE;QACFC,IAAI,EAAE;MACV,CAAC;MACDC,EAAE,EAAE;QACAD,IAAI,EAAE;MACV,CAAC;MACDE,MAAM,EAAE;QACJF,IAAI,EAAE;MACV,CAAC;MACDG,MAAM,EAAE;QACJH,IAAI,EAAE;MACV,CAAC;MACDI,MAAM,EAAE;QACJJ,IAAI,EAAE;MACV,CAAC;MACDK,SAAS,EAAE;QACPL,IAAI,EAAE;MACV,CAAC;MACDM,OAAO,EAAE;QACLN,IAAI,EAAE;MACV,CAAC;MACDO,OAAO,EAAE;QACLP,IAAI,EAAE;MACV,CAAC;MACDQ,SAAS,EAAE;QACPR,IAAI,EAAE;MACV,CAAC;MACDR,IAAI,EAAE;QACFQ,IAAI,EAAE;MACV,CAAC;MACDS,IAAI,EAAE;QACFT,IAAI,EAAE;MACV,CAAC;MACDU,OAAO,EAAE;QACLV,IAAI,EAAE;MACV,CAAC;MACDW,MAAM,EAAE;QACJX,IAAI,EAAE;MACV,CAAC;MACDY,SAAS,EAAE;QACPZ,IAAI,EAAE;MACV,CAAC;MACDa,WAAW,EAAE;QACTb,IAAI,EAAE;MACV,CAAC;MACDc,MAAM,EAAE;QACJd,IAAI,EAAE;MACV,CAAC;MACDe,MAAM,EAAE;QACJf,IAAI,EAAE;MACV,CAAC;MACDgB,KAAK,EAAE;QACHhB,IAAI,EAAE;MACV,CAAC;MACDiB,KAAK,EAAE;QACHjB,IAAI,EAAE;MACV,CAAC;MACDkB,QAAQ,EAAE;QACNlB,IAAI,EAAE;MACV,CAAC;MACDmB,QAAQ,EAAE;QACNnB,IAAI,EAAE;MACV,CAAC;MACDoB,aAAa,EAAE;QACXpB,IAAI,EAAE;MACV;IAAC,GACGV,UAAU,IAAI,CAAC,CAAC;EAE5B,CAAC,CAAC;AACN,CAAC;AAAC+B,OAAA,CAAAnC,gBAAA,GAAAA,gBAAA"}
1
+ {"version":3,"names":["_toolbox","require","createFormEntity","params","table","entityName","attributes","Entity","name","PK","partitionKey","SK","sortKey","TYPE","type","id","formId","tenant","locale","createdBy","ownedBy","savedOn","createdOn","slug","version","locked","published","publishedOn","status","fields","steps","stats","settings","triggers","webinyVersion","exports"],"sources":["form.ts"],"sourcesContent":["import { Entity, Table } from \"@webiny/db-dynamodb/toolbox\";\nimport { Attributes } from \"~/types\";\n\ninterface Params {\n table: Table<string, string, string>;\n entityName: string;\n attributes: Attributes;\n}\n\nexport const createFormEntity = (params: Params): Entity<any> => {\n const { table, entityName, attributes } = params;\n return new Entity({\n table,\n name: entityName,\n attributes: {\n PK: {\n partitionKey: true\n },\n SK: {\n sortKey: true\n },\n TYPE: {\n type: \"string\"\n },\n id: {\n type: \"string\"\n },\n formId: {\n type: \"string\"\n },\n tenant: {\n type: \"string\"\n },\n locale: {\n type: \"string\"\n },\n createdBy: {\n type: \"map\"\n },\n ownedBy: {\n type: \"map\"\n },\n savedOn: {\n type: \"string\"\n },\n createdOn: {\n type: \"string\"\n },\n name: {\n type: \"string\"\n },\n slug: {\n type: \"string\"\n },\n version: {\n type: \"number\"\n },\n locked: {\n type: \"boolean\"\n },\n published: {\n type: \"boolean\"\n },\n publishedOn: {\n type: \"string\"\n },\n status: {\n type: \"string\"\n },\n fields: {\n type: \"list\"\n },\n steps: {\n type: \"list\"\n },\n stats: {\n type: \"map\"\n },\n settings: {\n type: \"map\"\n },\n triggers: {\n type: \"map\"\n },\n webinyVersion: {\n type: \"string\"\n },\n ...(attributes || {})\n }\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AASO,MAAMC,gBAAgB,GAAIC,MAAc,IAAkB;EAC7D,MAAM;IAAEC,KAAK;IAAEC,UAAU;IAAEC;EAAW,CAAC,GAAGH,MAAM;EAChD,OAAO,IAAII,eAAM,CAAC;IACdH,KAAK;IACLI,IAAI,EAAEH,UAAU;IAChBC,UAAU,EAAE;MACRG,EAAE,EAAE;QACAC,YAAY,EAAE;MAClB,CAAC;MACDC,EAAE,EAAE;QACAC,OAAO,EAAE;MACb,CAAC;MACDC,IAAI,EAAE;QACFC,IAAI,EAAE;MACV,CAAC;MACDC,EAAE,EAAE;QACAD,IAAI,EAAE;MACV,CAAC;MACDE,MAAM,EAAE;QACJF,IAAI,EAAE;MACV,CAAC;MACDG,MAAM,EAAE;QACJH,IAAI,EAAE;MACV,CAAC;MACDI,MAAM,EAAE;QACJJ,IAAI,EAAE;MACV,CAAC;MACDK,SAAS,EAAE;QACPL,IAAI,EAAE;MACV,CAAC;MACDM,OAAO,EAAE;QACLN,IAAI,EAAE;MACV,CAAC;MACDO,OAAO,EAAE;QACLP,IAAI,EAAE;MACV,CAAC;MACDQ,SAAS,EAAE;QACPR,IAAI,EAAE;MACV,CAAC;MACDN,IAAI,EAAE;QACFM,IAAI,EAAE;MACV,CAAC;MACDS,IAAI,EAAE;QACFT,IAAI,EAAE;MACV,CAAC;MACDU,OAAO,EAAE;QACLV,IAAI,EAAE;MACV,CAAC;MACDW,MAAM,EAAE;QACJX,IAAI,EAAE;MACV,CAAC;MACDY,SAAS,EAAE;QACPZ,IAAI,EAAE;MACV,CAAC;MACDa,WAAW,EAAE;QACTb,IAAI,EAAE;MACV,CAAC;MACDc,MAAM,EAAE;QACJd,IAAI,EAAE;MACV,CAAC;MACDe,MAAM,EAAE;QACJf,IAAI,EAAE;MACV,CAAC;MACDgB,KAAK,EAAE;QACHhB,IAAI,EAAE;MACV,CAAC;MACDiB,KAAK,EAAE;QACHjB,IAAI,EAAE;MACV,CAAC;MACDkB,QAAQ,EAAE;QACNlB,IAAI,EAAE;MACV,CAAC;MACDmB,QAAQ,EAAE;QACNnB,IAAI,EAAE;MACV,CAAC;MACDoB,aAAa,EAAE;QACXpB,IAAI,EAAE;MACV,CAAC;MACD,IAAIR,UAAU,IAAI,CAAC,CAAC;IACxB;EACJ,CAAC,CAAC;AACN,CAAC;AAAC6B,OAAA,CAAAjC,gBAAA,GAAAA,gBAAA"}
@@ -1,7 +1,7 @@
1
- import { Entity, Table } from "dynamodb-toolbox";
1
+ import { Entity, Table } from "@webiny/db-dynamodb/toolbox";
2
2
  import { Attributes } from "../types";
3
3
  interface Params {
4
- table: Table;
4
+ table: Table<string, string, string>;
5
5
  entityName: string;
6
6
  attributes: Attributes;
7
7
  }
@@ -1,22 +1,20 @@
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.createSettingsEntity = void 0;
8
- var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
9
- var _dynamodbToolbox = require("dynamodb-toolbox");
7
+ var _toolbox = require("@webiny/db-dynamodb/toolbox");
10
8
  const createSettingsEntity = params => {
11
9
  const {
12
10
  entityName,
13
11
  attributes,
14
12
  table
15
13
  } = params;
16
- return new _dynamodbToolbox.Entity({
14
+ return new _toolbox.Entity({
17
15
  name: entityName,
18
16
  table,
19
- attributes: (0, _objectSpread2.default)({
17
+ attributes: {
20
18
  PK: {
21
19
  partitionKey: true
22
20
  },
@@ -37,8 +35,9 @@ const createSettingsEntity = params => {
37
35
  },
38
36
  locale: {
39
37
  type: "string"
40
- }
41
- }, attributes || {})
38
+ },
39
+ ...(attributes || {})
40
+ }
42
41
  });
43
42
  };
44
43
  exports.createSettingsEntity = createSettingsEntity;
@@ -1 +1 @@
1
- {"version":3,"names":["_dynamodbToolbox","require","createSettingsEntity","params","entityName","attributes","table","Entity","name","_objectSpread2","default","PK","partitionKey","SK","sortKey","TYPE","type","reCaptcha","domain","tenant","locale","exports"],"sources":["settings.ts"],"sourcesContent":["import { Entity, Table } from \"dynamodb-toolbox\";\nimport { Attributes } from \"~/types\";\n\ninterface Params {\n table: Table;\n entityName: string;\n attributes: Attributes;\n}\n\nexport const createSettingsEntity = (params: Params): Entity<any> => {\n const { entityName, attributes, table } = params;\n return new Entity({\n name: entityName,\n table,\n attributes: {\n PK: {\n partitionKey: true\n },\n SK: {\n sortKey: true\n },\n TYPE: {\n type: \"string\"\n },\n reCaptcha: {\n type: \"map\"\n },\n domain: {\n type: \"string\"\n },\n tenant: {\n type: \"string\"\n },\n locale: {\n type: \"string\"\n },\n ...(attributes || {})\n }\n });\n};\n"],"mappings":";;;;;;;;AAAA,IAAAA,gBAAA,GAAAC,OAAA;AASO,MAAMC,oBAAoB,GAAIC,MAAc,IAAkB;EACjE,MAAM;IAAEC,UAAU;IAAEC,UAAU;IAAEC;EAAM,CAAC,GAAGH,MAAM;EAChD,OAAO,IAAII,uBAAM,CAAC;IACdC,IAAI,EAAEJ,UAAU;IAChBE,KAAK;IACLD,UAAU,MAAAI,cAAA,CAAAC,OAAA;MACNC,EAAE,EAAE;QACAC,YAAY,EAAE;MAClB,CAAC;MACDC,EAAE,EAAE;QACAC,OAAO,EAAE;MACb,CAAC;MACDC,IAAI,EAAE;QACFC,IAAI,EAAE;MACV,CAAC;MACDC,SAAS,EAAE;QACPD,IAAI,EAAE;MACV,CAAC;MACDE,MAAM,EAAE;QACJF,IAAI,EAAE;MACV,CAAC;MACDG,MAAM,EAAE;QACJH,IAAI,EAAE;MACV,CAAC;MACDI,MAAM,EAAE;QACJJ,IAAI,EAAE;MACV;IAAC,GACGX,UAAU,IAAI,CAAC,CAAC;EAE5B,CAAC,CAAC;AACN,CAAC;AAACgB,OAAA,CAAAnB,oBAAA,GAAAA,oBAAA"}
1
+ {"version":3,"names":["_toolbox","require","createSettingsEntity","params","entityName","attributes","table","Entity","name","PK","partitionKey","SK","sortKey","TYPE","type","reCaptcha","domain","tenant","locale","exports"],"sources":["settings.ts"],"sourcesContent":["import { Entity, Table } from \"@webiny/db-dynamodb/toolbox\";\nimport { Attributes } from \"~/types\";\n\ninterface Params {\n table: Table<string, string, string>;\n entityName: string;\n attributes: Attributes;\n}\n\nexport const createSettingsEntity = (params: Params): Entity<any> => {\n const { entityName, attributes, table } = params;\n return new Entity({\n name: entityName,\n table,\n attributes: {\n PK: {\n partitionKey: true\n },\n SK: {\n sortKey: true\n },\n TYPE: {\n type: \"string\"\n },\n reCaptcha: {\n type: \"map\"\n },\n domain: {\n type: \"string\"\n },\n tenant: {\n type: \"string\"\n },\n locale: {\n type: \"string\"\n },\n ...(attributes || {})\n }\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AASO,MAAMC,oBAAoB,GAAIC,MAAc,IAAkB;EACjE,MAAM;IAAEC,UAAU;IAAEC,UAAU;IAAEC;EAAM,CAAC,GAAGH,MAAM;EAChD,OAAO,IAAII,eAAM,CAAC;IACdC,IAAI,EAAEJ,UAAU;IAChBE,KAAK;IACLD,UAAU,EAAE;MACRI,EAAE,EAAE;QACAC,YAAY,EAAE;MAClB,CAAC;MACDC,EAAE,EAAE;QACAC,OAAO,EAAE;MACb,CAAC;MACDC,IAAI,EAAE;QACFC,IAAI,EAAE;MACV,CAAC;MACDC,SAAS,EAAE;QACPD,IAAI,EAAE;MACV,CAAC;MACDE,MAAM,EAAE;QACJF,IAAI,EAAE;MACV,CAAC;MACDG,MAAM,EAAE;QACJH,IAAI,EAAE;MACV,CAAC;MACDI,MAAM,EAAE;QACJJ,IAAI,EAAE;MACV,CAAC;MACD,IAAIT,UAAU,IAAI,CAAC,CAAC;IACxB;EACJ,CAAC,CAAC;AACN,CAAC;AAACc,OAAA,CAAAjB,oBAAA,GAAAA,oBAAA"}
@@ -1,7 +1,7 @@
1
- import { Entity, Table } from "dynamodb-toolbox";
1
+ import { Entity, Table } from "@webiny/db-dynamodb/toolbox";
2
2
  import { Attributes } from "../types";
3
3
  interface Params {
4
- table: Table;
4
+ table: Table<string, string, string>;
5
5
  entityName: string;
6
6
  attributes: Attributes;
7
7
  }
@@ -1,22 +1,20 @@
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.createSubmissionEntity = void 0;
8
- var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
9
- var _dynamodbToolbox = require("dynamodb-toolbox");
7
+ var _toolbox = require("@webiny/db-dynamodb/toolbox");
10
8
  const createSubmissionEntity = params => {
11
9
  const {
12
10
  table,
13
11
  entityName,
14
12
  attributes
15
13
  } = params;
16
- return new _dynamodbToolbox.Entity({
14
+ return new _toolbox.Entity({
17
15
  table,
18
16
  name: entityName,
19
- attributes: (0, _objectSpread2.default)({
17
+ attributes: {
20
18
  PK: {
21
19
  partitionKey: true
22
20
  },
@@ -58,8 +56,9 @@ const createSubmissionEntity = params => {
58
56
  },
59
57
  webinyVersion: {
60
58
  type: "string"
61
- }
62
- }, attributes || {})
59
+ },
60
+ ...(attributes || {})
61
+ }
63
62
  });
64
63
  };
65
64
  exports.createSubmissionEntity = createSubmissionEntity;
@@ -1 +1 @@
1
- {"version":3,"names":["_dynamodbToolbox","require","createSubmissionEntity","params","table","entityName","attributes","Entity","name","_objectSpread2","default","PK","partitionKey","SK","sortKey","id","type","TYPE","data","meta","form","logs","createdOn","savedOn","ownedBy","tenant","locale","webinyVersion","exports"],"sources":["submission.ts"],"sourcesContent":["import { Entity, Table } from \"dynamodb-toolbox\";\nimport { Attributes } from \"~/types\";\n\ninterface Params {\n table: Table;\n entityName: string;\n attributes: Attributes;\n}\n\nexport const createSubmissionEntity = (params: Params): Entity<any> => {\n const { table, entityName, attributes } = params;\n return new Entity({\n table,\n name: entityName,\n attributes: {\n PK: {\n partitionKey: true\n },\n SK: {\n sortKey: true\n },\n id: {\n type: \"string\"\n },\n TYPE: {\n type: \"string\"\n },\n data: {\n type: \"map\"\n },\n meta: {\n type: \"map\"\n },\n form: {\n type: \"map\"\n },\n logs: {\n type: \"list\"\n },\n createdOn: {\n type: \"string\"\n },\n savedOn: {\n type: \"string\"\n },\n ownedBy: {\n type: \"map\"\n },\n tenant: {\n type: \"string\"\n },\n locale: {\n type: \"string\"\n },\n webinyVersion: {\n type: \"string\"\n },\n ...(attributes || {})\n }\n });\n};\n"],"mappings":";;;;;;;;AAAA,IAAAA,gBAAA,GAAAC,OAAA;AASO,MAAMC,sBAAsB,GAAIC,MAAc,IAAkB;EACnE,MAAM;IAAEC,KAAK;IAAEC,UAAU;IAAEC;EAAW,CAAC,GAAGH,MAAM;EAChD,OAAO,IAAII,uBAAM,CAAC;IACdH,KAAK;IACLI,IAAI,EAAEH,UAAU;IAChBC,UAAU,MAAAG,cAAA,CAAAC,OAAA;MACNC,EAAE,EAAE;QACAC,YAAY,EAAE;MAClB,CAAC;MACDC,EAAE,EAAE;QACAC,OAAO,EAAE;MACb,CAAC;MACDC,EAAE,EAAE;QACAC,IAAI,EAAE;MACV,CAAC;MACDC,IAAI,EAAE;QACFD,IAAI,EAAE;MACV,CAAC;MACDE,IAAI,EAAE;QACFF,IAAI,EAAE;MACV,CAAC;MACDG,IAAI,EAAE;QACFH,IAAI,EAAE;MACV,CAAC;MACDI,IAAI,EAAE;QACFJ,IAAI,EAAE;MACV,CAAC;MACDK,IAAI,EAAE;QACFL,IAAI,EAAE;MACV,CAAC;MACDM,SAAS,EAAE;QACPN,IAAI,EAAE;MACV,CAAC;MACDO,OAAO,EAAE;QACLP,IAAI,EAAE;MACV,CAAC;MACDQ,OAAO,EAAE;QACLR,IAAI,EAAE;MACV,CAAC;MACDS,MAAM,EAAE;QACJT,IAAI,EAAE;MACV,CAAC;MACDU,MAAM,EAAE;QACJV,IAAI,EAAE;MACV,CAAC;MACDW,aAAa,EAAE;QACXX,IAAI,EAAE;MACV;IAAC,GACGV,UAAU,IAAI,CAAC,CAAC;EAE5B,CAAC,CAAC;AACN,CAAC;AAACsB,OAAA,CAAA1B,sBAAA,GAAAA,sBAAA"}
1
+ {"version":3,"names":["_toolbox","require","createSubmissionEntity","params","table","entityName","attributes","Entity","name","PK","partitionKey","SK","sortKey","id","type","TYPE","data","meta","form","logs","createdOn","savedOn","ownedBy","tenant","locale","webinyVersion","exports"],"sources":["submission.ts"],"sourcesContent":["import { Entity, Table } from \"@webiny/db-dynamodb/toolbox\";\nimport { Attributes } from \"~/types\";\n\ninterface Params {\n table: Table<string, string, string>;\n entityName: string;\n attributes: Attributes;\n}\n\nexport const createSubmissionEntity = (params: Params): Entity<any> => {\n const { table, entityName, attributes } = params;\n return new Entity({\n table,\n name: entityName,\n attributes: {\n PK: {\n partitionKey: true\n },\n SK: {\n sortKey: true\n },\n id: {\n type: \"string\"\n },\n TYPE: {\n type: \"string\"\n },\n data: {\n type: \"map\"\n },\n meta: {\n type: \"map\"\n },\n form: {\n type: \"map\"\n },\n logs: {\n type: \"list\"\n },\n createdOn: {\n type: \"string\"\n },\n savedOn: {\n type: \"string\"\n },\n ownedBy: {\n type: \"map\"\n },\n tenant: {\n type: \"string\"\n },\n locale: {\n type: \"string\"\n },\n webinyVersion: {\n type: \"string\"\n },\n ...(attributes || {})\n }\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AASO,MAAMC,sBAAsB,GAAIC,MAAc,IAAkB;EACnE,MAAM;IAAEC,KAAK;IAAEC,UAAU;IAAEC;EAAW,CAAC,GAAGH,MAAM;EAChD,OAAO,IAAII,eAAM,CAAC;IACdH,KAAK;IACLI,IAAI,EAAEH,UAAU;IAChBC,UAAU,EAAE;MACRG,EAAE,EAAE;QACAC,YAAY,EAAE;MAClB,CAAC;MACDC,EAAE,EAAE;QACAC,OAAO,EAAE;MACb,CAAC;MACDC,EAAE,EAAE;QACAC,IAAI,EAAE;MACV,CAAC;MACDC,IAAI,EAAE;QACFD,IAAI,EAAE;MACV,CAAC;MACDE,IAAI,EAAE;QACFF,IAAI,EAAE;MACV,CAAC;MACDG,IAAI,EAAE;QACFH,IAAI,EAAE;MACV,CAAC;MACDI,IAAI,EAAE;QACFJ,IAAI,EAAE;MACV,CAAC;MACDK,IAAI,EAAE;QACFL,IAAI,EAAE;MACV,CAAC;MACDM,SAAS,EAAE;QACPN,IAAI,EAAE;MACV,CAAC;MACDO,OAAO,EAAE;QACLP,IAAI,EAAE;MACV,CAAC;MACDQ,OAAO,EAAE;QACLR,IAAI,EAAE;MACV,CAAC;MACDS,MAAM,EAAE;QACJT,IAAI,EAAE;MACV,CAAC;MACDU,MAAM,EAAE;QACJV,IAAI,EAAE;MACV,CAAC;MACDW,aAAa,EAAE;QACXX,IAAI,EAAE;MACV,CAAC;MACD,IAAIR,UAAU,IAAI,CAAC,CAAC;IACxB;EACJ,CAAC,CAAC;AACN,CAAC;AAACoB,OAAA,CAAAxB,sBAAA,GAAAA,sBAAA"}
@@ -1,7 +1,7 @@
1
- import { Entity, Table } from "dynamodb-toolbox";
1
+ import { Entity, Table } from "@webiny/db-dynamodb/toolbox";
2
2
  import { Attributes } from "../types";
3
3
  interface Params {
4
- table: Table;
4
+ table: Table<string, string, string>;
5
5
  entityName: string;
6
6
  attributes: Attributes;
7
7
  }
@@ -1,22 +1,20 @@
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.createSystemEntity = void 0;
8
- var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
9
- var _dynamodbToolbox = require("dynamodb-toolbox");
7
+ var _toolbox = require("@webiny/db-dynamodb/toolbox");
10
8
  const createSystemEntity = params => {
11
9
  const {
12
10
  entityName,
13
11
  attributes,
14
12
  table
15
13
  } = params;
16
- return new _dynamodbToolbox.Entity({
14
+ return new _toolbox.Entity({
17
15
  name: entityName,
18
16
  table,
19
- attributes: (0, _objectSpread2.default)({
17
+ attributes: {
20
18
  PK: {
21
19
  partitionKey: true
22
20
  },
@@ -28,8 +26,9 @@ const createSystemEntity = params => {
28
26
  },
29
27
  tenant: {
30
28
  type: "string"
31
- }
32
- }, attributes || {})
29
+ },
30
+ ...(attributes || {})
31
+ }
33
32
  });
34
33
  };
35
34
  exports.createSystemEntity = createSystemEntity;
@@ -1 +1 @@
1
- {"version":3,"names":["_dynamodbToolbox","require","createSystemEntity","params","entityName","attributes","table","Entity","name","_objectSpread2","default","PK","partitionKey","SK","sortKey","version","type","tenant","exports"],"sources":["system.ts"],"sourcesContent":["import { Entity, Table } from \"dynamodb-toolbox\";\nimport { Attributes } from \"~/types\";\n\ninterface Params {\n table: Table;\n entityName: string;\n attributes: Attributes;\n}\n\nexport const createSystemEntity = (params: Params): Entity<any> => {\n const { entityName, attributes, table } = params;\n return new Entity({\n name: entityName,\n table,\n attributes: {\n PK: {\n partitionKey: true\n },\n SK: {\n sortKey: true\n },\n version: {\n type: \"string\"\n },\n tenant: {\n type: \"string\"\n },\n ...(attributes || {})\n }\n });\n};\n"],"mappings":";;;;;;;;AAAA,IAAAA,gBAAA,GAAAC,OAAA;AASO,MAAMC,kBAAkB,GAAIC,MAAc,IAAkB;EAC/D,MAAM;IAAEC,UAAU;IAAEC,UAAU;IAAEC;EAAM,CAAC,GAAGH,MAAM;EAChD,OAAO,IAAII,uBAAM,CAAC;IACdC,IAAI,EAAEJ,UAAU;IAChBE,KAAK;IACLD,UAAU,MAAAI,cAAA,CAAAC,OAAA;MACNC,EAAE,EAAE;QACAC,YAAY,EAAE;MAClB,CAAC;MACDC,EAAE,EAAE;QACAC,OAAO,EAAE;MACb,CAAC;MACDC,OAAO,EAAE;QACLC,IAAI,EAAE;MACV,CAAC;MACDC,MAAM,EAAE;QACJD,IAAI,EAAE;MACV;IAAC,GACGX,UAAU,IAAI,CAAC,CAAC;EAE5B,CAAC,CAAC;AACN,CAAC;AAACa,OAAA,CAAAhB,kBAAA,GAAAA,kBAAA"}
1
+ {"version":3,"names":["_toolbox","require","createSystemEntity","params","entityName","attributes","table","Entity","name","PK","partitionKey","SK","sortKey","version","type","tenant","exports"],"sources":["system.ts"],"sourcesContent":["import { Entity, Table } from \"@webiny/db-dynamodb/toolbox\";\nimport { Attributes } from \"~/types\";\n\ninterface Params {\n table: Table<string, string, string>;\n entityName: string;\n attributes: Attributes;\n}\n\nexport const createSystemEntity = (params: Params): Entity<any> => {\n const { entityName, attributes, table } = params;\n return new Entity({\n name: entityName,\n table,\n attributes: {\n PK: {\n partitionKey: true\n },\n SK: {\n sortKey: true\n },\n version: {\n type: \"string\"\n },\n tenant: {\n type: \"string\"\n },\n ...(attributes || {})\n }\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AASO,MAAMC,kBAAkB,GAAIC,MAAc,IAAkB;EAC/D,MAAM;IAAEC,UAAU;IAAEC,UAAU;IAAEC;EAAM,CAAC,GAAGH,MAAM;EAChD,OAAO,IAAII,eAAM,CAAC;IACdC,IAAI,EAAEJ,UAAU;IAChBE,KAAK;IACLD,UAAU,EAAE;MACRI,EAAE,EAAE;QACAC,YAAY,EAAE;MAClB,CAAC;MACDC,EAAE,EAAE;QACAC,OAAO,EAAE;MACb,CAAC;MACDC,OAAO,EAAE;QACLC,IAAI,EAAE;MACV,CAAC;MACDC,MAAM,EAAE;QACJD,IAAI,EAAE;MACV,CAAC;MACD,IAAIT,UAAU,IAAI,CAAC,CAAC;IACxB;EACJ,CAAC,CAAC;AACN,CAAC;AAACW,OAAA,CAAAd,kBAAA,GAAAA,kBAAA"}
@@ -1,8 +1,8 @@
1
- import { DocumentClient } from "aws-sdk/clients/dynamodb";
2
- import { Table } from "dynamodb-toolbox";
1
+ import { DynamoDBClient } from "@webiny/aws-sdk/client-dynamodb";
2
+ import { Table } from "@webiny/db-dynamodb/toolbox";
3
3
  interface Params {
4
4
  tableName?: string;
5
- documentClient: DocumentClient;
5
+ documentClient: DynamoDBClient;
6
6
  }
7
- export declare const createTable: (params: Params) => Table;
7
+ export declare const createTable: (params: Params) => Table<string, string, string>;
8
8
  export {};
@@ -4,17 +4,19 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.createTable = void 0;
7
- var _dynamodbToolbox = require("dynamodb-toolbox");
7
+ var _toolbox = require("@webiny/db-dynamodb/toolbox");
8
8
  const createTable = params => {
9
9
  const {
10
10
  tableName,
11
11
  documentClient
12
12
  } = params;
13
- return new _dynamodbToolbox.Table({
13
+ return new _toolbox.Table({
14
14
  name: tableName || process.env.DB_TABLE,
15
15
  partitionKey: "PK",
16
16
  sortKey: "SK",
17
- DocumentClient: documentClient
17
+ DocumentClient: documentClient,
18
+ autoExecute: true,
19
+ autoParse: true
18
20
  });
19
21
  };
20
22
  exports.createTable = createTable;
@@ -1 +1 @@
1
- {"version":3,"names":["_dynamodbToolbox","require","createTable","params","tableName","documentClient","Table","name","process","env","DB_TABLE","partitionKey","sortKey","DocumentClient","exports"],"sources":["table.ts"],"sourcesContent":["import { DocumentClient } from \"aws-sdk/clients/dynamodb\";\nimport { Table } from \"dynamodb-toolbox\";\n\ninterface Params {\n tableName?: string;\n documentClient: DocumentClient;\n}\n\nexport const createTable = (params: Params): Table => {\n const { tableName, documentClient } = params;\n\n return new Table({\n name: tableName || (process.env.DB_TABLE as string),\n partitionKey: \"PK\",\n sortKey: \"SK\",\n DocumentClient: documentClient\n });\n};\n"],"mappings":";;;;;;AACA,IAAAA,gBAAA,GAAAC,OAAA;AAOO,MAAMC,WAAW,GAAIC,MAAc,IAAY;EAClD,MAAM;IAAEC,SAAS;IAAEC;EAAe,CAAC,GAAGF,MAAM;EAE5C,OAAO,IAAIG,sBAAK,CAAC;IACbC,IAAI,EAAEH,SAAS,IAAKI,OAAO,CAACC,GAAG,CAACC,QAAmB;IACnDC,YAAY,EAAE,IAAI;IAClBC,OAAO,EAAE,IAAI;IACbC,cAAc,EAAER;EACpB,CAAC,CAAC;AACN,CAAC;AAACS,OAAA,CAAAZ,WAAA,GAAAA,WAAA"}
1
+ {"version":3,"names":["_toolbox","require","createTable","params","tableName","documentClient","Table","name","process","env","DB_TABLE","partitionKey","sortKey","DocumentClient","autoExecute","autoParse","exports"],"sources":["table.ts"],"sourcesContent":["import { DynamoDBClient } from \"@webiny/aws-sdk/client-dynamodb\";\nimport { Table } from \"@webiny/db-dynamodb/toolbox\";\n\ninterface Params {\n tableName?: string;\n documentClient: DynamoDBClient;\n}\n\nexport const createTable = (params: Params): Table<string, string, string> => {\n const { tableName, documentClient } = params;\n\n return new Table({\n name: tableName || (process.env.DB_TABLE as string),\n partitionKey: \"PK\",\n sortKey: \"SK\",\n DocumentClient: documentClient,\n autoExecute: true,\n autoParse: true\n });\n};\n"],"mappings":";;;;;;AACA,IAAAA,QAAA,GAAAC,OAAA;AAOO,MAAMC,WAAW,GAAIC,MAAc,IAAoC;EAC1E,MAAM;IAAEC,SAAS;IAAEC;EAAe,CAAC,GAAGF,MAAM;EAE5C,OAAO,IAAIG,cAAK,CAAC;IACbC,IAAI,EAAEH,SAAS,IAAKI,OAAO,CAACC,GAAG,CAACC,QAAmB;IACnDC,YAAY,EAAE,IAAI;IAClBC,OAAO,EAAE,IAAI;IACbC,cAAc,EAAER,cAAc;IAC9BS,WAAW,EAAE,IAAI;IACjBC,SAAS,EAAE;EACf,CAAC,CAAC;AACN,CAAC;AAACC,OAAA,CAAAd,WAAA,GAAAA,WAAA"}
@@ -1,8 +1,8 @@
1
- import { Table } from "dynamodb-toolbox";
2
- import { DocumentClient } from "aws-sdk/clients/dynamodb";
1
+ import { Table } from "@webiny/db-dynamodb/toolbox";
2
+ import { DynamoDBClient } from "@webiny/aws-sdk/client-dynamodb";
3
3
  interface Params {
4
- documentClient: DocumentClient;
4
+ documentClient: DynamoDBClient;
5
5
  tableName?: string;
6
6
  }
7
- export declare const createElasticsearchTable: (params: Params) => Table;
7
+ export declare const createElasticsearchTable: (params: Params) => Table<string, string, string>;
8
8
  export {};
@@ -4,17 +4,19 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.createElasticsearchTable = void 0;
7
- var _dynamodbToolbox = require("dynamodb-toolbox");
7
+ var _toolbox = require("@webiny/db-dynamodb/toolbox");
8
8
  const createElasticsearchTable = params => {
9
9
  const {
10
10
  tableName,
11
11
  documentClient
12
12
  } = params;
13
- return new _dynamodbToolbox.Table({
13
+ return new _toolbox.Table({
14
14
  name: tableName || process.env.DB_TABLE_ELASTICSEARCH,
15
15
  partitionKey: "PK",
16
16
  sortKey: "SK",
17
- DocumentClient: documentClient
17
+ DocumentClient: documentClient,
18
+ autoExecute: true,
19
+ autoParse: true
18
20
  });
19
21
  };
20
22
  exports.createElasticsearchTable = createElasticsearchTable;
@@ -1 +1 @@
1
- {"version":3,"names":["_dynamodbToolbox","require","createElasticsearchTable","params","tableName","documentClient","Table","name","process","env","DB_TABLE_ELASTICSEARCH","partitionKey","sortKey","DocumentClient","exports"],"sources":["tableElasticsearch.ts"],"sourcesContent":["import { Table } from \"dynamodb-toolbox\";\nimport { DocumentClient } from \"aws-sdk/clients/dynamodb\";\n\ninterface Params {\n documentClient: DocumentClient;\n tableName?: string;\n}\n\nexport const createElasticsearchTable = (params: Params): Table => {\n const { tableName, documentClient } = params;\n return new Table({\n name: tableName || (process.env.DB_TABLE_ELASTICSEARCH as string),\n partitionKey: \"PK\",\n sortKey: \"SK\",\n DocumentClient: documentClient\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,gBAAA,GAAAC,OAAA;AAQO,MAAMC,wBAAwB,GAAIC,MAAc,IAAY;EAC/D,MAAM;IAAEC,SAAS;IAAEC;EAAe,CAAC,GAAGF,MAAM;EAC5C,OAAO,IAAIG,sBAAK,CAAC;IACbC,IAAI,EAAEH,SAAS,IAAKI,OAAO,CAACC,GAAG,CAACC,sBAAiC;IACjEC,YAAY,EAAE,IAAI;IAClBC,OAAO,EAAE,IAAI;IACbC,cAAc,EAAER;EACpB,CAAC,CAAC;AACN,CAAC;AAACS,OAAA,CAAAZ,wBAAA,GAAAA,wBAAA"}
1
+ {"version":3,"names":["_toolbox","require","createElasticsearchTable","params","tableName","documentClient","Table","name","process","env","DB_TABLE_ELASTICSEARCH","partitionKey","sortKey","DocumentClient","autoExecute","autoParse","exports"],"sources":["tableElasticsearch.ts"],"sourcesContent":["import { Table } from \"@webiny/db-dynamodb/toolbox\";\nimport { DynamoDBClient } from \"@webiny/aws-sdk/client-dynamodb\";\n\ninterface Params {\n documentClient: DynamoDBClient;\n tableName?: string;\n}\n\nexport const createElasticsearchTable = (params: Params): Table<string, string, string> => {\n const { tableName, documentClient } = params;\n return new Table({\n name: tableName || (process.env.DB_TABLE_ELASTICSEARCH as string),\n partitionKey: \"PK\",\n sortKey: \"SK\",\n DocumentClient: documentClient,\n autoExecute: true,\n autoParse: true\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AAQO,MAAMC,wBAAwB,GAAIC,MAAc,IAAoC;EACvF,MAAM;IAAEC,SAAS;IAAEC;EAAe,CAAC,GAAGF,MAAM;EAC5C,OAAO,IAAIG,cAAK,CAAC;IACbC,IAAI,EAAEH,SAAS,IAAKI,OAAO,CAACC,GAAG,CAACC,sBAAiC;IACjEC,YAAY,EAAE,IAAI;IAClBC,OAAO,EAAE,IAAI;IACbC,cAAc,EAAER,cAAc;IAC9BS,WAAW,EAAE,IAAI;IACjBC,SAAS,EAAE;EACf,CAAC,CAAC;AACN,CAAC;AAACC,OAAA,CAAAd,wBAAA,GAAAA,wBAAA"}
package/index.js CHANGED
@@ -8,7 +8,6 @@ var _exportNames = {
8
8
  createFormBuilderStorageOperations: true
9
9
  };
10
10
  exports.createFormBuilderStorageOperations = void 0;
11
- var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
12
11
  var _filters = _interopRequireDefault(require("@webiny/db-dynamodb/plugins/filters"));
13
12
  var _elasticsearchFields = _interopRequireDefault(require("./operations/form/elasticsearchFields"));
14
13
  var _elasticsearchFields2 = _interopRequireDefault(require("./operations/submission/elasticsearchFields"));
@@ -131,7 +130,7 @@ const createFormBuilderStorageOperations = params => {
131
130
  attributes: attributes ? attributes[_types.ENTITIES.ES_SUBMISSION] : {}
132
131
  })
133
132
  };
134
- return (0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({
133
+ return {
135
134
  beforeInit: async context => {
136
135
  const types = [
137
136
  // Elasticsearch
@@ -157,26 +156,30 @@ const createFormBuilderStorageOperations = params => {
157
156
  },
158
157
  getTable: () => table,
159
158
  getEsTable: () => esTable,
160
- getEntities: () => entities
161
- }, (0, _system2.createSystemStorageOperations)({
162
- table,
163
- entity: entities.system
164
- })), (0, _settings2.createSettingsStorageOperations)({
165
- table,
166
- entity: entities.settings
167
- })), (0, _form2.createFormStorageOperations)({
168
- elasticsearch,
169
- table,
170
- entity: entities.form,
171
- esEntity: entities.esForm,
172
- plugins
173
- })), (0, _submission2.createSubmissionStorageOperations)({
174
- elasticsearch,
175
- table,
176
- entity: entities.submission,
177
- esEntity: entities.esSubmission,
178
- plugins
179
- }));
159
+ getEntities: () => entities,
160
+ ...(0, _system2.createSystemStorageOperations)({
161
+ table,
162
+ entity: entities.system
163
+ }),
164
+ ...(0, _settings2.createSettingsStorageOperations)({
165
+ table,
166
+ entity: entities.settings
167
+ }),
168
+ ...(0, _form2.createFormStorageOperations)({
169
+ elasticsearch,
170
+ table,
171
+ entity: entities.form,
172
+ esEntity: entities.esForm,
173
+ plugins
174
+ }),
175
+ ...(0, _submission2.createSubmissionStorageOperations)({
176
+ elasticsearch,
177
+ table,
178
+ entity: entities.submission,
179
+ esEntity: entities.esSubmission,
180
+ plugins
181
+ })
182
+ };
180
183
  };
181
184
  exports.createFormBuilderStorageOperations = createFormBuilderStorageOperations;
182
185
 
package/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["_filters","_interopRequireDefault","require","_elasticsearchFields","_elasticsearchFields2","_error","_types","_table","_form","_submission","_system","_settings","_system2","_submission2","_settings2","_form2","_tableElasticsearch","_plugins","_elasticsearch","_apiElasticsearch","_indices","_createElasticsearchIndex","_plugins2","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","reservedFields","isReserved","name","includes","WebinyError","createFormBuilderStorageOperations","params","attributes","table","tableName","esTable","esTableName","documentClient","elasticsearch","plugins","userPlugins","values","attrs","PluginsContainer","submissionElasticsearchFields","formElasticsearchFields","dynamoDbValueFilters","elasticsearchIndexPlugins","createTable","createElasticsearchTable","entities","form","createFormEntity","entityName","ENTITIES","FORM","submission","createSubmissionEntity","SUBMISSION","system","createSystemEntity","SYSTEM","settings","createSettingsEntity","SETTINGS","esForm","createElasticsearchEntity","ES_FORM","esSubmission","ES_SUBMISSION","_objectSpread2","default","beforeInit","context","types","CompressionPlugin","type","ElasticsearchQueryBuilderOperatorPlugin","FormDynamoDbFieldPlugin","FormElasticsearchBodyModifierPlugin","FormElasticsearchFieldPlugin","FormElasticsearchIndexPlugin","FormElasticsearchQueryModifierPlugin","FormElasticsearchSortModifierPlugin","SubmissionElasticsearchBodyModifierPlugin","SubmissionElasticsearchFieldPlugin","SubmissionElasticsearchQueryModifierPlugin","SubmissionElasticsearchSortModifierPlugin","mergeByType","init","i18n","locales","onLocaleBeforeCreate","subscribe","locale","tenant","createElasticsearchIndex","code","getTable","getEsTable","getEntities","createSystemStorageOperations","entity","createSettingsStorageOperations","createFormStorageOperations","esEntity","createSubmissionStorageOperations"],"sources":["index.ts"],"sourcesContent":["import dynamoDbValueFilters from \"@webiny/db-dynamodb/plugins/filters\";\nimport formElasticsearchFields from \"./operations/form/elasticsearchFields\";\nimport submissionElasticsearchFields from \"./operations/submission/elasticsearchFields\";\nimport WebinyError from \"@webiny/error\";\nimport { FormBuilderStorageOperationsFactory, ENTITIES } from \"~/types\";\nimport { createTable } from \"~/definitions/table\";\nimport { createFormEntity } from \"~/definitions/form\";\nimport { createSubmissionEntity } from \"~/definitions/submission\";\nimport { createSystemEntity } from \"~/definitions/system\";\nimport { createSettingsEntity } from \"~/definitions/settings\";\nimport { createSystemStorageOperations } from \"~/operations/system\";\nimport { createSubmissionStorageOperations } from \"~/operations/submission\";\nimport { createSettingsStorageOperations } from \"~/operations/settings\";\nimport { createFormStorageOperations } from \"~/operations/form\";\nimport { createElasticsearchTable } from \"~/definitions/tableElasticsearch\";\nimport { PluginsContainer } from \"@webiny/plugins\";\nimport { createElasticsearchEntity } from \"~/definitions/elasticsearch\";\nimport {\n CompressionPlugin,\n ElasticsearchQueryBuilderOperatorPlugin\n} from \"@webiny/api-elasticsearch\";\nimport { elasticsearchIndexPlugins } from \"~/elasticsearch/indices\";\nimport { createElasticsearchIndex } from \"~/elasticsearch/createElasticsearchIndex\";\nimport { FormBuilderContext } from \"@webiny/api-form-builder/types\";\nimport {\n FormDynamoDbFieldPlugin,\n FormElasticsearchBodyModifierPlugin,\n FormElasticsearchFieldPlugin,\n FormElasticsearchIndexPlugin,\n FormElasticsearchQueryModifierPlugin,\n FormElasticsearchSortModifierPlugin,\n SubmissionElasticsearchBodyModifierPlugin,\n SubmissionElasticsearchFieldPlugin,\n SubmissionElasticsearchQueryModifierPlugin,\n SubmissionElasticsearchSortModifierPlugin\n} from \"~/plugins\";\n\nconst reservedFields = [\"PK\", \"SK\", \"index\", \"data\", \"TYPE\", \"__type\", \"GSI1_PK\", \"GSI1_SK\"];\n\nconst isReserved = (name: string): void => {\n if (reservedFields.includes(name) === false) {\n return;\n }\n throw new WebinyError(`Attribute name \"${name}\" is not allowed.`, \"ATTRIBUTE_NOT_ALLOWED\", {\n name\n });\n};\n\nexport * from \"./plugins\";\n\nexport const createFormBuilderStorageOperations: FormBuilderStorageOperationsFactory = params => {\n const {\n attributes,\n table: tableName,\n esTable: esTableName,\n documentClient,\n elasticsearch,\n plugins: userPlugins\n } = params;\n\n if (attributes) {\n Object.values(attributes).forEach(attrs => {\n Object.keys(attrs).forEach(isReserved);\n });\n }\n\n const plugins = new PluginsContainer([\n /**\n * User defined plugins.\n */\n userPlugins || [],\n /**\n * Elasticsearch field definitions for the submission record.\n */\n submissionElasticsearchFields(),\n /**\n * Elasticsearch field definitions for the form record.\n */\n formElasticsearchFields(),\n /**\n * DynamoDB filter plugins for the where conditions.\n */\n dynamoDbValueFilters(),\n /**\n * Built-in Elasticsearch index plugins\n */\n elasticsearchIndexPlugins()\n ]);\n\n const table = createTable({\n tableName,\n documentClient\n });\n\n const esTable = createElasticsearchTable({\n tableName: esTableName,\n documentClient\n });\n\n const entities = {\n /**\n * Regular entities.\n */\n form: createFormEntity({\n entityName: ENTITIES.FORM,\n table,\n attributes: attributes ? attributes[ENTITIES.FORM] : {}\n }),\n submission: createSubmissionEntity({\n entityName: ENTITIES.SUBMISSION,\n table,\n attributes: attributes ? attributes[ENTITIES.SUBMISSION] : {}\n }),\n system: createSystemEntity({\n entityName: ENTITIES.SYSTEM,\n table,\n attributes: attributes ? attributes[ENTITIES.SYSTEM] : {}\n }),\n settings: createSettingsEntity({\n entityName: ENTITIES.SETTINGS,\n table,\n attributes: attributes ? attributes[ENTITIES.SETTINGS] : {}\n }),\n /**\n * Elasticsearch entities.\n */\n esForm: createElasticsearchEntity({\n entityName: ENTITIES.ES_FORM,\n table: esTable,\n attributes: attributes ? attributes[ENTITIES.ES_FORM] : {}\n }),\n esSubmission: createElasticsearchEntity({\n entityName: ENTITIES.ES_SUBMISSION,\n table: esTable,\n attributes: attributes ? attributes[ENTITIES.ES_SUBMISSION] : {}\n })\n };\n\n return {\n beforeInit: async (context: FormBuilderContext) => {\n const types: string[] = [\n // Elasticsearch\n CompressionPlugin.type,\n ElasticsearchQueryBuilderOperatorPlugin.type,\n // Form Builder\n FormDynamoDbFieldPlugin.type,\n FormElasticsearchBodyModifierPlugin.type,\n FormElasticsearchFieldPlugin.type,\n FormElasticsearchIndexPlugin.type,\n FormElasticsearchQueryModifierPlugin.type,\n FormElasticsearchSortModifierPlugin.type,\n SubmissionElasticsearchBodyModifierPlugin.type,\n SubmissionElasticsearchFieldPlugin.type,\n SubmissionElasticsearchQueryModifierPlugin.type,\n SubmissionElasticsearchSortModifierPlugin.type\n ];\n for (const type of types) {\n plugins.mergeByType(context.plugins, type);\n }\n },\n init: async (context: FormBuilderContext) => {\n context.i18n.locales.onLocaleBeforeCreate.subscribe(async ({ locale, tenant }) => {\n await createElasticsearchIndex({\n elasticsearch,\n plugins,\n tenant,\n locale: locale.code\n });\n });\n },\n getTable: () => table,\n getEsTable: () => esTable,\n getEntities: () => entities,\n ...createSystemStorageOperations({\n table,\n entity: entities.system\n }),\n ...createSettingsStorageOperations({\n table,\n entity: entities.settings\n }),\n ...createFormStorageOperations({\n elasticsearch,\n table,\n entity: entities.form,\n esEntity: entities.esForm,\n plugins\n }),\n ...createSubmissionStorageOperations({\n elasticsearch,\n table,\n entity: entities.submission,\n esEntity: entities.esSubmission,\n plugins\n })\n };\n};\n"],"mappings":";;;;;;;;;;;AAAA,IAAAA,QAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,oBAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,qBAAA,GAAAH,s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C,IAAI;IACrBsD,QAAQ,EAAEvD,QAAQ,CAACe,MAAM;IACzB1B;EACJ,CAAC,CAAC,GACC,IAAAmE,8CAAiC,EAAC;IACjCpE,aAAa;IACbL,KAAK;IACLqE,MAAM,EAAEpD,QAAQ,CAACM,UAAU;IAC3BiD,QAAQ,EAAEvD,QAAQ,CAACkB,YAAY;IAC/B7B;EACJ,CAAC,CAAC;AAEV,CAAC;AAAClB,OAAA,CAAAS,kCAAA,GAAAA,kCAAA"}
1
+ {"version":3,"names":["_filters","_interopRequireDefault","require","_elasticsearchFields","_elasticsearchFields2","_error","_types","_table","_form","_submission","_system","_settings","_system2","_submission2","_settings2","_form2","_tableElasticsearch","_plugins","_elasticsearch","_apiElasticsearch","_indices","_createElasticsearchIndex","_plugins2","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","reservedFields","isReserved","name","includes","WebinyError","createFormBuilderStorageOperations","params","attributes","table","tableName","esTable","esTableName","documentClient","elasticsearch","plugins","userPlugins","values","attrs","PluginsContainer","submissionElasticsearchFields","formElasticsearchFields","dynamoDbValueFilters","elasticsearchIndexPlugins","createTable","createElasticsearchTable","entities","form","createFormEntity","entityName","ENTITIES","FORM","submission","createSubmissionEntity","SUBMISSION","system","createSystemEntity","SYSTEM","settings","createSettingsEntity","SETTINGS","esForm","createElasticsearchEntity","ES_FORM","esSubmission","ES_SUBMISSION","beforeInit","context","types","CompressionPlugin","type","ElasticsearchQueryBuilderOperatorPlugin","FormDynamoDbFieldPlugin","FormElasticsearchBodyModifierPlugin","FormElasticsearchFieldPlugin","FormElasticsearchIndexPlugin","FormElasticsearchQueryModifierPlugin","FormElasticsearchSortModifierPlugin","SubmissionElasticsearchBodyModifierPlugin","SubmissionElasticsearchFieldPlugin","SubmissionElasticsearchQueryModifierPlugin","SubmissionElasticsearchSortModifierPlugin","mergeByType","init","i18n","locales","onLocaleBeforeCreate","subscribe","locale","tenant","createElasticsearchIndex","code","getTable","getEsTable","getEntities","createSystemStorageOperations","entity","createSettingsStorageOperations","createFormStorageOperations","esEntity","createSubmissionStorageOperations"],"sources":["index.ts"],"sourcesContent":["import dynamoDbValueFilters from \"@webiny/db-dynamodb/plugins/filters\";\nimport formElasticsearchFields from \"./operations/form/elasticsearchFields\";\nimport submissionElasticsearchFields from \"./operations/submission/elasticsearchFields\";\nimport WebinyError from \"@webiny/error\";\nimport { FormBuilderStorageOperationsFactory, ENTITIES } from \"~/types\";\nimport { createTable } from \"~/definitions/table\";\nimport { createFormEntity } from \"~/definitions/form\";\nimport { createSubmissionEntity } from \"~/definitions/submission\";\nimport { createSystemEntity } from \"~/definitions/system\";\nimport { createSettingsEntity } from \"~/definitions/settings\";\nimport { createSystemStorageOperations } from \"~/operations/system\";\nimport { createSubmissionStorageOperations } from \"~/operations/submission\";\nimport { createSettingsStorageOperations } from \"~/operations/settings\";\nimport { createFormStorageOperations } from \"~/operations/form\";\nimport { createElasticsearchTable } from \"~/definitions/tableElasticsearch\";\nimport { PluginsContainer } from \"@webiny/plugins\";\nimport { createElasticsearchEntity } from \"~/definitions/elasticsearch\";\nimport {\n CompressionPlugin,\n ElasticsearchQueryBuilderOperatorPlugin\n} from \"@webiny/api-elasticsearch\";\nimport { elasticsearchIndexPlugins } from \"~/elasticsearch/indices\";\nimport { createElasticsearchIndex } from \"~/elasticsearch/createElasticsearchIndex\";\nimport { FormBuilderContext } from \"@webiny/api-form-builder/types\";\nimport {\n FormDynamoDbFieldPlugin,\n FormElasticsearchBodyModifierPlugin,\n FormElasticsearchFieldPlugin,\n FormElasticsearchIndexPlugin,\n FormElasticsearchQueryModifierPlugin,\n FormElasticsearchSortModifierPlugin,\n SubmissionElasticsearchBodyModifierPlugin,\n SubmissionElasticsearchFieldPlugin,\n SubmissionElasticsearchQueryModifierPlugin,\n SubmissionElasticsearchSortModifierPlugin\n} from \"~/plugins\";\n\nconst reservedFields = [\"PK\", \"SK\", \"index\", \"data\", \"TYPE\", \"__type\", \"GSI1_PK\", \"GSI1_SK\"];\n\nconst isReserved = (name: string): void => {\n if (reservedFields.includes(name) === false) {\n return;\n }\n throw new WebinyError(`Attribute name \"${name}\" is not allowed.`, \"ATTRIBUTE_NOT_ALLOWED\", {\n name\n });\n};\n\nexport * from \"./plugins\";\n\nexport const createFormBuilderStorageOperations: FormBuilderStorageOperationsFactory = params => {\n const {\n attributes,\n table: tableName,\n esTable: esTableName,\n documentClient,\n elasticsearch,\n plugins: userPlugins\n } = params;\n\n if (attributes) {\n Object.values(attributes).forEach(attrs => {\n Object.keys(attrs).forEach(isReserved);\n });\n }\n\n const plugins = new PluginsContainer([\n /**\n * User defined plugins.\n */\n userPlugins || [],\n /**\n * Elasticsearch field definitions for the submission record.\n */\n submissionElasticsearchFields(),\n /**\n * Elasticsearch field definitions for the form record.\n */\n formElasticsearchFields(),\n /**\n * DynamoDB filter plugins for the where conditions.\n */\n dynamoDbValueFilters(),\n /**\n * Built-in Elasticsearch index plugins\n */\n elasticsearchIndexPlugins()\n ]);\n\n const table = createTable({\n tableName,\n documentClient\n });\n\n const esTable = createElasticsearchTable({\n tableName: esTableName,\n documentClient\n });\n\n const entities = {\n /**\n * Regular entities.\n */\n form: createFormEntity({\n entityName: ENTITIES.FORM,\n table,\n attributes: attributes ? attributes[ENTITIES.FORM] : {}\n }),\n submission: createSubmissionEntity({\n entityName: ENTITIES.SUBMISSION,\n table,\n attributes: attributes ? attributes[ENTITIES.SUBMISSION] : {}\n }),\n system: createSystemEntity({\n entityName: ENTITIES.SYSTEM,\n table,\n attributes: attributes ? attributes[ENTITIES.SYSTEM] : {}\n }),\n settings: createSettingsEntity({\n entityName: ENTITIES.SETTINGS,\n table,\n attributes: attributes ? attributes[ENTITIES.SETTINGS] : {}\n }),\n /**\n * Elasticsearch entities.\n */\n esForm: createElasticsearchEntity({\n entityName: ENTITIES.ES_FORM,\n table: esTable,\n attributes: attributes ? attributes[ENTITIES.ES_FORM] : {}\n }),\n esSubmission: createElasticsearchEntity({\n entityName: ENTITIES.ES_SUBMISSION,\n table: esTable,\n attributes: attributes ? attributes[ENTITIES.ES_SUBMISSION] : {}\n })\n };\n\n return {\n beforeInit: async (context: FormBuilderContext) => {\n const types: string[] = [\n // Elasticsearch\n CompressionPlugin.type,\n ElasticsearchQueryBuilderOperatorPlugin.type,\n // Form Builder\n FormDynamoDbFieldPlugin.type,\n FormElasticsearchBodyModifierPlugin.type,\n FormElasticsearchFieldPlugin.type,\n FormElasticsearchIndexPlugin.type,\n FormElasticsearchQueryModifierPlugin.type,\n FormElasticsearchSortModifierPlugin.type,\n SubmissionElasticsearchBodyModifierPlugin.type,\n SubmissionElasticsearchFieldPlugin.type,\n SubmissionElasticsearchQueryModifierPlugin.type,\n SubmissionElasticsearchSortModifierPlugin.type\n ];\n for (const type of types) {\n plugins.mergeByType(context.plugins, type);\n }\n },\n init: async (context: FormBuilderContext) => {\n context.i18n.locales.onLocaleBeforeCreate.subscribe(async ({ locale, tenant }) => {\n await createElasticsearchIndex({\n elasticsearch,\n plugins,\n tenant,\n locale: locale.code\n });\n });\n },\n getTable: () => table,\n getEsTable: () => esTable,\n getEntities: () => entities,\n ...createSystemStorageOperations({\n table,\n entity: entities.system\n }),\n ...createSettingsStorageOperations({\n table,\n entity: entities.settings\n }),\n ...createFormStorageOperations({\n elasticsearch,\n table,\n entity: entities.form,\n esEntity: entities.esForm,\n plugins\n }),\n ...createSubmissionStorageOperations({\n elasticsearch,\n table,\n entity: entities.submission,\n esEntity: entities.esSubmission,\n plugins\n })\n };\n};\n"],"mappings":";;;;;;;;;;AAAA,IAAAA,QAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,oBAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,qBAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,MAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,MAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,KAAA,GAAAN,OAAA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ACL,CAAC;AACL,CAAC;AAAClB,OAAA,CAAAS,kCAAA,GAAAA,kCAAA"}
@@ -1,4 +1,4 @@
1
- import { SearchBody as esSearchBody } from "elastic-ts";
1
+ import { PrimitiveValue, SearchBody as esSearchBody } from "elastic-ts";
2
2
  import { FormBuilderStorageOperationsListFormsParams } from "@webiny/api-form-builder/types";
3
3
  import { PluginsContainer } from "@webiny/plugins";
4
4
  export declare const createFormElasticType: () => string;
@@ -6,7 +6,7 @@ interface CreateElasticsearchBodyParams {
6
6
  plugins: PluginsContainer;
7
7
  where: FormBuilderStorageOperationsListFormsParams["where"];
8
8
  limit: number;
9
- after?: string;
9
+ after?: PrimitiveValue[];
10
10
  sort: string[];
11
11
  }
12
12
  export declare const createElasticsearchBody: (params: CreateElasticsearchBodyParams) => esSearchBody;