@webiny/api-headless-cms-ddb 5.34.8-beta.1 → 5.35.0-beta.0

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 (91) hide show
  1. package/definitions/entry.js +3 -5
  2. package/definitions/entry.js.map +1 -1
  3. package/definitions/group.js +0 -5
  4. package/definitions/group.js.map +1 -1
  5. package/definitions/model.js +17 -5
  6. package/definitions/model.js.map +1 -1
  7. package/definitions/settings.js +0 -5
  8. package/definitions/settings.js.map +1 -1
  9. package/definitions/system.js +0 -5
  10. package/definitions/system.js.map +1 -1
  11. package/definitions/table.js +0 -3
  12. package/definitions/table.js.map +1 -1
  13. package/dynamoDb/index.js +0 -7
  14. package/dynamoDb/index.js.map +1 -1
  15. package/dynamoDb/path/plainObject.js +1 -8
  16. package/dynamoDb/path/plainObject.js.map +1 -1
  17. package/dynamoDb/storage/date.js +1 -19
  18. package/dynamoDb/storage/date.js.map +1 -1
  19. package/dynamoDb/storage/longText.js +1 -18
  20. package/dynamoDb/storage/longText.js.map +1 -1
  21. package/dynamoDb/storage/richText.js +0 -18
  22. package/dynamoDb/storage/richText.js.map +1 -1
  23. package/dynamoDb/transformValue/datetime.js +1 -8
  24. package/dynamoDb/transformValue/datetime.js.map +1 -1
  25. package/index.js +6 -30
  26. package/index.js.map +1 -1
  27. package/operations/entry/dataLoaders.js +1 -44
  28. package/operations/entry/dataLoaders.js.map +1 -1
  29. package/operations/entry/filtering/createExpressions.js +2 -39
  30. package/operations/entry/filtering/createExpressions.js.map +1 -1
  31. package/operations/entry/filtering/createFields.js +0 -18
  32. package/operations/entry/filtering/createFields.js.map +1 -1
  33. package/operations/entry/filtering/extractSort.js +0 -10
  34. package/operations/entry/filtering/extractSort.js.map +1 -1
  35. package/operations/entry/filtering/filter.js +1 -36
  36. package/operations/entry/filtering/filter.js.map +1 -1
  37. package/operations/entry/filtering/fullTextSearch.js +0 -12
  38. package/operations/entry/filtering/fullTextSearch.js.map +1 -1
  39. package/operations/entry/filtering/getValue.js +0 -18
  40. package/operations/entry/filtering/getValue.js.map +1 -1
  41. package/operations/entry/filtering/index.js +0 -2
  42. package/operations/entry/filtering/index.js.map +1 -1
  43. package/operations/entry/filtering/mapPlugins.js +0 -8
  44. package/operations/entry/filtering/mapPlugins.js.map +1 -1
  45. package/operations/entry/filtering/plugins/defaultFilterCreate.js +0 -7
  46. package/operations/entry/filtering/plugins/defaultFilterCreate.js.map +1 -1
  47. package/operations/entry/filtering/plugins/index.js +0 -5
  48. package/operations/entry/filtering/plugins/index.js.map +1 -1
  49. package/operations/entry/filtering/plugins/objectFilterCreate.js +0 -21
  50. package/operations/entry/filtering/plugins/objectFilterCreate.js.map +1 -1
  51. package/operations/entry/filtering/plugins/refFilterCreate.js +0 -18
  52. package/operations/entry/filtering/plugins/refFilterCreate.js.map +1 -1
  53. package/operations/entry/filtering/sort.js +0 -15
  54. package/operations/entry/filtering/sort.js.map +1 -1
  55. package/operations/entry/filtering/systemFields.js +0 -2
  56. package/operations/entry/filtering/systemFields.js.map +1 -1
  57. package/operations/entry/filtering/transform.js +0 -3
  58. package/operations/entry/filtering/transform.js.map +1 -1
  59. package/operations/entry/filtering/values.js +0 -6
  60. package/operations/entry/filtering/values.js.map +1 -1
  61. package/operations/entry/filtering/where.js +0 -6
  62. package/operations/entry/filtering/where.js.map +1 -1
  63. package/operations/entry/index.js +58 -116
  64. package/operations/entry/index.js.map +1 -1
  65. package/operations/entry/keys.js +0 -18
  66. package/operations/entry/keys.js.map +1 -1
  67. package/operations/entry/systemFields.js +0 -2
  68. package/operations/entry/systemFields.js.map +1 -1
  69. package/operations/group/index.js +2 -32
  70. package/operations/group/index.js.map +1 -1
  71. package/operations/model/index.js +0 -25
  72. package/operations/model/index.js.map +1 -1
  73. package/operations/settings/index.js +0 -24
  74. package/operations/settings/index.js.map +1 -1
  75. package/operations/system/index.js +0 -17
  76. package/operations/system/index.js.map +1 -1
  77. package/package.json +13 -13
  78. package/plugins/CmsEntryFieldFilterPathPlugin.js +0 -14
  79. package/plugins/CmsEntryFieldFilterPathPlugin.js.map +1 -1
  80. package/plugins/CmsEntryFieldFilterPlugin.js +0 -7
  81. package/plugins/CmsEntryFieldFilterPlugin.js.map +1 -1
  82. package/plugins/CmsEntryFieldSortingPlugin.js +0 -10
  83. package/plugins/CmsEntryFieldSortingPlugin.js.map +1 -1
  84. package/plugins/CmsFieldFilterValueTransformPlugin.d.ts +11 -0
  85. package/plugins/CmsFieldFilterValueTransformPlugin.js +24 -0
  86. package/plugins/CmsFieldFilterValueTransformPlugin.js.map +1 -0
  87. package/plugins/index.d.ts +1 -0
  88. package/plugins/index.js +11 -6
  89. package/plugins/index.js.map +1 -1
  90. package/types.js +0 -1
  91. package/types.js.map +1 -1
@@ -1,16 +1,12 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.createEntryEntity = void 0;
9
-
10
8
  var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
11
-
12
9
  var _dynamodbToolbox = require("dynamodb-toolbox");
13
-
14
10
  const createEntryEntity = params => {
15
11
  const {
16
12
  table,
@@ -59,6 +55,9 @@ const createEntryEntity = params => {
59
55
  ownedBy: {
60
56
  type: "map"
61
57
  },
58
+ modifiedBy: {
59
+ type: "map"
60
+ },
62
61
  createdOn: {
63
62
  type: "string"
64
63
  },
@@ -92,5 +91,4 @@ const createEntryEntity = params => {
92
91
  }, attributes || {})
93
92
  });
94
93
  };
95
-
96
94
  exports.createEntryEntity = createEntryEntity;
@@ -1 +1 @@
1
- {"version":3,"names":["createEntryEntity","params","table","entityName","attributes","Entity","name","PK","type","partitionKey","SK","sortKey","GSI1_PK","GSI1_SK","TYPE","__type","webinyVersion","tenant","entryId","id","createdBy","ownedBy","createdOn","savedOn","modelId","locale","publishedOn","version","locked","status","values","meta"],"sources":["entry.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}\nexport const createEntryEntity = (params: Params): Entity<any> => {\n const { table, entityName, attributes } = params;\n return new Entity({\n name: entityName,\n table,\n attributes: {\n PK: {\n type: \"string\",\n partitionKey: true\n },\n SK: {\n type: \"string\",\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 __type: {\n type: \"string\"\n },\n webinyVersion: {\n type: \"string\"\n },\n tenant: {\n type: \"string\"\n },\n entryId: {\n type: \"string\"\n },\n id: {\n type: \"string\"\n },\n createdBy: {\n type: \"map\"\n },\n ownedBy: {\n type: \"map\"\n },\n createdOn: {\n type: \"string\"\n },\n savedOn: {\n type: \"string\"\n },\n modelId: {\n type: \"string\"\n },\n locale: {\n type: \"string\"\n },\n publishedOn: {\n type: \"string\"\n },\n version: {\n type: \"number\"\n },\n locked: {\n type: \"boolean\"\n },\n status: {\n type: \"string\"\n },\n values: {\n type: \"map\"\n },\n meta: {\n type: \"map\"\n },\n ...(attributes || {})\n }\n });\n};\n"],"mappings":";;;;;;;;;;;AAAA;;AAQO,MAAMA,iBAAiB,GAAIC,MAAD,IAAiC;EAC9D,MAAM;IAAEC,KAAF;IAASC,UAAT;IAAqBC;EAArB,IAAoCH,MAA1C;EACA,OAAO,IAAII,uBAAJ,CAAW;IACdC,IAAI,EAAEH,UADQ;IAEdD,KAFc;IAGdE,UAAU;MACNG,EAAE,EAAE;QACAC,IAAI,EAAE,QADN;QAEAC,YAAY,EAAE;MAFd,CADE;MAKNC,EAAE,EAAE;QACAF,IAAI,EAAE,QADN;QAEAG,OAAO,EAAE;MAFT,CALE;MASNC,OAAO,EAAE;QACLJ,IAAI,EAAE;MADD,CATH;MAYNK,OAAO,EAAE;QACLL,IAAI,EAAE;MADD,CAZH;MAeNM,IAAI,EAAE;QACFN,IAAI,EAAE;MADJ,CAfA;MAkBNO,MAAM,EAAE;QACJP,IAAI,EAAE;MADF,CAlBF;MAqBNQ,aAAa,EAAE;QACXR,IAAI,EAAE;MADK,CArBT;MAwBNS,MAAM,EAAE;QACJT,IAAI,EAAE;MADF,CAxBF;MA2BNU,OAAO,EAAE;QACLV,IAAI,EAAE;MADD,CA3BH;MA8BNW,EAAE,EAAE;QACAX,IAAI,EAAE;MADN,CA9BE;MAiCNY,SAAS,EAAE;QACPZ,IAAI,EAAE;MADC,CAjCL;MAoCNa,OAAO,EAAE;QACLb,IAAI,EAAE;MADD,CApCH;MAuCNc,SAAS,EAAE;QACPd,IAAI,EAAE;MADC,CAvCL;MA0CNe,OAAO,EAAE;QACLf,IAAI,EAAE;MADD,CA1CH;MA6CNgB,OAAO,EAAE;QACLhB,IAAI,EAAE;MADD,CA7CH;MAgDNiB,MAAM,EAAE;QACJjB,IAAI,EAAE;MADF,CAhDF;MAmDNkB,WAAW,EAAE;QACTlB,IAAI,EAAE;MADG,CAnDP;MAsDNmB,OAAO,EAAE;QACLnB,IAAI,EAAE;MADD,CAtDH;MAyDNoB,MAAM,EAAE;QACJpB,IAAI,EAAE;MADF,CAzDF;MA4DNqB,MAAM,EAAE;QACJrB,IAAI,EAAE;MADF,CA5DF;MA+DNsB,MAAM,EAAE;QACJtB,IAAI,EAAE;MADF,CA/DF;MAkENuB,IAAI,EAAE;QACFvB,IAAI,EAAE;MADJ;IAlEA,GAqEFJ,UAAU,IAAI,EArEZ;EAHI,CAAX,CAAP;AA2EH,CA7EM"}
1
+ {"version":3,"names":["createEntryEntity","params","table","entityName","attributes","Entity","name","PK","type","partitionKey","SK","sortKey","GSI1_PK","GSI1_SK","TYPE","__type","webinyVersion","tenant","entryId","id","createdBy","ownedBy","modifiedBy","createdOn","savedOn","modelId","locale","publishedOn","version","locked","status","values","meta"],"sources":["entry.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}\nexport const createEntryEntity = (params: Params): Entity<any> => {\n const { table, entityName, attributes } = params;\n return new Entity({\n name: entityName,\n table,\n attributes: {\n PK: {\n type: \"string\",\n partitionKey: true\n },\n SK: {\n type: \"string\",\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 __type: {\n type: \"string\"\n },\n webinyVersion: {\n type: \"string\"\n },\n tenant: {\n type: \"string\"\n },\n entryId: {\n type: \"string\"\n },\n id: {\n type: \"string\"\n },\n createdBy: {\n type: \"map\"\n },\n ownedBy: {\n type: \"map\"\n },\n modifiedBy: {\n type: \"map\"\n },\n createdOn: {\n type: \"string\"\n },\n savedOn: {\n type: \"string\"\n },\n modelId: {\n type: \"string\"\n },\n locale: {\n type: \"string\"\n },\n publishedOn: {\n type: \"string\"\n },\n version: {\n type: \"number\"\n },\n locked: {\n type: \"boolean\"\n },\n status: {\n type: \"string\"\n },\n values: {\n type: \"map\"\n },\n meta: {\n type: \"map\"\n },\n ...(attributes || {})\n }\n });\n};\n"],"mappings":";;;;;;;;AAAA;AAQO,MAAMA,iBAAiB,GAAIC,MAAc,IAAkB;EAC9D,MAAM;IAAEC,KAAK;IAAEC,UAAU;IAAEC;EAAW,CAAC,GAAGH,MAAM;EAChD,OAAO,IAAII,uBAAM,CAAC;IACdC,IAAI,EAAEH,UAAU;IAChBD,KAAK;IACLE,UAAU;MACNG,EAAE,EAAE;QACAC,IAAI,EAAE,QAAQ;QACdC,YAAY,EAAE;MAClB,CAAC;MACDC,EAAE,EAAE;QACAF,IAAI,EAAE,QAAQ;QACdG,OAAO,EAAE;MACb,CAAC;MACDC,OAAO,EAAE;QACLJ,IAAI,EAAE;MACV,CAAC;MACDK,OAAO,EAAE;QACLL,IAAI,EAAE;MACV,CAAC;MACDM,IAAI,EAAE;QACFN,IAAI,EAAE;MACV,CAAC;MACDO,MAAM,EAAE;QACJP,IAAI,EAAE;MACV,CAAC;MACDQ,aAAa,EAAE;QACXR,IAAI,EAAE;MACV,CAAC;MACDS,MAAM,EAAE;QACJT,IAAI,EAAE;MACV,CAAC;MACDU,OAAO,EAAE;QACLV,IAAI,EAAE;MACV,CAAC;MACDW,EAAE,EAAE;QACAX,IAAI,EAAE;MACV,CAAC;MACDY,SAAS,EAAE;QACPZ,IAAI,EAAE;MACV,CAAC;MACDa,OAAO,EAAE;QACLb,IAAI,EAAE;MACV,CAAC;MACDc,UAAU,EAAE;QACRd,IAAI,EAAE;MACV,CAAC;MACDe,SAAS,EAAE;QACPf,IAAI,EAAE;MACV,CAAC;MACDgB,OAAO,EAAE;QACLhB,IAAI,EAAE;MACV,CAAC;MACDiB,OAAO,EAAE;QACLjB,IAAI,EAAE;MACV,CAAC;MACDkB,MAAM,EAAE;QACJlB,IAAI,EAAE;MACV,CAAC;MACDmB,WAAW,EAAE;QACTnB,IAAI,EAAE;MACV,CAAC;MACDoB,OAAO,EAAE;QACLpB,IAAI,EAAE;MACV,CAAC;MACDqB,MAAM,EAAE;QACJrB,IAAI,EAAE;MACV,CAAC;MACDsB,MAAM,EAAE;QACJtB,IAAI,EAAE;MACV,CAAC;MACDuB,MAAM,EAAE;QACJvB,IAAI,EAAE;MACV,CAAC;MACDwB,IAAI,EAAE;QACFxB,IAAI,EAAE;MACV;IAAC,GACGJ,UAAU,IAAI,CAAC,CAAC;EAE5B,CAAC,CAAC;AACN,CAAC;AAAC"}
@@ -1,16 +1,12 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.createGroupEntity = void 0;
9
-
10
8
  var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
11
-
12
9
  var _dynamodbToolbox = require("dynamodb-toolbox");
13
-
14
10
  const createGroupEntity = params => {
15
11
  const {
16
12
  table,
@@ -66,5 +62,4 @@ const createGroupEntity = params => {
66
62
  }, attributes || {})
67
63
  });
68
64
  };
69
-
70
65
  exports.createGroupEntity = createGroupEntity;
@@ -1 +1 @@
1
- {"version":3,"names":["createGroupEntity","params","table","attributes","entityName","Entity","name","PK","partitionKey","SK","sortKey","TYPE","type","webinyVersion","id","slug","locale","description","icon","createdBy","createdOn","savedOn","tenant"],"sources":["group.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}\nexport const createGroupEntity = (params: Params): Entity<any> => {\n const { table, attributes, entityName } = 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 webinyVersion: {\n type: \"string\"\n },\n id: {\n type: \"string\"\n },\n name: {\n type: \"string\"\n },\n slug: {\n type: \"string\"\n },\n locale: {\n type: \"string\"\n },\n description: {\n type: \"string\"\n },\n icon: {\n type: \"string\"\n },\n\n createdBy: {\n type: \"map\"\n },\n createdOn: {\n type: \"string\"\n },\n savedOn: {\n type: \"string\"\n },\n tenant: {\n type: \"string\"\n },\n ...(attributes || {})\n }\n });\n};\n"],"mappings":";;;;;;;;;;;AAAA;;AAQO,MAAMA,iBAAiB,GAAIC,MAAD,IAAiC;EAC9D,MAAM;IAAEC,KAAF;IAASC,UAAT;IAAqBC;EAArB,IAAoCH,MAA1C;EACA,OAAO,IAAII,uBAAJ,CAAW;IACdC,IAAI,EAAEF,UADQ;IAEdF,KAFc;IAGdC,UAAU;MACNI,EAAE,EAAE;QACAC,YAAY,EAAE;MADd,CADE;MAINC,EAAE,EAAE;QACAC,OAAO,EAAE;MADT,CAJE;MAONC,IAAI,EAAE;QACFC,IAAI,EAAE;MADJ,CAPA;MAUNC,aAAa,EAAE;QACXD,IAAI,EAAE;MADK,CAVT;MAaNE,EAAE,EAAE;QACAF,IAAI,EAAE;MADN,CAbE;MAgBNN,IAAI,EAAE;QACFM,IAAI,EAAE;MADJ,CAhBA;MAmBNG,IAAI,EAAE;QACFH,IAAI,EAAE;MADJ,CAnBA;MAsBNI,MAAM,EAAE;QACJJ,IAAI,EAAE;MADF,CAtBF;MAyBNK,WAAW,EAAE;QACTL,IAAI,EAAE;MADG,CAzBP;MA4BNM,IAAI,EAAE;QACFN,IAAI,EAAE;MADJ,CA5BA;MAgCNO,SAAS,EAAE;QACPP,IAAI,EAAE;MADC,CAhCL;MAmCNQ,SAAS,EAAE;QACPR,IAAI,EAAE;MADC,CAnCL;MAsCNS,OAAO,EAAE;QACLT,IAAI,EAAE;MADD,CAtCH;MAyCNU,MAAM,EAAE;QACJV,IAAI,EAAE;MADF;IAzCF,GA4CFT,UAAU,IAAI,EA5CZ;EAHI,CAAX,CAAP;AAkDH,CApDM"}
1
+ {"version":3,"names":["createGroupEntity","params","table","attributes","entityName","Entity","name","PK","partitionKey","SK","sortKey","TYPE","type","webinyVersion","id","slug","locale","description","icon","createdBy","createdOn","savedOn","tenant"],"sources":["group.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}\nexport const createGroupEntity = (params: Params): Entity<any> => {\n const { table, attributes, entityName } = 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 webinyVersion: {\n type: \"string\"\n },\n id: {\n type: \"string\"\n },\n name: {\n type: \"string\"\n },\n slug: {\n type: \"string\"\n },\n locale: {\n type: \"string\"\n },\n description: {\n type: \"string\"\n },\n icon: {\n type: \"string\"\n },\n\n createdBy: {\n type: \"map\"\n },\n createdOn: {\n type: \"string\"\n },\n savedOn: {\n type: \"string\"\n },\n tenant: {\n type: \"string\"\n },\n ...(attributes || {})\n }\n });\n};\n"],"mappings":";;;;;;;;AAAA;AAQO,MAAMA,iBAAiB,GAAIC,MAAc,IAAkB;EAC9D,MAAM;IAAEC,KAAK;IAAEC,UAAU;IAAEC;EAAW,CAAC,GAAGH,MAAM;EAChD,OAAO,IAAII,uBAAM,CAAC;IACdC,IAAI,EAAEF,UAAU;IAChBF,KAAK;IACLC,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,aAAa,EAAE;QACXD,IAAI,EAAE;MACV,CAAC;MACDE,EAAE,EAAE;QACAF,IAAI,EAAE;MACV,CAAC;MACDN,IAAI,EAAE;QACFM,IAAI,EAAE;MACV,CAAC;MACDG,IAAI,EAAE;QACFH,IAAI,EAAE;MACV,CAAC;MACDI,MAAM,EAAE;QACJJ,IAAI,EAAE;MACV,CAAC;MACDK,WAAW,EAAE;QACTL,IAAI,EAAE;MACV,CAAC;MACDM,IAAI,EAAE;QACFN,IAAI,EAAE;MACV,CAAC;MAEDO,SAAS,EAAE;QACPP,IAAI,EAAE;MACV,CAAC;MACDQ,SAAS,EAAE;QACPR,IAAI,EAAE;MACV,CAAC;MACDS,OAAO,EAAE;QACLT,IAAI,EAAE;MACV,CAAC;MACDU,MAAM,EAAE;QACJV,IAAI,EAAE;MACV;IAAC,GACGT,UAAU,IAAI,CAAC,CAAC;EAE5B,CAAC,CAAC;AACN,CAAC;AAAC"}
@@ -1,16 +1,12 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.createModelEntity = void 0;
9
-
10
8
  var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
11
-
12
9
  var _dynamodbToolbox = require("dynamodb-toolbox");
13
-
14
10
  const createModelEntity = params => {
15
11
  const {
16
12
  table,
@@ -43,6 +39,14 @@ const createModelEntity = params => {
43
39
  type: "string",
44
40
  required: true
45
41
  },
42
+ singularApiName: {
43
+ type: "string",
44
+ required: true
45
+ },
46
+ pluralApiName: {
47
+ type: "string",
48
+ required: true
49
+ },
46
50
  locale: {
47
51
  type: "string",
48
52
  required: true
@@ -51,6 +55,9 @@ const createModelEntity = params => {
51
55
  type: "map",
52
56
  required: true
53
57
  },
58
+ icon: {
59
+ type: "string"
60
+ },
54
61
  description: {
55
62
  type: "string"
56
63
  },
@@ -86,6 +93,12 @@ const createModelEntity = params => {
86
93
  titleFieldId: {
87
94
  type: "string"
88
95
  },
96
+ descriptionFieldId: {
97
+ type: "string"
98
+ },
99
+ imageFieldId: {
100
+ type: "string"
101
+ },
89
102
  tenant: {
90
103
  type: "string",
91
104
  required: true
@@ -93,5 +106,4 @@ const createModelEntity = params => {
93
106
  }, attributes || {})
94
107
  });
95
108
  };
96
-
97
109
  exports.createModelEntity = createModelEntity;
@@ -1 +1 @@
1
- {"version":3,"names":["createModelEntity","params","table","attributes","entityName","Entity","name","PK","partitionKey","SK","sortKey","TYPE","type","required","webinyVersion","modelId","locale","group","description","createdOn","savedOn","createdBy","fields","layout","tags","default","lockedFields","titleFieldId","tenant"],"sources":["model.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 createModelEntity = (params: Params): Entity<any> => {\n const { table, attributes, entityName } = 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 required: true\n },\n webinyVersion: {\n type: \"string\",\n required: true\n },\n name: {\n type: \"string\",\n required: true\n },\n modelId: {\n type: \"string\",\n required: true\n },\n locale: {\n type: \"string\",\n required: true\n },\n group: {\n type: \"map\",\n required: true\n },\n description: {\n type: \"string\"\n },\n createdOn: {\n type: \"string\",\n required: true\n },\n savedOn: {\n type: \"string\",\n required: true\n },\n createdBy: {\n type: \"map\",\n required: true\n },\n fields: {\n type: \"list\",\n required: true\n },\n layout: {\n type: \"list\",\n required: true\n },\n tags: {\n type: \"list\",\n required: false,\n default: []\n },\n lockedFields: {\n type: \"list\",\n required: true\n },\n titleFieldId: {\n type: \"string\"\n },\n tenant: {\n type: \"string\",\n required: true\n },\n ...(attributes || {})\n }\n });\n};\n"],"mappings":";;;;;;;;;;;AAAA;;AASO,MAAMA,iBAAiB,GAAIC,MAAD,IAAiC;EAC9D,MAAM;IAAEC,KAAF;IAASC,UAAT;IAAqBC;EAArB,IAAoCH,MAA1C;EACA,OAAO,IAAII,uBAAJ,CAAW;IACdC,IAAI,EAAEF,UADQ;IAEdF,KAFc;IAGdC,UAAU;MACNI,EAAE,EAAE;QACAC,YAAY,EAAE;MADd,CADE;MAINC,EAAE,EAAE;QACAC,OAAO,EAAE;MADT,CAJE;MAONC,IAAI,EAAE;QACFC,IAAI,EAAE,QADJ;QAEFC,QAAQ,EAAE;MAFR,CAPA;MAWNC,aAAa,EAAE;QACXF,IAAI,EAAE,QADK;QAEXC,QAAQ,EAAE;MAFC,CAXT;MAeNP,IAAI,EAAE;QACFM,IAAI,EAAE,QADJ;QAEFC,QAAQ,EAAE;MAFR,CAfA;MAmBNE,OAAO,EAAE;QACLH,IAAI,EAAE,QADD;QAELC,QAAQ,EAAE;MAFL,CAnBH;MAuBNG,MAAM,EAAE;QACJJ,IAAI,EAAE,QADF;QAEJC,QAAQ,EAAE;MAFN,CAvBF;MA2BNI,KAAK,EAAE;QACHL,IAAI,EAAE,KADH;QAEHC,QAAQ,EAAE;MAFP,CA3BD;MA+BNK,WAAW,EAAE;QACTN,IAAI,EAAE;MADG,CA/BP;MAkCNO,SAAS,EAAE;QACPP,IAAI,EAAE,QADC;QAEPC,QAAQ,EAAE;MAFH,CAlCL;MAsCNO,OAAO,EAAE;QACLR,IAAI,EAAE,QADD;QAELC,QAAQ,EAAE;MAFL,CAtCH;MA0CNQ,SAAS,EAAE;QACPT,IAAI,EAAE,KADC;QAEPC,QAAQ,EAAE;MAFH,CA1CL;MA8CNS,MAAM,EAAE;QACJV,IAAI,EAAE,MADF;QAEJC,QAAQ,EAAE;MAFN,CA9CF;MAkDNU,MAAM,EAAE;QACJX,IAAI,EAAE,MADF;QAEJC,QAAQ,EAAE;MAFN,CAlDF;MAsDNW,IAAI,EAAE;QACFZ,IAAI,EAAE,MADJ;QAEFC,QAAQ,EAAE,KAFR;QAGFY,OAAO,EAAE;MAHP,CAtDA;MA2DNC,YAAY,EAAE;QACVd,IAAI,EAAE,MADI;QAEVC,QAAQ,EAAE;MAFA,CA3DR;MA+DNc,YAAY,EAAE;QACVf,IAAI,EAAE;MADI,CA/DR;MAkENgB,MAAM,EAAE;QACJhB,IAAI,EAAE,QADF;QAEJC,QAAQ,EAAE;MAFN;IAlEF,GAsEFV,UAAU,IAAI,EAtEZ;EAHI,CAAX,CAAP;AA4EH,CA9EM"}
1
+ {"version":3,"names":["createModelEntity","params","table","attributes","entityName","Entity","name","PK","partitionKey","SK","sortKey","TYPE","type","required","webinyVersion","modelId","singularApiName","pluralApiName","locale","group","icon","description","createdOn","savedOn","createdBy","fields","layout","tags","default","lockedFields","titleFieldId","descriptionFieldId","imageFieldId","tenant"],"sources":["model.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 createModelEntity = (params: Params): Entity<any> => {\n const { table, attributes, entityName } = 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 required: true\n },\n webinyVersion: {\n type: \"string\",\n required: true\n },\n name: {\n type: \"string\",\n required: true\n },\n modelId: {\n type: \"string\",\n required: true\n },\n singularApiName: {\n type: \"string\",\n required: true\n },\n pluralApiName: {\n type: \"string\",\n required: true\n },\n locale: {\n type: \"string\",\n required: true\n },\n group: {\n type: \"map\",\n required: true\n },\n icon: {\n type: \"string\"\n },\n description: {\n type: \"string\"\n },\n createdOn: {\n type: \"string\",\n required: true\n },\n savedOn: {\n type: \"string\",\n required: true\n },\n createdBy: {\n type: \"map\",\n required: true\n },\n fields: {\n type: \"list\",\n required: true\n },\n layout: {\n type: \"list\",\n required: true\n },\n tags: {\n type: \"list\",\n required: false,\n default: []\n },\n lockedFields: {\n type: \"list\",\n required: true\n },\n titleFieldId: {\n type: \"string\"\n },\n descriptionFieldId: {\n type: \"string\"\n },\n imageFieldId: {\n type: \"string\"\n },\n tenant: {\n type: \"string\",\n required: true\n },\n ...(attributes || {})\n }\n });\n};\n"],"mappings":";;;;;;;;AAAA;AASO,MAAMA,iBAAiB,GAAIC,MAAc,IAAkB;EAC9D,MAAM;IAAEC,KAAK;IAAEC,UAAU;IAAEC;EAAW,CAAC,GAAGH,MAAM;EAChD,OAAO,IAAII,uBAAM,CAAC;IACdC,IAAI,EAAEF,UAAU;IAChBF,KAAK;IACLC,UAAU;MACNI,EAAE,EAAE;QACAC,YAAY,EAAE;MAClB,CAAC;MACDC,EAAE,EAAE;QACAC,OAAO,EAAE;MACb,CAAC;MACDC,IAAI,EAAE;QACFC,IAAI,EAAE,QAAQ;QACdC,QAAQ,EAAE;MACd,CAAC;MACDC,aAAa,EAAE;QACXF,IAAI,EAAE,QAAQ;QACdC,QAAQ,EAAE;MACd,CAAC;MACDP,IAAI,EAAE;QACFM,IAAI,EAAE,QAAQ;QACdC,QAAQ,EAAE;MACd,CAAC;MACDE,OAAO,EAAE;QACLH,IAAI,EAAE,QAAQ;QACdC,QAAQ,EAAE;MACd,CAAC;MACDG,eAAe,EAAE;QACbJ,IAAI,EAAE,QAAQ;QACdC,QAAQ,EAAE;MACd,CAAC;MACDI,aAAa,EAAE;QACXL,IAAI,EAAE,QAAQ;QACdC,QAAQ,EAAE;MACd,CAAC;MACDK,MAAM,EAAE;QACJN,IAAI,EAAE,QAAQ;QACdC,QAAQ,EAAE;MACd,CAAC;MACDM,KAAK,EAAE;QACHP,IAAI,EAAE,KAAK;QACXC,QAAQ,EAAE;MACd,CAAC;MACDO,IAAI,EAAE;QACFR,IAAI,EAAE;MACV,CAAC;MACDS,WAAW,EAAE;QACTT,IAAI,EAAE;MACV,CAAC;MACDU,SAAS,EAAE;QACPV,IAAI,EAAE,QAAQ;QACdC,QAAQ,EAAE;MACd,CAAC;MACDU,OAAO,EAAE;QACLX,IAAI,EAAE,QAAQ;QACdC,QAAQ,EAAE;MACd,CAAC;MACDW,SAAS,EAAE;QACPZ,IAAI,EAAE,KAAK;QACXC,QAAQ,EAAE;MACd,CAAC;MACDY,MAAM,EAAE;QACJb,IAAI,EAAE,MAAM;QACZC,QAAQ,EAAE;MACd,CAAC;MACDa,MAAM,EAAE;QACJd,IAAI,EAAE,MAAM;QACZC,QAAQ,EAAE;MACd,CAAC;MACDc,IAAI,EAAE;QACFf,IAAI,EAAE,MAAM;QACZC,QAAQ,EAAE,KAAK;QACfe,OAAO,EAAE;MACb,CAAC;MACDC,YAAY,EAAE;QACVjB,IAAI,EAAE,MAAM;QACZC,QAAQ,EAAE;MACd,CAAC;MACDiB,YAAY,EAAE;QACVlB,IAAI,EAAE;MACV,CAAC;MACDmB,kBAAkB,EAAE;QAChBnB,IAAI,EAAE;MACV,CAAC;MACDoB,YAAY,EAAE;QACVpB,IAAI,EAAE;MACV,CAAC;MACDqB,MAAM,EAAE;QACJrB,IAAI,EAAE,QAAQ;QACdC,QAAQ,EAAE;MACd;IAAC,GACGV,UAAU,IAAI,CAAC,CAAC;EAE5B,CAAC,CAAC;AACN,CAAC;AAAC"}
@@ -1,16 +1,12 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.createSettingsEntity = void 0;
9
-
10
8
  var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
11
-
12
9
  var _dynamodbToolbox = require("dynamodb-toolbox");
13
-
14
10
  const createSettingsEntity = params => {
15
11
  const {
16
12
  entityName,
@@ -54,5 +50,4 @@ const createSettingsEntity = params => {
54
50
  }, attributes || {})
55
51
  });
56
52
  };
57
-
58
53
  exports.createSettingsEntity = createSettingsEntity;
@@ -1 +1 @@
1
- {"version":3,"names":["createSettingsEntity","params","entityName","table","attributes","Entity","name","PK","partitionKey","SK","sortKey","TYPE","type","key","uploadMinFileSize","uploadMaxFileSize","srcPrefix","contentModelLastChange","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, table, 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 TYPE: {\n type: \"string\"\n },\n key: {\n type: \"string\"\n },\n uploadMinFileSize: {\n type: \"number\"\n },\n uploadMaxFileSize: {\n type: \"number\"\n },\n srcPrefix: {\n type: \"string\"\n },\n contentModelLastChange: {\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,MAAD,IAAiC;EACjE,MAAM;IAAEC,UAAF;IAAcC,KAAd;IAAqBC;EAArB,IAAoCH,MAA1C;EACA,OAAO,IAAII,uBAAJ,CAAW;IACdC,IAAI,EAAEJ,UADQ;IAEdC,KAFc;IAGdC,UAAU;MACNG,EAAE,EAAE;QACAC,YAAY,EAAE;MADd,CADE;MAINC,EAAE,EAAE;QACAC,OAAO,EAAE;MADT,CAJE;MAONC,IAAI,EAAE;QACFC,IAAI,EAAE;MADJ,CAPA;MAUNC,GAAG,EAAE;QACDD,IAAI,EAAE;MADL,CAVC;MAaNE,iBAAiB,EAAE;QACfF,IAAI,EAAE;MADS,CAbb;MAgBNG,iBAAiB,EAAE;QACfH,IAAI,EAAE;MADS,CAhBb;MAmBNI,SAAS,EAAE;QACPJ,IAAI,EAAE;MADC,CAnBL;MAsBNK,sBAAsB,EAAE;QACpBL,IAAI,EAAE;MADc,CAtBlB;MAyBNM,MAAM,EAAE;QACJN,IAAI,EAAE;MADF,CAzBF;MA4BNO,MAAM,EAAE;QACJP,IAAI,EAAE;MADF;IA5BF,GA+BFR,UAAU,IAAI,EA/BZ;EAHI,CAAX,CAAP;AAqCH,CAvCM"}
1
+ {"version":3,"names":["createSettingsEntity","params","entityName","table","attributes","Entity","name","PK","partitionKey","SK","sortKey","TYPE","type","key","uploadMinFileSize","uploadMaxFileSize","srcPrefix","contentModelLastChange","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, table, 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 TYPE: {\n type: \"string\"\n },\n key: {\n type: \"string\"\n },\n uploadMinFileSize: {\n type: \"number\"\n },\n uploadMaxFileSize: {\n type: \"number\"\n },\n srcPrefix: {\n type: \"string\"\n },\n contentModelLastChange: {\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,KAAK;IAAEC;EAAW,CAAC,GAAGH,MAAM;EAChD,OAAO,IAAII,uBAAM,CAAC;IACdC,IAAI,EAAEJ,UAAU;IAChBC,KAAK;IACLC,UAAU;MACNG,EAAE,EAAE;QACAC,YAAY,EAAE;MAClB,CAAC;MACDC,EAAE,EAAE;QACAC,OAAO,EAAE;MACb,CAAC;MACDC,IAAI,EAAE;QACFC,IAAI,EAAE;MACV,CAAC;MACDC,GAAG,EAAE;QACDD,IAAI,EAAE;MACV,CAAC;MACDE,iBAAiB,EAAE;QACfF,IAAI,EAAE;MACV,CAAC;MACDG,iBAAiB,EAAE;QACfH,IAAI,EAAE;MACV,CAAC;MACDI,SAAS,EAAE;QACPJ,IAAI,EAAE;MACV,CAAC;MACDK,sBAAsB,EAAE;QACpBL,IAAI,EAAE;MACV,CAAC;MACDM,MAAM,EAAE;QACJN,IAAI,EAAE;MACV,CAAC;MACDO,MAAM,EAAE;QACJP,IAAI,EAAE;MACV;IAAC,GACGR,UAAU,IAAI,CAAC,CAAC;EAE5B,CAAC,CAAC;AACN,CAAC;AAAC"}
@@ -1,16 +1,12 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.createSystemEntity = void 0;
9
-
10
8
  var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
11
-
12
9
  var _dynamodbToolbox = require("dynamodb-toolbox");
13
-
14
10
  const createSystemEntity = params => {
15
11
  const {
16
12
  entityName,
@@ -42,5 +38,4 @@ const createSystemEntity = params => {
42
38
  }, attributes || {})
43
39
  });
44
40
  };
45
-
46
41
  exports.createSystemEntity = createSystemEntity;
@@ -1 +1 @@
1
- {"version":3,"names":["createSystemEntity","params","entityName","attributes","table","Entity","name","PK","partitionKey","SK","sortKey","version","type","locale","tenant","readAPIKey"],"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 locale: {\n type: \"string\"\n },\n tenant: {\n type: \"string\"\n },\n readAPIKey: {\n type: \"string\"\n },\n ...(attributes || {})\n }\n });\n};\n"],"mappings":";;;;;;;;;;;AAAA;;AASO,MAAMA,kBAAkB,GAAIC,MAAD,IAAiC;EAC/D,MAAM;IAAEC,UAAF;IAAcC,UAAd;IAA0BC;EAA1B,IAAoCH,MAA1C;EACA,OAAO,IAAII,uBAAJ,CAAW;IACdC,IAAI,EAAEJ,UADQ;IAEdE,KAFc;IAGdD,UAAU;MACNI,EAAE,EAAE;QACAC,YAAY,EAAE;MADd,CADE;MAINC,EAAE,EAAE;QACAC,OAAO,EAAE;MADT,CAJE;MAONC,OAAO,EAAE;QACLC,IAAI,EAAE;MADD,CAPH;MAUNC,MAAM,EAAE;QACJD,IAAI,EAAE;MADF,CAVF;MAaNE,MAAM,EAAE;QACJF,IAAI,EAAE;MADF,CAbF;MAgBNG,UAAU,EAAE;QACRH,IAAI,EAAE;MADE;IAhBN,GAmBFT,UAAU,IAAI,EAnBZ;EAHI,CAAX,CAAP;AAyBH,CA3BM"}
1
+ {"version":3,"names":["createSystemEntity","params","entityName","attributes","table","Entity","name","PK","partitionKey","SK","sortKey","version","type","locale","tenant","readAPIKey"],"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 locale: {\n type: \"string\"\n },\n tenant: {\n type: \"string\"\n },\n readAPIKey: {\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,CAAC;MACDE,MAAM,EAAE;QACJF,IAAI,EAAE;MACV,CAAC;MACDG,UAAU,EAAE;QACRH,IAAI,EAAE;MACV;IAAC,GACGT,UAAU,IAAI,CAAC,CAAC;EAE5B,CAAC,CAAC;AACN,CAAC;AAAC"}
@@ -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 = ({
11
9
  table,
12
10
  documentClient
@@ -26,5 +24,4 @@ const createTable = ({
26
24
  const config = typeof table === "function" ? table(tableConfig) : tableConfig;
27
25
  return new _dynamodbToolbox.Table(config);
28
26
  };
29
-
30
27
  exports.createTable = createTable;
@@ -1 +1 @@
1
- {"version":3,"names":["createTable","table","documentClient","tableConfig","name","process","env","DB_TABLE_HEADLESS_CMS","DB_TABLE","partitionKey","sortKey","DocumentClient","indexes","GSI1","config","Table"],"sources":["table.ts"],"sourcesContent":["import { TableModifier } from \"~/types\";\nimport { DocumentClient } from \"aws-sdk/clients/dynamodb\";\nimport { Table } from \"dynamodb-toolbox\";\nimport { TableConstructor } from \"dynamodb-toolbox/dist/classes/Table\";\n\ninterface Params {\n table?: TableModifier;\n documentClient: DocumentClient;\n}\nexport const createTable = ({ table, documentClient }: Params): Table => {\n const tableConfig: TableConstructor = {\n name: process.env.DB_TABLE_HEADLESS_CMS || (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 const config = typeof table === \"function\" ? table(tableConfig) : tableConfig;\n\n return new Table(config);\n};\n"],"mappings":";;;;;;;AAEA;;AAOO,MAAMA,WAAW,GAAG,CAAC;EAAEC,KAAF;EAASC;AAAT,CAAD,KAA8C;EACrE,MAAMC,WAA6B,GAAG;IAClCC,IAAI,EAAEC,OAAO,CAACC,GAAR,CAAYC,qBAAZ,IAAsCF,OAAO,CAACC,GAAR,CAAYE,QADtB;IAElCC,YAAY,EAAE,IAFoB;IAGlCC,OAAO,EAAE,IAHyB;IAIlCC,cAAc,EAAET,cAJkB;IAKlCU,OAAO,EAAE;MACLC,IAAI,EAAE;QACFJ,YAAY,EAAE,SADZ;QAEFC,OAAO,EAAE;MAFP;IADD;EALyB,CAAtC;EAaA,MAAMI,MAAM,GAAG,OAAOb,KAAP,KAAiB,UAAjB,GAA8BA,KAAK,CAACE,WAAD,CAAnC,GAAmDA,WAAlE;EAEA,OAAO,IAAIY,sBAAJ,CAAUD,MAAV,CAAP;AACH,CAjBM"}
1
+ {"version":3,"names":["createTable","table","documentClient","tableConfig","name","process","env","DB_TABLE_HEADLESS_CMS","DB_TABLE","partitionKey","sortKey","DocumentClient","indexes","GSI1","config","Table"],"sources":["table.ts"],"sourcesContent":["import { TableModifier } from \"~/types\";\nimport { DocumentClient } from \"aws-sdk/clients/dynamodb\";\nimport { Table } from \"dynamodb-toolbox\";\nimport { TableConstructor } from \"dynamodb-toolbox/dist/classes/Table\";\n\ninterface Params {\n table?: TableModifier;\n documentClient: DocumentClient;\n}\nexport const createTable = ({ table, documentClient }: Params): Table => {\n const tableConfig: TableConstructor = {\n name: process.env.DB_TABLE_HEADLESS_CMS || (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 const config = typeof table === \"function\" ? table(tableConfig) : tableConfig;\n\n return new Table(config);\n};\n"],"mappings":";;;;;;AAEA;AAOO,MAAMA,WAAW,GAAG,CAAC;EAAEC,KAAK;EAAEC;AAAuB,CAAC,KAAY;EACrE,MAAMC,WAA6B,GAAG;IAClCC,IAAI,EAAEC,OAAO,CAACC,GAAG,CAACC,qBAAqB,IAAKF,OAAO,CAACC,GAAG,CAACE,QAAmB;IAC3EC,YAAY,EAAE,IAAI;IAClBC,OAAO,EAAE,IAAI;IACbC,cAAc,EAAET,cAAc;IAC9BU,OAAO,EAAE;MACLC,IAAI,EAAE;QACFJ,YAAY,EAAE,SAAS;QACvBC,OAAO,EAAE;MACb;IACJ;EACJ,CAAC;EAED,MAAMI,MAAM,GAAG,OAAOb,KAAK,KAAK,UAAU,GAAGA,KAAK,CAACE,WAAW,CAAC,GAAGA,WAAW;EAE7E,OAAO,IAAIY,sBAAK,CAACD,MAAM,CAAC;AAC5B,CAAC;AAAC"}
package/dynamoDb/index.js CHANGED
@@ -4,17 +4,10 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  var _richText = require("./storage/richText");
9
-
10
8
  var _longText = require("./storage/longText");
11
-
12
9
  var _date = require("./storage/date");
13
-
14
10
  var _plainObject = require("./path/plainObject");
15
-
16
11
  var _datetime = require("./transformValue/datetime");
17
-
18
12
  var _default = () => [(0, _richText.createRichTextStorageTransformPlugin)(), (0, _longText.createLongTextStorageTransformPlugin)(), (0, _date.createDateStorageTransformPlugin)(), (0, _plainObject.createPlainObjectPathPlugin)(), (0, _datetime.createDatetimeTransformValuePlugin)()];
19
-
20
13
  exports.default = _default;
@@ -1 +1 @@
1
- {"version":3,"names":["createRichTextStorageTransformPlugin","createLongTextStorageTransformPlugin","createDateStorageTransformPlugin","createPlainObjectPathPlugin","createDatetimeTransformValuePlugin"],"sources":["index.ts"],"sourcesContent":["import { createRichTextStorageTransformPlugin } from \"./storage/richText\";\nimport { createLongTextStorageTransformPlugin } from \"./storage/longText\";\nimport { createDateStorageTransformPlugin } from \"./storage/date\";\nimport { createPlainObjectPathPlugin } from \"./path/plainObject\";\nimport { createDatetimeTransformValuePlugin } from \"./transformValue/datetime\";\n\nexport default () => [\n createRichTextStorageTransformPlugin(),\n createLongTextStorageTransformPlugin(),\n createDateStorageTransformPlugin(),\n createPlainObjectPathPlugin(),\n createDatetimeTransformValuePlugin()\n];\n"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;eAEe,MAAM,CACjB,IAAAA,8CAAA,GADiB,EAEjB,IAAAC,8CAAA,GAFiB,EAGjB,IAAAC,sCAAA,GAHiB,EAIjB,IAAAC,wCAAA,GAJiB,EAKjB,IAAAC,4CAAA,GALiB,C"}
1
+ {"version":3,"names":["createRichTextStorageTransformPlugin","createLongTextStorageTransformPlugin","createDateStorageTransformPlugin","createPlainObjectPathPlugin","createDatetimeTransformValuePlugin"],"sources":["index.ts"],"sourcesContent":["import { createRichTextStorageTransformPlugin } from \"./storage/richText\";\nimport { createLongTextStorageTransformPlugin } from \"./storage/longText\";\nimport { createDateStorageTransformPlugin } from \"./storage/date\";\nimport { createPlainObjectPathPlugin } from \"./path/plainObject\";\nimport { createDatetimeTransformValuePlugin } from \"./transformValue/datetime\";\n\nexport default () => [\n createRichTextStorageTransformPlugin(),\n createLongTextStorageTransformPlugin(),\n createDateStorageTransformPlugin(),\n createPlainObjectPathPlugin(),\n createDatetimeTransformValuePlugin()\n];\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;AAA+E,eAEhE,MAAM,CACjB,IAAAA,8CAAoC,GAAE,EACtC,IAAAC,8CAAoC,GAAE,EACtC,IAAAC,sCAAgC,GAAE,EAClC,IAAAC,wCAA2B,GAAE,EAC7B,IAAAC,4CAAkC,GAAE,CACvC;AAAA"}
@@ -1,40 +1,33 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.createPlainObjectPathPlugin = void 0;
9
-
10
8
  var _error = _interopRequireDefault(require("@webiny/error"));
11
-
12
9
  var _CmsEntryFieldFilterPathPlugin = require("../../plugins/CmsEntryFieldFilterPathPlugin");
13
-
14
10
  /**
15
11
  * File is @internal
16
12
  */
13
+
17
14
  const createPath = ({
18
15
  field
19
16
  }) => {
20
17
  const {
21
18
  path
22
19
  } = field.settings || {};
23
-
24
20
  if (!path) {
25
21
  throw new _error.default("Missing path settings value.", "FIELD_SETTINGS_ERROR", {
26
22
  field
27
23
  });
28
24
  }
29
-
30
25
  return path;
31
26
  };
32
-
33
27
  const createPlainObjectPathPlugin = () => {
34
28
  return new _CmsEntryFieldFilterPathPlugin.CmsEntryFieldFilterPathPlugin({
35
29
  fieldType: "plainObject",
36
30
  path: createPath
37
31
  });
38
32
  };
39
-
40
33
  exports.createPlainObjectPathPlugin = createPlainObjectPathPlugin;
@@ -1 +1 @@
1
- {"version":3,"names":["createPath","field","path","settings","WebinyError","createPlainObjectPathPlugin","CmsEntryFieldFilterPathPlugin","fieldType"],"sources":["plainObject.ts"],"sourcesContent":["/**\n * File is @internal\n */\nimport WebinyError from \"@webiny/error\";\nimport {\n CmsEntryFieldFilterPathPlugin,\n CreatePathCallable\n} from \"~/plugins/CmsEntryFieldFilterPathPlugin\";\n\nconst createPath: CreatePathCallable = ({ field }) => {\n const { path } = field.settings || {};\n if (!path) {\n throw new WebinyError(\"Missing path settings value.\", \"FIELD_SETTINGS_ERROR\", {\n field\n });\n }\n return path;\n};\n\nexport const createPlainObjectPathPlugin = (): CmsEntryFieldFilterPathPlugin => {\n return new CmsEntryFieldFilterPathPlugin({\n fieldType: \"plainObject\",\n path: createPath\n });\n};\n"],"mappings":";;;;;;;;;AAGA;;AACA;;AAJA;AACA;AACA;AAOA,MAAMA,UAA8B,GAAG,CAAC;EAAEC;AAAF,CAAD,KAAe;EAClD,MAAM;IAAEC;EAAF,IAAWD,KAAK,CAACE,QAAN,IAAkB,EAAnC;;EACA,IAAI,CAACD,IAAL,EAAW;IACP,MAAM,IAAIE,cAAJ,CAAgB,8BAAhB,EAAgD,sBAAhD,EAAwE;MAC1EH;IAD0E,CAAxE,CAAN;EAGH;;EACD,OAAOC,IAAP;AACH,CARD;;AAUO,MAAMG,2BAA2B,GAAG,MAAqC;EAC5E,OAAO,IAAIC,4DAAJ,CAAkC;IACrCC,SAAS,EAAE,aAD0B;IAErCL,IAAI,EAAEF;EAF+B,CAAlC,CAAP;AAIH,CALM"}
1
+ {"version":3,"names":["createPath","field","path","settings","WebinyError","createPlainObjectPathPlugin","CmsEntryFieldFilterPathPlugin","fieldType"],"sources":["plainObject.ts"],"sourcesContent":["/**\n * File is @internal\n */\nimport WebinyError from \"@webiny/error\";\nimport {\n CmsEntryFieldFilterPathPlugin,\n CreatePathCallable\n} from \"~/plugins/CmsEntryFieldFilterPathPlugin\";\n\nconst createPath: CreatePathCallable = ({ field }) => {\n const { path } = field.settings || {};\n if (!path) {\n throw new WebinyError(\"Missing path settings value.\", \"FIELD_SETTINGS_ERROR\", {\n field\n });\n }\n return path;\n};\n\nexport const createPlainObjectPathPlugin = (): CmsEntryFieldFilterPathPlugin => {\n return new CmsEntryFieldFilterPathPlugin({\n fieldType: \"plainObject\",\n path: createPath\n });\n};\n"],"mappings":";;;;;;;AAGA;AACA;AAJA;AACA;AACA;;AAOA,MAAMA,UAA8B,GAAG,CAAC;EAAEC;AAAM,CAAC,KAAK;EAClD,MAAM;IAAEC;EAAK,CAAC,GAAGD,KAAK,CAACE,QAAQ,IAAI,CAAC,CAAC;EACrC,IAAI,CAACD,IAAI,EAAE;IACP,MAAM,IAAIE,cAAW,CAAC,8BAA8B,EAAE,sBAAsB,EAAE;MAC1EH;IACJ,CAAC,CAAC;EACN;EACA,OAAOC,IAAI;AACf,CAAC;AAEM,MAAMG,2BAA2B,GAAG,MAAqC;EAC5E,OAAO,IAAIC,4DAA6B,CAAC;IACrCC,SAAS,EAAE,aAAa;IACxBL,IAAI,EAAEF;EACV,CAAC,CAAC;AACN,CAAC;AAAC"}
@@ -1,60 +1,49 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.createDateStorageTransformPlugin = void 0;
9
-
10
8
  var _error = _interopRequireDefault(require("@webiny/error"));
11
-
12
9
  var _apiHeadlessCms = require("@webiny/api-headless-cms");
13
-
14
10
  /**
15
11
  * File is @internal
16
12
  */
17
- const excludeTypes = ["time", "dateTimeWithTimezone"];
18
13
 
14
+ const excludeTypes = ["time", "dateTimeWithTimezone"];
19
15
  const convertFromStorage = (field, value) => {
20
16
  try {
21
17
  if (field.multipleValues) {
22
18
  const result = [];
23
-
24
19
  for (const v of value) {
25
20
  if (!v) {
26
21
  continue;
27
22
  }
28
-
29
23
  try {
30
24
  result.push(new Date(v));
31
25
  } catch {}
32
26
  }
33
-
34
27
  return result;
35
28
  }
36
-
37
29
  return new Date(value);
38
30
  } catch {
39
31
  console.log(`Could not transform from storage for field type`);
40
32
  return value;
41
33
  }
42
34
  };
43
-
44
35
  const convertValueToStorage = (field, value) => {
45
36
  if (value.toISOString) {
46
37
  return value.toISOString();
47
38
  } else if (typeof value === "string") {
48
39
  return value;
49
40
  }
50
-
51
41
  throw new _error.default("Error converting value to a storage type.", "TO_STORAGE_ERROR", {
52
42
  value: value,
53
43
  fieldId: field.fieldId,
54
44
  storageId: field.storageId
55
45
  });
56
46
  };
57
-
58
47
  const createDateStorageTransformPlugin = () => {
59
48
  return new _apiHeadlessCms.StorageTransformPlugin({
60
49
  fieldType: "datetime",
@@ -65,11 +54,9 @@ const createDateStorageTransformPlugin = () => {
65
54
  const {
66
55
  type
67
56
  } = field.settings || {};
68
-
69
57
  if (!value || !type || excludeTypes.includes(type)) {
70
58
  return value;
71
59
  }
72
-
73
60
  return convertFromStorage(field, value);
74
61
  },
75
62
  toStorage: async ({
@@ -79,24 +66,20 @@ const createDateStorageTransformPlugin = () => {
79
66
  const {
80
67
  type
81
68
  } = field.settings || {};
82
-
83
69
  if (!value || !type || excludeTypes.includes(type)) {
84
70
  return value;
85
71
  }
86
-
87
72
  if (field.multipleValues) {
88
73
  const multipleValues = value;
89
74
  return (multipleValues || []).filter(v => !!v).map(v => {
90
75
  return convertValueToStorage(field, v);
91
76
  });
92
77
  }
93
-
94
78
  if (value.toISOString) {
95
79
  return value.toISOString();
96
80
  } else if (typeof value === "string") {
97
81
  return value;
98
82
  }
99
-
100
83
  throw new _error.default("Error converting value to a storage type.", "TO_STORAGE_ERROR", {
101
84
  value,
102
85
  fieldId: field.fieldId,
@@ -105,5 +88,4 @@ const createDateStorageTransformPlugin = () => {
105
88
  }
106
89
  });
107
90
  };
108
-
109
91
  exports.createDateStorageTransformPlugin = createDateStorageTransformPlugin;
@@ -1 +1 @@
1
- {"version":3,"names":["excludeTypes","convertFromStorage","field","value","multipleValues","result","v","push","Date","console","log","convertValueToStorage","toISOString","WebinyError","fieldId","storageId","createDateStorageTransformPlugin","StorageTransformPlugin","fieldType","fromStorage","type","settings","includes","toStorage","filter","map"],"sources":["date.ts"],"sourcesContent":["/**\n * File is @internal\n */\nimport WebinyError from \"@webiny/error\";\nimport { StorageTransformPlugin } from \"@webiny/api-headless-cms\";\nimport { CmsModelField } from \"@webiny/api-headless-cms/types\";\n\nconst excludeTypes = [\"time\", \"dateTimeWithTimezone\"];\n\nconst convertFromStorage = (\n field: Pick<CmsModelField, \"multipleValues\">,\n value: string | string[]\n) => {\n try {\n if (field.multipleValues) {\n const result: Date[] = [];\n for (const v of value) {\n if (!v) {\n continue;\n }\n try {\n result.push(new Date(v));\n } catch {}\n }\n return result;\n }\n return new Date(value as string);\n } catch {\n console.log(`Could not transform from storage for field type`);\n return value;\n }\n};\n\nconst convertValueToStorage = (field: CmsModelField, value: any): any => {\n if ((value as any).toISOString) {\n return (value as Date).toISOString();\n } else if (typeof value === \"string\") {\n return value as string;\n }\n throw new WebinyError(\"Error converting value to a storage type.\", \"TO_STORAGE_ERROR\", {\n value: value,\n fieldId: field.fieldId,\n storageId: field.storageId\n });\n};\n\nexport const createDateStorageTransformPlugin = () => {\n return new StorageTransformPlugin({\n fieldType: \"datetime\",\n fromStorage: async ({ value, field }) => {\n const { type } = field.settings || {};\n if (!value || !type || excludeTypes.includes(type)) {\n return value;\n }\n return convertFromStorage(field, value);\n },\n toStorage: async ({ value, field }) => {\n const { type } = field.settings || {};\n if (!value || !type || excludeTypes.includes(type)) {\n return value;\n }\n if (field.multipleValues) {\n const multipleValues = value as (string | Date | null | undefined)[];\n return (multipleValues || [])\n .filter(v => !!v)\n .map(v => {\n return convertValueToStorage(field, v);\n });\n }\n if ((value as any).toISOString) {\n return (value as Date).toISOString();\n } else if (typeof value === \"string\") {\n return value as string;\n }\n throw new WebinyError(\"Error converting value to a storage type.\", \"TO_STORAGE_ERROR\", {\n value,\n fieldId: field.fieldId,\n storageId: field.storageId\n });\n }\n });\n};\n"],"mappings":";;;;;;;;;AAGA;;AACA;;AAJA;AACA;AACA;AAKA,MAAMA,YAAY,GAAG,CAAC,MAAD,EAAS,sBAAT,CAArB;;AAEA,MAAMC,kBAAkB,GAAG,CACvBC,KADuB,EAEvBC,KAFuB,KAGtB;EACD,IAAI;IACA,IAAID,KAAK,CAACE,cAAV,EAA0B;MACtB,MAAMC,MAAc,GAAG,EAAvB;;MACA,KAAK,MAAMC,CAAX,IAAgBH,KAAhB,EAAuB;QACnB,IAAI,CAACG,CAAL,EAAQ;UACJ;QACH;;QACD,IAAI;UACAD,MAAM,CAACE,IAAP,CAAY,IAAIC,IAAJ,CAASF,CAAT,CAAZ;QACH,CAFD,CAEE,MAAM,CAAE;MACb;;MACD,OAAOD,MAAP;IACH;;IACD,OAAO,IAAIG,IAAJ,CAASL,KAAT,CAAP;EACH,CAdD,CAcE,MAAM;IACJM,OAAO,CAACC,GAAR,CAAa,iDAAb;IACA,OAAOP,KAAP;EACH;AACJ,CAtBD;;AAwBA,MAAMQ,qBAAqB,GAAG,CAACT,KAAD,EAAuBC,KAAvB,KAA2C;EACrE,IAAKA,KAAD,CAAeS,WAAnB,EAAgC;IAC5B,OAAQT,KAAD,CAAgBS,WAAhB,EAAP;EACH,CAFD,MAEO,IAAI,OAAOT,KAAP,KAAiB,QAArB,EAA+B;IAClC,OAAOA,KAAP;EACH;;EACD,MAAM,IAAIU,cAAJ,CAAgB,2CAAhB,EAA6D,kBAA7D,EAAiF;IACnFV,KAAK,EAAEA,KAD4E;IAEnFW,OAAO,EAAEZ,KAAK,CAACY,OAFoE;IAGnFC,SAAS,EAAEb,KAAK,CAACa;EAHkE,CAAjF,CAAN;AAKH,CAXD;;AAaO,MAAMC,gCAAgC,GAAG,MAAM;EAClD,OAAO,IAAIC,sCAAJ,CAA2B;IAC9BC,SAAS,EAAE,UADmB;IAE9BC,WAAW,EAAE,OAAO;MAAEhB,KAAF;MAASD;IAAT,CAAP,KAA4B;MACrC,MAAM;QAAEkB;MAAF,IAAWlB,KAAK,CAACmB,QAAN,IAAkB,EAAnC;;MACA,IAAI,CAAClB,KAAD,IAAU,CAACiB,IAAX,IAAmBpB,YAAY,CAACsB,QAAb,CAAsBF,IAAtB,CAAvB,EAAoD;QAChD,OAAOjB,KAAP;MACH;;MACD,OAAOF,kBAAkB,CAACC,KAAD,EAAQC,KAAR,CAAzB;IACH,CAR6B;IAS9BoB,SAAS,EAAE,OAAO;MAAEpB,KAAF;MAASD;IAAT,CAAP,KAA4B;MACnC,MAAM;QAAEkB;MAAF,IAAWlB,KAAK,CAACmB,QAAN,IAAkB,EAAnC;;MACA,IAAI,CAAClB,KAAD,IAAU,CAACiB,IAAX,IAAmBpB,YAAY,CAACsB,QAAb,CAAsBF,IAAtB,CAAvB,EAAoD;QAChD,OAAOjB,KAAP;MACH;;MACD,IAAID,KAAK,CAACE,cAAV,EAA0B;QACtB,MAAMA,cAAc,GAAGD,KAAvB;QACA,OAAO,CAACC,cAAc,IAAI,EAAnB,EACFoB,MADE,CACKlB,CAAC,IAAI,CAAC,CAACA,CADZ,EAEFmB,GAFE,CAEEnB,CAAC,IAAI;UACN,OAAOK,qBAAqB,CAACT,KAAD,EAAQI,CAAR,CAA5B;QACH,CAJE,CAAP;MAKH;;MACD,IAAKH,KAAD,CAAeS,WAAnB,EAAgC;QAC5B,OAAQT,KAAD,CAAgBS,WAAhB,EAAP;MACH,CAFD,MAEO,IAAI,OAAOT,KAAP,KAAiB,QAArB,EAA+B;QAClC,OAAOA,KAAP;MACH;;MACD,MAAM,IAAIU,cAAJ,CAAgB,2CAAhB,EAA6D,kBAA7D,EAAiF;QACnFV,KADmF;QAEnFW,OAAO,EAAEZ,KAAK,CAACY,OAFoE;QAGnFC,SAAS,EAAEb,KAAK,CAACa;MAHkE,CAAjF,CAAN;IAKH;EAhC6B,CAA3B,CAAP;AAkCH,CAnCM"}
1
+ {"version":3,"names":["excludeTypes","convertFromStorage","field","value","multipleValues","result","v","push","Date","console","log","convertValueToStorage","toISOString","WebinyError","fieldId","storageId","createDateStorageTransformPlugin","StorageTransformPlugin","fieldType","fromStorage","type","settings","includes","toStorage","filter","map"],"sources":["date.ts"],"sourcesContent":["/**\n * File is @internal\n */\nimport WebinyError from \"@webiny/error\";\nimport { StorageTransformPlugin } from \"@webiny/api-headless-cms\";\nimport { CmsModelField } from \"@webiny/api-headless-cms/types\";\n\nconst excludeTypes = [\"time\", \"dateTimeWithTimezone\"];\n\nconst convertFromStorage = (\n field: Pick<CmsModelField, \"multipleValues\">,\n value: string | string[]\n) => {\n try {\n if (field.multipleValues) {\n const result: Date[] = [];\n for (const v of value) {\n if (!v) {\n continue;\n }\n try {\n result.push(new Date(v));\n } catch {}\n }\n return result;\n }\n return new Date(value as string);\n } catch {\n console.log(`Could not transform from storage for field type`);\n return value;\n }\n};\n\nconst convertValueToStorage = (field: CmsModelField, value: any): any => {\n if ((value as any).toISOString) {\n return (value as Date).toISOString();\n } else if (typeof value === \"string\") {\n return value as string;\n }\n throw new WebinyError(\"Error converting value to a storage type.\", \"TO_STORAGE_ERROR\", {\n value: value,\n fieldId: field.fieldId,\n storageId: field.storageId\n });\n};\n\nexport const createDateStorageTransformPlugin = () => {\n return new StorageTransformPlugin({\n fieldType: \"datetime\",\n fromStorage: async ({ value, field }) => {\n const { type } = field.settings || {};\n if (!value || !type || excludeTypes.includes(type)) {\n return value;\n }\n return convertFromStorage(field, value);\n },\n toStorage: async ({ value, field }) => {\n const { type } = field.settings || {};\n if (!value || !type || excludeTypes.includes(type)) {\n return value;\n }\n if (field.multipleValues) {\n const multipleValues = value as (string | Date | null | undefined)[];\n return (multipleValues || [])\n .filter(v => !!v)\n .map(v => {\n return convertValueToStorage(field, v);\n });\n }\n if ((value as any).toISOString) {\n return (value as Date).toISOString();\n } else if (typeof value === \"string\") {\n return value as string;\n }\n throw new WebinyError(\"Error converting value to a storage type.\", \"TO_STORAGE_ERROR\", {\n value,\n fieldId: field.fieldId,\n storageId: field.storageId\n });\n }\n });\n};\n"],"mappings":"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"}
@@ -1,33 +1,26 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.createLongTextStorageTransformPlugin = void 0;
9
-
10
8
  var _error = _interopRequireDefault(require("@webiny/error"));
11
-
12
9
  var _gzip = require("@webiny/utils/compression/gzip");
13
-
14
10
  var _apiHeadlessCms = require("@webiny/api-headless-cms");
15
-
16
11
  /**
17
12
  * File is @internal
18
13
  */
14
+
19
15
  const GZIP = "gzip";
20
16
  const TO_STORAGE_ENCODING = "base64";
21
17
  const FROM_STORAGE_ENCODING = "utf8";
22
-
23
18
  const convertToBuffer = value => {
24
19
  if (typeof value === "string") {
25
20
  return Buffer.from(value, TO_STORAGE_ENCODING);
26
21
  }
27
-
28
22
  return value;
29
23
  };
30
-
31
24
  const createLongTextStorageTransformPlugin = () => {
32
25
  return new _apiHeadlessCms.StorageTransformPlugin({
33
26
  fieldType: "long-text",
@@ -36,13 +29,11 @@ const createLongTextStorageTransformPlugin = () => {
36
29
  value: storageValue
37
30
  }) => {
38
31
  const typeOf = typeof storageValue;
39
-
40
32
  if (!storageValue || typeOf === "string" || typeOf === "number" || Array.isArray(storageValue) === true) {
41
33
  return storageValue;
42
34
  } else if (typeOf !== "object") {
43
35
  throw new _error.default(`LongText value received in "fromStorage" function is not an object in field "${field.storageId}" - ${field.fieldId}.`);
44
36
  }
45
-
46
37
  const {
47
38
  compression,
48
39
  value,
@@ -51,7 +42,6 @@ const createLongTextStorageTransformPlugin = () => {
51
42
  /**
52
43
  * Check if possibly undefined, null, empty...
53
44
  */
54
-
55
45
  if (!compression) {
56
46
  throw new _error.default(`Missing compression in "fromStorage" function in field "${field.storageId}" - ${field.fieldId}.": ${JSON.stringify(storageValue)}.`, "MISSING_COMPRESSION", {
57
47
  value: storageValue
@@ -61,15 +51,12 @@ const createLongTextStorageTransformPlugin = () => {
61
51
  compression
62
52
  });
63
53
  }
64
-
65
54
  try {
66
55
  const buf = await (0, _gzip.decompress)(convertToBuffer(value));
67
56
  const result = buf.toString(FROM_STORAGE_ENCODING);
68
-
69
57
  if (!isArray) {
70
58
  return result;
71
59
  }
72
-
73
60
  return JSON.parse(result);
74
61
  } catch (ex) {
75
62
  console.log("Error while transforming long-text.");
@@ -86,7 +73,6 @@ const createLongTextStorageTransformPlugin = () => {
86
73
  if (initialValue && initialValue.hasOwnProperty("compression") === true) {
87
74
  return initialValue;
88
75
  }
89
-
90
76
  const isArray = Array.isArray(initialValue);
91
77
  const value = isArray ? JSON.stringify(initialValue) : initialValue;
92
78
  const compressedValue = await (0, _gzip.compress)(value);
@@ -94,15 +80,12 @@ const createLongTextStorageTransformPlugin = () => {
94
80
  compression: GZIP,
95
81
  value: compressedValue.toString(TO_STORAGE_ENCODING)
96
82
  };
97
-
98
83
  if (!isArray) {
99
84
  return result;
100
85
  }
101
-
102
86
  result.isArray = isArray;
103
87
  return result;
104
88
  }
105
89
  });
106
90
  };
107
-
108
91
  exports.createLongTextStorageTransformPlugin = createLongTextStorageTransformPlugin;