@webiny/api-headless-cms 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 (806) hide show
  1. package/constants.d.ts +18 -6
  2. package/constants.js +29 -16
  3. package/constants.js.map +1 -1
  4. package/context.d.ts +1 -1
  5. package/context.js +61 -32
  6. package/context.js.map +1 -1
  7. package/crud/AccessControl/AccessControl.d.ts +98 -0
  8. package/crud/AccessControl/AccessControl.js +542 -0
  9. package/crud/AccessControl/AccessControl.js.map +1 -0
  10. package/crud/AccessControl/README.md +47 -0
  11. package/crud/AccessControl/groups-own.png +0 -0
  12. package/crud/AccessControl/models-own.png +0 -0
  13. package/crud/contentEntry/abstractions/IDeleteEntry.d.ts +4 -0
  14. package/crud/contentEntry/abstractions/IDeleteEntry.js +7 -0
  15. package/crud/contentEntry/abstractions/IDeleteEntry.js.map +1 -0
  16. package/crud/contentEntry/abstractions/IDeleteEntryOperation.d.ts +4 -0
  17. package/crud/contentEntry/abstractions/IDeleteEntryOperation.js +7 -0
  18. package/crud/contentEntry/abstractions/IDeleteEntryOperation.js.map +1 -0
  19. package/crud/contentEntry/abstractions/IGetEntriesByIds.d.ts +4 -0
  20. package/crud/contentEntry/abstractions/IGetEntriesByIds.js +7 -0
  21. package/crud/contentEntry/abstractions/IGetEntriesByIds.js.map +1 -0
  22. package/crud/contentEntry/abstractions/IGetEntry.d.ts +4 -0
  23. package/crud/contentEntry/abstractions/IGetEntry.js +7 -0
  24. package/crud/contentEntry/abstractions/IGetEntry.js.map +1 -0
  25. package/crud/contentEntry/abstractions/IGetLatestEntriesByIds.d.ts +4 -0
  26. package/crud/contentEntry/abstractions/IGetLatestEntriesByIds.js +7 -0
  27. package/crud/contentEntry/abstractions/IGetLatestEntriesByIds.js.map +1 -0
  28. package/crud/contentEntry/abstractions/IGetLatestRevisionByEntryId.d.ts +4 -0
  29. package/crud/contentEntry/abstractions/IGetLatestRevisionByEntryId.js +7 -0
  30. package/crud/contentEntry/abstractions/IGetLatestRevisionByEntryId.js.map +1 -0
  31. package/crud/contentEntry/abstractions/IGetPreviousRevisionByEntryId.d.ts +4 -0
  32. package/crud/contentEntry/abstractions/IGetPreviousRevisionByEntryId.js +7 -0
  33. package/crud/contentEntry/abstractions/IGetPreviousRevisionByEntryId.js.map +1 -0
  34. package/crud/contentEntry/abstractions/IGetPublishedEntriesByIds.d.ts +4 -0
  35. package/crud/contentEntry/abstractions/IGetPublishedEntriesByIds.js +7 -0
  36. package/crud/contentEntry/abstractions/IGetPublishedEntriesByIds.js.map +1 -0
  37. package/crud/contentEntry/abstractions/IGetPublishedRevisionByEntryId.d.ts +4 -0
  38. package/crud/contentEntry/abstractions/IGetPublishedRevisionByEntryId.js +7 -0
  39. package/crud/contentEntry/abstractions/IGetPublishedRevisionByEntryId.js.map +1 -0
  40. package/crud/contentEntry/abstractions/IGetRevisionById.d.ts +4 -0
  41. package/crud/contentEntry/abstractions/IGetRevisionById.js +7 -0
  42. package/crud/contentEntry/abstractions/IGetRevisionById.js.map +1 -0
  43. package/crud/contentEntry/abstractions/IGetRevisionsByEntryId.d.ts +4 -0
  44. package/crud/contentEntry/abstractions/IGetRevisionsByEntryId.js +7 -0
  45. package/crud/contentEntry/abstractions/IGetRevisionsByEntryId.js.map +1 -0
  46. package/crud/contentEntry/abstractions/IListEntries.d.ts +4 -0
  47. package/crud/contentEntry/abstractions/IListEntries.js +7 -0
  48. package/crud/contentEntry/abstractions/IListEntries.js.map +1 -0
  49. package/crud/contentEntry/abstractions/IListEntriesOperation.d.ts +4 -0
  50. package/crud/contentEntry/abstractions/IListEntriesOperation.js +7 -0
  51. package/crud/contentEntry/abstractions/IListEntriesOperation.js.map +1 -0
  52. package/crud/contentEntry/abstractions/IMoveEntryToBinOperation.d.ts +4 -0
  53. package/crud/contentEntry/abstractions/IMoveEntryToBinOperation.js +7 -0
  54. package/crud/contentEntry/abstractions/IMoveEntryToBinOperation.js.map +1 -0
  55. package/crud/contentEntry/abstractions/IRestoreEntryFromBin.d.ts +4 -0
  56. package/crud/contentEntry/abstractions/IRestoreEntryFromBin.js +7 -0
  57. package/crud/contentEntry/abstractions/IRestoreEntryFromBin.js.map +1 -0
  58. package/crud/contentEntry/abstractions/IRestoreEntryFromBinOperation.d.ts +4 -0
  59. package/crud/contentEntry/abstractions/IRestoreEntryFromBinOperation.js +7 -0
  60. package/crud/contentEntry/abstractions/IRestoreEntryFromBinOperation.js.map +1 -0
  61. package/crud/contentEntry/abstractions/index.d.ts +16 -0
  62. package/crud/contentEntry/abstractions/index.js +183 -0
  63. package/crud/contentEntry/abstractions/index.js.map +1 -0
  64. package/crud/contentEntry/afterDelete.d.ts +6 -2
  65. package/crud/contentEntry/afterDelete.js +15 -1
  66. package/crud/contentEntry/afterDelete.js.map +1 -1
  67. package/crud/contentEntry/beforeCreate.d.ts +2 -2
  68. package/crud/contentEntry/beforeCreate.js.map +1 -1
  69. package/crud/contentEntry/beforeUpdate.d.ts +2 -2
  70. package/crud/contentEntry/beforeUpdate.js.map +1 -1
  71. package/crud/contentEntry/entryDataFactories/createEntryData.d.ts +8 -8
  72. package/crud/contentEntry/entryDataFactories/createEntryData.js +30 -4
  73. package/crud/contentEntry/entryDataFactories/createEntryData.js.map +1 -1
  74. package/crud/contentEntry/entryDataFactories/createEntryRevisionFromData.d.ts +8 -6
  75. package/crud/contentEntry/entryDataFactories/createEntryRevisionFromData.js +54 -11
  76. package/crud/contentEntry/entryDataFactories/createEntryRevisionFromData.js.map +1 -1
  77. package/crud/contentEntry/entryDataFactories/createPublishEntryData.d.ts +5 -5
  78. package/crud/contentEntry/entryDataFactories/createPublishEntryData.js +22 -20
  79. package/crud/contentEntry/entryDataFactories/createPublishEntryData.js.map +1 -1
  80. package/crud/contentEntry/entryDataFactories/createRepublishEntryData.d.ts +3 -3
  81. package/crud/contentEntry/entryDataFactories/createRepublishEntryData.js +18 -16
  82. package/crud/contentEntry/entryDataFactories/createRepublishEntryData.js.map +1 -1
  83. package/crud/contentEntry/entryDataFactories/createUnpublishEntryData.d.ts +5 -5
  84. package/crud/contentEntry/entryDataFactories/createUnpublishEntryData.js +10 -8
  85. package/crud/contentEntry/entryDataFactories/createUnpublishEntryData.js.map +1 -1
  86. package/crud/contentEntry/entryDataFactories/createUpdateEntryData.d.ts +5 -5
  87. package/crud/contentEntry/entryDataFactories/createUpdateEntryData.js +8 -0
  88. package/crud/contentEntry/entryDataFactories/createUpdateEntryData.js.map +1 -1
  89. package/crud/contentEntry/entryDataFactories/index.js.map +1 -1
  90. package/crud/contentEntry/entryDataFactories/mapAndCleanUpdatedInputData.d.ts +1 -1
  91. package/crud/contentEntry/entryDataFactories/mapAndCleanUpdatedInputData.js.map +1 -1
  92. package/crud/contentEntry/entryDataFactories/statuses.js +3 -6
  93. package/crud/contentEntry/entryDataFactories/statuses.js.map +1 -1
  94. package/crud/contentEntry/entryDataValidation.d.ts +2 -2
  95. package/crud/contentEntry/entryDataValidation.js.map +1 -1
  96. package/crud/contentEntry/markLockedFields.d.ts +1 -1
  97. package/crud/contentEntry/markLockedFields.js.map +1 -1
  98. package/crud/contentEntry/referenceFieldsMapping.d.ts +1 -1
  99. package/crud/contentEntry/referenceFieldsMapping.js +10 -10
  100. package/crud/contentEntry/referenceFieldsMapping.js.map +1 -1
  101. package/crud/contentEntry/searchableFields.d.ts +2 -2
  102. package/crud/contentEntry/searchableFields.js.map +1 -1
  103. package/crud/contentEntry/useCases/DeleteEntry/DeleteEntry.d.ts +10 -0
  104. package/crud/contentEntry/useCases/DeleteEntry/DeleteEntry.js +58 -0
  105. package/crud/contentEntry/useCases/DeleteEntry/DeleteEntry.js.map +1 -0
  106. package/crud/contentEntry/useCases/DeleteEntry/DeleteEntryOperation.d.ts +7 -0
  107. package/crud/contentEntry/useCases/DeleteEntry/DeleteEntryOperation.js +17 -0
  108. package/crud/contentEntry/useCases/DeleteEntry/DeleteEntryOperation.js.map +1 -0
  109. package/crud/contentEntry/useCases/DeleteEntry/DeleteEntryOperationWithEvents.d.ts +9 -0
  110. package/crud/contentEntry/useCases/DeleteEntry/DeleteEntryOperationWithEvents.js +45 -0
  111. package/crud/contentEntry/useCases/DeleteEntry/DeleteEntryOperationWithEvents.js.map +1 -0
  112. package/crud/contentEntry/useCases/DeleteEntry/DeleteEntrySecure.d.ts +9 -0
  113. package/crud/contentEntry/useCases/DeleteEntry/DeleteEntrySecure.js +22 -0
  114. package/crud/contentEntry/useCases/DeleteEntry/DeleteEntrySecure.js.map +1 -0
  115. package/crud/contentEntry/useCases/DeleteEntry/MoveEntryToBin.d.ts +10 -0
  116. package/crud/contentEntry/useCases/DeleteEntry/MoveEntryToBin.js +33 -0
  117. package/crud/contentEntry/useCases/DeleteEntry/MoveEntryToBin.js.map +1 -0
  118. package/crud/contentEntry/useCases/DeleteEntry/MoveEntryToBinOperation.d.ts +7 -0
  119. package/crud/contentEntry/useCases/DeleteEntry/MoveEntryToBinOperation.js +17 -0
  120. package/crud/contentEntry/useCases/DeleteEntry/MoveEntryToBinOperation.js.map +1 -0
  121. package/crud/contentEntry/useCases/DeleteEntry/MoveEntryToBinOperationWithEvents.d.ts +9 -0
  122. package/crud/contentEntry/useCases/DeleteEntry/MoveEntryToBinOperationWithEvents.js +45 -0
  123. package/crud/contentEntry/useCases/DeleteEntry/MoveEntryToBinOperationWithEvents.js.map +1 -0
  124. package/crud/contentEntry/useCases/DeleteEntry/TransformEntryDelete.d.ts +6 -0
  125. package/crud/contentEntry/useCases/DeleteEntry/TransformEntryDelete.js +21 -0
  126. package/crud/contentEntry/useCases/DeleteEntry/TransformEntryDelete.js.map +1 -0
  127. package/crud/contentEntry/useCases/DeleteEntry/TransformEntryMoveToBin.d.ts +9 -0
  128. package/crud/contentEntry/useCases/DeleteEntry/TransformEntryMoveToBin.js +54 -0
  129. package/crud/contentEntry/useCases/DeleteEntry/TransformEntryMoveToBin.js.map +1 -0
  130. package/crud/contentEntry/useCases/DeleteEntry/index.d.ts +28 -0
  131. package/crud/contentEntry/useCases/DeleteEntry/index.js +42 -0
  132. package/crud/contentEntry/useCases/DeleteEntry/index.js.map +1 -0
  133. package/crud/contentEntry/useCases/GetEntriesByIds/GetEntriesByIds.d.ts +9 -0
  134. package/crud/contentEntry/useCases/GetEntriesByIds/GetEntriesByIds.js +21 -0
  135. package/crud/contentEntry/useCases/GetEntriesByIds/GetEntriesByIds.js.map +1 -0
  136. package/crud/contentEntry/useCases/GetEntriesByIds/GetEntriesByIdsNotDeleted.d.ts +7 -0
  137. package/crud/contentEntry/useCases/GetEntriesByIds/GetEntriesByIdsNotDeleted.js +18 -0
  138. package/crud/contentEntry/useCases/GetEntriesByIds/GetEntriesByIdsNotDeleted.js.map +1 -0
  139. package/crud/contentEntry/useCases/GetEntriesByIds/GetEntriesByIdsSecure.d.ts +9 -0
  140. package/crud/contentEntry/useCases/GetEntriesByIds/GetEntriesByIdsSecure.js +28 -0
  141. package/crud/contentEntry/useCases/GetEntriesByIds/GetEntriesByIdsSecure.js.map +1 -0
  142. package/crud/contentEntry/useCases/GetEntriesByIds/index.d.ts +13 -0
  143. package/crud/contentEntry/useCases/GetEntriesByIds/index.js +20 -0
  144. package/crud/contentEntry/useCases/GetEntriesByIds/index.js.map +1 -0
  145. package/crud/contentEntry/useCases/GetLatestEntriesByIds/GetLatestEntriesByIds.d.ts +9 -0
  146. package/crud/contentEntry/useCases/GetLatestEntriesByIds/GetLatestEntriesByIds.js +21 -0
  147. package/crud/contentEntry/useCases/GetLatestEntriesByIds/GetLatestEntriesByIds.js.map +1 -0
  148. package/crud/contentEntry/useCases/GetLatestEntriesByIds/GetLatestEntriesByIdsNotDeleted.d.ts +7 -0
  149. package/crud/contentEntry/useCases/GetLatestEntriesByIds/GetLatestEntriesByIdsNotDeleted.js +18 -0
  150. package/crud/contentEntry/useCases/GetLatestEntriesByIds/GetLatestEntriesByIdsNotDeleted.js.map +1 -0
  151. package/crud/contentEntry/useCases/GetLatestEntriesByIds/GetLatestEntriesByIdsSecure.d.ts +9 -0
  152. package/crud/contentEntry/useCases/GetLatestEntriesByIds/GetLatestEntriesByIdsSecure.js +28 -0
  153. package/crud/contentEntry/useCases/GetLatestEntriesByIds/GetLatestEntriesByIdsSecure.js.map +1 -0
  154. package/crud/contentEntry/useCases/GetLatestEntriesByIds/index.d.ts +13 -0
  155. package/crud/contentEntry/useCases/GetLatestEntriesByIds/index.js +20 -0
  156. package/crud/contentEntry/useCases/GetLatestEntriesByIds/index.js.map +1 -0
  157. package/crud/contentEntry/useCases/GetLatestRevisionByEntryId/GetLatestRevisionByEntryId.d.ts +9 -0
  158. package/crud/contentEntry/useCases/GetLatestRevisionByEntryId/GetLatestRevisionByEntryId.js +22 -0
  159. package/crud/contentEntry/useCases/GetLatestRevisionByEntryId/GetLatestRevisionByEntryId.js.map +1 -0
  160. package/crud/contentEntry/useCases/GetLatestRevisionByEntryId/GetLatestRevisionByEntryIdDeleted.d.ts +7 -0
  161. package/crud/contentEntry/useCases/GetLatestRevisionByEntryId/GetLatestRevisionByEntryIdDeleted.js +21 -0
  162. package/crud/contentEntry/useCases/GetLatestRevisionByEntryId/GetLatestRevisionByEntryIdDeleted.js.map +1 -0
  163. package/crud/contentEntry/useCases/GetLatestRevisionByEntryId/GetLatestRevisionByEntryIdNotDeleted.d.ts +7 -0
  164. package/crud/contentEntry/useCases/GetLatestRevisionByEntryId/GetLatestRevisionByEntryIdNotDeleted.js +21 -0
  165. package/crud/contentEntry/useCases/GetLatestRevisionByEntryId/GetLatestRevisionByEntryIdNotDeleted.js.map +1 -0
  166. package/crud/contentEntry/useCases/GetLatestRevisionByEntryId/index.d.ts +15 -0
  167. package/crud/contentEntry/useCases/GetLatestRevisionByEntryId/index.js +22 -0
  168. package/crud/contentEntry/useCases/GetLatestRevisionByEntryId/index.js.map +1 -0
  169. package/crud/contentEntry/useCases/GetPreviousRevisionByEntryId/GetPreviousRevisionByEntryId.d.ts +9 -0
  170. package/crud/contentEntry/useCases/GetPreviousRevisionByEntryId/GetPreviousRevisionByEntryId.js +22 -0
  171. package/crud/contentEntry/useCases/GetPreviousRevisionByEntryId/GetPreviousRevisionByEntryId.js.map +1 -0
  172. package/crud/contentEntry/useCases/GetPreviousRevisionByEntryId/GetPreviousRevisionByEntryIdNotDeleted.d.ts +7 -0
  173. package/crud/contentEntry/useCases/GetPreviousRevisionByEntryId/GetPreviousRevisionByEntryIdNotDeleted.js +21 -0
  174. package/crud/contentEntry/useCases/GetPreviousRevisionByEntryId/GetPreviousRevisionByEntryIdNotDeleted.js.map +1 -0
  175. package/crud/contentEntry/useCases/GetPreviousRevisionByEntryId/index.d.ts +11 -0
  176. package/crud/contentEntry/useCases/GetPreviousRevisionByEntryId/index.js +18 -0
  177. package/crud/contentEntry/useCases/GetPreviousRevisionByEntryId/index.js.map +1 -0
  178. package/crud/contentEntry/useCases/GetPublishedEntriesByIds/GetPublishedEntriesByIds.d.ts +9 -0
  179. package/crud/contentEntry/useCases/GetPublishedEntriesByIds/GetPublishedEntriesByIds.js +21 -0
  180. package/crud/contentEntry/useCases/GetPublishedEntriesByIds/GetPublishedEntriesByIds.js.map +1 -0
  181. package/crud/contentEntry/useCases/GetPublishedEntriesByIds/GetPublishedEntriesByIdsNotDeleted.d.ts +7 -0
  182. package/crud/contentEntry/useCases/GetPublishedEntriesByIds/GetPublishedEntriesByIdsNotDeleted.js +18 -0
  183. package/crud/contentEntry/useCases/GetPublishedEntriesByIds/GetPublishedEntriesByIdsNotDeleted.js.map +1 -0
  184. package/crud/contentEntry/useCases/GetPublishedEntriesByIds/GetPublishedEntriesByIdsSecure.d.ts +9 -0
  185. package/crud/contentEntry/useCases/GetPublishedEntriesByIds/GetPublishedEntriesByIdsSecure.js +28 -0
  186. package/crud/contentEntry/useCases/GetPublishedEntriesByIds/GetPublishedEntriesByIdsSecure.js.map +1 -0
  187. package/crud/contentEntry/useCases/GetPublishedEntriesByIds/index.d.ts +13 -0
  188. package/crud/contentEntry/useCases/GetPublishedEntriesByIds/index.js +20 -0
  189. package/crud/contentEntry/useCases/GetPublishedEntriesByIds/index.js.map +1 -0
  190. package/crud/contentEntry/useCases/GetPublishedRevisionByEntryId/GetPublishedRevisionByEntryId.d.ts +9 -0
  191. package/crud/contentEntry/useCases/GetPublishedRevisionByEntryId/GetPublishedRevisionByEntryId.js +22 -0
  192. package/crud/contentEntry/useCases/GetPublishedRevisionByEntryId/GetPublishedRevisionByEntryId.js.map +1 -0
  193. package/crud/contentEntry/useCases/GetPublishedRevisionByEntryId/GetPublishedRevisionByEntryIdNotDeleted.d.ts +7 -0
  194. package/crud/contentEntry/useCases/GetPublishedRevisionByEntryId/GetPublishedRevisionByEntryIdNotDeleted.js +21 -0
  195. package/crud/contentEntry/useCases/GetPublishedRevisionByEntryId/GetPublishedRevisionByEntryIdNotDeleted.js.map +1 -0
  196. package/crud/contentEntry/useCases/GetPublishedRevisionByEntryId/index.d.ts +11 -0
  197. package/crud/contentEntry/useCases/GetPublishedRevisionByEntryId/index.js +18 -0
  198. package/crud/contentEntry/useCases/GetPublishedRevisionByEntryId/index.js.map +1 -0
  199. package/crud/contentEntry/useCases/GetRevisionById/GetRevisionById.d.ts +9 -0
  200. package/crud/contentEntry/useCases/GetRevisionById/GetRevisionById.js +22 -0
  201. package/crud/contentEntry/useCases/GetRevisionById/GetRevisionById.js.map +1 -0
  202. package/crud/contentEntry/useCases/GetRevisionById/GetRevisionByIdNotDeleted.d.ts +7 -0
  203. package/crud/contentEntry/useCases/GetRevisionById/GetRevisionByIdNotDeleted.js +21 -0
  204. package/crud/contentEntry/useCases/GetRevisionById/GetRevisionByIdNotDeleted.js.map +1 -0
  205. package/crud/contentEntry/useCases/GetRevisionById/index.d.ts +11 -0
  206. package/crud/contentEntry/useCases/GetRevisionById/index.js +18 -0
  207. package/crud/contentEntry/useCases/GetRevisionById/index.js.map +1 -0
  208. package/crud/contentEntry/useCases/GetRevisionsByEntryId/GetRevisionsByEntryId.d.ts +9 -0
  209. package/crud/contentEntry/useCases/GetRevisionsByEntryId/GetRevisionsByEntryId.js +21 -0
  210. package/crud/contentEntry/useCases/GetRevisionsByEntryId/GetRevisionsByEntryId.js.map +1 -0
  211. package/crud/contentEntry/useCases/GetRevisionsByEntryId/GetRevisionsByEntryIdNotDeleted.d.ts +7 -0
  212. package/crud/contentEntry/useCases/GetRevisionsByEntryId/GetRevisionsByEntryIdNotDeleted.js +18 -0
  213. package/crud/contentEntry/useCases/GetRevisionsByEntryId/GetRevisionsByEntryIdNotDeleted.js.map +1 -0
  214. package/crud/contentEntry/useCases/GetRevisionsByEntryId/index.d.ts +13 -0
  215. package/crud/contentEntry/useCases/GetRevisionsByEntryId/index.js +18 -0
  216. package/crud/contentEntry/useCases/GetRevisionsByEntryId/index.js.map +1 -0
  217. package/crud/contentEntry/useCases/ListEntries/GetEntry.d.ts +7 -0
  218. package/crud/contentEntry/useCases/ListEntries/GetEntry.js +29 -0
  219. package/crud/contentEntry/useCases/ListEntries/GetEntry.js.map +1 -0
  220. package/crud/contentEntry/useCases/ListEntries/GetEntrySecure.d.ts +11 -0
  221. package/crud/contentEntry/useCases/ListEntries/GetEntrySecure.js +38 -0
  222. package/crud/contentEntry/useCases/ListEntries/GetEntrySecure.js.map +1 -0
  223. package/crud/contentEntry/useCases/ListEntries/ListEntries.d.ts +7 -0
  224. package/crud/contentEntry/useCases/ListEntries/ListEntries.js +62 -0
  225. package/crud/contentEntry/useCases/ListEntries/ListEntries.js.map +1 -0
  226. package/crud/contentEntry/useCases/ListEntries/ListEntriesOperation.d.ts +14 -0
  227. package/crud/contentEntry/useCases/ListEntries/ListEntriesOperation.js +24 -0
  228. package/crud/contentEntry/useCases/ListEntries/ListEntriesOperation.js.map +1 -0
  229. package/crud/contentEntry/useCases/ListEntries/ListEntriesOperationDeleted.d.ts +7 -0
  230. package/crud/contentEntry/useCases/ListEntries/ListEntriesOperationDeleted.js +24 -0
  231. package/crud/contentEntry/useCases/ListEntries/ListEntriesOperationDeleted.js.map +1 -0
  232. package/crud/contentEntry/useCases/ListEntries/ListEntriesOperationLatest.d.ts +7 -0
  233. package/crud/contentEntry/useCases/ListEntries/ListEntriesOperationLatest.js +25 -0
  234. package/crud/contentEntry/useCases/ListEntries/ListEntriesOperationLatest.js.map +1 -0
  235. package/crud/contentEntry/useCases/ListEntries/ListEntriesOperationNotDeleted.d.ts +7 -0
  236. package/crud/contentEntry/useCases/ListEntries/ListEntriesOperationNotDeleted.js +24 -0
  237. package/crud/contentEntry/useCases/ListEntries/ListEntriesOperationNotDeleted.js.map +1 -0
  238. package/crud/contentEntry/useCases/ListEntries/ListEntriesOperationPublished.d.ts +7 -0
  239. package/crud/contentEntry/useCases/ListEntries/ListEntriesOperationPublished.js +24 -0
  240. package/crud/contentEntry/useCases/ListEntries/ListEntriesOperationPublished.js.map +1 -0
  241. package/crud/contentEntry/useCases/ListEntries/ListEntriesOperationWithEvents.d.ts +9 -0
  242. package/crud/contentEntry/useCases/ListEntries/ListEntriesOperationWithEvents.js +22 -0
  243. package/crud/contentEntry/useCases/ListEntries/ListEntriesOperationWithEvents.js.map +1 -0
  244. package/crud/contentEntry/useCases/ListEntries/ListEntriesOperationWithSearchableFields.d.ts +8 -0
  245. package/crud/contentEntry/useCases/ListEntries/ListEntriesOperationWithSearchableFields.js +27 -0
  246. package/crud/contentEntry/useCases/ListEntries/ListEntriesOperationWithSearchableFields.js.map +1 -0
  247. package/crud/contentEntry/useCases/ListEntries/ListEntriesOperationWithSort.d.ts +8 -0
  248. package/crud/contentEntry/useCases/ListEntries/ListEntriesOperationWithSort.js +26 -0
  249. package/crud/contentEntry/useCases/ListEntries/ListEntriesOperationWithSort.js.map +1 -0
  250. package/crud/contentEntry/useCases/ListEntries/ListEntriesOperationWithStatusCheck.d.ts +7 -0
  251. package/crud/contentEntry/useCases/ListEntries/ListEntriesOperationWithStatusCheck.js +36 -0
  252. package/crud/contentEntry/useCases/ListEntries/ListEntriesOperationWithStatusCheck.js.map +1 -0
  253. package/crud/contentEntry/useCases/ListEntries/ListEntriesSecure.d.ts +11 -0
  254. package/crud/contentEntry/useCases/ListEntries/ListEntriesSecure.js +41 -0
  255. package/crud/contentEntry/useCases/ListEntries/ListEntriesSecure.js.map +1 -0
  256. package/crud/contentEntry/useCases/ListEntries/index.d.ts +26 -0
  257. package/crud/contentEntry/useCases/ListEntries/index.js +61 -0
  258. package/crud/contentEntry/useCases/ListEntries/index.js.map +1 -0
  259. package/crud/contentEntry/useCases/RestoreEntryFromBin/RestoreEntryFromBin.d.ts +10 -0
  260. package/crud/contentEntry/useCases/RestoreEntryFromBin/RestoreEntryFromBin.js +37 -0
  261. package/crud/contentEntry/useCases/RestoreEntryFromBin/RestoreEntryFromBin.js.map +1 -0
  262. package/crud/contentEntry/useCases/RestoreEntryFromBin/RestoreEntryFromBinOperation.d.ts +9 -0
  263. package/crud/contentEntry/useCases/RestoreEntryFromBin/RestoreEntryFromBinOperation.js +19 -0
  264. package/crud/contentEntry/useCases/RestoreEntryFromBin/RestoreEntryFromBinOperation.js.map +1 -0
  265. package/crud/contentEntry/useCases/RestoreEntryFromBin/RestoreEntryFromBinOperationWithEvents.d.ts +9 -0
  266. package/crud/contentEntry/useCases/RestoreEntryFromBin/RestoreEntryFromBinOperationWithEvents.js +42 -0
  267. package/crud/contentEntry/useCases/RestoreEntryFromBin/RestoreEntryFromBinOperationWithEvents.js.map +1 -0
  268. package/crud/contentEntry/useCases/RestoreEntryFromBin/RestoreEntryFromBinSecure.d.ts +9 -0
  269. package/crud/contentEntry/useCases/RestoreEntryFromBin/RestoreEntryFromBinSecure.js +22 -0
  270. package/crud/contentEntry/useCases/RestoreEntryFromBin/RestoreEntryFromBinSecure.js.map +1 -0
  271. package/crud/contentEntry/useCases/RestoreEntryFromBin/TransformEntryRestoreFromBin.d.ts +9 -0
  272. package/crud/contentEntry/useCases/RestoreEntryFromBin/TransformEntryRestoreFromBin.js +53 -0
  273. package/crud/contentEntry/useCases/RestoreEntryFromBin/TransformEntryRestoreFromBin.js.map +1 -0
  274. package/crud/contentEntry/useCases/RestoreEntryFromBin/index.d.ts +25 -0
  275. package/crud/contentEntry/useCases/RestoreEntryFromBin/index.js +24 -0
  276. package/crud/contentEntry/useCases/RestoreEntryFromBin/index.js.map +1 -0
  277. package/crud/contentEntry/useCases/index.d.ts +11 -0
  278. package/crud/contentEntry/useCases/index.js +128 -0
  279. package/crud/contentEntry/useCases/index.js.map +1 -0
  280. package/crud/contentEntry.crud.d.ts +6 -8
  281. package/crud/contentEntry.crud.js +304 -357
  282. package/crud/contentEntry.crud.js.map +1 -1
  283. package/crud/contentModel/beforeCreate.d.ts +2 -2
  284. package/crud/contentModel/beforeCreate.js.map +1 -1
  285. package/crud/contentModel/beforeDelete.d.ts +3 -5
  286. package/crud/contentModel/beforeDelete.js +49 -15
  287. package/crud/contentModel/beforeDelete.js.map +1 -1
  288. package/crud/contentModel/beforeUpdate.d.ts +2 -2
  289. package/crud/contentModel/beforeUpdate.js.map +1 -1
  290. package/crud/contentModel/compatibility/modelApiName.d.ts +1 -1
  291. package/crud/contentModel/compatibility/modelApiName.js.map +1 -1
  292. package/crud/contentModel/contentModelManagerFactory.d.ts +2 -2
  293. package/crud/contentModel/contentModelManagerFactory.js.map +1 -1
  294. package/crud/contentModel/createFieldStorageId.d.ts +1 -1
  295. package/crud/contentModel/createFieldStorageId.js.map +1 -1
  296. package/crud/contentModel/defaultFields.d.ts +1 -1
  297. package/crud/contentModel/defaultFields.js.map +1 -1
  298. package/crud/contentModel/ensureTypeTag.d.ts +1 -1
  299. package/crud/contentModel/ensureTypeTag.js.map +1 -1
  300. package/crud/contentModel/fields/descriptionField.d.ts +6 -2
  301. package/crud/contentModel/fields/descriptionField.js +14 -28
  302. package/crud/contentModel/fields/descriptionField.js.map +1 -1
  303. package/crud/contentModel/fields/getApplicableFieldById.d.ts +2 -0
  304. package/crud/contentModel/fields/getApplicableFieldById.js +15 -0
  305. package/crud/contentModel/fields/getApplicableFieldById.js.map +1 -0
  306. package/crud/contentModel/fields/imageField.d.ts +2 -2
  307. package/crud/contentModel/fields/imageField.js +9 -28
  308. package/crud/contentModel/fields/imageField.js.map +1 -1
  309. package/crud/contentModel/fields/titleField.d.ts +6 -2
  310. package/crud/contentModel/fields/titleField.js +14 -43
  311. package/crud/contentModel/fields/titleField.js.map +1 -1
  312. package/crud/contentModel/listModelsFromDatabase.d.ts +3 -3
  313. package/crud/contentModel/listModelsFromDatabase.js.map +1 -1
  314. package/crud/contentModel/validate/endingAllowed.d.ts +1 -1
  315. package/crud/contentModel/validate/endingAllowed.js.map +1 -1
  316. package/crud/contentModel/validate/isModelEndingAllowed.js +1 -2
  317. package/crud/contentModel/validate/isModelEndingAllowed.js.map +1 -1
  318. package/crud/contentModel/validate/modelId.d.ts +1 -1
  319. package/crud/contentModel/validate/modelId.js.map +1 -1
  320. package/crud/contentModel/validate/pluralApiName.d.ts +1 -1
  321. package/crud/contentModel/validate/pluralApiName.js.map +1 -1
  322. package/crud/contentModel/validate/singularApiName.d.ts +1 -1
  323. package/crud/contentModel/validate/singularApiName.js.map +1 -1
  324. package/crud/contentModel/validateModel.d.ts +1 -1
  325. package/crud/contentModel/validateModel.js.map +1 -1
  326. package/crud/contentModel/validateModelFields.d.ts +1 -1
  327. package/crud/contentModel/validateModelFields.js +1 -1
  328. package/crud/contentModel/validateModelFields.js.map +1 -1
  329. package/crud/contentModel/validateStorageId.d.ts +1 -0
  330. package/crud/contentModel/validateStorageId.js +19 -0
  331. package/crud/contentModel/validateStorageId.js.map +1 -0
  332. package/crud/contentModel/validation.d.ts +197 -176
  333. package/crud/contentModel/validation.js +5 -5
  334. package/crud/contentModel/validation.js.map +1 -1
  335. package/crud/contentModel.crud.d.ts +6 -6
  336. package/crud/contentModel.crud.js +76 -37
  337. package/crud/contentModel.crud.js.map +1 -1
  338. package/crud/contentModelGroup/beforeCreate.d.ts +3 -3
  339. package/crud/contentModelGroup/beforeCreate.js.map +1 -1
  340. package/crud/contentModelGroup/beforeDelete.d.ts +3 -3
  341. package/crud/contentModelGroup/beforeDelete.js.map +1 -1
  342. package/crud/contentModelGroup/beforeUpdate.d.ts +3 -3
  343. package/crud/contentModelGroup/beforeUpdate.js.map +1 -1
  344. package/crud/contentModelGroup/listGroupsFromDatabase.d.ts +1 -1
  345. package/crud/contentModelGroup/listGroupsFromDatabase.js.map +1 -1
  346. package/crud/contentModelGroup/validation.d.ts +1 -1
  347. package/crud/contentModelGroup/validation.js.map +1 -1
  348. package/crud/contentModelGroup.crud.d.ts +6 -6
  349. package/crud/contentModelGroup.crud.js +17 -28
  350. package/crud/contentModelGroup.crud.js.map +1 -1
  351. package/crud/system.crud.d.ts +4 -4
  352. package/crud/system.crud.js +10 -0
  353. package/crud/system.crud.js.map +1 -1
  354. package/export/crud/exporting.d.ts +2 -2
  355. package/export/crud/exporting.js.map +1 -1
  356. package/export/crud/importing.d.ts +2 -2
  357. package/export/crud/importing.js.map +1 -1
  358. package/export/crud/imports/importData.d.ts +2 -2
  359. package/export/crud/imports/importData.js.map +1 -1
  360. package/export/crud/imports/importGroups.d.ts +2 -2
  361. package/export/crud/imports/importGroups.js.map +1 -1
  362. package/export/crud/imports/importModels.d.ts +2 -2
  363. package/export/crud/imports/importModels.js.map +1 -1
  364. package/export/crud/imports/validateGroups.d.ts +2 -2
  365. package/export/crud/imports/validateGroups.js.map +1 -1
  366. package/export/crud/imports/validateInput.d.ts +2 -2
  367. package/export/crud/imports/validateInput.js.map +1 -1
  368. package/export/crud/imports/validateModels.d.ts +2 -2
  369. package/export/crud/imports/validateModels.js.map +1 -1
  370. package/export/crud/index.d.ts +1 -1
  371. package/export/crud/index.js.map +1 -1
  372. package/export/crud/sanitize.d.ts +3 -3
  373. package/export/crud/sanitize.js +2 -1
  374. package/export/crud/sanitize.js.map +1 -1
  375. package/export/graphql/index.d.ts +1 -1
  376. package/export/graphql/index.js +1 -1
  377. package/export/graphql/index.js.map +1 -1
  378. package/export/index.js.map +1 -1
  379. package/export/types.d.ts +5 -5
  380. package/export/types.js +1 -2
  381. package/export/types.js.map +1 -1
  382. package/fieldConverters/CmsModelDefaultFieldConverterPlugin.d.ts +5 -3
  383. package/fieldConverters/CmsModelDefaultFieldConverterPlugin.js.map +1 -1
  384. package/fieldConverters/CmsModelDynamicZoneFieldConverterPlugin.d.ts +3 -2
  385. package/fieldConverters/CmsModelDynamicZoneFieldConverterPlugin.js +23 -65
  386. package/fieldConverters/CmsModelDynamicZoneFieldConverterPlugin.js.map +1 -1
  387. package/fieldConverters/CmsModelObjectFieldConverterPlugin.d.ts +3 -2
  388. package/fieldConverters/CmsModelObjectFieldConverterPlugin.js +2 -2
  389. package/fieldConverters/CmsModelObjectFieldConverterPlugin.js.map +1 -1
  390. package/fieldConverters/index.d.ts +3 -0
  391. package/fieldConverters/index.js +4 -0
  392. package/fieldConverters/index.js.map +1 -1
  393. package/graphql/buildSchemaPlugins.d.ts +3 -3
  394. package/graphql/buildSchemaPlugins.js.map +1 -1
  395. package/graphql/checkEndpointAccess.d.ts +1 -1
  396. package/graphql/checkEndpointAccess.js.map +1 -1
  397. package/graphql/createExecutableSchema.d.ts +2 -2
  398. package/graphql/createExecutableSchema.js +14 -7
  399. package/graphql/createExecutableSchema.js.map +1 -1
  400. package/graphql/createRequestBody.d.ts +1 -1
  401. package/graphql/createRequestBody.js.map +1 -1
  402. package/graphql/formatErrorPayload.js.map +1 -1
  403. package/graphql/generateSchema.d.ts +2 -2
  404. package/graphql/generateSchema.js +6 -1
  405. package/graphql/generateSchema.js.map +1 -1
  406. package/graphql/getSchema/generateCacheId.d.ts +10 -0
  407. package/graphql/getSchema/generateCacheId.js +17 -0
  408. package/graphql/getSchema/generateCacheId.js.map +1 -0
  409. package/graphql/getSchema/generateCacheKey.d.ts +10 -0
  410. package/graphql/getSchema/generateCacheKey.js +34 -0
  411. package/graphql/getSchema/generateCacheKey.js.map +1 -0
  412. package/graphql/getSchema.d.ts +4 -4
  413. package/graphql/getSchema.js +13 -50
  414. package/graphql/getSchema.js.map +1 -1
  415. package/graphql/graphQLHandlerFactory.d.ts +2 -2
  416. package/graphql/graphQLHandlerFactory.js.map +1 -1
  417. package/graphql/handleRequest.d.ts +2 -2
  418. package/graphql/handleRequest.js +8 -1
  419. package/graphql/handleRequest.js.map +1 -1
  420. package/graphql/index.d.ts +4 -3
  421. package/graphql/index.js +1 -1
  422. package/graphql/index.js.map +1 -1
  423. package/graphql/scalars/RevisionId.d.ts +2 -0
  424. package/graphql/scalars/RevisionId.js +26 -0
  425. package/graphql/scalars/RevisionId.js.map +1 -0
  426. package/graphql/scalars/RevisionIdScalarPlugin.d.ts +2 -0
  427. package/graphql/scalars/RevisionIdScalarPlugin.js +18 -0
  428. package/graphql/scalars/RevisionIdScalarPlugin.js.map +1 -0
  429. package/graphql/schema/baseContentSchema.d.ts +3 -3
  430. package/graphql/schema/baseContentSchema.js +1 -7
  431. package/graphql/schema/baseContentSchema.js.map +1 -1
  432. package/graphql/schema/baseSchema.js +12 -5
  433. package/graphql/schema/baseSchema.js.map +1 -1
  434. package/graphql/schema/contentEntries.d.ts +3 -3
  435. package/graphql/schema/contentEntries.js +3 -4
  436. package/graphql/schema/contentEntries.js.map +1 -1
  437. package/graphql/schema/contentModelGroups.d.ts +3 -3
  438. package/graphql/schema/contentModelGroups.js +1 -1
  439. package/graphql/schema/contentModelGroups.js.map +1 -1
  440. package/graphql/schema/contentModels.d.ts +4 -5
  441. package/graphql/schema/contentModels.js +21 -5
  442. package/graphql/schema/contentModels.js.map +1 -1
  443. package/graphql/schema/createFieldResolvers.d.ts +2 -2
  444. package/graphql/schema/createFieldResolvers.js +1 -3
  445. package/graphql/schema/createFieldResolvers.js.map +1 -1
  446. package/graphql/schema/createFieldTypePluginRecords.d.ts +2 -2
  447. package/graphql/schema/createFieldTypePluginRecords.js.map +1 -1
  448. package/graphql/schema/createManageResolvers.d.ts +1 -2
  449. package/graphql/schema/createManageResolvers.js +24 -49
  450. package/graphql/schema/createManageResolvers.js.map +1 -1
  451. package/graphql/schema/createManageSDL.d.ts +2 -2
  452. package/graphql/schema/createManageSDL.js +14 -5
  453. package/graphql/schema/createManageSDL.js.map +1 -1
  454. package/graphql/schema/createPreviewResolvers.d.ts +1 -2
  455. package/graphql/schema/createPreviewResolvers.js +4 -7
  456. package/graphql/schema/createPreviewResolvers.js.map +1 -1
  457. package/graphql/schema/createReadResolvers.d.ts +1 -2
  458. package/graphql/schema/createReadResolvers.js +4 -7
  459. package/graphql/schema/createReadResolvers.js.map +1 -1
  460. package/graphql/schema/createReadSDL.d.ts +2 -2
  461. package/graphql/schema/createReadSDL.js +6 -7
  462. package/graphql/schema/createReadSDL.js.map +1 -1
  463. package/graphql/schema/createSingularResolvers.d.ts +12 -0
  464. package/graphql/schema/createSingularResolvers.js +56 -0
  465. package/graphql/schema/createSingularResolvers.js.map +1 -0
  466. package/graphql/schema/createSingularSDL.d.ts +12 -0
  467. package/graphql/schema/createSingularSDL.js +95 -0
  468. package/graphql/schema/createSingularSDL.js.map +1 -0
  469. package/graphql/schema/resolvers/manage/normalizeGraphQlInput.d.ts +7 -0
  470. package/graphql/schema/resolvers/manage/normalizeGraphQlInput.js +59 -0
  471. package/graphql/schema/resolvers/manage/normalizeGraphQlInput.js.map +1 -0
  472. package/graphql/schema/resolvers/manage/resolveCreate.d.ts +2 -2
  473. package/graphql/schema/resolvers/manage/resolveCreate.js.map +1 -1
  474. package/graphql/schema/resolvers/manage/resolveCreateFrom.d.ts +2 -2
  475. package/graphql/schema/resolvers/manage/resolveCreateFrom.js.map +1 -1
  476. package/graphql/schema/resolvers/manage/resolveDelete.d.ts +2 -2
  477. package/graphql/schema/resolvers/manage/resolveDelete.js +2 -1
  478. package/graphql/schema/resolvers/manage/resolveDelete.js.map +1 -1
  479. package/graphql/schema/resolvers/manage/resolveDeleteMultiple.d.ts +2 -2
  480. package/graphql/schema/resolvers/manage/resolveDeleteMultiple.js.map +1 -1
  481. package/graphql/schema/resolvers/manage/resolveGet.d.ts +2 -2
  482. package/graphql/schema/resolvers/manage/resolveGet.js.map +1 -1
  483. package/graphql/schema/resolvers/manage/resolveGetByIds.d.ts +2 -2
  484. package/graphql/schema/resolvers/manage/resolveGetByIds.js.map +1 -1
  485. package/graphql/schema/resolvers/manage/resolveGetRevisions.d.ts +2 -2
  486. package/graphql/schema/resolvers/manage/resolveGetRevisions.js.map +1 -1
  487. package/graphql/schema/resolvers/manage/resolveGetUniqueFieldValues.d.ts +2 -2
  488. package/graphql/schema/resolvers/manage/resolveGetUniqueFieldValues.js.map +1 -1
  489. package/graphql/schema/resolvers/manage/resolveList.d.ts +2 -2
  490. package/graphql/schema/resolvers/manage/resolveList.js.map +1 -1
  491. package/graphql/schema/resolvers/manage/resolveListDeleted.d.ts +4 -0
  492. package/graphql/schema/resolvers/manage/resolveListDeleted.js +20 -0
  493. package/graphql/schema/resolvers/manage/resolveListDeleted.js.map +1 -0
  494. package/graphql/schema/resolvers/manage/resolveMove.d.ts +2 -2
  495. package/graphql/schema/resolvers/manage/resolveMove.js.map +1 -1
  496. package/graphql/schema/resolvers/manage/resolvePublish.d.ts +2 -2
  497. package/graphql/schema/resolvers/manage/resolvePublish.js.map +1 -1
  498. package/graphql/schema/resolvers/manage/resolveRepublish.d.ts +2 -2
  499. package/graphql/schema/resolvers/manage/resolveRepublish.js.map +1 -1
  500. package/graphql/schema/resolvers/manage/resolveRestoreFromBin.d.ts +7 -0
  501. package/graphql/schema/resolvers/manage/resolveRestoreFromBin.js +20 -0
  502. package/graphql/schema/resolvers/manage/resolveRestoreFromBin.js.map +1 -0
  503. package/graphql/schema/resolvers/manage/resolveUnpublish.d.ts +2 -2
  504. package/graphql/schema/resolvers/manage/resolveUnpublish.js.map +1 -1
  505. package/graphql/schema/resolvers/manage/resolveUpdate.d.ts +2 -2
  506. package/graphql/schema/resolvers/manage/resolveUpdate.js.map +1 -1
  507. package/graphql/schema/resolvers/manage/resolveValidate.d.ts +2 -2
  508. package/graphql/schema/resolvers/manage/resolveValidate.js.map +1 -1
  509. package/graphql/schema/resolvers/preview/resolveGet.d.ts +2 -2
  510. package/graphql/schema/resolvers/preview/resolveGet.js.map +1 -1
  511. package/graphql/schema/resolvers/preview/resolveList.d.ts +2 -2
  512. package/graphql/schema/resolvers/preview/resolveList.js.map +1 -1
  513. package/graphql/schema/resolvers/read/resolveGet.d.ts +2 -2
  514. package/graphql/schema/resolvers/read/resolveGet.js.map +1 -1
  515. package/graphql/schema/resolvers/read/resolveList.d.ts +2 -2
  516. package/graphql/schema/resolvers/read/resolveList.js.map +1 -1
  517. package/graphql/schema/resolvers/singular/resolveGet.d.ts +7 -0
  518. package/graphql/schema/resolvers/singular/resolveGet.js +21 -0
  519. package/graphql/schema/resolvers/singular/resolveGet.js.map +1 -0
  520. package/graphql/schema/resolvers/singular/resolveUpdate.d.ts +8 -0
  521. package/graphql/schema/resolvers/singular/resolveUpdate.js +21 -0
  522. package/graphql/schema/resolvers/singular/resolveUpdate.js.map +1 -0
  523. package/graphql/schema/schemaPlugins.d.ts +3 -3
  524. package/graphql/schema/schemaPlugins.js +32 -11
  525. package/graphql/schema/schemaPlugins.js.map +1 -1
  526. package/graphql/system.d.ts +1 -1
  527. package/graphql/system.js +2 -1
  528. package/graphql/system.js.map +1 -1
  529. package/graphqlFields/boolean.d.ts +1 -1
  530. package/graphqlFields/boolean.js.map +1 -1
  531. package/graphqlFields/datetime.d.ts +1 -1
  532. package/graphqlFields/datetime.js.map +1 -1
  533. package/graphqlFields/dynamicZone/dynamicZoneField.d.ts +1 -1
  534. package/graphqlFields/dynamicZone/dynamicZoneField.js +62 -8
  535. package/graphqlFields/dynamicZone/dynamicZoneField.js.map +1 -1
  536. package/graphqlFields/dynamicZone/index.d.ts +0 -1
  537. package/graphqlFields/dynamicZone/index.js +0 -7
  538. package/graphqlFields/dynamicZone/index.js.map +1 -1
  539. package/graphqlFields/file.d.ts +1 -1
  540. package/graphqlFields/file.js.map +1 -1
  541. package/graphqlFields/helpers.d.ts +1 -1
  542. package/graphqlFields/helpers.js.map +1 -1
  543. package/graphqlFields/index.d.ts +1 -1
  544. package/graphqlFields/index.js +2 -1
  545. package/graphqlFields/index.js.map +1 -1
  546. package/graphqlFields/json.d.ts +1 -1
  547. package/graphqlFields/json.js.map +1 -1
  548. package/graphqlFields/longText.d.ts +1 -1
  549. package/graphqlFields/longText.js.map +1 -1
  550. package/graphqlFields/number.d.ts +1 -1
  551. package/graphqlFields/number.js.map +1 -1
  552. package/graphqlFields/object.d.ts +2 -2
  553. package/graphqlFields/object.js +14 -0
  554. package/graphqlFields/object.js.map +1 -1
  555. package/graphqlFields/ref.d.ts +1 -1
  556. package/graphqlFields/ref.js +1 -1
  557. package/graphqlFields/ref.js.map +1 -1
  558. package/graphqlFields/richText/RichTextPluginsProcessor.d.ts +2 -2
  559. package/graphqlFields/richText/RichTextPluginsProcessor.js.map +1 -1
  560. package/graphqlFields/richText/richTextResolver.d.ts +2 -2
  561. package/graphqlFields/richText/richTextResolver.js +4 -19
  562. package/graphqlFields/richText/richTextResolver.js.map +1 -1
  563. package/graphqlFields/richText.d.ts +1 -1
  564. package/graphqlFields/richText.js.map +1 -1
  565. package/graphqlFields/searchableJson.d.ts +2 -0
  566. package/graphqlFields/searchableJson.js +60 -0
  567. package/graphqlFields/searchableJson.js.map +1 -0
  568. package/graphqlFields/text.d.ts +1 -1
  569. package/graphqlFields/text.js.map +1 -1
  570. package/htmlRenderer/LexicalRenderer.d.ts +1 -1
  571. package/htmlRenderer/LexicalRenderer.js.map +1 -1
  572. package/htmlRenderer/createLexicalHTMLRenderer.js +1 -1
  573. package/htmlRenderer/createLexicalHTMLRenderer.js.map +1 -1
  574. package/index.d.ts +13 -7
  575. package/index.js +67 -7
  576. package/index.js.map +1 -1
  577. package/modelManager/DefaultCmsModelManager.d.ts +11 -10
  578. package/modelManager/DefaultCmsModelManager.js +16 -13
  579. package/modelManager/DefaultCmsModelManager.js.map +1 -1
  580. package/modelManager/SingletonModelManager.d.ts +12 -0
  581. package/modelManager/SingletonModelManager.js +48 -0
  582. package/modelManager/SingletonModelManager.js.map +1 -0
  583. package/modelManager/index.d.ts +2 -1
  584. package/modelManager/index.js +16 -1
  585. package/modelManager/index.js.map +1 -1
  586. package/package.json +37 -38
  587. package/parameters/context.js.map +1 -1
  588. package/parameters/header.js.map +1 -1
  589. package/parameters/index.js.map +1 -1
  590. package/parameters/manual.d.ts +2 -1
  591. package/parameters/manual.js.map +1 -1
  592. package/parameters/path.js.map +1 -1
  593. package/plugins/CmsGraphQLSchemaPlugin/CmsGraphQLSchemaPlugin.d.ts +9 -0
  594. package/plugins/{CmsGraphQLSchemaPlugin.js → CmsGraphQLSchemaPlugin/CmsGraphQLSchemaPlugin.js} +5 -1
  595. package/plugins/CmsGraphQLSchemaPlugin/CmsGraphQLSchemaPlugin.js.map +1 -0
  596. package/plugins/CmsGraphQLSchemaPlugin/index.d.ts +1 -0
  597. package/plugins/CmsGraphQLSchemaPlugin/index.js +18 -0
  598. package/plugins/CmsGraphQLSchemaPlugin/index.js.map +1 -0
  599. package/plugins/CmsGraphQLSchemaSorterPlugin.d.ts +1 -1
  600. package/plugins/CmsGraphQLSchemaSorterPlugin.js.map +1 -1
  601. package/plugins/CmsGroupPlugin.d.ts +9 -1
  602. package/plugins/CmsGroupPlugin.js +17 -1
  603. package/plugins/CmsGroupPlugin.js.map +1 -1
  604. package/plugins/CmsModelFieldConverterPlugin.d.ts +5 -2
  605. package/plugins/CmsModelFieldConverterPlugin.js +4 -0
  606. package/plugins/CmsModelFieldConverterPlugin.js.map +1 -1
  607. package/plugins/CmsModelPlugin.d.ts +30 -10
  608. package/plugins/CmsModelPlugin.js +101 -19
  609. package/plugins/CmsModelPlugin.js.map +1 -1
  610. package/plugins/CmsParametersPlugin.d.ts +3 -3
  611. package/plugins/CmsParametersPlugin.js.map +1 -1
  612. package/plugins/CmsRichTextRendererPlugin.d.ts +6 -6
  613. package/plugins/CmsRichTextRendererPlugin.js.map +1 -1
  614. package/plugins/StorageOperationsCmsModelPlugin.d.ts +1 -1
  615. package/plugins/StorageOperationsCmsModelPlugin.js.map +1 -1
  616. package/plugins/StorageTransformPlugin.d.ts +6 -2
  617. package/plugins/StorageTransformPlugin.js +9 -1
  618. package/plugins/StorageTransformPlugin.js.map +1 -1
  619. package/plugins/index.js.map +1 -1
  620. package/storage/date.d.ts +3 -0
  621. package/storage/date.js +119 -0
  622. package/storage/date.js.map +1 -0
  623. package/storage/default.js.map +1 -1
  624. package/storage/dynamicZone.d.ts +2 -0
  625. package/storage/dynamicZone.js +157 -0
  626. package/storage/dynamicZone.js.map +1 -0
  627. package/storage/index.js +7 -1
  628. package/storage/index.js.map +1 -1
  629. package/storage/json.js +34 -5
  630. package/storage/json.js.map +1 -1
  631. package/storage/object.js +16 -12
  632. package/storage/object.js.map +1 -1
  633. package/types/context.d.ts +146 -0
  634. package/types/context.js +7 -0
  635. package/types/context.js.map +1 -0
  636. package/types/fields/dynamicZoneField.d.ts +23 -0
  637. package/types/fields/dynamicZoneField.js +7 -0
  638. package/types/fields/dynamicZoneField.js.map +1 -0
  639. package/types/fields/objectField.d.ts +13 -0
  640. package/types/fields/objectField.js +7 -0
  641. package/types/fields/objectField.js.map +1 -0
  642. package/types/identity.d.ts +19 -0
  643. package/types/identity.js +7 -0
  644. package/types/identity.js.map +1 -0
  645. package/types/index.d.ts +10 -0
  646. package/types/index.js +117 -0
  647. package/types/index.js.map +1 -0
  648. package/types/model.d.ts +199 -0
  649. package/types/model.js +7 -0
  650. package/types/model.js.map +1 -0
  651. package/types/modelAst.d.ts +39 -0
  652. package/types/modelAst.js +7 -0
  653. package/types/modelAst.js.map +1 -0
  654. package/types/modelField.d.ts +330 -0
  655. package/types/modelField.js +7 -0
  656. package/types/modelField.js.map +1 -0
  657. package/types/modelGroup.d.ts +77 -0
  658. package/types/modelGroup.js +7 -0
  659. package/types/modelGroup.js.map +1 -0
  660. package/types/plugins.d.ts +365 -0
  661. package/types/plugins.js +7 -0
  662. package/types/plugins.js.map +1 -0
  663. package/{types.d.ts → types/types.d.ts} +295 -1215
  664. package/{types.js → types/types.js} +18 -119
  665. package/types/types.js.map +1 -0
  666. package/utils/RichTextRenderer.d.ts +10 -0
  667. package/utils/RichTextRenderer.js +33 -0
  668. package/utils/RichTextRenderer.js.map +1 -0
  669. package/utils/caching/Cache.d.ts +5 -2
  670. package/utils/caching/Cache.js +4 -7
  671. package/utils/caching/Cache.js.map +1 -1
  672. package/utils/caching/CacheKey.d.ts +2 -1
  673. package/utils/caching/CacheKey.js +5 -17
  674. package/utils/caching/CacheKey.js.map +1 -1
  675. package/utils/caching/index.js.map +1 -1
  676. package/utils/caching/types.d.ts +3 -1
  677. package/utils/caching/types.js +7 -0
  678. package/utils/caching/types.js.map +1 -1
  679. package/utils/contentEntryTraverser/ContentEntryTraverser.d.ts +13 -0
  680. package/utils/contentEntryTraverser/ContentEntryTraverser.js +97 -0
  681. package/utils/contentEntryTraverser/ContentEntryTraverser.js.map +1 -0
  682. package/utils/contentModelAst/CmsModelFieldToAstConverterFromPlugins.d.ts +6 -0
  683. package/utils/contentModelAst/CmsModelFieldToAstConverterFromPlugins.js +23 -0
  684. package/utils/contentModelAst/CmsModelFieldToAstConverterFromPlugins.js.map +1 -0
  685. package/utils/contentModelAst/CmsModelFieldToAstFromPlugin.d.ts +7 -0
  686. package/utils/contentModelAst/CmsModelFieldToAstFromPlugin.js +22 -0
  687. package/utils/contentModelAst/CmsModelFieldToAstFromPlugin.js.map +1 -0
  688. package/utils/contentModelAst/CmsModelToAstConverter.d.ts +11 -0
  689. package/utils/contentModelAst/CmsModelToAstConverter.js +28 -0
  690. package/utils/contentModelAst/CmsModelToAstConverter.js.map +1 -0
  691. package/utils/contentModelAst/index.d.ts +3 -0
  692. package/utils/contentModelAst/index.js +40 -0
  693. package/utils/contentModelAst/index.js.map +1 -0
  694. package/utils/converters/Converter.d.ts +3 -3
  695. package/utils/converters/Converter.js.map +1 -1
  696. package/utils/converters/ConverterCollection.d.ts +2 -2
  697. package/utils/converters/ConverterCollection.js.map +1 -1
  698. package/utils/converters/valueKeyStorageConverter.d.ts +3 -3
  699. package/utils/converters/valueKeyStorageConverter.js.map +1 -1
  700. package/utils/createModelField.d.ts +7 -0
  701. package/utils/createModelField.js +51 -0
  702. package/utils/createModelField.js.map +1 -0
  703. package/utils/createTypeFromFields.d.ts +1 -1
  704. package/utils/createTypeFromFields.js.map +1 -1
  705. package/utils/createTypeName.js.map +1 -1
  706. package/utils/date.js.map +1 -1
  707. package/utils/entryStorage.d.ts +13 -1
  708. package/utils/entryStorage.js +37 -3
  709. package/utils/entryStorage.js.map +1 -1
  710. package/utils/filterAsync.js.map +1 -1
  711. package/utils/getBaseFieldType.d.ts +1 -1
  712. package/utils/getBaseFieldType.js.map +1 -1
  713. package/utils/getEntryDescription.d.ts +1 -1
  714. package/utils/getEntryDescription.js.map +1 -1
  715. package/utils/getEntryImage.d.ts +1 -1
  716. package/utils/getEntryImage.js.map +1 -1
  717. package/utils/getEntryTitle.d.ts +1 -1
  718. package/utils/getEntryTitle.js.map +1 -1
  719. package/utils/getSchemaFromFieldPlugins.d.ts +6 -6
  720. package/utils/getSchemaFromFieldPlugins.js +5 -4
  721. package/utils/getSchemaFromFieldPlugins.js.map +1 -1
  722. package/utils/identity.d.ts +1 -1
  723. package/utils/identity.js.map +1 -1
  724. package/utils/incrementEntryIdVersion.js.map +1 -1
  725. package/utils/index.d.ts +1 -0
  726. package/utils/index.js +11 -0
  727. package/utils/index.js.map +1 -1
  728. package/utils/isHeadlessCmsReady.d.ts +2 -0
  729. package/utils/isHeadlessCmsReady.js +23 -0
  730. package/utils/isHeadlessCmsReady.js.map +1 -0
  731. package/utils/modelFieldTraverser/ModelFieldTraverser.d.ts +16 -0
  732. package/utils/modelFieldTraverser/ModelFieldTraverser.js +41 -0
  733. package/utils/modelFieldTraverser/ModelFieldTraverser.js.map +1 -0
  734. package/utils/modelFieldTraverser/index.d.ts +1 -0
  735. package/utils/modelFieldTraverser/index.js +18 -0
  736. package/utils/modelFieldTraverser/index.js.map +1 -0
  737. package/utils/renderFields.d.ts +1 -1
  738. package/utils/renderFields.js +2 -0
  739. package/utils/renderFields.js.map +1 -1
  740. package/utils/renderGetFilterFields.d.ts +1 -1
  741. package/utils/renderGetFilterFields.js.map +1 -1
  742. package/utils/renderInputFields.d.ts +1 -1
  743. package/utils/renderInputFields.js.map +1 -1
  744. package/utils/renderListFilterFields.d.ts +1 -1
  745. package/utils/renderListFilterFields.js.map +1 -1
  746. package/utils/renderSortEnum.d.ts +2 -2
  747. package/utils/renderSortEnum.js.map +1 -1
  748. package/utils/toSlug.js.map +1 -1
  749. package/validators/dateGte.d.ts +1 -1
  750. package/validators/dateGte.js.map +1 -1
  751. package/validators/dateLte.d.ts +1 -1
  752. package/validators/dateLte.js.map +1 -1
  753. package/validators/gte.d.ts +1 -1
  754. package/validators/gte.js.map +1 -1
  755. package/validators/in.d.ts +1 -1
  756. package/validators/in.js.map +1 -1
  757. package/validators/index.js.map +1 -1
  758. package/validators/lte.d.ts +1 -1
  759. package/validators/lte.js.map +1 -1
  760. package/validators/maxLength.d.ts +1 -1
  761. package/validators/maxLength.js.map +1 -1
  762. package/validators/minLength.d.ts +1 -1
  763. package/validators/minLength.js.map +1 -1
  764. package/validators/pattern.d.ts +1 -1
  765. package/validators/pattern.js.map +1 -1
  766. package/validators/patternPlugins/email.d.ts +1 -1
  767. package/validators/patternPlugins/email.js +1 -1
  768. package/validators/patternPlugins/email.js.map +1 -1
  769. package/validators/patternPlugins/index.d.ts +1 -1
  770. package/validators/patternPlugins/index.js.map +1 -1
  771. package/validators/patternPlugins/lowerCase.d.ts +1 -1
  772. package/validators/patternPlugins/lowerCase.js.map +1 -1
  773. package/validators/patternPlugins/lowerCaseSpace.d.ts +1 -1
  774. package/validators/patternPlugins/lowerCaseSpace.js.map +1 -1
  775. package/validators/patternPlugins/upperCase.d.ts +1 -1
  776. package/validators/patternPlugins/upperCase.js.map +1 -1
  777. package/validators/patternPlugins/upperCaseSpace.d.ts +1 -1
  778. package/validators/patternPlugins/upperCaseSpace.js.map +1 -1
  779. package/validators/patternPlugins/url.d.ts +1 -1
  780. package/validators/patternPlugins/url.js.map +1 -1
  781. package/validators/required.d.ts +1 -1
  782. package/validators/required.js.map +1 -1
  783. package/validators/timeGte.d.ts +1 -1
  784. package/validators/timeGte.js.map +1 -1
  785. package/validators/timeLte.d.ts +1 -1
  786. package/validators/timeLte.js.map +1 -1
  787. package/validators/unique.d.ts +1 -1
  788. package/validators/unique.js.map +1 -1
  789. package/graphqlFields/dynamicZone/dynamicZoneStorage.d.ts +0 -3
  790. package/graphqlFields/dynamicZone/dynamicZoneStorage.js +0 -111
  791. package/graphqlFields/dynamicZone/dynamicZoneStorage.js.map +0 -1
  792. package/plugins/CmsGraphQLSchemaPlugin.d.ts +0 -5
  793. package/plugins/CmsGraphQLSchemaPlugin.js.map +0 -1
  794. package/types.js.map +0 -1
  795. package/utils/access.d.ts +0 -9
  796. package/utils/access.js +0 -26
  797. package/utils/access.js.map +0 -1
  798. package/utils/permissions/EntriesPermissions.d.ts +0 -4
  799. package/utils/permissions/EntriesPermissions.js +0 -11
  800. package/utils/permissions/EntriesPermissions.js.map +0 -1
  801. package/utils/permissions/ModelGroupsPermissions.d.ts +0 -9
  802. package/utils/permissions/ModelGroupsPermissions.js +0 -50
  803. package/utils/permissions/ModelGroupsPermissions.js.map +0 -1
  804. package/utils/permissions/ModelsPermissions.d.ts +0 -22
  805. package/utils/permissions/ModelsPermissions.js +0 -90
  806. package/utils/permissions/ModelsPermissions.js.map +0 -1
@@ -0,0 +1,97 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.ContentEntryTraverser = void 0;
7
+ const nodeHasChildren = node => {
8
+ return node.children.length > 0;
9
+ };
10
+ const childrenAreCollections = node => {
11
+ return node.children.every(node => node.type === "collection");
12
+ };
13
+ const emptyValues = [null, undefined];
14
+ class ContentEntryTraverser {
15
+ constructor(modelAst) {
16
+ this.modelAst = modelAst;
17
+ }
18
+ async traverse(values, visitor) {
19
+ await this.visitTree(this.modelAst, values, [], visitor);
20
+ }
21
+ async visitTree(root, values, path, visitor) {
22
+ for (const node of root.children) {
23
+ const context = {
24
+ node,
25
+ parent: root
26
+ };
27
+ const field = this.getFieldFromNode(context);
28
+ let value = values[field.fieldId];
29
+
30
+ // We do not descend into nodes if they're `null` or `undefined`.
31
+ if (nodeHasChildren(node) && emptyValues.includes(value)) {
32
+ continue;
33
+ }
34
+
35
+ // We do not visit leaf nodes that are `undefined`.
36
+ if (!nodeHasChildren(node) && value === undefined) {
37
+ continue;
38
+ }
39
+ const fieldPath = [...path, field.fieldId];
40
+ await visitor({
41
+ field,
42
+ value,
43
+ path: fieldPath.join(".")
44
+ }, context);
45
+
46
+ // Refetch the value from the original input, in case the value changed within the visitor.
47
+ value = values[field.fieldId];
48
+ if (nodeHasChildren(node) && childrenAreCollections(node)) {
49
+ if (field.multipleValues) {
50
+ const arrayValue = this.ensureArray(value);
51
+ for (let i = 0; i < arrayValue.length; i++) {
52
+ await this.findCollectionAndVisit(node, arrayValue[i], [...fieldPath, i.toString()], visitor);
53
+ }
54
+ } else {
55
+ await this.findCollectionAndVisit(node, value, fieldPath, visitor);
56
+ }
57
+ continue;
58
+ }
59
+ if (field.multipleValues) {
60
+ const arrayValue = this.ensureArray(value);
61
+ for (let i = 0; i < arrayValue.length; i++) {
62
+ await this.visitTree(node, arrayValue[i], [...fieldPath, i.toString()], visitor);
63
+ }
64
+ continue;
65
+ }
66
+ await this.visitTree(node, value, fieldPath, visitor);
67
+ }
68
+ }
69
+ ensureArray(value) {
70
+ if (!Array.isArray(value)) {
71
+ return [];
72
+ }
73
+ return value;
74
+ }
75
+ findCollectionAndVisit(node, values, path, visitor) {
76
+ const collection = node.children.find(child => {
77
+ // Use the `discriminator` to find the correct value.
78
+ return values[child.collection.discriminator] === child.collection.id;
79
+ });
80
+ if (!collection) {
81
+ return;
82
+ }
83
+ return this.visitTree(collection, values, path, visitor);
84
+ }
85
+ getFieldFromNode({
86
+ node,
87
+ parent
88
+ }) {
89
+ if (node.type === "collection") {
90
+ return parent.field;
91
+ }
92
+ return node.field;
93
+ }
94
+ }
95
+ exports.ContentEntryTraverser = ContentEntryTraverser;
96
+
97
+ //# sourceMappingURL=ContentEntryTraverser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["nodeHasChildren","node","children","length","childrenAreCollections","every","type","emptyValues","undefined","ContentEntryTraverser","constructor","modelAst","traverse","values","visitor","visitTree","root","path","context","parent","field","getFieldFromNode","value","fieldId","includes","fieldPath","join","multipleValues","arrayValue","ensureArray","i","findCollectionAndVisit","toString","Array","isArray","collection","find","child","discriminator","id","exports"],"sources":["ContentEntryTraverser.ts"],"sourcesContent":["import type {\n CmsModelAst,\n CmsModelFieldAstNodeField,\n CmsModelFieldAstNode,\n ContentEntryValueVisitor,\n CmsModelFieldAstNodeCollection,\n CmsEntryValues\n} from \"~/types\";\n\ntype ParentNode = CmsModelAst | CmsModelFieldAstNode | null;\n\ntype VisitorContext = {\n node: CmsModelFieldAstNode;\n parent: ParentNode;\n};\n\nconst nodeHasChildren = (node: CmsModelFieldAstNode) => {\n return node.children.length > 0;\n};\n\ninterface NodeWithCollections extends CmsModelFieldAstNodeField {\n children: CmsModelFieldAstNodeCollection[];\n}\n\nconst childrenAreCollections = (node: CmsModelFieldAstNode): node is NodeWithCollections => {\n return node.children.every(node => node.type === \"collection\");\n};\n\nconst emptyValues = [null, undefined];\n\nexport interface IContentEntryTraverser {\n traverse(values: CmsEntryValues, visitor: ContentEntryValueVisitor): Promise<void>;\n}\n\nexport class ContentEntryTraverser implements IContentEntryTraverser {\n private readonly modelAst: CmsModelAst;\n\n constructor(modelAst: CmsModelAst) {\n this.modelAst = modelAst;\n }\n\n async traverse(values: CmsEntryValues, visitor: ContentEntryValueVisitor) {\n await this.visitTree(this.modelAst, values, [], visitor);\n }\n\n private async visitTree(\n root: CmsModelAst | CmsModelFieldAstNode,\n values: CmsEntryValues,\n path: string[],\n visitor: ContentEntryValueVisitor\n ) {\n for (const node of root.children) {\n const context: VisitorContext = { node, parent: root };\n const field = this.getFieldFromNode(context);\n let value = values[field.fieldId];\n\n // We do not descend into nodes if they're `null` or `undefined`.\n if (nodeHasChildren(node) && emptyValues.includes(value)) {\n continue;\n }\n\n // We do not visit leaf nodes that are `undefined`.\n if (!nodeHasChildren(node) && value === undefined) {\n continue;\n }\n\n const fieldPath = [...path, field.fieldId];\n\n await visitor(\n {\n field,\n value,\n path: fieldPath.join(\".\")\n },\n context\n );\n\n // Refetch the value from the original input, in case the value changed within the visitor.\n value = values[field.fieldId];\n\n if (nodeHasChildren(node) && childrenAreCollections(node)) {\n if (field.multipleValues) {\n const arrayValue = this.ensureArray(value);\n for (let i = 0; i < arrayValue.length; i++) {\n await this.findCollectionAndVisit(\n node,\n arrayValue[i],\n [...fieldPath, i.toString()],\n visitor\n );\n }\n } else {\n await this.findCollectionAndVisit(node, value, fieldPath, visitor);\n }\n continue;\n }\n\n if (field.multipleValues) {\n const arrayValue = this.ensureArray(value);\n for (let i = 0; i < arrayValue.length; i++) {\n await this.visitTree(\n node,\n arrayValue[i],\n [...fieldPath, i.toString()],\n visitor\n );\n }\n continue;\n }\n\n await this.visitTree(node, value, fieldPath, visitor);\n }\n }\n\n private ensureArray(value: any) {\n if (!Array.isArray(value)) {\n return [];\n }\n\n return value;\n }\n\n private findCollectionAndVisit(\n node: NodeWithCollections,\n values: CmsEntryValues,\n path: string[],\n visitor: ContentEntryValueVisitor\n ) {\n const collection = node.children.find(child => {\n // Use the `discriminator` to find the correct value.\n return values[child.collection.discriminator] === child.collection.id;\n });\n\n if (!collection) {\n return;\n }\n\n return this.visitTree(collection, values, path, visitor);\n }\n\n private getFieldFromNode({ node, parent }: VisitorContext) {\n if (node.type === \"collection\") {\n return (parent as CmsModelFieldAstNodeField).field;\n }\n\n return (node as CmsModelFieldAstNodeField).field;\n }\n}\n"],"mappings":";;;;;;AAgBA,MAAMA,eAAe,GAAIC,IAA0B,IAAK;EACpD,OAAOA,IAAI,CAACC,QAAQ,CAACC,MAAM,GAAG,C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,CAACZ,KAAK,CAAC,EAAE;MACvB,OAAO,EAAE;IACb;IAEA,OAAOA,KAAK;EAChB;EAEQS,sBAAsBA,CAC1B9B,IAAyB,EACzBY,MAAsB,EACtBI,IAAc,EACdH,OAAiC,EACnC;IACE,MAAMqB,UAAU,GAAGlC,IAAI,CAACC,QAAQ,CAACkC,IAAI,CAACC,KAAK,IAAI;MAC3C;MACA,OAAOxB,MAAM,CAACwB,KAAK,CAACF,UAAU,CAACG,aAAa,CAAC,KAAKD,KAAK,CAACF,UAAU,CAACI,EAAE;IACzE,CAAC,CAAC;IAEF,IAAI,CAACJ,UAAU,EAAE;MACb;IACJ;IAEA,OAAO,IAAI,CAACpB,SAAS,CAACoB,UAAU,EAAEtB,MAAM,EAAEI,IAAI,EAAEH,OAAO,CAAC;EAC5D;EAEQO,gBAAgBA,CAAC;IAAEpB,IAAI;IAAEkB;EAAuB,CAAC,EAAE;IACvD,IAAIlB,IAAI,CAACK,IAAI,KAAK,YAAY,EAAE;MAC5B,OAAQa,MAAM,CAA+BC,KAAK;IACtD;IAEA,OAAQnB,IAAI,CAA+BmB,KAAK;EACpD;AACJ;AAACoB,OAAA,CAAA/B,qBAAA,GAAAA,qBAAA","ignoreList":[]}
@@ -0,0 +1,6 @@
1
+ import type { CmsModelField, CmsModelFieldToGraphQLPlugin, ICmsModelFieldToAst } from "../../types";
2
+ export declare class CmsModelFieldToAstConverterFromPlugins implements ICmsModelFieldToAst {
3
+ private converters;
4
+ constructor(plugins: CmsModelFieldToGraphQLPlugin[]);
5
+ toAst(field: CmsModelField): import("../../types").CmsModelFieldAstNode;
6
+ }
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.CmsModelFieldToAstConverterFromPlugins = void 0;
7
+ var _CmsModelFieldToAstFromPlugin = require("./CmsModelFieldToAstFromPlugin");
8
+ class CmsModelFieldToAstConverterFromPlugins {
9
+ constructor(plugins) {
10
+ this.converters = plugins.reduce((converters, plugin) => {
11
+ return {
12
+ ...converters,
13
+ [plugin.fieldType]: new _CmsModelFieldToAstFromPlugin.CmsModelFieldToAstFromPlugin(plugin, this)
14
+ };
15
+ }, {});
16
+ }
17
+ toAst(field) {
18
+ return this.converters[field.type].toAst(field);
19
+ }
20
+ }
21
+ exports.CmsModelFieldToAstConverterFromPlugins = CmsModelFieldToAstConverterFromPlugins;
22
+
23
+ //# sourceMappingURL=CmsModelFieldToAstConverterFromPlugins.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_CmsModelFieldToAstFromPlugin","require","CmsModelFieldToAstConverterFromPlugins","constructor","plugins","converters","reduce","plugin","fieldType","CmsModelFieldToAstFromPlugin","toAst","field","type","exports"],"sources":["CmsModelFieldToAstConverterFromPlugins.ts"],"sourcesContent":["import type { CmsModelField, CmsModelFieldToGraphQLPlugin, ICmsModelFieldToAst } from \"~/types\";\nimport { CmsModelFieldToAstFromPlugin } from \"./CmsModelFieldToAstFromPlugin\";\n\ntype FieldToAstConverters = Record<string, ICmsModelFieldToAst>;\n\nexport class CmsModelFieldToAstConverterFromPlugins implements ICmsModelFieldToAst {\n private converters: FieldToAstConverters;\n\n constructor(plugins: CmsModelFieldToGraphQLPlugin[]) {\n this.converters = plugins.reduce<FieldToAstConverters>((converters, plugin) => {\n return {\n ...converters,\n [plugin.fieldType]: new CmsModelFieldToAstFromPlugin(plugin, this)\n };\n }, {});\n }\n\n toAst(field: CmsModelField) {\n return this.converters[field.type].toAst(field);\n }\n}\n"],"mappings":";;;;;;AACA,IAAAA,6BAAA,GAAAC,OAAA;AAIO,MAAMC,sCAAsC,CAAgC;EAG/EC,WAAWA,CAACC,OAAuC,EAAE;IACjD,IAAI,CAACC,UAAU,GAAGD,OAAO,CAACE,MAAM,CAAuB,CAACD,UAAU,EAAEE,MAAM,KAAK;MAC3E,OAAO;QACH,GAAGF,UAAU;QACb,CAACE,MAAM,CAACC,SAAS,GAAG,IAAIC,0DAA4B,CAACF,MAAM,EAAE,IAAI;MACrE,CAAC;IACL,CAAC,EAAE,CAAC,CAAC,CAAC;EACV;EAEAG,KAAKA,CAACC,KAAoB,EAAE;IACxB,OAAO,IAAI,CAACN,UAAU,CAACM,KAAK,CAACC,IAAI,CAAC,CAACF,KAAK,CAACC,KAAK,CAAC;EACnD;AACJ;AAACE,OAAA,CAAAX,sCAAA,GAAAA,sCAAA","ignoreList":[]}
@@ -0,0 +1,7 @@
1
+ import type { CmsModelField, CmsModelFieldAstNode, CmsModelFieldToGraphQLPlugin, ICmsModelFieldToAst } from "../../types";
2
+ export declare class CmsModelFieldToAstFromPlugin implements ICmsModelFieldToAst {
3
+ private readonly converter;
4
+ private plugin;
5
+ constructor(plugin: CmsModelFieldToGraphQLPlugin, converter: ICmsModelFieldToAst);
6
+ toAst(field: CmsModelField): CmsModelFieldAstNode;
7
+ }
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.CmsModelFieldToAstFromPlugin = void 0;
7
+ class CmsModelFieldToAstFromPlugin {
8
+ constructor(plugin, converter) {
9
+ this.converter = converter;
10
+ this.plugin = plugin;
11
+ }
12
+ toAst(field) {
13
+ return this.plugin.getFieldAst ? this.plugin.getFieldAst(field, this.converter) : {
14
+ type: "field",
15
+ field,
16
+ children: []
17
+ };
18
+ }
19
+ }
20
+ exports.CmsModelFieldToAstFromPlugin = CmsModelFieldToAstFromPlugin;
21
+
22
+ //# sourceMappingURL=CmsModelFieldToAstFromPlugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["CmsModelFieldToAstFromPlugin","constructor","plugin","converter","toAst","field","getFieldAst","type","children","exports"],"sources":["CmsModelFieldToAstFromPlugin.ts"],"sourcesContent":["import type {\n CmsModelField,\n CmsModelFieldAstNode,\n CmsModelFieldToGraphQLPlugin,\n ICmsModelFieldToAst\n} from \"~/types\";\n\nexport class CmsModelFieldToAstFromPlugin implements ICmsModelFieldToAst {\n private readonly converter: ICmsModelFieldToAst;\n private plugin: CmsModelFieldToGraphQLPlugin;\n\n constructor(plugin: CmsModelFieldToGraphQLPlugin, converter: ICmsModelFieldToAst) {\n this.converter = converter;\n this.plugin = plugin;\n }\n\n toAst(field: CmsModelField): CmsModelFieldAstNode {\n return this.plugin.getFieldAst\n ? this.plugin.getFieldAst(field, this.converter)\n : { type: \"field\", field, children: [] };\n }\n}\n"],"mappings":";;;;;;AAOO,MAAMA,4BAA4B,CAAgC;EAIrEC,WAAWA,CAACC,MAAoC,EAAEC,SAA8B,EAAE;IAC9E,IAAI,CAACA,SAAS,GAAGA,SAAS;IAC1B,IAAI,CAACD,MAAM,GAAGA,MAAM;EACxB;EAEAE,KAAKA,CAACC,KAAoB,EAAwB;IAC9C,OAAO,IAAI,CAACH,MAAM,CAACI,WAAW,GACxB,IAAI,CAACJ,MAAM,CAACI,WAAW,CAACD,KAAK,EAAE,IAAI,CAACF,SAAS,CAAC,GAC9C;MAAEI,IAAI,EAAE,OAAO;MAAEF,KAAK;MAAEG,QAAQ,EAAE;IAAG,CAAC;EAChD;AACJ;AAACC,OAAA,CAAAT,4BAAA,GAAAA,4BAAA","ignoreList":[]}
@@ -0,0 +1,11 @@
1
+ import type { CmsModel, CmsModelAst, ICmsModelFieldToAst } from "../../types";
2
+ /**
3
+ * The purpose of this class is to convert the given CmsModel to an AST, which is easier to traverse programmatically.
4
+ * Using this, we can get information about the structure of the model fields, without understanding how each
5
+ * individual model field stores its internal data. This is particularly useful for fields like `dynamicZone` and `object`.
6
+ */
7
+ export declare class CmsModelToAstConverter {
8
+ private readonly fieldToAstConverter;
9
+ constructor(fieldToAstConverter: ICmsModelFieldToAst);
10
+ toAst(model: Pick<CmsModel, "fields">): CmsModelAst;
11
+ }
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.CmsModelToAstConverter = void 0;
7
+ /**
8
+ * The purpose of this class is to convert the given CmsModel to an AST, which is easier to traverse programmatically.
9
+ * Using this, we can get information about the structure of the model fields, without understanding how each
10
+ * individual model field stores its internal data. This is particularly useful for fields like `dynamicZone` and `object`.
11
+ */
12
+
13
+ class CmsModelToAstConverter {
14
+ constructor(fieldToAstConverter) {
15
+ this.fieldToAstConverter = fieldToAstConverter;
16
+ }
17
+ toAst(model) {
18
+ return {
19
+ type: "root",
20
+ children: model.fields.reduce((ast, field) => {
21
+ return [...ast, this.fieldToAstConverter.toAst(field)];
22
+ }, [])
23
+ };
24
+ }
25
+ }
26
+ exports.CmsModelToAstConverter = CmsModelToAstConverter;
27
+
28
+ //# sourceMappingURL=CmsModelToAstConverter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["CmsModelToAstConverter","constructor","fieldToAstConverter","toAst","model","type","children","fields","reduce","ast","field","exports"],"sources":["CmsModelToAstConverter.ts"],"sourcesContent":["import type { CmsModel, CmsModelAst, CmsModelFieldAstNode, ICmsModelFieldToAst } from \"~/types\";\n\n/**\n * The purpose of this class is to convert the given CmsModel to an AST, which is easier to traverse programmatically.\n * Using this, we can get information about the structure of the model fields, without understanding how each\n * individual model field stores its internal data. This is particularly useful for fields like `dynamicZone` and `object`.\n */\n\nexport class CmsModelToAstConverter {\n private readonly fieldToAstConverter: ICmsModelFieldToAst;\n\n public constructor(fieldToAstConverter: ICmsModelFieldToAst) {\n this.fieldToAstConverter = fieldToAstConverter;\n }\n\n public toAst(model: Pick<CmsModel, \"fields\">): CmsModelAst {\n return {\n type: \"root\",\n children: model.fields.reduce<CmsModelFieldAstNode[]>((ast, field) => {\n return [...ast, this.fieldToAstConverter.toAst(field)];\n }, [])\n };\n }\n}\n"],"mappings":";;;;;;AAEA;AACA;AACA;AACA;AACA;;AAEO,MAAMA,sBAAsB,CAAC;EAGzBC,WAAWA,CAACC,mBAAwC,EAAE;IACzD,IAAI,CAACA,mBAAmB,GAAGA,mBAAmB;EAClD;EAEOC,KAAKA,CAACC,KAA+B,EAAe;IACvD,OAAO;MACHC,IAAI,EAAE,MAAM;MACZC,QAAQ,EAAEF,KAAK,CAACG,MAAM,CAACC,MAAM,CAAyB,CAACC,GAAG,EAAEC,KAAK,KAAK;QAClE,OAAO,CAAC,GAAGD,GAAG,EAAE,IAAI,CAACP,mBAAmB,CAACC,KAAK,CAACO,KAAK,CAAC,CAAC;MAC1D,CAAC,EAAE,EAAE;IACT,CAAC;EACL;AACJ;AAACC,OAAA,CAAAX,sBAAA,GAAAA,sBAAA","ignoreList":[]}
@@ -0,0 +1,3 @@
1
+ export * from "./CmsModelFieldToAstFromPlugin";
2
+ export * from "./CmsModelFieldToAstConverterFromPlugins";
3
+ export * from "./CmsModelToAstConverter";
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ var _CmsModelFieldToAstFromPlugin = require("./CmsModelFieldToAstFromPlugin");
7
+ Object.keys(_CmsModelFieldToAstFromPlugin).forEach(function (key) {
8
+ if (key === "default" || key === "__esModule") return;
9
+ if (key in exports && exports[key] === _CmsModelFieldToAstFromPlugin[key]) return;
10
+ Object.defineProperty(exports, key, {
11
+ enumerable: true,
12
+ get: function () {
13
+ return _CmsModelFieldToAstFromPlugin[key];
14
+ }
15
+ });
16
+ });
17
+ var _CmsModelFieldToAstConverterFromPlugins = require("./CmsModelFieldToAstConverterFromPlugins");
18
+ Object.keys(_CmsModelFieldToAstConverterFromPlugins).forEach(function (key) {
19
+ if (key === "default" || key === "__esModule") return;
20
+ if (key in exports && exports[key] === _CmsModelFieldToAstConverterFromPlugins[key]) return;
21
+ Object.defineProperty(exports, key, {
22
+ enumerable: true,
23
+ get: function () {
24
+ return _CmsModelFieldToAstConverterFromPlugins[key];
25
+ }
26
+ });
27
+ });
28
+ var _CmsModelToAstConverter = require("./CmsModelToAstConverter");
29
+ Object.keys(_CmsModelToAstConverter).forEach(function (key) {
30
+ if (key === "default" || key === "__esModule") return;
31
+ if (key in exports && exports[key] === _CmsModelToAstConverter[key]) return;
32
+ Object.defineProperty(exports, key, {
33
+ enumerable: true,
34
+ get: function () {
35
+ return _CmsModelToAstConverter[key];
36
+ }
37
+ });
38
+ });
39
+
40
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_CmsModelFieldToAstFromPlugin","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get","_CmsModelFieldToAstConverterFromPlugins","_CmsModelToAstConverter"],"sources":["index.ts"],"sourcesContent":["export * from \"./CmsModelFieldToAstFromPlugin\";\nexport * from \"./CmsModelFieldToAstConverterFromPlugins\";\nexport * from \"./CmsModelToAstConverter\";\n"],"mappings":";;;;;AAAA,IAAAA,6BAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,6BAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,6BAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,6BAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAK,uCAAA,GAAAT,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAO,uCAAA,EAAAN,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAK,uCAAA,CAAAL,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAC,uCAAA,CAAAL,GAAA;IAAA;EAAA;AAAA;AACA,IAAAM,uBAAA,GAAAV,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAQ,uBAAA,EAAAP,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAM,uBAAA,CAAAN,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAE,uBAAA,CAAAN,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
@@ -1,6 +1,6 @@
1
- import { CmsEntryValues, CmsModelField } from "../../types";
2
- import { CmsModelFieldConverterPlugin } from "../../plugins";
3
- import { ConverterCollection } from "./ConverterCollection";
1
+ import type { CmsEntryValues, CmsModelField } from "../../types";
2
+ import type { CmsModelFieldConverterPlugin } from "../../plugins";
3
+ import type { ConverterCollection } from "./ConverterCollection";
4
4
  export interface CmsModelFieldWithParent extends CmsModelField {
5
5
  parent?: CmsModelFieldWithParent | null;
6
6
  }
@@ -1 +1 @@
1
- {"version":3,"names":["_error","_interopRequireDefault","require","Converter","converters","undefined","constructor","config","type","plugin","setConverterCollection","WebinyError","getConverterCollection","getType","convertToStorage","params","field","value","converterCollection","convertFromStorage","exports"],"sources":["Converter.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { CmsEntryValues, CmsModelField } from \"~/types\";\nimport { CmsModelFieldConverterPlugin } from \"~/plugins\";\nimport { ConverterCollection } from \"./ConverterCollection\";\n\nexport interface CmsModelFieldWithParent extends CmsModelField {\n parent?: CmsModelFieldWithParent | null;\n}\n\ninterface ConverterConvertParams {\n field: CmsModelFieldWithParent;\n value: any;\n parent?: CmsModelFieldWithParent | null;\n}\nexport interface ConverterConfig {\n type: string;\n plugin: CmsModelFieldConverterPlugin;\n}\nexport class Converter {\n private readonly type: string;\n private readonly plugin: CmsModelFieldConverterPlugin;\n\n private converters: ConverterCollection | undefined = undefined;\n\n public constructor(config: ConverterConfig) {\n this.type = config.type;\n this.plugin = config.plugin;\n }\n\n public setConverterCollection(converters: ConverterCollection): void {\n if (this.converters) {\n throw new WebinyError(\n `Cannot attach converters collection more than once to Converter with type \"${this.type}\".`,\n \"CONVERTER_COLLECTION_ERROR\",\n {\n type: this.type\n }\n );\n }\n this.converters = converters;\n }\n\n public getConverterCollection(): ConverterCollection {\n if (!this.converters) {\n throw new WebinyError(\n `There is no ConverterCollection defined in the converter with type \"${this.type}\".`\n );\n }\n return this.converters;\n }\n\n public getType(): string {\n return this.type;\n }\n\n public convertToStorage(params: ConverterConvertParams): CmsEntryValues {\n const { field, value } = params;\n\n return this.plugin.convertToStorage({\n field,\n value,\n converterCollection: this.getConverterCollection()\n });\n }\n\n public convertFromStorage(params: ConverterConvertParams): CmsEntryValues {\n const { field, value } = params;\n\n return this.plugin.convertFromStorage({\n field,\n value,\n converterCollection: this.getConverterCollection()\n });\n }\n}\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAkBO,MAAMC,SAAS,CAAC;EAIXC,UAAU,GAAoCC,SAAS;EAExDC,WAAWA,CAACC,MAAuB,EAAE;IACxC,IAAI,CAACC,IAAI,GAAGD,MAAM,CAACC,IAAI;IACvB,IAAI,CAACC,MAAM,GAAGF,MAAM,CAACE,MAAM;EAC/B;EAEOC,sBAAsBA,CAACN,UAA+B,EAAQ;IACjE,IAAI,IAAI,CAACA,UAAU,EAAE;MACjB,MAAM,IAAIO,cAAW,CAChB,8EAA6E,IAAI,CAACH,IAAK,IAAG,EAC3F,4BAA4B,EAC5B;QACIA,IAAI,EAAE,IAAI,CAACA;MACf,CACJ,CAAC;IACL;IACA,IAAI,CAACJ,UAAU,GAAGA,UAAU;EAChC;EAEOQ,sBAAsBA,CAAA,EAAwB;IACjD,IAAI,CAAC,IAAI,CAACR,UAAU,EAAE;MAClB,MAAM,IAAIO,cAAW,CAChB,uEAAsE,IAAI,CAACH,IAAK,IACrF,CAAC;IACL;IACA,OAAO,IAAI,CAACJ,UAAU;EAC1B;EAEOS,OAAOA,CAAA,EAAW;IACrB,OAAO,IAAI,CAACL,IAAI;EACpB;EAEOM,gBAAgBA,CAACC,MAA8B,EAAkB;IACpE,MAAM;MAAEC,KAAK;MAAEC;IAAM,CAAC,GAAGF,MAAM;IAE/B,OAAO,IAAI,CAACN,MAAM,CAACK,gBAAgB,CAAC;MAChCE,KAAK;MACLC,KAAK;MACLC,mBAAmB,EAAE,IAAI,CAACN,sBAAsB,CAAC;IACrD,CAAC,CAAC;EACN;EAEOO,kBAAkBA,CAACJ,MAA8B,EAAkB;IACtE,MAAM;MAAEC,KAAK;MAAEC;IAAM,CAAC,GAAGF,MAAM;IAE/B,OAAO,IAAI,CAACN,MAAM,CAACU,kBAAkB,CAAC;MAClCH,KAAK;MACLC,KAAK;MACLC,mBAAmB,EAAE,IAAI,CAACN,sBAAsB,CAAC;IACrD,CAAC,CAAC;EACN;AACJ;AAACQ,OAAA,CAAAjB,SAAA,GAAAA,SAAA"}
1
+ {"version":3,"names":["_error","_interopRequireDefault","require","Converter","converters","undefined","constructor","config","type","plugin","setConverterCollection","WebinyError","getConverterCollection","getType","convertToStorage","params","field","value","converterCollection","convertFromStorage","exports"],"sources":["Converter.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport type { CmsEntryValues, CmsModelField } from \"~/types\";\nimport type { CmsModelFieldConverterPlugin } from \"~/plugins\";\nimport type { ConverterCollection } from \"./ConverterCollection\";\n\nexport interface CmsModelFieldWithParent extends CmsModelField {\n parent?: CmsModelFieldWithParent | null;\n}\n\ninterface ConverterConvertParams {\n field: CmsModelFieldWithParent;\n value: any;\n parent?: CmsModelFieldWithParent | null;\n}\nexport interface ConverterConfig {\n type: string;\n plugin: CmsModelFieldConverterPlugin;\n}\nexport class Converter {\n private readonly type: string;\n private readonly plugin: CmsModelFieldConverterPlugin;\n\n private converters: ConverterCollection | undefined = undefined;\n\n public constructor(config: ConverterConfig) {\n this.type = config.type;\n this.plugin = config.plugin;\n }\n\n public setConverterCollection(converters: ConverterCollection): void {\n if (this.converters) {\n throw new WebinyError(\n `Cannot attach converters collection more than once to Converter with type \"${this.type}\".`,\n \"CONVERTER_COLLECTION_ERROR\",\n {\n type: this.type\n }\n );\n }\n this.converters = converters;\n }\n\n public getConverterCollection(): ConverterCollection {\n if (!this.converters) {\n throw new WebinyError(\n `There is no ConverterCollection defined in the converter with type \"${this.type}\".`\n );\n }\n return this.converters;\n }\n\n public getType(): string {\n return this.type;\n }\n\n public convertToStorage(params: ConverterConvertParams): CmsEntryValues {\n const { field, value } = params;\n\n return this.plugin.convertToStorage({\n field,\n value,\n converterCollection: this.getConverterCollection()\n });\n }\n\n public convertFromStorage(params: ConverterConvertParams): CmsEntryValues {\n const { field, value } = params;\n\n return this.plugin.convertFromStorage({\n field,\n value,\n converterCollection: this.getConverterCollection()\n });\n }\n}\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAkBO,MAAMC,SAAS,CAAC;EAIXC,UAAU,GAAoCC,SAAS;EAExDC,WAAWA,CAACC,MAAuB,EAAE;IACxC,IAAI,CAACC,IAAI,GAAGD,MAAM,CAACC,IAAI;IACvB,IAAI,CAACC,MAAM,GAAGF,MAAM,CAACE,MAAM;EAC/B;EAEOC,sBAAsBA,CAACN,UAA+B,EAAQ;IACjE,IAAI,IAAI,CAACA,UAAU,EAAE;MACjB,MAAM,IAAIO,cAAW,CACjB,8EAA8E,IAAI,CAACH,IAAI,IAAI,EAC3F,4BAA4B,EAC5B;QACIA,IAAI,EAAE,IAAI,CAACA;MACf,CACJ,CAAC;IACL;IACA,IAAI,CAACJ,UAAU,GAAGA,UAAU;EAChC;EAEOQ,sBAAsBA,CAAA,EAAwB;IACjD,IAAI,CAAC,IAAI,CAACR,UAAU,EAAE;MAClB,MAAM,IAAIO,cAAW,CACjB,uEAAuE,IAAI,CAACH,IAAI,IACpF,CAAC;IACL;IACA,OAAO,IAAI,CAACJ,UAAU;EAC1B;EAEOS,OAAOA,CAAA,EAAW;IACrB,OAAO,IAAI,CAACL,IAAI;EACpB;EAEOM,gBAAgBA,CAACC,MAA8B,EAAkB;IACpE,MAAM;MAAEC,KAAK;MAAEC;IAAM,CAAC,GAAGF,MAAM;IAE/B,OAAO,IAAI,CAACN,MAAM,CAACK,gBAAgB,CAAC;MAChCE,KAAK;MACLC,KAAK;MACLC,mBAAmB,EAAE,IAAI,CAACN,sBAAsB,CAAC;IACrD,CAAC,CAAC;EACN;EAEOO,kBAAkBA,CAACJ,MAA8B,EAAkB;IACtE,MAAM;MAAEC,KAAK;MAAEC;IAAM,CAAC,GAAGF,MAAM;IAE/B,OAAO,IAAI,CAACN,MAAM,CAACU,kBAAkB,CAAC;MAClCH,KAAK;MACLC,KAAK;MACLC,mBAAmB,EAAE,IAAI,CAACN,sBAAsB,CAAC;IACrD,CAAC,CAAC;EACN;AACJ;AAACQ,OAAA,CAAAjB,SAAA,GAAAA,SAAA","ignoreList":[]}
@@ -1,6 +1,6 @@
1
1
  import { Converter } from "./Converter";
2
- import { CmsEntryValues, CmsModelField } from "../../types";
3
- import { PluginsContainer } from "@webiny/plugins";
2
+ import type { CmsEntryValues, CmsModelField } from "../../types";
3
+ import type { PluginsContainer } from "@webiny/plugins";
4
4
  export interface CmsModelFieldsWithParent extends CmsModelField {
5
5
  parent?: CmsModelField | null;
6
6
  }
@@ -1 +1 @@
1
- {"version":3,"names":["_error","_interopRequireDefault","require","_Converter","_plugins","_getBaseFieldType","ConverterCollection","converters","Map","constructor","params","plugins","fieldGraphQLPlugins","byType","fieldConverterPlugins","CmsModelFieldConverterPlugin","type","defaultFieldConverterPlugin","find","pl","getFieldType","undefined","WebinyError","fieldGraphQLPlugin","plugin","fieldType","converter","Converter","addConverter","setConverterCollection","set","getType","getConverter","get","convertToStorage","fields","values","inputValues","attachHasOwnProperty","reduce","output","field","baseType","getBaseFieldType","hasOwnProperty","fieldId","value","convertFromStorage","storageId","Array","isArray","Object","defineProperty","enumerable","writable","property","exports"],"sources":["ConverterCollection.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { Converter } from \"./Converter\";\nimport { CmsEntryValues, CmsModelField, CmsModelFieldToGraphQLPlugin } from \"~/types\";\nimport { CmsModelFieldConverterPlugin } from \"~/plugins\";\nimport { PluginsContainer } from \"@webiny/plugins\";\nimport { getBaseFieldType } from \"~/utils/getBaseFieldType\";\n\nexport interface CmsModelFieldsWithParent extends CmsModelField {\n parent?: CmsModelField | null;\n}\n\nexport interface CmsModelConverterCallable {\n (params: ConverterCollectionConvertParams): CmsEntryValues;\n}\n\nexport interface ConverterCollectionConvertParams {\n fields: CmsModelFieldsWithParent[];\n values?: CmsEntryValues;\n}\n\nexport interface ConverterCollectionParams {\n plugins: PluginsContainer;\n}\n\nexport class ConverterCollection {\n private readonly converters: Map<string, Converter> = new Map();\n\n public constructor(params: ConverterCollectionParams) {\n const { plugins } = params;\n const fieldGraphQLPlugins = plugins.byType<CmsModelFieldToGraphQLPlugin>(\n \"cms-model-field-to-graphql\"\n );\n const fieldConverterPlugins = plugins.byType<CmsModelFieldConverterPlugin>(\n CmsModelFieldConverterPlugin.type\n );\n const defaultFieldConverterPlugin = fieldConverterPlugins.find(\n pl => pl.getFieldType() === \"*\"\n );\n if (defaultFieldConverterPlugin === undefined) {\n throw new WebinyError(\n `Missing default field converter plugin.`,\n \"DEFAULT_FIELD_CONVERTER_ERROR\"\n );\n }\n for (const fieldGraphQLPlugin of fieldGraphQLPlugins) {\n const plugin = fieldConverterPlugins.find(\n pl => pl.getFieldType() === fieldGraphQLPlugin.fieldType\n );\n const converter = new Converter({\n type: fieldGraphQLPlugin.fieldType,\n plugin: plugin || defaultFieldConverterPlugin\n });\n\n this.addConverter(converter);\n }\n }\n\n public addConverter(converter: Converter): void {\n converter.setConverterCollection(this);\n this.converters.set(converter.getType(), converter);\n }\n\n public getConverter(type: string): Converter {\n const converter = this.converters.get(type);\n if (converter === undefined) {\n throw new WebinyError(\n `Missing converter for field type \"${type}\".`,\n \"CONVERTER_ERROR\",\n {\n type\n }\n );\n }\n return converter;\n }\n\n public convertToStorage(params: ConverterCollectionConvertParams): CmsEntryValues | undefined {\n const { fields, values: inputValues } = params;\n if (inputValues === undefined) {\n return undefined;\n }\n\n this.attachHasOwnProperty(inputValues);\n\n return fields.reduce<CmsEntryValues>((output, field) => {\n const baseType = getBaseFieldType(field);\n const converter = this.getConverter(baseType);\n if (inputValues === null || inputValues.hasOwnProperty(field.fieldId) === false) {\n return output;\n }\n const values = converter.convertToStorage({\n field,\n value: inputValues[field.fieldId]\n });\n\n return {\n ...output,\n ...values\n };\n }, {});\n }\n\n public convertFromStorage(\n params: ConverterCollectionConvertParams\n ): CmsEntryValues | undefined {\n const { fields, values: inputValues } = params;\n if (inputValues === undefined) {\n return undefined;\n }\n\n return fields.reduce((output, field) => {\n const baseType = getBaseFieldType(field);\n const converter = this.getConverter(baseType);\n if (inputValues === null || inputValues.hasOwnProperty(field.storageId) === false) {\n return output;\n }\n const values = converter.convertFromStorage({\n field,\n value: inputValues[field.storageId]\n });\n\n return {\n ...output,\n ...values\n };\n }, {});\n }\n\n /**\n * This method attaches hasOwnProperty when received object was created via Object.create(null) - no inheritance of Object.\n * At that point, hasOwnProperty does not exist, and we need to add it.\n *\n * TODO add more checks if required\n */\n private attachHasOwnProperty(values: CmsEntryValues) {\n if (\n // null or undefined?\n values === null ||\n values === undefined ||\n // not an object?\n typeof values !== \"object\" ||\n // maybe it's an array?\n Array.isArray(values) ||\n // and in the end, check if hasOwnProperty is a function already\n typeof values?.hasOwnProperty === \"function\"\n ) {\n return;\n }\n Object.defineProperty(values, \"hasOwnProperty\", {\n enumerable: false,\n writable: false,\n value: function (property: string) {\n return this[property] !== undefined;\n }\n });\n }\n}\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AAEA,IAAAE,QAAA,GAAAF,OAAA;AAEA,IAAAG,iBAAA,GAAAH,OAAA;AAmBO,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IAAI,CAACM,YAAY,CAACU,QAAQ,CAAC;MAC7C,IAAIL,WAAW,KAAK,IAAI,IAAIA,WAAW,CAACO,cAAc,CAACH,KAAK,CAACO,SAAS,CAAC,KAAK,KAAK,EAAE;QAC/E,OAAOR,MAAM;MACjB;MACA,MAAMJ,MAAM,GAAGV,SAAS,CAACqB,kBAAkB,CAAC;QACxCN,KAAK;QACLK,KAAK,EAAET,WAAW,CAACI,KAAK,CAACO,SAAS;MACtC,CAAC,CAAC;MAEF,OAAO;QACH,GAAGR,MAAM;QACT,GAAGJ;MACP,CAAC;IACL,CAAC,EAAE,CAAC,CAAC,CAAC;EACV;;EAEA;AACJ;AACA;AACA;AACA;AACA;EACYE,oBAAoBA,CAACF,MAAsB,EAAE;IACjD;IACI;IACAA,MAAM,KAAK,IAAI,IACfA,MAAM,KAAKf,SAAS;IACpB;IACA,OAAOe,MAAM,KAAK,QAAQ;IAC1B;IACAa,KAAK,CAACC,OAAO,CAACd,MAAM,CAAC;IACrB;IACA,OAAOA,MAAM,EAAEQ,cAAc,KAAK,UAAU,EAC9C;MACE;IACJ;IACAO,MAAM,CAACC,cAAc,CAAChB,MAAM,EAAE,gBAAgB,EAAE;MAC5CiB,UAAU,EAAE,KAAK;MACjBC,QAAQ,EAAE,KAAK;MACfR,KAAK,EAAE,SAAAA,CAAUS,QAAgB,EAAE;QAC/B,OAAO,IAAI,CAACA,QAAQ,CAAC,KAAKlC,SAAS;MACvC;IACJ,CAAC,CAAC;EACN;AACJ;AAACmC,OAAA,CAAAlD,mBAAA,GAAAA,mBAAA"}
1
+ {"version":3,"names":["_error","_interopRequireDefault","require","_Converter","_plugins","_getBaseFieldType","ConverterCollection","converters","Map","constructor","params","plugins","fieldGraphQLPlugins","byType","fieldConverterPlugins","CmsModelFieldConverterPlugin","type","defaultFieldConverterPlugin","find","pl","getFieldType","undefined","WebinyError","fieldGraphQLPlugin","plugin","fieldType","converter","Converter","addConverter","setConverterCollection","set","getType","getConverter","get","convertToStorage","fields","values","inputValues","attachHasOwnProperty","reduce","output","field","baseType","getBaseFieldType","hasOwnProperty","fieldId","value","convertFromStorage","storageId","Array","isArray","Object","defineProperty","enumerable","writable","property","exports"],"sources":["ConverterCollection.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { Converter } from \"./Converter\";\nimport type { CmsEntryValues, CmsModelField, CmsModelFieldToGraphQLPlugin } from \"~/types\";\nimport { CmsModelFieldConverterPlugin } from \"~/plugins\";\nimport type { PluginsContainer } from \"@webiny/plugins\";\nimport { getBaseFieldType } from \"~/utils/getBaseFieldType\";\n\nexport interface CmsModelFieldsWithParent extends CmsModelField {\n parent?: CmsModelField | null;\n}\n\nexport interface CmsModelConverterCallable {\n (params: ConverterCollectionConvertParams): CmsEntryValues;\n}\n\nexport interface ConverterCollectionConvertParams {\n fields: CmsModelFieldsWithParent[];\n values?: CmsEntryValues;\n}\n\nexport interface ConverterCollectionParams {\n plugins: PluginsContainer;\n}\n\nexport class ConverterCollection {\n private readonly converters: Map<string, Converter> = new Map();\n\n public constructor(params: ConverterCollectionParams) {\n const { plugins } = params;\n const fieldGraphQLPlugins = plugins.byType<CmsModelFieldToGraphQLPlugin>(\n \"cms-model-field-to-graphql\"\n );\n const fieldConverterPlugins = plugins.byType<CmsModelFieldConverterPlugin>(\n CmsModelFieldConverterPlugin.type\n );\n const defaultFieldConverterPlugin = fieldConverterPlugins.find(\n pl => pl.getFieldType() === \"*\"\n );\n if (defaultFieldConverterPlugin === undefined) {\n throw new WebinyError(\n `Missing default field converter plugin.`,\n \"DEFAULT_FIELD_CONVERTER_ERROR\"\n );\n }\n for (const fieldGraphQLPlugin of fieldGraphQLPlugins) {\n const plugin = fieldConverterPlugins.find(\n pl => pl.getFieldType() === fieldGraphQLPlugin.fieldType\n );\n const converter = new Converter({\n type: fieldGraphQLPlugin.fieldType,\n plugin: plugin || defaultFieldConverterPlugin\n });\n\n this.addConverter(converter);\n }\n }\n\n public addConverter(converter: Converter): void {\n converter.setConverterCollection(this);\n this.converters.set(converter.getType(), converter);\n }\n\n public getConverter(type: string): Converter {\n const converter = this.converters.get(type);\n if (converter === undefined) {\n throw new WebinyError(\n `Missing converter for field type \"${type}\".`,\n \"CONVERTER_ERROR\",\n {\n type\n }\n );\n }\n return converter;\n }\n\n public convertToStorage(params: ConverterCollectionConvertParams): CmsEntryValues | undefined {\n const { fields, values: inputValues } = params;\n if (inputValues === undefined) {\n return undefined;\n }\n\n this.attachHasOwnProperty(inputValues);\n\n return fields.reduce<CmsEntryValues>((output, field) => {\n const baseType = getBaseFieldType(field);\n const converter = this.getConverter(baseType);\n if (inputValues === null || inputValues.hasOwnProperty(field.fieldId) === false) {\n return output;\n }\n const values = converter.convertToStorage({\n field,\n value: inputValues[field.fieldId]\n });\n\n return {\n ...output,\n ...values\n };\n }, {});\n }\n\n public convertFromStorage(\n params: ConverterCollectionConvertParams\n ): CmsEntryValues | undefined {\n const { fields, values: inputValues } = params;\n if (inputValues === undefined) {\n return undefined;\n }\n\n return fields.reduce((output, field) => {\n const baseType = getBaseFieldType(field);\n const converter = this.getConverter(baseType);\n if (inputValues === null || inputValues.hasOwnProperty(field.storageId) === false) {\n return output;\n }\n const values = converter.convertFromStorage({\n field,\n value: inputValues[field.storageId]\n });\n\n return {\n ...output,\n ...values\n };\n }, {});\n }\n\n /**\n * This method attaches hasOwnProperty when received object was created via Object.create(null) - no inheritance of Object.\n * At that point, hasOwnProperty does not exist, and we need to add it.\n *\n * TODO add more checks if required\n */\n private attachHasOwnProperty(values: CmsEntryValues) {\n if (\n // null or undefined?\n values === null ||\n values === undefined ||\n // not an object?\n typeof values !== \"object\" ||\n // maybe it's an array?\n Array.isArray(values) ||\n // and in the end, check if hasOwnProperty is a function already\n typeof values?.hasOwnProperty === \"function\"\n ) {\n return;\n }\n Object.defineProperty(values, \"hasOwnProperty\", {\n enumerable: false,\n writable: false,\n value: function (property: string) {\n return this[property] !== undefined;\n }\n });\n }\n}\n"],"mappings":";;;;;;;AAAA,IAAAA,MAA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CAACI,MAAM,CAAC,CAACC,MAAM,EAAEC,KAAK,KAAK;MACpC,MAAMC,QAAQ,GAAG,IAAAC,kCAAgB,EAACF,KAAK,CAAC;MACxC,MAAMf,SAAS,GAAG,IAAI,CAACM,YAAY,CAACU,QAAQ,CAAC;MAC7C,IAAIL,WAAW,KAAK,IAAI,IAAIA,WAAW,CAACO,cAAc,CAACH,KAAK,CAACO,SAAS,CAAC,KAAK,KAAK,EAAE;QAC/E,OAAOR,MAAM;MACjB;MACA,MAAMJ,MAAM,GAAGV,SAAS,CAACqB,kBAAkB,CAAC;QACxCN,KAAK;QACLK,KAAK,EAAET,WAAW,CAACI,KAAK,CAACO,SAAS;MACtC,CAAC,CAAC;MAEF,OAAO;QACH,GAAGR,MAAM;QACT,GAAGJ;MACP,CAAC;IACL,CAAC,EAAE,CAAC,CAAC,CAAC;EACV;;EAEA;AACJ;AACA;AACA;AACA;AACA;EACYE,oBAAoBA,CAACF,MAAsB,EAAE;IACjD;IACI;IACAA,MAAM,KAAK,IAAI,IACfA,MAAM,KAAKf,SAAS;IACpB;IACA,OAAOe,MAAM,KAAK,QAAQ;IAC1B;IACAa,KAAK,CAACC,OAAO,CAACd,MAAM,CAAC;IACrB;IACA,OAAOA,MAAM,EAAEQ,cAAc,KAAK,UAAU,EAC9C;MACE;IACJ;IACAO,MAAM,CAACC,cAAc,CAAChB,MAAM,EAAE,gBAAgB,EAAE;MAC5CiB,UAAU,EAAE,KAAK;MACjBC,QAAQ,EAAE,KAAK;MACfR,KAAK,EAAE,SAAAA,CAAUS,QAAgB,EAAE;QAC/B,OAAO,IAAI,CAACA,QAAQ,CAAC,KAAKlC,SAAS;MACvC;IACJ,CAAC,CAAC;EACN;AACJ;AAACmC,OAAA,CAAAlD,mBAAA,GAAAA,mBAAA","ignoreList":[]}
@@ -1,6 +1,6 @@
1
- import { PluginsContainer } from "@webiny/plugins";
2
- import { CmsModelConverterCallable } from "./ConverterCollection";
3
- import { CmsModel, StorageOperationsCmsModel } from "../../types";
1
+ import type { PluginsContainer } from "@webiny/plugins";
2
+ import type { CmsModelConverterCallable } from "./ConverterCollection";
3
+ import type { CmsModel, StorageOperationsCmsModel } from "../../types";
4
4
  interface Params {
5
5
  /**
6
6
  * We need a model to determine if the conversion feature is enabled.
@@ -1 +1 @@
1
- {"version":3,"names":["_ConverterCollection","require","_semver","_interopRequireDefault","featureVersion","semver","coerce","isBetaOrNext","model","webinyVersion","startsWith","match","isFeatureEnabled","disableConversion","process","env","WEBINY_API_TEST_STORAGE_ID_CONVERSION_DISABLE","nodeEnv","NODE_ENV","modelVersion","console","log","modelId","compare","createValueKeyToStorageConverter","params","plugins","values","converters","ConverterCollection","fields","result","convertToStorage","exports","createValueKeyFromStorageConverter","convertFromStorage","createCmsModelFieldConvertersAttachFactory","storageModel","convertValueKeyToStorage","convertValueKeyFromStorage"],"sources":["valueKeyStorageConverter.ts"],"sourcesContent":["import { PluginsContainer } from \"@webiny/plugins\";\nimport {\n CmsModelConverterCallable,\n ConverterCollection,\n ConverterCollectionConvertParams as BaseConverterCollectionConvertParams\n} from \"~/utils/converters/ConverterCollection\";\nimport { CmsModel, StorageOperationsCmsModel } from \"~/types\";\nimport semver, { SemVer } from \"semver\";\n\nconst featureVersion = semver.coerce(\"5.33.0\") as SemVer;\n\nconst isBetaOrNext = (model: CmsModel): boolean => {\n if (!model.webinyVersion) {\n return false;\n } else if (model.webinyVersion.startsWith(\"0.0.0\")) {\n return true;\n }\n return model.webinyVersion.match(/next|beta|unstable/) !== null;\n};\n\nconst isFeatureEnabled = (model: CmsModel): boolean => {\n /**\n * In case of disabled webinyVersion value, we disable this feature.\n * This is only for testing...\n */\n const disableConversion = !!process.env.WEBINY_API_TEST_STORAGE_ID_CONVERSION_DISABLE;\n if (model.webinyVersion === \"disable\" || disableConversion) {\n return false;\n }\n /**\n * If is a test environment, always have this turned on.\n */\n const nodeEnv = process.env.NODE_ENV as string;\n if (nodeEnv === \"test\" || nodeEnv === \"disable\" || isBetaOrNext(model)) {\n return true;\n }\n /**\n * Possibility that the version is not defined, this means it is a quite old system where models did not change.\n */\n if (!model.webinyVersion) {\n return false;\n }\n /**\n * In case feature version value is greater than the model version, feature is not enabled as it is an older model with no storageId.\n *\n * TODO change if necessary after the update to the system\n */\n const modelVersion = semver.coerce(model.webinyVersion);\n if (!modelVersion) {\n console.log(`Warning: Model \"${model.modelId}\" does not have valid Webiny version set.`);\n return true;\n } else if (semver.compare(modelVersion, featureVersion) === -1) {\n return false;\n }\n return true;\n};\n\ninterface Params {\n /**\n * We need a model to determine if the conversion feature is enabled.\n */\n model: CmsModel;\n plugins: PluginsContainer;\n}\n\n/**\n * In the first call of the converter we do not need the fields property as it will be taken directly from the model.\n */\ninterface ConverterCollectionConvertParams\n extends Omit<BaseConverterCollectionConvertParams, \"fields\"> {\n fields?: BaseConverterCollectionConvertParams[\"fields\"];\n}\n\nexport const createValueKeyToStorageConverter = (params: Params): CmsModelConverterCallable => {\n const { plugins, model } = params;\n\n if (isFeatureEnabled(model) === false) {\n return ({ values }: ConverterCollectionConvertParams) => {\n return values || {};\n };\n }\n\n const converters = new ConverterCollection({\n plugins\n });\n\n return ({ fields, values }: ConverterCollectionConvertParams) => {\n const result = converters.convertToStorage({\n fields: fields || model.fields,\n values\n });\n return result || {};\n };\n};\n\nexport const createValueKeyFromStorageConverter = (params: Params): CmsModelConverterCallable => {\n const { plugins, model } = params;\n\n if (isFeatureEnabled(model) === false) {\n return ({ values }: ConverterCollectionConvertParams) => {\n return values || {};\n };\n }\n\n const converters = new ConverterCollection({\n plugins\n });\n\n return ({ fields, values }: ConverterCollectionConvertParams) => {\n const result = converters.convertFromStorage({\n fields: fields || model.fields,\n values\n });\n return result || {};\n };\n};\n\nexport const createCmsModelFieldConvertersAttachFactory = (plugins: PluginsContainer) => {\n return (model: StorageOperationsCmsModel | CmsModel): StorageOperationsCmsModel => {\n const storageModel = model as Partial<StorageOperationsCmsModel>;\n if (!!storageModel.convertValueKeyToStorage && !!storageModel.convertValueKeyFromStorage) {\n return storageModel as StorageOperationsCmsModel;\n }\n return {\n ...model,\n convertValueKeyToStorage: createValueKeyToStorageConverter({\n model,\n plugins\n }),\n convertValueKeyFromStorage: createValueKeyFromStorageConverter({\n model,\n plugins\n })\n };\n };\n};\n"],"mappings":";;;;;;;AACA,IAAAA,oBAAA,GAAAC,OAAA;AAMA,IAAAC,OAAA,GAAAC,sBAAA,CAAAF,OAAA;AAEA,MAAMG,cAAc,GAAGC,eAAM,CAACC,MAAM,CAAC,QAAQ,CAAW;AAExD,MAAMC,YAAY,GAAIC,KAAe,IAAc;EAC/C,IAAI,CAACA,KAAK,CAACC,aAAa,EAAE;IACtB,OAAO,KAAK;EAChB,CAAC,MAAM,IAAID,KAAK,CAACC,aAAa,CAACC,UAAU,CAAC,OAAO,CAAC,EAAE;IAChD,OAAO,IAAI;EACf;EACA,OAAOF,KAAK,CAACC,aAAa,CAACE,KAAK,CAAC,oBAAoB,CAAC,KAAK,IAAI;AACnE,CAAC;AAED,MAAMC,gBAAgB,GAAIJ,KAAe,IAAc;EACnD;AACJ;AACA;AACA;EACI,MAAMK,iBAAiB,GAAG,CAAC,CAACC,OAAO,CAACC,GAAG,CAACC,6CAA6C;EACrF,IAAIR,KAAK,CAACC,aAAa,KAAK,SAAS,IAAII,iBAAiB,EAAE;IACxD,OAAO,KAAK;EAChB;EACA;AACJ;AACA;EACI,MAAMI,OAAO,GAAGH,OAAO,CAACC,GAAG,CAACG,QAAkB;EAC9C,IAAID,OAAO,KAAK,MAAM,IAAIA,OAAO,KAAK,SAAS,IAAIV,YAAY,CAACC,KAAK,CAAC,EAAE;IACpE,OAAO,IAAI;EACf;EACA;AACJ;AACA;EACI,IAAI,CAACA,KAAK,CAACC,aAAa,EAAE;IACtB,OAAO,KAAK;EAChB;EACA;AACJ;AACA;AACA;AACA;EACI,MAAMU,YAAY,GAAGd,eAAM,CAACC,MAAM,CAACE,KAAK,CAACC,aAAa,CAAC;EACvD,IAAI,CAACU,YAAY,EAAE;IACf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,CAAC;IAAEI,MAAM;IAAEH;EAAyC,CAAC,KAAK;IAC7D,MAAMI,MAAM,GAAGH,UAAU,CAACO,kBAAkB,CAAC;MACzCL,MAAM,EAAEA,MAAM,IAAItB,KAAK,CAACsB,MAAM;MAC9BH;IACJ,CAAC,CAAC;IACF,OAAOI,MAAM,IAAI,CAAC,CAAC;EACvB,CAAC;AACL,CAAC;AAACE,OAAA,CAAAC,kCAAA,GAAAA,kCAAA;AAEK,MAAME,0CAA0C,GAAIV,OAAyB,IAAK;EACrF,OAAQlB,KAA2C,IAAgC;IAC/E,MAAM6B,YAAY,GAAG7B,KAA2C;IAChE,IAAI,CAAC,CAAC6B,YAAY,CAACC,wBAAwB,IAAI,CAAC,CAACD,YAAY,CAACE,0BAA0B,EAAE;MACtF,OAAOF,YAAY;IACvB;IACA,OAAO;MACH,GAAG7B,KAAK;MACR8B,wBAAwB,EAAEd,gCAAgC,CAAC;QACvDhB,KAAK;QACLkB;MACJ,CAAC,CAAC;MACFa,0BAA0B,EAAEL,kCAAkC,CAAC;QAC3D1B,KAAK;QACLkB;MACJ,CAAC;IACL,CAAC;EACL,CAAC;AACL,CAAC;AAACO,OAAA,CAAAG,0CAAA,GAAAA,0CAAA"}
1
+ {"version":3,"names":["_ConverterCollection","require","_semver","_interopRequireDefault","featureVersion","semver","coerce","isBetaOrNext","model","webinyVersion","startsWith","match","isFeatureEnabled","disableConversion","process","env","WEBINY_API_TEST_STORAGE_ID_CONVERSION_DISABLE","nodeEnv","NODE_ENV","modelVersion","console","log","modelId","compare","createValueKeyToStorageConverter","params","plugins","values","converters","ConverterCollection","fields","result","convertToStorage","exports","createValueKeyFromStorageConverter","convertFromStorage","createCmsModelFieldConvertersAttachFactory","storageModel","convertValueKeyToStorage","convertValueKeyFromStorage"],"sources":["valueKeyStorageConverter.ts"],"sourcesContent":["import type { PluginsContainer } from \"@webiny/plugins\";\nimport type {\n CmsModelConverterCallable,\n ConverterCollectionConvertParams as BaseConverterCollectionConvertParams\n} from \"~/utils/converters/ConverterCollection\";\nimport { ConverterCollection } from \"~/utils/converters/ConverterCollection\";\nimport type { CmsModel, StorageOperationsCmsModel } from \"~/types\";\nimport type { SemVer } from \"semver\";\nimport semver from \"semver\";\n\nconst featureVersion = semver.coerce(\"5.33.0\") as SemVer;\n\nconst isBetaOrNext = (model: CmsModel): boolean => {\n if (!model.webinyVersion) {\n return false;\n } else if (model.webinyVersion.startsWith(\"0.0.0\")) {\n return true;\n }\n return model.webinyVersion.match(/next|beta|unstable/) !== null;\n};\n\nconst isFeatureEnabled = (model: CmsModel): boolean => {\n /**\n * In case of disabled webinyVersion value, we disable this feature.\n * This is only for testing...\n */\n const disableConversion = !!process.env.WEBINY_API_TEST_STORAGE_ID_CONVERSION_DISABLE;\n if (model.webinyVersion === \"disable\" || disableConversion) {\n return false;\n }\n /**\n * If is a test environment, always have this turned on.\n */\n const nodeEnv = process.env.NODE_ENV as string;\n if (nodeEnv === \"test\" || nodeEnv === \"disable\" || isBetaOrNext(model)) {\n return true;\n }\n /**\n * Possibility that the version is not defined, this means it is a quite old system where models did not change.\n */\n if (!model.webinyVersion) {\n return false;\n }\n /**\n * In case feature version value is greater than the model version, feature is not enabled as it is an older model with no storageId.\n *\n * TODO change if necessary after the update to the system\n */\n const modelVersion = semver.coerce(model.webinyVersion);\n if (!modelVersion) {\n console.log(`Warning: Model \"${model.modelId}\" does not have valid Webiny version set.`);\n return true;\n } else if (semver.compare(modelVersion, featureVersion) === -1) {\n return false;\n }\n return true;\n};\n\ninterface Params {\n /**\n * We need a model to determine if the conversion feature is enabled.\n */\n model: CmsModel;\n plugins: PluginsContainer;\n}\n\n/**\n * In the first call of the converter we do not need the fields property as it will be taken directly from the model.\n */\ninterface ConverterCollectionConvertParams\n extends Omit<BaseConverterCollectionConvertParams, \"fields\"> {\n fields?: BaseConverterCollectionConvertParams[\"fields\"];\n}\n\nexport const createValueKeyToStorageConverter = (params: Params): CmsModelConverterCallable => {\n const { plugins, model } = params;\n\n if (isFeatureEnabled(model) === false) {\n return ({ values }: ConverterCollectionConvertParams) => {\n return values || {};\n };\n }\n\n const converters = new ConverterCollection({\n plugins\n });\n\n return ({ fields, values }: ConverterCollectionConvertParams) => {\n const result = converters.convertToStorage({\n fields: fields || model.fields,\n values\n });\n return result || {};\n };\n};\n\nexport const createValueKeyFromStorageConverter = (params: Params): CmsModelConverterCallable => {\n const { plugins, model } = params;\n\n if (isFeatureEnabled(model) === false) {\n return ({ values }: ConverterCollectionConvertParams) => {\n return values || {};\n };\n }\n\n const converters = new ConverterCollection({\n plugins\n });\n\n return ({ fields, values }: ConverterCollectionConvertParams) => {\n const result = converters.convertFromStorage({\n fields: fields || model.fields,\n values\n });\n return result || {};\n };\n};\n\nexport const createCmsModelFieldConvertersAttachFactory = (plugins: PluginsContainer) => {\n return (model: StorageOperationsCmsModel | CmsModel): StorageOperationsCmsModel => {\n const storageModel = model as Partial<StorageOperationsCmsModel>;\n if (!!storageModel.convertValueKeyToStorage && !!storageModel.convertValueKeyFromStorage) {\n return storageModel as StorageOperationsCmsModel;\n }\n return {\n ...model,\n convertValueKeyToStorage: createValueKeyToStorageConverter({\n model,\n plugins\n }),\n convertValueKeyFromStorage: createValueKeyFromStorageConverter({\n model,\n plugins\n })\n };\n };\n};\n"],"mappings":";;;;;;;AAKA,IAAAA,oBAAA,GAAAC,OAAA;AAGA,IAAAC,OAAA,GAAAC,sBAAA,CAAAF,OAAA;AAEA,MAAMG,cAAc,GAAGC,eAAM,CAACC,MAAM,CAAC,QAAQ,CAAW;AAExD,MAAMC,YAAY,GAAIC,KAAe,IAAc;EAC/C,IAAI,CAACA,KAAK,CAACC,aAAa,EAAE;IACtB,OAAO,KAAK;EAChB,CAAC,MAAM,IAAID,KAAK,CAACC,aAAa,CAACC,UAAU,CAAC,OAAO,CAAC,EAAE;IAChD,OAAO,IAAI;EACf;EACA,OAAOF,KAAK,CAACC,aAAa,CAACE,KAAK,CAAC,oBAAoB,CAAC,KAAK,IAAI;AACnE,CAAC;A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MACFa,0BAA0B,EAAEL,kCAAkC,CAAC;QAC3D1B,KAAK;QACLkB;MACJ,CAAC;IACL,CAAC;EACL,CAAC;AACL,CAAC;AAACO,OAAA,CAAAG,0CAAA,GAAAA,0CAAA","ignoreList":[]}
@@ -0,0 +1,7 @@
1
+ import type { CmsModelField } from "../types";
2
+ export interface CreateModelFieldParams extends Omit<CmsModelField, "id" | "storageId" | "fieldId"> {
3
+ id?: string;
4
+ fieldId?: string;
5
+ storageId?: string;
6
+ }
7
+ export declare const createModelField: (params: CreateModelFieldParams) => CmsModelField;
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.createModelField = void 0;
8
+ var _camelCase = _interopRequireDefault(require("lodash/camelCase"));
9
+ const createModelField = params => {
10
+ // We are not just spreading `params` because we want to ensure
11
+ // a default value is set for every property of the model field.
12
+ const {
13
+ id,
14
+ label,
15
+ fieldId: initialFieldId,
16
+ storageId,
17
+ type,
18
+ tags,
19
+ settings = {},
20
+ listValidation = [],
21
+ validation = [],
22
+ multipleValues = false,
23
+ predefinedValues = {
24
+ values: [],
25
+ enabled: false
26
+ },
27
+ helpText = null,
28
+ placeholderText = null,
29
+ renderer = null
30
+ } = params;
31
+ const fieldId = initialFieldId ? (0, _camelCase.default)(initialFieldId) : (0, _camelCase.default)(label);
32
+ return {
33
+ id: id ?? fieldId,
34
+ storageId: storageId ?? `${type}@${fieldId}`,
35
+ fieldId,
36
+ label,
37
+ type,
38
+ settings,
39
+ tags,
40
+ listValidation,
41
+ validation,
42
+ multipleValues,
43
+ predefinedValues,
44
+ helpText,
45
+ placeholderText,
46
+ renderer
47
+ };
48
+ };
49
+ exports.createModelField = createModelField;
50
+
51
+ //# sourceMappingURL=createModelField.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_camelCase","_interopRequireDefault","require","createModelField","params","id","label","fieldId","initialFieldId","storageId","type","tags","settings","listValidation","validation","multipleValues","predefinedValues","values","enabled","helpText","placeholderText","renderer","camelCase","exports"],"sources":["createModelField.ts"],"sourcesContent":["import camelCase from \"lodash/camelCase\";\nimport type { CmsModelField } from \"~/types\";\n\nexport interface CreateModelFieldParams\n extends Omit<CmsModelField, \"id\" | \"storageId\" | \"fieldId\"> {\n id?: string;\n fieldId?: string;\n storageId?: string;\n}\n\nexport const createModelField = (params: CreateModelFieldParams): CmsModelField => {\n // We are not just spreading `params` because we want to ensure\n // a default value is set for every property of the model field.\n const {\n id,\n label,\n fieldId: initialFieldId,\n storageId,\n type,\n tags,\n settings = {},\n listValidation = [],\n validation = [],\n multipleValues = false,\n predefinedValues = {\n values: [],\n enabled: false\n },\n helpText = null,\n placeholderText = null,\n renderer = null\n } = params;\n\n const fieldId = initialFieldId ? camelCase(initialFieldId) : camelCase(label);\n\n return {\n id: id ?? fieldId,\n storageId: storageId ?? `${type}@${fieldId}`,\n fieldId,\n label,\n type,\n settings,\n tags,\n listValidation,\n validation,\n multipleValues,\n predefinedValues,\n helpText,\n placeholderText,\n renderer\n };\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,UAAA,GAAAC,sBAAA,CAAAC,OAAA;AAUO,MAAMC,gBAAgB,GAAIC,MAA8B,IAAoB;EAC/E;EACA;EACA,MAAM;IACFC,EAAE;IACFC,KAAK;IACLC,OAAO,EAAEC,cAAc;IACvBC,SAAS;IACTC,IAAI;IACJC,IAAI;IACJC,QAAQ,GAAG,CAAC,CAAC;IACbC,cAAc,GAAG,EAAE;IACnBC,UAAU,GAAG,EAAE;IACfC,cAAc,GAAG,KAAK;IACtBC,gBAAgB,GAAG;MACfC,MAAM,EAAE,EAAE;MACVC,OAAO,EAAE;IACb,CAAC;IACDC,QAAQ,GAAG,IAAI;IACfC,eAAe,GAAG,IAAI;IACtBC,QAAQ,GAAG;EACf,CAAC,GAAGjB,MAAM;EAEV,MAAMG,OAAO,GAAGC,cAAc,GAAG,IAAAc,kBAAS,EAACd,cAAc,CAAC,GAAG,IAAAc,kBAAS,EAAChB,KAAK,CAAC;EAE7E,OAAO;IACHD,EAAE,EAAEA,EAAE,IAAIE,OAAO;IACjBE,SAAS,EAAEA,SAAS,IAAI,GAAGC,IAAI,IAAIH,OAAO,EAAE;IAC5CA,OAAO;IACPD,KAAK;IACLI,IAAI;IACJE,QAAQ;IACRD,IAAI;IACJE,cAAc;IACdC,UAAU;IACVC,cAAc;IACdC,gBAAgB;IAChBG,QAAQ;IACRC,eAAe;IACfC;EACJ,CAAC;AACL,CAAC;AAACE,OAAA,CAAApB,gBAAA,GAAAA,gBAAA","ignoreList":[]}
@@ -1,4 +1,4 @@
1
- import { ApiEndpoint, CmsFieldTypePlugins, CmsModel, CmsModelField } from "../types";
1
+ import type { ApiEndpoint, CmsFieldTypePlugins, CmsModel, CmsModelField } from "../types";
2
2
  interface TypeFromFieldParams {
3
3
  typeOfType: "type" | "input";
4
4
  models: CmsModel[];
@@ -1 +1 @@
1
- {"version":3,"names":["_renderFields","require","_renderInputFields","createTypeFromFields","params","typeOfType","model","models","type","typeNamePrefix","fields","fieldTypePlugins","typeSuffix","mTypeName","singularApiName","typeFields","nestedTypes","replace","RegExp","field","result","renderField","renderInputField","typeDefs","push","length","fieldType","join","exports"],"sources":["createTypeFromFields.ts"],"sourcesContent":["import { renderField } from \"~/utils/renderFields\";\nimport { renderInputField } from \"~/utils/renderInputFields\";\nimport { ApiEndpoint, CmsFieldTypePlugins, CmsModel, CmsModelField } from \"~/types\";\n\ninterface TypeFromFieldParams {\n typeOfType: \"type\" | \"input\";\n models: CmsModel[];\n model: CmsModel;\n type: ApiEndpoint;\n typeNamePrefix: string;\n fields: CmsModelField[];\n fieldTypePlugins: CmsFieldTypePlugins;\n}\n\ninterface TypeFromFieldResponse {\n fieldType: string;\n typeDefs: string;\n}\n\nexport const createTypeFromFields = (params: TypeFromFieldParams): TypeFromFieldResponse | null => {\n const { typeOfType, model, models, type, typeNamePrefix, fields, fieldTypePlugins } = params;\n const typeSuffix = typeOfType === \"input\" ? \"Input\" : \"\";\n const mTypeName = model.singularApiName;\n\n const typeFields: string[] = [];\n const nestedTypes: string[] = [];\n\n // Once the loop below starts, we'll be executing a recursive \"object\" type generation.\n // The main trick here is that nested objects don't know who the parent is, and will generate\n // type names using the \"model\", as if they're at the top level:\n // Every time the types are returned, we need to replace the model name in the generated type name\n // with the actual prefix which includes parent field name type.\n const replace = new RegExp(`${mTypeName}_`, \"g\");\n\n for (const field of fields) {\n const result =\n typeOfType === \"type\"\n ? renderField({ field, type, models, model, fieldTypePlugins })\n : renderInputField({ field, models, model, fieldTypePlugins });\n\n if (!result) {\n continue;\n }\n\n const { fields, typeDefs } = result;\n\n typeFields.push(fields.replace(replace, `${typeNamePrefix}_`));\n if (typeDefs) {\n nestedTypes.push(typeDefs.replace(replace, `${typeNamePrefix}_`));\n }\n }\n\n if (!typeFields.length) {\n typeFields.push(\"_empty: String\");\n }\n\n return {\n fieldType: `${typeNamePrefix}${typeSuffix}`,\n typeDefs: /* GraphQL */ `\n ${nestedTypes.join(\"\\n\")}\n\n ${typeOfType} ${typeNamePrefix}${typeSuffix} {\n ${typeFields.join(\"\\n\")}\n }\\n\n `\n };\n};\n"],"mappings":";;;;;;AAAA,IAAAA,aAAA,GAAAC,OAAA;AACA,IAAAC,kBAAA,GAAAD,OAAA;AAkBO,MAAME,oBAAoB,GAAIC,MAA2B,IAAmC;EAC/F,MAAM;IAAEC,UAAU;IAAEC,KAAK;IAAEC,MAAM;IAAEC,IAAI;IAAEC,cAAc;IAAEC,MAAM;IAAEC;EAAiB,CAAC,GAAGP,MAAM;EAC5F,MAAMQ,UAAU,GAAGP,UAAU,KAAK,OAAO,GAAG,OAAO,GAAG,EAAE;EACxD,MAAMQ,SAAS,GAAGP,KAAK,CAACQ,eAAe;EAEvC,MAAMC,UAAoB,GAAG,EAAE;EAC/B,MAAMC,WAAqB,GAAG,EAAE;;EAEhC;EACA;EACA;EACA;EACA;EACA,MAAMC,OAAO,GAAG,IAAIC,MAAM,CAAE,GAAEL,SAAU,GAAE,EAAE,GAAG,CAAC;EAEhD,KAAK,MAAMM,KAAK,IAAIT,MAAM,EAAE;IACxB,MAAMU,MAAM,GACRf,UAAU,KAAK,MAAM,GACf,IAAAgB,yBAAW,EAAC;MAAEF,KAAK;MAAEX,IAAI;MAAED,MAAM;MAAED,KAAK;MAAEK;IAAiB,CAAC,CAAC,GAC7D,IAAAW,mCAAgB,EAAC;MAAEH,KAAK;MAAEZ,MAAM;MAAED,KAAK;MAAEK;IAAiB,CAAC,CAAC;IAEtE,IAAI,CAACS,MAAM,EAAE;MACT;IACJ;IAEA,MAAM;MAAEV,MAAM;MAAEa;IAAS,CAAC,GAAGH,MAAM;IAEnCL,UAAU,CAACS,IAAI,CAACd,MAAM,CAACO,OAAO,CAACA,OAAO,EAAG,GAAER,cAAe,GAAE,CAAC,CAAC;IAC9D,IAAIc,QAAQ,EAAE;MACVP,WAAW,CAACQ,IAAI,CAACD,QAAQ,CAACN,OAAO,CAACA,OAAO,EAAG,GAAER,cAAe,GAAE,CAAC,CAAC;IACrE;EACJ;EAEA,IAAI,CAACM,UAAU,CAACU,MAAM,EAAE;IACpBV,UAAU,CAACS,IAAI,CAAC,gBAAgB,CAAC;EACrC;EAEA,OAAO;IACHE,SAAS,EAAG,GAAEjB,cAAe,GAAEG,UAAW,EAAC;IAC3CW,QAAQ,EAAE,aAAe;AACjC,cAAcP,WAAW,CAACW,IAAI,CAAC,IAAI,CAAE;AACrC;AACA,cAActB,UAAW,IAAGI,cAAe,GAAEG,UAAW;AACxD,kBAAkBG,UAAU,CAACY,IAAI,CAAC,IAAI,CAAE;AACxC;AACA;EACI,CAAC;AACL,CAAC;AAACC,OAAA,CAAAzB,oBAAA,GAAAA,oBAAA"}
1
+ {"version":3,"names":["_renderFields","require","_renderInputFields","createTypeFromFields","params","typeOfType","model","models","type","typeNamePrefix","fields","fieldTypePlugins","typeSuffix","mTypeName","singularApiName","typeFields","nestedTypes","replace","RegExp","field","result","renderField","renderInputField","typeDefs","push","length","fieldType","join","exports"],"sources":["createTypeFromFields.ts"],"sourcesContent":["import { renderField } from \"~/utils/renderFields\";\nimport { renderInputField } from \"~/utils/renderInputFields\";\nimport type { ApiEndpoint, CmsFieldTypePlugins, CmsModel, CmsModelField } from \"~/types\";\n\ninterface TypeFromFieldParams {\n typeOfType: \"type\" | \"input\";\n models: CmsModel[];\n model: CmsModel;\n type: ApiEndpoint;\n typeNamePrefix: string;\n fields: CmsModelField[];\n fieldTypePlugins: CmsFieldTypePlugins;\n}\n\ninterface TypeFromFieldResponse {\n fieldType: string;\n typeDefs: string;\n}\n\nexport const createTypeFromFields = (params: TypeFromFieldParams): TypeFromFieldResponse | null => {\n const { typeOfType, model, models, type, typeNamePrefix, fields, fieldTypePlugins } = params;\n const typeSuffix = typeOfType === \"input\" ? \"Input\" : \"\";\n const mTypeName = model.singularApiName;\n\n const typeFields: string[] = [];\n const nestedTypes: string[] = [];\n\n // Once the loop below starts, we'll be executing a recursive \"object\" type generation.\n // The main trick here is that nested objects don't know who the parent is, and will generate\n // type names using the \"model\", as if they're at the top level:\n // Every time the types are returned, we need to replace the model name in the generated type name\n // with the actual prefix which includes parent field name type.\n const replace = new RegExp(`${mTypeName}_`, \"g\");\n\n for (const field of fields) {\n const result =\n typeOfType === \"type\"\n ? renderField({ field, type, models, model, fieldTypePlugins })\n : renderInputField({ field, models, model, fieldTypePlugins });\n\n if (!result) {\n continue;\n }\n\n const { fields, typeDefs } = result;\n\n typeFields.push(fields.replace(replace, `${typeNamePrefix}_`));\n if (typeDefs) {\n nestedTypes.push(typeDefs.replace(replace, `${typeNamePrefix}_`));\n }\n }\n\n if (!typeFields.length) {\n typeFields.push(\"_empty: String\");\n }\n\n return {\n fieldType: `${typeNamePrefix}${typeSuffix}`,\n typeDefs: /* GraphQL */ `\n ${nestedTypes.join(\"\\n\")}\n\n ${typeOfType} ${typeNamePrefix}${typeSuffix} {\n ${typeFields.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,MAAM,EAAE;IACpBV,UAAU,CAACS,IAAI,CAAC,gBAAgB,CAAC;EACrC;EAEA,OAAO;IACHE,SAAS,EAAE,GAAGjB,cAAc,GAAGG,UAAU,EAAE;IAC3CW,QAAQ,EAAE,aAAc;AAChC,cAAcP,WAAW,CAACW,IAAI,CAAC,IAAI,CAAC;AACpC;AACA,cAActB,UAAU,IAAII,cAAc,GAAGG,UAAU;AACvD,kBAAkBG,UAAU,CAACY,IAAI,CAAC,IAAI,CAAC;AACvC;AACA;EACI,CAAC;AACL,CAAC;AAACC,OAAA,CAAAzB,oBAAA,GAAAA,oBAAA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["_upperFirst","_interopRequireDefault","require","_camelCase","createTypeName","modelId","upperFirst","camelCase","exports"],"sources":["createTypeName.ts"],"sourcesContent":["import upperFirst from \"lodash/upperFirst\";\nimport camelCase from \"lodash/camelCase\";\n\nexport const createTypeName = (modelId: string): string => {\n return upperFirst(camelCase(modelId));\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;AAEO,MAAME,cAAc,GAAIC,OAAe,IAAa;EACvD,OAAO,IAAAC,mBAAU,EAAC,IAAAC,kBAAS,EAACF,OAAO,CAAC,CAAC;AACzC,CAAC;AAACG,OAAA,CAAAJ,cAAA,GAAAA,cAAA"}
1
+ {"version":3,"names":["_upperFirst","_interopRequireDefault","require","_camelCase","createTypeName","modelId","upperFirst","camelCase","exports"],"sources":["createTypeName.ts"],"sourcesContent":["import upperFirst from \"lodash/upperFirst\";\nimport camelCase from \"lodash/camelCase\";\n\nexport const createTypeName = (modelId: string): string => {\n return upperFirst(camelCase(modelId));\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;AAEO,MAAME,cAAc,GAAIC,OAAe,IAAa;EACvD,OAAO,IAAAC,mBAAU,EAAC,IAAAC,kBAAS,EAACF,OAAO,CAAC,CAAC;AACzC,CAAC;AAACG,OAAA,CAAAJ,cAAA,GAAAA,cAAA","ignoreList":[]}
package/utils/date.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["formatDate","date","Date","toISOString","exports","getDate","input","defaultValue"],"sources":["date.ts"],"sourcesContent":["/**\n * Should not be used by users as method is prone to breaking changes.\n * @internal\n */\nexport const formatDate = (date?: Date | string | null): string | null => {\n if (!date) {\n return null;\n } else if (date instanceof Date) {\n return date.toISOString();\n }\n return new Date(date).toISOString();\n};\n\n/**\n * Should not be used by users as method is prone to breaking changes.\n * @internal\n */\nexport const getDate = <T extends string | null = string | null>(\n input?: Date | string | null,\n defaultValue?: Date | string | null\n): T => {\n if (!input) {\n return formatDate(defaultValue) as T;\n }\n if (input instanceof Date) {\n return formatDate(input) as T;\n }\n return formatDate(new Date(input)) as T;\n};\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACO,MAAMA,UAAU,GAAIC,IAA2B,IAAoB;EACtE,IAAI,CAACA,IAAI,EAAE;IACP,OAAO,IAAI;EACf,CAAC,MAAM,IAAIA,IAAI,YAAYC,IAAI,EAAE;IAC7B,OAAOD,IAAI,CAACE,WAAW,CAAC,CAAC;EAC7B;EACA,OAAO,IAAID,IAAI,CAACD,IAAI,CAAC,CAACE,WAAW,CAAC,CAAC;AACvC,CAAC;;AAED;AACA;AACA;AACA;AAHAC,OAAA,CAAAJ,UAAA,GAAAA,UAAA;AAIO,MAAMK,OAAO,GAAGA,CACnBC,KAA4B,EAC5BC,YAAmC,KAC/B;EACJ,IAAI,CAACD,KAAK,EAAE;IACR,OAAON,UAAU,CAACO,YAAY,CAAC;EACnC;EACA,IAAID,KAAK,YAAYJ,IAAI,EAAE;IACvB,OAAOF,UAAU,CAACM,KAAK,CAAC;EAC5B;EACA,OAAON,UAAU,CAAC,IAAIE,IAAI,CAACI,KAAK,CAAC,CAAC;AACtC,CAAC;AAACF,OAAA,CAAAC,OAAA,GAAAA,OAAA"}
1
+ {"version":3,"names":["formatDate","date","Date","toISOString","exports","getDate","input","defaultValue"],"sources":["date.ts"],"sourcesContent":["/**\n * Should not be used by users as method is prone to breaking changes.\n * @internal\n */\nexport const formatDate = (date?: Date | string | null): string | null => {\n if (!date) {\n return null;\n } else if (date instanceof Date) {\n return date.toISOString();\n }\n return new Date(date).toISOString();\n};\n\n/**\n * Should not be used by users as method is prone to breaking changes.\n * @internal\n */\nexport const getDate = <T extends string | null = string | null>(\n input?: Date | string | null,\n defaultValue?: Date | string | null\n): T => {\n if (!input) {\n return formatDate(defaultValue) as T;\n }\n if (input instanceof Date) {\n return formatDate(input) as T;\n }\n return formatDate(new Date(input)) as T;\n};\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACO,MAAMA,UAAU,GAAIC,IAA2B,IAAoB;EACtE,IAAI,CAACA,IAAI,EAAE;IACP,OAAO,IAAI;EACf,CAAC,MAAM,IAAIA,IAAI,YAAYC,IAAI,EAAE;IAC7B,OAAOD,IAAI,CAACE,WAAW,CAAC,CAAC;EAC7B;EACA,OAAO,IAAID,IAAI,CAACD,IAAI,CAAC,CAACE,WAAW,CAAC,CAAC;AACvC,CAAC;;AAED;AACA;AACA;AACA;AAHAC,OAAA,CAAAJ,UAAA,GAAAA,UAAA;AAIO,MAAMK,OAAO,GAAGA,CACnBC,KAA4B,EAC5BC,YAAmC,KAC/B;EACJ,IAAI,CAACD,KAAK,EAAE;IACR,OAAON,UAAU,CAACO,YAAY,CAAC;EACnC;EACA,IAAID,KAAK,YAAYJ,IAAI,EAAE;IACvB,OAAOF,UAAU,CAACM,KAAK,CAAC;EAC5B;EACA,OAAON,UAAU,CAAC,IAAIE,IAAI,CAACI,KAAK,CAAC,CAAC;AACtC,CAAC;AAACF,OAAA,CAAAC,OAAA,GAAAA,OAAA","ignoreList":[]}
@@ -1,4 +1,9 @@
1
- import { CmsContext, CmsEntry, CmsModel, CmsModelField } from "../types";
1
+ import { StorageTransformPlugin } from "../plugins/StorageTransformPlugin";
2
+ import type { CmsContext, CmsEntry, CmsEntryValues, CmsModel, CmsModelField } from "../types";
3
+ export interface GetStoragePluginFactory {
4
+ (context: Pick<CmsContext, "plugins">): (fieldType: string) => StorageTransformPlugin<any>;
5
+ }
6
+ export declare const getStoragePluginFactory: GetStoragePluginFactory;
2
7
  /**
3
8
  * A function that is used in crud to transform entry into the storage type.
4
9
  */
@@ -14,4 +19,11 @@ interface EntryFieldFromStorageTransformParams {
14
19
  value: any;
15
20
  }
16
21
  export declare const entryFieldFromStorageTransform: <T = any>(params: EntryFieldFromStorageTransformParams) => Promise<T>;
22
+ export interface ICreateTransformEntryCallable {
23
+ context: Pick<CmsContext, "plugins">;
24
+ }
25
+ export interface ITransformEntryCallable<T extends CmsEntryValues = CmsEntryValues> {
26
+ (model: CmsModel, entry: CmsEntry): Promise<CmsEntry<T>>;
27
+ }
28
+ export declare const createTransformEntryCallable: (params: ICreateTransformEntryCallable) => ITransformEntryCallable;
17
29
  export {};