@webiny/api-form-builder-so-ddb 0.0.0-mt-3 → 0.0.0-unstable.2af142b57e

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 (40) hide show
  1. package/definitions/form.d.ts +2 -1
  2. package/definitions/form.js +3 -12
  3. package/definitions/form.js.map +1 -0
  4. package/definitions/settings.d.ts +2 -1
  5. package/definitions/settings.js +3 -12
  6. package/definitions/settings.js.map +1 -0
  7. package/definitions/submission.d.ts +2 -1
  8. package/definitions/submission.js +3 -12
  9. package/definitions/submission.js.map +1 -0
  10. package/definitions/system.d.ts +2 -1
  11. package/definitions/system.js +3 -12
  12. package/definitions/system.js.map +1 -0
  13. package/definitions/table.d.ts +3 -2
  14. package/definitions/table.js +0 -3
  15. package/definitions/table.js.map +1 -0
  16. package/index.js +10 -38
  17. package/index.js.map +1 -0
  18. package/operations/form/fields.js +0 -3
  19. package/operations/form/fields.js.map +1 -0
  20. package/operations/form/index.d.ts +2 -2
  21. package/operations/form/index.js +25 -115
  22. package/operations/form/index.js.map +1 -0
  23. package/operations/settings/index.d.ts +2 -2
  24. package/operations/settings/index.js +4 -27
  25. package/operations/settings/index.js.map +1 -0
  26. package/operations/submission/fields.js +0 -3
  27. package/operations/submission/fields.js.map +1 -0
  28. package/operations/submission/index.d.ts +2 -2
  29. package/operations/submission/index.js +7 -45
  30. package/operations/submission/index.js.map +1 -0
  31. package/operations/system/index.d.ts +2 -2
  32. package/operations/system/index.js +4 -25
  33. package/operations/system/index.js.map +1 -0
  34. package/package.json +18 -18
  35. package/plugins/FormDynamoDbFieldPlugin.js +1 -6
  36. package/plugins/FormDynamoDbFieldPlugin.js.map +1 -0
  37. package/plugins/FormSubmissionDynamoDbFieldPlugin.js +1 -6
  38. package/plugins/FormSubmissionDynamoDbFieldPlugin.js.map +1 -0
  39. package/types.js +0 -1
  40. package/types.js.map +1 -0
@@ -1,8 +1,9 @@
1
1
  import { Entity, Table } from "dynamodb-toolbox";
2
2
  import { Attributes } from "../types";
3
- export interface Params {
3
+ interface Params {
4
4
  table: Table;
5
5
  entityName: string;
6
6
  attributes: Attributes;
7
7
  }
8
8
  export declare const createFormEntity: (params: Params) => Entity<any>;
9
+ export {};
@@ -1,20 +1,12 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.createFormEntity = void 0;
9
-
10
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
-
8
+ var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
12
9
  var _dynamodbToolbox = require("dynamodb-toolbox");
13
-
14
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
15
-
16
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
17
-
18
10
  const createFormEntity = params => {
19
11
  const {
20
12
  table,
@@ -24,7 +16,7 @@ const createFormEntity = params => {
24
16
  return new _dynamodbToolbox.Entity({
25
17
  table,
26
18
  name: entityName,
27
- attributes: _objectSpread({
19
+ attributes: (0, _objectSpread2.default)({
28
20
  PK: {
29
21
  partitionKey: true
30
22
  },
@@ -106,5 +98,4 @@ const createFormEntity = params => {
106
98
  }, attributes || {})
107
99
  });
108
100
  };
109
-
110
101
  exports.createFormEntity = createFormEntity;
@@ -0,0 +1 @@
1
+ {"version":3,"names":["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","layout","stats","settings","triggers","webinyVersion"],"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 layout: {\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;AASO,MAAMA,gBAAgB,GAAIC,MAAc,IAAkB;EAC7D,MAAM;IAAEC,KAAK;IAAEC,UAAU;IAAEC;EAAW,CA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MACV,CAAC;MACDqB,QAAQ,EAAE;QACNrB,IAAI,EAAE;MACV,CAAC;MACDsB,aAAa,EAAE;QACXtB,IAAI,EAAE;MACV;IAAC,GACGR,UAAU,IAAI,CAAC,CAAC;EAE5B,CAAC,CAAC;AACN,CAAC;AAAC"}
@@ -1,8 +1,9 @@
1
1
  import { Entity, Table } from "dynamodb-toolbox";
2
2
  import { Attributes } from "../types";
3
- export interface Params {
3
+ interface Params {
4
4
  table: Table;
5
5
  entityName: string;
6
6
  attributes: Attributes;
7
7
  }
8
8
  export declare const createSettingsEntity: (params: Params) => Entity<any>;
9
+ export {};
@@ -1,20 +1,12 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.createSettingsEntity = void 0;
9
-
10
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
-
8
+ var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
12
9
  var _dynamodbToolbox = require("dynamodb-toolbox");
13
-
14
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
15
-
16
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
17
-
18
10
  const createSettingsEntity = params => {
19
11
  const {
20
12
  entityName,
@@ -24,7 +16,7 @@ const createSettingsEntity = params => {
24
16
  return new _dynamodbToolbox.Entity({
25
17
  name: entityName,
26
18
  table,
27
- attributes: _objectSpread({
19
+ attributes: (0, _objectSpread2.default)({
28
20
  PK: {
29
21
  partitionKey: true
30
22
  },
@@ -49,5 +41,4 @@ const createSettingsEntity = params => {
49
41
  }, attributes || {})
50
42
  });
51
43
  };
52
-
53
44
  exports.createSettingsEntity = createSettingsEntity;
@@ -0,0 +1 @@
1
+ {"version":3,"names":["createSettingsEntity","params","entityName","attributes","table","Entity","name","PK","partitionKey","SK","sortKey","TYPE","type","reCaptcha","domain","tenant","locale"],"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;AASO,MAAMA,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;MACNI,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,GACGT,UAAU,IAAI,CAAC,CAAC;EAE5B,CAAC,CAAC;AACN,CAAC;AAAC"}
@@ -1,8 +1,9 @@
1
1
  import { Entity, Table } from "dynamodb-toolbox";
2
2
  import { Attributes } from "../types";
3
- export interface Params {
3
+ interface Params {
4
4
  table: Table;
5
5
  entityName: string;
6
6
  attributes: Attributes;
7
7
  }
8
8
  export declare const createSubmissionEntity: (params: Params) => Entity<any>;
9
+ export {};
@@ -1,20 +1,12 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.createSubmissionEntity = void 0;
9
-
10
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
-
8
+ var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
12
9
  var _dynamodbToolbox = require("dynamodb-toolbox");
13
-
14
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
15
-
16
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
17
-
18
10
  const createSubmissionEntity = params => {
19
11
  const {
20
12
  table,
@@ -24,7 +16,7 @@ const createSubmissionEntity = params => {
24
16
  return new _dynamodbToolbox.Entity({
25
17
  table,
26
18
  name: entityName,
27
- attributes: _objectSpread({
19
+ attributes: (0, _objectSpread2.default)({
28
20
  PK: {
29
21
  partitionKey: true
30
22
  },
@@ -70,5 +62,4 @@ const createSubmissionEntity = params => {
70
62
  }, attributes || {})
71
63
  });
72
64
  };
73
-
74
65
  exports.createSubmissionEntity = createSubmissionEntity;
@@ -0,0 +1 @@
1
+ {"version":3,"names":["createSubmissionEntity","params","table","entityName","attributes","Entity","name","PK","partitionKey","SK","sortKey","id","type","TYPE","data","meta","form","logs","createdOn","savedOn","ownedBy","tenant","locale","webinyVersion"],"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;AASO,MAAMA,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;MACNG,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,GACGR,UAAU,IAAI,CAAC,CAAC;EAE5B,CAAC,CAAC;AACN,CAAC;AAAC"}
@@ -1,8 +1,9 @@
1
1
  import { Entity, Table } from "dynamodb-toolbox";
2
2
  import { Attributes } from "../types";
3
- export interface Params {
3
+ interface Params {
4
4
  table: Table;
5
5
  entityName: string;
6
6
  attributes: Attributes;
7
7
  }
8
8
  export declare const createSystemEntity: (params: Params) => Entity<any>;
9
+ export {};
@@ -1,20 +1,12 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.createSystemEntity = void 0;
9
-
10
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
-
8
+ var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
12
9
  var _dynamodbToolbox = require("dynamodb-toolbox");
13
-
14
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
15
-
16
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
17
-
18
10
  const createSystemEntity = params => {
19
11
  const {
20
12
  entityName,
@@ -24,7 +16,7 @@ const createSystemEntity = params => {
24
16
  return new _dynamodbToolbox.Entity({
25
17
  name: entityName,
26
18
  table,
27
- attributes: _objectSpread({
19
+ attributes: (0, _objectSpread2.default)({
28
20
  PK: {
29
21
  partitionKey: true
30
22
  },
@@ -40,5 +32,4 @@ const createSystemEntity = params => {
40
32
  }, attributes || {})
41
33
  });
42
34
  };
43
-
44
35
  exports.createSystemEntity = createSystemEntity;
@@ -0,0 +1 @@
1
+ {"version":3,"names":["createSystemEntity","params","entityName","attributes","table","Entity","name","PK","partitionKey","SK","sortKey","version","type","tenant"],"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;AASO,MAAMA,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;MACNI,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,GACGT,UAAU,IAAI,CAAC,CAAC;EAE5B,CAAC,CAAC;AACN,CAAC;AAAC"}
@@ -1,7 +1,8 @@
1
1
  import { DocumentClient } from "aws-sdk/clients/dynamodb";
2
2
  import { Table } from "dynamodb-toolbox";
3
- export interface Params {
4
- tableName: string;
3
+ interface Params {
4
+ tableName?: string;
5
5
  documentClient: DocumentClient;
6
6
  }
7
7
  export declare const createTable: (params: Params) => Table;
8
+ export {};
@@ -4,9 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.createTable = void 0;
7
-
8
7
  var _dynamodbToolbox = require("dynamodb-toolbox");
9
-
10
8
  const createTable = params => {
11
9
  const {
12
10
  tableName,
@@ -25,5 +23,4 @@ const createTable = params => {
25
23
  }
26
24
  });
27
25
  };
28
-
29
26
  exports.createTable = createTable;
@@ -0,0 +1 @@
1
+ {"version":3,"names":["createTable","params","tableName","documentClient","Table","name","process","env","DB_TABLE","partitionKey","sortKey","DocumentClient","indexes","GSI1"],"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;AAOO,MAAMA,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;AAAC"}
package/index.js CHANGED
@@ -1,79 +1,52 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.createFormBuilderStorageOperations = void 0;
9
-
10
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
-
8
+ var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
12
9
  var _types = require("./types");
13
-
14
10
  var _table = require("./definitions/table");
15
-
16
11
  var _form = require("./definitions/form");
17
-
18
12
  var _submission = require("./definitions/submission");
19
-
20
13
  var _system = require("./definitions/system");
21
-
22
14
  var _settings = require("./definitions/settings");
23
-
24
15
  var _system2 = require("./operations/system");
25
-
26
16
  var _submission2 = require("./operations/submission");
27
-
28
17
  var _settings2 = require("./operations/settings");
29
-
30
18
  var _form2 = require("./operations/form");
31
-
32
19
  var _plugins = require("@webiny/plugins");
33
-
34
20
  var _filters = _interopRequireDefault(require("@webiny/db-dynamodb/plugins/filters"));
35
-
36
21
  var _fields = _interopRequireDefault(require("./operations/submission/fields"));
37
-
38
22
  var _fields2 = _interopRequireDefault(require("./operations/form/fields"));
39
-
40
23
  var _error = _interopRequireDefault(require("@webiny/error"));
41
-
42
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
43
-
44
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
45
-
46
24
  const reservedFields = ["PK", "SK", "index", "data", "TYPE", "__type", "GSI1_PK", "GSI1_SK"];
47
-
48
25
  const isReserved = name => {
49
26
  if (reservedFields.includes(name) === false) {
50
27
  return;
51
28
  }
52
-
53
29
  throw new _error.default(`Attribute name "${name}" is not allowed.`, "ATTRIBUTE_NOT_ALLOWED", {
54
30
  name
55
31
  });
56
32
  };
57
-
58
33
  const createFormBuilderStorageOperations = params => {
59
34
  const {
60
- attributes = {},
35
+ attributes,
61
36
  table: tableName,
62
37
  documentClient,
63
- plugins: pluginsInput
38
+ plugins: userPlugins
64
39
  } = params;
65
-
66
40
  if (attributes) {
67
41
  Object.values(attributes).forEach(attrs => {
68
42
  Object.keys(attrs).forEach(isReserved);
69
43
  });
70
44
  }
71
-
72
45
  const plugins = new _plugins.PluginsContainer([
73
46
  /**
74
47
  * User defined plugins.
75
48
  */
76
- pluginsInput || [],
49
+ userPlugins || [],
77
50
  /**
78
51
  * Form submission DynamoDB fields.
79
52
  */
@@ -97,25 +70,25 @@ const createFormBuilderStorageOperations = params => {
97
70
  form: (0, _form.createFormEntity)({
98
71
  entityName: _types.ENTITIES.FORM,
99
72
  table,
100
- attributes: attributes[_types.ENTITIES.FORM]
73
+ attributes: attributes ? attributes[_types.ENTITIES.FORM] : {}
101
74
  }),
102
75
  submission: (0, _submission.createSubmissionEntity)({
103
76
  entityName: _types.ENTITIES.SUBMISSION,
104
77
  table,
105
- attributes: attributes[_types.ENTITIES.SUBMISSION]
78
+ attributes: attributes ? attributes[_types.ENTITIES.SUBMISSION] : {}
106
79
  }),
107
80
  system: (0, _system.createSystemEntity)({
108
81
  entityName: _types.ENTITIES.SYSTEM,
109
82
  table,
110
- attributes: attributes[_types.ENTITIES.SYSTEM]
83
+ attributes: attributes ? attributes[_types.ENTITIES.SYSTEM] : {}
111
84
  }),
112
85
  settings: (0, _settings.createSettingsEntity)({
113
86
  entityName: _types.ENTITIES.SETTINGS,
114
87
  table,
115
- attributes: attributes[_types.ENTITIES.SETTINGS]
88
+ attributes: attributes ? attributes[_types.ENTITIES.SETTINGS] : {}
116
89
  })
117
90
  };
118
- return _objectSpread(_objectSpread(_objectSpread(_objectSpread({
91
+ return (0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({
119
92
  upgrade: null,
120
93
  getTable: () => table,
121
94
  getEntities: () => entities
@@ -135,5 +108,4 @@ const createFormBuilderStorageOperations = params => {
135
108
  plugins
136
109
  }));
137
110
  };
138
-
139
111
  exports.createFormBuilderStorageOperations = createFormBuilderStorageOperations;
package/index.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"names":["reservedFields","isReserved","name","includes","WebinyError","createFormBuilderStorageOperations","params","attributes","table","tableName","documentClient","plugins","userPlugins","Object","values","forEach","attrs","keys","PluginsContainer","formSubmissionFields","formFields","dynamoDbValueFilters","createTable","entities","form","createFormEntity","entityName","ENTITIES","FORM","submission","createSubmissionEntity","SUBMISSION","system","createSystemEntity","SYSTEM","settings","createSettingsEntity","SETTINGS","upgrade","getTable","getEntities","createSystemStorageOperations","entity","createSettingsStorageOperations","createFormStorageOperations","createSubmissionStorageOperations"],"sources":["index.ts"],"sourcesContent":["import { 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 dynamoDbValueFilters from \"@webiny/db-dynamodb/plugins/filters\";\nimport formSubmissionFields from \"~/operations/submission/fields\";\nimport formFields from \"~/operations/form/fields\";\nimport WebinyError from \"@webiny/error\";\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 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 upgrade: null,\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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA,MAAMA,cAAc,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,CAAC;AAE5F,MAAMC,UAAU,GAAIC,IAAY,IAAW;EACvC,IAAIF,cAAc,CAACG,QAAQ,CAACD,IAAI,CAAC,KAAK,KAAK,EAAE;IACzC;EACJ;EACA,MAAM,IAAIE,cAAW,CAAE,mBAAkBF,IAAK,mBAAkB,EAAE,uBAAuB,EAAE;IACvFA;EACJ,CAAC,CAAC;AACN,CAAC;AAEM,MAAMG,kCAAuE,G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CAAC,GAAG,CAAC;IAC5D,CAAC,CAAC;IACFC,QAAQ,EAAE,IAAAC,8BAAoB,EAAC;MAC3BV,UAAU,EAAEC,eAAQ,CAACU,QAAQ;MAC7B7B,KAAK;MACLD,UAAU,EAAEA,UAAU,GAAGA,UAAU,CAACoB,eAAQ,CAACU,QAAQ,CAAC,GAAG,CAAC;IAC9D,CAAC;EACL,CAAC;EAED;IACIC,OAAO,EAAE,IAAI;IACbC,QAAQ,EAAE,MAAM/B,KAAK;IACrBgC,WAAW,EAAE,MAAMjB;EAAQ,GACxB,IAAAkB,sCAA6B,EAAC;IAC7BjC,KAAK;IACLkC,MAAM,EAAEnB,QAAQ,CAACS;EACrB,CAAC,CAAC,GACC,IAAAW,0CAA+B,EAAC;IAC/BnC,KAAK;IACLkC,MAAM,EAAEnB,QAAQ,CAACY;EACrB,CAAC,CAAC,GACC,IAAAS,kCAA2B,EAAC;IAC3BpC,KAAK;IACLkC,MAAM,EAAEnB,QAAQ,CAACC,IAAI;IACrBb;EACJ,CAAC,CAAC,GACC,IAAAkC,8CAAiC,EAAC;IACjCrC,KAAK;IACLkC,MAAM,EAAEnB,QAAQ,CAACM,UAAU;IAC3BlB;EACJ,CAAC,CAAC;AAEV,CAAC;AAAC"}
@@ -4,9 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  var _FormDynamoDbFieldPlugin = require("../../plugins/FormDynamoDbFieldPlugin");
9
-
10
8
  var _default = () => [new _FormDynamoDbFieldPlugin.FormDynamoDbFieldPlugin({
11
9
  field: "publishedOn",
12
10
  type: "date"
@@ -39,5 +37,4 @@ var _default = () => [new _FormDynamoDbFieldPlugin.FormDynamoDbFieldPlugin({
39
37
  field: "createdBy",
40
38
  path: "createdBy.id"
41
39
  })];
42
-
43
40
  exports.default = _default;
@@ -0,0 +1 @@
1
+ {"version":3,"names":["FormDynamoDbFieldPlugin","field","type","path"],"sources":["fields.ts"],"sourcesContent":["import { FormDynamoDbFieldPlugin } from \"~/plugins/FormDynamoDbFieldPlugin\";\n\nexport default () => [\n new FormDynamoDbFieldPlugin({\n field: \"publishedOn\",\n type: \"date\"\n }),\n new FormDynamoDbFieldPlugin({\n field: \"createdOn\",\n type: \"date\"\n }),\n new FormDynamoDbFieldPlugin({\n field: \"savedOn\",\n type: \"date\"\n }),\n new FormDynamoDbFieldPlugin({\n field: \"name\"\n }),\n new FormDynamoDbFieldPlugin({\n field: \"slug\"\n }),\n new FormDynamoDbFieldPlugin({\n field: \"locale\"\n }),\n new FormDynamoDbFieldPlugin({\n field: \"tenant\"\n }),\n new FormDynamoDbFieldPlugin({\n field: \"published\",\n type: \"boolean\"\n }),\n new FormDynamoDbFieldPlugin({\n field: \"status\"\n }),\n new FormDynamoDbFieldPlugin({\n field: \"version\",\n type: \"number\"\n }),\n new FormDynamoDbFieldPlugin({\n field: \"ownedBy\",\n path: \"ownedBy.id\"\n }),\n new FormDynamoDbFieldPlugin({\n field: \"createdBy\",\n path: \"createdBy.id\"\n })\n];\n"],"mappings":";;;;;;AAAA;AAA4E,eAE7D,MAAM,CACjB,IAAIA,gDAAuB,CAAC;EACxBC,KAAK,EAAE,aAAa;EACpBC,IAAI,EAAE;AACV,CAAC,CAAC,EACF,IAAIF,gDAAuB,CAAC;EACxBC,KAAK,EAAE,WAAW;EAClBC,IAAI,EAAE;AACV,CAAC,CAAC,EACF,IAAIF,gDAAuB,CAAC;EACxBC,KAAK,EAAE,SAAS;EAChBC,IAAI,EAAE;AACV,CAAC,CAAC,EACF,IAAIF,gDAAuB,CAAC;EACxBC,KAAK,EAAE;AACX,CAAC,CAAC,EACF,IAAID,gDAAuB,CAAC;EACxBC,KAAK,EAAE;AACX,CAAC,CAAC,EACF,IAAID,gDAAuB,CAAC;EACxBC,KAAK,EAAE;AACX,CAAC,CAAC,EACF,IAAID,gDAAuB,CAAC;EACxBC,KAAK,EAAE;AACX,CAAC,CAAC,EACF,IAAID,gDAAuB,CAAC;EACxBC,KAAK,EAAE,WAAW;EAClBC,IAAI,EAAE;AACV,CAAC,CAAC,EACF,IAAIF,gDAAuB,CAAC;EACxBC,KAAK,EAAE;AACX,CAAC,CAAC,EACF,IAAID,gDAAuB,CAAC;EACxBC,KAAK,EAAE,SAAS;EAChBC,IAAI,EAAE;AACV,CAAC,CAAC,EACF,IAAIF,gDAAuB,CAAC;EACxBC,KAAK,EAAE,SAAS;EAChBE,IAAI,EAAE;AACV,CAAC,CAAC,EACF,IAAIH,gDAAuB,CAAC;EACxBC,KAAK,EAAE,WAAW;EAClBE,IAAI,EAAE;AACV,CAAC,CAAC,CACL;AAAA"}
@@ -1,9 +1,9 @@
1
1
  import { Entity, Table } from "dynamodb-toolbox";
2
2
  import { PluginsContainer } from "@webiny/plugins";
3
3
  import { FormBuilderFormStorageOperations } from "../../types";
4
- export interface Params {
4
+ export interface CreateFormStorageOperationsParams {
5
5
  entity: Entity<any>;
6
6
  table: Table;
7
7
  plugins: PluginsContainer;
8
8
  }
9
- export declare const createFormStorageOperations: (params: Params) => FormBuilderFormStorageOperations;
9
+ export declare const createFormStorageOperations: (params: CreateFormStorageOperationsParams) => FormBuilderFormStorageOperations;