@webiny/api-form-builder-so-ddb 5.39.0-beta.1 → 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.
@@ -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
  },
@@ -94,8 +92,9 @@ const createFormEntity = params => {
94
92
  },
95
93
  webinyVersion: {
96
94
  type: "string"
97
- }
98
- }, attributes || {})
95
+ },
96
+ ...(attributes || {})
97
+ }
99
98
  });
100
99
  };
101
100
  exports.createFormEntity = createFormEntity;
@@ -1 +1 @@
1
- {"version":3,"names":["_dynamodbToolbox","require","createFormEntity","params","table","entityName","attributes","Entity","name","_objectSpread2","default","PK","partitionKey","SK","sortKey","GSI1_PK","type","GSI1_SK","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 GSI1_PK: {\n type: \"string\"\n },\n GSI1_SK: {\n type: \"string\"\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,OAAO,EAAE;QACLC,I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+ {"version":3,"names":["_toolbox","require","createFormEntity","params","table","entityName","attributes","Entity","name","PK","partitionKey","SK","sortKey","GSI1_PK","type","GSI1_SK","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 GSI1_PK: {\n type: \"string\"\n },\n GSI1_SK: {\n type: \"string\"\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,CA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IAAI,EAAE;MACV,CAAC;MACDsB,aAAa,EAAE;QACXtB,IAAI,EAAE;MACV,CAAC;MACD,IAAIR,UAAU,IAAI,CAAC,CAAC;IACxB;EACJ,CAAC,CAAC;AACN,CAAC;AAAC+B,OAAA,CAAAnC,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,13 +4,13 @@ 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",
@@ -20,7 +20,9 @@ const createTable = params => {
20
20
  partitionKey: "GSI1_PK",
21
21
  sortKey: "GSI1_SK"
22
22
  }
23
- }
23
+ },
24
+ autoExecute: true,
25
+ autoParse: true
24
26
  });
25
27
  };
26
28
  exports.createTable = createTable;
@@ -1 +1 @@
1
- {"version":3,"names":["_dynamodbToolbox","require","createTable","params","tableName","documentClient","Table","name","process","env","DB_TABLE","partitionKey","sortKey","DocumentClient","indexes","GSI1","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 indexes: {\n GSI1: {\n partitionKey: \"GSI1_PK\",\n sortKey: \"GSI1_SK\"\n }\n }\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,cAAc;IAC9BS,OAAO,EAAE;MACLC,IAAI,EAAE;QACFJ,YAAY,EAAE,SAAS;QACvBC,OAAO,EAAE;MACb;IACJ;EACJ,CAAC,CAAC;AACN,CAAC;AAACI,OAAA,CAAAd,WAAA,GAAAA,WAAA"}
1
+ {"version":3,"names":["_toolbox","require","createTable","params","tableName","documentClient","Table","name","process","env","DB_TABLE","partitionKey","sortKey","DocumentClient","indexes","GSI1","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 indexes: {\n GSI1: {\n partitionKey: \"GSI1_PK\",\n sortKey: \"GSI1_SK\"\n }\n },\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,OAAO,EAAE;MACLC,IAAI,EAAE;QACFJ,YAAY,EAAE,SAAS;QACvBC,OAAO,EAAE;MACb;IACJ,CAAC;IACDI,WAAW,EAAE,IAAI;IACjBC,SAAS,EAAE;EACf,CAAC,CAAC;AACN,CAAC;AAACC,OAAA,CAAAhB,WAAA,GAAAA,WAAA"}
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 _fields = _interopRequireDefault(require("./operations/submission/fields"));
14
13
  var _fields2 = _interopRequireDefault(require("./operations/form/fields"));
@@ -103,7 +102,7 @@ const createFormBuilderStorageOperations = params => {
103
102
  attributes: attributes ? attributes[_types.ENTITIES.SETTINGS] : {}
104
103
  })
105
104
  };
106
- return (0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({
105
+ return {
107
106
  beforeInit: async context => {
108
107
  const types = [_plugins2.FormDynamoDbFieldPlugin.type, _plugins2.FormSubmissionDynamoDbFieldPlugin.type];
109
108
  for (const type of types) {
@@ -111,22 +110,26 @@ const createFormBuilderStorageOperations = params => {
111
110
  }
112
111
  },
113
112
  getTable: () => table,
114
- getEntities: () => entities
115
- }, (0, _system2.createSystemStorageOperations)({
116
- table,
117
- entity: entities.system
118
- })), (0, _settings2.createSettingsStorageOperations)({
119
- table,
120
- entity: entities.settings
121
- })), (0, _form2.createFormStorageOperations)({
122
- table,
123
- entity: entities.form,
124
- plugins
125
- })), (0, _submission2.createSubmissionStorageOperations)({
126
- table,
127
- entity: entities.submission,
128
- plugins
129
- }));
113
+ getEntities: () => entities,
114
+ ...(0, _system2.createSystemStorageOperations)({
115
+ table,
116
+ entity: entities.system
117
+ }),
118
+ ...(0, _settings2.createSettingsStorageOperations)({
119
+ table,
120
+ entity: entities.settings
121
+ }),
122
+ ...(0, _form2.createFormStorageOperations)({
123
+ table,
124
+ entity: entities.form,
125
+ plugins
126
+ }),
127
+ ...(0, _submission2.createSubmissionStorageOperations)({
128
+ table,
129
+ entity: entities.submission,
130
+ plugins
131
+ })
132
+ };
130
133
  };
131
134
  exports.createFormBuilderStorageOperations = createFormBuilderStorageOperations;
132
135
 
package/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["_filters","_interopRequireDefault","require","_fields","_fields2","_error","_types","_table","_form","_submission","_system","_settings","_system2","_submission2","_settings2","_form2","_plugins","_plugins2","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","reservedFields","isReserved","name","includes","WebinyError","createFormBuilderStorageOperations","params","attributes","table","tableName","documentClient","plugins","userPlugins","values","attrs","PluginsContainer","formSubmissionFields","formFields","dynamoDbValueFilters","createTable","entities","form","createFormEntity","entityName","ENTITIES","FORM","submission","createSubmissionEntity","SUBMISSION","system","createSystemEntity","SYSTEM","settings","createSettingsEntity","SETTINGS","_objectSpread2","default","beforeInit","context","types","FormDynamoDbFieldPlugin","type","FormSubmissionDynamoDbFieldPlugin","mergeByType","getTable","getEntities","createSystemStorageOperations","entity","createSettingsStorageOperations","createFormStorageOperations","createSubmissionStorageOperations"],"sources":["index.ts"],"sourcesContent":["import dynamoDbValueFilters from \"@webiny/db-dynamodb/plugins/filters\";\nimport formSubmissionFields from \"~/operations/submission/fields\";\nimport formFields from \"~/operations/form/fields\";\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 { PluginsContainer } from \"@webiny/plugins\";\nimport { FormDynamoDbFieldPlugin, FormSubmissionDynamoDbFieldPlugin } 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 { attributes, table: tableName, documentClient, plugins: userPlugins } = 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 * Form submission DynamoDB fields.\n */\n formSubmissionFields(),\n /**\n * Form DynamoDB fields.\n */\n formFields(),\n\n /**\n * DynamoDB filter plugins for the where conditions.\n */\n dynamoDbValueFilters()\n ]);\n\n const table = createTable({\n tableName,\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\n return {\n beforeInit: async context => {\n const types: string[] = [\n FormDynamoDbFieldPlugin.type,\n FormSubmissionDynamoDbFieldPlugin.type\n ];\n for (const type of types) {\n plugins.mergeByType(context.plugins, type);\n }\n },\n getTable: () => table,\n getEntities: () => entities,\n ...createSystemStorageOperations({\n table,\n entity: entities.system\n }),\n ...createSettingsStorageOperations({\n table,\n entity: entities.settings\n }),\n ...createFormStorageOperations({\n table,\n entity: entities.form,\n plugins\n }),\n ...createSubmissionStorageOperations({\n table,\n entity: entities.submission,\n plugins\n })\n };\n};\n"],"mappings":";;;;;;;;;;;AAAA,IAAAA,QAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,QAAA,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;AACA,IAAAO,WAAA,GAAAP,OAAA;AACA,IAAAQ,OAAA,GAAAR,OAAA;AACA,IAAAS,SAAA,GAAAT,OAAA;AACA,IAAAU,QAAA,GAAAV,OAAA;AACA,IAAAW,YAAA,GAAAX,OAAA;AACA,IAAAY,UAAA,GAAAZ,OAAA;AACA,IAAAa,MAAA,GAAAb,OAAA;AACA,IAAAc,QAAA,GAAAd,OAAA;AACA,IAAAe,SAAA,GAAAf,OAAA;AAaAgB,MAAA,CAAAC,IAAA,CAAAF,SAAA,EAAAG,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAJ,SAAA,CAAAI,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAZ,SAAA,CAAAI,GAAA;IAAA;EAAA;AAAA;AAXA,MAAMS,cAAc,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EA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2B,EAAC;IAC3BzC,KAAK;IACLuC,MAAM,EAAE3B,QAAQ,CAACC,IAAI;IACrBV;EACJ,CAAC,CAAC,GACC,IAAAuC,8CAAiC,EAAC;IACjC1C,KAAK;IACLuC,MAAM,EAAE3B,QAAQ,CAACM,UAAU;IAC3Bf;EACJ,CAAC,CAAC;AAEV,CAAC;AAACf,OAAA,CAAAS,kCAAA,GAAAA,kCAAA"}
1
+ {"version":3,"names":["_filters","_interopRequireDefault","require","_fields","_fields2","_error","_types","_table","_form","_submission","_system","_settings","_system2","_submission2","_settings2","_form2","_plugins","_plugins2","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","reservedFields","isReserved","name","includes","WebinyError","createFormBuilderStorageOperations","params","attributes","table","tableName","documentClient","plugins","userPlugins","values","attrs","PluginsContainer","formSubmissionFields","formFields","dynamoDbValueFilters","createTable","entities","form","createFormEntity","entityName","ENTITIES","FORM","submission","createSubmissionEntity","SUBMISSION","system","createSystemEntity","SYSTEM","settings","createSettingsEntity","SETTINGS","beforeInit","context","types","FormDynamoDbFieldPlugin","type","FormSubmissionDynamoDbFieldPlugin","mergeByType","getTable","getEntities","createSystemStorageOperations","entity","createSettingsStorageOperations","createFormStorageOperations","createSubmissionStorageOperations"],"sources":["index.ts"],"sourcesContent":["import dynamoDbValueFilters from \"@webiny/db-dynamodb/plugins/filters\";\nimport formSubmissionFields from \"~/operations/submission/fields\";\nimport formFields from \"~/operations/form/fields\";\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 { PluginsContainer } from \"@webiny/plugins\";\nimport { FormDynamoDbFieldPlugin, FormSubmissionDynamoDbFieldPlugin } 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 { attributes, table: tableName, documentClient, plugins: userPlugins } = 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 * Form submission DynamoDB fields.\n */\n formSubmissionFields(),\n /**\n * Form DynamoDB fields.\n */\n formFields(),\n\n /**\n * DynamoDB filter plugins for the where conditions.\n */\n dynamoDbValueFilters()\n ]);\n\n const table = createTable({\n tableName,\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\n return {\n beforeInit: async context => {\n const types: string[] = [\n FormDynamoDbFieldPlugin.type,\n FormSubmissionDynamoDbFieldPlugin.type\n ];\n for (const type of types) {\n plugins.mergeByType(context.plugins, type);\n }\n },\n getTable: () => table,\n getEntities: () => entities,\n ...createSystemStorageOperations({\n table,\n entity: entities.system\n }),\n ...createSettingsStorageOperations({\n table,\n entity: entities.settings\n }),\n ...createFormStorageOperations({\n table,\n entity: entities.form,\n plugins\n }),\n ...createSubmissionStorageOperations({\n table,\n entity: entities.submission,\n plugins\n })\n };\n};\n"],"mappings":";;;;;;;;;;AAAA,IAAAA,QAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,QAAA,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;AACA,IAAAO,WAAA,GAAAP,OAAA;AACA,IAAAQ,OAAA,GAAAR,OAAA;AACA,IAAAS,SAAA,GAAAT,OAAA;AACA,IAAAU,QAAA,GAAAV,OAAA;AACA,IAAAW,YAAA,GAAAX,OAAA;AACA,IAAAY,UAAA,GAAAZ,OAAA;AACA,IAAAa,MAAA,GAAAb,OAAA;AACA,IAAAc,QAAA,GAAAd,OAAA;AACA,IAAAe,SAAA,GAAAf,OAAA;AAaAgB,MAAA,CAAAC,IAAA,CAAAF,SAAA,EAAAG,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAJ,SAAA,CAAAI,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAZ,SAAA,CAAAI,GAAA;IAAA;E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AAG,IAAAe,kCAA2B,EAAC;MAC3BvC,KAAK;MACLqC,MAAM,EAAEzB,QAAQ,CAACC,IAAI;MACrBV;IACJ,CAAC,CAAC;IACF,GAAG,IAAAqC,8CAAiC,EAAC;MACjCxC,KAAK;MACLqC,MAAM,EAAEzB,QAAQ,CAACM,UAAU;MAC3Bf;IACJ,CAAC;EACL,CAAC;AACL,CAAC;AAACf,OAAA,CAAAS,kCAAA,GAAAA,kCAAA"}
@@ -1,9 +1,9 @@
1
- import { Entity, Table } from "dynamodb-toolbox";
1
+ import { Entity, Table } from "@webiny/db-dynamodb/toolbox";
2
2
  import { PluginsContainer } from "@webiny/plugins";
3
3
  import { FormBuilderFormStorageOperations } from "../../types";
4
4
  export interface CreateFormStorageOperationsParams {
5
5
  entity: Entity<any>;
6
- table: Table;
6
+ table: Table<string, string, string>;
7
7
  plugins: PluginsContainer;
8
8
  }
9
9
  export declare const createFormStorageOperations: (params: CreateFormStorageOperationsParams) => FormBuilderFormStorageOperations;