@webiny/api-headless-cms 5.40.0-beta.2 → 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
@@ -1 +1 @@
1
- {"version":3,"names":["_getBaseFieldType","require","_error","_interopRequireDefault","getContentModelDescriptionFieldId","fields","descriptionFieldId","length","descriptionField","find","field","getBaseFieldType","multipleValues","fieldId","target","WebinyError","storageId","type","exports"],"sources":["descriptionField.ts"],"sourcesContent":["import { CmsModelField } from \"~/types\";\nimport { getBaseFieldType } from \"~/utils/getBaseFieldType\";\nimport WebinyError from \"@webiny/error\";\n\nexport const getContentModelDescriptionFieldId = (\n fields: CmsModelField[],\n descriptionFieldId?: string | null\n): string | null | undefined => {\n /**\n * If there are no fields defined, we will just set as null.\n */\n if (fields.length === 0) {\n return null;\n }\n /**\n * If description field is not defined, let us find possible one.\n */\n if (!descriptionFieldId) {\n const descriptionField = fields.find(field => {\n return getBaseFieldType(field) === \"long-text\" && !field.multipleValues;\n });\n return descriptionField?.fieldId || null;\n }\n const target = fields.find(\n field => field.fieldId === descriptionFieldId && getBaseFieldType(field) === \"long-text\"\n );\n if (!target) {\n throw new WebinyError(\n `Field selected for the description field does not exist in the model.`,\n \"VALIDATION_ERROR\",\n {\n fieldId: descriptionFieldId,\n fields\n }\n );\n }\n if (target.multipleValues) {\n throw new WebinyError(\n `Fields that accept multiple values cannot be used as the entry description.`,\n \"ENTRY_TITLE_FIELD_TYPE\",\n {\n storageId: target.storageId,\n fieldId: target.fieldId,\n type: target.type\n }\n );\n }\n\n return target.fieldId;\n};\n"],"mappings":";;;;;;;AACA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAC,sBAAA,CAAAF,OAAA;AAEO,MAAMG,iCAAiC,GAAGA,CAC7CC,MAAuB,EACvBC,kBAAkC,KACN;EAC5B;AACJ;AACA;EACI,IAAID,MAAM,CAACE,MAAM,KAAK,CAAC,EAAE;IACrB,OAAO,IAAI;EACf;EACA;AACJ;AACA;EACI,IAAI,CAACD,kBAAkB,EAAE;IACrB,MAAME,gBAAgB,GAAGH,MAAM,CAACI,IAAI,CAACC,KAAK,IAAI;MAC1C,OAAO,IAAAC,kCAAgB,EAACD,KAAK,CAAC,KAAK,WAAW,IAAI,CAACA,KAAK,CAACE,cAAc;IAC3E,CAAC,CAAC;IACF,OAAOJ,gBAAgB,EAAEK,OAAO,IAAI,IAAI;EAC5C;EACA,MAAMC,MAAM,GAAGT,MAAM,CAACI,IAAI,CACtBC,KAAK,IAAIA,KAAK,CAACG,OAAO,KAAKP,kBAAkB,IAAI,IAAAK,kCAAgB,EAACD,KAAK,CAAC,KAAK,WACjF,CAAC;EACD,IAAI,CAACI,MAAM,EAAE;IACT,MAAM,IAAIC,cAAW,CAChB,uEAAsE,EACvE,kBAAkB,EAClB;MACIF,OAAO,EAAEP,kBAAkB;MAC3BD;IACJ,CACJ,CAAC;EACL;EACA,IAAIS,MAAM,CAACF,cAAc,EAAE;IACvB,MAAM,IAAIG,cAAW,CAChB,6EAA4E,EAC7E,wBAAwB,EACxB;MACIC,SAAS,EAAEF,MAAM,CAACE,SAAS;MAC3BH,OAAO,EAAEC,MAAM,CAACD,OAAO;MACvBI,IAAI,EAAEH,MAAM,CAACG;IACjB,CACJ,CAAC;EACL;EAEA,OAAOH,MAAM,CAACD,OAAO;AACzB,CAAC;AAACK,OAAA,CAAAd,iCAAA,GAAAA,iCAAA"}
1
+ {"version":3,"names":["_getBaseFieldType","require","_error","_interopRequireDefault","getContentModelDescriptionFieldId","fields","descriptionFieldId","length","descriptionField","find","field","getBaseFieldType","multipleValues","fieldId","target","WebinyError","storageId","type","exports"],"sources":["descriptionField.ts"],"sourcesContent":["import { CmsModelField } from \"~/types\";\nimport { getBaseFieldType } from \"~/utils/getBaseFieldType\";\nimport WebinyError from \"@webiny/error\";\n\nexport const getContentModelDescriptionFieldId = (\n fields: CmsModelField[],\n descriptionFieldId?: string | null\n): string | null | undefined => {\n /**\n * If there are no fields defined, we will just set as null.\n */\n if (fields.length === 0) {\n return null;\n }\n /**\n * If description field is not defined, let us find possible one.\n */\n if (!descriptionFieldId) {\n const descriptionField = fields.find(field => {\n return getBaseFieldType(field) === \"long-text\" && !field.multipleValues;\n });\n return descriptionField?.fieldId || null;\n }\n const target = fields.find(\n field => field.fieldId === descriptionFieldId && getBaseFieldType(field) === \"long-text\"\n );\n if (!target) {\n throw new WebinyError(\n `Field selected for the description field does not exist in the model.`,\n \"VALIDATION_ERROR\",\n {\n fieldId: descriptionFieldId,\n fields\n }\n );\n }\n if (target.multipleValues) {\n throw new WebinyError(\n `Fields that accept multiple values cannot be used as the entry description.`,\n \"ENTRY_TITLE_FIELD_TYPE\",\n {\n storageId: target.storageId,\n fieldId: target.fieldId,\n type: target.type\n }\n );\n }\n\n return target.fieldId;\n};\n"],"mappings":";;;;;;;AACA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAC,sBAAA,CAAAF,OAAA;AAEO,MAAMG,iCAAiC,GAAGA,CAC7CC,MAAuB,EACvBC,kBAAkC,KACN;EAC5B;AACJ;AACA;EACI,IAAID,MAAM,CAACE,MAAM,KAAK,CAAC,EAAE;IACrB,OAAO,IAAI;EACf;EACA;AACJ;AACA;EACI,IAAI,CAACD,kBAAkB,EAAE;IACrB,MAAME,gBAAgB,GAAGH,MAAM,CAACI,IAAI,CAACC,KAAK,IAAI;MAC1C,OAAO,IAAAC,kCAAgB,EAACD,KAAK,CAAC,KAAK,WAAW,IAAI,CAACA,KAAK,CAACE,cAAc;IAC3E,CAAC,CAAC;IACF,OAAOJ,gBAAgB,EAAEK,OAAO,IAAI,IAAI;EAC5C;EACA,MAAMC,MAAM,GAAGT,MAAM,CAACI,IAAI,CACtBC,KAAK,IAAIA,KAAK,CAACG,OAAO,KAAKP,kBAAkB,IAAI,IAAAK,kCAAgB,EAACD,KAAK,CAAC,KAAK,WACjF,CAAC;EACD,IAAI,CAACI,MAAM,EAAE;IACT,MAAM,IAAIC,cAAW,CAChB,uEAAsE,EACvE,kBAAkB,EAClB;MACIF,OAAO,EAAEP,kBAAkB;MAC3BD;IACJ,CACJ,CAAC;EACL;EACA,IAAIS,MAAM,CAACF,cAAc,EAAE;IACvB,MAAM,IAAIG,cAAW,CAChB,6EAA4E,EAC7E,wBAAwB,EACxB;MACIC,SAAS,EAAEF,MAAM,CAACE,SAAS;MAC3BH,OAAO,EAAEC,MAAM,CAACD,OAAO;MACvBI,IAAI,EAAEH,MAAM,CAACG;IACjB,CACJ,CAAC;EACL;EAEA,OAAOH,MAAM,CAACD,OAAO;AACzB,CAAC;AAACK,OAAA,CAAAd,iCAAA,GAAAA,iCAAA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["_getBaseFieldType","require","_error","_interopRequireDefault","getContentModelImageFieldId","fields","imageFieldId","length","imageField","find","field","getBaseFieldType","multipleValues","settings","imagesOnly","fieldId","target","WebinyError","storageId","type","exports"],"sources":["imageField.ts"],"sourcesContent":["import { CmsModelField } from \"~/types\";\nimport { getBaseFieldType } from \"~/utils/getBaseFieldType\";\nimport WebinyError from \"@webiny/error\";\n\nexport const getContentModelImageFieldId = (\n fields: CmsModelField[],\n imageFieldId?: string | null\n): string | null | undefined => {\n /**\n * If there are no fields defined, we will just set as null.\n */\n if (fields.length === 0) {\n return null;\n }\n /**\n * If image field is not defined, let us find possible one.\n */\n if (!imageFieldId) {\n const imageField = fields.find(field => {\n return (\n getBaseFieldType(field) === \"file\" &&\n !field.multipleValues &&\n field.settings?.imagesOnly\n );\n });\n return imageField?.fieldId || null;\n }\n const target = fields.find(\n field =>\n field.fieldId === imageFieldId &&\n getBaseFieldType(field) === \"file\" &&\n field.settings?.imagesOnly\n );\n if (!target) {\n throw new WebinyError(\n `Field selected for the image field does not exist in the model.`,\n \"VALIDATION_ERROR\",\n {\n fieldId: imageFieldId,\n fields\n }\n );\n }\n if (target.multipleValues) {\n throw new WebinyError(\n `Fields that accept multiple values cannot be used as the entry image.`,\n \"ENTRY_TITLE_FIELD_TYPE\",\n {\n storageId: target.storageId,\n fieldId: target.fieldId,\n type: target.type\n }\n );\n }\n\n return target.fieldId;\n};\n"],"mappings":";;;;;;;AACA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAC,sBAAA,CAAAF,OAAA;AAEO,MAAMG,2BAA2B,GAAGA,CACvCC,MAAuB,EACvBC,YAA4B,KACA;EAC5B;AACJ;AACA;EACI,IAAID,MAAM,CAACE,MAAM,KAAK,CAAC,EAAE;IACrB,OAAO,IAAI;EACf;EACA;AACJ;AACA;EACI,IAAI,CAACD,YAAY,EAAE;IACf,MAAME,UAAU,GAAGH,MAAM,CAACI,IAAI,CAACC,KAAK,IAAI;MACpC,OACI,IAAAC,kCAAgB,EAACD,KAAK,CAAC,KAAK,MAAM,IAClC,CAACA,KAAK,CAACE,cAAc,IACrBF,KAAK,CAACG,QAAQ,EAAEC,UAAU;IAElC,CAAC,CAAC;IACF,OAAON,UAAU,EAAEO,OAAO,IAAI,IAAI;EACtC;EACA,MAAMC,MAAM,GAAGX,MAAM,CAACI,IAAI,CACtBC,KAAK,IACDA,KAAK,CAACK,OAAO,KAAKT,YAAY,IAC9B,IAAAK,kCAAgB,EAACD,KAAK,CAAC,KAAK,MAAM,IAClCA,KAAK,CAACG,QAAQ,EAAEC,UACxB,CAAC;EACD,IAAI,CAACE,MAAM,EAAE;IACT,MAAM,IAAIC,cAAW,CAChB,iEAAgE,EACjE,kBAAkB,EAClB;MACIF,OAAO,EAAET,YAAY;MACrBD;IACJ,CACJ,CAAC;EACL;EACA,IAAIW,MAAM,CAACJ,cAAc,EAAE;IACvB,MAAM,IAAIK,cAAW,CAChB,uEAAsE,EACvE,wBAAwB,EACxB;MACIC,SAAS,EAAEF,MAAM,CAACE,SAAS;MAC3BH,OAAO,EAAEC,MAAM,CAACD,OAAO;MACvBI,IAAI,EAAEH,MAAM,CAACG;IACjB,CACJ,CAAC;EACL;EAEA,OAAOH,MAAM,CAACD,OAAO;AACzB,CAAC;AAACK,OAAA,CAAAhB,2BAAA,GAAAA,2BAAA"}
1
+ {"version":3,"names":["_getBaseFieldType","require","_error","_interopRequireDefault","getContentModelImageFieldId","fields","imageFieldId","length","imageField","find","field","getBaseFieldType","multipleValues","settings","imagesOnly","fieldId","target","WebinyError","storageId","type","exports"],"sources":["imageField.ts"],"sourcesContent":["import { CmsModelField } from \"~/types\";\nimport { getBaseFieldType } from \"~/utils/getBaseFieldType\";\nimport WebinyError from \"@webiny/error\";\n\nexport const getContentModelImageFieldId = (\n fields: CmsModelField[],\n imageFieldId?: string | null\n): string | null | undefined => {\n /**\n * If there are no fields defined, we will just set as null.\n */\n if (fields.length === 0) {\n return null;\n }\n /**\n * If image field is not defined, let us find possible one.\n */\n if (!imageFieldId) {\n const imageField = fields.find(field => {\n return (\n getBaseFieldType(field) === \"file\" &&\n !field.multipleValues &&\n field.settings?.imagesOnly\n );\n });\n return imageField?.fieldId || null;\n }\n const target = fields.find(\n field =>\n field.fieldId === imageFieldId &&\n getBaseFieldType(field) === \"file\" &&\n field.settings?.imagesOnly\n );\n if (!target) {\n throw new WebinyError(\n `Field selected for the image field does not exist in the model.`,\n \"VALIDATION_ERROR\",\n {\n fieldId: imageFieldId,\n fields\n }\n );\n }\n if (target.multipleValues) {\n throw new WebinyError(\n `Fields that accept multiple values cannot be used as the entry image.`,\n \"ENTRY_TITLE_FIELD_TYPE\",\n {\n storageId: target.storageId,\n fieldId: target.fieldId,\n type: target.type\n }\n );\n }\n\n return target.fieldId;\n};\n"],"mappings":";;;;;;;AACA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAC,sBAAA,CAAAF,OAAA;AAEO,MAAMG,2BAA2B,GAAGA,CACvCC,MAAuB,EACvBC,YAA4B,KACA;EAC5B;AACJ;AACA;EACI,IAAID,MAAM,CAACE,MAAM,KAAK,CAAC,EAAE;IACrB,OAAO,IAAI;EACf;EACA;AACJ;AACA;EACI,IAAI,CAACD,YAAY,EAAE;IACf,MAAME,UAAU,GAAGH,MAAM,CAACI,IAAI,CAACC,KAAK,IAAI;MACpC,OACI,IAAAC,kCAAgB,EAACD,KAAK,CAAC,KAAK,MAAM,IAClC,CAACA,KAAK,CAACE,cAAc,IACrBF,KAAK,CAACG,QAAQ,EAAEC,UAAU;IAElC,CAAC,CAAC;IACF,OAAON,UAAU,EAAEO,OAAO,IAAI,IAAI;EACtC;EACA,MAAMC,MAAM,GAAGX,MAAM,CAACI,IAAI,CACtBC,KAAK,IACDA,KAAK,CAACK,OAAO,KAAKT,YAAY,IAC9B,IAAAK,kCAAgB,EAACD,KAAK,CAAC,KAAK,MAAM,IAClCA,KAAK,CAACG,QAAQ,EAAEC,UACxB,CAAC;EACD,IAAI,CAACE,MAAM,EAAE;IACT,MAAM,IAAIC,cAAW,CAChB,iEAAgE,EACjE,kBAAkB,EAClB;MACIF,OAAO,EAAET,YAAY;MACrBD;IACJ,CACJ,CAAC;EACL;EACA,IAAIW,MAAM,CAACJ,cAAc,EAAE;IACvB,MAAM,IAAIK,cAAW,CAChB,uEAAsE,EACvE,wBAAwB,EACxB;MACIC,SAAS,EAAEF,MAAM,CAACE,SAAS;MAC3BH,OAAO,EAAEC,MAAM,CAACD,OAAO;MACvBI,IAAI,EAAEH,MAAM,CAACG;IACjB,CACJ,CAAC;EACL;EAEA,OAAOH,MAAM,CAACD,OAAO;AACzB,CAAC;AAACK,OAAA,CAAAhB,2BAAA,GAAAA,2BAAA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["_getBaseFieldType","require","_error","_interopRequireDefault","defaultTitleFieldId","allowedTitleFieldTypes","getContentModelTitleFieldId","fields","titleFieldId","length","titleField","find","field","getBaseFieldType","multipleValues","fieldId","target","f","WebinyError","includes","type","join","storageId","exports"],"sources":["titleField.ts"],"sourcesContent":["import { CmsModelField } from \"~/types\";\nimport { getBaseFieldType } from \"~/utils/getBaseFieldType\";\nimport WebinyError from \"@webiny/error\";\n\nconst defaultTitleFieldId = \"id\";\n\nconst allowedTitleFieldTypes = [\"text\", \"number\"];\n\nexport const getContentModelTitleFieldId = (\n fields: CmsModelField[],\n titleFieldId?: string\n): string => {\n /**\n * If there are no fields defined, we will return the default field\n */\n if (fields.length === 0) {\n return defaultTitleFieldId;\n }\n /**\n * if there is no title field defined either in input data or existing content model data\n * we will take first text field that has no multiple values enabled\n * or if initial titleFieldId is the default one also try to find first available text field\n */\n if (!titleFieldId || titleFieldId === defaultTitleFieldId) {\n const titleField = fields.find(field => {\n return getBaseFieldType(field) === \"text\" && !field.multipleValues;\n });\n return titleField?.fieldId || defaultTitleFieldId;\n }\n /**\n * check existing titleFieldId for existence in the model\n * for correct type\n * and that it is not multiple values field\n */\n const target = fields.find(f => f.fieldId === titleFieldId);\n if (!target) {\n throw new WebinyError(\n `Field selected for the title field does not exist in the model.`,\n \"VALIDATION_ERROR\",\n {\n fieldId: titleFieldId,\n fields\n }\n );\n }\n\n if (allowedTitleFieldTypes.includes(target.type) === false) {\n throw new WebinyError(\n `Only ${allowedTitleFieldTypes.join(\n \", \"\n )} and id fields can be used as an entry title.`,\n \"ENTRY_TITLE_FIELD_TYPE\",\n {\n storageId: target.storageId,\n fieldId: target.fieldId,\n type: target.type\n }\n );\n }\n\n if (target.multipleValues) {\n throw new WebinyError(\n `Fields that accept multiple values cannot be used as the entry title.`,\n \"ENTRY_TITLE_FIELD_TYPE\",\n {\n storageId: target.storageId,\n fie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CAACD,OAAO;MACvBK,IAAI,EAAEJ,MAAM,CAACI;IACjB,CACJ,CAAC;EACL;EAEA,IAAIJ,MAAM,CAACF,cAAc,EAAE;IACvB,MAAM,IAAII,cAAW,CAChB,uEAAsE,EACvE,wBAAwB,EACxB;MACII,SAAS,EAAEN,MAAM,CAACM,SAAS;MAC3BP,OAAO,EAAEC,MAAM,CAACD,OAAO;MACvBK,IAAI,EAAEJ,MAAM,CAACI;IACjB,CACJ,CAAC;EACL;EAEA,OAAOJ,MAAM,CAACD,OAAO;AACzB,CAAC;AAACQ,OAAA,CAAAjB,2BAAA,GAAAA,2BAAA"}
1
+ {"version":3,"names":["_getBaseFieldType","require","_error","_interopRequireDefault","defaultTitleFieldId","allowedTitleFieldTypes","getContentModelTitleFieldId","fields","titleFieldId","length","titleField","find","field","getBaseFieldType","multipleValues","fieldId","target","f","WebinyError","includes","type","join","storageId","exports"],"sources":["titleField.ts"],"sourcesContent":["import { CmsModelField } from \"~/types\";\nimport { getBaseFieldType } from \"~/utils/getBaseFieldType\";\nimport WebinyError from \"@webiny/error\";\n\nconst defaultTitleFieldId = \"id\";\n\nconst allowedTitleFieldTypes = [\"text\", \"number\"];\n\nexport const getContentModelTitleFieldId = (\n fields: CmsModelField[],\n titleFieldId?: string\n): string => {\n /**\n * If there are no fields defined, we will return the default field\n */\n if (fields.length === 0) {\n return defaultTitleFieldId;\n }\n /**\n * if there is no title field defined either in input data or existing content model data\n * we will take first text field that has no multiple values enabled\n * or if initial titleFieldId is the default one also try to find first available text field\n */\n if (!titleFieldId || titleFieldId === defaultTitleFieldId) {\n const titleField = fields.find(field => {\n return getBaseFieldType(field) === \"text\" && !field.multipleValues;\n });\n return titleField?.fieldId || defaultTitleFieldId;\n }\n /**\n * check existing titleFieldId for existence in the model\n * for correct type\n * and that it is not multiple values field\n */\n const target = fields.find(f => f.fieldId === titleFieldId);\n if (!target) {\n throw new WebinyError(\n `Field selected for the title field does not exist in the model.`,\n \"VALIDATION_ERROR\",\n {\n fieldId: titleFieldId,\n fields\n }\n );\n }\n\n if (allowedTitleFieldTypes.includes(target.type) === false) {\n throw new WebinyError(\n `Only ${allowedTitleFieldTypes.join(\n \", \"\n )} and id fields can be used as an entry title.`,\n \"ENTRY_TITLE_FIELD_TYPE\",\n {\n storageId: target.storageId,\n fieldId: target.fieldId,\n type: target.type\n }\n );\n }\n\n if (target.multipleValues) {\n throw new WebinyError(\n `Fields that accept multiple values cannot be used as the entry title.`,\n \"ENTRY_TITLE_FIELD_TYPE\",\n {\n storageId: target.storageId,\n fieldId: target.fieldId,\n type: target.type\n }\n );\n }\n\n return target.fieldId;\n};\n"],"mappings":";;;;;;;AACA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAC,sBAAA,CAAAF,OAAA;AAEA,MAAMG,mBAAmB,GAAG,IAAI;AAEhC,MAAMC,sBAAsB,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC;AAE1C,MAAMC,2BAA2B,GAAGA,CACvCC,MAAuB,EACvBC,YAAqB,KACZ;EACT;AACJ;AACA;EACI,IAAID,MAAM,CAACE,MAAM,KAAK,CAAC,EAAE;IACrB,OAAOL,mBAAmB;EAC9B;EACA;AACJ;AACA;AACA;AACA;EACI,IAAI,CAACI,YAAY,IAAIA,YAAY,KAAKJ,mBAAmB,EAAE;IACvD,MAAMM,UAAU,GAAGH,MAAM,CAACI,IAAI,CAACC,KAAK,IAAI;MACpC,OAAO,IAAAC,kCAAgB,EAACD,KAAK,CAAC,KAAK,MAAM,IAAI,CAACA,KAAK,CAACE,cAAc;IACtE,CAAC,CAAC;IACF,OAAOJ,UAAU,EAAEK,OAAO,IAAIX,mBAAmB;EACrD;EACA;AACJ;AACA;AACA;AACA;EACI,MAAMY,MAAM,GAAGT,MAAM,CAACI,IAAI,CAACM,CAAC,IAAIA,CAAC,CAACF,OAAO,KAAKP,YAAY,CAAC;EAC3D,IAAI,CAACQ,MAAM,EAAE;IACT,MAAM,IAAIE,cAAW,CAChB,iEAAgE,EACjE,kBAAkB,EAClB;MACIH,OAAO,EAAEP,YAAY;MACrBD;IACJ,CACJ,CAAC;EACL;EAEA,IAAIF,sBAAsB,CAACc,QAAQ,CAACH,MAAM,CAACI,IAAI,CAAC,KAAK,KAAK,EAAE;IACxD,MAAM,IAAIF,cAAW,CAChB,QAAOb,sBAAsB,CAACgB,IAAI,CAC/B,IACJ,CAAE,+CAA8C,EAChD,wBAAwB,EACxB;MACIC,SAAS,EAAEN,MAAM,CAACM,SAAS;MAC3BP,OAAO,EAAEC,MAAM,CAACD,OAAO;MACvBK,IAAI,EAAEJ,MAAM,CAACI;IACjB,CACJ,CAAC;EACL;EAEA,IAAIJ,MAAM,CAACF,cAAc,EAAE;IACvB,MAAM,IAAII,cAAW,CAChB,uEAAsE,EACvE,wBAAwB,EACxB;MACII,SAAS,EAAEN,MAAM,CAACM,SAAS;MAC3BP,OAAO,EAAEC,MAAM,CAACD,OAAO;MACvBK,IAAI,EAAEJ,MAAM,CAACI;IACjB,CACJ,CAAC;EACL;EAEA,OAAOJ,MAAM,CAACD,OAAO;AACzB,CAAC;AAACQ,OAAA,CAAAjB,2BAAA,GAAAA,2BAAA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["_modelApiName","require","_ensureTypeTag","listModelsFromDatabase","params","storageOperations","getTenant","getLocale","models","list","where","tenant","id","locale","code","map","model","tags","ensureTypeTag","singularApiName","ensureSingularApiName","pluralApiName","ensurePluralApiName","exports"],"sources":["listModelsFromDatabase.ts"],"sourcesContent":["import { CmsModel, HeadlessCmsStorageOperations } from \"~/types\";\nimport {\n ensurePluralApiName,\n ensureSingularApiName\n} from \"~/crud/contentModel/compatibility/modelApiName\";\nimport { Tenant } from \"@webiny/api-tenancy/types\";\nimport { I18NLocale } from \"@webiny/api-i18n/types\";\nimport { ensureTypeTag } from \"./ensureTypeTag\";\n\ninterface Params {\n storageOperations: HeadlessCmsStorageOperations;\n getTenant: () => Tenant;\n getLocale: () => I18NLocale;\n}\n\nexport const listModelsFromDatabase = async (params: Params): Promise<CmsModel[]> => {\n const { storageOperations, getTenant, getLocale } = params;\n const models = await storageOperations.models.list({\n where: {\n tenant: getTenant().id,\n locale: getLocale().code\n }\n });\n return models.map(model => {\n return {\n ...model,\n tags: ensureTypeTag(model),\n tenant: model.tenant || getTenant().id,\n locale: model.locale || getLocale().code,\n /**\n * TODO: remove in v5.36.0\n * This is for backward compatibility while migrations are not yet executed.\n */\n singularApiName: ensureSingularApiName(model),\n pluralApiName: ensurePluralApiName(model)\n };\n });\n};\n"],"mappings":";;;;;;AACA,IAAAA,aAAA,GAAAC,OAAA;AAMA,IAAAC,cAAA,GAAAD,OAAA;AAQO,MAAME,sBAAsB,GAAG,MAAOC,MAAc,IAA0B;EACjF,MAAM;IAAEC,iBAAiB;IAAEC,SAAS;IAAEC;EAAU,CAAC,GAAGH,MAAM;EAC1D,MAAMI,MAAM,GAAG,MAAMH,iBAAiB,CAACG,MAAM,CAACC,IAAI,CAAC;IAC/CC,KAAK,EAAE;MACHC,MAAM,EAAEL,SAAS,CAAC,CAAC,CAACM,EAAE;MACtBC,MAAM,EAAEN,SAAS,CAAC,CAAC,CAACO;IACxB;EACJ,CAAC,CAAC;EACF,OAAON,MAAM,CAACO,GAAG,CAACC,KAAK,IAAI;IACvB,OAAO;MACH,GAAGA,KAAK;MACRC,IAAI,EAAE,IAAAC,4BAAa,EAACF,KAAK,CAAC;MAC1BL,MAAM,EAAEK,KAAK,CAACL,MAAM,IAAIL,SAAS,CAAC,CAAC,CAACM,EAAE;MACtCC,MAAM,EAAEG,KAAK,CAACH,MAAM,IAAIN,SAAS,CAAC,CAAC,CAACO,IAAI;MACxC;AACZ;AACA;AACA;MACYK,eAAe,EAAE,IAAAC,mCAAqB,EAACJ,KAAK,CAAC;MAC7CK,aAAa,EAAE,IAAAC,iCAAmB,EAACN,KAAK;IAC5C,CAAC;EACL,CAAC,CAAC;AACN,CAAC;AAACO,OAAA,CAAApB,sBAAA,GAAAA,sBAAA"}
1
+ {"version":3,"names":["_modelApiName","require","_ensureTypeTag","listModelsFromDatabase","params","storageOperations","getTenant","getLocale","models","list","where","tenant","id","locale","code","map","model","tags","ensureTypeTag","singularApiName","ensureSingularApiName","pluralApiName","ensurePluralApiName","exports"],"sources":["listModelsFromDatabase.ts"],"sourcesContent":["import { CmsModel, HeadlessCmsStorageOperations } from \"~/types\";\nimport {\n ensurePluralApiName,\n ensureSingularApiName\n} from \"~/crud/contentModel/compatibility/modelApiName\";\nimport { Tenant } from \"@webiny/api-tenancy/types\";\nimport { I18NLocale } from \"@webiny/api-i18n/types\";\nimport { ensureTypeTag } from \"./ensureTypeTag\";\n\ninterface Params {\n storageOperations: HeadlessCmsStorageOperations;\n getTenant: () => Tenant;\n getLocale: () => I18NLocale;\n}\n\nexport const listModelsFromDatabase = async (params: Params): Promise<CmsModel[]> => {\n const { storageOperations, getTenant, getLocale } = params;\n const models = await storageOperations.models.list({\n where: {\n tenant: getTenant().id,\n locale: getLocale().code\n }\n });\n return models.map(model => {\n return {\n ...model,\n tags: ensureTypeTag(model),\n tenant: model.tenant || getTenant().id,\n locale: model.locale || getLocale().code,\n /**\n * TODO: remove in v5.36.0\n * This is for backward compatibility while migrations are not yet executed.\n */\n singularApiName: ensureSingularApiName(model),\n pluralApiName: ensurePluralApiName(model)\n };\n });\n};\n"],"mappings":";;;;;;AACA,IAAAA,aAAA,GAAAC,OAAA;AAMA,IAAAC,cAAA,GAAAD,OAAA;AAQO,MAAME,sBAAsB,GAAG,MAAOC,MAAc,IAA0B;EACjF,MAAM;IAAEC,iBAAiB;IAAEC,SAAS;IAAEC;EAAU,CAAC,GAAGH,MAAM;EAC1D,MAAMI,MAAM,GAAG,MAAMH,iBAAiB,CAACG,MAAM,CAACC,IAAI,CAAC;IAC/CC,KAAK,EAAE;MACHC,MAAM,EAAEL,SAAS,CAAC,CAAC,CAACM,EAAE;MACtBC,MAAM,EAAEN,SAAS,CAAC,CAAC,CAACO;IACxB;EACJ,CAAC,CAAC;EACF,OAAON,MAAM,CAACO,GAAG,CAACC,KAAK,IAAI;IACvB,OAAO;MACH,GAAGA,KAAK;MACRC,IAAI,EAAE,IAAAC,4BAAa,EAACF,KAAK,CAAC;MAC1BL,MAAM,EAAEK,KAAK,CAACL,MAAM,IAAIL,SAAS,CAAC,CAAC,CAACM,EAAE;MACtCC,MAAM,EAAEG,KAAK,CAACH,MAAM,IAAIN,SAAS,CAAC,CAAC,CAACO,IAAI;MACxC;AACZ;AACA;AACA;MACYK,eAAe,EAAE,IAAAC,mCAAqB,EAACJ,KAAK,CAAC;MAC7CK,aAAa,EAAE,IAAAC,iCAAmB,EAACN,KAAK;IAC5C,CAAC;EACL,CAAC,CAAC;AACN,CAAC;AAACO,OAAA,CAAApB,sBAAA,GAAAA,sBAAA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["_error","_interopRequireDefault","require","_isModelEndingAllowed","validateEndingAllowed","params","model","isModelEndingAllowed","singularApiName","WebinyError","input","disallowedEnding","pluralApiName","exports"],"sources":["endingAllowed.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { disallowedEnding, isModelEndingAllowed } from \"./isModelEndingAllowed\";\nimport { CmsModel } from \"~/types\";\n\ninterface Params {\n model: Pick<CmsModel, \"singularApiName\" | \"pluralApiName\">;\n}\n\nexport const validateEndingAllowed = (params: Params): void => {\n const { model } = params;\n if (isModelEndingAllowed(model.singularApiName) === false) {\n throw new WebinyError(\n `Content model with singularApiName \"${model.singularApiName}\" is not allowed, as it ends in disallowed value.`,\n \"MODEL_SINGULAR_API_NAME_ENDING_NOT_ALLOWED\",\n {\n input: model.singularApiName,\n disallowedEnding\n }\n );\n } else if (isModelEndingAllowed(model.pluralApiName) === false) {\n throw new WebinyError(\n `Content model with pluralApiName \"${model.pluralApiName}\" is not allowed, as it ends in disallowed value.`,\n \"MODEL_PLURAL_API_NAME_NOT_ENDING_ALLOWED\",\n {\n input: model.pluralApiName,\n disallowedEnding: disallowedEnding\n }\n );\n }\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,qBAAA,GAAAD,OAAA;AAOO,MAAME,qBAAqB,GAAIC,MAAc,IAAW;EAC3D,MAAM;IAAEC;EAAM,CAAC,GAAGD,MAAM;EACxB,IAAI,IAAAE,0CAAoB,EAACD,KAAK,CAACE,eAAe,CAAC,KAAK,KAAK,EAAE;IACvD,MAAM,IAAIC,cAAW,CAChB,uCAAsCH,KAAK,CAACE,eAAgB,mDAAkD,EAC/G,4CAA4C,EAC5C;MACIE,KAAK,EAAEJ,KAAK,CAACE,eAAe;MAC5BG,gBAAgB,EAAhBA;IACJ,CACJ,CAAC;EACL,CAAC,MAAM,IAAI,IAAAJ,0CAAoB,EAACD,KAAK,CAACM,aAAa,CAAC,KAAK,KAAK,EAAE;IAC5D,MAAM,IAAIH,cAAW,CAChB,qCAAoCH,KAAK,CAACM,aAAc,mDAAkD,EAC3G,0CAA0C,EAC1C;MACIF,KAAK,EAAEJ,KAAK,CAACM,aAAa;MAC1BD,gBAAgB,EAAEA;IACtB,CACJ,CAAC;EACL;AACJ,CAAC;AAACE,OAAA,CAAAT,qBAAA,GAAAA,qBAAA"}
1
+ {"version":3,"names":["_error","_interopRequireDefault","require","_isModelEndingAllowed","validateEndingAllowed","params","model","isModelEndingAllowed","singularApiName","WebinyError","input","disallowedEnding","pluralApiName","exports"],"sources":["endingAllowed.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { disallowedEnding, isModelEndingAllowed } from \"./isModelEndingAllowed\";\nimport { CmsModel } from \"~/types\";\n\ninterface Params {\n model: Pick<CmsModel, \"singularApiName\" | \"pluralApiName\">;\n}\n\nexport const validateEndingAllowed = (params: Params): void => {\n const { model } = params;\n if (isModelEndingAllowed(model.singularApiName) === false) {\n throw new WebinyError(\n `Content model with singularApiName \"${model.singularApiName}\" is not allowed, as it ends in disallowed value.`,\n \"MODEL_SINGULAR_API_NAME_ENDING_NOT_ALLOWED\",\n {\n input: model.singularApiName,\n disallowedEnding\n }\n );\n } else if (isModelEndingAllowed(model.pluralApiName) === false) {\n throw new WebinyError(\n `Content model with pluralApiName \"${model.pluralApiName}\" is not allowed, as it ends in disallowed value.`,\n \"MODEL_PLURAL_API_NAME_NOT_ENDING_ALLOWED\",\n {\n input: model.pluralApiName,\n disallowedEnding: disallowedEnding\n }\n );\n }\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,qBAAA,GAAAD,OAAA;AAOO,MAAME,qBAAqB,GAAIC,MAAc,IAAW;EAC3D,MAAM;IAAEC;EAAM,CAAC,GAAGD,MAAM;EACxB,IAAI,IAAAE,0CAAoB,EAACD,KAAK,CAACE,eAAe,CAAC,KAAK,KAAK,EAAE;IACvD,MAAM,IAAIC,cAAW,CAChB,uCAAsCH,KAAK,CAACE,eAAgB,mDAAkD,EAC/G,4CAA4C,EAC5C;MACIE,KAAK,EAAEJ,KAAK,CAACE,eAAe;MAC5BG,gBAAgB,EAAhBA;IACJ,CACJ,CAAC;EACL,CAAC,MAAM,IAAI,IAAAJ,0CAAoB,EAACD,KAAK,CAACM,aAAa,CAAC,KAAK,KAAK,EAAE;IAC5D,MAAM,IAAIH,cAAW,CAChB,qCAAoCH,KAAK,CAACM,aAAc,mDAAkD,EAC3G,0CAA0C,EAC1C;MACIF,KAAK,EAAEJ,KAAK,CAACM,aAAa;MAC1BD,gBAAgB,EAAEA;IACtB,CACJ,CAAC;EACL;AACJ,CAAC;AAACE,OAAA,CAAAT,qBAAA,GAAAA,qBAAA","ignoreList":[]}
@@ -8,8 +8,7 @@ exports.isModelEndingAllowed = exports.disallowedEnding = void 0;
8
8
  * This list is to disallow creating models that might interfere with GraphQL schema creation.
9
9
  * Add more if required.
10
10
  */
11
- const disallowedEnding = ["Response", "List", "Meta", "Input", "Sorter", "RefType"];
12
- exports.disallowedEnding = disallowedEnding;
11
+ const disallowedEnding = exports.disallowedEnding = ["Response", "List", "Meta", "Input", "Sorter", "RefType"];
13
12
  const isModelEndingAllowed = apiName => {
14
13
  for (const ending of disallowedEnding) {
15
14
  const re = new RegExp(`${ending}$`);
@@ -1 +1 @@
1
- {"version":3,"names":["disallowedEnding","exports","isModelEndingAllowed","apiName","ending","re","RegExp","matched","match"],"sources":["isModelEndingAllowed.ts"],"sourcesContent":["/**\n * This list is to disallow creating models that might interfere with GraphQL schema creation.\n * Add more if required.\n */\nexport const disallowedEnding: string[] = [\n \"Response\",\n \"List\",\n \"Meta\",\n \"Input\",\n \"Sorter\",\n \"RefType\"\n];\n\nexport const isModelEndingAllowed = (apiName: string): boolean => {\n for (const ending of disallowedEnding) {\n const re = new RegExp(`${ending}$`);\n const matched = apiName.match(re);\n if (matched === null) {\n continue;\n }\n return false;\n }\n return true;\n};\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACO,MAAMA,gBAA0B,GAAG,CACtC,UAAU,EACV,MAAM,EACN,MAAM,EACN,OAAO,EACP,QAAQ,EACR,SAAS,CACZ;AAACC,OAAA,CAAAD,gBAAA,GAAAA,gBAAA;AAEK,MAAME,oBAAoB,GAAIC,OAAe,IAAc;EAC9D,KAAK,MAAMC,MAAM,IAAIJ,gBAAgB,EAAE;IACnC,MAAMK,EAAE,GAAG,IAAIC,MAAM,CAAE,GAAEF,MAAO,GAAE,CAAC;IACnC,MAAMG,OAAO,GAAGJ,OAAO,CAACK,KAAK,CAACH,EAAE,CAAC;IACjC,IAAIE,OAAO,KAAK,IAAI,EAAE;MAClB;IACJ;IACA,OAAO,KAAK;EAChB;EACA,OAAO,IAAI;AACf,CAAC;AAACN,OAAA,CAAAC,oBAAA,GAAAA,oBAAA"}
1
+ {"version":3,"names":["disallowedEnding","exports","isModelEndingAllowed","apiName","ending","re","RegExp","matched","match"],"sources":["isModelEndingAllowed.ts"],"sourcesContent":["/**\n * This list is to disallow creating models that might interfere with GraphQL schema creation.\n * Add more if required.\n */\nexport const disallowedEnding: string[] = [\n \"Response\",\n \"List\",\n \"Meta\",\n \"Input\",\n \"Sorter\",\n \"RefType\"\n];\n\nexport const isModelEndingAllowed = (apiName: string): boolean => {\n for (const ending of disallowedEnding) {\n const re = new RegExp(`${ending}$`);\n const matched = apiName.match(re);\n if (matched === null) {\n continue;\n }\n return false;\n }\n return true;\n};\n"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACO,MAAMA,gBAA0B,GAAAC,OAAA,CAAAD,gBAAA,GAAG,CACtC,UAAU,EACV,MAAM,EACN,MAAM,EACN,OAAO,EACP,QAAQ,EACR,SAAS,CACZ;AAEM,MAAME,oBAAoB,GAAIC,OAAe,IAAc;EAC9D,KAAK,MAAMC,MAAM,IAAIJ,gBAAgB,EAAE;IACnC,MAAMK,EAAE,GAAG,IAAIC,MAAM,CAAE,GAAEF,MAAO,GAAE,CAAC;IACnC,MAAMG,OAAO,GAAGJ,OAAO,CAACK,KAAK,CAACH,EAAE,CAAC;IACjC,IAAIE,OAAO,KAAK,IAAI,EAAE;MAClB;IACJ;IACA,OAAO,KAAK;EAChB;EACA,OAAO,IAAI;AACf,CAAC;AAACN,OAAA,CAAAC,oBAAA,GAAAA,oBAAA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["_error","_interopRequireDefault","require","disallowedModelIdList","isModelIdAllowed","modelId","includes","validateModelIdAllowed","params","model","WebinyError","input","exports","validateExistingModelId","existingModel"],"sources":["modelId.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { CmsModel } from \"~/types\";\n\nconst disallowedModelIdList: string[] = [\n \"contentModel\",\n \"contentModels\",\n \"contentModelGroup\",\n \"contentModelGroups\"\n];\nconst isModelIdAllowed = (modelId: string): boolean => {\n return disallowedModelIdList.includes(modelId) === false;\n};\n\ninterface ModelIdAllowedParams {\n model: Pick<CmsModel, \"modelId\">;\n}\n\nexport const validateModelIdAllowed = (params: ModelIdAllowedParams) => {\n const { model } = params;\n if (isModelIdAllowed(model.modelId)) {\n return;\n }\n throw new WebinyError(\n `Provided model ID \"${model.modelId}\" is not allowed.`,\n \"MODEL_ID_NOT_ALLOWED\",\n {\n input: model.modelId\n }\n );\n};\n\ninterface Params {\n existingModel: Pick<CmsModel, \"modelId\">;\n model: Pick<CmsModel, \"modelId\">;\n}\n\nexport const validateExistingModelId = (params: Params): void => {\n const { existingModel, model } = params;\n\n if (existingModel.modelId === model.modelId) {\n throw new WebinyError(\n `Content model with modelId \"${model.modelId}\" already exists.`,\n \"MODEL_ID_EXISTS\",\n {\n input: existingModel.modelId\n }\n );\n }\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAGA,MAAMC,qBAA+B,GAAG,CACpC,cAAc,EACd,eAAe,EACf,mBAAmB,EACnB,oBAAoB,CACvB;AACD,MAAMC,gBAAgB,GAAIC,OAAe,IAAc;EACnD,OAAOF,qBAAqB,CAACG,QAAQ,CAACD,OAAO,CAAC,KAAK,KAAK;AAC5D,CAAC;AAMM,MAAME,sBAAsB,GAAIC,MAA4B,IAAK;EACpE,MAAM;IAAEC;EAAM,CAAC,GAAGD,MAAM;EACxB,IAAIJ,gBAAgB,CAACK,KAAK,CAACJ,OAAO,CAAC,EAAE;IACjC;EACJ;EACA,MAAM,IAAIK,cAAW,CAChB,sBAAqBD,KAAK,CAACJ,OAAQ,mBAAkB,EACtD,sBAAsB,EACtB;IACIM,KAAK,EAAEF,KAAK,CAACJ;EACjB,CACJ,CAAC;AACL,CAAC;AAACO,OAAA,CAAAL,sBAAA,GAAAA,sBAAA;AAOK,MAAMM,uBAAuB,GAAIL,MAAc,IAAW;EAC7D,MAAM;IAAEM,aAAa;IAAEL;EAAM,CAAC,GAAGD,MAAM;EAEvC,IAAIM,aAAa,CAACT,OAAO,KAAKI,KAAK,CAACJ,OAAO,EAAE;IACzC,MAAM,IAAIK,cAAW,CAChB,+BAA8BD,KAAK,CAACJ,OAAQ,mBAAkB,EAC/D,iBAAiB,EACjB;MACIM,KAAK,EAAEG,aAAa,CAACT;IACzB,CACJ,CAAC;EACL;AACJ,CAAC;AAACO,OAAA,CAAAC,uBAAA,GAAAA,uBAAA"}
1
+ {"version":3,"names":["_error","_interopRequireDefault","require","disallowedModelIdList","isModelIdAllowed","modelId","includes","validateModelIdAllowed","params","model","WebinyError","input","exports","validateExistingModelId","existingModel"],"sources":["modelId.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { CmsModel } from \"~/types\";\n\nconst disallowedModelIdList: string[] = [\n \"contentModel\",\n \"contentModels\",\n \"contentModelGroup\",\n \"contentModelGroups\"\n];\nconst isModelIdAllowed = (modelId: string): boolean => {\n return disallowedModelIdList.includes(modelId) === false;\n};\n\ninterface ModelIdAllowedParams {\n model: Pick<CmsModel, \"modelId\">;\n}\n\nexport const validateModelIdAllowed = (params: ModelIdAllowedParams) => {\n const { model } = params;\n if (isModelIdAllowed(model.modelId)) {\n return;\n }\n throw new WebinyError(\n `Provided model ID \"${model.modelId}\" is not allowed.`,\n \"MODEL_ID_NOT_ALLOWED\",\n {\n input: model.modelId\n }\n );\n};\n\ninterface Params {\n existingModel: Pick<CmsModel, \"modelId\">;\n model: Pick<CmsModel, \"modelId\">;\n}\n\nexport const validateExistingModelId = (params: Params): void => {\n const { existingModel, model } = params;\n\n if (existingModel.modelId === model.modelId) {\n throw new WebinyError(\n `Content model with modelId \"${model.modelId}\" already exists.`,\n \"MODEL_ID_EXISTS\",\n {\n input: existingModel.modelId\n }\n );\n }\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAGA,MAAMC,qBAA+B,GAAG,CACpC,cAAc,EACd,eAAe,EACf,mBAAmB,EACnB,oBAAoB,CACvB;AACD,MAAMC,gBAAgB,GAAIC,OAAe,IAAc;EACnD,OAAOF,qBAAqB,CAACG,QAAQ,CAACD,OAAO,CAAC,KAAK,KAAK;AAC5D,CAAC;AAMM,MAAME,sBAAsB,GAAIC,MAA4B,IAAK;EACpE,MAAM;IAAEC;EAAM,CAAC,GAAGD,MAAM;EACxB,IAAIJ,gBAAgB,CAACK,KAAK,CAACJ,OAAO,CAAC,EAAE;IACjC;EACJ;EACA,MAAM,IAAIK,cAAW,CAChB,sBAAqBD,KAAK,CAACJ,OAAQ,mBAAkB,EACtD,sBAAsB,EACtB;IACIM,KAAK,EAAEF,KAAK,CAACJ;EACjB,CACJ,CAAC;AACL,CAAC;AAACO,OAAA,CAAAL,sBAAA,GAAAA,sBAAA;AAOK,MAAMM,uBAAuB,GAAIL,MAAc,IAAW;EAC7D,MAAM;IAAEM,aAAa;IAAEL;EAAM,CAAC,GAAGD,MAAM;EAEvC,IAAIM,aAAa,CAACT,OAAO,KAAKI,KAAK,CAACJ,OAAO,EAAE;IACzC,MAAM,IAAIK,cAAW,CAChB,+BAA8BD,KAAK,CAACJ,OAAQ,mBAAkB,EAC/D,iBAAiB,EACjB;MACIM,KAAK,EAAEG,aAAa,CAACT;IACzB,CACJ,CAAC;EACL;AACJ,CAAC;AAACO,OAAA,CAAAC,uBAAA,GAAAA,uBAAA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["_error","_interopRequireDefault","require","validatePluralApiName","params","existingModel","model","singularApiName","pluralApiName","WebinyError","input","exports"],"sources":["pluralApiName.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { CmsModel } from \"~/types\";\n\ninterface Params {\n existingModel: Pick<CmsModel, \"singularApiName\" | \"pluralApiName\">;\n model: Pick<CmsModel, \"singularApiName\" | \"pluralApiName\">;\n}\n\nexport const validatePluralApiName = (params: Params): void => {\n const { existingModel, model } = params;\n\n if (existingModel.singularApiName === model.pluralApiName) {\n throw new WebinyError(\n `Content model with singularApiName \"${model.pluralApiName}\" already exists.`,\n \"MODEL_SINGULAR_API_NAME_EXISTS\",\n {\n input: model.pluralApiName\n }\n );\n } else if (existingModel.pluralApiName === model.pluralApiName) {\n throw new WebinyError(\n `Content model with pluralApiName \"${model.pluralApiName}\" already exists.`,\n \"MODEL_PLURAL_API_NAME_EXISTS\",\n {\n input: model.pluralApiName\n }\n );\n }\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAQO,MAAMC,qBAAqB,GAAIC,MAAc,IAAW;EAC3D,MAAM;IAAEC,aAAa;IAAEC;EAAM,CAAC,GAAGF,MAAM;EAEvC,IAAIC,aAAa,CAACE,eAAe,KAAKD,KAAK,CAACE,aAAa,EAAE;IACvD,MAAM,IAAIC,cAAW,CAChB,uCAAsCH,KAAK,CAACE,aAAc,mBAAkB,EAC7E,gCAAgC,EAChC;MACIE,KAAK,EAAEJ,KAAK,CAACE;IACjB,CACJ,CAAC;EACL,CAAC,MAAM,IAAIH,aAAa,CAACG,aAAa,KAAKF,KAAK,CAACE,aAAa,EAAE;IAC5D,MAAM,IAAIC,cAAW,CAChB,qCAAoCH,KAAK,CAACE,aAAc,mBAAkB,EAC3E,8BAA8B,EAC9B;MACIE,KAAK,EAAEJ,KAAK,CAACE;IACjB,CACJ,CAAC;EACL;AACJ,CAAC;AAACG,OAAA,CAAAR,qBAAA,GAAAA,qBAAA"}
1
+ {"version":3,"names":["_error","_interopRequireDefault","require","validatePluralApiName","params","existingModel","model","singularApiName","pluralApiName","WebinyError","input","exports"],"sources":["pluralApiName.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { CmsModel } from \"~/types\";\n\ninterface Params {\n existingModel: Pick<CmsModel, \"singularApiName\" | \"pluralApiName\">;\n model: Pick<CmsModel, \"singularApiName\" | \"pluralApiName\">;\n}\n\nexport const validatePluralApiName = (params: Params): void => {\n const { existingModel, model } = params;\n\n if (existingModel.singularApiName === model.pluralApiName) {\n throw new WebinyError(\n `Content model with singularApiName \"${model.pluralApiName}\" already exists.`,\n \"MODEL_SINGULAR_API_NAME_EXISTS\",\n {\n input: model.pluralApiName\n }\n );\n } else if (existingModel.pluralApiName === model.pluralApiName) {\n throw new WebinyError(\n `Content model with pluralApiName \"${model.pluralApiName}\" already exists.`,\n \"MODEL_PLURAL_API_NAME_EXISTS\",\n {\n input: model.pluralApiName\n }\n );\n }\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAQO,MAAMC,qBAAqB,GAAIC,MAAc,IAAW;EAC3D,MAAM;IAAEC,aAAa;IAAEC;EAAM,CAAC,GAAGF,MAAM;EAEvC,IAAIC,aAAa,CAACE,eAAe,KAAKD,KAAK,CAACE,aAAa,EAAE;IACvD,MAAM,IAAIC,cAAW,CAChB,uCAAsCH,KAAK,CAACE,aAAc,mBAAkB,EAC7E,gCAAgC,EAChC;MACIE,KAAK,EAAEJ,KAAK,CAACE;IACjB,CACJ,CAAC;EACL,CAAC,MAAM,IAAIH,aAAa,CAACG,aAAa,KAAKF,KAAK,CAACE,aAAa,EAAE;IAC5D,MAAM,IAAIC,cAAW,CAChB,qCAAoCH,KAAK,CAACE,aAAc,mBAAkB,EAC3E,8BAA8B,EAC9B;MACIE,KAAK,EAAEJ,KAAK,CAACE;IACjB,CACJ,CAAC;EACL;AACJ,CAAC;AAACG,OAAA,CAAAR,qBAAA,GAAAA,qBAAA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["_error","_interopRequireDefault","require","validateSingularApiName","params","existingModel","model","singularApiName","WebinyError","input","pluralApiName","exports"],"sources":["singularApiName.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { CmsModel } from \"~/types\";\n\ninterface Params {\n existingModel: Pick<CmsModel, \"singularApiName\" | \"pluralApiName\">;\n model: Pick<CmsModel, \"singularApiName\" | \"pluralApiName\">;\n}\n\nexport const validateSingularApiName = (params: Params): void => {\n const { existingModel, model } = params;\n\n if (existingModel.singularApiName === model.singularApiName) {\n throw new WebinyError(\n `Content model with singularApiName \"${model.singularApiName}\" already exists.`,\n \"MODEL_SINGULAR_API_NAME_EXISTS\",\n {\n input: model.singularApiName\n }\n );\n } else if (existingModel.pluralApiName === model.singularApiName) {\n throw new WebinyError(\n `Content model with pluralApiName \"${model.singularApiName}\" already exists.`,\n \"MODEL_PLURAL_API_NAME_EXISTS\",\n {\n input: model.singularApiName\n }\n );\n }\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAQO,MAAMC,uBAAuB,GAAIC,MAAc,IAAW;EAC7D,MAAM;IAAEC,aAAa;IAAEC;EAAM,CAAC,GAAGF,MAAM;EAEvC,IAAIC,aAAa,CAACE,eAAe,KAAKD,KAAK,CAACC,eAAe,EAAE;IACzD,MAAM,IAAIC,cAAW,CAChB,uCAAsCF,KAAK,CAACC,eAAgB,mBAAkB,EAC/E,gCAAgC,EAChC;MACIE,KAAK,EAAEH,KAAK,CAACC;IACjB,CACJ,CAAC;EACL,CAAC,MAAM,IAAIF,aAAa,CAACK,aAAa,KAAKJ,KAAK,CAACC,eAAe,EAAE;IAC9D,MAAM,IAAIC,cAAW,CAChB,qCAAoCF,KAAK,CAACC,eAAgB,mBAAkB,EAC7E,8BAA8B,EAC9B;MACIE,KAAK,EAAEH,KAAK,CAACC;IACjB,CACJ,CAAC;EACL;AACJ,CAAC;AAACI,OAAA,CAAAR,uBAAA,GAAAA,uBAAA"}
1
+ {"version":3,"names":["_error","_interopRequireDefault","require","validateSingularApiName","params","existingModel","model","singularApiName","WebinyError","input","pluralApiName","exports"],"sources":["singularApiName.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { CmsModel } from \"~/types\";\n\ninterface Params {\n existingModel: Pick<CmsModel, \"singularApiName\" | \"pluralApiName\">;\n model: Pick<CmsModel, \"singularApiName\" | \"pluralApiName\">;\n}\n\nexport const validateSingularApiName = (params: Params): void => {\n const { existingModel, model } = params;\n\n if (existingModel.singularApiName === model.singularApiName) {\n throw new WebinyError(\n `Content model with singularApiName \"${model.singularApiName}\" already exists.`,\n \"MODEL_SINGULAR_API_NAME_EXISTS\",\n {\n input: model.singularApiName\n }\n );\n } else if (existingModel.pluralApiName === model.singularApiName) {\n throw new WebinyError(\n `Content model with pluralApiName \"${model.singularApiName}\" already exists.`,\n \"MODEL_PLURAL_API_NAME_EXISTS\",\n {\n input: model.singularApiName\n }\n );\n }\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAQO,MAAMC,uBAAuB,GAAIC,MAAc,IAAW;EAC7D,MAAM;IAAEC,aAAa;IAAEC;EAAM,CAAC,GAAGF,MAAM;EAEvC,IAAIC,aAAa,CAACE,eAAe,KAAKD,KAAK,CAACC,eAAe,EAAE;IACzD,MAAM,IAAIC,cAAW,CAChB,uCAAsCF,KAAK,CAACC,eAAgB,mBAAkB,EAC/E,gCAAgC,EAChC;MACIE,KAAK,EAAEH,KAAK,CAACC;IACjB,CACJ,CAAC;EACL,CAAC,MAAM,IAAIF,aAAa,CAACK,aAAa,KAAKJ,KAAK,CAACC,eAAe,EAAE;IAC9D,MAAM,IAAIC,cAAW,CAChB,qCAAoCF,KAAK,CAACC,eAAgB,mBAAkB,EAC7E,8BAA8B,EAC9B;MACIE,KAAK,EAAEH,KAAK,CAACC;IACjB,CACJ,CAAC;EACL;AACJ,CAAC;AAACI,OAAA,CAAAR,uBAAA,GAAAA,uBAAA","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["_error","_interopRequireDefault","require","_CmsModelPlugin","_validateModelFields","validateModel","params","model","context","plugins","modelPlugin","byType","CmsModelPlugin","type","find","item","contentModel","modelId","WebinyError","validateModelFields","exports"],"sources":["validateModel.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { CmsModelPlugin } from \"~/plugins/CmsModelPlugin\";\nimport { CmsContext, CmsModel } from \"~/types\";\nimport { validateModelFields } from \"./validateModelFields\";\n\ninterface ValidateModelParams {\n models: CmsModel[];\n model: CmsModel;\n original?: CmsModel;\n context: CmsContext;\n}\n\nexport const validateModel = async (params: ValidateModelParams): Promise<void> => {\n const { model, context } = params;\n\n const { plugins } = context;\n\n const modelPlugin = plugins\n .byType<CmsModelPlugin>(CmsModelPlugin.type)\n .find(item => item.contentModel.modelId === model.modelId);\n\n if (modelPlugin) {\n throw new WebinyError(\n \"Content models defined via plugins cannot be updated.\",\n \"CONTENT_MODEL_UPDATE_ERROR\",\n {\n modelId: model.modelId\n }\n );\n }\n\n await validateModelFields(params);\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,eAAA,GAAAD,OAAA;AAEA,IAAAE,oBAAA,GAAAF,OAAA;AASO,MAAMG,aAAa,GAAG,MAAOC,MAA2B,IAAoB;EAC/E,MAAM;IAAEC,KAAK;IAAEC;EAAQ,CAAC,GAAGF,MAAM;EAEjC,MAAM;IAAEG;EAAQ,CAAC,GAAGD,OAAO;EAE3B,MAAME,WAAW,GAAGD,OAAO,CACtBE,MAAM,CAAiBC,8BAAc,CAACC,IAAI,CAAC,CAC3CC,IAAI,CAACC,IAAI,IAAIA,IAAI,CAACC,YAAY,CAACC,OAAO,KAAKV,KAAK,CAACU,OAAO,CAAC;EAE9D,IAAIP,WAAW,EAAE;IACb,MAAM,IAAIQ,cAAW,CACjB,uDAAuD,EACvD,4BAA4B,EAC5B;MACID,OAAO,EAAEV,KAAK,CAACU;IACnB,CACJ,CAAC;EACL;EAEA,MAAM,IAAAE,wCAAmB,EAACb,MAAM,CAAC;AACrC,CAAC;AAACc,OAAA,CAAAf,aAAA,GAAAA,aAAA"}
1
+ {"version":3,"names":["_error","_interopRequireDefault","require","_CmsModelPlugin","_validateModelFields","validateModel","params","model","context","plugins","modelPlugin","byType","CmsModelPlugin","type","find","item","contentModel","modelId","WebinyError","validateModelFields","exports"],"sources":["validateModel.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { CmsModelPlugin } from \"~/plugins/CmsModelPlugin\";\nimport { CmsContext, CmsModel } from \"~/types\";\nimport { validateModelFields } from \"./validateModelFields\";\n\ninterface ValidateModelParams {\n models: CmsModel[];\n model: CmsModel;\n original?: CmsModel;\n context: CmsContext;\n}\n\nexport const validateModel = async (params: ValidateModelParams): Promise<void> => {\n const { model, context } = params;\n\n const { plugins } = context;\n\n const modelPlugin = plugins\n .byType<CmsModelPlugin>(CmsModelPlugin.type)\n .find(item => item.contentModel.modelId === model.modelId);\n\n if (modelPlugin) {\n throw new WebinyError(\n \"Content models defined via plugins cannot be updated.\",\n \"CONTENT_MODEL_UPDATE_ERROR\",\n {\n modelId: model.modelId\n }\n );\n }\n\n await validateModelFields(params);\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,eAAA,GAAAD,OAAA;AAEA,IAAAE,oBAAA,GAAAF,OAAA;AASO,MAAMG,aAAa,GAAG,MAAOC,MAA2B,IAAoB;EAC/E,MAAM;IAAEC,KAAK;IAAEC;EAAQ,CAAC,GAAGF,MAAM;EAEjC,MAAM;IAAEG;EAAQ,CAAC,GAAGD,OAAO;EAE3B,MAAME,WAAW,GAAGD,OAAO,CACtBE,MAAM,CAAiBC,8BAAc,CAACC,IAAI,CAAC,CAC3CC,IAAI,CAACC,IAAI,IAAIA,IAAI,CAACC,YAAY,CAACC,OAAO,KAAKV,KAAK,CAACU,OAAO,CAAC;EAE9D,IAAIP,WAAW,EAAE;IACb,MAAM,IAAIQ,cAAW,CACjB,uDAAuD,EACvD,4BAA4B,EAC5B;MACID,OAAO,EAAEV,KAAK,CAACU;IACnB,CACJ,CAAC;EACL;EAEA,MAAM,IAAAE,wCAAmB,EAACb,MAAM,CAAC;AACrC,CAAC;AAACc,OAAA,CAAAf,aAAA,GAAAA,aAAA","ignoreList":[]}
@@ -1,4 +1,4 @@
1
- import { CmsModel, CmsContext } from "../../types";
1
+ import { CmsContext, CmsModel } from "../../types";
2
2
  interface ValidateModelFieldsParams {
3
3
  models: CmsModel[];
4
4
  model: CmsModel;
@@ -1 +1 @@
1
- {"version":3,"names":["_graphqlTag","_interopRequireDefault","require","_error","_createManageSDL","_createFieldStorageId","_getBaseFieldType","_titleField","_descriptionField","_imageField","_plugins","_buildSchemaPlugins","_createExecutableSchema","_utils","extractInvalidField","model","err","sdl","source","body","line","lineNumber","locations","sdlLines","split","sdlLine","gqlType","i","includes","match","invalidField","undefined","Array","isArray","fieldRegex","RegExp","matched","message","data","modelId","code","join","createValidateChildFields","plugins","fields","originalFields","length","validateFields","lockedFields","params","idList","fieldIdList","storageIdList","field","baseType","getBaseFieldType","plugin","find","fieldType","Error","id","WebinyError","storageId","fieldId","push","originalField","f","isLocked","some","lockedField","createFieldStorageId","label","validateChildFields","validate","createGraphQLSchema","context","models","security","withoutAuthorization","cms","listModels","filter","isPrivate","modelPlugins","buildSchemaPlugins","concat","byType","CmsGraphQLSchemaPlugin","type","reduce","collection","name","generateAlphaNumericId","createExecutableSchema","Object","values","extractErrorObject","error","output","key","validateModelFields","original","titleFieldId","descriptionFieldId","imageFieldId","fieldTypePlugins","sorterPlugins","CmsGraphQLSchemaSorterPlugin","schema","createManageSDL","acc","pl","gql","getContentModelTitleFieldId","getContentModelDescriptionFieldId","getContentModelImageFieldId","cmsLockedFieldPlugins","existingField","item","Boolean","multipleValues","reason","lockedFieldType","existingFieldType","lockedFieldsByType","checkLockedField","exports"],"sources":["validateModelFields.ts"],"sourcesContent":["import gql from \"graphql-tag\";\nimport WebinyError from \"@webiny/error\";\nimport {\n CmsModel,\n CmsContext,\n CmsModelField,\n CmsModelFieldToGraphQLPlugin,\n CmsModelFieldToGraphQLPluginValidateChildFieldsValidate,\n CmsModelLockedFieldPlugin,\n LockedField\n} from \"~/types\";\nimport { createManageSDL } from \"~/graphql/schema/createManageSDL\";\nimport { createFieldStorageId } from \"./createFieldStorageId\";\nimport { GraphQLError } from \"graphql\";\nimport { getBaseFieldType } from \"~/utils/getBaseFieldType\";\nimport { getContentModelTitleFieldId } from \"./fields/titleField\";\nimport { getContentModelDescriptionFieldId } from \"./fields/descriptionField\";\nimport { getContentModelImageFieldId } from \"./fields/imageField\";\nimport { CmsGraphQLSchemaPlugin, CmsGraphQLSchemaSorterPlugin } from \"~/plugins\";\nimport { buildSchemaPlugins } from \"~/graphql/buildSchemaPlugins\";\nimport { createExecutableSchema } from \"~/graphql/createExecutableSchema\";\nimport { generateAlphaNumericId } from \"@webiny/utils\";\n\nconst extractInvalidField = (model: CmsModel, err: GraphQLError) => {\n const sdl = err.source?.body || \"\";\n\n /**\n * Find the invalid type\n */\n const { line: lineNumber } = err.locations\n ? err.locations[0]\n : {\n line: 0\n };\n const sdlLines = sdl.split(\"\\n\");\n let sdlLine;\n let gqlType;\n for (let i = lineNumber; i > 0; i--) {\n if (sdlLine && sdlLine.includes(\"type \")) {\n gqlType = sdlLine.match(/type\\s+(.*?)\\s+{/);\n break;\n }\n\n sdlLine = sdlLines[i];\n }\n\n let invalidField: string | undefined = undefined;\n if (Array.isArray(gqlType)) {\n const fieldRegex = new RegExp(`([^\\\\s+].*?):\\\\s+\\\\[?${gqlType[1]}!?\\\\]?`);\n\n const matched = sdl.match(fieldRegex);\n if (matched) {\n invalidField = matched[1];\n }\n }\n\n let message = `See more details in the browser console.`;\n if (invalidField) {\n message = `Please review the definition of \"${invalidField}\" field.`;\n }\n\n return {\n data: {\n modelId: model.modelId,\n sdl,\n invalidField\n },\n code: \"INVALID_MODEL_DEFINITION\",\n message: [`Model \"${model.modelId}\" was not saved!`, message].join(\"\\n\")\n };\n};\n\nconst createValidateChildFields = (\n plugins: CmsModelFieldToGraphQLPlugin[]\n): CmsModelFieldToGraphQLPluginValidateChildFieldsValidate => {\n return ({ fields, originalFields }) => {\n if (fields.length === 0 && originalFields.length === 0) {\n return;\n }\n validateFields({\n fields,\n originalFields,\n plugins,\n lockedFields: []\n });\n };\n};\n\ninterface ValidateFieldsParams {\n plugins: CmsModelFieldToGraphQLPlugin[];\n fields: CmsModelField[];\n originalFields: CmsModelField[];\n lockedFields: LockedField[];\n}\n\nconst validateFields = (params: ValidateFieldsParams) => {\n const { plugins, fields, originalFields, lockedFields } = params;\n\n const idList: string[] = [];\n const fieldIdList: string[] = [];\n const storageIdList: string[] = [];\n\n for (const field of fields) {\n const baseType = getBaseFieldType(field);\n const plugin = plugins.find(plugin => plugin.fieldType === baseType);\n\n if (!plugin) {\n throw new Error(\n `Cannot update content model because of the unknown \"${baseType}\" field.`\n );\n }\n /**\n * Check the field's id against existing ones.\n * There cannot be two fields with the same id.\n */\n if (idList.includes(field.id)) {\n throw new WebinyError(\n `Cannot update content model because field \"${\n field.storageId || field.fieldId\n }\" has id \"${field.id}\", which is already used.`\n );\n }\n idList.push(field.id);\n\n const originalField = originalFields.find(f => f.id === field.id);\n /**\n * Field MUST have an fieldId defined.\n */\n if (!field.fieldId) {\n throw new WebinyError(`Field does not have an \"fieldId\" defined.`, \"MISSING_FIELD_ID\", {\n field\n });\n }\n /**\n * If storageId does not match a certain pattern, add that pattern, but only if field is not locked (used) already.\n * This is to avoid errors in the already installed systems.\n *\n * Why are we using the @?\n *\n * It is not part of special characters for the query syntax in the Lucene.\n *\n * Relevant links:\n * https://lucene.apache.org/core/3_4_0/queryparsersyntax.html\n * https://discuss.elastic.co/t/special-characters-in-field-names/10658/3\n * https://discuss.elastic.co/t/illegal-characters-in-elasticsearch-field-names/17196/2\n */\n const isLocked = lockedFields.some(lockedField => {\n return lockedField.fieldId === field.storageId || lockedField.fieldId === field.fieldId;\n });\n if (!field.storageId) {\n /**\n * In case field is locked, we must set the storageId to the fieldId value.\n * This should not happen, because we upgrade all the fields in 5.33.0, but let's have a check just in case of some upgrade miss.\n */\n //\n if (isLocked) {\n field.storageId = field.fieldId;\n }\n /**\n * When having original field, just set the storageId to value from the originalField\n */\n //\n else if (originalField) {\n field.storageId = originalField.storageId;\n }\n /**\n * The last case is when no original field and not locked - so this is a completely new field.\n */\n //\n else {\n field.storageId = createFieldStorageId(field);\n }\n }\n /**\n * Check the field's fieldId against existing ones.\n * There cannot be two fields with the same fieldId - outside world identifier.\n */\n if (fieldIdList.includes(field.fieldId)) {\n throw new WebinyError(\n `Cannot update content model because field \"${field.storageId}\" has fieldId \"${field.fieldId}\", which is already used.`\n );\n }\n fieldIdList.push(field.fieldId);\n /**\n * Check the field's storageId against the existing ones.\n * There cannot be two fields with the same storageId.\n */\n if (storageIdList.includes(field.storageId)) {\n throw new WebinyError(\n `Cannot update content model because field \"${field.label}\" has storageId \"${field.storageId}\", which is already used.`\n );\n }\n storageIdList.push(field.storageId);\n /**\n * There might be some plugins which allow child fields.\n * We use this method to validate them as well.\n */\n if (!plugin.validateChildFields) {\n continue;\n }\n const validateChildFields = createValidateChildFields(plugins);\n plugin.validateChildFields({\n field,\n originalField,\n validate: validateChildFields\n });\n }\n};\n\ninterface CreateGraphQLSchemaParams {\n context: CmsContext;\n model: CmsModel;\n}\n\nconst createGraphQLSchema = async (params: CreateGraphQLSchemaParams): Promise<any> => {\n const { context, model } = params;\n\n const models = await context.security.withoutAuthorization(async () => {\n return (await context.cms.listModels()).filter((model): model is CmsModel => {\n return model.isPrivate !== true;\n });\n });\n\n const modelPlugins = await buildSchemaPlugins({\n context,\n models: models.concat([model])\n });\n\n const plugins = context.plugins\n .byType<CmsGraphQLSchemaPlugin>(CmsGraphQLSchemaPlugin.type)\n .reduce<Record<string, CmsGraphQLSchemaPlugin>>((collection, plugin) => {\n const name =\n plugin.name || `${CmsGraphQLSchemaPlugin.type}-${generateAlphaNumericId(16)}`;\n collection[name] = plugin;\n return collection;\n }, {});\n for (const plugin of modelPlugins) {\n const name = plugin.name || `${plugin.type}-${generateAlphaNumericId(16)}`;\n plugins[name] = plugin;\n }\n\n return createExecutableSchema({\n plugins: Object.values(plugins)\n });\n};\n\nconst extractErrorObject = (error: any) => {\n return [\"message\", \"code\", \"data\", \"stack\"].reduce<Record<string, any>>((output, key) => {\n if (!error[key]) {\n return output;\n }\n output[key] = error[key];\n return output;\n }, {});\n};\n\ninterface ValidateModelFieldsParams {\n models: CmsModel[];\n model: CmsModel;\n original?: CmsModel;\n context: CmsContext;\n}\n\nexport const validateModelFields = async (params: ValidateModelFieldsParams): Promise<void> => {\n const { models, model, original, context } = params;\n const { titleFieldId, descriptionFieldId, imageFieldId } = model;\n const { plugins } = context;\n\n /**\n * There should be fields/locked fields in either model or data to be updated.\n */\n const { fields = [], lockedFields = [] } = model;\n\n /**\n * Let's inspect the fields of the received content model. We prevent saving of a content model if it\n * contains a field for which a \"cms-model-field-to-graphql\" plugin does not exist on the backend.\n */\n const fieldTypePlugins = plugins.byType<CmsModelFieldToGraphQLPlugin>(\n \"cms-model-field-to-graphql\"\n );\n\n validateFields({\n fields,\n originalFields: original?.fields || [],\n lockedFields,\n plugins: fieldTypePlugins\n });\n\n if (fields.length) {\n const sorterPlugins = plugins.byType<CmsGraphQLSchemaSorterPlugin>(\n CmsGraphQLSchemaSorterPlugin.type\n );\n /**\n * Make sure that this model can be safely converted to a GraphQL SDL\n */\n const schema = createManageSDL({\n models,\n model,\n fieldTypePlugins: fieldTypePlugins.reduce(\n (acc, pl) => ({ ...acc, [pl.fieldType]: pl }),\n {}\n ),\n sorterPlugins\n });\n\n try {\n gql(schema);\n } catch (err) {\n throw new WebinyError(extractInvalidField(model, err));\n }\n /**\n *\n */\n try {\n await createGraphQLSchema({\n context,\n model\n });\n } catch (err) {\n throw new WebinyError({\n message:\n \"Cannot generate GraphQL schema when testing with the given model. Please check the response for more details.\",\n code: \"GRAPHQL_SCHEMA_ERROR\",\n data: {\n modelId: model.modelId,\n error: extractErrorObject(err)\n }\n });\n }\n }\n\n model.titleFieldId = getContentModelTitleFieldId(fields, titleFieldId);\n model.descriptionFieldId = getContentModelDescriptionFieldId(fields, descriptionFieldId);\n model.imageFieldId = getContentModelImageFieldId(fields, imageFieldId);\n\n const cmsLockedFieldPlugins =\n plugins.byType<CmsModelLockedFieldPlugin>(\"cms-model-locked-field\");\n\n /**\n * We must not allow removal or changes in fields that are already in use in content entries.\n * Locked fields still have fieldId (should be storageId) because of the old existing locked fields in the models.\n */\n for (const lockedField of lockedFields) {\n const existingField = fields.find(item => item.storageId === lockedField.fieldId);\n\n /**\n * Starting with 5.33.0 fields can be deleted.\n * Our UI gives a warning upon locked field deletion, but if user is managing fields through API directly - we cannot do anything.\n */\n if (!existingField) {\n continue;\n }\n\n if (Boolean(lockedField.multipleValues) !== Boolean(existingField.multipleValues)) {\n throw new WebinyError(\n `Cannot change \"multipleValues\" for the \"${lockedField.fieldId}\" field because it's already in use in created content.`,\n \"ENTRY_FIELD_USED\",\n {\n reason: `\"multipleValues\" changed`,\n field: existingField\n }\n );\n }\n\n const fieldType = getBaseFieldType(existingField);\n if (lockedField.type !== fieldType) {\n throw new WebinyError(\n `Cannot change field type for the \"${lockedField.fieldId}\" field because it's already in use in created content.`,\n \"ENTRY_FIELD_USED\",\n {\n reason: `\"type\" changed`,\n lockedFieldType: lockedField.type,\n existingFieldType: fieldType\n }\n );\n }\n\n /**\n * Check `lockedField` invariant for specific field\n */\n const lockedFieldsByType = cmsLockedFieldPlugins.filter(\n pl => pl.fieldType === getBaseFieldType(lockedField)\n );\n for (const plugin of lockedFieldsByType) {\n if (typeof plugin.checkLockedField !== \"function\") {\n continue;\n }\n plugin.checkLockedField({\n lockedField,\n field: existingField\n });\n }\n }\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAF,sBAAA,CAAAC,OAAA;AAUA,IAAAE,gBAAA,GAAAF,OAAA;AACA,IAAAG,qBAAA,GAAAH,OAAA;AAEA,IAAAI,iBAAA,GAAAJ,OAAA;AACA,IAAAK,WAAA,GAAAL,OAAA;AACA,IAAAM,iBAAA,GAAAN,OAAA;AACA,IAAAO,WAAA,GAAAP,OAAA;AACA,IAAAQ,QAAA,GAAAR,OAAA;AACA,IAAAS,mBAAA,GAAAT,OAAA;AACA,IAAAU,uBAAA,GAAAV,OAAA;AACA,IAAAW,MAAA,GAAAX,OAAA;AAEA,MAAMY,mBAAmB,GAAGA,CAACC,KAAe,EAAEC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E,gBAAgB,KAAK,UAAU,EAAE;QAC/C;MACJ;MACArE,MAAM,CAACqE,gBAAgB,CAAC;QACpBxD,WAAW;QACXhB,KAAK,EAAEgE;MACX,CAAC,CAAC;IACN;EACJ;AACJ,CAAC;AAACS,OAAA,CAAA1B,mBAAA,GAAAA,mBAAA"}
1
+ {"version":3,"names":["_graphqlTag","_interopRequireDefault","require","_error","_createManageSDL","_createFieldStorageId","_getBaseFieldType","_titleField","_descriptionField","_imageField","_plugins","_buildSchemaPlugins","_createExecutableSchema","_utils","extractInvalidField","model","err","sdl","source","body","line","lineNumber","locations","sdlLines","split","sdlLine","gqlType","i","includes","match","invalidField","undefined","Array","isArray","fieldRegex","RegExp","matched","message","data","modelId","code","join","createValidateChildFields","plugins","fields","originalFields","length","validateFields","lockedFields","params","idList","fieldIdList","storageIdList","field","baseType","getBaseFieldType","plugin","find","fieldType","Error","id","WebinyError","storageId","fieldId","push","originalField","f","isLocked","some","lockedField","createFieldStorageId","label","validateChildFields","validate","createGraphQLSchema","context","models","security","withoutAuthorization","cms","listModels","filter","isPrivate","modelPlugins","buildSchemaPlugins","concat","byType","CmsGraphQLSchemaPlugin","type","reduce","collection","name","generateAlphaNumericId","createExecutableSchema","Object","values","extractErrorObject","error","output","key","validateModelFields","original","titleFieldId","descriptionFieldId","imageFieldId","fieldTypePlugins","sorterPlugins","CmsGraphQLSchemaSorterPlugin","schema","createManageSDL","acc","pl","gql","getContentModelTitleFieldId","getContentModelDescriptionFieldId","getContentModelImageFieldId","cmsLockedFieldPlugins","existingField","item","Boolean","multipleValues","reason","lockedFieldType","existingFieldType","lockedFieldsByType","checkLockedField","exports"],"sources":["validateModelFields.ts"],"sourcesContent":["import gql from \"graphql-tag\";\nimport WebinyError from \"@webiny/error\";\nimport {\n CmsContext,\n CmsModel,\n CmsModelField,\n CmsModelFieldToGraphQLPlugin,\n CmsModelFieldToGraphQLPluginValidateChildFieldsValidate,\n CmsModelLockedFieldPlugin,\n LockedField\n} from \"~/types\";\nimport { createManageSDL } from \"~/graphql/schema/createManageSDL\";\nimport { createFieldStorageId } from \"./createFieldStorageId\";\nimport { GraphQLError } from \"graphql\";\nimport { getBaseFieldType } from \"~/utils/getBaseFieldType\";\nimport { getContentModelTitleFieldId } from \"./fields/titleField\";\nimport { getContentModelDescriptionFieldId } from \"./fields/descriptionField\";\nimport { getContentModelImageFieldId } from \"./fields/imageField\";\nimport {\n CmsGraphQLSchemaPlugin,\n CmsGraphQLSchemaSorterPlugin,\n ICmsGraphQLSchemaPlugin\n} from \"~/plugins\";\nimport { buildSchemaPlugins } from \"~/graphql/buildSchemaPlugins\";\nimport { createExecutableSchema } from \"~/graphql/createExecutableSchema\";\nimport { generateAlphaNumericId } from \"@webiny/utils\";\n\nconst extractInvalidField = (model: CmsModel, err: GraphQLError) => {\n const sdl = err.source?.body || \"\";\n\n /**\n * Find the invalid type\n */\n const { line: lineNumber } = err.locations\n ? err.locations[0]\n : {\n line: 0\n };\n const sdlLines = sdl.split(\"\\n\");\n let sdlLine;\n let gqlType;\n for (let i = lineNumber; i > 0; i--) {\n if (sdlLine && sdlLine.includes(\"type \")) {\n gqlType = sdlLine.match(/type\\s+(.*?)\\s+{/);\n break;\n }\n\n sdlLine = sdlLines[i];\n }\n\n let invalidField: string | undefined = undefined;\n if (Array.isArray(gqlType)) {\n const fieldRegex = new RegExp(`([^\\\\s+].*?):\\\\s+\\\\[?${gqlType[1]}!?\\\\]?`);\n\n const matched = sdl.match(fieldRegex);\n if (matched) {\n invalidField = matched[1];\n }\n }\n\n let message = `See more details in the browser console.`;\n if (invalidField) {\n message = `Please review the definition of \"${invalidField}\" field.`;\n }\n\n return {\n data: {\n modelId: model.modelId,\n sdl,\n invalidField\n },\n code: \"INVALID_MODEL_DEFINITION\",\n message: [`Model \"${model.modelId}\" was not saved!`, message].join(\"\\n\")\n };\n};\n\nconst createValidateChildFields = (\n plugins: CmsModelFieldToGraphQLPlugin[]\n): CmsModelFieldToGraphQLPluginValidateChildFieldsValidate => {\n return ({ fields, originalFields }) => {\n if (fields.length === 0 && originalFields.length === 0) {\n return;\n }\n validateFields({\n fields,\n originalFields,\n plugins,\n lockedFields: []\n });\n };\n};\n\ninterface ValidateFieldsParams {\n plugins: CmsModelFieldToGraphQLPlugin[];\n fields: CmsModelField[];\n originalFields: CmsModelField[];\n lockedFields: LockedField[];\n}\n\nconst validateFields = (params: ValidateFieldsParams) => {\n const { plugins, fields, originalFields, lockedFields } = params;\n\n const idList: string[] = [];\n const fieldIdList: string[] = [];\n const storageIdList: string[] = [];\n\n for (const field of fields) {\n const baseType = getBaseFieldType(field);\n const plugin = plugins.find(plugin => plugin.fieldType === baseType);\n\n if (!plugin) {\n throw new Error(\n `Cannot update content model because of the unknown \"${baseType}\" field.`\n );\n }\n /**\n * Check the field's id against existing ones.\n * There cannot be two fields with the same id.\n */\n if (idList.includes(field.id)) {\n throw new WebinyError(\n `Cannot update content model because field \"${\n field.storageId || field.fieldId\n }\" has id \"${field.id}\", which is already used.`\n );\n }\n idList.push(field.id);\n\n const originalField = originalFields.find(f => f.id === field.id);\n /**\n * Field MUST have an fieldId defined.\n */\n if (!field.fieldId) {\n throw new WebinyError(`Field does not have an \"fieldId\" defined.`, \"MISSING_FIELD_ID\", {\n field\n });\n }\n /**\n * If storageId does not match a certain pattern, add that pattern, but only if field is not locked (used) already.\n * This is to avoid errors in the already installed systems.\n *\n * Why are we using the @?\n *\n * It is not part of special characters for the query syntax in the Lucene.\n *\n * Relevant links:\n * https://lucene.apache.org/core/3_4_0/queryparsersyntax.html\n * https://discuss.elastic.co/t/special-characters-in-field-names/10658/3\n * https://discuss.elastic.co/t/illegal-characters-in-elasticsearch-field-names/17196/2\n */\n const isLocked = lockedFields.some(lockedField => {\n return lockedField.fieldId === field.storageId || lockedField.fieldId === field.fieldId;\n });\n if (!field.storageId) {\n /**\n * In case field is locked, we must set the storageId to the fieldId value.\n * This should not happen, because we upgrade all the fields in 5.33.0, but let's have a check just in case of some upgrade miss.\n */\n //\n if (isLocked) {\n field.storageId = field.fieldId;\n }\n /**\n * When having original field, just set the storageId to value from the originalField\n */\n //\n else if (originalField) {\n field.storageId = originalField.storageId;\n }\n /**\n * The last case is when no original field and not locked - so this is a completely new field.\n */\n //\n else {\n field.storageId = createFieldStorageId(field);\n }\n }\n /**\n * Check the field's fieldId against existing ones.\n * There cannot be two fields with the same fieldId - outside world identifier.\n */\n if (fieldIdList.includes(field.fieldId)) {\n throw new WebinyError(\n `Cannot update content model because field \"${field.storageId}\" has fieldId \"${field.fieldId}\", which is already used.`\n );\n }\n fieldIdList.push(field.fieldId);\n /**\n * Check the field's storageId against the existing ones.\n * There cannot be two fields with the same storageId.\n */\n if (storageIdList.includes(field.storageId)) {\n throw new WebinyError(\n `Cannot update content model because field \"${field.label}\" has storageId \"${field.storageId}\", which is already used.`\n );\n }\n storageIdList.push(field.storageId);\n /**\n * There might be some plugins which allow child fields.\n * We use this method to validate them as well.\n */\n if (!plugin.validateChildFields) {\n continue;\n }\n const validateChildFields = createValidateChildFields(plugins);\n plugin.validateChildFields({\n field,\n originalField,\n validate: validateChildFields\n });\n }\n};\n\ninterface CreateGraphQLSchemaParams {\n context: CmsContext;\n model: CmsModel;\n}\n\nconst createGraphQLSchema = async (params: CreateGraphQLSchemaParams): Promise<any> => {\n const { context, model } = params;\n\n const models = await context.security.withoutAuthorization(async () => {\n return (await context.cms.listModels()).filter((model): model is CmsModel => {\n return model.isPrivate !== true;\n });\n });\n\n const modelPlugins = await buildSchemaPlugins({\n context,\n models: models.concat([model])\n });\n\n const plugins = context.plugins\n .byType<ICmsGraphQLSchemaPlugin>(CmsGraphQLSchemaPlugin.type)\n .reduce<Record<string, ICmsGraphQLSchemaPlugin>>((collection, plugin) => {\n const name =\n plugin.name || `${CmsGraphQLSchemaPlugin.type}-${generateAlphaNumericId(16)}`;\n collection[name] = plugin;\n return collection;\n }, {});\n for (const plugin of modelPlugins) {\n const name = plugin.name || `${plugin.type}-${generateAlphaNumericId(16)}`;\n plugins[name] = plugin;\n }\n\n return createExecutableSchema({\n plugins: Object.values(plugins)\n });\n};\n\nconst extractErrorObject = (error: any) => {\n return [\"message\", \"code\", \"data\", \"stack\"].reduce<Record<string, any>>((output, key) => {\n if (!error[key]) {\n return output;\n }\n output[key] = error[key];\n return output;\n }, {});\n};\n\ninterface ValidateModelFieldsParams {\n models: CmsModel[];\n model: CmsModel;\n original?: CmsModel;\n context: CmsContext;\n}\n\nexport const validateModelFields = async (params: ValidateModelFieldsParams): Promise<void> => {\n const { models, model, original, context } = params;\n const { titleFieldId, descriptionFieldId, imageFieldId } = model;\n const { plugins } = context;\n\n /**\n * There should be fields/locked fields in either model or data to be updated.\n */\n const { fields = [], lockedFields = [] } = model;\n\n /**\n * Let's inspect the fields of the received content model. We prevent saving of a content model if it\n * contains a field for which a \"cms-model-field-to-graphql\" plugin does not exist on the backend.\n */\n const fieldTypePlugins = plugins.byType<CmsModelFieldToGraphQLPlugin>(\n \"cms-model-field-to-graphql\"\n );\n\n validateFields({\n fields,\n originalFields: original?.fields || [],\n lockedFields,\n plugins: fieldTypePlugins\n });\n\n if (fields.length) {\n const sorterPlugins = plugins.byType<CmsGraphQLSchemaSorterPlugin>(\n CmsGraphQLSchemaSorterPlugin.type\n );\n /**\n * Make sure that this model can be safely converted to a GraphQL SDL\n */\n const schema = createManageSDL({\n models,\n model,\n fieldTypePlugins: fieldTypePlugins.reduce(\n (acc, pl) => ({ ...acc, [pl.fieldType]: pl }),\n {}\n ),\n sorterPlugins\n });\n\n try {\n gql(schema);\n } catch (err) {\n throw new WebinyError(extractInvalidField(model, err));\n }\n /**\n *\n */\n try {\n await createGraphQLSchema({\n context,\n model\n });\n } catch (err) {\n throw new WebinyError({\n message:\n \"Cannot generate GraphQL schema when testing with the given model. Please check the response for more details.\",\n code: \"GRAPHQL_SCHEMA_ERROR\",\n data: {\n modelId: model.modelId,\n error: extractErrorObject(err)\n }\n });\n }\n }\n\n model.titleFieldId = getContentModelTitleFieldId(fields, titleFieldId);\n model.descriptionFieldId = getContentModelDescriptionFieldId(fields, descriptionFieldId);\n model.imageFieldId = getContentModelImageFieldId(fields, imageFieldId);\n\n const cmsLockedFieldPlugins =\n plugins.byType<CmsModelLockedFieldPlugin>(\"cms-model-locked-field\");\n\n /**\n * We must not allow removal or changes in fields that are already in use in content entries.\n * Locked fields still have fieldId (should be storageId) because of the old existing locked fields in the models.\n */\n for (const lockedField of lockedFields) {\n const existingField = fields.find(item => item.storageId === lockedField.fieldId);\n\n /**\n * Starting with 5.33.0 fields can be deleted.\n * Our UI gives a warning upon locked field deletion, but if user is managing fields through API directly - we cannot do anything.\n */\n if (!existingField) {\n continue;\n }\n\n if (Boolean(lockedField.multipleValues) !== Boolean(existingField.multipleValues)) {\n throw new WebinyError(\n `Cannot change \"multipleValues\" for the \"${lockedField.fieldId}\" field because it's already in use in created content.`,\n \"ENTRY_FIELD_USED\",\n {\n reason: `\"multipleValues\" changed`,\n field: existingField\n }\n );\n }\n\n const fieldType = getBaseFieldType(existingField);\n if (lockedField.type !== fieldType) {\n throw new WebinyError(\n `Cannot change field type for the \"${lockedField.fieldId}\" field because it's already in use in created content.`,\n \"ENTRY_FIELD_USED\",\n {\n reason: `\"type\" changed`,\n lockedFieldType: lockedField.type,\n existingFieldType: fieldType\n }\n );\n }\n\n /**\n * Check `lockedField` invariant for specific field\n */\n const lockedFieldsByType = cmsLockedFieldPlugins.filter(\n pl => pl.fieldType === getBaseFieldType(lockedField)\n );\n for (const plugin of lockedFieldsByType) {\n if (typeof plugin.checkLockedField !== \"function\") {\n continue;\n }\n plugin.checkLockedField({\n lockedField,\n field: existingField\n });\n }\n }\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAF,sBAAA,CAAAC,OAAA;AAUA,IAAAE,gBAAA,GAAAF,OAAA;AACA,IAAAG,qBAAA,GAAAH,OAAA;AAEA,IAAAI,iBAAA,GAAAJ,OAAA;AACA,IAAAK,WA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;MACvB,CACJ,CAAC;IACL;;IAEA;AACR;AACA;IACQ,MAAMkE,kBAAkB,GAAGR,qBAAqB,CAACnC,MAAM,CACnD8B,EAAE,IAAIA,EAAE,CAACrD,SAAS,KAAK,IAAAH,kCAAgB,EAACc,WAAW,CACvD,CAAC;IACD,KAAK,MAAMb,MAAM,IAAIoE,kBAAkB,EAAE;MACrC,IAAI,OAAOpE,MAAM,CAACqE,gBAAgB,KAAK,UAAU,EAAE;QAC/C;MACJ;MACArE,MAAM,CAACqE,gBAAgB,CAAC;QACpBxD,WAAW;QACXhB,KAAK,EAAEgE;MACX,CAAC,CAAC;IACN;EACJ;AACJ,CAAC;AAACS,OAAA,CAAA1B,mBAAA,GAAAA,mBAAA","ignoreList":[]}
@@ -0,0 +1 @@
1
+ export declare const validateStorageId: (storageId: string) => void;
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.validateStorageId = void 0;
8
+ var _camelCase = _interopRequireDefault(require("lodash/camelCase"));
9
+ var _error = _interopRequireDefault(require("@webiny/error"));
10
+ // We allow "@" because that's we use it with the `createModelField` function.
11
+ const VALID_STORAGE_ID_REGEX = /^([@a-zA-Z-0-9]+)$/;
12
+ const validateStorageId = storageId => {
13
+ if (!storageId.match(VALID_STORAGE_ID_REGEX)) {
14
+ const message = [`Invalid storageId provided ("${storageId}").`, 'Only alphanumeric characters and "@" are allowed.'].join(" ");
15
+ throw new _error.default(message, "STORAGE_ID_NOT_ALPHANUMERIC_ERROR");
16
+ }
17
+
18
+ // We must do this because in the process of camel casing, Lodash removes the `@`
19
+ // character from the string. For example, if we received `text@productName`, we
20
+ // would be doing the `text@productName` vs. `textProductName` (camel cased) comparison.
21
+ storageId = storageId.replace("@", "");
22
+ if (storageId !== (0, _camelCase.default)(storageId)) {
23
+ const message = [`Invalid storageId provided ("${storageId}").`, "Must be a camelCased string."].join(" ");
24
+ throw new _error.default(message, "STORAGE_ID_NOT_CAMEL_CASED_ERROR");
25
+ }
26
+ };
27
+ exports.validateStorageId = validateStorageId;
28
+
29
+ //# sourceMappingURL=validateStorageId.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_camelCase","_interopRequireDefault","require","_error","VALID_STORAGE_ID_REGEX","validateStorageId","storageId","match","message","join","WebinyError","replace","lodashCamelCase","exports"],"sources":["validateStorageId.ts"],"sourcesContent":["import lodashCamelCase from \"lodash/camelCase\";\nimport WebinyError from \"@webiny/error\";\n\n// We allow \"@\" because that's we use it with the `createModelField` function.\nconst VALID_STORAGE_ID_REGEX = /^([@a-zA-Z-0-9]+)$/;\n\nexport const validateStorageId = (storageId: string) => {\n if (!storageId.match(VALID_STORAGE_ID_REGEX)) {\n const message = [\n `Invalid storageId provided (\"${storageId}\").`,\n 'Only alphanumeric characters and \"@\" are allowed.'\n ].join(\" \");\n\n throw new WebinyError(message, \"STORAGE_ID_NOT_ALPHANUMERIC_ERROR\");\n }\n\n // We must do this because in the process of camel casing, Lodash removes the `@`\n // character from the string. For example, if we received `text@productName`, we\n // would be doing the `text@productName` vs. `textProductName` (camel cased) comparison.\n storageId = storageId.replace(\"@\", \"\");\n\n if (storageId !== lodashCamelCase(storageId)) {\n const message = [\n `Invalid storageId provided (\"${storageId}\").`,\n \"Must be a camelCased string.\"\n ].join(\" \");\n\n throw new WebinyError(message, \"STORAGE_ID_NOT_CAMEL_CASED_ERROR\");\n }\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,UAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAF,sBAAA,CAAAC,OAAA;AAEA;AACA,MAAME,sBAAsB,GAAG,oBAAoB;AAE5C,MAAMC,iBAAiB,GAAIC,SAAiB,IAAK;EACpD,IAAI,CAACA,SAAS,CAACC,KAAK,CAACH,sBAAsB,CAAC,EAAE;IAC1C,MAAMI,OAAO,GAAG,CACX,gCAA+BF,SAAU,KAAI,EAC9C,mDAAmD,CACtD,CAACG,IAAI,CAAC,GAAG,CAAC;IAEX,MAAM,IAAIC,cAAW,CAACF,OAAO,EAAE,mCAAmC,CAAC;EACvE;;EAEA;EACA;EACA;EACAF,SAAS,GAAGA,SAAS,CAACK,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC;EAEtC,IAAIL,SAAS,KAAK,IAAAM,kBAAe,EAACN,SAAS,CAAC,EAAE;IAC1C,MAAME,OAAO,GAAG,CACX,gCAA+BF,SAAU,KAAI,EAC9C,8BAA8B,CACjC,CAACG,IAAI,CAAC,GAAG,CAAC;IAEX,MAAM,IAAIC,cAAW,CAACF,OAAO,EAAE,kCAAkC,CAAC;EACtE;AACJ,CAAC;AAACK,OAAA,CAAAR,iBAAA,GAAAA,iBAAA","ignoreList":[]}
@@ -47,13 +47,16 @@ export declare const createModelCreateValidation: () => zod.ZodObject<{
47
47
  selected?: boolean | undefined;
48
48
  }[] | undefined;
49
49
  }>>>;
50
- renderer: zod.ZodOptional<zod.ZodObject<{
50
+ renderer: zod.ZodDefault<zod.ZodNullable<zod.ZodOptional<zod.ZodObject<{
51
51
  name: zod.ZodString;
52
+ settings: zod.ZodOptional<zod.ZodNullable<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>>;
52
53
  }, "strip", zod.ZodTypeAny, {
53
54
  name: string;
55
+ settings?: zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough"> | null | undefined;
54
56
  }, {
55
57
  name: string;
56
- }>>;
58
+ settings?: zod.objectInputType<{}, zod.ZodTypeAny, "passthrough"> | null | undefined;
59
+ }>>>>;
57
60
  validation: zod.ZodEffects<zod.ZodDefault<zod.ZodOptional<zod.ZodOptional<zod.ZodNullable<zod.ZodArray<zod.ZodObject<{
58
61
  name: zod.ZodString;
59
62
  message: zod.ZodDefault<zod.ZodOptional<zod.ZodString>>;
@@ -113,6 +116,10 @@ export declare const createModelCreateValidation: () => zod.ZodObject<{
113
116
  label: string;
114
117
  helpText: string | null;
115
118
  placeholderText: string | null;
119
+ renderer: {
120
+ name: string;
121
+ settings?: zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough"> | null | undefined;
122
+ } | null;
116
123
  validation: {
117
124
  name: string;
118
125
  settings: {} & {
@@ -140,9 +147,6 @@ export declare const createModelCreateValidation: () => zod.ZodObject<{
140
147
  }[];
141
148
  enabled: boolean;
142
149
  } | undefined;
143
- renderer?: {
144
- name: string;
145
- } | undefined;
146
150
  }, {
147
151
  id: string;
148
152
  type: string;
@@ -163,7 +167,8 @@ export declare const createModelCreateValidation: () => zod.ZodObject<{
163
167
  } | undefined;
164
168
  renderer?: {
165
169
  name: string;
166
- } | undefined;
170
+ settings?: zod.objectInputType<{}, zod.ZodTypeAny, "passthrough"> | null | undefined;
171
+ } | null | undefined;
167
172
  validation?: {
168
173
  name: string;
169
174
  message?: string | undefined;
@@ -192,6 +197,10 @@ export declare const createModelCreateValidation: () => zod.ZodObject<{
192
197
  label: string;
193
198
  helpText: string | null;
194
199
  placeholderText: string | null;
200
+ renderer: {
201
+ name: string;
202
+ settings?: zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough"> | null | undefined;
203
+ } | null;
195
204
  validation: {
196
205
  name: string;
197
206
  settings: {} & {
@@ -219,9 +228,6 @@ export declare const createModelCreateValidation: () => zod.ZodObject<{
219
228
  }[];
220
229
  enabled: boolean;
221
230
  } | undefined;
222
- renderer?: {
223
- name: string;
224
- } | undefined;
225
231
  }[];
226
232
  layout: string[][];
227
233
  singularApiName: string;
@@ -263,7 +269,8 @@ export declare const createModelCreateValidation: () => zod.ZodObject<{
263
269
  } | undefined;
264
270
  renderer?: {
265
271
  name: string;
266
- } | undefined;
272
+ settings?: zod.objectInputType<{}, zod.ZodTypeAny, "passthrough"> | null | undefined;
273
+ } | null | undefined;
267
274
  validation?: {
268
275
  name: string;
269
276
  message?: string | undefined;
@@ -331,13 +338,16 @@ export declare const createModelImportValidation: () => zod.ZodObject<{
331
338
  selected?: boolean | undefined;
332
339
  }[] | undefined;
333
340
  }>>>;
334
- renderer: zod.ZodOptional<zod.ZodObject<{
341
+ renderer: zod.ZodDefault<zod.ZodNullable<zod.ZodOptional<zod.ZodObject<{
335
342
  name: zod.ZodString;
343
+ settings: zod.ZodOptional<zod.ZodNullable<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>>;
336
344
  }, "strip", zod.ZodTypeAny, {
337
345
  name: string;
346
+ settings?: zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough"> | null | undefined;
338
347
  }, {
339
348
  name: string;
340
- }>>;
349
+ settings?: zod.objectInputType<{}, zod.ZodTypeAny, "passthrough"> | null | undefined;
350
+ }>>>>;
341
351
  validation: zod.ZodEffects<zod.ZodDefault<zod.ZodOptional<zod.ZodOptional<zod.ZodNullable<zod.ZodArray<zod.ZodObject<{
342
352
  name: zod.ZodString;
343
353
  message: zod.ZodDefault<zod.ZodOptional<zod.ZodString>>;
@@ -397,6 +407,10 @@ export declare const createModelImportValidation: () => zod.ZodObject<{
397
407
  label: string;
398
408
  helpText: string | null;
399
409
  placeholderText: string | null;
410
+ renderer: {
411
+ name: string;
412
+ settings?: zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough"> | null | undefined;
413
+ } | null;
400
414
  validation: {
401
415
  name: string;
402
416
  settings: {} & {
@@ -424,9 +438,6 @@ export declare const createModelImportValidation: () => zod.ZodObject<{
424
438
  }[];
425
439
  enabled: boolean;
426
440
  } | undefined;
427
- renderer?: {
428
- name: string;
429
- } | undefined;
430
441
  }, {
431
442
  id: string;
432
443
  type: string;
@@ -447,7 +458,8 @@ export declare const createModelImportValidation: () => zod.ZodObject<{
447
458
  } | undefined;
448
459
  renderer?: {
449
460
  name: string;
450
- } | undefined;
461
+ settings?: zod.objectInputType<{}, zod.ZodTypeAny, "passthrough"> | null | undefined;
462
+ } | null | undefined;
451
463
  validation?: {
452
464
  name: string;
453
465
  message?: string | undefined;
@@ -475,6 +487,10 @@ export declare const createModelImportValidation: () => zod.ZodObject<{
475
487
  label: string;
476
488
  helpText: string | null;
477
489
  placeholderText: string | null;
490
+ renderer: {
491
+ name: string;
492
+ settings?: zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough"> | null | undefined;
493
+ } | null;
478
494
  validation: {
479
495
  name: string;
480
496
  settings: {} & {
@@ -502,9 +518,6 @@ export declare const createModelImportValidation: () => zod.ZodObject<{
502
518
  }[];
503
519
  enabled: boolean;
504
520
  } | undefined;
505
- renderer?: {
506
- name: string;
507
- } | undefined;
508
521
  }[];
509
522
  layout: string[][];
510
523
  singularApiName: string;
@@ -539,7 +552,8 @@ export declare const createModelImportValidation: () => zod.ZodObject<{
539
552
  } | undefined;
540
553
  renderer?: {
541
554
  name: string;
542
- } | undefined;
555
+ settings?: zod.objectInputType<{}, zod.ZodTypeAny, "passthrough"> | null | undefined;
556
+ } | null | undefined;
543
557
  validation?: {
544
558
  name: string;
545
559
  message?: string | undefined;
@@ -639,13 +653,16 @@ export declare const createModelUpdateValidation: () => zod.ZodObject<{
639
653
  selected?: boolean | undefined;
640
654
  }[] | undefined;
641
655
  }>>>;
642
- renderer: zod.ZodOptional<zod.ZodObject<{
656
+ renderer: zod.ZodDefault<zod.ZodNullable<zod.ZodOptional<zod.ZodObject<{
643
657
  name: zod.ZodString;
658
+ settings: zod.ZodOptional<zod.ZodNullable<zod.ZodObject<{}, "passthrough", zod.ZodTypeAny, zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough">, zod.objectInputType<{}, zod.ZodTypeAny, "passthrough">>>>;
644
659
  }, "strip", zod.ZodTypeAny, {
645
660
  name: string;
661
+ settings?: zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough"> | null | undefined;
646
662
  }, {
647
663
  name: string;
648
- }>>;
664
+ settings?: zod.objectInputType<{}, zod.ZodTypeAny, "passthrough"> | null | undefined;
665
+ }>>>>;
649
666
  validation: zod.ZodEffects<zod.ZodDefault<zod.ZodOptional<zod.ZodOptional<zod.ZodNullable<zod.ZodArray<zod.ZodObject<{
650
667
  name: zod.ZodString;
651
668
  message: zod.ZodDefault<zod.ZodOptional<zod.ZodString>>;
@@ -705,6 +722,10 @@ export declare const createModelUpdateValidation: () => zod.ZodObject<{
705
722
  label: string;
706
723
  helpText: string | null;
707
724
  placeholderText: string | null;
725
+ renderer: {
726
+ name: string;
727
+ settings?: zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough"> | null | undefined;
728
+ } | null;
708
729
  validation: {
709
730
  name: string;
710
731
  settings: {} & {
@@ -732,9 +753,6 @@ export declare const createModelUpdateValidation: () => zod.ZodObject<{
732
753
  }[];
733
754
  enabled: boolean;
734
755
  } | undefined;
735
- renderer?: {
736
- name: string;
737
- } | undefined;
738
756
  }, {
739
757
  id: string;
740
758
  type: string;
@@ -755,7 +773,8 @@ export declare const createModelUpdateValidation: () => zod.ZodObject<{
755
773
  } | undefined;
756
774
  renderer?: {
757
775
  name: string;
758
- } | undefined;
776
+ settings?: zod.objectInputType<{}, zod.ZodTypeAny, "passthrough"> | null | undefined;
777
+ } | null | undefined;
759
778
  validation?: {
760
779
  name: string;
761
780
  message?: string | undefined;
@@ -782,6 +801,10 @@ export declare const createModelUpdateValidation: () => zod.ZodObject<{
782
801
  label: string;
783
802
  helpText: string | null;
784
803
  placeholderText: string | null;
804
+ renderer: {
805
+ name: string;
806
+ settings?: zod.objectOutputType<{}, zod.ZodTypeAny, "passthrough"> | null | undefined;
807
+ } | null;
785
808
  validation: {
786
809
  name: string;
787
810
  settings: {} & {
@@ -809,9 +832,6 @@ export declare const createModelUpdateValidation: () => zod.ZodObject<{
809
832
  }[];
810
833
  enabled: boolean;
811
834
  } | undefined;
812
- renderer?: {
813
- name: string;
814
- } | undefined;
815
835
  }[];
816
836
  layout: string[][];
817
837
  name?: string | undefined;
@@ -845,7 +865,8 @@ export declare const createModelUpdateValidation: () => zod.ZodObject<{
845
865
  } | undefined;
846
866
  renderer?: {
847
867
  name: string;
848
- } | undefined;
868
+ settings?: zod.objectInputType<{}, zod.ZodTypeAny, "passthrough"> | null | undefined;
869
+ } | null | undefined;
849
870
  validation?: {
850
871
  name: string;
851
872
  message?: string | undefined;
@@ -51,8 +51,9 @@ const fieldSchema = _zod.default.object({
51
51
  values: []
52
52
  }).optional(),
53
53
  renderer: _zod.default.object({
54
- name: shortString
55
- }).optional(),
54
+ name: shortString,
55
+ settings: _zod.default.object({}).passthrough().nullable().optional()
56
+ }).optional().nullable().default(null),
56
57
  validation: _zod.default.array(_zod.default.object({
57
58
  name: shortString,
58
59
  message: optionalShortString.default("Value is required."),