@webiny/api-headless-cms-ddb 0.0.0-unstable.de38392959 → 0.0.0-unstable.e0bfc55d5a

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 (112) hide show
  1. package/definitions/entry.d.ts +3 -2
  2. package/definitions/entry.js +42 -0
  3. package/definitions/entry.js.map +1 -1
  4. package/definitions/group.d.ts +3 -2
  5. package/definitions/group.js.map +1 -1
  6. package/definitions/model.d.ts +3 -2
  7. package/definitions/model.js.map +1 -1
  8. package/definitions/system.d.ts +3 -2
  9. package/definitions/system.js.map +1 -1
  10. package/definitions/table.d.ts +3 -3
  11. package/definitions/table.js.map +1 -1
  12. package/dynamoDb/index.js +1 -2
  13. package/dynamoDb/index.js.map +1 -1
  14. package/dynamoDb/path/locationFolderId.js.map +1 -1
  15. package/dynamoDb/path/plainObject.js.map +1 -1
  16. package/dynamoDb/storage/longText.js +1 -0
  17. package/dynamoDb/storage/longText.js.map +1 -1
  18. package/dynamoDb/storage/richText.js +21 -56
  19. package/dynamoDb/storage/richText.js.map +1 -1
  20. package/dynamoDb/transformValue/datetime.d.ts +1 -1
  21. package/dynamoDb/transformValue/datetime.js.map +1 -1
  22. package/index.d.ts +1 -1
  23. package/index.js +2 -1
  24. package/index.js.map +1 -1
  25. package/operations/entry/dataLoader/DataLoaderCache.d.ts +1 -1
  26. package/operations/entry/dataLoader/DataLoaderCache.js.map +1 -1
  27. package/operations/entry/dataLoader/constants.js +1 -2
  28. package/operations/entry/dataLoader/constants.js.map +1 -1
  29. package/operations/entry/dataLoader/createBatchScheduleFn.js.map +1 -1
  30. package/operations/entry/dataLoader/getAllEntryRevisions.d.ts +2 -2
  31. package/operations/entry/dataLoader/getAllEntryRevisions.js.map +1 -1
  32. package/operations/entry/dataLoader/getLatestRevisionByEntryId.d.ts +2 -2
  33. package/operations/entry/dataLoader/getLatestRevisionByEntryId.js +2 -2
  34. package/operations/entry/dataLoader/getLatestRevisionByEntryId.js.map +1 -1
  35. package/operations/entry/dataLoader/getPublishedRevisionByEntryId.d.ts +2 -2
  36. package/operations/entry/dataLoader/getPublishedRevisionByEntryId.js +2 -2
  37. package/operations/entry/dataLoader/getPublishedRevisionByEntryId.js.map +1 -1
  38. package/operations/entry/dataLoader/getRevisionById.d.ts +2 -2
  39. package/operations/entry/dataLoader/getRevisionById.js +2 -2
  40. package/operations/entry/dataLoader/getRevisionById.js.map +1 -1
  41. package/operations/entry/dataLoader/index.d.ts +3 -3
  42. package/operations/entry/dataLoader/index.js.map +1 -1
  43. package/operations/entry/dataLoader/types.d.ts +1 -1
  44. package/operations/entry/dataLoader/types.js.map +1 -1
  45. package/operations/entry/dataLoaders.d.ts +3 -3
  46. package/operations/entry/dataLoaders.js.map +1 -1
  47. package/operations/entry/filtering/createExpressions.d.ts +4 -4
  48. package/operations/entry/filtering/createExpressions.js.map +1 -1
  49. package/operations/entry/filtering/createFields.d.ts +3 -3
  50. package/operations/entry/filtering/createFields.js.map +1 -1
  51. package/operations/entry/filtering/extractSort.d.ts +3 -3
  52. package/operations/entry/filtering/extractSort.js.map +1 -1
  53. package/operations/entry/filtering/filter.d.ts +3 -3
  54. package/operations/entry/filtering/filter.js.map +1 -1
  55. package/operations/entry/filtering/fullTextSearch.d.ts +3 -3
  56. package/operations/entry/filtering/fullTextSearch.js.map +1 -1
  57. package/operations/entry/filtering/getValue.js.map +1 -1
  58. package/operations/entry/filtering/index.js.map +1 -1
  59. package/operations/entry/filtering/mapPlugins.d.ts +2 -2
  60. package/operations/entry/filtering/mapPlugins.js.map +1 -1
  61. package/operations/entry/filtering/plugins/defaultFilterCreate.d.ts +1 -1
  62. package/operations/entry/filtering/plugins/defaultFilterCreate.js.map +1 -1
  63. package/operations/entry/filtering/plugins/index.d.ts +1 -1
  64. package/operations/entry/filtering/plugins/index.js +2 -1
  65. package/operations/entry/filtering/plugins/index.js.map +1 -1
  66. package/operations/entry/filtering/plugins/objectFilterCreate.d.ts +1 -1
  67. package/operations/entry/filtering/plugins/objectFilterCreate.js.map +1 -1
  68. package/operations/entry/filtering/plugins/refFilterCreate.d.ts +2 -1
  69. package/operations/entry/filtering/plugins/refFilterCreate.js +6 -1
  70. package/operations/entry/filtering/plugins/refFilterCreate.js.map +1 -1
  71. package/operations/entry/filtering/plugins/searchableJsonFilterCreate.d.ts +2 -0
  72. package/operations/entry/filtering/plugins/searchableJsonFilterCreate.js +65 -0
  73. package/operations/entry/filtering/plugins/searchableJsonFilterCreate.js.map +1 -0
  74. package/operations/entry/filtering/sort.d.ts +3 -3
  75. package/operations/entry/filtering/sort.js +2 -2
  76. package/operations/entry/filtering/sort.js.map +1 -1
  77. package/operations/entry/filtering/systemFields.d.ts +2 -2
  78. package/operations/entry/filtering/systemFields.js +6 -0
  79. package/operations/entry/filtering/systemFields.js.map +1 -1
  80. package/operations/entry/filtering/transform.d.ts +1 -1
  81. package/operations/entry/filtering/transform.js.map +1 -1
  82. package/operations/entry/filtering/types.d.ts +2 -2
  83. package/operations/entry/filtering/types.js.map +1 -1
  84. package/operations/entry/filtering/values.d.ts +1 -1
  85. package/operations/entry/filtering/values.js.map +1 -1
  86. package/operations/entry/filtering/where.js.map +1 -1
  87. package/operations/entry/index.d.ts +3 -3
  88. package/operations/entry/index.js +438 -238
  89. package/operations/entry/index.js.map +1 -1
  90. package/operations/entry/keys.js.map +1 -1
  91. package/operations/group/index.d.ts +3 -3
  92. package/operations/group/index.js.map +1 -1
  93. package/operations/model/index.d.ts +2 -2
  94. package/operations/model/index.js.map +1 -1
  95. package/operations/system/index.d.ts +2 -2
  96. package/operations/system/index.js.map +1 -1
  97. package/package.json +19 -23
  98. package/plugins/CmsEntryFieldFilterPathPlugin.d.ts +1 -1
  99. package/plugins/CmsEntryFieldFilterPathPlugin.js.map +1 -1
  100. package/plugins/CmsEntryFieldFilterPlugin.d.ts +10 -10
  101. package/plugins/CmsEntryFieldFilterPlugin.js.map +1 -1
  102. package/plugins/CmsEntryFieldSortingPlugin.d.ts +2 -2
  103. package/plugins/CmsEntryFieldSortingPlugin.js.map +1 -1
  104. package/plugins/CmsFieldFilterValueTransformPlugin.d.ts +2 -2
  105. package/plugins/CmsFieldFilterValueTransformPlugin.js.map +1 -1
  106. package/plugins/index.js.map +1 -1
  107. package/types.d.ts +8 -8
  108. package/types.js +1 -2
  109. package/types.js.map +1 -1
  110. package/dynamoDb/storage/date.d.ts +0 -3
  111. package/dynamoDb/storage/date.js +0 -84
  112. package/dynamoDb/storage/date.js.map +0 -1
@@ -1,5 +1,6 @@
1
- import { Entity, Table } from "@webiny/db-dynamodb/toolbox";
2
- import { Attributes } from "../types";
1
+ import type { Table } from "@webiny/db-dynamodb/toolbox";
2
+ import { Entity } from "@webiny/db-dynamodb/toolbox";
3
+ import type { Attributes } from "../types";
3
4
  interface Params {
4
5
  table: Table<string, string, string>;
5
6
  entityName: string;
@@ -65,6 +65,12 @@ const createEntryEntity = params => {
65
65
  revisionSavedOn: {
66
66
  type: "string"
67
67
  },
68
+ revisionDeletedOn: {
69
+ type: "string"
70
+ },
71
+ revisionRestoredOn: {
72
+ type: "string"
73
+ },
68
74
  revisionFirstPublishedOn: {
69
75
  type: "string"
70
76
  },
@@ -80,6 +86,12 @@ const createEntryEntity = params => {
80
86
  revisionSavedBy: {
81
87
  type: "map"
82
88
  },
89
+ revisionDeletedBy: {
90
+ type: "map"
91
+ },
92
+ revisionRestoredBy: {
93
+ type: "map"
94
+ },
83
95
  revisionFirstPublishedBy: {
84
96
  type: "map"
85
97
  },
@@ -98,6 +110,12 @@ const createEntryEntity = params => {
98
110
  savedOn: {
99
111
  type: "string"
100
112
  },
113
+ deletedOn: {
114
+ type: "string"
115
+ },
116
+ restoredOn: {
117
+ type: "string"
118
+ },
101
119
  firstPublishedOn: {
102
120
  type: "string"
103
121
  },
@@ -113,12 +131,30 @@ const createEntryEntity = params => {
113
131
  savedBy: {
114
132
  type: "map"
115
133
  },
134
+ deletedBy: {
135
+ type: "map"
136
+ },
137
+ restoredBy: {
138
+ type: "map"
139
+ },
116
140
  firstPublishedBy: {
117
141
  type: "map"
118
142
  },
119
143
  lastPublishedBy: {
120
144
  type: "map"
121
145
  },
146
+ /**
147
+ * Deprecated fields. 👇
148
+ */
149
+ ownedBy: {
150
+ type: "map"
151
+ },
152
+ publishedOn: {
153
+ type: "string"
154
+ },
155
+ /**
156
+ * The rest. 👇
157
+ */
122
158
  version: {
123
159
  type: "number"
124
160
  },
@@ -131,6 +167,12 @@ const createEntryEntity = params => {
131
167
  location: {
132
168
  type: "map"
133
169
  },
170
+ wbyDeleted: {
171
+ type: "boolean"
172
+ },
173
+ binOriginalFolderId: {
174
+ type: "string"
175
+ },
134
176
  values: {
135
177
  type: "map"
136
178
  },
@@ -1 +1 @@
1
- {"version":3,"names":["_toolbox","require","createEntryEntity","params","table","entityName","attributes","Entity","name","PK","type","partitionKey","SK","sortKey","GSI1_PK","GSI1_SK","TYPE","__type","webinyVersion","tenant","entryId","id","modelId","locale","revisionCreatedOn","revisionModifiedOn","revisionSavedOn","revisionFirstPublishedOn","revisionLastPublishedOn","revisionCreatedBy","revisionModifiedBy","revisionSavedBy","revisionFirstPublishedBy","revisionLastPublishedBy","createdOn","modifiedOn","savedOn","firstPublishedOn","lastPublishedOn","createdBy","modifiedBy","savedBy","firstPublishedBy","lastPublishedBy","version","locked","status","location","values","meta","exports"],"sources":["entry.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 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 modelId: {\n type: \"string\"\n },\n locale: {\n type: \"string\"\n },\n\n /**\n * Revision-level meta fields. 👇\n */\n revisionCreatedOn: { type: \"string\" },\n revisionModifiedOn: { type: \"string\" },\n revisionSavedOn: { type: \"string\" },\n revisionFirstPublishedOn: { type: \"string\" },\n revisionLastPublishedOn: { type: \"string\" },\n revisionCreatedBy: { type: \"map\" },\n revisionModifiedBy: { type: \"map\" },\n revisionSavedBy: { type: \"map\" },\n revisionFirstPublishedBy: { type: \"map\" },\n revisionLastPublishedBy: { type: \"map\" },\n\n /**\n * Entry-level meta fields. 👇\n */\n createdOn: { type: \"string\" },\n modifiedOn: { type: \"string\" },\n savedOn: { type: \"string\" },\n firstPublishedOn: { type: \"string\" },\n lastPublishedOn: { type: \"string\" },\n createdBy: { type: \"map\" },\n modifiedBy: { type: \"map\" },\n savedBy: { type: \"map\" },\n firstPublishedBy: { type: \"map\" },\n lastPublishedBy: { type: \"map\" },\n\n version: {\n type: \"number\"\n },\n locked: {\n type: \"boolean\"\n },\n status: {\n type: \"string\"\n },\n location: {\n type: \"map\"\n },\n values: {\n type: \"map\"\n },\n meta: {\n type: \"map\"\n },\n ...(attributes || {})\n }\n });\n};\n"],"mappings":";;;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AASO,MAAMC,iBAAiB,GAAIC,MAAc,IAAkB;EAC9D,MAAM;IAAEC,KAAK;IAAEC,UAAU;IAAEC;EAAW,CAAC,GAAGH,MAAM;EAChD,OAAO,IAAII,eAAM,CAAC;IACdC,IAAI,EAAEH,UAAU;IAChBD,KAAK;IACLE,UAAU,EAAE;MACRG,EAAE,EAAE;QACAC,IAAI,EAAE,QAAQ;QACdC,YAAY,EAAE;MAClB,CAAC;MACDC,EAAE,EAAE;QACAF,IAAI,EAAE,QAAQ;QACdG,OAAO,EAAE;MACb,CAAC;MACDC,OAAO,EAAE;QACL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AS,CAAC;MACpC4B,eAAe,EAAE;QAAE5B,IAAI,EAAE;MAAS,CAAC;MACnC6B,SAAS,EAAE;QAAE7B,IAAI,EAAE;MAAM,CAAC;MAC1B8B,UAAU,EAAE;QAAE9B,IAAI,EAAE;MAAM,CAAC;MAC3B+B,OAAO,EAAE;QAAE/B,IAAI,EAAE;MAAM,CAAC;MACxBgC,gBAAgB,EAAE;QAAEhC,IAAI,EAAE;MAAM,CAAC;MACjCiC,eAAe,EAAE;QAAEjC,IAAI,EAAE;MAAM,CAAC;MAEhCkC,OAAO,EAAE;QACLlC,IAAI,EAAE;MACV,CAAC;MACDmC,MAAM,EAAE;QACJnC,IAAI,EAAE;MACV,CAAC;MACDoC,MAAM,EAAE;QACJpC,IAAI,EAAE;MACV,CAAC;MACDqC,QAAQ,EAAE;QACNrC,IAAI,EAAE;MACV,CAAC;MACDsC,MAAM,EAAE;QACJtC,IAAI,EAAE;MACV,CAAC;MACDuC,IAAI,EAAE;QACFvC,IAAI,EAAE;MACV,CAAC;MACD,IAAIJ,UAAU,IAAI,CAAC,CAAC;IACxB;EACJ,CAAC,CAAC;AACN,CAAC;AAAC4C,OAAA,CAAAhD,iBAAA,GAAAA,iBAAA"}
1
+ {"version":3,"names":["_toolbox","require","createEntryEntity","params","table","entityName","attributes","Entity","name","PK","type","partitionKey","SK","sortKey","GSI1_PK","GSI1_SK","TYPE","__type","webinyVersion","tenant","entryId","id","modelId","locale","revisionCreatedOn","revisionModifiedOn","revisionSavedOn","revisionDeletedOn","revisionRestoredOn","revisionFirstPublishedOn","revisionLastPublishedOn","revisionCreatedBy","revisionModifiedBy","revisionSavedBy","revisionDeletedBy","revisionRestoredBy","revisionFirstPublishedBy","revisionLastPublishedBy","createdOn","modifiedOn","savedOn","deletedOn","restoredOn","firstPublishedOn","lastPublishedOn","createdBy","modifiedBy","savedBy","deletedBy","restoredBy","firstPublishedBy","lastPublishedBy","ownedBy","publishedOn","version","locked","status","location","wbyDeleted","binOriginalFolderId","values","meta","exports"],"sources":["entry.ts"],"sourcesContent":["import type { Table } from \"@webiny/db-dynamodb/toolbox\";\nimport { Entity } from \"@webiny/db-dynamodb/toolbox\";\nimport type { Attributes } from \"~/types\";\n\ninterface Params {\n table: Table<string, string, string>;\n entityName: string;\n attributes: Attributes;\n}\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 modelId: {\n type: \"string\"\n },\n locale: {\n type: \"string\"\n },\n\n /**\n * Revision-level meta fields. 👇\n */\n revisionCreatedOn: { type: \"string\" },\n revisionModifiedOn: { type: \"string\" },\n revisionSavedOn: { type: \"string\" },\n revisionDeletedOn: { type: \"string\" },\n revisionRestoredOn: { type: \"string\" },\n revisionFirstPublishedOn: { type: \"string\" },\n revisionLastPublishedOn: { type: \"string\" },\n revisionCreatedBy: { type: \"map\" },\n revisionModifiedBy: { type: \"map\" },\n revisionSavedBy: { type: \"map\" },\n revisionDeletedBy: { type: \"map\" },\n revisionRestoredBy: { type: \"map\" },\n revisionFirstPublishedBy: { type: \"map\" },\n revisionLastPublishedBy: { type: \"map\" },\n\n /**\n * Entry-level meta fields. 👇\n */\n createdOn: { type: \"string\" },\n modifiedOn: { type: \"string\" },\n savedOn: { type: \"string\" },\n deletedOn: { type: \"string\" },\n restoredOn: { type: \"string\" },\n firstPublishedOn: { type: \"string\" },\n lastPublishedOn: { type: \"string\" },\n createdBy: { type: \"map\" },\n modifiedBy: { type: \"map\" },\n savedBy: { type: \"map\" },\n deletedBy: { type: \"map\" },\n restoredBy: { type: \"map\" },\n firstPublishedBy: { type: \"map\" },\n lastPublishedBy: { type: \"map\" },\n\n /**\n * Deprecated fields. 👇\n */\n ownedBy: {\n type: \"map\"\n },\n publishedOn: {\n type: \"string\"\n },\n\n /**\n * The rest. 👇\n */\n version: {\n type: \"number\"\n },\n locked: {\n type: \"boolean\"\n },\n status: {\n type: \"string\"\n },\n location: {\n type: \"map\"\n },\n wbyDeleted: {\n type: \"boolean\"\n },\n binOriginalFolderId: {\n type: \"string\"\n },\n values: {\n type: \"map\"\n },\n meta: {\n type: \"map\"\n },\n ...(attributes || {})\n }\n });\n};\n"],"mappings":";;;;;;AACA,IAAAA,QAAA,GAAAC,OAAA;AASO,MAAMC,iBAAiB,GAAIC,MAAc,IAAkB;EAC9D,MAAM;IAAEC,KAAK;IAAEC,UAAU;IAAEC;EAAW,CAAC,GAAGH,MAAM;EAChD,OAAO,IAAII,eAAM,CAAC;IACdC,IAAI,EAAEH,UAAU;IAChBD,KAAK;IACLE,UAAU,EAAE;MACRG,EAAE,EAAE;QACAC,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,OAAO,EAAE;QACLZ,IAAI,EAAE;MACV,CAAC;MACDa,MAAM,EAAE;QACJb,IAAI,EAAE;MAC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;MAC1BoC,UAAU,EAAE;QAAEpC,IAAI,EAAE;MAAM,CAAC;MAC3BqC,OAAO,EAAE;QAAErC,IAAI,EAAE;MAAM,CAAC;MACxBsC,SAAS,EAAE;QAAEtC,IAAI,EAAE;MAAM,CAAC;MAC1BuC,UAAU,EAAE;QAAEvC,IAAI,EAAE;MAAM,CAAC;MAC3BwC,gBAAgB,EAAE;QAAExC,IAAI,EAAE;MAAM,CAAC;MACjCyC,eAAe,EAAE;QAAEzC,IAAI,EAAE;MAAM,CAAC;MAEhC;AACZ;AACA;MACY0C,OAAO,EAAE;QACL1C,IAAI,EAAE;MACV,CAAC;MACD2C,WAAW,EAAE;QACT3C,IAAI,EAAE;MACV,CAAC;MAED;AACZ;AACA;MACY4C,OAAO,EAAE;QACL5C,IAAI,EAAE;MACV,CAAC;MACD6C,MAAM,EAAE;QACJ7C,IAAI,EAAE;MACV,CAAC;MACD8C,MAAM,EAAE;QACJ9C,IAAI,EAAE;MACV,CAAC;MACD+C,QAAQ,EAAE;QACN/C,IAAI,EAAE;MACV,CAAC;MACDgD,UAAU,EAAE;QACRhD,IAAI,EAAE;MACV,CAAC;MACDiD,mBAAmB,EAAE;QACjBjD,IAAI,EAAE;MACV,CAAC;MACDkD,MAAM,EAAE;QACJlD,IAAI,EAAE;MACV,CAAC;MACDmD,IAAI,EAAE;QACFnD,IAAI,EAAE;MACV,CAAC;MACD,IAAIJ,UAAU,IAAI,CAAC,CAAC;IACxB;EACJ,CAAC,CAAC;AACN,CAAC;AAACwD,OAAA,CAAA5D,iBAAA,GAAAA,iBAAA","ignoreList":[]}
@@ -1,5 +1,6 @@
1
- import { Entity, Table } from "@webiny/db-dynamodb/toolbox";
2
- import { Attributes } from "../types";
1
+ import type { Table } from "@webiny/db-dynamodb/toolbox";
2
+ import { Entity } from "@webiny/db-dynamodb/toolbox";
3
+ import type { Attributes } from "../types";
3
4
  interface Params {
4
5
  table: Table<string, string, string>;
5
6
  entityName: string;
@@ -1 +1 @@
1
- {"version":3,"names":["_toolbox","require","createGroupEntity","params","table","attributes","entityName","Entity","name","PK","partitionKey","SK","sortKey","TYPE","type","webinyVersion","id","slug","locale","description","icon","createdBy","createdOn","savedOn","tenant","exports"],"sources":["group.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}\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,IAAAA,QAAA,GAAAC,OAAA;AAQO,MAAMC,iBAAiB,GAAIC,MAAc,IAAkB;EAC9D,MAAM;IAAEC,KAAK;IAAEC,UAAU;IAAEC;EAAW,CAAC,GAAGH,MAAM;EAChD,OAAO,IAAII,eAAM,CAAC;IACdC,IAAI,EAAEF,UAAU;IAChBF,KAAK;IACLC,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,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,CAAC;MACD,IAAIT,UAAU,IAAI,CAAC,CAAC;IACxB;EACJ,CAAC,CAAC;AACN,CAAC;AAACoB,OAAA,CAAAvB,iBAAA,GAAAA,iBAAA"}
1
+ {"version":3,"names":["_toolbox","require","createGroupEntity","params","table","attributes","entityName","Entity","name","PK","partitionKey","SK","sortKey","TYPE","type","webinyVersion","id","slug","locale","description","icon","createdBy","createdOn","savedOn","tenant","exports"],"sources":["group.ts"],"sourcesContent":["import type { Table } from \"@webiny/db-dynamodb/toolbox\";\nimport { Entity } from \"@webiny/db-dynamodb/toolbox\";\nimport type { Attributes } from \"~/types\";\n\ninterface Params {\n table: Table<string, string, string>;\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":";;;;;;AACA,IAAAA,QAAA,GAAAC,OAAA;AAQO,MAAMC,iBAAiB,GAAIC,MAAc,IAAkB;EAC9D,MAAM;IAAEC,KAAK;IAAEC,UAAU;IAAEC;EAAW,CAAC,GAAGH,MAAM;EAChD,OAAO,IAAII,eAAM,CAAC;IACdC,IAAI,EAAEF,UAAU;IAChBF,KAAK;IACLC,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,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,CAAC;MACD,IAAIT,UAAU,IAAI,CAAC,CAAC;IACxB;EACJ,CAAC,CAAC;AACN,CAAC;AAACoB,OAAA,CAAAvB,iBAAA,GAAAA,iBAAA","ignoreList":[]}
@@ -1,5 +1,6 @@
1
- import { Entity, Table } from "@webiny/db-dynamodb/toolbox";
2
- import { Attributes } from "../types";
1
+ import type { Table } from "@webiny/db-dynamodb/toolbox";
2
+ import { Entity } from "@webiny/db-dynamodb/toolbox";
3
+ import type { Attributes } from "../types";
3
4
  interface Params {
4
5
  table: Table<string, string, string>;
5
6
  entityName: string;
@@ -1 +1 @@
1
- {"version":3,"names":["_toolbox","require","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","exports"],"sources":["model.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 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,IAAAA,QAAA,GAAAC,OAAA;AASO,MAAMC,iBAAiB,GAAIC,MAAc,IAAkB;EAC9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M,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,CAAC;MACD,IAAIV,UAAU,IAAI,CAAC,CAAC;IACxB;EACJ,CAAC,CAAC;AACN,CAAC;AAAC+B,OAAA,CAAAlC,iBAAA,GAAAA,iBAAA"}
1
+ {"version":3,"names":["_toolbox","require","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","exports"],"sources":["model.ts"],"sourcesContent":["import type { Table } from \"@webiny/db-dynamodb/toolbox\";\nimport { Entity } from \"@webiny/db-dynamodb/toolbox\";\nimport type { Attributes } from \"~/types\";\n\ninterface Params {\n table: Table<string, string, string>;\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":";;;;;;AACA,IAAAA,QAAA,GAAAC,OAAA;AASO,MAAMC,iBAAiB,GAAIC,MAAc,IAAkB;EAC9D,MAAM;IAAEC,KAAK;IAAEC,UAAU;IAAEC;EAAW,CAAC,GAAGH,MAAM;EAChD,OAAO,IAAII,eAAM,CAAC;IACdC,IAAI,EAAEF,UAAU;IAChBF,KAAK;IACLC,UAAU,EAAE;MACRI,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,CAAC;MACD,IAAIV,UAAU,IAAI,CAAC,CAAC;IACxB;EACJ,CAAC,CAAC;AACN,CAAC;AAAC+B,OAAA,CAAAlC,iBAAA,GAAAA,iBAAA","ignoreList":[]}
@@ -1,5 +1,6 @@
1
- import { Entity, Table } from "@webiny/db-dynamodb/toolbox";
2
- import { Attributes } from "../types";
1
+ import type { Table } from "@webiny/db-dynamodb/toolbox";
2
+ import { Entity } from "@webiny/db-dynamodb/toolbox";
3
+ import type { Attributes } from "../types";
3
4
  interface Params {
4
5
  table: Table<string, string, string>;
5
6
  entityName: string;
@@ -1 +1 @@
1
- {"version":3,"names":["_toolbox","require","createSystemEntity","params","entityName","attributes","table","Entity","name","PK","partitionKey","SK","sortKey","version","type","locale","tenant","readAPIKey","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 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,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;MACDE,MAAM,EAAE;QACJF,IAAI,EAAE;MACV,CAAC;MACDG,UAAU,EAAE;QACRH,IAAI,EAAE;MACV,CAAC;MACD,IAAIT,UAAU,IAAI,CAAC,CAAC;IACxB;EACJ,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","locale","tenant","readAPIKey","exports"],"sources":["system.ts"],"sourcesContent":["import type { Table } from \"@webiny/db-dynamodb/toolbox\";\nimport { Entity } from \"@webiny/db-dynamodb/toolbox\";\nimport type { 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 locale: {\n type: \"string\"\n },\n tenant: {\n type: \"string\"\n },\n readAPIKey: {\n type: \"string\"\n },\n ...(attributes || {})\n }\n });\n};\n"],"mappings":";;;;;;AACA,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;MACDE,MAAM,EAAE;QACJF,IAAI,EAAE;MACV,CAAC;MACDG,UAAU,EAAE;QACRH,IAAI,EAAE;MACV,CAAC;MACD,IAAIT,UAAU,IAAI,CAAC,CAAC;IACxB;EACJ,CAAC,CAAC;AACN,CAAC;AAACa,OAAA,CAAAhB,kBAAA,GAAAA,kBAAA","ignoreList":[]}
@@ -1,9 +1,9 @@
1
- import { TableModifier } from "../types";
2
- import { DynamoDBClient } from "@webiny/aws-sdk/client-dynamodb";
1
+ import type { TableModifier } from "../types";
2
+ import type { DynamoDBDocument } from "@webiny/aws-sdk/client-dynamodb";
3
3
  import { Table } from "@webiny/db-dynamodb/toolbox";
4
4
  interface Params {
5
5
  table?: TableModifier;
6
- documentClient: DynamoDBClient;
6
+ documentClient: DynamoDBDocument;
7
7
  }
8
8
  export declare const createTable: ({ table, documentClient }: Params) => Table<string, string, string>;
9
9
  export {};
@@ -1 +1 @@
1
- {"version":3,"names":["_toolbox","require","createTable","table","documentClient","tableConfig","name","process","env","DB_TABLE_HEADLESS_CMS","DB_TABLE","partitionKey","sortKey","DocumentClient","indexes","GSI1","autoExecute","autoParse","config","Table","exports"],"sources":["table.ts"],"sourcesContent":["import { TableModifier } from \"~/types\";\nimport { DynamoDBClient } from \"@webiny/aws-sdk/client-dynamodb\";\nimport { Table } from \"@webiny/db-dynamodb/toolbox\";\nimport { TableConstructor } from \"@webiny/db-dynamodb/toolbox\";\n\ninterface Params {\n table?: TableModifier;\n documentClient: DynamoDBClient;\n}\nexport const createTable = ({ table, documentClient }: Params): Table<string, string, string> => {\n const tableConfig: TableConstructor<string, string, string> = {\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 autoExecute: true,\n autoParse: true\n };\n\n const config = typeof table === \"function\" ? table(tableConfig) : tableConfig;\n\n return new Table(config);\n};\n"],"mappings":";;;;;;AAEA,IAAAA,QAAA,GAAAC,OAAA;AAOO,MAAMC,WAAW,GAAGA,CAAC;EAAEC,KAAK;EAAEC;AAAuB,CAAC,KAAoC;EAC7F,MAAMC,WAAqD,GAAG;IAC1DC,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,CAAC;IACDI,WAAW,EAAE,IAAI;IACjBC,SAAS,EAAE;EACf,CAAC;EAED,MAAMC,MAAM,GAAG,OAAOf,KAAK,KAAK,UAAU,GAAGA,KAAK,CAACE,WAAW,CAAC,GAAGA,WAAW;EAE7E,OAAO,IAAIc,cAAK,CAACD,MAAM,CAAC;AAC5B,CAAC;AAACE,OAAA,CAAAlB,WAAA,GAAAA,WAAA"}
1
+ {"version":3,"names":["_toolbox","require","createTable","table","documentClient","tableConfig","name","process","env","DB_TABLE_HEADLESS_CMS","DB_TABLE","partitionKey","sortKey","DocumentClient","indexes","GSI1","autoExecute","autoParse","config","Table","exports"],"sources":["table.ts"],"sourcesContent":["import type { TableModifier } from \"~/types\";\nimport type { DynamoDBDocument } from \"@webiny/aws-sdk/client-dynamodb\";\nimport { Table } from \"@webiny/db-dynamodb/toolbox\";\nimport type { TableConstructor } from \"@webiny/db-dynamodb/toolbox\";\n\ninterface Params {\n table?: TableModifier;\n documentClient: DynamoDBDocument;\n}\nexport const createTable = ({ table, documentClient }: Params): Table<string, string, string> => {\n const tableConfig: TableConstructor<string, string, string> = {\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 autoExecute: true,\n autoParse: true\n };\n\n const config = typeof table === \"function\" ? table(tableConfig) : tableConfig;\n\n return new Table(config);\n};\n"],"mappings":";;;;;;AAEA,IAAAA,QAAA,GAAAC,OAAA;AAOO,MAAMC,WAAW,GAAGA,CAAC;EAAEC,KAAK;EAAEC;AAAuB,CAAC,KAAoC;EAC7F,MAAMC,WAAqD,GAAG;IAC1DC,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,CAAC;IACDI,WAAW,EAAE,IAAI;IACjBC,SAAS,EAAE;EACf,CAAC;EAED,MAAMC,MAAM,GAAG,OAAOf,KAAK,KAAK,UAAU,GAAGA,KAAK,CAACE,WAAW,CAAC,GAAGA,WAAW;EAE7E,OAAO,IAAIc,cAAK,CAACD,MAAM,CAAC;AAC5B,CAAC;AAACE,OAAA,CAAAlB,WAAA,GAAAA,WAAA","ignoreList":[]}
package/dynamoDb/index.js CHANGED
@@ -6,11 +6,10 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.default = void 0;
7
7
  var _richText = require("./storage/richText");
8
8
  var _longText = require("./storage/longText");
9
- var _date = require("./storage/date");
10
9
  var _plainObject = require("./path/plainObject");
11
10
  var _datetime = require("./transformValue/datetime");
12
11
  var _locationFolderId = require("./path/locationFolderId");
13
- var _default = () => [(0, _richText.createRichTextStorageTransformPlugin)(), (0, _longText.createLongTextStorageTransformPlugin)(), (0, _date.createDateStorageTransformPlugin)(), (0, _plainObject.createPlainObjectPathPlugin)(), (0, _locationFolderId.createLocationFolderIdPathPlugin)(), (0, _datetime.createDatetimeTransformValuePlugin)()];
12
+ var _default = () => [(0, _richText.createRichTextStorageTransformPlugin)(), (0, _longText.createLongTextStorageTransformPlugin)(), (0, _plainObject.createPlainObjectPathPlugin)(), (0, _locationFolderId.createLocationFolderIdPathPlugin)(), (0, _datetime.createDatetimeTransformValuePlugin)()];
14
13
  exports.default = _default;
15
14
 
16
15
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_richText","require","_longText","_date","_plainObject","_datetime","_locationFolderId","_default","createRichTextStorageTransformPlugin","createLongTextStorageTransformPlugin","createDateStorageTransformPlugin","createPlainObjectPathPlugin","createLocationFolderIdPathPlugin","createDatetimeTransformValuePlugin","exports","default"],"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\";\nimport { createLocationFolderIdPathPlugin } from \"~/dynamoDb/path/locationFolderId\";\n\nexport default () => [\n createRichTextStorageTransformPlugin(),\n createLongTextStorageTransformPlugin(),\n createDateStorageTransformPlugin(),\n createPlainObjectPathPlugin(),\n createLocationFolderIdPathPlugin(),\n createDatetimeTransformValuePlugin()\n];\n"],"mappings":";;;;;;AAAA,IAAAA,SAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,KAAA,GAAAF,OAAA;AACA,IAAAG,YAAA,GAAAH,OAAA;AACA,IAAAI,SAAA,GAAAJ,OAAA;AACA,IAAAK,iBAAA,GAAAL,OAAA;AAAoF,IAAAM,QAAA,GAErEA,CAAA,KAAM,CACjB,IAAAC,8CAAoC,EAAC,CAAC,EACtC,IAAAC,8CAAoC,EAAC,CAAC,EACtC,IAAAC,sCAAgC,EAAC,CAAC,EAClC,IAAAC,wCAA2B,EAAC,CAAC,EAC7B,IAAAC,kDAAgC,EAAC,CAAC,EAClC,IAAAC,4CAAkC,EAAC,CAAC,CACvC;AAAAC,OAAA,CAAAC,OAAA,GAAAR,QAAA"}
1
+ {"version":3,"names":["_richText","require","_longText","_plainObject","_datetime","_locationFolderId","_default","createRichTextStorageTransformPlugin","createLongTextStorageTransformPlugin","createPlainObjectPathPlugin","createLocationFolderIdPathPlugin","createDatetimeTransformValuePlugin","exports","default"],"sources":["index.ts"],"sourcesContent":["import { createRichTextStorageTransformPlugin } from \"./storage/richText\";\nimport { createLongTextStorageTransformPlugin } from \"./storage/longText\";\nimport { createPlainObjectPathPlugin } from \"./path/plainObject\";\nimport { createDatetimeTransformValuePlugin } from \"./transformValue/datetime\";\nimport { createLocationFolderIdPathPlugin } from \"~/dynamoDb/path/locationFolderId\";\n\nexport default () => [\n createRichTextStorageTransformPlugin(),\n createLongTextStorageTransformPlugin(),\n createPlainObjectPathPlugin(),\n createLocationFolderIdPathPlugin(),\n createDatetimeTransformValuePlugin()\n];\n"],"mappings":";;;;;;AAAA,IAAAA,SAAA,GAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AACA,IAAAE,YAAA,GAAAF,OAAA;AACA,IAAAG,SAAA,GAAAH,OAAA;AACA,IAAAI,iBAAA,GAAAJ,OAAA;AAAoF,IAAAK,QAAA,GAErEA,CAAA,KAAM,CACjB,IAAAC,8CAAoC,EAAC,CAAC,EACtC,IAAAC,8CAAoC,EAAC,CAAC,EACtC,IAAAC,wCAA2B,EAAC,CAAC,EAC7B,IAAAC,kDAAgC,EAAC,CAAC,EAClC,IAAAC,4CAAkC,EAAC,CAAC,CACvC;AAAAC,OAAA,CAAAC,OAAA,GAAAP,QAAA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["_error","_interopRequireDefault","require","_CmsEntryFieldFilterPathPlugin","createPath","field","path","settings","WebinyError","createLocationFolderIdPathPlugin","CmsEntryFieldFilterPathPlugin","fieldType","canUse","parents","fieldId","length","exports"],"sources":["locationFolderId.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 createLocationFolderIdPathPlugin = (): CmsEntryFieldFilterPathPlugin => {\n return new CmsEntryFieldFilterPathPlugin({\n fieldType: \"text\",\n path: createPath,\n canUse: (field, parents) => {\n if (field.fieldId !== \"folderId\") {\n return false;\n } else if (!parents?.length) {\n return false;\n }\n return parents[0] === \"wbyAco_location\";\n }\n });\n};\n"],"mappings":";;;;;;;AAGA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,8BAAA,GAAAD,OAAA;AAJA;AACA;AACA;;AAOA,MAAME,UAA8B,GAAGA,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,gCAAgC,GAAGA,CAAA,KAAqC;EACjF,OAAO,IAAIC,4DAA6B,CAAC;IACrCC,SAAS,EAAE,MAAM;IACjBL,IAAI,EAAEF,UAAU;IAChBQ,MAAM,EAAEA,CAACP,KAAK,EAAEQ,OAAO,KAAK;MACxB,IAAIR,KAAK,CAACS,OAAO,KAAK,UAAU,EAAE;QAC9B,OAAO,KAAK;MAChB,CAAC,MAAM,IAAI,CAACD,OAAO,EAAEE,MAAM,EAAE;QACzB,OAAO,KAAK;MAChB;MACA,OAAOF,OAAO,CAAC,CAAC,CAAC,KAAK,iBAAiB;IAC3C;EACJ,CAAC,CAAC;AACN,CAAC;AAACG,OAAA,CAAAP,gCAAA,GAAAA,gCAAA"}
1
+ {"version":3,"names":["_error","_interopRequireDefault","require","_CmsEntryFieldFilterPathPlugin","createPath","field","path","settings","WebinyError","createLocationFolderIdPathPlugin","CmsEntryFieldFilterPathPlugin","fieldType","canUse","parents","fieldId","length","exports"],"sources":["locationFolderId.ts"],"sourcesContent":["/**\n * File is @internal\n */\nimport WebinyError from \"@webiny/error\";\nimport type { CreatePathCallable } from \"~/plugins/CmsEntryFieldFilterPathPlugin\";\nimport { CmsEntryFieldFilterPathPlugin } 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 createLocationFolderIdPathPlugin = (): CmsEntryFieldFilterPathPlugin => {\n return new CmsEntryFieldFilterPathPlugin({\n fieldType: \"text\",\n path: createPath,\n canUse: (field, parents) => {\n if (field.fieldId !== \"folderId\") {\n return false;\n } else if (!parents?.length) {\n return false;\n }\n return parents[0] === \"wbyAco_location\";\n }\n });\n};\n"],"mappings":";;;;;;;AAGA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,8BAAA,GAAAD,OAAA;AALA;AACA;AACA;;AAKA,MAAME,UAA8B,GAAGA,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,gCAAgC,GAAGA,CAAA,KAAqC;EACjF,OAAO,IAAIC,4DAA6B,CAAC;IACrCC,SAAS,EAAE,MAAM;IACjBL,IAAI,EAAEF,UAAU;IAChBQ,MAAM,EAAEA,CAACP,KAAK,EAAEQ,OAAO,KAAK;MACxB,IAAIR,KAAK,CAACS,OAAO,KAAK,UAAU,EAAE;QAC9B,OAAO,KAAK;MAChB,CAAC,MAAM,IAAI,CAACD,OAAO,EAAEE,MAAM,EAAE;QACzB,OAAO,KAAK;MAChB;MACA,OAAOF,OAAO,CAAC,CAAC,CAAC,KAAK,iBAAiB;IAC3C;EACJ,CAAC,CAAC;AACN,CAAC;AAACG,OAAA,CAAAP,gCAAA,GAAAA,gCAAA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["_error","_interopRequireDefault","require","_CmsEntryFieldFilterPathPlugin","createPath","field","path","settings","WebinyError","createPlainObjectPathPlugin","CmsEntryFieldFilterPathPlugin","fieldType","exports"],"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,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,8BAAA,GAAAD,OAAA;AAJA;AACA;AACA;;AAOA,MAAME,UAA8B,GAAGA,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,GAAGA,CAAA,KAAqC;EAC5E,OAAO,IAAIC,4DAA6B,CAAC;IACrCC,SAAS,EAAE,aAAa;IACxBL,IAAI,EAAEF;EACV,CAAC,CAAC;AACN,CAAC;AAACQ,OAAA,CAAAH,2BAAA,GAAAA,2BAAA"}
1
+ {"version":3,"names":["_error","_interopRequireDefault","require","_CmsEntryFieldFilterPathPlugin","createPath","field","path","settings","WebinyError","createPlainObjectPathPlugin","CmsEntryFieldFilterPathPlugin","fieldType","exports"],"sources":["plainObject.ts"],"sourcesContent":["/**\n * File is @internal\n */\nimport WebinyError from \"@webiny/error\";\nimport type { CreatePathCallable } from \"~/plugins/CmsEntryFieldFilterPathPlugin\";\nimport { CmsEntryFieldFilterPathPlugin } 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,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,8BAAA,GAAAD,OAAA;AALA;AACA;AACA;;AAKA,MAAME,UAA8B,GAAGA,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,GAAGA,CAAA,KAAqC;EAC5E,OAAO,IAAIC,4DAA6B,CAAC;IACrCC,SAAS,EAAE,aAAa;IACxBL,IAAI,EAAEF;EACV,CAAC,CAAC;AACN,CAAC;AAACQ,OAAA,CAAAH,2BAAA,GAAAA,2BAAA","ignoreList":[]}
@@ -23,6 +23,7 @@ const convertToBuffer = value => {
23
23
  };
24
24
  const createLongTextStorageTransformPlugin = () => {
25
25
  return new _apiHeadlessCms.StorageTransformPlugin({
26
+ name: "headless-cms.storage-transform.long-text.default",
26
27
  fieldType: "long-text",
27
28
  fromStorage: async ({
28
29
  field,
@@ -1 +1 @@
1
- {"version":3,"names":["_error","_interopRequireDefault","require","_gzip","_apiHeadlessCms","GZIP","TO_STORAGE_ENCODING","FROM_STORAGE_ENCODING","convertToBuffer","value","Buffer","from","createLongTextStorageTransformPlugin","StorageTransformPlugin","fieldType","fromStorage","field","storageValue","typeOf","Array","isArray","WebinyError","storageId","fieldId","compression","JSON","stringify","buf","ungzip","result","toString","parse","ex","console","log","message","toStorage","initialValue","hasOwnProperty","compressedValue","gzip","exports"],"sources":["longText.ts"],"sourcesContent":["/**\n * File is @internal\n */\n\nimport WebinyError from \"@webiny/error\";\nimport { compress as gzip, decompress as ungzip } from \"@webiny/utils/compression/gzip\";\nimport { StorageTransformPlugin } from \"@webiny/api-headless-cms\";\n\nconst GZIP = \"gzip\";\nconst TO_STORAGE_ENCODING = \"base64\";\nconst FROM_STORAGE_ENCODING = \"utf8\";\n\nconst convertToBuffer = (value: string | Buffer): Buffer => {\n if (typeof value === \"string\") {\n return Buffer.from(value, TO_STORAGE_ENCODING);\n }\n return value;\n};\n\nexport interface StorageValue {\n compression: string;\n value: string;\n isArray?: boolean;\n}\n\nexport const createLongTextStorageTransformPlugin = () => {\n return new StorageTransformPlugin<string | string[], StorageValue>({\n fieldType: \"long-text\",\n fromStorage: async ({ field, value: storageValue }) => {\n const typeOf = typeof storageValue;\n if (\n !storageValue ||\n typeOf === \"string\" ||\n typeOf === \"number\" ||\n Array.isArray(storageValue) === true\n ) {\n return storageValue as unknown as string | string[];\n } else if (typeOf !== \"object\") {\n throw new WebinyError(\n `LongText value received in \"fromStorage\" function is not an object in field \"${field.storageId}\" - ${field.fieldId}.`\n );\n }\n const { compression, value, isArray } = storageValue;\n /**\n * Check if possibly undefined, null, empty...\n */\n if (!compression) {\n throw new WebinyError(\n `Missing compression in \"fromStorage\" function in field \"${\n field.storageId\n }\" - ${field.fieldId}.\": ${JSON.stringify(storageValue)}.`,\n \"MISSING_COMPRESSION\",\n {\n value: storageValue\n }\n );\n } else if (compression !== GZIP) {\n throw new WebinyError(\n `This plugin cannot transform something not compressed with \"GZIP\".`,\n \"WRONG_COMPRESSION\",\n {\n compression\n }\n );\n }\n try {\n const buf = await ungzip(convertToBuffer(value));\n const result = buf.toString(FROM_STORAGE_ENCODING);\n if (!isArray) {\n return result;\n }\n return JSON.parse(result);\n } catch (ex) {\n console.log(\"Error while transforming long-text.\");\n console.log(ex.message);\n return \"\";\n }\n },\n toStorage: async ({ value: initialValue }) => {\n /**\n * There is a possibility that we are trying to compress already compressed value.\n */\n if (initialValue && initialValue.hasOwnProperty(\"compression\") === true) {\n return initialValue as unknown as StorageValue;\n }\n const isArray = Array.isArray(initialValue);\n const value = isArray ? JSON.stringify(initialValue) : initialValue;\n const compressedValue = await gzip(value);\n\n const result: StorageValue = {\n compression: GZIP,\n value: compressedValue.toString(TO_STORAGE_ENCODING)\n };\n if (!isArray) {\n return result;\n }\n result.isArray = isArray;\n return result;\n }\n });\n};\n"],"mappings":";;;;;;;AAIA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,eAAA,GAAAF,OAAA;AANA;AACA;AACA;;AAMA,MAAMG,IAAI,GAAG,MAAM;AACnB,MAAMC,mBAAmB,GAAG,QAAQ;AACpC,MAAMC,qBAAqB,GAAG,MAAM;AAEpC,MAAMC,eAAe,GAAIC,KAAsB,IAAa;EACxD,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE;IAC3B,OAAOC,MAAM,CAACC,IAAI,CAACF,KAAK,EAAEH,mBAAmB,CAAC;EAClD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OAAOJ,IAAI,CAACM,KAAK,CAACF,MAAM,CAAC;MAC7B,CAAC,CAAC,OAAOG,EAAE,EAAE;QACTC,OAAO,CAACC,GAAG,CAAC,qCAAqC,CAAC;QAClDD,OAAO,CAACC,GAAG,CAACF,EAAE,CAACG,OAAO,CAAC;QACvB,OAAO,EAAE;MACb;IACJ,CAAC;IACDC,SAAS,EAAE,MAAAA,CAAO;MAAE3B,KAAK,EAAE4B;IAAa,CAAC,KAAK;MAC1C;AACZ;AACA;MACY,IAAIA,YAAY,IAAIA,YAAY,CAACC,cAAc,CAAC,aAAa,CAAC,KAAK,IAAI,EAAE;QACrE,OAAOD,YAAY;MACvB;MACA,MAAMjB,OAAO,GAAGD,KAAK,CAACC,OAAO,CAACiB,YAAY,CAAC;MAC3C,MAAM5B,KAAK,GAAGW,OAAO,GAAGK,IAAI,CAACC,SAAS,CAACW,YAAY,CAAC,GAAGA,YAAY;MACnE,MAAME,eAAe,GAAG,MAAM,IAAAC,cAAI,EAAC/B,KAAK,CAAC;MAEzC,MAAMoB,MAAoB,GAAG;QACzBL,WAAW,EAAEnB,IAAI;QACjBI,KAAK,EAAE8B,eAAe,CAACT,QAAQ,CAACxB,mBAAmB;MACvD,CAAC;MACD,IAAI,CAACc,OAAO,EAAE;QACV,OAAOS,MAAM;MACjB;MACAA,MAAM,CAACT,OAAO,GAAGA,OAAO;MACxB,OAAOS,MAAM;IACjB;EACJ,CAAC,CAAC;AACN,CAAC;AAACY,OAAA,CAAA7B,oCAAA,GAAAA,oCAAA"}
1
+ {"version":3,"names":["_error","_interopRequireDefault","require","_gzip","_apiHeadlessCms","GZIP","TO_STORAGE_ENCODING","FROM_STORAGE_ENCODING","convertToBuffer","value","Buffer","from","createLongTextStorageTransformPlugin","StorageTransformPlugin","name","fieldType","fromStorage","field","storageValue","typeOf","Array","isArray","WebinyError","storageId","fieldId","compression","JSON","stringify","buf","ungzip","result","toString","parse","ex","console","log","message","toStorage","initialValue","hasOwnProperty","compressedValue","gzip","exports"],"sources":["longText.ts"],"sourcesContent":["/**\n * File is @internal\n */\n\nimport WebinyError from \"@webiny/error\";\nimport { compress as gzip, decompress as ungzip } from \"@webiny/utils/compression/gzip\";\nimport { StorageTransformPlugin } from \"@webiny/api-headless-cms\";\n\nconst GZIP = \"gzip\";\nconst TO_STORAGE_ENCODING = \"base64\";\nconst FROM_STORAGE_ENCODING = \"utf8\";\n\nconst convertToBuffer = (value: string | Buffer): Buffer => {\n if (typeof value === \"string\") {\n return Buffer.from(value, TO_STORAGE_ENCODING);\n }\n return value;\n};\n\nexport interface StorageValue {\n compression: string;\n value: string;\n isArray?: boolean;\n}\n\nexport const createLongTextStorageTransformPlugin = () => {\n return new StorageTransformPlugin<string | string[], StorageValue>({\n name: \"headless-cms.storage-transform.long-text.default\",\n fieldType: \"long-text\",\n fromStorage: async ({ field, value: storageValue }) => {\n const typeOf = typeof storageValue;\n if (\n !storageValue ||\n typeOf === \"string\" ||\n typeOf === \"number\" ||\n Array.isArray(storageValue) === true\n ) {\n return storageValue as unknown as string | string[];\n } else if (typeOf !== \"object\") {\n throw new WebinyError(\n `LongText value received in \"fromStorage\" function is not an object in field \"${field.storageId}\" - ${field.fieldId}.`\n );\n }\n const { compression, value, isArray } = storageValue;\n /**\n * Check if possibly undefined, null, empty...\n */\n if (!compression) {\n throw new WebinyError(\n `Missing compression in \"fromStorage\" function in field \"${\n field.storageId\n }\" - ${field.fieldId}.\": ${JSON.stringify(storageValue)}.`,\n \"MISSING_COMPRESSION\",\n {\n value: storageValue\n }\n );\n } else if (compression !== GZIP) {\n throw new WebinyError(\n `This plugin cannot transform something not compressed with \"GZIP\".`,\n \"WRONG_COMPRESSION\",\n {\n compression\n }\n );\n }\n try {\n const buf = await ungzip(convertToBuffer(value));\n const result = buf.toString(FROM_STORAGE_ENCODING);\n if (!isArray) {\n return result;\n }\n return JSON.parse(result);\n } catch (ex) {\n console.log(\"Error while transforming long-text.\");\n console.log(ex.message);\n return \"\";\n }\n },\n toStorage: async ({ value: initialValue }) => {\n /**\n * There is a possibility that we are trying to compress already compressed value.\n */\n if (initialValue && initialValue.hasOwnProperty(\"compression\") === true) {\n return initialValue as unknown as StorageValue;\n }\n const isArray = Array.isArray(initialValue);\n const value = isArray ? JSON.stringify(initialValue) : initialValue;\n const compressedValue = await gzip(value);\n\n const result: StorageValue = {\n compression: GZIP,\n value: compressedValue.toString(TO_STORAGE_ENCODING)\n };\n if (!isArray) {\n return result;\n }\n result.isArray = isArray;\n return result;\n }\n });\n};\n"],"mappings":";;;;;;;AAIA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AACA,IAAAE,eAAA,GAAAF,OAAA;AANA;AACA;AACA;;AAMA,MAAMG,IAAI,GAAG,MAAM;AACnB,MAAMC,mBAAmB,GAAG,QAAQ;AACpC,MAAMC,qBAAqB,GAAG,MAAM;AAEpC,MAAMC,eAAe,GAAIC,KAAsB,IAAa;EACxD,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE;IAC3B,OAAOC,MAAM,CAACC,IAAI,CAACF,KAAK,EAAEH,mBAAmB,CAAC;EAClD;EACA,OAAOG,KAAK;AAChB,CAAC;AAQM,MAAMG,oCAAoC,GAAGA,CAAA,KAAM;EACtD,OAAO,IAAIC,sCAAsB,CAAkC;IAC/DC,IAAI,EAAE,kDAAkD;IACxDC,SAAS,EAAE,WAAW;IACtBC,WAAW,EAAE,MAAAA,CAAO;MAAEC,KAAK;MAAER,KAAK,EAAES;IAAa,CAAC,KAAK;MACnD,MAAMC,MAAM,GAAG,OAAOD,YAAY;MAClC,IACI,CAACA,YAAY,IACbC,MAAM,KAAK,QAAQ,IACnBA,MAAM,KAAK,QAAQ,IACnBC,KAAK,CAACC,OAAO,CAACH,YAAY,CAAC,KAAK,IAAI,EACtC;QACE,OAAOA,YAAY;MACvB,CAAC,MAAM,IAAIC,MAAM,KAAK,QAAQ,EAAE;QAC5B,MAAM,IAAIG,cAAW,CACjB,gFA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GY,OAAO,GAAGK,IAAI,CAACC,SAAS,CAACW,YAAY,CAAC,GAAGA,YAAY;MACnE,MAAME,eAAe,GAAG,MAAM,IAAAC,cAAI,EAAChC,KAAK,CAAC;MAEzC,MAAMqB,MAAoB,GAAG;QACzBL,WAAW,EAAEpB,IAAI;QACjBI,KAAK,EAAE+B,eAAe,CAACT,QAAQ,CAACzB,mBAAmB;MACvD,CAAC;MACD,IAAI,CAACe,OAAO,EAAE;QACV,OAAOS,MAAM;MACjB;MACAA,MAAM,CAACT,OAAO,GAAGA,OAAO;MACxB,OAAOS,MAAM;IACjB;EACJ,CAAC,CAAC;AACN,CAAC;AAACY,OAAA,CAAA9B,oCAAA,GAAAA,oCAAA","ignoreList":[]}
@@ -5,89 +5,54 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.createRichTextStorageTransformPlugin = void 0;
8
- var _jsonpack = _interopRequireDefault(require("jsonpack"));
9
8
  var _error = _interopRequireDefault(require("@webiny/error"));
10
9
  var _apiHeadlessCms = require("@webiny/api-headless-cms");
10
+ var _api = require("@webiny/api");
11
11
  /**
12
12
  * File is @internal
13
13
  */
14
14
 
15
- /**
16
- * Remove when jsonpack gets PR with a fix merged
17
- * https://github.com/rgcl/jsonpack/pull/25/files
18
- * NOTE 2021-07-28: it seems PR is not going to be merged so keep this.
19
- */ // TODO @ts-refactor figure better type
20
- const transformArray = value => {
21
- if (!value) {
22
- return value;
23
- }
24
- let isArray = Array.isArray(value);
25
- const shouldBeArray = value instanceof Array === false && isArray;
26
- if (shouldBeArray) {
27
- value = Array.from(value);
28
- isArray = true;
29
- }
30
- if (typeof value === "object" || isArray) {
31
- for (const k in value) {
32
- value[k] = transformArray(value[k]);
33
- }
34
- }
35
- return value;
36
- };
37
15
  const createRichTextStorageTransformPlugin = () => {
38
16
  return new _apiHeadlessCms.StorageTransformPlugin({
17
+ name: "headless-cms.storage-transform.rich-text.default",
39
18
  fieldType: "rich-text",
40
19
  fromStorage: async ({
41
20
  field,
42
- value: storageValue
21
+ value: storageValue,
22
+ plugins
43
23
  }) => {
44
24
  if (!storageValue) {
45
25
  return storageValue;
46
26
  } else if (typeof storageValue !== "object") {
47
27
  throw new _error.default(`RichText value received in "fromStorage" function is not an object in field "${field.storageId}" - ${field.fieldId}.`);
48
28
  }
49
- /**
50
- * This is to circumvent a bug introduced with 5.8.0 storage operations.
51
- * Do not remove.
52
- */
53
- if (storageValue.hasOwnProperty("compression") === false) {
29
+ let compressor;
30
+ try {
31
+ compressor = plugins.oneByType(_api.CompressorPlugin.type);
32
+ } catch (ex) {
54
33
  return storageValue;
55
34
  }
56
- const {
57
- compression,
58
- value
59
- } = storageValue;
60
- if (!compression) {
61
- throw new _error.default(`Missing compression in "fromStorage" function in field "${field.fieldId}": ${JSON.stringify(storageValue)}.`, "MISSING_COMPRESSION", {
62
- value: storageValue
63
- });
64
- }
65
- if (compression !== "jsonpack") {
66
- throw new _error.default(`This plugin cannot transform something not packed with "jsonpack".`, "WRONG_COMPRESSION", {
67
- compression
68
- });
69
- }
70
35
  try {
71
- return _jsonpack.default.unpack(value);
36
+ return await compressor.getCompressor().decompress(storageValue);
72
37
  } catch {
73
- return null;
38
+ return storageValue;
74
39
  }
75
40
  },
76
41
  toStorage: async ({
77
- value
42
+ value,
43
+ plugins
78
44
  }) => {
79
- /**
80
- * There is a possibility that we are trying to compress already compressed value.
81
- * Introduced a bug with 5.8.0 storage operations, so just return the value to correct it.
82
- */
83
- if (value && value.hasOwnProperty("compression") === true) {
45
+ let compressor;
46
+ try {
47
+ compressor = plugins.oneByType(_api.CompressorPlugin.type);
48
+ } catch (ex) {
49
+ return value;
50
+ }
51
+ try {
52
+ return await compressor.getCompressor().compress(value);
53
+ } catch {
84
54
  return value;
85
55
  }
86
- value = transformArray(value);
87
- return {
88
- compression: "jsonpack",
89
- value: value ? _jsonpack.default.pack(value) : value
90
- };
91
56
  }
92
57
  });
93
58
  };
@@ -1 +1 @@
1
- {"version":3,"names":["_jsonpack","_interopRequireDefault","require","_error","_apiHeadlessCms","transformArray","value","isArray","Array","shouldBeArray","from","k","createRichTextStorageTransformPlugin","StorageTransformPlugin","fieldType","fromStorage","field","storageValue","WebinyError","storageId","fieldId","hasOwnProperty","compression","JSON","stringify","jsonpack","unpack","toStorage","pack","exports"],"sources":["richText.ts"],"sourcesContent":["/**\n * File is @internal\n */\nimport jsonpack from \"jsonpack\";\nimport WebinyError from \"@webiny/error\";\nimport { StorageTransformPlugin } from \"@webiny/api-headless-cms\";\n\n/**\n * Remove when jsonpack gets PR with a fix merged\n * https://github.com/rgcl/jsonpack/pull/25/files\n * NOTE 2021-07-28: it seems PR is not going to be merged so keep this.\n */\n// TODO @ts-refactor figure better type\nconst transformArray = (value: any) => {\n if (!value) {\n return value;\n }\n let isArray = Array.isArray(value);\n const shouldBeArray = value instanceof Array === false && isArray;\n if (shouldBeArray) {\n value = Array.from(value);\n isArray = true;\n }\n if (typeof value === \"object\" || isArray) {\n for (const k in value) {\n value[k] = transformArray(value[k]);\n }\n }\n return value;\n};\n\nexport const createRichTextStorageTransformPlugin = () => {\n return new StorageTransformPlugin({\n fieldType: \"rich-text\",\n fromStorage: async ({ field, value: storageValue }) => {\n if (!storageValue) {\n return storageValue;\n } else if (typeof storageValue !== \"object\") {\n throw new WebinyError(\n `RichText value received in \"fromStorage\" function is not an object in field \"${field.storageId}\" - ${field.fieldId}.`\n );\n }\n /**\n * This is to circumvent a bug introduced with 5.8.0 storage operations.\n * Do not remove.\n */\n if (storageValue.hasOwnProperty(\"compression\") === false) {\n return storageValue;\n }\n const { compression, value } = storageValue;\n if (!compression) {\n throw new WebinyError(\n `Missing compression in \"fromStorage\" function in field \"${\n field.fieldId\n }\": ${JSON.stringify(storageValue)}.`,\n \"MISSING_COMPRESSION\",\n {\n value: storageValue\n }\n );\n }\n if (compression !== \"jsonpack\") {\n throw new WebinyError(\n `This plugin cannot transform something not packed with \"jsonpack\".`,\n \"WRONG_COMPRESSION\",\n {\n compression\n }\n );\n }\n try {\n return jsonpack.unpack(value);\n } catch {\n return null;\n }\n },\n toStorage: async ({ value }) => {\n /**\n * There is a possibility that we are trying to compress already compressed value.\n * Introduced a bug with 5.8.0 storage operations, so just return the value to correct it.\n */\n if (value && value.hasOwnProperty(\"compression\") === true) {\n return value;\n }\n value = transformArray(value);\n return {\n compression: \"jsonpack\",\n value: value ? jsonpack.pack(value) : value\n };\n }\n });\n};\n"],"mappings":";;;;;;;AAGA,IAAAA,SAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,eAAA,GAAAF,OAAA;AALA;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA,GAJA,CAKA;AACA,MAAMG,cAAc,GAAIC,KAAU,IAAK;EACnC,IAAI,CAACA,KAAK,EAAE;IACR,OAAOA,KAAK;EAChB;EACA,IAAIC,OAAO,GAAGC,KAAK,CAACD,OAAO,CAACD,KAAK,CAAC;EAClC,MAAMG,aAAa,GAAGH,KAAK,YAAYE,KAAK,KAAK,KAAK,IAAID,OAAO;EACjE,IAAIE,aAAa,EAAE;IACfH,KAAK,GAAGE,KAAK,CAACE,IAAI,CAACJ,KAAK,CAAC;IACzBC,OAAO,GAAG,IAAI;EAClB;EACA,IAAI,OAAOD,KAAK,KAAK,QAAQ,IAAIC,OAAO,EAAE;IACtC,KAAK,MAAMI,CAAC,IAAIL,KAAK,EAAE;MACnBA,KAAK,CAACK,CAAC,CAAC,GAAGN,cAAc,CAACC,KAAK,CAACK,CAAC,CAAC,CAAC;IACvC;EACJ;EACA,OAAOL,KAAK;AAChB,CAAC;AAEM,MAAMM,oCAAoC,GAAGA,CAAA,KAAM;EACtD,OAAO,IAAIC,sCAAsB,CAAC;IAC9BC,SAAS,EAAE,WAAW;IACtBC,WAAW,EAAE,MAAAA,CAAO;MAAEC,KAAK;MAAEV,KAAK,EAAEW;IAAa,CAAC,KAAK;MACnD,IAAI,CAACA,YAAY,EAAE;QACf,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
+ {"version":3,"names":["_error","_interopRequireDefault","require","_apiHeadlessCms","_api","createRichTextStorageTransformPlugin","StorageTransformPlugin","name","fieldType","fromStorage","field","value","storageValue","plugins","WebinyError","storageId","fieldId","compressor","oneByType","CompressorPlugin","type","ex","getCompressor","decompress","toStorage","compress","exports"],"sources":["richText.ts"],"sourcesContent":["/**\n * File is @internal\n */\nimport WebinyError from \"@webiny/error\";\nimport { StorageTransformPlugin } from \"@webiny/api-headless-cms\";\nimport { CompressorPlugin } from \"@webiny/api\";\n\nexport const createRichTextStorageTransformPlugin = () => {\n return new StorageTransformPlugin({\n name: \"headless-cms.storage-transform.rich-text.default\",\n fieldType: \"rich-text\",\n fromStorage: async ({ field, value: storageValue, plugins }) => {\n if (!storageValue) {\n return storageValue;\n } else if (typeof storageValue !== \"object\") {\n throw new WebinyError(\n `RichText value received in \"fromStorage\" function is not an object in field \"${field.storageId}\" - ${field.fieldId}.`\n );\n }\n\n let compressor: CompressorPlugin;\n\n try {\n compressor = plugins.oneByType<CompressorPlugin>(CompressorPlugin.type);\n } catch (ex) {\n return storageValue;\n }\n\n try {\n return await compressor.getCompressor().decompress(storageValue);\n } catch {\n return storageValue;\n }\n },\n toStorage: async ({ value, plugins }) => {\n let compressor: CompressorPlugin;\n\n try {\n compressor = plugins.oneByType<CompressorPlugin>(CompressorPlugin.type);\n } catch (ex) {\n return value;\n }\n try {\n return await compressor.getCompressor().compress(value);\n } catch {\n return value;\n }\n }\n });\n};\n"],"mappings":";;;;;;;AAGA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,eAAA,GAAAD,OAAA;AACA,IAAAE,IAAA,GAAAF,OAAA;AALA;AACA;AACA;;AAKO,MAAMG,oCAAoC,GAAGA,CAAA,KAAM;EACtD,OAAO,IAAIC,sCAAsB,CAAC;IAC9BC,IAAI,EAAE,kDAAkD;IACxDC,SAAS,EAAE,WAAW;IACtBC,WAAW,EAAE,MAAAA,CAAO;MAAEC,KAAK;MAAEC,KAAK,EAAEC,YAAY;MAAEC;IAAQ,CAAC,KAAK;MAC5D,IAAI,CAACD,YAAY,EAAE;QACf,OAAOA,YAAY;MACvB,CAAC,MAAM,IAAI,OAAOA,YAAY,KAAK,QAAQ,EAAE;QACzC,MAAM,IAAIE,cAAW,CACjB,gFAAgFJ,KAAK,CAACK,SAAS,OAAOL,KAAK,CAACM,OAAO,GACvH,CAAC;MACL;MAEA,IAAIC,UAA4B;MAEhC,IAAI;QACAA,UAAU,GAAGJ,OAAO,CAACK,SAAS,CAAmBC,qBAAgB,CAACC,IAAI,CAAC;MAC3E,CAAC,CAAC,OAAOC,EAAE,EAAE;QACT,OAAOT,YAAY;MACvB;MAEA,IAAI;QACA,OAAO,MAAMK,UAAU,CAACK,aAAa,CAAC,CAAC,CAACC,UAAU,CAACX,YAAY,CAAC;MACpE,CAAC,CAAC,MAAM;QACJ,OAAOA,YAAY;MACvB;IACJ,CAAC;IACDY,SAAS,EAAE,MAAAA,CAAO;MAAEb,KAAK;MAAEE;IAAQ,CAAC,KAAK;MACrC,IAAII,UAA4B;MAEhC,IAAI;QACAA,UAAU,GAAGJ,OAAO,CAACK,SAAS,CAAmBC,qBAAgB,CAACC,IAAI,CAAC;MAC3E,CAAC,CAAC,OAAOC,EAAE,EAAE;QACT,OAAOV,KAAK;MAChB;MACA,IAAI;QACA,OAAO,MAAMM,UAAU,CAACK,aAAa,CAAC,CAAC,CAACG,QAAQ,CAACd,KAAK,CAAC;MAC3D,CAAC,CAAC,MAAM;QACJ,OAAOA,KAAK;MAChB;IACJ;EACJ,CAAC,CAAC;AACN,CAAC;AAACe,OAAA,CAAArB,oCAAA,GAAAA,oCAAA","ignoreList":[]}
@@ -1,5 +1,5 @@
1
1
  /**
2
2
  * File is @internal
3
3
  */
4
- import { CmsFieldFilterValueTransformPlugin } from "../../types";
4
+ import type { CmsFieldFilterValueTransformPlugin } from "../../types";
5
5
  export declare const createDatetimeTransformValuePlugin: () => CmsFieldFilterValueTransformPlugin;
@@ -1 +1 @@
1
- {"version":3,"names":["_TimeTransformPlugin","require","_DateTimeTransformPlugin","timeTransformer","TimeTransformPlugin","fields","dateTimeTransformer","DateTimeTransformPlugin","createDatetimeTransformValuePlugin","type","name","fieldType","transform","field","value","settings","exports"],"sources":["datetime.ts"],"sourcesContent":["/**\n * File is @internal\n */\nimport { CmsFieldFilterValueTransformPlugin } from \"~/types\";\nimport { TimeTransformPlugin } from \"@webiny/db-dynamodb/plugins/definitions/TimeTransformPlugin\";\nimport { DateTimeTransformPlugin } from \"@webiny/db-dynamodb/plugins/definitions/DateTimeTransformPlugin\";\n\nconst timeTransformer = new TimeTransformPlugin({\n fields: [\"*\"]\n});\nconst dateTimeTransformer = new DateTimeTransformPlugin({\n fields: [\"*\"]\n});\n\nexport const createDatetimeTransformValuePlugin = (): CmsFieldFilterValueTransformPlugin => {\n return {\n type: \"cms-field-filter-value-transform\",\n name: \"cms-field-value-filter-transform-datetime\",\n fieldType: \"datetime\",\n /**\n * Always transform into the milliseconds.\n */\n transform: ({ field, value }) => {\n const { type } = field.settings || {};\n if (type === \"time\") {\n return timeTransformer.transform({\n value\n });\n }\n return dateTimeTransformer.transform({\n value\n });\n }\n };\n};\n"],"mappings":";;;;;;AAIA,IAAAA,oBAAA,GAAAC,OAAA;AACA,IAAAC,wBAAA,GAAAD,OAAA;AALA;AACA;AACA;;AAKA,MAAME,eAAe,GAAG,IAAIC,wCAAmB,CAAC;EAC5CC,MAAM,EAAE,CAAC,GAAG;AAChB,CAAC,CAAC;AACF,MAAMC,mBAAmB,GAAG,IAAIC,gDAAuB,CAAC;EACpDF,MAAM,EAAE,CAAC,GAAG;AAChB,CAAC,CAAC;AAEK,MAAMG,kCAAkC,GAAGA,CAAA,KAA0C;EACxF,OAAO;IACHC,IAAI,EAAE,kCAAkC;IACxCC,IAAI,EAAE,2CAA2C;IACjDC,SAAS,EAAE,UAAU;IACrB;AACR;AACA;IACQC,SAAS,EAAEA,CAAC;MAAEC,KAAK;MAAEC;IAAM,CAAC,KAAK;MAC7B,MAAM;QAAEL;MAAK,CAAC,GAAGI,KAAK,CAACE,QAAQ,IAAI,CAAC,CAAC;MACrC,IAAIN,IAAI,KAAK,MAAM,EAAE;QACjB,OAAON,eAAe,CAACS,SAAS,CAAC;UAC7BE;QACJ,CAAC,CAAC;MACN;MACA,OAAOR,mBAAmB,CAACM,SAAS,CAAC;QACjCE;MACJ,CAAC,CAAC;IACN;EACJ,CAAC;AACL,CAAC;AAACE,OAAA,CAAAR,kCAAA,GAAAA,kCAAA"}
1
+ {"version":3,"names":["_TimeTransformPlugin","require","_DateTimeTransformPlugin","timeTransformer","TimeTransformPlugin","fields","dateTimeTransformer","DateTimeTransformPlugin","createDatetimeTransformValuePlugin","type","name","fieldType","transform","field","value","settings","exports"],"sources":["datetime.ts"],"sourcesContent":["/**\n * File is @internal\n */\nimport type { CmsFieldFilterValueTransformPlugin } from \"~/types\";\nimport { TimeTransformPlugin } from \"@webiny/db-dynamodb/plugins/definitions/TimeTransformPlugin\";\nimport { DateTimeTransformPlugin } from \"@webiny/db-dynamodb/plugins/definitions/DateTimeTransformPlugin\";\n\nconst timeTransformer = new TimeTransformPlugin({\n fields: [\"*\"]\n});\nconst dateTimeTransformer = new DateTimeTransformPlugin({\n fields: [\"*\"]\n});\n\nexport const createDatetimeTransformValuePlugin = (): CmsFieldFilterValueTransformPlugin => {\n return {\n type: \"cms-field-filter-value-transform\",\n name: \"cms-field-value-filter-transform-datetime\",\n fieldType: \"datetime\",\n /**\n * Always transform into the milliseconds.\n */\n transform: ({ field, value }) => {\n const { type } = field.settings || {};\n if (type === \"time\") {\n return timeTransformer.transform({\n value\n });\n }\n return dateTimeTransformer.transform({\n value\n });\n }\n };\n};\n"],"mappings":";;;;;;AAIA,IAAAA,oBAAA,GAAAC,OAAA;AACA,IAAAC,wBAAA,GAAAD,OAAA;AALA;AACA;AACA;;AAKA,MAAME,eAAe,GAAG,IAAIC,wCAAmB,CAAC;EAC5CC,MAAM,EAAE,CAAC,GAAG;AAChB,CAAC,CAAC;AACF,MAAMC,mBAAmB,GAAG,IAAIC,gDAAuB,CAAC;EACpDF,MAAM,EAAE,CAAC,GAAG;AAChB,CAAC,CAAC;AAEK,MAAMG,kCAAkC,GAAGA,CAAA,KAA0C;EACxF,OAAO;IACHC,IAAI,EAAE,kCAAkC;IACxCC,IAAI,EAAE,2CAA2C;IACjDC,SAAS,EAAE,UAAU;IACrB;AACR;AACA;IACQC,SAAS,EAAEA,CAAC;MAAEC,KAAK;MAAEC;IAAM,CAAC,KAAK;MAC7B,MAAM;QAAEL;MAAK,CAAC,GAAGI,KAAK,CAACE,QAAQ,IAAI,CAAC,CAAC;MACrC,IAAIN,IAAI,KAAK,MAAM,EAAE;QACjB,OAAON,eAAe,CAACS,SAAS,CAAC;UAC7BE;QACJ,CAAC,CAAC;MACN;MACA,OAAOR,mBAAmB,CAACM,SAAS,CAAC;QACjCE;MACJ,CAAC,CAAC;IACN;EACJ,CAAC;AACL,CAAC;AAACE,OAAA,CAAAR,kCAAA,GAAAA,kCAAA","ignoreList":[]}
package/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- import { StorageOperationsFactory } from "./types";
1
+ import type { StorageOperationsFactory } from "./types";
2
2
  export * from "./plugins";
3
3
  export declare const createStorageOperations: StorageOperationsFactory;
package/index.js CHANGED
@@ -36,6 +36,7 @@ Object.keys(_plugins3).forEach(function (key) {
36
36
  });
37
37
  var _ValueFilterPlugin = require("@webiny/db-dynamodb/plugins/definitions/ValueFilterPlugin");
38
38
  var _apiHeadlessCms = require("@webiny/api-headless-cms");
39
+ var _api = require("@webiny/api");
39
40
  const createStorageOperations = params => {
40
41
  const {
41
42
  attributes,
@@ -93,7 +94,7 @@ const createStorageOperations = params => {
93
94
  return {
94
95
  name: "dynamodb",
95
96
  beforeInit: async context => {
96
- const types = ["cms-model-field-to-graphql", _plugins3.CmsEntryFieldFilterPathPlugin.type, _plugins3.CmsFieldFilterValueTransformPlugin.type, _plugins3.CmsEntryFieldFilterPlugin.type, _plugins3.CmsEntryFieldSortingPlugin.type, _ValueFilterPlugin.ValueFilterPlugin.type, _apiHeadlessCms.StorageOperationsCmsModelPlugin.type];
97
+ const types = ["cms-model-field-to-graphql", _plugins3.CmsEntryFieldFilterPathPlugin.type, _plugins3.CmsFieldFilterValueTransformPlugin.type, _plugins3.CmsEntryFieldFilterPlugin.type, _plugins3.CmsEntryFieldSortingPlugin.type, _ValueFilterPlugin.ValueFilterPlugin.type, _apiHeadlessCms.StorageOperationsCmsModelPlugin.type, _apiHeadlessCms.StorageTransformPlugin.type, _api.CompressorPlugin.type];
97
98
  /**
98
99
  * Collect all required plugins from parent context.
99
100
  */
package/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["_filters","_interopRequireDefault","require","_dynamoDb","_types","_table","_system","_group","_model","_entry","_plugins","_system2","_group2","_model2","_entry2","_plugins2","_plugins3","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_ValueFilterPlugin","_apiHeadlessCms","createStorageOperations","params","attributes","table","documentClient","plugins","userPlugins","tableInstance","createTable","entities","system","createSystemEntity","entityName","ENTITIES","SYSTEM","groups","createGroupEntity","GROUPS","models","createModelEntity","MODELS","entries","createEntryEntity","ENTRIES","PluginsContainer","dynamoDbValueFilters","dynamoDbPlugins","createFilterCreatePlugins","createEntriesStorageOperations","entity","name","beforeInit","context","types","CmsEntryFieldFilterPathPlugin","type","CmsFieldFilterValueTransformPlugin","CmsEntryFieldFilterPlugin","CmsEntryFieldSortingPlugin","ValueFilterPlugin","StorageOperationsCmsModelPlugin","mergeByType","register","dataLoaders","clearAll","getEntities","getTable","createSystemStorageOperations","createGroupsStorageOperations","createModelsStorageOperations"],"sources":["index.ts"],"sourcesContent":["import dynamoDbValueFilters from \"@webiny/db-dynamodb/plugins/filters\";\nimport dynamoDbPlugins from \"./dynamoDb\";\nimport { ENTITIES, StorageOperationsFactory } from \"~/types\";\nimport { createTable } from \"~/definitions/table\";\nimport { createSystemEntity } from \"~/definitions/system\";\nimport { createGroupEntity } from \"~/definitions/group\";\nimport { createModelEntity } from \"~/definitions/model\";\nimport { createEntryEntity } from \"~/definitions/entry\";\nimport { PluginsContainer } from \"@webiny/plugins\";\nimport { createSystemStorageOperations } from \"~/operations/system\";\nimport { createGroupsStorageOperations } from \"~/operations/group\";\nimport { createModelsStorageOperations } from \"~/operations/model\";\nimport { createEntriesStorageOperations } from \"./operations/entry\";\n\nimport { createFilterCreatePlugins } from \"~/operations/entry/filtering/plugins\";\nimport {\n CmsEntryFieldFilterPathPlugin,\n CmsEntryFieldFilterPlugin,\n CmsEntryFieldSortingPlugin,\n CmsFieldFilterValueTransformPlugin\n} from \"~/plugins\";\nimport { ValueFilterPlugin } from \"@webiny/db-dynamodb/plugins/definitions/ValueFilterPlugin\";\nimport { StorageOperationsCmsModelPlugin } from \"@webiny/api-headless-cms\";\n\nexport * from \"./plugins\";\n\nexport const createStorageOperations: StorageOperationsFactory = params => {\n const { attributes, table, documentClient, plugins: userPlugins } = params;\n\n const tableInstance = createTable({\n table,\n documentClient\n });\n\n const entities = {\n system: createSystemEntity({\n entityName: ENTITIES.SYSTEM,\n table: tableInstance,\n attributes: attributes ? attributes[ENTITIES.SYSTEM] : {}\n }),\n groups: createGroupEntity({\n entityName: ENTITIES.GROUPS,\n table: tableInstance,\n attributes: attributes ? attributes[ENTITIES.GROUPS] : {}\n }),\n models: createModelEntity({\n entityName: ENTITIES.MODELS,\n table: tableInstance,\n attributes: attributes ? attributes[ENTITIES.MODELS] : {}\n }),\n entries: createEntryEntity({\n entityName: ENTITIES.ENTRIES,\n table: tableInstance,\n attributes: attributes ? attributes[ENTITIES.ENTRIES] : {}\n })\n };\n\n const plugins = new PluginsContainer([\n /**\n * DynamoDB filter plugins for the where conditions.\n */\n dynamoDbValueFilters(),\n /**\n * Field plugins for DynamoDB.\n */\n dynamoDbPlugins(),\n /**\n * Filter create plugins.\n */\n createFilterCreatePlugins(),\n /**\n * User defined custom plugins.\n */\n ...(userPlugins || [])\n ]);\n\n const entries = createEntriesStorageOperations({\n entity: entities.entries,\n plugins\n });\n\n return {\n name: \"dynamodb\",\n beforeInit: async context => {\n const types: string[] = [\n \"cms-model-field-to-graphql\",\n CmsEntryFieldFilterPathPlugin.type,\n CmsFieldFilterValueTransformPlugin.type,\n CmsEntryFieldFilterPlugin.type,\n CmsEntryFieldSortingPlugin.type,\n ValueFilterPlugin.type,\n StorageOperationsCmsModelPlugin.type\n ];\n /**\n * Collect all required plugins from parent context.\n */\n for (const type of types) {\n plugins.mergeByType(context.plugins, type);\n }\n /**\n * Pass the plugins to the parent context.\n */\n context.plugins.register([dynamoDbPlugins()]);\n\n entries.dataLoaders.clearAll();\n },\n getEntities: () => entities,\n getTable: () => tableInstance,\n system: createSystemStorageOperations({\n entity: entities.system\n }),\n groups: createGroupsStorageOperations({\n entity: entities.groups,\n plugins\n }),\n models: createModelsStorageOperations({\n entity: entities.models\n }),\n entries\n };\n};\n"],"mappings":";;;;;;;;;;AAAA,IAAAA,QAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,SAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,MAAA,GAAAP,OAAA;AACA,IAAAQ,QAAA,GAAAR,OAAA;AACA,IAAAS,QAAA,GAAAT,OAAA;AACA,IAAAU,OAAA,GAAAV,OAAA;AACA,IAAAW,OAAA,GAAAX,OAAA;AACA,IAAAY,OAAA,GAAAZ,OAAA;AAEA,IAAAa,SAAA,GAAAb,OAAA;AACA,IAAAc,SAAA,GAAAd,OAAA;AASAe,MAAA,CAAAC,IAAA,CAAAF,SAAA,EAAAG,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;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AC;IACDC,WAAW,EAAEA,CAAA,KAAMpC,QAAQ;IAC3BqC,QAAQ,EAAEA,CAAA,KAAMvC,aAAa;IAC7BG,MAAM,EAAE,IAAAqC,sCAA6B,EAAC;MAClClB,MAAM,EAAEpB,QAAQ,CAACC;IACrB,CAAC,CAAC;IACFK,MAAM,EAAE,IAAAiC,qCAA6B,EAAC;MAClCnB,MAAM,EAAEpB,QAAQ,CAACM,MAAM;MACvBV;IACJ,CAAC,CAAC;IACFa,MAAM,EAAE,IAAA+B,qCAA6B,EAAC;MAClCpB,MAAM,EAAEpB,QAAQ,CAACS;IACrB,CAAC,CAAC;IACFG;EACJ,CAAC;AACL,CAAC;AAAC3B,OAAA,CAAAM,uBAAA,GAAAA,uBAAA"}
1
+ {"version":3,"names":["_filters","_interopRequireDefault","require","_dynamoDb","_types","_table","_system","_group","_model","_entry","_plugins","_system2","_group2","_model2","_entry2","_plugins2","_plugins3","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_ValueFilterPlugin","_apiHeadlessCms","_api","createStorageOperations","params","attributes","table","documentClient","plugins","userPlugins","tableInstance","createTable","entities","system","createSystemEntity","entityName","ENTITIES","SYSTEM","groups","createGroupEntity","GROUPS","models","createModelEntity","MODELS","entries","createEntryEntity","ENTRIES","PluginsContainer","dynamoDbValueFilters","dynamoDbPlugins","createFilterCreatePlugins","createEntriesStorageOperations","entity","name","beforeInit","context","types","CmsEntryFieldFilterPathPlugin","type","CmsFieldFilterValueTransformPlugin","CmsEntryFieldFilterPlugin","CmsEntryFieldSortingPlugin","ValueFilterPlugin","StorageOperationsCmsModelPlugin","StorageTransformPlugin","CompressorPlugin","mergeByType","register","dataLoaders","clearAll","getEntities","getTable","createSystemStorageOperations","createGroupsStorageOperations","createModelsStorageOperations"],"sources":["index.ts"],"sourcesContent":["import dynamoDbValueFilters from \"@webiny/db-dynamodb/plugins/filters\";\nimport dynamoDbPlugins from \"./dynamoDb\";\nimport type { StorageOperationsFactory } from \"~/types\";\nimport { ENTITIES } from \"~/types\";\nimport { createTable } from \"~/definitions/table\";\nimport { createSystemEntity } from \"~/definitions/system\";\nimport { createGroupEntity } from \"~/definitions/group\";\nimport { createModelEntity } from \"~/definitions/model\";\nimport { createEntryEntity } from \"~/definitions/entry\";\nimport { PluginsContainer } from \"@webiny/plugins\";\nimport { createSystemStorageOperations } from \"~/operations/system\";\nimport { createGroupsStorageOperations } from \"~/operations/group\";\nimport { createModelsStorageOperations } from \"~/operations/model\";\nimport { createEntriesStorageOperations } from \"./operations/entry\";\n\nimport { createFilterCreatePlugins } from \"~/operations/entry/filtering/plugins\";\nimport {\n CmsEntryFieldFilterPathPlugin,\n CmsEntryFieldFilterPlugin,\n CmsEntryFieldSortingPlugin,\n CmsFieldFilterValueTransformPlugin\n} from \"~/plugins\";\nimport { ValueFilterPlugin } from \"@webiny/db-dynamodb/plugins/definitions/ValueFilterPlugin\";\nimport { StorageOperationsCmsModelPlugin, StorageTransformPlugin } from \"@webiny/api-headless-cms\";\nimport { CompressorPlugin } from \"@webiny/api\";\n\nexport * from \"./plugins\";\n\nexport const createStorageOperations: StorageOperationsFactory = params => {\n const { attributes, table, documentClient, plugins: userPlugins } = params;\n\n const tableInstance = createTable({\n table,\n documentClient\n });\n\n const entities = {\n system: createSystemEntity({\n entityName: ENTITIES.SYSTEM,\n table: tableInstance,\n attributes: attributes ? attributes[ENTITIES.SYSTEM] : {}\n }),\n groups: createGroupEntity({\n entityName: ENTITIES.GROUPS,\n table: tableInstance,\n attributes: attributes ? attributes[ENTITIES.GROUPS] : {}\n }),\n models: createModelEntity({\n entityName: ENTITIES.MODELS,\n table: tableInstance,\n attributes: attributes ? attributes[ENTITIES.MODELS] : {}\n }),\n entries: createEntryEntity({\n entityName: ENTITIES.ENTRIES,\n table: tableInstance,\n attributes: attributes ? attributes[ENTITIES.ENTRIES] : {}\n })\n };\n\n const plugins = new PluginsContainer([\n /**\n * DynamoDB filter plugins for the where conditions.\n */\n dynamoDbValueFilters(),\n /**\n * Field plugins for DynamoDB.\n */\n dynamoDbPlugins(),\n /**\n * Filter create plugins.\n */\n createFilterCreatePlugins(),\n /**\n * User defined custom plugins.\n */\n ...(userPlugins || [])\n ]);\n\n const entries = createEntriesStorageOperations({\n entity: entities.entries,\n plugins\n });\n\n return {\n name: \"dynamodb\",\n beforeInit: async context => {\n const types: string[] = [\n \"cms-model-field-to-graphql\",\n CmsEntryFieldFilterPathPlugin.type,\n CmsFieldFilterValueTransformPlugin.type,\n CmsEntryFieldFilterPlugin.type,\n CmsEntryFieldSortingPlugin.type,\n ValueFilterPlugin.type,\n StorageOperationsCmsModelPlugin.type,\n StorageTransformPlugin.type,\n CompressorPlugin.type\n ];\n /**\n * Collect all required plugins from parent context.\n */\n for (const type of types) {\n plugins.mergeByType(context.plugins, type);\n }\n /**\n * Pass the plugins to the parent context.\n */\n context.plugins.register([dynamoDbPlugins()]);\n\n entries.dataLoaders.clearAll();\n },\n getEntities: () => entities,\n getTable: () => tableInstance,\n system: createSystemStorageOperations({\n entity: entities.system\n }),\n groups: createGroupsStorageOperations({\n entity: entities.groups,\n plugins\n }),\n models: createModelsStorageOperations({\n entity: entities.models\n }),\n entries\n };\n};\n"],"mappings":";;;;;;;;;;AAAA,IAAAA,QAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,SAAA,GAAAF,sBAAA,CAAAC,OAAA;AAEA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,OAAA,GAAAJ,OAAA;AACA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,MAAA,GAAAP,OAAA;AACA,IAAAQ,QAAA,GAAAR,OAAA;AACA,IAAAS,QAAA,GAAAT,OAAA;AACA,IAAAU,OAAA,GAAAV,OAAA;AACA,IAAAW,OAAA,GAAAX,OAAA;AACA,IAAAY,OAAA,GAAAZ,OAAA;AAEA,IAAAa,SAAA,GA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C,WAAW,CAACX,OAAO,CAAC3B,OAAO,EAAE8B,IAAI,CAAC;MAC9C;MACA;AACZ;AACA;MACYH,OAAO,CAAC3B,OAAO,CAACuC,QAAQ,CAAC,CAAC,IAAAlB,iBAAe,EAAC,CAAC,CAAC,CAAC;MAE7CL,OAAO,CAACwB,WAAW,CAACC,QAAQ,CAAC,CAAC;IAClC,CAAC;IACDC,WAAW,EAAEA,CAAA,KAAMtC,QAAQ;IAC3BuC,QAAQ,EAAEA,CAAA,KAAMzC,aAAa;IAC7BG,MAAM,EAAE,IAAAuC,sCAA6B,EAAC;MAClCpB,MAAM,EAAEpB,QAAQ,CAACC;IACrB,CAAC,CAAC;IACFK,MAAM,EAAE,IAAAmC,qCAA6B,EAAC;MAClCrB,MAAM,EAAEpB,QAAQ,CAACM,MAAM;MACvBV;IACJ,CAAC,CAAC;IACFa,MAAM,EAAE,IAAAiC,qCAA6B,EAAC;MAClCtB,MAAM,EAAEpB,QAAQ,CAACS;IACrB,CAAC,CAAC;IACFG;EACJ,CAAC;AACL,CAAC;AAAC5B,OAAA,CAAAO,uBAAA,GAAAA,uBAAA","ignoreList":[]}
@@ -1,4 +1,4 @@
1
- import DataLoader from "dataloader";
1
+ import type DataLoader from "dataloader";
2
2
  export interface CacheKeyParams {
3
3
  name: string;
4
4
  tenant: string;