@webiny/api-headless-cms 5.40.0-beta.1 → 5.40.0-beta.3

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 (548) hide show
  1. package/constants.d.ts +11 -1
  2. package/constants.js +15 -9
  3. package/constants.js.map +1 -1
  4. package/context.js +47 -31
  5. package/context.js.map +1 -1
  6. package/crud/AccessControl/AccessControl.d.ts +3 -3
  7. package/crud/AccessControl/AccessControl.js.map +1 -1
  8. package/crud/contentEntry/abstractions/IDeleteEntry.d.ts +4 -0
  9. package/crud/contentEntry/abstractions/IDeleteEntry.js +7 -0
  10. package/crud/contentEntry/abstractions/IDeleteEntry.js.map +1 -0
  11. package/crud/contentEntry/abstractions/IDeleteEntryOperation.d.ts +4 -0
  12. package/crud/contentEntry/abstractions/IDeleteEntryOperation.js +7 -0
  13. package/crud/contentEntry/abstractions/IDeleteEntryOperation.js.map +1 -0
  14. package/crud/contentEntry/abstractions/IGetEntriesByIds.d.ts +4 -0
  15. package/crud/contentEntry/abstractions/IGetEntriesByIds.js +7 -0
  16. package/crud/contentEntry/abstractions/IGetEntriesByIds.js.map +1 -0
  17. package/crud/contentEntry/abstractions/IGetEntry.d.ts +4 -0
  18. package/crud/contentEntry/abstractions/IGetEntry.js +7 -0
  19. package/crud/contentEntry/abstractions/IGetEntry.js.map +1 -0
  20. package/crud/contentEntry/abstractions/IGetLatestEntriesByIds.d.ts +4 -0
  21. package/crud/contentEntry/abstractions/IGetLatestEntriesByIds.js +7 -0
  22. package/crud/contentEntry/abstractions/IGetLatestEntriesByIds.js.map +1 -0
  23. package/crud/contentEntry/abstractions/IGetLatestRevisionByEntryId.d.ts +4 -0
  24. package/crud/contentEntry/abstractions/IGetLatestRevisionByEntryId.js +7 -0
  25. package/crud/contentEntry/abstractions/IGetLatestRevisionByEntryId.js.map +1 -0
  26. package/crud/contentEntry/abstractions/IGetPreviousRevisionByEntryId.d.ts +4 -0
  27. package/crud/contentEntry/abstractions/IGetPreviousRevisionByEntryId.js +7 -0
  28. package/crud/contentEntry/abstractions/IGetPreviousRevisionByEntryId.js.map +1 -0
  29. package/crud/contentEntry/abstractions/IGetPublishedEntriesByIds.d.ts +4 -0
  30. package/crud/contentEntry/abstractions/IGetPublishedEntriesByIds.js +7 -0
  31. package/crud/contentEntry/abstractions/IGetPublishedEntriesByIds.js.map +1 -0
  32. package/crud/contentEntry/abstractions/IGetPublishedRevisionByEntryId.d.ts +4 -0
  33. package/crud/contentEntry/abstractions/IGetPublishedRevisionByEntryId.js +7 -0
  34. package/crud/contentEntry/abstractions/IGetPublishedRevisionByEntryId.js.map +1 -0
  35. package/crud/contentEntry/abstractions/IGetRevisionById.d.ts +4 -0
  36. package/crud/contentEntry/abstractions/IGetRevisionById.js +7 -0
  37. package/crud/contentEntry/abstractions/IGetRevisionById.js.map +1 -0
  38. package/crud/contentEntry/abstractions/IGetRevisionsByEntryId.d.ts +4 -0
  39. package/crud/contentEntry/abstractions/IGetRevisionsByEntryId.js +7 -0
  40. package/crud/contentEntry/abstractions/IGetRevisionsByEntryId.js.map +1 -0
  41. package/crud/contentEntry/abstractions/IListEntries.d.ts +4 -0
  42. package/crud/contentEntry/abstractions/IListEntries.js +7 -0
  43. package/crud/contentEntry/abstractions/IListEntries.js.map +1 -0
  44. package/crud/contentEntry/abstractions/IListEntriesOperation.d.ts +4 -0
  45. package/crud/contentEntry/abstractions/IListEntriesOperation.js +7 -0
  46. package/crud/contentEntry/abstractions/IListEntriesOperation.js.map +1 -0
  47. package/crud/contentEntry/abstractions/IMoveEntryToBinOperation.d.ts +4 -0
  48. package/crud/contentEntry/abstractions/IMoveEntryToBinOperation.js +7 -0
  49. package/crud/contentEntry/abstractions/IMoveEntryToBinOperation.js.map +1 -0
  50. package/crud/contentEntry/abstractions/IRestoreEntryFromBin.d.ts +4 -0
  51. package/crud/contentEntry/abstractions/IRestoreEntryFromBin.js +7 -0
  52. package/crud/contentEntry/abstractions/IRestoreEntryFromBin.js.map +1 -0
  53. package/crud/contentEntry/abstractions/IRestoreEntryFromBinOperation.d.ts +4 -0
  54. package/crud/contentEntry/abstractions/IRestoreEntryFromBinOperation.js +7 -0
  55. package/crud/contentEntry/abstractions/IRestoreEntryFromBinOperation.js.map +1 -0
  56. package/crud/contentEntry/abstractions/index.d.ts +16 -0
  57. package/crud/contentEntry/abstractions/index.js +183 -0
  58. package/crud/contentEntry/abstractions/index.js.map +1 -0
  59. package/crud/contentEntry/afterDelete.js.map +1 -1
  60. package/crud/contentEntry/beforeCreate.js.map +1 -1
  61. package/crud/contentEntry/beforeUpdate.js.map +1 -1
  62. package/crud/contentEntry/entryDataFactories/createEntryData.js +9 -1
  63. package/crud/contentEntry/entryDataFactories/createEntryData.js.map +1 -1
  64. package/crud/contentEntry/entryDataFactories/createEntryRevisionFromData.js.map +1 -1
  65. package/crud/contentEntry/entryDataFactories/createPublishEntryData.js.map +1 -1
  66. package/crud/contentEntry/entryDataFactories/createRepublishEntryData.js.map +1 -1
  67. package/crud/contentEntry/entryDataFactories/createUnpublishEntryData.js.map +1 -1
  68. package/crud/contentEntry/entryDataFactories/createUpdateEntryData.js +8 -0
  69. package/crud/contentEntry/entryDataFactories/createUpdateEntryData.js.map +1 -1
  70. package/crud/contentEntry/entryDataFactories/index.js.map +1 -1
  71. package/crud/contentEntry/entryDataFactories/mapAndCleanUpdatedInputData.js.map +1 -1
  72. package/crud/contentEntry/entryDataFactories/statuses.js +3 -6
  73. package/crud/contentEntry/entryDataFactories/statuses.js.map +1 -1
  74. package/crud/contentEntry/entryDataValidation.js.map +1 -1
  75. package/crud/contentEntry/markLockedFields.js.map +1 -1
  76. package/crud/contentEntry/referenceFieldsMapping.js +1 -1
  77. package/crud/contentEntry/referenceFieldsMapping.js.map +1 -1
  78. package/crud/contentEntry/searchableFields.js.map +1 -1
  79. package/crud/contentEntry/useCases/DeleteEntry/DeleteEntry.d.ts +10 -0
  80. package/crud/contentEntry/useCases/DeleteEntry/DeleteEntry.js +58 -0
  81. package/crud/contentEntry/useCases/DeleteEntry/DeleteEntry.js.map +1 -0
  82. package/crud/contentEntry/useCases/DeleteEntry/DeleteEntryOperation.d.ts +7 -0
  83. package/crud/contentEntry/useCases/DeleteEntry/DeleteEntryOperation.js +17 -0
  84. package/crud/contentEntry/useCases/DeleteEntry/DeleteEntryOperation.js.map +1 -0
  85. package/crud/contentEntry/useCases/DeleteEntry/DeleteEntryOperationWithEvents.d.ts +9 -0
  86. package/crud/contentEntry/useCases/DeleteEntry/DeleteEntryOperationWithEvents.js +45 -0
  87. package/crud/contentEntry/useCases/DeleteEntry/DeleteEntryOperationWithEvents.js.map +1 -0
  88. package/crud/contentEntry/useCases/DeleteEntry/DeleteEntrySecure.d.ts +9 -0
  89. package/crud/contentEntry/useCases/DeleteEntry/DeleteEntrySecure.js +22 -0
  90. package/crud/contentEntry/useCases/DeleteEntry/DeleteEntrySecure.js.map +1 -0
  91. package/crud/contentEntry/useCases/DeleteEntry/MoveEntryToBin.d.ts +10 -0
  92. package/crud/contentEntry/useCases/DeleteEntry/MoveEntryToBin.js +33 -0
  93. package/crud/contentEntry/useCases/DeleteEntry/MoveEntryToBin.js.map +1 -0
  94. package/crud/contentEntry/useCases/DeleteEntry/MoveEntryToBinOperation.d.ts +7 -0
  95. package/crud/contentEntry/useCases/DeleteEntry/MoveEntryToBinOperation.js +17 -0
  96. package/crud/contentEntry/useCases/DeleteEntry/MoveEntryToBinOperation.js.map +1 -0
  97. package/crud/contentEntry/useCases/DeleteEntry/MoveEntryToBinOperationWithEvents.d.ts +9 -0
  98. package/crud/contentEntry/useCases/DeleteEntry/MoveEntryToBinOperationWithEvents.js +45 -0
  99. package/crud/contentEntry/useCases/DeleteEntry/MoveEntryToBinOperationWithEvents.js.map +1 -0
  100. package/crud/contentEntry/useCases/DeleteEntry/TransformEntryDelete.d.ts +6 -0
  101. package/crud/contentEntry/useCases/DeleteEntry/TransformEntryDelete.js +21 -0
  102. package/crud/contentEntry/useCases/DeleteEntry/TransformEntryDelete.js.map +1 -0
  103. package/crud/contentEntry/useCases/DeleteEntry/TransformEntryMoveToBin.d.ts +9 -0
  104. package/crud/contentEntry/useCases/DeleteEntry/TransformEntryMoveToBin.js +62 -0
  105. package/crud/contentEntry/useCases/DeleteEntry/TransformEntryMoveToBin.js.map +1 -0
  106. package/crud/contentEntry/useCases/DeleteEntry/index.d.ts +28 -0
  107. package/crud/contentEntry/useCases/DeleteEntry/index.js +42 -0
  108. package/crud/contentEntry/useCases/DeleteEntry/index.js.map +1 -0
  109. package/crud/contentEntry/useCases/GetEntriesByIds/GetEntriesByIds.d.ts +7 -0
  110. package/crud/contentEntry/useCases/GetEntriesByIds/GetEntriesByIds.js +17 -0
  111. package/crud/contentEntry/useCases/GetEntriesByIds/GetEntriesByIds.js.map +1 -0
  112. package/crud/contentEntry/useCases/GetEntriesByIds/GetEntriesByIdsNotDeleted.d.ts +7 -0
  113. package/crud/contentEntry/useCases/GetEntriesByIds/GetEntriesByIdsNotDeleted.js +18 -0
  114. package/crud/contentEntry/useCases/GetEntriesByIds/GetEntriesByIdsNotDeleted.js.map +1 -0
  115. package/crud/contentEntry/useCases/GetEntriesByIds/GetEntriesByIdsSecure.d.ts +9 -0
  116. package/crud/contentEntry/useCases/GetEntriesByIds/GetEntriesByIdsSecure.js +28 -0
  117. package/crud/contentEntry/useCases/GetEntriesByIds/GetEntriesByIdsSecure.js.map +1 -0
  118. package/crud/contentEntry/useCases/GetEntriesByIds/index.d.ts +11 -0
  119. package/crud/contentEntry/useCases/GetEntriesByIds/index.js +20 -0
  120. package/crud/contentEntry/useCases/GetEntriesByIds/index.js.map +1 -0
  121. package/crud/contentEntry/useCases/GetLatestEntriesByIds/GetLatestEntriesByIds.d.ts +7 -0
  122. package/crud/contentEntry/useCases/GetLatestEntriesByIds/GetLatestEntriesByIds.js +17 -0
  123. package/crud/contentEntry/useCases/GetLatestEntriesByIds/GetLatestEntriesByIds.js.map +1 -0
  124. package/crud/contentEntry/useCases/GetLatestEntriesByIds/GetLatestEntriesByIdsNotDeleted.d.ts +7 -0
  125. package/crud/contentEntry/useCases/GetLatestEntriesByIds/GetLatestEntriesByIdsNotDeleted.js +18 -0
  126. package/crud/contentEntry/useCases/GetLatestEntriesByIds/GetLatestEntriesByIdsNotDeleted.js.map +1 -0
  127. package/crud/contentEntry/useCases/GetLatestEntriesByIds/GetLatestEntriesByIdsSecure.d.ts +9 -0
  128. package/crud/contentEntry/useCases/GetLatestEntriesByIds/GetLatestEntriesByIdsSecure.js +28 -0
  129. package/crud/contentEntry/useCases/GetLatestEntriesByIds/GetLatestEntriesByIdsSecure.js.map +1 -0
  130. package/crud/contentEntry/useCases/GetLatestEntriesByIds/index.d.ts +11 -0
  131. package/crud/contentEntry/useCases/GetLatestEntriesByIds/index.js +20 -0
  132. package/crud/contentEntry/useCases/GetLatestEntriesByIds/index.js.map +1 -0
  133. package/crud/contentEntry/useCases/GetLatestRevisionByEntryId/GetLatestRevisionByEntryId.d.ts +7 -0
  134. package/crud/contentEntry/useCases/GetLatestRevisionByEntryId/GetLatestRevisionByEntryId.js +17 -0
  135. package/crud/contentEntry/useCases/GetLatestRevisionByEntryId/GetLatestRevisionByEntryId.js.map +1 -0
  136. package/crud/contentEntry/useCases/GetLatestRevisionByEntryId/GetLatestRevisionByEntryIdDeleted.d.ts +7 -0
  137. package/crud/contentEntry/useCases/GetLatestRevisionByEntryId/GetLatestRevisionByEntryIdDeleted.js +21 -0
  138. package/crud/contentEntry/useCases/GetLatestRevisionByEntryId/GetLatestRevisionByEntryIdDeleted.js.map +1 -0
  139. package/crud/contentEntry/useCases/GetLatestRevisionByEntryId/GetLatestRevisionByEntryIdNotDeleted.d.ts +7 -0
  140. package/crud/contentEntry/useCases/GetLatestRevisionByEntryId/GetLatestRevisionByEntryIdNotDeleted.js +21 -0
  141. package/crud/contentEntry/useCases/GetLatestRevisionByEntryId/GetLatestRevisionByEntryIdNotDeleted.js.map +1 -0
  142. package/crud/contentEntry/useCases/GetLatestRevisionByEntryId/index.d.ts +13 -0
  143. package/crud/contentEntry/useCases/GetLatestRevisionByEntryId/index.js +22 -0
  144. package/crud/contentEntry/useCases/GetLatestRevisionByEntryId/index.js.map +1 -0
  145. package/crud/contentEntry/useCases/GetPreviousRevisionByEntryId/GetPreviousRevisionByEntryId.d.ts +7 -0
  146. package/crud/contentEntry/useCases/GetPreviousRevisionByEntryId/GetPreviousRevisionByEntryId.js +17 -0
  147. package/crud/contentEntry/useCases/GetPreviousRevisionByEntryId/GetPreviousRevisionByEntryId.js.map +1 -0
  148. package/crud/contentEntry/useCases/GetPreviousRevisionByEntryId/GetPreviousRevisionByEntryIdNotDeleted.d.ts +7 -0
  149. package/crud/contentEntry/useCases/GetPreviousRevisionByEntryId/GetPreviousRevisionByEntryIdNotDeleted.js +21 -0
  150. package/crud/contentEntry/useCases/GetPreviousRevisionByEntryId/GetPreviousRevisionByEntryIdNotDeleted.js.map +1 -0
  151. package/crud/contentEntry/useCases/GetPreviousRevisionByEntryId/index.d.ts +9 -0
  152. package/crud/contentEntry/useCases/GetPreviousRevisionByEntryId/index.js +18 -0
  153. package/crud/contentEntry/useCases/GetPreviousRevisionByEntryId/index.js.map +1 -0
  154. package/crud/contentEntry/useCases/GetPublishedEntriesByIds/GetPublishedEntriesByIds.d.ts +7 -0
  155. package/crud/contentEntry/useCases/GetPublishedEntriesByIds/GetPublishedEntriesByIds.js +17 -0
  156. package/crud/contentEntry/useCases/GetPublishedEntriesByIds/GetPublishedEntriesByIds.js.map +1 -0
  157. package/crud/contentEntry/useCases/GetPublishedEntriesByIds/GetPublishedEntriesByIdsNotDeleted.d.ts +7 -0
  158. package/crud/contentEntry/useCases/GetPublishedEntriesByIds/GetPublishedEntriesByIdsNotDeleted.js +18 -0
  159. package/crud/contentEntry/useCases/GetPublishedEntriesByIds/GetPublishedEntriesByIdsNotDeleted.js.map +1 -0
  160. package/crud/contentEntry/useCases/GetPublishedEntriesByIds/GetPublishedEntriesByIdsSecure.d.ts +9 -0
  161. package/crud/contentEntry/useCases/GetPublishedEntriesByIds/GetPublishedEntriesByIdsSecure.js +28 -0
  162. package/crud/contentEntry/useCases/GetPublishedEntriesByIds/GetPublishedEntriesByIdsSecure.js.map +1 -0
  163. package/crud/contentEntry/useCases/GetPublishedEntriesByIds/index.d.ts +11 -0
  164. package/crud/contentEntry/useCases/GetPublishedEntriesByIds/index.js +20 -0
  165. package/crud/contentEntry/useCases/GetPublishedEntriesByIds/index.js.map +1 -0
  166. package/crud/contentEntry/useCases/GetPublishedRevisionByEntryId/GetPublishedRevisionByEntryId.d.ts +7 -0
  167. package/crud/contentEntry/useCases/GetPublishedRevisionByEntryId/GetPublishedRevisionByEntryId.js +17 -0
  168. package/crud/contentEntry/useCases/GetPublishedRevisionByEntryId/GetPublishedRevisionByEntryId.js.map +1 -0
  169. package/crud/contentEntry/useCases/GetPublishedRevisionByEntryId/GetPublishedRevisionByEntryIdNotDeleted.d.ts +7 -0
  170. package/crud/contentEntry/useCases/GetPublishedRevisionByEntryId/GetPublishedRevisionByEntryIdNotDeleted.js +21 -0
  171. package/crud/contentEntry/useCases/GetPublishedRevisionByEntryId/GetPublishedRevisionByEntryIdNotDeleted.js.map +1 -0
  172. package/crud/contentEntry/useCases/GetPublishedRevisionByEntryId/index.d.ts +9 -0
  173. package/crud/contentEntry/useCases/GetPublishedRevisionByEntryId/index.js +18 -0
  174. package/crud/contentEntry/useCases/GetPublishedRevisionByEntryId/index.js.map +1 -0
  175. package/crud/contentEntry/useCases/GetRevisionById/GetRevisionById.d.ts +7 -0
  176. package/crud/contentEntry/useCases/GetRevisionById/GetRevisionById.js +17 -0
  177. package/crud/contentEntry/useCases/GetRevisionById/GetRevisionById.js.map +1 -0
  178. package/crud/contentEntry/useCases/GetRevisionById/GetRevisionByIdNotDeleted.d.ts +7 -0
  179. package/crud/contentEntry/useCases/GetRevisionById/GetRevisionByIdNotDeleted.js +21 -0
  180. package/crud/contentEntry/useCases/GetRevisionById/GetRevisionByIdNotDeleted.js.map +1 -0
  181. package/crud/contentEntry/useCases/GetRevisionById/index.d.ts +9 -0
  182. package/crud/contentEntry/useCases/GetRevisionById/index.js +18 -0
  183. package/crud/contentEntry/useCases/GetRevisionById/index.js.map +1 -0
  184. package/crud/contentEntry/useCases/GetRevisionsByEntryId/GetRevisionsByEntryId.d.ts +7 -0
  185. package/crud/contentEntry/useCases/GetRevisionsByEntryId/GetRevisionsByEntryId.js +17 -0
  186. package/crud/contentEntry/useCases/GetRevisionsByEntryId/GetRevisionsByEntryId.js.map +1 -0
  187. package/crud/contentEntry/useCases/GetRevisionsByEntryId/GetRevisionsByEntryIdNotDeleted.d.ts +7 -0
  188. package/crud/contentEntry/useCases/GetRevisionsByEntryId/GetRevisionsByEntryIdNotDeleted.js +18 -0
  189. package/crud/contentEntry/useCases/GetRevisionsByEntryId/GetRevisionsByEntryIdNotDeleted.js.map +1 -0
  190. package/crud/contentEntry/useCases/GetRevisionsByEntryId/index.d.ts +11 -0
  191. package/crud/contentEntry/useCases/GetRevisionsByEntryId/index.js +18 -0
  192. package/crud/contentEntry/useCases/GetRevisionsByEntryId/index.js.map +1 -0
  193. package/crud/contentEntry/useCases/ListEntries/GetEntry.d.ts +7 -0
  194. package/crud/contentEntry/useCases/ListEntries/GetEntry.js +29 -0
  195. package/crud/contentEntry/useCases/ListEntries/GetEntry.js.map +1 -0
  196. package/crud/contentEntry/useCases/ListEntries/GetEntrySecure.d.ts +11 -0
  197. package/crud/contentEntry/useCases/ListEntries/GetEntrySecure.js +38 -0
  198. package/crud/contentEntry/useCases/ListEntries/GetEntrySecure.js.map +1 -0
  199. package/crud/contentEntry/useCases/ListEntries/ListEntries.d.ts +7 -0
  200. package/crud/contentEntry/useCases/ListEntries/ListEntries.js +62 -0
  201. package/crud/contentEntry/useCases/ListEntries/ListEntries.js.map +1 -0
  202. package/crud/contentEntry/useCases/ListEntries/ListEntriesOperation.d.ts +7 -0
  203. package/crud/contentEntry/useCases/ListEntries/ListEntriesOperation.js +17 -0
  204. package/crud/contentEntry/useCases/ListEntries/ListEntriesOperation.js.map +1 -0
  205. package/crud/contentEntry/useCases/ListEntries/ListEntriesOperationDeleted.d.ts +7 -0
  206. package/crud/contentEntry/useCases/ListEntries/ListEntriesOperationDeleted.js +24 -0
  207. package/crud/contentEntry/useCases/ListEntries/ListEntriesOperationDeleted.js.map +1 -0
  208. package/crud/contentEntry/useCases/ListEntries/ListEntriesOperationLatest.d.ts +7 -0
  209. package/crud/contentEntry/useCases/ListEntries/ListEntriesOperationLatest.js +25 -0
  210. package/crud/contentEntry/useCases/ListEntries/ListEntriesOperationLatest.js.map +1 -0
  211. package/crud/contentEntry/useCases/ListEntries/ListEntriesOperationNotDeleted.d.ts +7 -0
  212. package/crud/contentEntry/useCases/ListEntries/ListEntriesOperationNotDeleted.js +24 -0
  213. package/crud/contentEntry/useCases/ListEntries/ListEntriesOperationNotDeleted.js.map +1 -0
  214. package/crud/contentEntry/useCases/ListEntries/ListEntriesOperationPublished.d.ts +7 -0
  215. package/crud/contentEntry/useCases/ListEntries/ListEntriesOperationPublished.js +24 -0
  216. package/crud/contentEntry/useCases/ListEntries/ListEntriesOperationPublished.js.map +1 -0
  217. package/crud/contentEntry/useCases/ListEntries/ListEntriesOperationWithEvents.d.ts +9 -0
  218. package/crud/contentEntry/useCases/ListEntries/ListEntriesOperationWithEvents.js +22 -0
  219. package/crud/contentEntry/useCases/ListEntries/ListEntriesOperationWithEvents.js.map +1 -0
  220. package/crud/contentEntry/useCases/ListEntries/ListEntriesOperationWithSearchableFields.d.ts +8 -0
  221. package/crud/contentEntry/useCases/ListEntries/ListEntriesOperationWithSearchableFields.js +27 -0
  222. package/crud/contentEntry/useCases/ListEntries/ListEntriesOperationWithSearchableFields.js.map +1 -0
  223. package/crud/contentEntry/useCases/ListEntries/ListEntriesOperationWithSort.d.ts +8 -0
  224. package/crud/contentEntry/useCases/ListEntries/ListEntriesOperationWithSort.js +26 -0
  225. package/crud/contentEntry/useCases/ListEntries/ListEntriesOperationWithSort.js.map +1 -0
  226. package/crud/contentEntry/useCases/ListEntries/ListEntriesOperationWithStatusCheck.d.ts +7 -0
  227. package/crud/contentEntry/useCases/ListEntries/ListEntriesOperationWithStatusCheck.js +36 -0
  228. package/crud/contentEntry/useCases/ListEntries/ListEntriesOperationWithStatusCheck.js.map +1 -0
  229. package/crud/contentEntry/useCases/ListEntries/ListEntriesSecure.d.ts +11 -0
  230. package/crud/contentEntry/useCases/ListEntries/ListEntriesSecure.js +41 -0
  231. package/crud/contentEntry/useCases/ListEntries/ListEntriesSecure.js.map +1 -0
  232. package/crud/contentEntry/useCases/ListEntries/index.d.ts +24 -0
  233. package/crud/contentEntry/useCases/ListEntries/index.js +61 -0
  234. package/crud/contentEntry/useCases/ListEntries/index.js.map +1 -0
  235. package/crud/contentEntry/useCases/RestoreEntryFromBin/RestoreEntryFromBin.d.ts +10 -0
  236. package/crud/contentEntry/useCases/RestoreEntryFromBin/RestoreEntryFromBin.js +37 -0
  237. package/crud/contentEntry/useCases/RestoreEntryFromBin/RestoreEntryFromBin.js.map +1 -0
  238. package/crud/contentEntry/useCases/RestoreEntryFromBin/RestoreEntryFromBinOperation.d.ts +7 -0
  239. package/crud/contentEntry/useCases/RestoreEntryFromBin/RestoreEntryFromBinOperation.js +17 -0
  240. package/crud/contentEntry/useCases/RestoreEntryFromBin/RestoreEntryFromBinOperation.js.map +1 -0
  241. package/crud/contentEntry/useCases/RestoreEntryFromBin/RestoreEntryFromBinOperationWithEvents.d.ts +9 -0
  242. package/crud/contentEntry/useCases/RestoreEntryFromBin/RestoreEntryFromBinOperationWithEvents.js +42 -0
  243. package/crud/contentEntry/useCases/RestoreEntryFromBin/RestoreEntryFromBinOperationWithEvents.js.map +1 -0
  244. package/crud/contentEntry/useCases/RestoreEntryFromBin/RestoreEntryFromBinSecure.d.ts +9 -0
  245. package/crud/contentEntry/useCases/RestoreEntryFromBin/RestoreEntryFromBinSecure.js +22 -0
  246. package/crud/contentEntry/useCases/RestoreEntryFromBin/RestoreEntryFromBinSecure.js.map +1 -0
  247. package/crud/contentEntry/useCases/RestoreEntryFromBin/TransformEntryRestoreFromBin.d.ts +9 -0
  248. package/crud/contentEntry/useCases/RestoreEntryFromBin/TransformEntryRestoreFromBin.js +61 -0
  249. package/crud/contentEntry/useCases/RestoreEntryFromBin/TransformEntryRestoreFromBin.js.map +1 -0
  250. package/crud/contentEntry/useCases/RestoreEntryFromBin/index.d.ts +23 -0
  251. package/crud/contentEntry/useCases/RestoreEntryFromBin/index.js +24 -0
  252. package/crud/contentEntry/useCases/RestoreEntryFromBin/index.js.map +1 -0
  253. package/crud/contentEntry/useCases/index.d.ts +11 -0
  254. package/crud/contentEntry/useCases/index.js +128 -0
  255. package/crud/contentEntry/useCases/index.js.map +1 -0
  256. package/crud/contentEntry.crud.js +210 -269
  257. package/crud/contentEntry.crud.js.map +1 -1
  258. package/crud/contentModel/beforeCreate.js.map +1 -1
  259. package/crud/contentModel/beforeDelete.js.map +1 -1
  260. package/crud/contentModel/beforeUpdate.js.map +1 -1
  261. package/crud/contentModel/compatibility/modelApiName.js.map +1 -1
  262. package/crud/contentModel/contentModelManagerFactory.d.ts +1 -1
  263. package/crud/contentModel/contentModelManagerFactory.js.map +1 -1
  264. package/crud/contentModel/createFieldStorageId.js.map +1 -1
  265. package/crud/contentModel/defaultFields.js.map +1 -1
  266. package/crud/contentModel/ensureTypeTag.js.map +1 -1
  267. package/crud/contentModel/fields/descriptionField.js.map +1 -1
  268. package/crud/contentModel/fields/imageField.js.map +1 -1
  269. package/crud/contentModel/fields/titleField.js.map +1 -1
  270. package/crud/contentModel/listModelsFromDatabase.js.map +1 -1
  271. package/crud/contentModel/validate/endingAllowed.js.map +1 -1
  272. package/crud/contentModel/validate/isModelEndingAllowed.js +1 -2
  273. package/crud/contentModel/validate/isModelEndingAllowed.js.map +1 -1
  274. package/crud/contentModel/validate/modelId.js.map +1 -1
  275. package/crud/contentModel/validate/pluralApiName.js.map +1 -1
  276. package/crud/contentModel/validate/singularApiName.js.map +1 -1
  277. package/crud/contentModel/validateModel.js.map +1 -1
  278. package/crud/contentModel/validateModelFields.d.ts +1 -1
  279. package/crud/contentModel/validateModelFields.js.map +1 -1
  280. package/crud/contentModel/validateStorageId.d.ts +1 -0
  281. package/crud/contentModel/validateStorageId.js +29 -0
  282. package/crud/contentModel/validateStorageId.js.map +1 -0
  283. package/crud/contentModel/validation.d.ts +51 -30
  284. package/crud/contentModel/validation.js +3 -2
  285. package/crud/contentModel/validation.js.map +1 -1
  286. package/crud/contentModel.crud.js +6 -0
  287. package/crud/contentModel.crud.js.map +1 -1
  288. package/crud/contentModelGroup/beforeCreate.js.map +1 -1
  289. package/crud/contentModelGroup/beforeDelete.js.map +1 -1
  290. package/crud/contentModelGroup/beforeUpdate.js.map +1 -1
  291. package/crud/contentModelGroup/listGroupsFromDatabase.js.map +1 -1
  292. package/crud/contentModelGroup/validation.js.map +1 -1
  293. package/crud/contentModelGroup.crud.js.map +1 -1
  294. package/crud/system.crud.js.map +1 -1
  295. package/export/crud/exporting.js.map +1 -1
  296. package/export/crud/importing.js.map +1 -1
  297. package/export/crud/imports/importData.js.map +1 -1
  298. package/export/crud/imports/importGroups.js.map +1 -1
  299. package/export/crud/imports/importModels.js.map +1 -1
  300. package/export/crud/imports/validateGroups.js.map +1 -1
  301. package/export/crud/imports/validateInput.js.map +1 -1
  302. package/export/crud/imports/validateModels.js.map +1 -1
  303. package/export/crud/index.js.map +1 -1
  304. package/export/crud/sanitize.js.map +1 -1
  305. package/export/graphql/index.js +1 -1
  306. package/export/graphql/index.js.map +1 -1
  307. package/export/index.js.map +1 -1
  308. package/export/types.js +1 -2
  309. package/export/types.js.map +1 -1
  310. package/fieldConverters/CmsModelDefaultFieldConverterPlugin.js.map +1 -1
  311. package/fieldConverters/CmsModelDynamicZoneFieldConverterPlugin.js +4 -14
  312. package/fieldConverters/CmsModelDynamicZoneFieldConverterPlugin.js.map +1 -1
  313. package/fieldConverters/CmsModelObjectFieldConverterPlugin.js.map +1 -1
  314. package/fieldConverters/index.js.map +1 -1
  315. package/graphql/buildSchemaPlugins.d.ts +2 -2
  316. package/graphql/buildSchemaPlugins.js.map +1 -1
  317. package/graphql/checkEndpointAccess.js.map +1 -1
  318. package/graphql/createExecutableSchema.d.ts +2 -2
  319. package/graphql/createExecutableSchema.js.map +1 -1
  320. package/graphql/createRequestBody.js.map +1 -1
  321. package/graphql/formatErrorPayload.js.map +1 -1
  322. package/graphql/generateSchema.js.map +1 -1
  323. package/graphql/getSchema.js.map +1 -1
  324. package/graphql/graphQLHandlerFactory.js.map +1 -1
  325. package/graphql/handleRequest.js.map +1 -1
  326. package/graphql/index.js.map +1 -1
  327. package/graphql/schema/baseContentSchema.d.ts +2 -2
  328. package/graphql/schema/baseContentSchema.js +1 -7
  329. package/graphql/schema/baseContentSchema.js.map +1 -1
  330. package/graphql/schema/baseSchema.js +12 -5
  331. package/graphql/schema/baseSchema.js.map +1 -1
  332. package/graphql/schema/contentEntries.d.ts +2 -2
  333. package/graphql/schema/contentEntries.js +2 -2
  334. package/graphql/schema/contentEntries.js.map +1 -1
  335. package/graphql/schema/contentModelGroups.d.ts +2 -2
  336. package/graphql/schema/contentModelGroups.js +1 -1
  337. package/graphql/schema/contentModelGroups.js.map +1 -1
  338. package/graphql/schema/contentModels.d.ts +2 -2
  339. package/graphql/schema/contentModels.js +3 -1
  340. package/graphql/schema/contentModels.js.map +1 -1
  341. package/graphql/schema/createFieldResolvers.js.map +1 -1
  342. package/graphql/schema/createFieldTypePluginRecords.js.map +1 -1
  343. package/graphql/schema/createManageResolvers.js +8 -0
  344. package/graphql/schema/createManageResolvers.js.map +1 -1
  345. package/graphql/schema/createManageSDL.js +10 -0
  346. package/graphql/schema/createManageSDL.js.map +1 -1
  347. package/graphql/schema/createPreviewResolvers.js.map +1 -1
  348. package/graphql/schema/createReadResolvers.js.map +1 -1
  349. package/graphql/schema/createReadSDL.js.map +1 -1
  350. package/graphql/schema/resolvers/manage/resolveCreate.js.map +1 -1
  351. package/graphql/schema/resolvers/manage/resolveCreateFrom.js.map +1 -1
  352. package/graphql/schema/resolvers/manage/resolveDelete.js +2 -1
  353. package/graphql/schema/resolvers/manage/resolveDelete.js.map +1 -1
  354. package/graphql/schema/resolvers/manage/resolveDeleteMultiple.js.map +1 -1
  355. package/graphql/schema/resolvers/manage/resolveGet.js.map +1 -1
  356. package/graphql/schema/resolvers/manage/resolveGetByIds.js.map +1 -1
  357. package/graphql/schema/resolvers/manage/resolveGetRevisions.js.map +1 -1
  358. package/graphql/schema/resolvers/manage/resolveGetUniqueFieldValues.js.map +1 -1
  359. package/graphql/schema/resolvers/manage/resolveList.js.map +1 -1
  360. package/graphql/schema/resolvers/manage/resolveListDeleted.d.ts +4 -0
  361. package/graphql/schema/resolvers/manage/resolveListDeleted.js +20 -0
  362. package/graphql/schema/resolvers/manage/resolveListDeleted.js.map +1 -0
  363. package/graphql/schema/resolvers/manage/resolveMove.js.map +1 -1
  364. package/graphql/schema/resolvers/manage/resolvePublish.js.map +1 -1
  365. package/graphql/schema/resolvers/manage/resolveRepublish.js.map +1 -1
  366. package/graphql/schema/resolvers/manage/resolveRestoreFromBin.d.ts +7 -0
  367. package/graphql/schema/resolvers/manage/resolveRestoreFromBin.js +20 -0
  368. package/graphql/schema/resolvers/manage/resolveRestoreFromBin.js.map +1 -0
  369. package/graphql/schema/resolvers/manage/resolveUnpublish.js.map +1 -1
  370. package/graphql/schema/resolvers/manage/resolveUpdate.js.map +1 -1
  371. package/graphql/schema/resolvers/manage/resolveValidate.js.map +1 -1
  372. package/graphql/schema/resolvers/preview/resolveGet.js.map +1 -1
  373. package/graphql/schema/resolvers/preview/resolveList.js.map +1 -1
  374. package/graphql/schema/resolvers/read/resolveGet.js.map +1 -1
  375. package/graphql/schema/resolvers/read/resolveList.js.map +1 -1
  376. package/graphql/schema/schemaPlugins.d.ts +2 -2
  377. package/graphql/schema/schemaPlugins.js +2 -2
  378. package/graphql/schema/schemaPlugins.js.map +1 -1
  379. package/graphql/system.js.map +1 -1
  380. package/graphqlFields/boolean.js.map +1 -1
  381. package/graphqlFields/datetime.js.map +1 -1
  382. package/graphqlFields/dynamicZone/dynamicZoneField.js +27 -1
  383. package/graphqlFields/dynamicZone/dynamicZoneField.js.map +1 -1
  384. package/graphqlFields/dynamicZone/dynamicZoneStorage.js.map +1 -1
  385. package/graphqlFields/dynamicZone/index.js.map +1 -1
  386. package/graphqlFields/file.js.map +1 -1
  387. package/graphqlFields/helpers.js.map +1 -1
  388. package/graphqlFields/index.js.map +1 -1
  389. package/graphqlFields/json.js.map +1 -1
  390. package/graphqlFields/longText.js.map +1 -1
  391. package/graphqlFields/number.js.map +1 -1
  392. package/graphqlFields/object.d.ts +2 -2
  393. package/graphqlFields/object.js +14 -0
  394. package/graphqlFields/object.js.map +1 -1
  395. package/graphqlFields/ref.js.map +1 -1
  396. package/graphqlFields/richText/RichTextPluginsProcessor.js.map +1 -1
  397. package/graphqlFields/richText/richTextResolver.js.map +1 -1
  398. package/graphqlFields/richText.js.map +1 -1
  399. package/graphqlFields/text.js.map +1 -1
  400. package/htmlRenderer/LexicalRenderer.js.map +1 -1
  401. package/htmlRenderer/createLexicalHTMLRenderer.js.map +1 -1
  402. package/index.js.map +1 -1
  403. package/modelManager/DefaultCmsModelManager.d.ts +1 -0
  404. package/modelManager/DefaultCmsModelManager.js +3 -0
  405. package/modelManager/DefaultCmsModelManager.js.map +1 -1
  406. package/modelManager/index.js +1 -1
  407. package/modelManager/index.js.map +1 -1
  408. package/package.json +27 -27
  409. package/parameters/context.js.map +1 -1
  410. package/parameters/header.js.map +1 -1
  411. package/parameters/index.js.map +1 -1
  412. package/parameters/manual.js.map +1 -1
  413. package/parameters/path.js.map +1 -1
  414. package/plugins/CmsGraphQLSchemaPlugin/CmsGraphQLSchemaPlugin.d.ts +8 -0
  415. package/plugins/{CmsGraphQLSchemaPlugin.js → CmsGraphQLSchemaPlugin/CmsGraphQLSchemaPlugin.js} +5 -1
  416. package/plugins/CmsGraphQLSchemaPlugin/CmsGraphQLSchemaPlugin.js.map +1 -0
  417. package/plugins/CmsGraphQLSchemaPlugin/index.d.ts +1 -0
  418. package/plugins/CmsGraphQLSchemaPlugin/index.js +18 -0
  419. package/plugins/CmsGraphQLSchemaPlugin/index.js.map +1 -0
  420. package/plugins/CmsGraphQLSchemaSorterPlugin.js.map +1 -1
  421. package/plugins/CmsGroupPlugin.d.ts +4 -0
  422. package/plugins/CmsGroupPlugin.js +9 -1
  423. package/plugins/CmsGroupPlugin.js.map +1 -1
  424. package/plugins/CmsModelFieldConverterPlugin.js.map +1 -1
  425. package/plugins/CmsModelPlugin.d.ts +10 -8
  426. package/plugins/CmsModelPlugin.js +29 -16
  427. package/plugins/CmsModelPlugin.js.map +1 -1
  428. package/plugins/CmsParametersPlugin.js.map +1 -1
  429. package/plugins/CmsRichTextRendererPlugin.js.map +1 -1
  430. package/plugins/StorageOperationsCmsModelPlugin.js.map +1 -1
  431. package/plugins/StorageTransformPlugin.js.map +1 -1
  432. package/plugins/index.js.map +1 -1
  433. package/storage/default.js.map +1 -1
  434. package/storage/index.js.map +1 -1
  435. package/storage/json.js.map +1 -1
  436. package/storage/object.js.map +1 -1
  437. package/types/context.d.ts +146 -0
  438. package/types/context.js +7 -0
  439. package/types/context.js.map +1 -0
  440. package/types/fields/dynamicZoneField.d.ts +23 -0
  441. package/types/fields/dynamicZoneField.js +7 -0
  442. package/types/fields/dynamicZoneField.js.map +1 -0
  443. package/types/fields/objectField.d.ts +13 -0
  444. package/types/fields/objectField.js +7 -0
  445. package/types/fields/objectField.js.map +1 -0
  446. package/types/identity.d.ts +19 -0
  447. package/types/identity.js +7 -0
  448. package/types/identity.js.map +1 -0
  449. package/types/index.d.ts +10 -0
  450. package/types/index.js +117 -0
  451. package/types/index.js.map +1 -0
  452. package/types/model.d.ts +199 -0
  453. package/types/model.js +7 -0
  454. package/types/model.js.map +1 -0
  455. package/types/modelAst.d.ts +39 -0
  456. package/types/modelAst.js +7 -0
  457. package/types/modelAst.js.map +1 -0
  458. package/types/modelField.d.ts +320 -0
  459. package/types/modelField.js +7 -0
  460. package/types/modelField.js.map +1 -0
  461. package/types/modelGroup.d.ts +77 -0
  462. package/types/modelGroup.js +7 -0
  463. package/types/modelGroup.js.map +1 -0
  464. package/types/plugins.d.ts +364 -0
  465. package/types/plugins.js +7 -0
  466. package/types/plugins.js.map +1 -0
  467. package/{types.d.ts → types/types.d.ts} +196 -1171
  468. package/{types.js → types/types.js} +18 -119
  469. package/types/types.js.map +1 -0
  470. package/utils/caching/Cache.js.map +1 -1
  471. package/utils/caching/CacheKey.js.map +1 -1
  472. package/utils/caching/index.js.map +1 -1
  473. package/utils/caching/types.js.map +1 -1
  474. package/utils/contentEntryTraverser/ContentEntryTraverser.d.ts +10 -0
  475. package/utils/contentEntryTraverser/ContentEntryTraverser.js +84 -0
  476. package/utils/contentEntryTraverser/ContentEntryTraverser.js.map +1 -0
  477. package/utils/contentModelAst/CmsModelFieldToAstConverterFromPlugins.d.ts +6 -0
  478. package/utils/contentModelAst/CmsModelFieldToAstConverterFromPlugins.js +23 -0
  479. package/utils/contentModelAst/CmsModelFieldToAstConverterFromPlugins.js.map +1 -0
  480. package/utils/contentModelAst/CmsModelFieldToAstFromPlugin.d.ts +7 -0
  481. package/utils/contentModelAst/CmsModelFieldToAstFromPlugin.js +22 -0
  482. package/utils/contentModelAst/CmsModelFieldToAstFromPlugin.js.map +1 -0
  483. package/utils/contentModelAst/CmsModelToAstConverter.d.ts +11 -0
  484. package/utils/contentModelAst/CmsModelToAstConverter.js +28 -0
  485. package/utils/contentModelAst/CmsModelToAstConverter.js.map +1 -0
  486. package/utils/contentModelAst/index.d.ts +3 -0
  487. package/utils/contentModelAst/index.js +40 -0
  488. package/utils/contentModelAst/index.js.map +1 -0
  489. package/utils/converters/Converter.js.map +1 -1
  490. package/utils/converters/ConverterCollection.js.map +1 -1
  491. package/utils/converters/valueKeyStorageConverter.js.map +1 -1
  492. package/utils/createModelField.d.ts +2 -0
  493. package/utils/createModelField.js +14 -4
  494. package/utils/createModelField.js.map +1 -1
  495. package/utils/createTypeFromFields.js.map +1 -1
  496. package/utils/createTypeName.js.map +1 -1
  497. package/utils/date.js.map +1 -1
  498. package/utils/entryStorage.js.map +1 -1
  499. package/utils/filterAsync.js.map +1 -1
  500. package/utils/getBaseFieldType.js.map +1 -1
  501. package/utils/getEntryDescription.js.map +1 -1
  502. package/utils/getEntryImage.js.map +1 -1
  503. package/utils/getEntryTitle.js.map +1 -1
  504. package/utils/getSchemaFromFieldPlugins.d.ts +4 -4
  505. package/utils/getSchemaFromFieldPlugins.js +2 -2
  506. package/utils/getSchemaFromFieldPlugins.js.map +1 -1
  507. package/utils/identity.js.map +1 -1
  508. package/utils/incrementEntryIdVersion.js.map +1 -1
  509. package/utils/index.js.map +1 -1
  510. package/utils/isHeadlessCmsReady.js.map +1 -1
  511. package/utils/renderFields.js.map +1 -1
  512. package/utils/renderGetFilterFields.js.map +1 -1
  513. package/utils/renderInputFields.js.map +1 -1
  514. package/utils/renderListFilterFields.js.map +1 -1
  515. package/utils/renderSortEnum.js.map +1 -1
  516. package/utils/toSlug.js.map +1 -1
  517. package/validators/dateGte.js.map +1 -1
  518. package/validators/dateLte.js.map +1 -1
  519. package/validators/gte.js.map +1 -1
  520. package/validators/in.js.map +1 -1
  521. package/validators/index.js.map +1 -1
  522. package/validators/lte.js.map +1 -1
  523. package/validators/maxLength.js.map +1 -1
  524. package/validators/minLength.js.map +1 -1
  525. package/validators/pattern.js.map +1 -1
  526. package/validators/patternPlugins/email.js.map +1 -1
  527. package/validators/patternPlugins/index.js.map +1 -1
  528. package/validators/patternPlugins/lowerCase.js.map +1 -1
  529. package/validators/patternPlugins/lowerCaseSpace.js.map +1 -1
  530. package/validators/patternPlugins/upperCase.js.map +1 -1
  531. package/validators/patternPlugins/upperCaseSpace.js.map +1 -1
  532. package/validators/patternPlugins/url.js.map +1 -1
  533. package/validators/required.js.map +1 -1
  534. package/validators/timeGte.js.map +1 -1
  535. package/validators/timeLte.js.map +1 -1
  536. package/validators/unique.js.map +1 -1
  537. package/plugins/CmsGraphQLSchemaPlugin.d.ts +0 -5
  538. package/plugins/CmsGraphQLSchemaPlugin.js.map +0 -1
  539. package/types.js.map +0 -1
  540. package/utils/permissions/EntriesPermissions.d.ts +0 -4
  541. package/utils/permissions/EntriesPermissions.js +0 -11
  542. package/utils/permissions/EntriesPermissions.js.map +0 -1
  543. package/utils/permissions/ModelGroupsPermissions.d.ts +0 -9
  544. package/utils/permissions/ModelGroupsPermissions.js +0 -50
  545. package/utils/permissions/ModelGroupsPermissions.js.map +0 -1
  546. package/utils/permissions/ModelsPermissions.d.ts +0 -22
  547. package/utils/permissions/ModelsPermissions.js +0 -90
  548. package/utils/permissions/ModelsPermissions.js.map +0 -1
@@ -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 +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 { 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","ignoreList":[]}
@@ -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,MAAMI,mBAAmB,CAAC;EACZC,UAAU,GAA2B,IAAIC,GAAG,CAAC,CAAC;EAExDC,WAAWA,CAACC,MAAiC,EAAE;IAClD,MAAM;MAAEC;IAAQ,CAAC,GAAGD,MAAM;IAC1B,MAAME,mBAAmB,GAAGD,OAAO,CAACE,MAAM,CACtC,4BACJ,CAAC;IACD,MAAMC,qBAAqB,GAAGH,OAAO,CAACE,MAAM,CACxCE,qCAA4B,CAACC,IACjC,CAAC;IACD,MAAMC,2BAA2B,GAAGH,qBAAqB,CAACI,IAAI,CAC1DC,EAAE,IAAIA,EAAE,CAACC,YAAY,CAAC,CAAC,KAAK,GAChC,CAAC;IACD,IAAIH,2BAA2B,KAAKI,SAAS,EAAE;MAC3C,MAAM,IAAIC,cAAW,CAChB,yCAAwC,EACzC,+BACJ,CAAC;IACL;IACA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,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 { 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,MAAMI,mBAAmB,CAAC;EACZC,UAAU,GAA2B,IAAIC,GAAG,CAAC,CAAC;EAExDC,WAAWA,CAACC,MAAiC,EAAE;IAClD,MAAM;MAAEC;IAAQ,CAAC,GAAGD,MAAM;IAC1B,MAAME,mBAAmB,GAAGD,OAAO,CAACE,MAAM,CACtC,4BACJ,CAAC;IACD,MAAMC,qBAAqB,GAAGH,OAAO,CAACE,MAAM,CACxCE,qCAA4B,CAACC,IACjC,CAAC;IACD,MAAMC,2BAA2B,GAAGH,qBAAqB,CAACI,IAAI,CAC1DC,EAAE,IAAIA,EAAE,CAACC,YAAY,CAAC,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,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 +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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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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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","ignoreList":[]}
@@ -1,5 +1,7 @@
1
1
  import { CmsModelField } from "../types";
2
2
  export interface CreateModelFieldParams extends Omit<CmsModelField, "id" | "storageId" | "fieldId"> {
3
+ id?: string;
3
4
  fieldId?: string;
5
+ storageId?: string;
4
6
  }
5
7
  export declare const createModelField: (params: CreateModelFieldParams) => CmsModelField;
@@ -7,9 +7,13 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.createModelField = void 0;
8
8
  var _camelCase = _interopRequireDefault(require("lodash/camelCase"));
9
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.
10
12
  const {
13
+ id,
11
14
  label,
12
15
  fieldId: initialFieldId,
16
+ storageId,
13
17
  type,
14
18
  tags,
15
19
  settings = {},
@@ -19,12 +23,15 @@ const createModelField = params => {
19
23
  predefinedValues = {
20
24
  values: [],
21
25
  enabled: false
22
- }
26
+ },
27
+ helpText = null,
28
+ placeholderText = null,
29
+ renderer = null
23
30
  } = params;
24
31
  const fieldId = initialFieldId ? (0, _camelCase.default)(initialFieldId) : (0, _camelCase.default)(label);
25
32
  return {
26
- id: fieldId,
27
- storageId: `${type}@${fieldId}`,
33
+ id: id ?? fieldId,
34
+ storageId: storageId ?? `${type}@${fieldId}`,
28
35
  fieldId,
29
36
  label,
30
37
  type,
@@ -33,7 +40,10 @@ const createModelField = params => {
33
40
  listValidation,
34
41
  validation,
35
42
  multipleValues,
36
- predefinedValues
43
+ predefinedValues,
44
+ helpText,
45
+ placeholderText,
46
+ renderer
37
47
  };
38
48
  };
39
49
  exports.createModelField = createModelField;
@@ -1 +1 @@
1
- {"version":3,"names":["_camelCase","_interopRequireDefault","require","createModelField","params","label","fieldId","initialFieldId","type","tags","settings","listValidation","validation","multipleValues","predefinedValues","values","enabled","camelCase","id","storageId","exports"],"sources":["createModelField.ts"],"sourcesContent":["import camelCase from \"lodash/camelCase\";\nimport { CmsModelField } from \"~/types\";\n\nexport interface CreateModelFieldParams\n extends Omit<CmsModelField, \"id\" | \"storageId\" | \"fieldId\"> {\n fieldId?: string;\n}\n\nexport const createModelField = (params: CreateModelFieldParams): CmsModelField => {\n const {\n label,\n fieldId: initialFieldId,\n type,\n tags,\n settings = {},\n listValidation = [],\n validation = [],\n multipleValues = false,\n predefinedValues = {\n values: [],\n enabled: false\n }\n } = params;\n\n const fieldId = initialFieldId ? camelCase(initialFieldId) : camelCase(label);\n\n return {\n id: fieldId,\n storageId: `${type}@${fieldId}`,\n fieldId,\n label,\n type,\n settings,\n tags,\n listValidation,\n validation,\n multipleValues,\n predefinedValues\n };\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,UAAA,GAAAC,sBAAA,CAAAC,OAAA;AAQO,MAAMC,gBAAgB,GAAIC,MAA8B,IAAoB;EAC/E,MAAM;IACFC,KAAK;IACLC,OAAO,EAAEC,cAAc;IACvBC,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;EACJ,CAAC,GAAGZ,MAAM;EAEV,MAAME,OAAO,GAAGC,cAAc,GAAG,IAAAU,kBAAS,EAACV,cAAc,CAAC,GAAG,IAAAU,kBAAS,EAACZ,KAAK,CAAC;EAE7E,OAAO;IACHa,EAAE,EAAEZ,OAAO;IACXa,SAAS,EAAG,GAAEX,IAAK,IAAGF,OAAQ,EAAC;IAC/BA,OAAO;IACPD,KAAK;IACLG,IAAI;IACJE,QAAQ;IACRD,IAAI;IACJE,cAAc;IACdC,UAAU;IACVC,cAAc;IACdC;EACJ,CAAC;AACL,CAAC;AAACM,OAAA,CAAAjB,gBAAA,GAAAA,gBAAA"}
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 { 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,IAAK,GAAEC,IAAK,IAAGH,OAAQ,EAAC;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 +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,IAA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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 { 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","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 +1 @@
1
- {"version":3,"names":["_error","_interopRequireDefault","require","_StorageTransformPlugin","_getBaseFieldType","getStoragePluginFactory","context","defaultStoragePlugin","plugins","byType","StorageTransformPlugin","type","reverse","reduce","collection","plugin","fieldType","entryStorageTransform","model","operation","entry","getStoragePlugin","transformedValues","field","fields","baseType","getBaseFieldType","WebinyError","name","fieldId","value","values","entryToStorageTransform","exports","entryFromStorageTransform","entryFieldFromStorageTransform","params","fromStorage"],"sources":["entryStorage.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { StorageTransformPlugin } from \"~/plugins/StorageTransformPlugin\";\nimport { CmsContext, CmsEntry, CmsModel, CmsModelField } from \"~/types\";\nimport { getBaseFieldType } from \"~/utils/getBaseFieldType\";\n\ninterface GetStoragePluginFactory {\n (context: Pick<CmsContext, \"plugins\">): (fieldType: string) => StorageTransformPlugin<any>;\n}\n\nconst getStoragePluginFactory: GetStoragePluginFactory = context => {\n let defaultStoragePlugin: StorageTransformPlugin;\n\n const plugins = context.plugins\n .byType<StorageTransformPlugin>(StorageTransformPlugin.type)\n // we reverse plugins because we want to get latest added only\n .reverse()\n .reduce((collection, plugin) => {\n /**\n * Check if it's a default plugin and set it - always override the previous one.\n */\n if (plugin.fieldType === \"*\") {\n defaultStoragePlugin = plugin;\n return collection;\n }\n\n /**\n * We will just set the plugin for given type.\n * The last one will override existing one - so users can override our default ones.\n */\n collection[plugin.fieldType] = plugin;\n\n return collection;\n }, {} as Record<string, StorageTransformPlugin>);\n\n return (fieldType: string) => {\n return plugins[fieldType] || defaultStoragePlugin;\n };\n};\n\n/**\n * This should be used when transforming the whole entry.\n */\nconst entryStorageTransform = async (\n context: Pick<CmsContext, \"plugins\">,\n model: CmsModel,\n operation: \"toStorage\" | \"fromStorage\",\n entry: CmsEntry\n): Promise<CmsEntry> => {\n const getStoragePlugin = getStoragePluginFactory(context);\n\n const transformedValues: Record<string, any> = {};\n for (const field of model.fields) {\n const baseType = getBaseFieldType(field);\n const plugin = getStoragePlugin(baseType);\n // TODO: remove this once plugins are converted into classes\n if (typeof plugin[operation] !== \"function\") {\n throw new WebinyError(\n `Missing \"${operation}\" function in storage plugin \"${plugin.name}\" for field type \"${baseType}\"`\n );\n }\n\n transformedValues[field.fieldId] = await plugin[operation]({\n plugins: context.plugins,\n model,\n field,\n value: entry.values[field.fieldId],\n getStoragePlugin\n });\n }\n\n return { ...entry, values: transformedValues };\n};\n\n/**\n * A function that is used in crud to transform entry into the storage type.\n */\nexport const entryToStorageTransform = async (\n context: Pick<CmsContext, \"plugins\">,\n model: CmsModel,\n entry: CmsEntry\n): Promise<CmsEntry> => {\n return entryStorageTransform(context, model, \"toStorage\", entry);\n};\n\n/**\n * A function that is used to transform the whole entry from storage into its native form.\n */\nexport const entryFromStorageTransform = async (\n context: Pick<CmsContext, \"plugins\">,\n model: CmsModel,\n entry: CmsEntry\n): Promise<CmsEntry> => {\n return entryStorageTransform(context, model, \"fromStorage\", entry);\n};\n\ninterface EntryFieldFromStorageTransformParams {\n context: Pick<CmsContext, \"plugins\">;\n model: CmsModel;\n field: CmsModelField;\n value: any;\n}\n/*\n * A function that is used to transform a single field from storage\n */\nexport const entryFieldFromStorageTransform = async <T = any>(\n params: EntryFieldFromStorageTransformParams\n): Promise<T> => {\n const { context, model, field, value } = params;\n const getStoragePlugin = getStoragePluginFactory(context);\n\n const baseType = getBaseFieldType(field);\n const plugin = getStoragePlugin(baseType);\n\n // TODO: remove this once plugins are converted into classes\n if (typeof plugin.fromStorage !== \"function\") {\n throw new WebinyError(\n `Missing \"fromStorage\" function in storage plugin \"${plugin.name}\" for field type \"${baseType}\"`\n );\n }\n\n return plugin.fromStorage({\n plugins: context.plugins,\n model,\n field,\n value,\n getStoragePlugin\n });\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,uBAAA,GAAAD,OAAA;AAEA,IAAAE,iBAAA,GAAAF,OAAA;AAMA,MAAMG,uBAAgD,GAAGC,OAAO,IAAI;EAChE,IAAIC,oBAA4C;EAEhD,MAAMC,OAAO,GAAGF,OAAO,CAACE,OAAO,CAC1BC,MAAM,CAAyBC,8CAAsB,CAACC,IAAI;EAC3D;EAAA,CACCC,OAAO,CAAC,CAAC,CACTC,MAAM,CAAC,CAACC,UAAU,EAAEC,MAAM,KAAK;IAC5B;AACZ;AACA;IACY,IAAIA,MAAM,CAACC,SAAS,KAAK,GAAG,EAAE;MAC1BT,oBAAoB,GAAGQ,MAAM;MAC7B,OAAOD,UAAU;IACrB;;IAEA;AACZ;AACA;AACA;IACYA,UAAU,CAACC,MAAM,CAACC,SAAS,CAAC,GAAGD,MAAM;IAErC,OAAOD,UAAU;EACrB,CAAC,EAAE,CAAC,CAA2C,CAAC;EAEpD,OAAQE,SAAiB,IAAK;IAC1B,OAAOR,OAAO,CAACQ,SAAS,CAAC,IAAIT,oBAAoB;EACrD,CAAC;AACL,CAAC;;AAED;AACA;AACA;AACA,MAAMU,qBAAqB,GAAG,MAAAA,CAC1BX,OAAoC,EACpCY,KAAe,EACfC,SAAsC,EACtCC,KAAe,KACK;EACpB,MAAMC,gBAAgB,GAAGhB,uBAAuB,CAACC,OAAO,CAAC;EAEzD,MAAMgB,iBAAsC,GAAG,CAAC,CAAC;EACjD,KAAK,MAAMC,KAAK,IAAIL,KAAK,CAACM,MAAM,EAAE;IAC9B,MAAMC,QAAQ,GAAG,IAAAC,kCAAgB,EAACH,KAAK,CAAC;IACxC,MAAMR,MAAM,GAAGM,gBAAgB,CAACI,QAAQ,CAAC;IACzC;IACA,IAAI,OAAOV,MAAM,CAAC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AQ,CAAC;;EAEzC;EACA,IAAI,OAAOV,MAAM,CAACsB,WAAW,KAAK,UAAU,EAAE;IAC1C,MAAM,IAAIV,cAAW,CAChB,qDAAoDZ,MAAM,CAACa,IAAK,qBAAoBH,QAAS,GAClG,CAAC;EACL;EAEA,OAAOV,MAAM,CAACsB,WAAW,CAAC;IACtB7B,OAAO,EAAEF,OAAO,CAACE,OAAO;IACxBU,KAAK;IACLK,KAAK;IACLO,KAAK;IACLT;EACJ,CAAC,CAAC;AACN,CAAC;AAACY,OAAA,CAAAE,8BAAA,GAAAA,8BAAA"}
1
+ {"version":3,"names":["_error","_interopRequireDefault","require","_StorageTransformPlugin","_getBaseFieldType","getStoragePluginFactory","context","defaultStoragePlugin","plugins","byType","StorageTransformPlugin","type","reverse","reduce","collection","plugin","fieldType","entryStorageTransform","model","operation","entry","getStoragePlugin","transformedValues","field","fields","baseType","getBaseFieldType","WebinyError","name","fieldId","value","values","entryToStorageTransform","exports","entryFromStorageTransform","entryFieldFromStorageTransform","params","fromStorage"],"sources":["entryStorage.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { StorageTransformPlugin } from \"~/plugins/StorageTransformPlugin\";\nimport { CmsContext, CmsEntry, CmsModel, CmsModelField } from \"~/types\";\nimport { getBaseFieldType } from \"~/utils/getBaseFieldType\";\n\ninterface GetStoragePluginFactory {\n (context: Pick<CmsContext, \"plugins\">): (fieldType: string) => StorageTransformPlugin<any>;\n}\n\nconst getStoragePluginFactory: GetStoragePluginFactory = context => {\n let defaultStoragePlugin: StorageTransformPlugin;\n\n const plugins = context.plugins\n .byType<StorageTransformPlugin>(StorageTransformPlugin.type)\n // we reverse plugins because we want to get latest added only\n .reverse()\n .reduce((collection, plugin) => {\n /**\n * Check if it's a default plugin and set it - always override the previous one.\n */\n if (plugin.fieldType === \"*\") {\n defaultStoragePlugin = plugin;\n return collection;\n }\n\n /**\n * We will just set the plugin for given type.\n * The last one will override existing one - so users can override our default ones.\n */\n collection[plugin.fieldType] = plugin;\n\n return collection;\n }, {} as Record<string, StorageTransformPlugin>);\n\n return (fieldType: string) => {\n return plugins[fieldType] || defaultStoragePlugin;\n };\n};\n\n/**\n * This should be used when transforming the whole entry.\n */\nconst entryStorageTransform = async (\n context: Pick<CmsContext, \"plugins\">,\n model: CmsModel,\n operation: \"toStorage\" | \"fromStorage\",\n entry: CmsEntry\n): Promise<CmsEntry> => {\n const getStoragePlugin = getStoragePluginFactory(context);\n\n const transformedValues: Record<string, any> = {};\n for (const field of model.fields) {\n const baseType = getBaseFieldType(field);\n const plugin = getStoragePlugin(baseType);\n // TODO: remove this once plugins are converted into classes\n if (typeof plugin[operation] !== \"function\") {\n throw new WebinyError(\n `Missing \"${operation}\" function in storage plugin \"${plugin.name}\" for field type \"${baseType}\"`\n );\n }\n\n transformedValues[field.fieldId] = await plugin[operation]({\n plugins: context.plugins,\n model,\n field,\n value: entry.values[field.fieldId],\n getStoragePlugin\n });\n }\n\n return { ...entry, values: transformedValues };\n};\n\n/**\n * A function that is used in crud to transform entry into the storage type.\n */\nexport const entryToStorageTransform = async (\n context: Pick<CmsContext, \"plugins\">,\n model: CmsModel,\n entry: CmsEntry\n): Promise<CmsEntry> => {\n return entryStorageTransform(context, model, \"toStorage\", entry);\n};\n\n/**\n * A function that is used to transform the whole entry from storage into its native form.\n */\nexport const entryFromStorageTransform = async (\n context: Pick<CmsContext, \"plugins\">,\n model: CmsModel,\n entry: CmsEntry\n): Promise<CmsEntry> => {\n return entryStorageTransform(context, model, \"fromStorage\", entry);\n};\n\ninterface EntryFieldFromStorageTransformParams {\n context: Pick<CmsContext, \"plugins\">;\n model: CmsModel;\n field: CmsModelField;\n value: any;\n}\n/*\n * A function that is used to transform a single field from storage\n */\nexport const entryFieldFromStorageTransform = async <T = any>(\n params: EntryFieldFromStorageTransformParams\n): Promise<T> => {\n const { context, model, field, value } = params;\n const getStoragePlugin = getStoragePluginFactory(context);\n\n const baseType = getBaseFieldType(field);\n const plugin = getStoragePlugin(baseType);\n\n // TODO: remove this once plugins are converted into classes\n if (typeof plugin.fromStorage !== \"function\") {\n throw new WebinyError(\n `Missing \"fromStorage\" function in storage plugin \"${plugin.name}\" for field type \"${baseType}\"`\n );\n }\n\n return plugin.fromStorage({\n plugins: context.plugins,\n model,\n field,\n value,\n getStoragePlugin\n });\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,uBAAA,GAAAD,OAAA;AAEA,IAAAE,iBAAA,GAAAF,OAAA;AAMA,MAAMG,uBAAgD,GAAGC,OAAO,IAAI;EAChE,IAAIC,oBAA4C;EAEhD,MAAMC,OAAO,GAAGF,OAAO,CAACE,OAAO,CAC1BC,MAAM,CAAyBC,8CAAsB,CAACC,IAAI;EAC3D;EAAA,CACCC,OAAO,CAAC,CAAC,CACTC,MAAM,CAAC,CAACC,UAAU,EAAEC,MAAM,KAAK;IAC5B;AACZ;AACA;IACY,IAAIA,MAAM,CAACC,SAAS,KAAK,GAAG,EAAE;MAC1BT,oBAAoB,GAAGQ,MAAM;MAC7B,OAAOD,UAAU;IACrB;;IAEA;AACZ;AACA;AACA;IACYA,UAAU,CAACC,MAAM,CAACC,SAAS,CAAC,GAAGD,MAAM;IAErC,OAAOD,UAAU;EACrB,CAAC,EAAE,CAAC,CAA2C,CAAC;EAEpD,OAAQE,SAAiB,IAAK;IAC1B,OAAOR,OAAO,CAACQ,SAAS,CAAC,IAAIT,oBAAoB;EACrD,CAAC;AACL,CAAC;;AAED;AACA;AACA;AACA,MAAMU,qBAAqB,GAAG,MAAAA,CAC1BX,OAAoC,EACpCY,KAAe,EACfC,SAAsC,EACtCC,KAAe,KACK;EACpB,MAAMC,gBAAgB,GAAGhB,uBAAuB,CAACC,OAAO,CAAC;EAEzD,MAAMgB,iBAAsC,GAAG,CAAC,CAAC;EACjD,KAAK,MAAMC,KAAK,IAAIL,KAAK,CAACM,MAAM,EAAE;IAC9B,MAAMC,QAAQ,GAAG,IAAAC,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O,CAAC;EAEzD,MAAMmB,QAAQ,GAAG,IAAAC,kCAAgB,EAACH,KAAK,CAAC;EACxC,MAAMR,MAAM,GAAGM,gBAAgB,CAACI,QAAQ,CAAC;;EAEzC;EACA,IAAI,OAAOV,MAAM,CAACsB,WAAW,KAAK,UAAU,EAAE;IAC1C,MAAM,IAAIV,cAAW,CAChB,qDAAoDZ,MAAM,CAACa,IAAK,qBAAoBH,QAAS,GAClG,CAAC;EACL;EAEA,OAAOV,MAAM,CAACsB,WAAW,CAAC;IACtB7B,OAAO,EAAEF,OAAO,CAACE,OAAO;IACxBU,KAAK;IACLK,KAAK;IACLO,KAAK;IACLT;EACJ,CAAC,CAAC;AACN,CAAC;AAACY,OAAA,CAAAE,8BAAA,GAAAA,8BAAA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["filterAsync","items","predicate","filteredItems","Promise","all","map","item","valid","filter","Boolean","exports"],"sources":["filterAsync.ts"],"sourcesContent":["export const filterAsync = async <T = Record<string, any>>(\n items: T[],\n predicate: (param: T) => Promise<boolean>\n): Promise<T[]> => {\n const filteredItems = await Promise.all(\n items.map(async item => {\n const valid = await predicate(item);\n if (!valid) {\n return null;\n }\n return item;\n })\n );\n\n return filteredItems.filter(Boolean) as T[];\n};\n"],"mappings":";;;;;;AAAO,MAAMA,WAAW,GAAG,MAAAA,CACvBC,KAAU,EACVC,SAAyC,KAC1B;EACf,MAAMC,aAAa,GAAG,MAAMC,OAAO,CAACC,GAAG,CACnCJ,KAAK,CAACK,GAAG,CAAC,MAAMC,IAAI,IAAI;IACpB,MAAMC,KAAK,GAAG,MAAMN,SAAS,CAACK,IAAI,CAAC;IACnC,IAAI,CAACC,KAAK,EAAE;MACR,OAAO,IAAI;IACf;IACA,OAAOD,IAAI;EACf,CAAC,CACL,CAAC;EAED,OAAOJ,aAAa,CAACM,MAAM,CAACC,OAAO,CAAC;AACxC,CAAC;AAACC,OAAA,CAAAX,WAAA,GAAAA,WAAA"}
1
+ {"version":3,"names":["filterAsync","items","predicate","filteredItems","Promise","all","map","item","valid","filter","Boolean","exports"],"sources":["filterAsync.ts"],"sourcesContent":["export const filterAsync = async <T = Record<string, any>>(\n items: T[],\n predicate: (param: T) => Promise<boolean>\n): Promise<T[]> => {\n const filteredItems = await Promise.all(\n items.map(async item => {\n const valid = await predicate(item);\n if (!valid) {\n return null;\n }\n return item;\n })\n );\n\n return filteredItems.filter(Boolean) as T[];\n};\n"],"mappings":";;;;;;AAAO,MAAMA,WAAW,GAAG,MAAAA,CACvBC,KAAU,EACVC,SAAyC,KAC1B;EACf,MAAMC,aAAa,GAAG,MAAMC,OAAO,CAACC,GAAG,CACnCJ,KAAK,CAACK,GAAG,CAAC,MAAMC,IAAI,IAAI;IACpB,MAAMC,KAAK,GAAG,MAAMN,SAAS,CAACK,IAAI,CAAC;IACnC,IAAI,CAACC,KAAK,EAAE;MACR,OAAO,IAAI;IACf;IACA,OAAOD,IAAI;EACf,CAAC,CACL,CAAC;EAED,OAAOJ,aAAa,CAACM,MAAM,CAACC,OAAO,CAAC;AACxC,CAAC;AAACC,OAAA,CAAAX,WAAA,GAAAA,WAAA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["getBaseFieldType","field","type","split","exports"],"sources":["getBaseFieldType.ts"],"sourcesContent":["import { CmsModelField } from \"~/types\";\n\nexport const getBaseFieldType = (field: Pick<CmsModelField, \"type\">) => {\n return field.type.split(\":\")[0];\n};\n"],"mappings":";;;;;;AAEO,MAAMA,gBAAgB,GAAIC,KAAkC,IAAK;EACpE,OAAOA,KAAK,CAACC,IAAI,CAACC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AACnC,CAAC;AAACC,OAAA,CAAAJ,gBAAA,GAAAA,gBAAA"}
1
+ {"version":3,"names":["getBaseFieldType","field","type","split","exports"],"sources":["getBaseFieldType.ts"],"sourcesContent":["import { CmsModelField } from \"~/types\";\n\nexport const getBaseFieldType = (field: Pick<CmsModelField, \"type\">) => {\n return field.type.split(\":\")[0];\n};\n"],"mappings":";;;;;;AAEO,MAAMA,gBAAgB,GAAIC,KAAkC,IAAK;EACpE,OAAOA,KAAK,CAACC,IAAI,CAACC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AACnC,CAAC;AAACC,OAAA,CAAAJ,gBAAA,GAAAA,gBAAA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["getEntryDescription","model","entry","descriptionFieldId","field","fields","find","f","fieldId","values"],"sources":["getEntryDescription.ts"],"sourcesContent":["import { CmsEntry, CmsModel } from \"~/types\";\n\nexport function getEntryDescription(\n model: Pick<CmsModel, \"descriptionFieldId\" | \"fields\">,\n entry: CmsEntry\n): string {\n if (!model.descriptionFieldId) {\n return \"\";\n }\n const field = model.fields.find(f => f.fieldId === model.descriptionFieldId);\n if (!field) {\n return \"\";\n }\n const descriptionFieldId = field.fieldId;\n return entry.values[descriptionFieldId] || \"\";\n}\n"],"mappings":";;;;;;AAEO,SAASA,mBAAmBA,CAC/BC,KAAsD,EACtDC,KAAe,EACT;EACN,IAAI,CAACD,KAAK,CAACE,kBAAkB,EAAE;IAC3B,OAAO,EAAE;EACb;EACA,MAAMC,KAAK,GAAGH,KAAK,CAACI,MAAM,CAACC,IAAI,CAACC,CAAC,IAAIA,CAAC,CAACC,OAAO,KAAKP,KAAK,CAACE,kBAAkB,CAAC;EAC5E,IAAI,CAACC,KAAK,EAAE;IACR,OAAO,EAAE;EACb;EACA,MAAMD,kBAAkB,GAAGC,KAAK,CAACI,OAAO;EACxC,OAAON,KAAK,CAACO,MAAM,CAACN,kBAAkB,CAAC,IAAI,EAAE;AACjD"}
1
+ {"version":3,"names":["getEntryDescription","model","entry","descriptionFieldId","field","fields","find","f","fieldId","values"],"sources":["getEntryDescription.ts"],"sourcesContent":["import { CmsEntry, CmsModel } from \"~/types\";\n\nexport function getEntryDescription(\n model: Pick<CmsModel, \"descriptionFieldId\" | \"fields\">,\n entry: CmsEntry\n): string {\n if (!model.descriptionFieldId) {\n return \"\";\n }\n const field = model.fields.find(f => f.fieldId === model.descriptionFieldId);\n if (!field) {\n return \"\";\n }\n const descriptionFieldId = field.fieldId;\n return entry.values[descriptionFieldId] || \"\";\n}\n"],"mappings":";;;;;;AAEO,SAASA,mBAAmBA,CAC/BC,KAAsD,EACtDC,KAAe,EACT;EACN,IAAI,CAACD,KAAK,CAACE,kBAAkB,EAAE;IAC3B,OAAO,EAAE;EACb;EACA,MAAMC,KAAK,GAAGH,KAAK,CAACI,MAAM,CAACC,IAAI,CAACC,CAAC,IAAIA,CAAC,CAACC,OAAO,KAAKP,KAAK,CAACE,kBAAkB,CAAC;EAC5E,IAAI,CAACC,KAAK,EAAE;IACR,OAAO,EAAE;EACb;EACA,MAAMD,kBAAkB,GAAGC,KAAK,CAACI,OAAO;EACxC,OAAON,KAAK,CAACO,MAAM,CAACN,kBAAkB,CAAC,IAAI,EAAE;AACjD","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["getEntryImage","model","entry","imageFieldId","field","fields","find","f","fieldId","values"],"sources":["getEntryImage.ts"],"sourcesContent":["import { CmsEntry, CmsModel } from \"~/types\";\n\nexport function getEntryImage(\n model: Pick<CmsModel, \"imageFieldId\" | \"fields\">,\n entry: CmsEntry\n): string | null {\n if (!model.imageFieldId) {\n return null;\n }\n const field = model.fields.find(f => f.fieldId === model.imageFieldId);\n if (!field) {\n return null;\n }\n const imageFieldId = field.fieldId;\n return entry.values[imageFieldId] || null;\n}\n"],"mappings":";;;;;;AAEO,SAASA,aAAaA,CACzBC,KAAgD,EAChDC,KAAe,EACF;EACb,IAAI,CAACD,KAAK,CAACE,YAAY,EAAE;IACrB,OAAO,IAAI;EACf;EACA,MAAMC,KAAK,GAAGH,KAAK,CAACI,MAAM,CAACC,IAAI,CAACC,CAAC,IAAIA,CAAC,CAACC,OAAO,KAAKP,KAAK,CAACE,YAAY,CAAC;EACtE,IAAI,CAACC,KAAK,EAAE;IACR,OAAO,IAAI;EACf;EACA,MAAMD,YAAY,GAAGC,KAAK,CAACI,OAAO;EAClC,OAAON,KAAK,CAACO,MAAM,CAACN,YAAY,CAAC,IAAI,IAAI;AAC7C"}
1
+ {"version":3,"names":["getEntryImage","model","entry","imageFieldId","field","fields","find","f","fieldId","values"],"sources":["getEntryImage.ts"],"sourcesContent":["import { CmsEntry, CmsModel } from \"~/types\";\n\nexport function getEntryImage(\n model: Pick<CmsModel, \"imageFieldId\" | \"fields\">,\n entry: CmsEntry\n): string | null {\n if (!model.imageFieldId) {\n return null;\n }\n const field = model.fields.find(f => f.fieldId === model.imageFieldId);\n if (!field) {\n return null;\n }\n const imageFieldId = field.fieldId;\n return entry.values[imageFieldId] || null;\n}\n"],"mappings":";;;;;;AAEO,SAASA,aAAaA,CACzBC,KAAgD,EAChDC,KAAe,EACF;EACb,IAAI,CAACD,KAAK,CAACE,YAAY,EAAE;IACrB,OAAO,IAAI;EACf;EACA,MAAMC,KAAK,GAAGH,KAAK,CAACI,MAAM,CAACC,IAAI,CAACC,CAAC,IAAIA,CAAC,CAACC,OAAO,KAAKP,KAAK,CAACE,YAAY,CAAC;EACtE,IAAI,CAACC,KAAK,EAAE;IACR,OAAO,IAAI;EACf;EACA,MAAMD,YAAY,GAAGC,KAAK,CAACI,OAAO;EAClC,OAAON,KAAK,CAACO,MAAM,CAACN,YAAY,CAAC,IAAI,IAAI;AAC7C","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["getEntryTitle","model","entry","titleFieldId","id","field","fields","find","f","fieldId","titleValue","values","enabled","predefinedValues","Array","isArray","value","label"],"sources":["getEntryTitle.ts"],"sourcesContent":["import { CmsEntry, CmsModel } from \"~/types\";\n\nexport function getEntryTitle(\n model: Pick<CmsModel, \"titleFieldId\" | \"fields\">,\n entry: CmsEntry\n): string {\n if (!model.titleFieldId) {\n return entry.id;\n }\n const field = model.fields.find(f => f.fieldId === model.titleFieldId);\n if (!field) {\n return entry.id;\n }\n const titleFieldId = field.fieldId;\n const titleValue = entry.values[titleFieldId];\n if (!titleValue) {\n return entry.id;\n }\n\n const { enabled = false, values } = field.predefinedValues || {};\n if (!enabled || !values || Array.isArray(values) === false) {\n return titleValue;\n }\n for (const value of values) {\n // needs to be loose because titleValue can be a number and value can be a string - but it must match\n if (value.value == titleValue) {\n return value.label;\n }\n }\n return titleValue;\n}\n"],"mappings":";;;;;;AAEO,SAASA,aAAaA,CACzBC,KAAgD,EAChDC,KAAe,EACT;EACN,IAAI,CAACD,KAAK,CAACE,YAAY,EAAE;IACrB,OAAOD,KAAK,CAACE,EAAE;EACnB;EACA,MAAMC,KAAK,GAAGJ,KAAK,CAACK,MAAM,CAACC,IAAI,CAACC,CAAC,IAAIA,CAAC,CAACC,OAAO,KAAKR,KAAK,CAACE,YAAY,CAAC;EACtE,IAAI,CAACE,KAAK,EAAE;IACR,OAAOH,KAAK,CAACE,EAAE;EACnB;EACA,MAAMD,YAAY,GAAGE,KAAK,CAACI,OAAO;EAClC,MAAMC,UAAU,GAAGR,KAAK,CAACS,MAAM,CAACR,YAAY,CAAC;EAC7C,IAAI,CAACO,UAAU,EAAE;IACb,OAAOR,KAAK,CAACE,EAAE;EACnB;EAEA,MAAM;IAAEQ,OAAO,GAAG,KAAK;IAAED;EAAO,CAAC,GAAGN,KAAK,CAACQ,gBAAgB,IAAI,CAAC,CAAC;EAChE,IAAI,CAACD,OAAO,IAAI,CAACD,MAAM,IAAIG,KAAK,CAACC,OAAO,CAACJ,MAAM,CAAC,KAAK,KAAK,EAAE;IACxD,OAAOD,UAAU;EACrB;EACA,KAAK,MAAMM,KAAK,IAAIL,MAAM,EAAE;IACxB;IACA,IAAIK,KAAK,CAACA,KAAK,IAAIN,UAAU,EAAE;MAC3B,OAAOM,KAAK,CAACC,KAAK;IACtB;EACJ;EACA,OAAOP,UAAU;AACrB"}
1
+ {"version":3,"names":["getEntryTitle","model","entry","titleFieldId","id","field","fields","find","f","fieldId","titleValue","values","enabled","predefinedValues","Array","isArray","value","label"],"sources":["getEntryTitle.ts"],"sourcesContent":["import { CmsEntry, CmsModel } from \"~/types\";\n\nexport function getEntryTitle(\n model: Pick<CmsModel, \"titleFieldId\" | \"fields\">,\n entry: CmsEntry\n): string {\n if (!model.titleFieldId) {\n return entry.id;\n }\n const field = model.fields.find(f => f.fieldId === model.titleFieldId);\n if (!field) {\n return entry.id;\n }\n const titleFieldId = field.fieldId;\n const titleValue = entry.values[titleFieldId];\n if (!titleValue) {\n return entry.id;\n }\n\n const { enabled = false, values } = field.predefinedValues || {};\n if (!enabled || !values || Array.isArray(values) === false) {\n return titleValue;\n }\n for (const value of values) {\n // needs to be loose because titleValue can be a number and value can be a string - but it must match\n if (value.value == titleValue) {\n return value.label;\n }\n }\n return titleValue;\n}\n"],"mappings":";;;;;;AAEO,SAASA,aAAaA,CACzBC,KAAgD,EAChDC,KAAe,EACT;EACN,IAAI,CAACD,KAAK,CAACE,YAAY,EAAE;IACrB,OAAOD,KAAK,CAACE,EAAE;EACnB;EACA,MAAMC,KAAK,GAAGJ,KAAK,CAACK,MAAM,CAACC,IAAI,CAACC,CAAC,IAAIA,CAAC,CAACC,OAAO,KAAKR,KAAK,CAACE,YAAY,CAAC;EACtE,IAAI,CAACE,KAAK,EAAE;IACR,OAAOH,KAAK,CAACE,EAAE;EACnB;EACA,MAAMD,YAAY,GAAGE,KAAK,CAACI,OAAO;EAClC,MAAMC,UAAU,GAAGR,KAAK,CAACS,MAAM,CAACR,YAAY,CAAC;EAC7C,IAAI,CAACO,UAAU,EAAE;IACb,OAAOR,KAAK,CAACE,EAAE;EACnB;EAEA,MAAM;IAAEQ,OAAO,GAAG,KAAK;IAAED;EAAO,CAAC,GAAGN,KAAK,CAACQ,gBAAgB,IAAI,CAAC,CAAC;EAChE,IAAI,CAACD,OAAO,IAAI,CAACD,MAAM,IAAIG,KAAK,CAACC,OAAO,CAACJ,MAAM,CAAC,KAAK,KAAK,EAAE;IACxD,OAAOD,UAAU;EACrB;EACA,KAAK,MAAMM,KAAK,IAAIL,MAAM,EAAE;IACxB;IACA,IAAIK,KAAK,CAACA,KAAK,IAAIN,UAAU,EAAE;MAC3B,OAAOM,KAAK,CAACC,KAAK;IACtB;EACJ;EACA,OAAOP,UAAU;AACrB","ignoreList":[]}
@@ -1,6 +1,6 @@
1
1
  import { ApiEndpoint, CmsContext, CmsFieldTypePlugins, CmsModel } from "../types";
2
- import { CmsGraphQLSchemaPlugin } from "../plugins";
3
- import { GraphQLSchemaPlugin } from "@webiny/handler-graphql";
2
+ import { ICmsGraphQLSchemaPlugin } from "../plugins";
3
+ import { IGraphQLSchemaPlugin } from "@webiny/handler-graphql";
4
4
  import { GraphQLSchemaDefinition } from "@webiny/handler-graphql/types";
5
5
  interface CreatePluginCallableParams {
6
6
  schema: GraphQLSchemaDefinition<CmsContext>;
@@ -8,7 +8,7 @@ interface CreatePluginCallableParams {
8
8
  fieldType: string;
9
9
  }
10
10
  interface CreatePluginCallable {
11
- (params: CreatePluginCallableParams): GraphQLSchemaPlugin<CmsContext>;
11
+ (params: CreatePluginCallableParams): IGraphQLSchemaPlugin<CmsContext>;
12
12
  }
13
13
  interface Params {
14
14
  models: CmsModel[];
@@ -16,5 +16,5 @@ interface Params {
16
16
  type: ApiEndpoint;
17
17
  createPlugin?: CreatePluginCallable;
18
18
  }
19
- export declare const createGraphQLSchemaPluginFromFieldPlugins: (params: Params) => CmsGraphQLSchemaPlugin<CmsContext>[];
19
+ export declare const createGraphQLSchemaPluginFromFieldPlugins: (params: Params) => ICmsGraphQLSchemaPlugin<CmsContext>[];
20
20
  export {};
@@ -15,7 +15,7 @@ const defaultCreatePlugin = ({
15
15
  type,
16
16
  fieldType
17
17
  }) => {
18
- const plugin = new _plugins.CmsGraphQLSchemaPlugin(schema);
18
+ const plugin = (0, _plugins.createCmsGraphQLSchemaPlugin)(schema);
19
19
  plugin.name = `headless-cms.graphql.schema.${type}.field.${fieldType}`;
20
20
  return plugin;
21
21
  };
@@ -41,7 +41,7 @@ const createGraphQLSchemaPluginFromFieldPlugins = params => {
41
41
  models
42
42
  });
43
43
 
44
- // const plugin = new CmsGraphQLSchemaPlugin(schema);
44
+ // const plugin = createCmsGraphQLSchemaPlugin(schema);
45
45
  // plugin.name = `headless-cms.graphql.schema.${type}.field.${fieldTypePlugin.fieldType}`;
46
46
  const plugin = createPlugin({
47
47
  schema,
@@ -1 +1 @@
1
- {"version":3,"names":["_plugins","require","TYPE_MAP","preview","read","manage","defaultCreatePlugin","schema","type","fieldType","plugin","CmsGraphQLSchemaPlugin","name","createGraphQLSchemaPluginFromFieldPlugins","params","models","fieldTypePlugins","createPlugin","plugins","key","fieldTypePlugin","createSchema","push","exports"],"sources":["getSchemaFromFieldPlugins.ts"],"sourcesContent":["import { ApiEndpoint, CmsContext, CmsFieldTypePlugins, CmsModel } from \"~/types\";\nimport { CmsGraphQLSchemaPlugin } from \"~/plugins\";\nimport { GraphQLSchemaPlugin } from \"@webiny/handler-graphql\";\nimport { GraphQLSchemaDefinition } from \"@webiny/handler-graphql/types\";\n\nconst TYPE_MAP: Record<string, \"manage\" | \"read\"> = {\n preview: \"read\",\n read: \"read\",\n manage: \"manage\"\n};\n\ninterface CreatePluginCallableParams {\n schema: GraphQLSchemaDefinition<CmsContext>;\n type: \"manage\" | \"preview\" | \"read\";\n fieldType: string;\n}\n\ninterface CreatePluginCallable {\n (params: CreatePluginCallableParams): GraphQLSchemaPlugin<CmsContext>;\n}\n\nconst defaultCreatePlugin: CreatePluginCallable = ({ schema, type, fieldType }) => {\n const plugin = new CmsGraphQLSchemaPlugin(schema);\n plugin.name = `headless-cms.graphql.schema.${type}.field.${fieldType}`;\n return plugin;\n};\n\ninterface Params {\n models: CmsModel[];\n fieldTypePlugins: CmsFieldTypePlugins;\n type: ApiEndpoint;\n createPlugin?: CreatePluginCallable;\n}\nexport const createGraphQLSchemaPluginFromFieldPlugins = (params: Params) => {\n const { models, fieldTypePlugins, type, createPlugin = defaultCreatePlugin } = params;\n\n const plugins: CmsGraphQLSchemaPlugin[] = [];\n for (const key in fieldTypePlugins) {\n const fieldTypePlugin = fieldTypePlugins[key];\n if (!TYPE_MAP[type] || !fieldTypePlugin[TYPE_MAP[type]]) {\n continue;\n }\n const createSchema = fieldTypePlugin[TYPE_MAP[type]].createSchema;\n // Render gql types generated by field type plugins\n if (!createSchema) {\n continue;\n }\n const schema = createSchema({ models });\n\n // const plugin = new CmsGraphQLSchemaPlugin(schema);\n // plugin.name = `headless-cms.graphql.schema.${type}.field.${fieldTypePlugin.fieldType}`;\n const plugin = createPlugin({\n schema,\n type,\n fieldType: fieldTypePlugin.fieldType\n });\n plugins.push(plugin);\n }\n return plugins;\n};\n"],"mappings":";;;;;;AACA,IAAAA,QAAA,GAAAC,OAAA;AAIA,MAAMC,QAA2C,GAAG;EAChDC,OAAO,EAAE,MAAM;EACfC,IAAI,EAAE,MAAM;EACZC,MAAM,EAAE;AACZ,CAAC;AAYD,MAAMC,mBAAyC,GAAGA,CAAC;EAAEC,MAAM;EAAEC,IAAI;EAAEC;AAAU,CAAC,KAAK;EAC/E,MAAMC,MAAM,GAAG,IAAIC,+BAAsB,CAACJ,MAAM,CAAC;EACjDG,MAAM,CAACE,IAAI,GAAI,+BAA8BJ,IAAK,UAASC,SAAU,EAAC;EACtE,OAAOC,MAAM;AACjB,CAAC;AAQM,MAAMG,yCAAyC,GAAIC,MAAc,IAAK;EACzE,MAAM;IAAEC,MAAM;IAAEC,gBAAgB;IAAER,IAAI;IAAES,YAAY,GAAGX;EAAoB,CAAC,GAAGQ,MAAM;EAErF,MAAMI,OAAiC,GAAG,EAAE;EAC5C,KAAK,MAAMC,GAAG,IAAIH,gBAAgB,EAAE;IAChC,MAAMI,eAAe,GAAGJ,gBAAgB,CAACG,GAAG,CAAC;IAC7C,IAAI,CAACjB,QAAQ,CAACM,IAAI,CAAC,IAAI,CAACY,eAAe,CAAClB,QAAQ,CAACM,IAAI,CAAC,CAAC,EAAE;MACrD;IACJ;IACA,MAAMa,YAAY,GAAGD,eAAe,CAAClB,QAAQ,CAACM,IAAI,CAAC,CAAC,CAACa,YAAY;IACjE;IACA,IAAI,CAACA,YAAY,EAAE;MACf;IACJ;IACA,MAAMd,MAAM,GAAGc,YAAY,CAAC;MAAEN;IAAO,CAAC,CAAC;;IAEvC;IACA;IACA,MAAML,MAAM,GAAGO,YAAY,CAAC;MACxBV,MAAM;MACNC,IAAI;MACJC,SAAS,EAAEW,eAAe,CAACX;IAC/B,CAAC,CAAC;IACFS,OAAO,CAACI,IAAI,CAACZ,MAAM,CAAC;EACxB;EACA,OAAOQ,OAAO;AAClB,CAAC;AAACK,OAAA,CAAAV,yCAAA,GAAAA,yCAAA"}
1
+ {"version":3,"names":["_plugins","require","TYPE_MAP","preview","read","manage","defaultCreatePlugin","schema","type","fieldType","plugin","createCmsGraphQLSchemaPlugin","name","createGraphQLSchemaPluginFromFieldPlugins","params","models","fieldTypePlugins","createPlugin","plugins","key","fieldTypePlugin","createSchema","push","exports"],"sources":["getSchemaFromFieldPlugins.ts"],"sourcesContent":["import { ApiEndpoint, CmsContext, CmsFieldTypePlugins, CmsModel } from \"~/types\";\nimport { createCmsGraphQLSchemaPlugin, ICmsGraphQLSchemaPlugin } from \"~/plugins\";\nimport { IGraphQLSchemaPlugin } from \"@webiny/handler-graphql\";\nimport { GraphQLSchemaDefinition } from \"@webiny/handler-graphql/types\";\n\nconst TYPE_MAP: Record<string, \"manage\" | \"read\"> = {\n preview: \"read\",\n read: \"read\",\n manage: \"manage\"\n};\n\ninterface CreatePluginCallableParams {\n schema: GraphQLSchemaDefinition<CmsContext>;\n type: \"manage\" | \"preview\" | \"read\";\n fieldType: string;\n}\n\ninterface CreatePluginCallable {\n (params: CreatePluginCallableParams): IGraphQLSchemaPlugin<CmsContext>;\n}\n\nconst defaultCreatePlugin: CreatePluginCallable = ({ schema, type, fieldType }) => {\n const plugin = createCmsGraphQLSchemaPlugin(schema);\n plugin.name = `headless-cms.graphql.schema.${type}.field.${fieldType}`;\n return plugin;\n};\n\ninterface Params {\n models: CmsModel[];\n fieldTypePlugins: CmsFieldTypePlugins;\n type: ApiEndpoint;\n createPlugin?: CreatePluginCallable;\n}\nexport const createGraphQLSchemaPluginFromFieldPlugins = (params: Params) => {\n const { models, fieldTypePlugins, type, createPlugin = defaultCreatePlugin } = params;\n\n const plugins: ICmsGraphQLSchemaPlugin[] = [];\n for (const key in fieldTypePlugins) {\n const fieldTypePlugin = fieldTypePlugins[key];\n if (!TYPE_MAP[type] || !fieldTypePlugin[TYPE_MAP[type]]) {\n continue;\n }\n const createSchema = fieldTypePlugin[TYPE_MAP[type]].createSchema;\n // Render gql types generated by field type plugins\n if (!createSchema) {\n continue;\n }\n const schema = createSchema({ models });\n\n // const plugin = createCmsGraphQLSchemaPlugin(schema);\n // plugin.name = `headless-cms.graphql.schema.${type}.field.${fieldTypePlugin.fieldType}`;\n const plugin = createPlugin({\n schema,\n type,\n fieldType: fieldTypePlugin.fieldType\n });\n plugins.push(plugin);\n }\n return plugins;\n};\n"],"mappings":";;;;;;AACA,IAAAA,QAAA,GAAAC,OAAA;AAIA,MAAMC,QAA2C,GAAG;EAChDC,OAAO,EAAE,MAAM;EACfC,IAAI,EAAE,MAAM;EACZC,MAAM,EAAE;AACZ,CAAC;AAYD,MAAMC,mBAAyC,GAAGA,CAAC;EAAEC,MAAM;EAAEC,IAAI;EAAEC;AAAU,CAAC,KAAK;EAC/E,MAAMC,MAAM,GAAG,IAAAC,qCAA4B,EAACJ,MAAM,CAAC;EACnDG,MAAM,CAACE,IAAI,GAAI,+BAA8BJ,IAAK,UAASC,SAAU,EAAC;EACtE,OAAOC,MAAM;AACjB,CAAC;AAQM,MAAMG,yCAAyC,GAAIC,MAAc,IAAK;EACzE,MAAM;IAAEC,MAAM;IAAEC,gBAAgB;IAAER,IAAI;IAAES,YAAY,GAAGX;EAAoB,CAAC,GAAGQ,MAAM;EAErF,MAAMI,OAAkC,GAAG,EAAE;EAC7C,KAAK,MAAMC,GAAG,IAAIH,gBAAgB,EAAE;IAChC,MAAMI,eAAe,GAAGJ,gBAAgB,CAACG,GAAG,CAAC;IAC7C,IAAI,CAACjB,QAAQ,CAACM,IAAI,CAAC,IAAI,CAACY,eAAe,CAAClB,QAAQ,CAACM,IAAI,CAAC,CAAC,EAAE;MACrD;IACJ;IACA,MAAMa,YAAY,GAAGD,eAAe,CAAClB,QAAQ,CAACM,IAAI,CAAC,CAAC,CAACa,YAAY;IACjE;IACA,IAAI,CAACA,YAAY,EAAE;MACf;IACJ;IACA,MAAMd,MAAM,GAAGc,YAAY,CAAC;MAAEN;IAAO,CAAC,CAAC;;IAEvC;IACA;IACA,MAAML,MAAM,GAAGO,YAAY,CAAC;MACxBV,MAAM;MACNC,IAAI;MACJC,SAAS,EAAEW,eAAe,CAACX;IAC/B,CAAC,CAAC;IACFS,OAAO,CAACI,IAAI,CAACZ,MAAM,CAAC;EACxB;EACA,OAAOQ,OAAO;AAClB,CAAC;AAACK,OAAA,CAAAV,yCAAA,GAAAA,yCAAA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["getIdentity","input","defaultValue","identity","id","displayName","type","exports"],"sources":["identity.ts"],"sourcesContent":["import { SecurityIdentity } from \"@webiny/api-security/types\";\n\nexport const getIdentity = <T extends SecurityIdentity | null>(\n input: SecurityIdentity | null | undefined,\n defaultValue: T | null = null\n): T => {\n const identity = input?.id && input?.displayName && input?.type ? input : defaultValue;\n if (!identity) {\n return null as T;\n }\n return {\n id: identity.id,\n displayName: identity.displayName,\n type: identity.type\n } as T;\n};\n"],"mappings":";;;;;;AAEO,MAAMA,WAAW,GAAGA,CACvBC,KAA0C,EAC1CC,YAAsB,GAAG,IAAI,KACzB;EACJ,MAAMC,QAAQ,GAAGF,KAAK,EAAEG,EAAE,IAAIH,KAAK,EAAEI,WAAW,IAAIJ,KAAK,EAAEK,IAAI,GAAGL,KAAK,GAAGC,YAAY;EACtF,IAAI,CAACC,QAAQ,EAAE;IACX,OAAO,IAAI;EACf;EACA,OAAO;IACHC,EAAE,EAAED,QAAQ,CAACC,EAAE;IACfC,WAAW,EAAEF,QAAQ,CAACE,WAAW;IACjCC,IAAI,EAAEH,QAAQ,CAACG;EACnB,CAAC;AACL,CAAC;AAACC,OAAA,CAAAP,WAAA,GAAAA,WAAA"}
1
+ {"version":3,"names":["getIdentity","input","defaultValue","identity","id","displayName","type","exports"],"sources":["identity.ts"],"sourcesContent":["import { SecurityIdentity } from \"@webiny/api-security/types\";\n\nexport const getIdentity = <T extends SecurityIdentity | null>(\n input: SecurityIdentity | null | undefined,\n defaultValue: T | null = null\n): T => {\n const identity = input?.id && input?.displayName && input?.type ? input : defaultValue;\n if (!identity) {\n return null as T;\n }\n return {\n id: identity.id,\n displayName: identity.displayName,\n type: identity.type\n } as T;\n};\n"],"mappings":";;;;;;AAEO,MAAMA,WAAW,GAAGA,CACvBC,KAA0C,EAC1CC,YAAsB,GAAG,IAAI,KACzB;EACJ,MAAMC,QAAQ,GAAGF,KAAK,EAAEG,EAAE,IAAIH,KAAK,EAAEI,WAAW,IAAIJ,KAAK,EAAEK,IAAI,GAAGL,KAAK,GAAGC,YAAY;EACtF,IAAI,CAACC,QAAQ,EAAE;IACX,OAAO,IAAI;EACf;EACA,OAAO;IACHC,EAAE,EAAED,QAAQ,CAACC,EAAE;IACfC,WAAW,EAAEF,QAAQ,CAACE,WAAW;IACjCC,IAAI,EAAEH,QAAQ,CAACG;EACnB,CAAC;AACL,CAAC;AAACC,OAAA,CAAAP,WAAA,GAAAA,WAAA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["_utils","require","_error","_interopRequireDefault","incrementEntryIdVersion","id","entryId","version","parseIdentifier","WebinyError","createIdentifier","exports"],"sources":["incrementEntryIdVersion.ts"],"sourcesContent":["import { createIdentifier, parseIdentifier } from \"@webiny/utils\";\nimport WebinyError from \"@webiny/error\";\n\nexport const incrementEntryIdVersion = (id: string) => {\n const { id: entryId, version } = parseIdentifier(id);\n if (!version) {\n throw new WebinyError(\n \"Cannot increase version on the ID without the version part.\",\n \"WRONG_ID\",\n {\n id\n }\n );\n }\n return {\n entryId,\n version: version + 1,\n id: createIdentifier({\n id: entryId,\n version: version + 1\n })\n };\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAC,sBAAA,CAAAF,OAAA;AAEO,MAAMG,uBAAuB,GAAIC,EAAU,IAAK;EACnD,MAAM;IAAEA,EAAE,EAAEC,OAAO;IAAEC;EAAQ,CAAC,GAAG,IAAAC,sBAAe,EAACH,EAAE,CAAC;EACpD,IAAI,CAACE,OAAO,EAAE;IACV,MAAM,IAAIE,cAAW,CACjB,6DAA6D,EAC7D,UAAU,EACV;MACIJ;IACJ,CACJ,CAAC;EACL;EACA,OAAO;IACHC,OAAO;IACPC,OAAO,EAAEA,OAAO,GAAG,CAAC;IACpBF,EAAE,EAAE,IAAAK,uBAAgB,EAAC;MACjBL,EAAE,EAAEC,OAAO;MACXC,OAAO,EAAEA,OAAO,GAAG;IACvB,CAAC;EACL,CAAC;AACL,CAAC;AAACI,OAAA,CAAAP,uBAAA,GAAAA,uBAAA"}
1
+ {"version":3,"names":["_utils","require","_error","_interopRequireDefault","incrementEntryIdVersion","id","entryId","version","parseIdentifier","WebinyError","createIdentifier","exports"],"sources":["incrementEntryIdVersion.ts"],"sourcesContent":["import { createIdentifier, parseIdentifier } from \"@webiny/utils\";\nimport WebinyError from \"@webiny/error\";\n\nexport const incrementEntryIdVersion = (id: string) => {\n const { id: entryId, version } = parseIdentifier(id);\n if (!version) {\n throw new WebinyError(\n \"Cannot increase version on the ID without the version part.\",\n \"WRONG_ID\",\n {\n id\n }\n );\n }\n return {\n entryId,\n version: version + 1,\n id: createIdentifier({\n id: entryId,\n version: version + 1\n })\n };\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAC,sBAAA,CAAAF,OAAA;AAEO,MAAMG,uBAAuB,GAAIC,EAAU,IAAK;EACnD,MAAM;IAAEA,EAAE,EAAEC,OAAO;IAAEC;EAAQ,CAAC,GAAG,IAAAC,sBAAe,EAACH,EAAE,CAAC;EACpD,IAAI,CAACE,OAAO,EAAE;IACV,MAAM,IAAIE,cAAW,CACjB,6DAA6D,EAC7D,UAAU,EACV;MACIJ;IACJ,CACJ,CAAC;EACL;EACA,OAAO;IACHC,OAAO;IACPC,OAAO,EAAEA,OAAO,GAAG,CAAC;IACpBF,EAAE,EAAE,IAAAK,uBAAgB,EAAC;MACjBL,EAAE,EAAEC,OAAO;MACXC,OAAO,EAAEA,OAAO,GAAG;IACvB,CAAC;EACL,CAAC;AACL,CAAC;AAACI,OAAA,CAAAP,uBAAA,GAAAA,uBAAA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["_caching","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get"],"sources":["index.ts"],"sourcesContent":["export * from \"./caching\";\n"],"mappings":";;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,QAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,QAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,QAAA,CAAAK,GAAA;IAAA;EAAA;AAAA"}
1
+ {"version":3,"names":["_caching","require","Object","keys","forEach","key","exports","defineProperty","enumerable","get"],"sources":["index.ts"],"sourcesContent":["export * from \"./caching\";\n"],"mappings":";;;;;AAAA,IAAAA,QAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,QAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAA,GAAA,IAAAC,OAAA,IAAAA,OAAA,CAAAD,GAAA,MAAAL,QAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAK,cAAA,CAAAD,OAAA,EAAAD,GAAA;IAAAG,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAT,QAAA,CAAAK,GAAA;IAAA;EAAA;AAAA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["isHeadlessCmsReady","tenancy","i18n","tenant","getCurrentTenant","locale","getContentLocale","undefined","exports"],"sources":["isHeadlessCmsReady.ts"],"sourcesContent":["import { CmsContext } from \"~/types\";\n\nexport const isHeadlessCmsReady = async ({ tenancy, i18n }: CmsContext): Promise<boolean> => {\n /**\n * In case of a fresh webiny project \"tenant\" and \"locale\" won't be there until the installation is completed.\n */\n const tenant = tenancy.getCurrentTenant();\n if (!tenant) {\n return false;\n }\n\n const locale = i18n.getContentLocale();\n\n return locale !== undefined;\n};\n"],"mappings":";;;;;;AAEO,MAAMA,kBAAkB,GAAG,MAAAA,CAAO;EAAEC,OAAO;EAAEC;AAAiB,CAAC,KAAuB;EACzF;AACJ;AACA;EACI,MAAMC,MAAM,GAAGF,OAAO,CAACG,gBAAgB,CAAC,CAAC;EACzC,IAAI,CAACD,MAAM,EAAE;IACT,OAAO,KAAK;EAChB;EAEA,MAAME,MAAM,GAAGH,IAAI,CAACI,gBAAgB,CAAC,CAAC;EAEtC,OAAOD,MAAM,KAAKE,SAAS;AAC/B,CAAC;AAACC,OAAA,CAAAR,kBAAA,GAAAA,kBAAA"}
1
+ {"version":3,"names":["isHeadlessCmsReady","tenancy","i18n","tenant","getCurrentTenant","locale","getContentLocale","undefined","exports"],"sources":["isHeadlessCmsReady.ts"],"sourcesContent":["import { CmsContext } from \"~/types\";\n\nexport const isHeadlessCmsReady = async ({ tenancy, i18n }: CmsContext): Promise<boolean> => {\n /**\n * In case of a fresh webiny project \"tenant\" and \"locale\" won't be there until the installation is completed.\n */\n const tenant = tenancy.getCurrentTenant();\n if (!tenant) {\n return false;\n }\n\n const locale = i18n.getContentLocale();\n\n return locale !== undefined;\n};\n"],"mappings":";;;;;;AAEO,MAAMA,kBAAkB,GAAG,MAAAA,CAAO;EAAEC,OAAO;EAAEC;AAAiB,CAAC,KAAuB;EACzF;AACJ;AACA;EACI,MAAMC,MAAM,GAAGF,OAAO,CAACG,gBAAgB,CAAC,CAAC;EACzC,IAAI,CAACD,MAAM,EAAE;IACT,OAAO,KAAK;EAChB;EAEA,MAAME,MAAM,GAAGH,IAAI,CAACI,gBAAgB,CAAC,CAAC;EAEtC,OAAOD,MAAM,KAAKE,SAAS;AAC/B,CAAC;AAACC,OAAA,CAAAR,kBAAA,GAAAA,kBAAA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["_getBaseFieldType","require","renderFields","models","model","fields","type","fieldTypePlugins","map","field","renderField","filter","Boolean","exports","plugin","getBaseFieldType","createTypeField","defs"],"sources":["renderFields.ts"],"sourcesContent":["import {\n ApiEndpoint,\n CmsFieldTypePlugins,\n CmsModel,\n CmsModelField,\n CmsModelFieldDefinition,\n CmsModelFieldToGraphQLPlugin\n} from \"~/types\";\nimport { getBaseFieldType } from \"~/utils/getBaseFieldType\";\n\ninterface RenderFieldsParams {\n models: CmsModel[];\n model: CmsModel;\n fields: CmsModelField[];\n type: ApiEndpoint;\n fieldTypePlugins: CmsFieldTypePlugins;\n}\n\ninterface RenderFields {\n (params: RenderFieldsParams): CmsModelFieldDefinition[];\n}\n\nexport const renderFields: RenderFields = ({\n models,\n model,\n fields,\n type,\n fieldTypePlugins\n}): CmsModelFieldDefinition[] => {\n return fields\n .map(field => renderField({ models, model, type, field, fieldTypePlugins }))\n .filter(Boolean) as CmsModelFieldDefinition[];\n};\n\ninterface RenderFieldParams extends Omit<RenderFieldsParams, \"fields\"> {\n field: CmsModelField;\n}\n\nexport const renderField = ({\n models,\n model,\n type,\n field,\n fieldTypePlugins\n}: RenderFieldParams): CmsModelFieldDefinition | null => {\n const plugin = fieldTypePlugins[getBaseFieldType(field)];\n if (!plugin) {\n // Let's not render the field if it does not exist in the field plugins.\n return null;\n }\n const { createTypeField } = plugin[type] as CmsModelFieldToGraphQLPlugin[\"manage\"];\n const defs = createTypeField({\n models,\n model,\n field,\n fieldTypePlugins\n });\n\n if (!defs) {\n return null;\n } else if (typeof defs === \"string\") {\n return {\n fields: defs\n };\n }\n\n return defs;\n};\n"],"mappings":";;;;;;AAQA,IAAAA,iBAAA,GAAAC,OAAA;AAcO,MAAMC,YAA0B,GAAGA,CAAC;EACvCC,MAAM;EACNC,KAAK;EACLC,MAAM;EACNC,IAAI;EACJC;AACJ,CAAC,KAAgC;EAC7B,OAAOF,MAAM,CACRG,GAAG,CAACC,KAAK,IAAIC,WAAW,CAAC;IAAEP,MAAM;IAAEC,KAAK;IAAEE,IAAI;IAAEG,KAAK;IAAEF;EAAiB,CAAC,CAAC,CAAC,CAC3EI,MAAM,CAACC,OAAO,CAAC;AACxB,CAAC;AAACC,OAAA,CAAAX,YAAA,GAAAA,YAAA;AAMK,MAAMQ,WAAW,GAAGA,CAAC;EACxBP,MAAM;EACNC,KAAK;EACLE,IAAI;EACJG,KAAK;EACLF;AACe,CAAC,KAAqC;EACrD,MAAMO,MAAM,GAAGP,gBAAgB,CAAC,IAAAQ,kCAAgB,EAACN,KAAK,CAAC,CAAC;EACxD,IAAI,CAACK,MAAM,EAAE;IACT;IACA,OAAO,IAAI;EACf;EACA,MAAM;IAAEE;EAAgB,CAAC,GAAGF,MAAM,CAACR,IAAI,CAA2C;EAClF,MAAMW,IAAI,GAAGD,eAAe,CAAC;IACzBb,MAAM;IACNC,KAAK;IACLK,KAAK;IACLF;EACJ,CAAC,CAAC;EAEF,IAAI,CAACU,IAAI,EAAE;IACP,OAAO,IAAI;EACf,CAAC,MAAM,IAAI,OAAOA,IAAI,KAAK,QAAQ,EAAE;IACjC,OAAO;MACHZ,MAAM,EAAEY;IACZ,CAAC;EACL;EAEA,OAAOA,IAAI;AACf,CAAC;AAACJ,OAAA,CAAAH,WAAA,GAAAA,WAAA"}
1
+ {"version":3,"names":["_getBaseFieldType","require","renderFields","models","model","fields","type","fieldTypePlugins","map","field","renderField","filter","Boolean","exports","plugin","getBaseFieldType","createTypeField","defs"],"sources":["renderFields.ts"],"sourcesContent":["import {\n ApiEndpoint,\n CmsFieldTypePlugins,\n CmsModel,\n CmsModelField,\n CmsModelFieldDefinition,\n CmsModelFieldToGraphQLPlugin\n} from \"~/types\";\nimport { getBaseFieldType } from \"~/utils/getBaseFieldType\";\n\ninterface RenderFieldsParams {\n models: CmsModel[];\n model: CmsModel;\n fields: CmsModelField[];\n type: ApiEndpoint;\n fieldTypePlugins: CmsFieldTypePlugins;\n}\n\ninterface RenderFields {\n (params: RenderFieldsParams): CmsModelFieldDefinition[];\n}\n\nexport const renderFields: RenderFields = ({\n models,\n model,\n fields,\n type,\n fieldTypePlugins\n}): CmsModelFieldDefinition[] => {\n return fields\n .map(field => renderField({ models, model, type, field, fieldTypePlugins }))\n .filter(Boolean) as CmsModelFieldDefinition[];\n};\n\ninterface RenderFieldParams extends Omit<RenderFieldsParams, \"fields\"> {\n field: CmsModelField;\n}\n\nexport const renderField = ({\n models,\n model,\n type,\n field,\n fieldTypePlugins\n}: RenderFieldParams): CmsModelFieldDefinition | null => {\n const plugin = fieldTypePlugins[getBaseFieldType(field)];\n if (!plugin) {\n // Let's not render the field if it does not exist in the field plugins.\n return null;\n }\n const { createTypeField } = plugin[type] as CmsModelFieldToGraphQLPlugin[\"manage\"];\n const defs = createTypeField({\n models,\n model,\n field,\n fieldTypePlugins\n });\n\n if (!defs) {\n return null;\n } else if (typeof defs === \"string\") {\n return {\n fields: defs\n };\n }\n\n return defs;\n};\n"],"mappings":";;;;;;AAQA,IAAAA,iBAAA,GAAAC,OAAA;AAcO,MAAMC,YAA0B,GAAGA,CAAC;EACvCC,MAAM;EACNC,KAAK;EACLC,MAAM;EACNC,IAAI;EACJC;AACJ,CAAC,KAAgC;EAC7B,OAAOF,MAAM,CACRG,GAAG,CAACC,KAAK,IAAIC,WAAW,CAAC;IAAEP,MAAM;IAAEC,KAAK;IAAEE,IAAI;IAAEG,KAAK;IAAEF;EAAiB,CAAC,CAAC,CAAC,CAC3EI,MAAM,CAACC,OAAO,CAAC;AACxB,CAAC;AAACC,OAAA,CAAAX,YAAA,GAAAA,YAAA;AAMK,MAAMQ,WAAW,GAAGA,CAAC;EACxBP,MAAM;EACNC,KAAK;EACLE,IAAI;EACJG,KAAK;EACLF;AACe,CAAC,KAAqC;EACrD,MAAMO,MAAM,GAAGP,gBAAgB,CAAC,IAAAQ,kCAAgB,EAACN,KAAK,CAAC,CAAC;EACxD,IAAI,CAACK,MAAM,EAAE;IACT;IACA,OAAO,IAAI;EACf;EACA,MAAM;IAAEE;EAAgB,CAAC,GAAGF,MAAM,CAACR,IAAI,CAA2C;EAClF,MAAMW,IAAI,GAAGD,eAAe,CAAC;IACzBb,MAAM;IACNC,KAAK;IACLK,KAAK;IACLF;EACJ,CAAC,CAAC;EAEF,IAAI,CAACU,IAAI,EAAE;IACP,OAAO,IAAI;EACf,CAAC,MAAM,IAAI,OAAOA,IAAI,KAAK,QAAQ,EAAE;IACjC,OAAO;MACHZ,MAAM,EAAEY;IACZ,CAAC;EACL;EAEA,OAAOA,IAAI;AACf,CAAC;AAACJ,OAAA,CAAAH,WAAA,GAAAA,WAAA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["_getBaseFieldType","require","renderGetFilterFields","fields","fieldTypePlugins","filters","field","baseType","getBaseFieldType","plugin","isSearchable","createGetFilters","read","push","filter","Boolean","join","exports"],"sources":["renderGetFilterFields.ts"],"sourcesContent":["import { CmsFieldTypePlugins, CmsModelField } from \"~/types\";\nimport { getBaseFieldType } from \"~/utils/getBaseFieldType\";\n\ninterface RenderGetFilterFieldsParams {\n fields: CmsModelField[];\n fieldTypePlugins: CmsFieldTypePlugins;\n}\ninterface RenderGetFilterFields {\n (params: RenderGetFilterFieldsParams): string;\n}\n\nexport const renderGetFilterFields: RenderGetFilterFields = ({ fields, fieldTypePlugins }) => {\n const filters: string[] = [\"id: ID\", \"entryId: String\"];\n\n for (const field of fields) {\n // Every time a client updates content model's fields, we check the type of each field. If a field plugin\n // for a particular \"field.type\" doesn't exist on the backend yet, we throw an error. But still, we also\n // want to be careful when accessing the field plugin here too. It is still possible to have a content model\n // that contains a field, for which we don't have a plugin registered on the backend. For example, user\n // could've just removed the plugin from the backend.\n const baseType = getBaseFieldType(field);\n const plugin = fieldTypePlugins[baseType];\n if (!plugin?.isSearchable) {\n continue;\n }\n const createGetFilters = plugin.read?.createGetFilters;\n if (typeof createGetFilters !== \"function\") {\n continue;\n }\n filters.push(createGetFilters({ field }));\n }\n\n return filters.filter(Boolean).join(\"\\n\");\n};\n"],"mappings":";;;;;;AACA,IAAAA,iBAAA,GAAAC,OAAA;AAUO,MAAMC,qBAA4C,GAAGA,CAAC;EAAEC,MAAM;EAAEC;AAAiB,CAAC,KAAK;EAC1F,MAAMC,OAAiB,GAAG,CAAC,QAAQ,EAAE,iBAAiB,CAAC;EAEvD,KAAK,MAAMC,KAAK,IAAIH,MAAM,EAAE;IACxB;IACA;IACA;IACA;IACA;IACA,MAAMI,QAAQ,GAAG,IAAAC,kCAAgB,EAACF,KAAK,CAAC;IACxC,MAAMG,MAAM,GAAGL,gBAAgB,CAACG,QAAQ,CAAC;IACzC,IAAI,CAACE,MAAM,EAAEC,YAAY,EAAE;MACvB;IACJ;IACA,MAAMC,gBAAgB,GAAGF,MAAM,CAACG,IAAI,EAAED,gBAAgB;IACtD,IAAI,OAAOA,gBAAgB,KAAK,UAAU,EAAE;MACxC;IACJ;IACAN,OAAO,CAACQ,IAAI,CAACF,gBAAgB,CAAC;MAAEL;IAAM,CAAC,CAAC,CAAC;EAC7C;EAEA,OAAOD,OAAO,CAACS,MAAM,CAACC,OAAO,CAAC,CAACC,IAAI,CAAC,IAAI,CAAC;AAC7C,CAAC;AAACC,OAAA,CAAAf,qBAAA,GAAAA,qBAAA"}
1
+ {"version":3,"names":["_getBaseFieldType","require","renderGetFilterFields","fields","fieldTypePlugins","filters","field","baseType","getBaseFieldType","plugin","isSearchable","createGetFilters","read","push","filter","Boolean","join","exports"],"sources":["renderGetFilterFields.ts"],"sourcesContent":["import { CmsFieldTypePlugins, CmsModelField } from \"~/types\";\nimport { getBaseFieldType } from \"~/utils/getBaseFieldType\";\n\ninterface RenderGetFilterFieldsParams {\n fields: CmsModelField[];\n fieldTypePlugins: CmsFieldTypePlugins;\n}\ninterface RenderGetFilterFields {\n (params: RenderGetFilterFieldsParams): string;\n}\n\nexport const renderGetFilterFields: RenderGetFilterFields = ({ fields, fieldTypePlugins }) => {\n const filters: string[] = [\"id: ID\", \"entryId: String\"];\n\n for (const field of fields) {\n // Every time a client updates content model's fields, we check the type of each field. If a field plugin\n // for a particular \"field.type\" doesn't exist on the backend yet, we throw an error. But still, we also\n // want to be careful when accessing the field plugin here too. It is still possible to have a content model\n // that contains a field, for which we don't have a plugin registered on the backend. For example, user\n // could've just removed the plugin from the backend.\n const baseType = getBaseFieldType(field);\n const plugin = fieldTypePlugins[baseType];\n if (!plugin?.isSearchable) {\n continue;\n }\n const createGetFilters = plugin.read?.createGetFilters;\n if (typeof createGetFilters !== \"function\") {\n continue;\n }\n filters.push(createGetFilters({ field }));\n }\n\n return filters.filter(Boolean).join(\"\\n\");\n};\n"],"mappings":";;;;;;AACA,IAAAA,iBAAA,GAAAC,OAAA;AAUO,MAAMC,qBAA4C,GAAGA,CAAC;EAAEC,MAAM;EAAEC;AAAiB,CAAC,KAAK;EAC1F,MAAMC,OAAiB,GAAG,CAAC,QAAQ,EAAE,iBAAiB,CAAC;EAEvD,KAAK,MAAMC,KAAK,IAAIH,MAAM,EAAE;IACxB;IACA;IACA;IACA;IACA;IACA,MAAMI,QAAQ,GAAG,IAAAC,kCAAgB,EAACF,KAAK,CAAC;IACxC,MAAMG,MAAM,GAAGL,gBAAgB,CAACG,QAAQ,CAAC;IACzC,IAAI,CAACE,MAAM,EAAEC,YAAY,EAAE;MACvB;IACJ;IACA,MAAMC,gBAAgB,GAAGF,MAAM,CAACG,IAAI,EAAED,gBAAgB;IACtD,IAAI,OAAOA,gBAAgB,KAAK,UAAU,EAAE;MACxC;IACJ;IACAN,OAAO,CAACQ,IAAI,CAACF,gBAAgB,CAAC;MAAEL;IAAM,CAAC,CAAC,CAAC;EAC7C;EAEA,OAAOD,OAAO,CAACS,MAAM,CAACC,OAAO,CAAC,CAACC,IAAI,CAAC,IAAI,CAAC;AAC7C,CAAC;AAACC,OAAA,CAAAf,qBAAA,GAAAA,qBAAA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["_getBaseFieldType","require","renderInputFields","models","model","fields","fieldTypePlugins","reduce","result","field","input","renderInputField","push","exports","plugin","getBaseFieldType","def","manage","createInputField"],"sources":["renderInputFields.ts"],"sourcesContent":["import { CmsFieldTypePlugins, CmsModel, CmsModelField, CmsModelFieldDefinition } from \"~/types\";\nimport { getBaseFieldType } from \"~/utils/getBaseFieldType\";\n\ninterface RenderInputFieldsParams {\n models: CmsModel[];\n model: CmsModel;\n fields: CmsModelField[];\n fieldTypePlugins: CmsFieldTypePlugins;\n}\n\ninterface RenderInputFieldParams extends Omit<RenderInputFieldsParams, \"fields\"> {\n field: CmsModelField;\n}\n\ninterface RenderInputFields {\n (params: RenderInputFieldsParams): CmsModelFieldDefinition[];\n}\n\nexport const renderInputFields: RenderInputFields = ({\n models,\n model,\n fields,\n fieldTypePlugins\n}): CmsModelFieldDefinition[] => {\n return fields.reduce<CmsModelFieldDefinition[]>((result, field) => {\n const input = renderInputField({ models, model, field, fieldTypePlugins });\n if (!input) {\n return result;\n }\n result.push(input);\n return result;\n }, []);\n};\n\nexport const renderInputField = ({\n models,\n model,\n field,\n fieldTypePlugins\n}: RenderInputFieldParams): CmsModelFieldDefinition | null => {\n // Every time a client updates content model's fields, we check the type of each field. If a field plugin\n // for a particular \"field.type\" doesn't exist on the backend yet, we throw an error. But still, we also\n // want to be careful when accessing the field plugin here too. It is still possible to have a content model\n // that contains a field, for which we don't have a plugin registered on the backend. For example, user\n // could've just removed the plugin from the backend.\n const plugin = fieldTypePlugins[getBaseFieldType(field)];\n\n if (!plugin) {\n // Let's not render the field if it does not exist in the field plugins.\n return null;\n }\n\n const def = plugin.manage.createInputField({\n models,\n model,\n field,\n fieldTypePlugins\n });\n if (typeof def === \"string\") {\n return {\n fields: def\n };\n }\n\n return def;\n};\n"],"mappings":";;;;;;AACA,IAAAA,iBAAA,GAAAC,OAAA;AAiBO,MAAMC,iBAAoC,GAAGA,CAAC;EACjDC,MAAM;EACNC,KAAK;EACLC,MAAM;EACNC;AACJ,CAAC,KAAgC;EAC7B,OAAOD,MAAM,CAACE,MAAM,CAA4B,CAACC,MAAM,EAAEC,KAAK,KAAK;IAC/D,MAAMC,KAAK,GAAGC,gBAAgB,CAAC;MAAER,MAAM;MAAEC,KAAK;MAAEK,KAAK;MAAEH;IAAiB,CAAC,CAAC;IAC1E,IAAI,CAACI,KAAK,EAAE;MACR,OAAOF,MAAM;IACjB;IACAA,MAAM,CAACI,IAAI,CAACF,KAAK,CAAC;IAClB,OAAOF,MAAM;EACjB,CAAC,EAAE,EAAE,CAAC;AACV,CAAC;AAACK,OAAA,CAAAX,iBAAA,GAAAA,iBAAA;AAEK,MAAMS,gBAAgB,GAAGA,CAAC;EAC7BR,MAAM;EACNC,KAAK;EACLK,KAAK;EACLH;AACoB,CAAC,KAAqC;EAC1D;EACA;EACA;EACA;EACA;EACA,MAAMQ,MAAM,GAAGR,gBAAgB,CAAC,IAAAS,kCAAgB,EAACN,KAAK,CAAC,CAAC;EAExD,IAAI,CAACK,MAAM,EAAE;IACT;IACA,OAAO,IAAI;EACf;EAEA,MAAME,GAAG,GAAGF,MAAM,CAACG,MAAM,CAACC,gBAAgB,CAAC;IACvCf,MAAM;IACNC,KAAK;IACLK,KAAK;IACLH;EACJ,CAAC,CAAC;EACF,IAAI,OAAOU,GAAG,KAAK,QAAQ,EAAE;IACzB,OAAO;MACHX,MAAM,EAAEW;IACZ,CAAC;EACL;EAEA,OAAOA,GAAG;AACd,CAAC;AAACH,OAAA,CAAAF,gBAAA,GAAAA,gBAAA"}
1
+ {"version":3,"names":["_getBaseFieldType","require","renderInputFields","models","model","fields","fieldTypePlugins","reduce","result","field","input","renderInputField","push","exports","plugin","getBaseFieldType","def","manage","createInputField"],"sources":["renderInputFields.ts"],"sourcesContent":["import { CmsFieldTypePlugins, CmsModel, CmsModelField, CmsModelFieldDefinition } from \"~/types\";\nimport { getBaseFieldType } from \"~/utils/getBaseFieldType\";\n\ninterface RenderInputFieldsParams {\n models: CmsModel[];\n model: CmsModel;\n fields: CmsModelField[];\n fieldTypePlugins: CmsFieldTypePlugins;\n}\n\ninterface RenderInputFieldParams extends Omit<RenderInputFieldsParams, \"fields\"> {\n field: CmsModelField;\n}\n\ninterface RenderInputFields {\n (params: RenderInputFieldsParams): CmsModelFieldDefinition[];\n}\n\nexport const renderInputFields: RenderInputFields = ({\n models,\n model,\n fields,\n fieldTypePlugins\n}): CmsModelFieldDefinition[] => {\n return fields.reduce<CmsModelFieldDefinition[]>((result, field) => {\n const input = renderInputField({ models, model, field, fieldTypePlugins });\n if (!input) {\n return result;\n }\n result.push(input);\n return result;\n }, []);\n};\n\nexport const renderInputField = ({\n models,\n model,\n field,\n fieldTypePlugins\n}: RenderInputFieldParams): CmsModelFieldDefinition | null => {\n // Every time a client updates content model's fields, we check the type of each field. If a field plugin\n // for a particular \"field.type\" doesn't exist on the backend yet, we throw an error. But still, we also\n // want to be careful when accessing the field plugin here too. It is still possible to have a content model\n // that contains a field, for which we don't have a plugin registered on the backend. For example, user\n // could've just removed the plugin from the backend.\n const plugin = fieldTypePlugins[getBaseFieldType(field)];\n\n if (!plugin) {\n // Let's not render the field if it does not exist in the field plugins.\n return null;\n }\n\n const def = plugin.manage.createInputField({\n models,\n model,\n field,\n fieldTypePlugins\n });\n if (typeof def === \"string\") {\n return {\n fields: def\n };\n }\n\n return def;\n};\n"],"mappings":";;;;;;AACA,IAAAA,iBAAA,GAAAC,OAAA;AAiBO,MAAMC,iBAAoC,GAAGA,CAAC;EACjDC,MAAM;EACNC,KAAK;EACLC,MAAM;EACNC;AACJ,CAAC,KAAgC;EAC7B,OAAOD,MAAM,CAACE,MAAM,CAA4B,CAACC,MAAM,EAAEC,KAAK,KAAK;IAC/D,MAAMC,KAAK,GAAGC,gBAAgB,CAAC;MAAER,MAAM;MAAEC,KAAK;MAAEK,KAAK;MAAEH;IAAiB,CAAC,CAAC;IAC1E,IAAI,CAACI,KAAK,EAAE;MACR,OAAOF,MAAM;IACjB;IACAA,MAAM,CAACI,IAAI,CAACF,KAAK,CAAC;IAClB,OAAOF,MAAM;EACjB,CAAC,EAAE,EAAE,CAAC;AACV,CAAC;AAACK,OAAA,CAAAX,iBAAA,GAAAA,iBAAA;AAEK,MAAMS,gBAAgB,GAAGA,CAAC;EAC7BR,MAAM;EACNC,KAAK;EACLK,KAAK;EACLH;AACoB,CAAC,KAAqC;EAC1D;EACA;EACA;EACA;EACA;EACA,MAAMQ,MAAM,GAAGR,gBAAgB,CAAC,IAAAS,kCAAgB,EAACN,KAAK,CAAC,CAAC;EAExD,IAAI,CAACK,MAAM,EAAE;IACT;IACA,OAAO,IAAI;EACf;EAEA,MAAME,GAAG,GAAGF,MAAM,CAACG,MAAM,CAACC,gBAAgB,CAAC;IACvCf,MAAM;IACNC,KAAK;IACLK,KAAK;IACLH;EACJ,CAAC,CAAC;EACF,IAAI,OAAOU,GAAG,KAAK,QAAQ,EAAE;IACzB,OAAO;MACHX,MAAM,EAAEW;IACZ,CAAC;EACL;EAEA,OAAOA,GAAG;AACd,CAAC;AAACH,OAAA,CAAAF,gBAAA,GAAAA,gBAAA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["_getBaseFieldType","require","_constants","renderListFilterFields","params","model","fields","type","fieldTypePlugins","excludeFields","result","ENTRY_META_FIELDS","map","field","isDateTimeEntryMetaField","flat","push","finalFields","filter","some","excl","startsWith","baseType","getBaseFieldType","createListFilters","plugins","Boolean","join","exports"],"sources":["renderListFilterFields.ts"],"sourcesContent":["import {\n ApiEndpoint,\n CmsFieldTypePlugins,\n CmsModel,\n CmsModelField,\n CmsModelFieldToGraphQLPlugin\n} from \"~/types\";\nimport { getBaseFieldType } from \"~/utils/getBaseFieldType\";\nimport { ENTRY_META_FIELDS, isDateTimeEntryMetaField } from \"~/constants\";\n\ninterface RenderListFilterFieldsParams {\n model: CmsModel;\n fields: CmsModelField[];\n type: ApiEndpoint;\n fieldTypePlugins: CmsFieldTypePlugins;\n excludeFields?: string[];\n}\n\ninterface RenderListFilterFields {\n (params: RenderListFilterFieldsParams): string;\n}\n\ntype CreateListFiltersType =\n | CmsModelFieldToGraphQLPlugin[\"read\"][\"createListFilters\"]\n | CmsModelFieldToGraphQLPlugin[\"manage\"][\"createListFilters\"];\n\nexport const renderListFilterFields: RenderListFilterFields = (params): string => {\n const { model, fields, type, fieldTypePlugins, excludeFields = [] } = params;\n const result: string[] = [\n \"id: ID\",\n \"id_not: ID\",\n \"id_in: [ID!]\",\n \"id_not_in: [ID!]\",\n \"entryId: String\",\n \"entryId_not: String\",\n \"entryId_in: [String!]\",\n \"entryId_not_in: [String!]\",\n\n ...ENTRY_META_FIELDS.map(field => {\n if (isDateTimeEntryMetaField(field)) {\n return [\n `${field}: DateTime`,\n `${field}_gt: DateTime`,\n `${field}_gte: DateTime`,\n `${field}_lt: DateTime`,\n `${field}_lte: DateTime`,\n `${field}_between: [DateTime!]`,\n `${field}_not_between: [DateTime!]`\n ];\n }\n\n return [\n `${field}: ID`,\n `${field}_not: ID`,\n `${field}_in: [ID!]`,\n `${field}_not_in: [ID!]`\n ];\n }).flat()\n ];\n\n /**\n * We can find different statuses only in the manage API endpoint.\n */\n if (type === \"manage\") {\n result.push(\n \"status: String\",\n \"status_not: String\",\n \"status_in: [String!]\",\n \"status_not_in: [String!]\"\n );\n }\n\n const finalFields = result.filter(field => {\n return !excludeFields.some(excl => {\n return field.startsWith(`${excl}_`) || field.startsWith(`${excl}: `);\n });\n });\n\n for (const field of fields) {\n // Every time a client updates content model's fields, we check the type of each field. If a field plugin\n // for a particular \"field.type\" doesn't exist on the backend yet, we throw an error. But still, we also\n // want to be careful when accessing the field plugin here too. It is still possible to have a content model\n // that contains a field, for which we don't have a plugin registered on the backend. For example, user\n // could've just removed the plugin from the backend.\n const baseType = getBaseFieldType(field);\n const createListFilters: CreateListFiltersType | undefined =\n fieldTypePlugins[baseType]?.[type]?.createListFilters;\n if (typeof createListFilters !== \"function\") {\n continue;\n }\n finalFields.push(createListFilters({ model, field, plugins: fieldTypePlugins }));\n }\n\n return finalFields.filter(Boolean).join(\"\\n\");\n};\n"],"mappings":";;;;;;AAOA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AAkBO,MAAME,sBAA8C,GAAIC,MAAM,IAAa;EAC9E,MAAM;IAAEC,KAAK;IAAEC,MAAM;IAAEC,IAAI;IAAEC,gBAAgB;IAAEC,aAAa,GAAG;EAAG,CAAC,GAAGL,MAAM;EAC5E,MAAMM,MAAgB,GAAG,CACrB,QAAQ,EACR,YAAY,EACZ,cAAc,EACd,kBAAkB,EAClB,iBAAiB,EACjB,qBAAqB,EACrB,uBAAuB,EACvB,2BAA2B,EAE3B,GAAGC,4BAAiB,CAACC,GAAG,CAACC,KAAK,IAAI;IAC9B,IAAI,IAAAC,mCAAwB,EAACD,KAAK,CAAC,EAAE;MACjC,OAAO,CACF,GAAEA,KAAM,YAAW,EACnB,GAAEA,KAAM,eAAc,EACtB,GAAEA,KAAM,gBAAe,EACvB,GAAEA,KAAM,eAAc,EACtB,GAAEA,KAAM,gBAAe,EACvB,GAAEA,KAAM,uBAAsB,EAC9B,GAAEA,KAAM,2BAA0B,CACtC;IACL;IAEA,OAAO,CACF,GAAEA,KAAM,MAAK,EACb,GAAEA,KAAM,UAAS,EACjB,GAAEA,KAAM,YAAW,EACnB,GAAEA,KAAM,gBAAe,CAC3B;EACL,CAAC,CAAC,CAACE,IAAI,CAAC,CAAC,CACZ;;EAED;AACJ;AACA;EACI,IAAIR,IAAI,KAAK,QAAQ,EAAE;IACnBG,MAAM,CAACM,IAAI,CACP,gBAAgB,EAChB,oBAAoB,EACpB,sBAAsB,EACtB,0BACJ,CAAC;EACL;EAEA,MAAMC,WAAW,GAAGP,MAAM,CAACQ,MAAM,CAACL,KAAK,IAAI;IACvC,OAAO,CAACJ,aAAa,CAACU,IAAI,CAACC,IAAI,IAAI;MAC/B,OAAOP,KAAK,CAACQ,UAAU,CAAE,GAAED,IAAK,GAAE,CAAC,IAAIP,KAAK,CAACQ,UAAU,CAAE,GAAED,IAAK,IAAG,CAAC;IACxE,CAAC,CAAC;EACN,CAAC,CAAC;EAEF,KAAK,MAAMP,KAAK,IAAIP,MAAM,EAAE;IACxB;IACA;IACA;IACA;IACA;IACA,MAAMgB,QAAQ,GAAG,IAAAC,kCAAgB,EAACV,KAAK,CAAC;IACxC,MAAMW,iBAAoD,GACtDhB,gBAAgB,CAACc,QAAQ,CAAC,GAAGf,IAAI,CAAC,EAAEiB,iBAAiB;IACzD,IAAI,OAAOA,iBAAiB,KAAK,UAAU,EAAE;MACzC;IACJ;IACAP,WAAW,CAACD,IAAI,CAACQ,iBAAiB,CAAC;MAAEnB,KAAK;MAAEQ,KAAK;MAAEY,OAAO,EAAEjB;IAAiB,CAAC,CAAC,CAAC;EACpF;EAEA,OAAOS,WAAW,CAACC,MAAM,CAACQ,OAAO,CAAC,CAACC,IAAI,CAAC,IAAI,CAAC;AACjD,CAAC;AAACC,OAAA,CAAAzB,sBAAA,GAAAA,sBAAA"}
1
+ {"version":3,"names":["_getBaseFieldType","require","_constants","renderListFilterFields","params","model","fields","type","fieldTypePlugins","excludeFields","result","ENTRY_META_FIELDS","map","field","isDateTimeEntryMetaField","flat","push","finalFields","filter","some","excl","startsWith","baseType","getBaseFieldType","createListFilters","plugins","Boolean","join","exports"],"sources":["renderListFilterFields.ts"],"sourcesContent":["import {\n ApiEndpoint,\n CmsFieldTypePlugins,\n CmsModel,\n CmsModelField,\n CmsModelFieldToGraphQLPlugin\n} from \"~/types\";\nimport { getBaseFieldType } from \"~/utils/getBaseFieldType\";\nimport { ENTRY_META_FIELDS, isDateTimeEntryMetaField } from \"~/constants\";\n\ninterface RenderListFilterFieldsParams {\n model: CmsModel;\n fields: CmsModelField[];\n type: ApiEndpoint;\n fieldTypePlugins: CmsFieldTypePlugins;\n excludeFields?: string[];\n}\n\ninterface RenderListFilterFields {\n (params: RenderListFilterFieldsParams): string;\n}\n\ntype CreateListFiltersType =\n | CmsModelFieldToGraphQLPlugin[\"read\"][\"createListFilters\"]\n | CmsModelFieldToGraphQLPlugin[\"manage\"][\"createListFilters\"];\n\nexport const renderListFilterFields: RenderListFilterFields = (params): string => {\n const { model, fields, type, fieldTypePlugins, excludeFields = [] } = params;\n const result: string[] = [\n \"id: ID\",\n \"id_not: ID\",\n \"id_in: [ID!]\",\n \"id_not_in: [ID!]\",\n \"entryId: String\",\n \"entryId_not: String\",\n \"entryId_in: [String!]\",\n \"entryId_not_in: [String!]\",\n\n ...ENTRY_META_FIELDS.map(field => {\n if (isDateTimeEntryMetaField(field)) {\n return [\n `${field}: DateTime`,\n `${field}_gt: DateTime`,\n `${field}_gte: DateTime`,\n `${field}_lt: DateTime`,\n `${field}_lte: DateTime`,\n `${field}_between: [DateTime!]`,\n `${field}_not_between: [DateTime!]`\n ];\n }\n\n return [\n `${field}: ID`,\n `${field}_not: ID`,\n `${field}_in: [ID!]`,\n `${field}_not_in: [ID!]`\n ];\n }).flat()\n ];\n\n /**\n * We can find different statuses only in the manage API endpoint.\n */\n if (type === \"manage\") {\n result.push(\n \"status: String\",\n \"status_not: String\",\n \"status_in: [String!]\",\n \"status_not_in: [String!]\"\n );\n }\n\n const finalFields = result.filter(field => {\n return !excludeFields.some(excl => {\n return field.startsWith(`${excl}_`) || field.startsWith(`${excl}: `);\n });\n });\n\n for (const field of fields) {\n // Every time a client updates content model's fields, we check the type of each field. If a field plugin\n // for a particular \"field.type\" doesn't exist on the backend yet, we throw an error. But still, we also\n // want to be careful when accessing the field plugin here too. It is still possible to have a content model\n // that contains a field, for which we don't have a plugin registered on the backend. For example, user\n // could've just removed the plugin from the backend.\n const baseType = getBaseFieldType(field);\n const createListFilters: CreateListFiltersType | undefined =\n fieldTypePlugins[baseType]?.[type]?.createListFilters;\n if (typeof createListFilters !== \"function\") {\n continue;\n }\n finalFields.push(createListFilters({ model, field, plugins: fieldTypePlugins }));\n }\n\n return finalFields.filter(Boolean).join(\"\\n\");\n};\n"],"mappings":";;;;;;AAOA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AAkBO,MAAME,sBAA8C,GAAIC,MAAM,IAAa;EAC9E,MAAM;IAAEC,KAAK;IAAEC,MAAM;IAAEC,IAAI;IAAEC,gBAAgB;IAAEC,aAAa,GAAG;EAAG,CAAC,GAAGL,MAAM;EAC5E,MAAMM,MAAgB,GAAG,CACrB,QAAQ,EACR,YAAY,EACZ,cAAc,EACd,kBAAkB,EAClB,iBAAiB,EACjB,qBAAqB,EACrB,uBAAuB,EACvB,2BAA2B,EAE3B,GAAGC,4BAAiB,CAACC,GAAG,CAACC,KAAK,IAAI;IAC9B,IAAI,IAAAC,mCAAwB,EAACD,KAAK,CAAC,EAAE;MACjC,OAAO,CACF,GAAEA,KAAM,YAAW,EACnB,GAAEA,KAAM,eAAc,EACtB,GAAEA,KAAM,gBAAe,EACvB,GAAEA,KAAM,eAAc,EACtB,GAAEA,KAAM,gBAAe,EACvB,GAAEA,KAAM,uBAAsB,EAC9B,GAAEA,KAAM,2BAA0B,CACtC;IACL;IAEA,OAAO,CACF,GAAEA,KAAM,MAAK,EACb,GAAEA,KAAM,UAAS,EACjB,GAAEA,KAAM,YAAW,EACnB,GAAEA,KAAM,gBAAe,CAC3B;EACL,CAAC,CAAC,CAACE,IAAI,CAAC,CAAC,CACZ;;EAED;AACJ;AACA;EACI,IAAIR,IAAI,KAAK,QAAQ,EAAE;IACnBG,MAAM,CAACM,IAAI,CACP,gBAAgB,EAChB,oBAAoB,EACpB,sBAAsB,EACtB,0BACJ,CAAC;EACL;EAEA,MAAMC,WAAW,GAAGP,MAAM,CAACQ,MAAM,CAACL,KAAK,IAAI;IACvC,OAAO,CAACJ,aAAa,CAACU,IAAI,CAACC,IAAI,IAAI;MAC/B,OAAOP,KAAK,CAACQ,UAAU,CAAE,GAAED,IAAK,GAAE,CAAC,IAAIP,KAAK,CAACQ,UAAU,CAAE,GAAED,IAAK,IAAG,CAAC;IACxE,CAAC,CAAC;EACN,CAAC,CAAC;EAEF,KAAK,MAAMP,KAAK,IAAIP,MAAM,EAAE;IACxB;IACA;IACA;IACA;IACA;IACA,MAAMgB,QAAQ,GAAG,IAAAC,kCAAgB,EAACV,KAAK,CAAC;IACxC,MAAMW,iBAAoD,GACtDhB,gBAAgB,CAACc,QAAQ,CAAC,GAAGf,IAAI,CAAC,EAAEiB,iBAAiB;IACzD,IAAI,OAAOA,iBAAiB,KAAK,UAAU,EAAE;MACzC;IACJ;IACAP,WAAW,CAACD,IAAI,CAACQ,iBAAiB,CAAC;MAAEnB,KAAK;MAAEQ,KAAK;MAAEY,OAAO,EAAEjB;IAAiB,CAAC,CAAC,CAAC;EACpF;EAEA,OAAOS,WAAW,CAACC,MAAM,CAACQ,OAAO,CAAC,CAACC,IAAI,CAAC,IAAI,CAAC;AACjD,CAAC;AAACC,OAAA,CAAAzB,sBAAA,GAAAA,sBAAA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["_getBaseFieldType","require","_constants","renderSortEnum","model","fields","fieldTypePlugins","sorterPlugins","sorters","ENTRY_META_FIELDS","filter","isDateTimeEntryMetaField","map","field","flat","plugin","getBaseFieldType","createSorters","result","isSortable","push","fieldId","join","reduce","createSorter","exports"],"sources":["renderSortEnum.ts"],"sourcesContent":["import { CmsFieldTypePlugins, CmsModel, CmsModelField } from \"~/types\";\nimport { getBaseFieldType } from \"~/utils/getBaseFieldType\";\nimport { CmsGraphQLSchemaSorterPlugin } from \"~/plugins/CmsGraphQLSchemaSorterPlugin\";\nimport { ENTRY_META_FIELDS, isDateTimeEntryMetaField } from \"~/constants\";\n\ninterface RenderSortEnumParams {\n model: CmsModel;\n fields: CmsModelField[];\n fieldTypePlugins: CmsFieldTypePlugins;\n sorterPlugins?: CmsGraphQLSchemaSorterPlugin[];\n}\n\ninterface RenderSortEnum {\n (params: RenderSortEnumParams): string;\n}\n\nexport const renderSortEnum: RenderSortEnum = ({\n model,\n fields,\n fieldTypePlugins,\n sorterPlugins\n}): string => {\n let sorters: string[] = [\n `id_ASC`,\n `id_DESC`,\n\n ...ENTRY_META_FIELDS.filter(isDateTimeEntryMetaField)\n .map(field => [`${field}_ASC`, `${field}_DESC`])\n .flat()\n ];\n\n for (const field of fields) {\n const plugin = fieldTypePlugins[getBaseFieldType(field)];\n if (!plugin) {\n continue;\n } else if (plugin.createSorters) {\n const result = plugin.createSorters({\n model,\n field,\n sorters\n });\n if (result) {\n sorters = result;\n continue;\n }\n }\n if (!plugin.isSortable) {\n continue;\n }\n sorters.push(`${field.fieldId}_ASC`);\n sorters.push(`${field.fieldId}_DESC`);\n }\n if (!sorterPlugins) {\n return sorters.join(\"\\n\");\n }\n\n return sorterPlugins\n .reduce((result, plugin) => {\n return plugin.createSorter({\n model,\n sorters: result\n });\n }, sorters)\n .join(\"\\n\");\n};\n"],"mappings":";;;;;;AACA,IAAAA,iBAAA,GAAAC,OAAA;AAEA,IAAAC,UAAA,GAAAD,OAAA;AAaO,MAAME,cAA8B,GAAGA,CAAC;EAC3CC,KAAK;EACLC,MAAM;EACNC,gBAAgB;EAChBC;AACJ,CAAC,KAAa;EACV,IAAIC,OAAiB,GAAG,CACnB,QAAO,EACP,SAAQ,EAET,GAAGC,4BAAiB,CAACC,MAAM,CAACC,mCAAwB,CAAC,CAChDC,GAAG,CAACC,KAAK,IAAI,CAAE,GAAEA,KAAM,MAAK,EAAG,GAAEA,KAAM,OAAM,CAAC,CAAC,CAC/CC,IAAI,CAAC,CAAC,CACd;EAED,KAAK,MAAMD,KAAK,IAAIR,MAAM,EAAE;IACxB,MAAMU,MAAM,GAAGT,gBAAgB,CAAC,IAAAU,kCAAgB,EAACH,KAAK,CAAC,CAAC;IACxD,IAAI,CAACE,MAAM,EAAE;MACT;IACJ,CAAC,MAAM,IAAIA,MAAM,CAACE,aAAa,EAAE;MAC7B,MAAMC,MAAM,GAAGH,MAAM,CAACE,aAAa,CAAC;QAChCb,KAAK;QACLS,KAAK;QACLL;MACJ,CAAC,CAAC;MACF,IAAIU,MAAM,EAAE;QACRV,OAAO,GAAGU,MAAM;QAChB;MACJ;IACJ;IACA,IAAI,CAACH,MAAM,CAACI,UAAU,EAAE;MACpB;IACJ;IACAX,OAAO,CAACY,IAAI,CAAE,GAAEP,KAAK,CAACQ,OAAQ,MAAK,CAAC;IACpCb,OAAO,CAACY,IAAI,CAAE,GAAEP,KAAK,CAACQ,OAAQ,OAAM,CAAC;EACzC;EACA,IAAI,CAACd,aAAa,EAAE;IAChB,OAAOC,OAAO,CAACc,IAAI,CAAC,IAAI,CAAC;EAC7B;EAEA,OAAOf,aAAa,CACfgB,MAAM,CAAC,CAACL,MAAM,EAAEH,MAAM,KAAK;IACxB,OAAOA,MAAM,CAACS,YAAY,CAAC;MACvBpB,KAAK;MACLI,OAAO,EAAEU;IACb,CAAC,CAAC;EACN,CAAC,EAAEV,OAAO,CAAC,CACVc,IAAI,CAAC,IAAI,CAAC;AACnB,CAAC;AAACG,OAAA,CAAAtB,cAAA,GAAAA,cAAA"}
1
+ {"version":3,"names":["_getBaseFieldType","require","_constants","renderSortEnum","model","fields","fieldTypePlugins","sorterPlugins","sorters","ENTRY_META_FIELDS","filter","isDateTimeEntryMetaField","map","field","flat","plugin","getBaseFieldType","createSorters","result","isSortable","push","fieldId","join","reduce","createSorter","exports"],"sources":["renderSortEnum.ts"],"sourcesContent":["import { CmsFieldTypePlugins, CmsModel, CmsModelField } from \"~/types\";\nimport { getBaseFieldType } from \"~/utils/getBaseFieldType\";\nimport { CmsGraphQLSchemaSorterPlugin } from \"~/plugins/CmsGraphQLSchemaSorterPlugin\";\nimport { ENTRY_META_FIELDS, isDateTimeEntryMetaField } from \"~/constants\";\n\ninterface RenderSortEnumParams {\n model: CmsModel;\n fields: CmsModelField[];\n fieldTypePlugins: CmsFieldTypePlugins;\n sorterPlugins?: CmsGraphQLSchemaSorterPlugin[];\n}\n\ninterface RenderSortEnum {\n (params: RenderSortEnumParams): string;\n}\n\nexport const renderSortEnum: RenderSortEnum = ({\n model,\n fields,\n fieldTypePlugins,\n sorterPlugins\n}): string => {\n let sorters: string[] = [\n `id_ASC`,\n `id_DESC`,\n\n ...ENTRY_META_FIELDS.filter(isDateTimeEntryMetaField)\n .map(field => [`${field}_ASC`, `${field}_DESC`])\n .flat()\n ];\n\n for (const field of fields) {\n const plugin = fieldTypePlugins[getBaseFieldType(field)];\n if (!plugin) {\n continue;\n } else if (plugin.createSorters) {\n const result = plugin.createSorters({\n model,\n field,\n sorters\n });\n if (result) {\n sorters = result;\n continue;\n }\n }\n if (!plugin.isSortable) {\n continue;\n }\n sorters.push(`${field.fieldId}_ASC`);\n sorters.push(`${field.fieldId}_DESC`);\n }\n if (!sorterPlugins) {\n return sorters.join(\"\\n\");\n }\n\n return sorterPlugins\n .reduce((result, plugin) => {\n return plugin.createSorter({\n model,\n sorters: result\n });\n }, sorters)\n .join(\"\\n\");\n};\n"],"mappings":";;;;;;AACA,IAAAA,iBAAA,GAAAC,OAAA;AAEA,IAAAC,UAAA,GAAAD,OAAA;AAaO,MAAME,cAA8B,GAAGA,CAAC;EAC3CC,KAAK;EACLC,MAAM;EACNC,gBAAgB;EAChBC;AACJ,CAAC,KAAa;EACV,IAAIC,OAAiB,GAAG,CACnB,QAAO,EACP,SAAQ,EAET,GAAGC,4BAAiB,CAACC,MAAM,CAACC,mCAAwB,CAAC,CAChDC,GAAG,CAACC,KAAK,IAAI,CAAE,GAAEA,KAAM,MAAK,EAAG,GAAEA,KAAM,OAAM,CAAC,CAAC,CAC/CC,IAAI,CAAC,CAAC,CACd;EAED,KAAK,MAAMD,KAAK,IAAIR,MAAM,EAAE;IACxB,MAAMU,MAAM,GAAGT,gBAAgB,CAAC,IAAAU,kCAAgB,EAACH,KAAK,CAAC,CAAC;IACxD,IAAI,CAACE,MAAM,EAAE;MACT;IACJ,CAAC,MAAM,IAAIA,MAAM,CAACE,aAAa,EAAE;MAC7B,MAAMC,MAAM,GAAGH,MAAM,CAACE,aAAa,CAAC;QAChCb,KAAK;QACLS,KAAK;QACLL;MACJ,CAAC,CAAC;MACF,IAAIU,MAAM,EAAE;QACRV,OAAO,GAAGU,MAAM;QAChB;MACJ;IACJ;IACA,IAAI,CAACH,MAAM,CAACI,UAAU,EAAE;MACpB;IACJ;IACAX,OAAO,CAACY,IAAI,CAAE,GAAEP,KAAK,CAACQ,OAAQ,MAAK,CAAC;IACpCb,OAAO,CAACY,IAAI,CAAE,GAAEP,KAAK,CAACQ,OAAQ,OAAM,CAAC;EACzC;EACA,IAAI,CAACd,aAAa,EAAE;IAChB,OAAOC,OAAO,CAACc,IAAI,CAAC,IAAI,CAAC;EAC7B;EAEA,OAAOf,aAAa,CACfgB,MAAM,CAAC,CAACL,MAAM,EAAEH,MAAM,KAAK;IACxB,OAAOA,MAAM,CAACS,YAAY,CAAC;MACvBpB,KAAK;MACLI,OAAO,EAAEU;IACb,CAAC,CAAC;EACN,CAAC,EAAEV,OAAO,CAAC,CACVc,IAAI,CAAC,IAAI,CAAC;AACnB,CAAC;AAACG,OAAA,CAAAtB,cAAA,GAAAA,cAAA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["_slugify","_interopRequireDefault","require","toSlug","text","slugify","replacement","lower","remove","exports"],"sources":["toSlug.ts"],"sourcesContent":["import slugify from \"slugify\";\n\nexport const toSlug = (text: string): string => {\n return slugify(text, {\n replacement: \"-\",\n lower: true,\n remove: /[*#\\?<>_\\{\\}\\[\\]+~.()'\"!:;@]/g\n });\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,QAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEO,MAAMC,MAAM,GAAIC,IAAY,IAAa;EAC5C,OAAO,IAAAC,gBAAO,EAACD,IAAI,EAAE;IACjBE,WAAW,EAAE,GAAG;IAChBC,KAAK,EAAE,IAAI;IACXC,MAAM,EAAE;EACZ,CAAC,CAAC;AACN,CAAC;AAACC,OAAA,CAAAN,MAAA,GAAAA,MAAA"}
1
+ {"version":3,"names":["_slugify","_interopRequireDefault","require","toSlug","text","slugify","replacement","lower","remove","exports"],"sources":["toSlug.ts"],"sourcesContent":["import slugify from \"slugify\";\n\nexport const toSlug = (text: string): string => {\n return slugify(text, {\n replacement: \"-\",\n lower: true,\n remove: /[*#\\?<>_\\{\\}\\[\\]+~.()'\"!:;@]/g\n });\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,QAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEO,MAAMC,MAAM,GAAIC,IAAY,IAAa;EAC5C,OAAO,IAAAC,gBAAO,EAACD,IAAI,EAAE;IACjBE,WAAW,EAAE,GAAG;IAChBC,KAAK,EAAE,IAAI;IACXC,MAAM,EAAE;EACZ,CAAC,CAAC;AACN,CAAC;AAACC,OAAA,CAAAN,MAAA,GAAAA,MAAA","ignoreList":[]}