@webiny/api-headless-cms 6.0.0-alpha.0 → 6.0.0-alpha.2

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 (563) hide show
  1. package/constants.d.ts +1 -1
  2. package/constants.js.map +1 -1
  3. package/context.d.ts +1 -1
  4. package/context.js.map +1 -1
  5. package/crud/AccessControl/AccessControl.d.ts +2 -2
  6. package/crud/AccessControl/AccessControl.js.map +1 -1
  7. package/crud/contentEntry/abstractions/IDeleteEntry.d.ts +1 -1
  8. package/crud/contentEntry/abstractions/IDeleteEntry.js.map +1 -1
  9. package/crud/contentEntry/abstractions/IDeleteEntryOperation.d.ts +1 -1
  10. package/crud/contentEntry/abstractions/IDeleteEntryOperation.js.map +1 -1
  11. package/crud/contentEntry/abstractions/IGetEntriesByIds.d.ts +1 -1
  12. package/crud/contentEntry/abstractions/IGetEntriesByIds.js.map +1 -1
  13. package/crud/contentEntry/abstractions/IGetEntry.d.ts +1 -1
  14. package/crud/contentEntry/abstractions/IGetEntry.js.map +1 -1
  15. package/crud/contentEntry/abstractions/IGetLatestEntriesByIds.d.ts +1 -1
  16. package/crud/contentEntry/abstractions/IGetLatestEntriesByIds.js.map +1 -1
  17. package/crud/contentEntry/abstractions/IGetLatestRevisionByEntryId.d.ts +1 -1
  18. package/crud/contentEntry/abstractions/IGetLatestRevisionByEntryId.js.map +1 -1
  19. package/crud/contentEntry/abstractions/IGetPreviousRevisionByEntryId.d.ts +1 -1
  20. package/crud/contentEntry/abstractions/IGetPreviousRevisionByEntryId.js.map +1 -1
  21. package/crud/contentEntry/abstractions/IGetPublishedEntriesByIds.d.ts +1 -1
  22. package/crud/contentEntry/abstractions/IGetPublishedEntriesByIds.js.map +1 -1
  23. package/crud/contentEntry/abstractions/IGetPublishedRevisionByEntryId.d.ts +1 -1
  24. package/crud/contentEntry/abstractions/IGetPublishedRevisionByEntryId.js.map +1 -1
  25. package/crud/contentEntry/abstractions/IGetRevisionById.d.ts +1 -1
  26. package/crud/contentEntry/abstractions/IGetRevisionById.js.map +1 -1
  27. package/crud/contentEntry/abstractions/IGetRevisionsByEntryId.d.ts +1 -1
  28. package/crud/contentEntry/abstractions/IGetRevisionsByEntryId.js.map +1 -1
  29. package/crud/contentEntry/abstractions/IListEntries.d.ts +1 -1
  30. package/crud/contentEntry/abstractions/IListEntries.js.map +1 -1
  31. package/crud/contentEntry/abstractions/IListEntriesOperation.d.ts +1 -1
  32. package/crud/contentEntry/abstractions/IListEntriesOperation.js.map +1 -1
  33. package/crud/contentEntry/abstractions/IMoveEntryToBinOperation.d.ts +1 -1
  34. package/crud/contentEntry/abstractions/IMoveEntryToBinOperation.js.map +1 -1
  35. package/crud/contentEntry/abstractions/IRestoreEntryFromBin.d.ts +1 -1
  36. package/crud/contentEntry/abstractions/IRestoreEntryFromBin.js.map +1 -1
  37. package/crud/contentEntry/abstractions/IRestoreEntryFromBinOperation.d.ts +1 -1
  38. package/crud/contentEntry/abstractions/IRestoreEntryFromBinOperation.js.map +1 -1
  39. package/crud/contentEntry/afterDelete.d.ts +2 -2
  40. package/crud/contentEntry/afterDelete.js.map +1 -1
  41. package/crud/contentEntry/beforeCreate.d.ts +2 -2
  42. package/crud/contentEntry/beforeCreate.js.map +1 -1
  43. package/crud/contentEntry/beforeUpdate.d.ts +2 -2
  44. package/crud/contentEntry/beforeUpdate.js.map +1 -1
  45. package/crud/contentEntry/entryDataFactories/createEntryData.d.ts +5 -5
  46. package/crud/contentEntry/entryDataFactories/createEntryData.js.map +1 -1
  47. package/crud/contentEntry/entryDataFactories/createEntryRevisionFromData.d.ts +5 -5
  48. package/crud/contentEntry/entryDataFactories/createEntryRevisionFromData.js.map +1 -1
  49. package/crud/contentEntry/entryDataFactories/createPublishEntryData.d.ts +4 -4
  50. package/crud/contentEntry/entryDataFactories/createPublishEntryData.js.map +1 -1
  51. package/crud/contentEntry/entryDataFactories/createRepublishEntryData.d.ts +2 -2
  52. package/crud/contentEntry/entryDataFactories/createRepublishEntryData.js.map +1 -1
  53. package/crud/contentEntry/entryDataFactories/createUnpublishEntryData.d.ts +4 -4
  54. package/crud/contentEntry/entryDataFactories/createUnpublishEntryData.js.map +1 -1
  55. package/crud/contentEntry/entryDataFactories/createUpdateEntryData.d.ts +4 -4
  56. package/crud/contentEntry/entryDataFactories/createUpdateEntryData.js.map +1 -1
  57. package/crud/contentEntry/entryDataFactories/mapAndCleanUpdatedInputData.d.ts +1 -1
  58. package/crud/contentEntry/entryDataFactories/mapAndCleanUpdatedInputData.js.map +1 -1
  59. package/crud/contentEntry/entryDataValidation.d.ts +1 -1
  60. package/crud/contentEntry/entryDataValidation.js.map +1 -1
  61. package/crud/contentEntry/markLockedFields.d.ts +1 -1
  62. package/crud/contentEntry/markLockedFields.js.map +1 -1
  63. package/crud/contentEntry/referenceFieldsMapping.d.ts +1 -1
  64. package/crud/contentEntry/referenceFieldsMapping.js.map +1 -1
  65. package/crud/contentEntry/searchableFields.d.ts +2 -2
  66. package/crud/contentEntry/searchableFields.js.map +1 -1
  67. package/crud/contentEntry/useCases/DeleteEntry/DeleteEntry.d.ts +3 -3
  68. package/crud/contentEntry/useCases/DeleteEntry/DeleteEntry.js.map +1 -1
  69. package/crud/contentEntry/useCases/DeleteEntry/DeleteEntryOperation.d.ts +2 -2
  70. package/crud/contentEntry/useCases/DeleteEntry/DeleteEntryOperation.js.map +1 -1
  71. package/crud/contentEntry/useCases/DeleteEntry/DeleteEntryOperationWithEvents.d.ts +3 -3
  72. package/crud/contentEntry/useCases/DeleteEntry/DeleteEntryOperationWithEvents.js.map +1 -1
  73. package/crud/contentEntry/useCases/DeleteEntry/DeleteEntrySecure.d.ts +3 -3
  74. package/crud/contentEntry/useCases/DeleteEntry/DeleteEntrySecure.js.map +1 -1
  75. package/crud/contentEntry/useCases/DeleteEntry/MoveEntryToBin.d.ts +3 -3
  76. package/crud/contentEntry/useCases/DeleteEntry/MoveEntryToBin.js.map +1 -1
  77. package/crud/contentEntry/useCases/DeleteEntry/MoveEntryToBinOperation.d.ts +2 -2
  78. package/crud/contentEntry/useCases/DeleteEntry/MoveEntryToBinOperation.js.map +1 -1
  79. package/crud/contentEntry/useCases/DeleteEntry/MoveEntryToBinOperationWithEvents.d.ts +3 -3
  80. package/crud/contentEntry/useCases/DeleteEntry/MoveEntryToBinOperationWithEvents.js.map +1 -1
  81. package/crud/contentEntry/useCases/DeleteEntry/TransformEntryDelete.d.ts +1 -1
  82. package/crud/contentEntry/useCases/DeleteEntry/TransformEntryDelete.js.map +1 -1
  83. package/crud/contentEntry/useCases/DeleteEntry/TransformEntryMoveToBin.d.ts +2 -2
  84. package/crud/contentEntry/useCases/DeleteEntry/TransformEntryMoveToBin.js.map +1 -1
  85. package/crud/contentEntry/useCases/DeleteEntry/index.d.ts +5 -5
  86. package/crud/contentEntry/useCases/DeleteEntry/index.js.map +1 -1
  87. package/crud/contentEntry/useCases/GetEntriesByIds/GetEntriesByIds.d.ts +7 -5
  88. package/crud/contentEntry/useCases/GetEntriesByIds/GetEntriesByIds.js +6 -2
  89. package/crud/contentEntry/useCases/GetEntriesByIds/GetEntriesByIds.js.map +1 -1
  90. package/crud/contentEntry/useCases/GetEntriesByIds/GetEntriesByIdsNotDeleted.d.ts +2 -2
  91. package/crud/contentEntry/useCases/GetEntriesByIds/GetEntriesByIdsNotDeleted.js.map +1 -1
  92. package/crud/contentEntry/useCases/GetEntriesByIds/GetEntriesByIdsSecure.d.ts +3 -3
  93. package/crud/contentEntry/useCases/GetEntriesByIds/GetEntriesByIdsSecure.js.map +1 -1
  94. package/crud/contentEntry/useCases/GetEntriesByIds/index.d.ts +4 -2
  95. package/crud/contentEntry/useCases/GetEntriesByIds/index.js +1 -1
  96. package/crud/contentEntry/useCases/GetEntriesByIds/index.js.map +1 -1
  97. package/crud/contentEntry/useCases/GetLatestEntriesByIds/GetLatestEntriesByIds.d.ts +7 -5
  98. package/crud/contentEntry/useCases/GetLatestEntriesByIds/GetLatestEntriesByIds.js +6 -2
  99. package/crud/contentEntry/useCases/GetLatestEntriesByIds/GetLatestEntriesByIds.js.map +1 -1
  100. package/crud/contentEntry/useCases/GetLatestEntriesByIds/GetLatestEntriesByIdsNotDeleted.d.ts +2 -2
  101. package/crud/contentEntry/useCases/GetLatestEntriesByIds/GetLatestEntriesByIdsNotDeleted.js.map +1 -1
  102. package/crud/contentEntry/useCases/GetLatestEntriesByIds/GetLatestEntriesByIdsSecure.d.ts +3 -3
  103. package/crud/contentEntry/useCases/GetLatestEntriesByIds/GetLatestEntriesByIdsSecure.js.map +1 -1
  104. package/crud/contentEntry/useCases/GetLatestEntriesByIds/index.d.ts +4 -2
  105. package/crud/contentEntry/useCases/GetLatestEntriesByIds/index.js +1 -1
  106. package/crud/contentEntry/useCases/GetLatestEntriesByIds/index.js.map +1 -1
  107. package/crud/contentEntry/useCases/GetLatestRevisionByEntryId/GetLatestRevisionByEntryId.d.ts +7 -5
  108. package/crud/contentEntry/useCases/GetLatestRevisionByEntryId/GetLatestRevisionByEntryId.js +7 -2
  109. package/crud/contentEntry/useCases/GetLatestRevisionByEntryId/GetLatestRevisionByEntryId.js.map +1 -1
  110. package/crud/contentEntry/useCases/GetLatestRevisionByEntryId/GetLatestRevisionByEntryIdDeleted.d.ts +2 -2
  111. package/crud/contentEntry/useCases/GetLatestRevisionByEntryId/GetLatestRevisionByEntryIdDeleted.js.map +1 -1
  112. package/crud/contentEntry/useCases/GetLatestRevisionByEntryId/GetLatestRevisionByEntryIdNotDeleted.d.ts +2 -2
  113. package/crud/contentEntry/useCases/GetLatestRevisionByEntryId/GetLatestRevisionByEntryIdNotDeleted.js.map +1 -1
  114. package/crud/contentEntry/useCases/GetLatestRevisionByEntryId/index.d.ts +3 -1
  115. package/crud/contentEntry/useCases/GetLatestRevisionByEntryId/index.js +1 -1
  116. package/crud/contentEntry/useCases/GetLatestRevisionByEntryId/index.js.map +1 -1
  117. package/crud/contentEntry/useCases/GetPreviousRevisionByEntryId/GetPreviousRevisionByEntryId.d.ts +7 -5
  118. package/crud/contentEntry/useCases/GetPreviousRevisionByEntryId/GetPreviousRevisionByEntryId.js +7 -2
  119. package/crud/contentEntry/useCases/GetPreviousRevisionByEntryId/GetPreviousRevisionByEntryId.js.map +1 -1
  120. package/crud/contentEntry/useCases/GetPreviousRevisionByEntryId/GetPreviousRevisionByEntryIdNotDeleted.d.ts +2 -2
  121. package/crud/contentEntry/useCases/GetPreviousRevisionByEntryId/GetPreviousRevisionByEntryIdNotDeleted.js.map +1 -1
  122. package/crud/contentEntry/useCases/GetPreviousRevisionByEntryId/index.d.ts +3 -1
  123. package/crud/contentEntry/useCases/GetPreviousRevisionByEntryId/index.js +1 -1
  124. package/crud/contentEntry/useCases/GetPreviousRevisionByEntryId/index.js.map +1 -1
  125. package/crud/contentEntry/useCases/GetPublishedEntriesByIds/GetPublishedEntriesByIds.d.ts +7 -5
  126. package/crud/contentEntry/useCases/GetPublishedEntriesByIds/GetPublishedEntriesByIds.js +6 -2
  127. package/crud/contentEntry/useCases/GetPublishedEntriesByIds/GetPublishedEntriesByIds.js.map +1 -1
  128. package/crud/contentEntry/useCases/GetPublishedEntriesByIds/GetPublishedEntriesByIdsNotDeleted.d.ts +2 -2
  129. package/crud/contentEntry/useCases/GetPublishedEntriesByIds/GetPublishedEntriesByIdsNotDeleted.js.map +1 -1
  130. package/crud/contentEntry/useCases/GetPublishedEntriesByIds/GetPublishedEntriesByIdsSecure.d.ts +3 -3
  131. package/crud/contentEntry/useCases/GetPublishedEntriesByIds/GetPublishedEntriesByIdsSecure.js.map +1 -1
  132. package/crud/contentEntry/useCases/GetPublishedEntriesByIds/index.d.ts +4 -2
  133. package/crud/contentEntry/useCases/GetPublishedEntriesByIds/index.js +1 -1
  134. package/crud/contentEntry/useCases/GetPublishedEntriesByIds/index.js.map +1 -1
  135. package/crud/contentEntry/useCases/GetPublishedRevisionByEntryId/GetPublishedRevisionByEntryId.d.ts +7 -5
  136. package/crud/contentEntry/useCases/GetPublishedRevisionByEntryId/GetPublishedRevisionByEntryId.js +7 -2
  137. package/crud/contentEntry/useCases/GetPublishedRevisionByEntryId/GetPublishedRevisionByEntryId.js.map +1 -1
  138. package/crud/contentEntry/useCases/GetPublishedRevisionByEntryId/GetPublishedRevisionByEntryIdNotDeleted.d.ts +2 -2
  139. package/crud/contentEntry/useCases/GetPublishedRevisionByEntryId/GetPublishedRevisionByEntryIdNotDeleted.js.map +1 -1
  140. package/crud/contentEntry/useCases/GetPublishedRevisionByEntryId/index.d.ts +3 -1
  141. package/crud/contentEntry/useCases/GetPublishedRevisionByEntryId/index.js +1 -1
  142. package/crud/contentEntry/useCases/GetPublishedRevisionByEntryId/index.js.map +1 -1
  143. package/crud/contentEntry/useCases/GetRevisionById/GetRevisionById.d.ts +7 -5
  144. package/crud/contentEntry/useCases/GetRevisionById/GetRevisionById.js +7 -2
  145. package/crud/contentEntry/useCases/GetRevisionById/GetRevisionById.js.map +1 -1
  146. package/crud/contentEntry/useCases/GetRevisionById/GetRevisionByIdNotDeleted.d.ts +2 -2
  147. package/crud/contentEntry/useCases/GetRevisionById/GetRevisionByIdNotDeleted.js.map +1 -1
  148. package/crud/contentEntry/useCases/GetRevisionById/index.d.ts +3 -1
  149. package/crud/contentEntry/useCases/GetRevisionById/index.js +1 -1
  150. package/crud/contentEntry/useCases/GetRevisionById/index.js.map +1 -1
  151. package/crud/contentEntry/useCases/GetRevisionsByEntryId/GetRevisionsByEntryId.d.ts +7 -5
  152. package/crud/contentEntry/useCases/GetRevisionsByEntryId/GetRevisionsByEntryId.js +6 -2
  153. package/crud/contentEntry/useCases/GetRevisionsByEntryId/GetRevisionsByEntryId.js.map +1 -1
  154. package/crud/contentEntry/useCases/GetRevisionsByEntryId/GetRevisionsByEntryIdNotDeleted.d.ts +2 -2
  155. package/crud/contentEntry/useCases/GetRevisionsByEntryId/GetRevisionsByEntryIdNotDeleted.js.map +1 -1
  156. package/crud/contentEntry/useCases/GetRevisionsByEntryId/index.d.ts +4 -2
  157. package/crud/contentEntry/useCases/GetRevisionsByEntryId/index.js +1 -1
  158. package/crud/contentEntry/useCases/GetRevisionsByEntryId/index.js.map +1 -1
  159. package/crud/contentEntry/useCases/ListEntries/GetEntry.d.ts +2 -2
  160. package/crud/contentEntry/useCases/ListEntries/GetEntry.js.map +1 -1
  161. package/crud/contentEntry/useCases/ListEntries/GetEntrySecure.d.ts +4 -4
  162. package/crud/contentEntry/useCases/ListEntries/GetEntrySecure.js.map +1 -1
  163. package/crud/contentEntry/useCases/ListEntries/ListEntries.d.ts +2 -2
  164. package/crud/contentEntry/useCases/ListEntries/ListEntries.js.map +1 -1
  165. package/crud/contentEntry/useCases/ListEntries/ListEntriesOperation.d.ts +12 -5
  166. package/crud/contentEntry/useCases/ListEntries/ListEntriesOperation.js +9 -2
  167. package/crud/contentEntry/useCases/ListEntries/ListEntriesOperation.js.map +1 -1
  168. package/crud/contentEntry/useCases/ListEntries/ListEntriesOperationDeleted.d.ts +2 -2
  169. package/crud/contentEntry/useCases/ListEntries/ListEntriesOperationDeleted.js.map +1 -1
  170. package/crud/contentEntry/useCases/ListEntries/ListEntriesOperationLatest.d.ts +2 -2
  171. package/crud/contentEntry/useCases/ListEntries/ListEntriesOperationLatest.js.map +1 -1
  172. package/crud/contentEntry/useCases/ListEntries/ListEntriesOperationNotDeleted.d.ts +2 -2
  173. package/crud/contentEntry/useCases/ListEntries/ListEntriesOperationNotDeleted.js.map +1 -1
  174. package/crud/contentEntry/useCases/ListEntries/ListEntriesOperationPublished.d.ts +2 -2
  175. package/crud/contentEntry/useCases/ListEntries/ListEntriesOperationPublished.js.map +1 -1
  176. package/crud/contentEntry/useCases/ListEntries/ListEntriesOperationWithEvents.d.ts +3 -3
  177. package/crud/contentEntry/useCases/ListEntries/ListEntriesOperationWithEvents.js.map +1 -1
  178. package/crud/contentEntry/useCases/ListEntries/ListEntriesOperationWithSearchableFields.d.ts +2 -2
  179. package/crud/contentEntry/useCases/ListEntries/ListEntriesOperationWithSearchableFields.js.map +1 -1
  180. package/crud/contentEntry/useCases/ListEntries/ListEntriesOperationWithSort.d.ts +2 -2
  181. package/crud/contentEntry/useCases/ListEntries/ListEntriesOperationWithSort.js.map +1 -1
  182. package/crud/contentEntry/useCases/ListEntries/ListEntriesOperationWithStatusCheck.d.ts +2 -2
  183. package/crud/contentEntry/useCases/ListEntries/ListEntriesOperationWithStatusCheck.js.map +1 -1
  184. package/crud/contentEntry/useCases/ListEntries/ListEntriesSecure.d.ts +4 -4
  185. package/crud/contentEntry/useCases/ListEntries/ListEntriesSecure.js.map +1 -1
  186. package/crud/contentEntry/useCases/ListEntries/index.d.ts +6 -4
  187. package/crud/contentEntry/useCases/ListEntries/index.js +1 -1
  188. package/crud/contentEntry/useCases/ListEntries/index.js.map +1 -1
  189. package/crud/contentEntry/useCases/RestoreEntryFromBin/RestoreEntryFromBin.d.ts +3 -3
  190. package/crud/contentEntry/useCases/RestoreEntryFromBin/RestoreEntryFromBin.js.map +1 -1
  191. package/crud/contentEntry/useCases/RestoreEntryFromBin/RestoreEntryFromBinOperation.d.ts +7 -5
  192. package/crud/contentEntry/useCases/RestoreEntryFromBin/RestoreEntryFromBinOperation.js +4 -2
  193. package/crud/contentEntry/useCases/RestoreEntryFromBin/RestoreEntryFromBinOperation.js.map +1 -1
  194. package/crud/contentEntry/useCases/RestoreEntryFromBin/RestoreEntryFromBinOperationWithEvents.d.ts +3 -3
  195. package/crud/contentEntry/useCases/RestoreEntryFromBin/RestoreEntryFromBinOperationWithEvents.js.map +1 -1
  196. package/crud/contentEntry/useCases/RestoreEntryFromBin/RestoreEntryFromBinSecure.d.ts +3 -3
  197. package/crud/contentEntry/useCases/RestoreEntryFromBin/RestoreEntryFromBinSecure.js.map +1 -1
  198. package/crud/contentEntry/useCases/RestoreEntryFromBin/TransformEntryRestoreFromBin.d.ts +2 -2
  199. package/crud/contentEntry/useCases/RestoreEntryFromBin/TransformEntryRestoreFromBin.js.map +1 -1
  200. package/crud/contentEntry/useCases/RestoreEntryFromBin/index.d.ts +7 -5
  201. package/crud/contentEntry/useCases/RestoreEntryFromBin/index.js +1 -1
  202. package/crud/contentEntry/useCases/RestoreEntryFromBin/index.js.map +1 -1
  203. package/crud/contentEntry.crud.d.ts +5 -5
  204. package/crud/contentEntry.crud.js +16 -3
  205. package/crud/contentEntry.crud.js.map +1 -1
  206. package/crud/contentModel/beforeCreate.d.ts +2 -2
  207. package/crud/contentModel/beforeCreate.js.map +1 -1
  208. package/crud/contentModel/beforeDelete.d.ts +2 -2
  209. package/crud/contentModel/beforeDelete.js.map +1 -1
  210. package/crud/contentModel/beforeUpdate.d.ts +2 -2
  211. package/crud/contentModel/beforeUpdate.js.map +1 -1
  212. package/crud/contentModel/compatibility/modelApiName.d.ts +1 -1
  213. package/crud/contentModel/compatibility/modelApiName.js.map +1 -1
  214. package/crud/contentModel/contentModelManagerFactory.d.ts +1 -1
  215. package/crud/contentModel/contentModelManagerFactory.js.map +1 -1
  216. package/crud/contentModel/createFieldStorageId.d.ts +1 -1
  217. package/crud/contentModel/createFieldStorageId.js.map +1 -1
  218. package/crud/contentModel/defaultFields.d.ts +1 -1
  219. package/crud/contentModel/defaultFields.js.map +1 -1
  220. package/crud/contentModel/ensureTypeTag.d.ts +1 -1
  221. package/crud/contentModel/ensureTypeTag.js.map +1 -1
  222. package/crud/contentModel/fields/descriptionField.d.ts +1 -1
  223. package/crud/contentModel/fields/descriptionField.js.map +1 -1
  224. package/crud/contentModel/fields/getApplicableFieldById.d.ts +1 -1
  225. package/crud/contentModel/fields/getApplicableFieldById.js.map +1 -1
  226. package/crud/contentModel/fields/imageField.d.ts +1 -1
  227. package/crud/contentModel/fields/imageField.js.map +1 -1
  228. package/crud/contentModel/fields/titleField.d.ts +1 -1
  229. package/crud/contentModel/fields/titleField.js.map +1 -1
  230. package/crud/contentModel/listModelsFromDatabase.d.ts +3 -3
  231. package/crud/contentModel/listModelsFromDatabase.js.map +1 -1
  232. package/crud/contentModel/validate/endingAllowed.d.ts +1 -1
  233. package/crud/contentModel/validate/endingAllowed.js.map +1 -1
  234. package/crud/contentModel/validate/modelId.d.ts +1 -1
  235. package/crud/contentModel/validate/modelId.js.map +1 -1
  236. package/crud/contentModel/validate/pluralApiName.d.ts +1 -1
  237. package/crud/contentModel/validate/pluralApiName.js.map +1 -1
  238. package/crud/contentModel/validate/singularApiName.d.ts +1 -1
  239. package/crud/contentModel/validate/singularApiName.js.map +1 -1
  240. package/crud/contentModel/validateModel.d.ts +1 -1
  241. package/crud/contentModel/validateModel.js.map +1 -1
  242. package/crud/contentModel/validateModelFields.d.ts +1 -1
  243. package/crud/contentModel/validateModelFields.js.map +1 -1
  244. package/crud/contentModel/validation.d.ts +132 -132
  245. package/crud/contentModel.crud.d.ts +5 -5
  246. package/crud/contentModel.crud.js.map +1 -1
  247. package/crud/contentModelGroup/beforeCreate.d.ts +3 -3
  248. package/crud/contentModelGroup/beforeCreate.js.map +1 -1
  249. package/crud/contentModelGroup/beforeDelete.d.ts +3 -3
  250. package/crud/contentModelGroup/beforeDelete.js.map +1 -1
  251. package/crud/contentModelGroup/beforeUpdate.d.ts +3 -3
  252. package/crud/contentModelGroup/beforeUpdate.js.map +1 -1
  253. package/crud/contentModelGroup/listGroupsFromDatabase.d.ts +1 -1
  254. package/crud/contentModelGroup/listGroupsFromDatabase.js.map +1 -1
  255. package/crud/contentModelGroup/validation.d.ts +2 -2
  256. package/crud/contentModelGroup.crud.d.ts +5 -5
  257. package/crud/contentModelGroup.crud.js.map +1 -1
  258. package/crud/system.crud.d.ts +4 -4
  259. package/crud/system.crud.js +10 -0
  260. package/crud/system.crud.js.map +1 -1
  261. package/export/crud/exporting.d.ts +2 -2
  262. package/export/crud/exporting.js.map +1 -1
  263. package/export/crud/importing.d.ts +2 -2
  264. package/export/crud/importing.js.map +1 -1
  265. package/export/crud/imports/importData.d.ts +2 -2
  266. package/export/crud/imports/importData.js.map +1 -1
  267. package/export/crud/imports/importGroups.d.ts +2 -2
  268. package/export/crud/imports/importGroups.js.map +1 -1
  269. package/export/crud/imports/importModels.d.ts +2 -2
  270. package/export/crud/imports/importModels.js.map +1 -1
  271. package/export/crud/imports/validateGroups.d.ts +2 -2
  272. package/export/crud/imports/validateGroups.js.map +1 -1
  273. package/export/crud/imports/validateInput.d.ts +2 -2
  274. package/export/crud/imports/validateInput.js.map +1 -1
  275. package/export/crud/imports/validateModels.d.ts +2 -2
  276. package/export/crud/imports/validateModels.js.map +1 -1
  277. package/export/crud/index.d.ts +1 -1
  278. package/export/crud/index.js.map +1 -1
  279. package/export/crud/sanitize.d.ts +2 -2
  280. package/export/crud/sanitize.js.map +1 -1
  281. package/export/graphql/index.d.ts +1 -1
  282. package/export/graphql/index.js.map +1 -1
  283. package/export/types.d.ts +1 -1
  284. package/export/types.js.map +1 -1
  285. package/fieldConverters/CmsModelDefaultFieldConverterPlugin.d.ts +3 -2
  286. package/fieldConverters/CmsModelDefaultFieldConverterPlugin.js.map +1 -1
  287. package/fieldConverters/CmsModelDynamicZoneFieldConverterPlugin.d.ts +3 -2
  288. package/fieldConverters/CmsModelDynamicZoneFieldConverterPlugin.js.map +1 -1
  289. package/fieldConverters/CmsModelObjectFieldConverterPlugin.d.ts +3 -2
  290. package/fieldConverters/CmsModelObjectFieldConverterPlugin.js.map +1 -1
  291. package/graphql/buildSchemaPlugins.d.ts +2 -2
  292. package/graphql/buildSchemaPlugins.js.map +1 -1
  293. package/graphql/checkEndpointAccess.d.ts +1 -1
  294. package/graphql/checkEndpointAccess.js.map +1 -1
  295. package/graphql/createExecutableSchema.d.ts +1 -1
  296. package/graphql/createExecutableSchema.js.map +1 -1
  297. package/graphql/createRequestBody.d.ts +1 -1
  298. package/graphql/createRequestBody.js.map +1 -1
  299. package/graphql/generateSchema.d.ts +2 -2
  300. package/graphql/generateSchema.js.map +1 -1
  301. package/graphql/getSchema/generateCacheId.d.ts +3 -3
  302. package/graphql/getSchema/generateCacheId.js.map +1 -1
  303. package/graphql/getSchema/generateCacheKey.d.ts +1 -1
  304. package/graphql/getSchema/generateCacheKey.js.map +1 -1
  305. package/graphql/getSchema.d.ts +4 -4
  306. package/graphql/getSchema.js.map +1 -1
  307. package/graphql/graphQLHandlerFactory.d.ts +1 -1
  308. package/graphql/graphQLHandlerFactory.js.map +1 -1
  309. package/graphql/handleRequest.d.ts +2 -2
  310. package/graphql/handleRequest.js.map +1 -1
  311. package/graphql/index.d.ts +2 -2
  312. package/graphql/index.js.map +1 -1
  313. package/graphql/scalars/RevisionIdScalarPlugin.d.ts +1 -1
  314. package/graphql/scalars/RevisionIdScalarPlugin.js.map +1 -1
  315. package/graphql/schema/baseContentSchema.d.ts +2 -2
  316. package/graphql/schema/baseContentSchema.js.map +1 -1
  317. package/graphql/schema/baseSchema.js.map +1 -1
  318. package/graphql/schema/contentEntries.d.ts +2 -2
  319. package/graphql/schema/contentEntries.js.map +1 -1
  320. package/graphql/schema/contentModelGroups.d.ts +2 -2
  321. package/graphql/schema/contentModelGroups.js.map +1 -1
  322. package/graphql/schema/contentModels.d.ts +2 -2
  323. package/graphql/schema/contentModels.js.map +1 -1
  324. package/graphql/schema/createFieldResolvers.d.ts +2 -2
  325. package/graphql/schema/createFieldResolvers.js.map +1 -1
  326. package/graphql/schema/createFieldTypePluginRecords.d.ts +2 -2
  327. package/graphql/schema/createFieldTypePluginRecords.js.map +1 -1
  328. package/graphql/schema/createManageSDL.d.ts +2 -2
  329. package/graphql/schema/createManageSDL.js.map +1 -1
  330. package/graphql/schema/createReadSDL.d.ts +2 -2
  331. package/graphql/schema/createReadSDL.js.map +1 -1
  332. package/graphql/schema/createSingularSDL.d.ts +1 -1
  333. package/graphql/schema/createSingularSDL.js.map +1 -1
  334. package/graphql/schema/resolvers/manage/normalizeGraphQlInput.d.ts +1 -1
  335. package/graphql/schema/resolvers/manage/normalizeGraphQlInput.js.map +1 -1
  336. package/graphql/schema/resolvers/manage/resolveCreate.d.ts +1 -1
  337. package/graphql/schema/resolvers/manage/resolveCreate.js.map +1 -1
  338. package/graphql/schema/resolvers/manage/resolveCreateFrom.d.ts +1 -1
  339. package/graphql/schema/resolvers/manage/resolveCreateFrom.js.map +1 -1
  340. package/graphql/schema/resolvers/manage/resolveDelete.d.ts +1 -1
  341. package/graphql/schema/resolvers/manage/resolveDelete.js.map +1 -1
  342. package/graphql/schema/resolvers/manage/resolveDeleteMultiple.d.ts +1 -1
  343. package/graphql/schema/resolvers/manage/resolveDeleteMultiple.js.map +1 -1
  344. package/graphql/schema/resolvers/manage/resolveGet.d.ts +1 -1
  345. package/graphql/schema/resolvers/manage/resolveGet.js.map +1 -1
  346. package/graphql/schema/resolvers/manage/resolveGetByIds.d.ts +1 -1
  347. package/graphql/schema/resolvers/manage/resolveGetByIds.js.map +1 -1
  348. package/graphql/schema/resolvers/manage/resolveGetRevisions.d.ts +1 -1
  349. package/graphql/schema/resolvers/manage/resolveGetRevisions.js.map +1 -1
  350. package/graphql/schema/resolvers/manage/resolveGetUniqueFieldValues.d.ts +1 -1
  351. package/graphql/schema/resolvers/manage/resolveGetUniqueFieldValues.js.map +1 -1
  352. package/graphql/schema/resolvers/manage/resolveList.d.ts +1 -1
  353. package/graphql/schema/resolvers/manage/resolveList.js.map +1 -1
  354. package/graphql/schema/resolvers/manage/resolveListDeleted.d.ts +1 -1
  355. package/graphql/schema/resolvers/manage/resolveListDeleted.js.map +1 -1
  356. package/graphql/schema/resolvers/manage/resolveMove.d.ts +1 -1
  357. package/graphql/schema/resolvers/manage/resolveMove.js.map +1 -1
  358. package/graphql/schema/resolvers/manage/resolvePublish.d.ts +1 -1
  359. package/graphql/schema/resolvers/manage/resolvePublish.js.map +1 -1
  360. package/graphql/schema/resolvers/manage/resolveRepublish.d.ts +1 -1
  361. package/graphql/schema/resolvers/manage/resolveRepublish.js.map +1 -1
  362. package/graphql/schema/resolvers/manage/resolveRestoreFromBin.d.ts +1 -1
  363. package/graphql/schema/resolvers/manage/resolveRestoreFromBin.js.map +1 -1
  364. package/graphql/schema/resolvers/manage/resolveUnpublish.d.ts +1 -1
  365. package/graphql/schema/resolvers/manage/resolveUnpublish.js.map +1 -1
  366. package/graphql/schema/resolvers/manage/resolveUpdate.d.ts +1 -1
  367. package/graphql/schema/resolvers/manage/resolveUpdate.js.map +1 -1
  368. package/graphql/schema/resolvers/manage/resolveValidate.d.ts +1 -1
  369. package/graphql/schema/resolvers/manage/resolveValidate.js.map +1 -1
  370. package/graphql/schema/resolvers/preview/resolveGet.d.ts +1 -1
  371. package/graphql/schema/resolvers/preview/resolveGet.js.map +1 -1
  372. package/graphql/schema/resolvers/preview/resolveList.d.ts +1 -1
  373. package/graphql/schema/resolvers/preview/resolveList.js.map +1 -1
  374. package/graphql/schema/resolvers/read/resolveGet.d.ts +1 -1
  375. package/graphql/schema/resolvers/read/resolveGet.js.map +1 -1
  376. package/graphql/schema/resolvers/read/resolveList.d.ts +1 -1
  377. package/graphql/schema/resolvers/read/resolveList.js.map +1 -1
  378. package/graphql/schema/resolvers/singular/resolveGet.d.ts +1 -1
  379. package/graphql/schema/resolvers/singular/resolveGet.js.map +1 -1
  380. package/graphql/schema/resolvers/singular/resolveUpdate.d.ts +1 -1
  381. package/graphql/schema/resolvers/singular/resolveUpdate.js.map +1 -1
  382. package/graphql/schema/schemaPlugins.d.ts +1 -1
  383. package/graphql/schema/schemaPlugins.js.map +1 -1
  384. package/graphql/system.d.ts +1 -1
  385. package/graphql/system.js.map +1 -1
  386. package/graphqlFields/boolean.d.ts +1 -1
  387. package/graphqlFields/boolean.js.map +1 -1
  388. package/graphqlFields/datetime.d.ts +1 -1
  389. package/graphqlFields/datetime.js.map +1 -1
  390. package/graphqlFields/dynamicZone/dynamicZoneField.d.ts +1 -1
  391. package/graphqlFields/dynamicZone/dynamicZoneField.js.map +1 -1
  392. package/graphqlFields/file.d.ts +1 -1
  393. package/graphqlFields/file.js.map +1 -1
  394. package/graphqlFields/helpers.d.ts +1 -1
  395. package/graphqlFields/helpers.js.map +1 -1
  396. package/graphqlFields/index.d.ts +1 -1
  397. package/graphqlFields/index.js.map +1 -1
  398. package/graphqlFields/json.d.ts +1 -1
  399. package/graphqlFields/json.js.map +1 -1
  400. package/graphqlFields/longText.d.ts +1 -1
  401. package/graphqlFields/longText.js.map +1 -1
  402. package/graphqlFields/number.d.ts +1 -1
  403. package/graphqlFields/number.js.map +1 -1
  404. package/graphqlFields/object.d.ts +1 -1
  405. package/graphqlFields/object.js.map +1 -1
  406. package/graphqlFields/ref.d.ts +1 -1
  407. package/graphqlFields/ref.js.map +1 -1
  408. package/graphqlFields/richText/RichTextPluginsProcessor.d.ts +1 -1
  409. package/graphqlFields/richText/RichTextPluginsProcessor.js.map +1 -1
  410. package/graphqlFields/richText/richTextResolver.d.ts +2 -2
  411. package/graphqlFields/richText/richTextResolver.js.map +1 -1
  412. package/graphqlFields/richText.d.ts +1 -1
  413. package/graphqlFields/richText.js.map +1 -1
  414. package/graphqlFields/searchableJson.d.ts +1 -1
  415. package/graphqlFields/searchableJson.js +5 -0
  416. package/graphqlFields/searchableJson.js.map +1 -1
  417. package/graphqlFields/text.d.ts +1 -1
  418. package/graphqlFields/text.js.map +1 -1
  419. package/htmlRenderer/LexicalRenderer.d.ts +1 -1
  420. package/htmlRenderer/LexicalRenderer.js.map +1 -1
  421. package/htmlRenderer/createLexicalHTMLRenderer.js.map +1 -1
  422. package/index.d.ts +3 -3
  423. package/index.js.map +1 -1
  424. package/modelManager/SingletonModelManager.d.ts +1 -1
  425. package/modelManager/SingletonModelManager.js.map +1 -1
  426. package/modelManager/index.d.ts +1 -1
  427. package/modelManager/index.js.map +1 -1
  428. package/package.json +21 -21
  429. package/parameters/header.js.map +1 -1
  430. package/parameters/manual.d.ts +2 -1
  431. package/parameters/manual.js.map +1 -1
  432. package/parameters/path.js.map +1 -1
  433. package/plugins/CmsGraphQLSchemaPlugin/CmsGraphQLSchemaPlugin.d.ts +3 -2
  434. package/plugins/CmsGraphQLSchemaPlugin/CmsGraphQLSchemaPlugin.js.map +1 -1
  435. package/plugins/CmsGraphQLSchemaSorterPlugin.d.ts +1 -1
  436. package/plugins/CmsGraphQLSchemaSorterPlugin.js.map +1 -1
  437. package/plugins/CmsGroupPlugin.d.ts +1 -1
  438. package/plugins/CmsGroupPlugin.js.map +1 -1
  439. package/plugins/CmsModelFieldConverterPlugin.d.ts +2 -2
  440. package/plugins/CmsModelFieldConverterPlugin.js.map +1 -1
  441. package/plugins/CmsModelPlugin.d.ts +1 -1
  442. package/plugins/CmsModelPlugin.js.map +1 -1
  443. package/plugins/CmsParametersPlugin.d.ts +1 -1
  444. package/plugins/CmsParametersPlugin.js.map +1 -1
  445. package/plugins/StorageOperationsCmsModelPlugin.d.ts +1 -1
  446. package/plugins/StorageOperationsCmsModelPlugin.js.map +1 -1
  447. package/plugins/StorageTransformPlugin.d.ts +2 -2
  448. package/plugins/StorageTransformPlugin.js.map +1 -1
  449. package/storage/date.d.ts +1 -1
  450. package/storage/date.js.map +1 -1
  451. package/storage/dynamicZone.js.map +1 -1
  452. package/storage/json.js +34 -5
  453. package/storage/json.js.map +1 -1
  454. package/storage/object.js.map +1 -1
  455. package/types/context.d.ts +7 -7
  456. package/types/context.js.map +1 -1
  457. package/types/fields/dynamicZoneField.d.ts +1 -1
  458. package/types/fields/dynamicZoneField.js.map +1 -1
  459. package/types/fields/objectField.d.ts +1 -1
  460. package/types/fields/objectField.js.map +1 -1
  461. package/types/model.d.ts +3 -3
  462. package/types/model.js.map +1 -1
  463. package/types/modelAst.d.ts +1 -1
  464. package/types/modelAst.js.map +1 -1
  465. package/types/modelField.d.ts +2 -2
  466. package/types/modelField.js.map +1 -1
  467. package/types/modelGroup.d.ts +1 -1
  468. package/types/modelGroup.js.map +1 -1
  469. package/types/plugins.d.ts +6 -6
  470. package/types/plugins.js.map +1 -1
  471. package/types/types.d.ts +19 -19
  472. package/types/types.js.map +1 -1
  473. package/utils/RichTextRenderer.d.ts +2 -2
  474. package/utils/RichTextRenderer.js.map +1 -1
  475. package/utils/caching/Cache.d.ts +1 -1
  476. package/utils/caching/Cache.js.map +1 -1
  477. package/utils/caching/CacheKey.d.ts +2 -2
  478. package/utils/caching/CacheKey.js.map +1 -1
  479. package/utils/contentEntryTraverser/ContentEntryTraverser.d.ts +1 -1
  480. package/utils/contentEntryTraverser/ContentEntryTraverser.js.map +1 -1
  481. package/utils/contentModelAst/CmsModelFieldToAstConverterFromPlugins.d.ts +1 -1
  482. package/utils/contentModelAst/CmsModelFieldToAstConverterFromPlugins.js.map +1 -1
  483. package/utils/contentModelAst/CmsModelFieldToAstFromPlugin.d.ts +1 -1
  484. package/utils/contentModelAst/CmsModelFieldToAstFromPlugin.js.map +1 -1
  485. package/utils/contentModelAst/CmsModelToAstConverter.d.ts +1 -1
  486. package/utils/contentModelAst/CmsModelToAstConverter.js.map +1 -1
  487. package/utils/converters/Converter.d.ts +3 -3
  488. package/utils/converters/Converter.js.map +1 -1
  489. package/utils/converters/ConverterCollection.d.ts +2 -2
  490. package/utils/converters/ConverterCollection.js.map +1 -1
  491. package/utils/converters/valueKeyStorageConverter.d.ts +3 -3
  492. package/utils/converters/valueKeyStorageConverter.js.map +1 -1
  493. package/utils/createModelField.d.ts +1 -1
  494. package/utils/createModelField.js.map +1 -1
  495. package/utils/createTypeFromFields.d.ts +1 -1
  496. package/utils/createTypeFromFields.js.map +1 -1
  497. package/utils/entryStorage.d.ts +8 -1
  498. package/utils/entryStorage.js +37 -4
  499. package/utils/entryStorage.js.map +1 -1
  500. package/utils/getBaseFieldType.d.ts +1 -1
  501. package/utils/getBaseFieldType.js.map +1 -1
  502. package/utils/getEntryDescription.d.ts +1 -1
  503. package/utils/getEntryDescription.js.map +1 -1
  504. package/utils/getEntryImage.d.ts +1 -1
  505. package/utils/getEntryImage.js.map +1 -1
  506. package/utils/getEntryTitle.d.ts +1 -1
  507. package/utils/getEntryTitle.js.map +1 -1
  508. package/utils/getSchemaFromFieldPlugins.d.ts +4 -4
  509. package/utils/getSchemaFromFieldPlugins.js.map +1 -1
  510. package/utils/identity.d.ts +1 -1
  511. package/utils/identity.js.map +1 -1
  512. package/utils/isHeadlessCmsReady.d.ts +1 -1
  513. package/utils/isHeadlessCmsReady.js.map +1 -1
  514. package/utils/modelFieldTraverser/ModelFieldTraverser.d.ts +1 -1
  515. package/utils/modelFieldTraverser/ModelFieldTraverser.js.map +1 -1
  516. package/utils/renderFields.d.ts +1 -1
  517. package/utils/renderFields.js.map +1 -1
  518. package/utils/renderGetFilterFields.d.ts +1 -1
  519. package/utils/renderGetFilterFields.js.map +1 -1
  520. package/utils/renderInputFields.d.ts +1 -1
  521. package/utils/renderInputFields.js.map +1 -1
  522. package/utils/renderListFilterFields.d.ts +1 -1
  523. package/utils/renderListFilterFields.js.map +1 -1
  524. package/utils/renderSortEnum.d.ts +2 -2
  525. package/utils/renderSortEnum.js.map +1 -1
  526. package/validators/dateGte.d.ts +1 -1
  527. package/validators/dateGte.js.map +1 -1
  528. package/validators/dateLte.d.ts +1 -1
  529. package/validators/dateLte.js.map +1 -1
  530. package/validators/gte.d.ts +1 -1
  531. package/validators/gte.js.map +1 -1
  532. package/validators/in.d.ts +1 -1
  533. package/validators/in.js.map +1 -1
  534. package/validators/lte.d.ts +1 -1
  535. package/validators/lte.js.map +1 -1
  536. package/validators/maxLength.d.ts +1 -1
  537. package/validators/maxLength.js.map +1 -1
  538. package/validators/minLength.d.ts +1 -1
  539. package/validators/minLength.js.map +1 -1
  540. package/validators/pattern.d.ts +1 -1
  541. package/validators/pattern.js.map +1 -1
  542. package/validators/patternPlugins/email.d.ts +1 -1
  543. package/validators/patternPlugins/email.js.map +1 -1
  544. package/validators/patternPlugins/index.d.ts +1 -1
  545. package/validators/patternPlugins/index.js.map +1 -1
  546. package/validators/patternPlugins/lowerCase.d.ts +1 -1
  547. package/validators/patternPlugins/lowerCase.js.map +1 -1
  548. package/validators/patternPlugins/lowerCaseSpace.d.ts +1 -1
  549. package/validators/patternPlugins/lowerCaseSpace.js.map +1 -1
  550. package/validators/patternPlugins/upperCase.d.ts +1 -1
  551. package/validators/patternPlugins/upperCase.js.map +1 -1
  552. package/validators/patternPlugins/upperCaseSpace.d.ts +1 -1
  553. package/validators/patternPlugins/upperCaseSpace.js.map +1 -1
  554. package/validators/patternPlugins/url.d.ts +1 -1
  555. package/validators/patternPlugins/url.js.map +1 -1
  556. package/validators/required.d.ts +1 -1
  557. package/validators/required.js.map +1 -1
  558. package/validators/timeGte.d.ts +1 -1
  559. package/validators/timeGte.js.map +1 -1
  560. package/validators/timeLte.d.ts +1 -1
  561. package/validators/timeLte.js.map +1 -1
  562. package/validators/unique.d.ts +1 -1
  563. package/validators/unique.js.map +1 -1
@@ -1 +1 @@
1
- {"version":3,"names":["_ConverterCollection","require","_semver","_interopRequireDefault","featureVersion","semver","coerce","isBetaOrNext","model","webinyVersion","startsWith","match","isFeatureEnabled","disableConversion","process","env","WEBINY_API_TEST_STORAGE_ID_CONVERSION_DISABLE","nodeEnv","NODE_ENV","modelVersion","console","log","modelId","compare","createValueKeyToStorageConverter","params","plugins","values","converters","ConverterCollection","fields","result","convertToStorage","exports","createValueKeyFromStorageConverter","convertFromStorage","createCmsModelFieldConvertersAttachFactory","storageModel","convertValueKeyToStorage","convertValueKeyFromStorage"],"sources":["valueKeyStorageConverter.ts"],"sourcesContent":["import { PluginsContainer } from \"@webiny/plugins\";\nimport {\n CmsModelConverterCallable,\n ConverterCollection,\n ConverterCollectionConvertParams as BaseConverterCollectionConvertParams\n} from \"~/utils/converters/ConverterCollection\";\nimport { CmsModel, StorageOperationsCmsModel } from \"~/types\";\nimport semver, { SemVer } from \"semver\";\n\nconst featureVersion = semver.coerce(\"5.33.0\") as SemVer;\n\nconst isBetaOrNext = (model: CmsModel): boolean => {\n if (!model.webinyVersion) {\n return false;\n } else if (model.webinyVersion.startsWith(\"0.0.0\")) {\n return true;\n }\n return model.webinyVersion.match(/next|beta|unstable/) !== null;\n};\n\nconst isFeatureEnabled = (model: CmsModel): boolean => {\n /**\n * In case of disabled webinyVersion value, we disable this feature.\n * This is only for testing...\n */\n const disableConversion = !!process.env.WEBINY_API_TEST_STORAGE_ID_CONVERSION_DISABLE;\n if (model.webinyVersion === \"disable\" || disableConversion) {\n return false;\n }\n /**\n * If is a test environment, always have this turned on.\n */\n const nodeEnv = process.env.NODE_ENV as string;\n if (nodeEnv === \"test\" || nodeEnv === \"disable\" || isBetaOrNext(model)) {\n return true;\n }\n /**\n * Possibility that the version is not defined, this means it is a quite old system where models did not change.\n */\n if (!model.webinyVersion) {\n return false;\n }\n /**\n * In case feature version value is greater than the model version, feature is not enabled as it is an older model with no storageId.\n *\n * TODO change if necessary after the update to the system\n */\n const modelVersion = semver.coerce(model.webinyVersion);\n if (!modelVersion) {\n console.log(`Warning: Model \"${model.modelId}\" does not have valid Webiny version set.`);\n return true;\n } else if (semver.compare(modelVersion, featureVersion) === -1) {\n return false;\n }\n return true;\n};\n\ninterface Params {\n /**\n * We need a model to determine if the conversion feature is enabled.\n */\n model: CmsModel;\n plugins: PluginsContainer;\n}\n\n/**\n * In the first call of the converter we do not need the fields property as it will be taken directly from the model.\n */\ninterface ConverterCollectionConvertParams\n extends Omit<BaseConverterCollectionConvertParams, \"fields\"> {\n fields?: BaseConverterCollectionConvertParams[\"fields\"];\n}\n\nexport const createValueKeyToStorageConverter = (params: Params): CmsModelConverterCallable => {\n const { plugins, model } = params;\n\n if (isFeatureEnabled(model) === false) {\n return ({ values }: ConverterCollectionConvertParams) => {\n return values || {};\n };\n }\n\n const converters = new ConverterCollection({\n plugins\n });\n\n return ({ fields, values }: ConverterCollectionConvertParams) => {\n const result = converters.convertToStorage({\n fields: fields || model.fields,\n values\n });\n return result || {};\n };\n};\n\nexport const createValueKeyFromStorageConverter = (params: Params): CmsModelConverterCallable => {\n const { plugins, model } = params;\n\n if (isFeatureEnabled(model) === false) {\n return ({ values }: ConverterCollectionConvertParams) => {\n return values || {};\n };\n }\n\n const converters = new ConverterCollection({\n plugins\n });\n\n return ({ fields, values }: ConverterCollectionConvertParams) => {\n const result = converters.convertFromStorage({\n fields: fields || model.fields,\n values\n });\n return result || {};\n };\n};\n\nexport const createCmsModelFieldConvertersAttachFactory = (plugins: PluginsContainer) => {\n return (model: StorageOperationsCmsModel | CmsModel): StorageOperationsCmsModel => {\n const storageModel = model as Partial<StorageOperationsCmsModel>;\n if (!!storageModel.convertValueKeyToStorage && !!storageModel.convertValueKeyFromStorage) {\n return storageModel as StorageOperationsCmsModel;\n }\n return {\n ...model,\n convertValueKeyToStorage: createValueKeyToStorageConverter({\n model,\n plugins\n }),\n convertValueKeyFromStorage: createValueKeyFromStorageConverter({\n model,\n plugins\n })\n };\n };\n};\n"],"mappings":";;;;;;;AACA,IAAAA,oBAAA,GAAAC,OAAA;AAMA,IAAAC,OAAA,GAAAC,sBAAA,CAAAF,OAAA;AAEA,MAAMG,cAAc,GAAGC,eAAM,CAACC,MAAM,CAAC,QAAQ,CAAW;AAExD,MAAMC,YAAY,GAAIC,KAAe,IAAc;EAC/C,IAAI,CAACA,KAAK,CAACC,aAAa,EAAE;IACtB,OAAO,KAAK;EAChB,CAAC,MAAM,IAAID,KAAK,CAACC,aAAa,CAACC,UAAU,CAAC,OAAO,CAAC,EAAE;IAChD,OAAO,IAAI;EACf;EACA,OAAOF,KAAK,CAACC,aAAa,CAACE,KAAK,CAAC,oBAAoB,CAAC,KAAK,IAAI;AACnE,CAAC;AAED,MAAMC,gBAAgB,GAAIJ,KAAe,IAAc;EACnD;AACJ;AACA;AACA;EACI,MAAMK,iBAAiB,GAAG,CAAC,CAACC,OAAO,CAACC,GAAG,CAACC,6CAA6C;EACrF,IAAIR,KAAK,CAACC,aAAa,KAAK,SAAS,IAAII,iBAAiB,EAAE;IACxD,OAAO,KAAK;EAChB;EACA;AACJ;AACA;EACI,MAAMI,OAAO,GAAGH,OAAO,CAACC,GAAG,CAACG,QAAkB;EAC9C,IAAID,OAAO,KAAK,MAAM,IAAIA,OAAO,KAAK,SAAS,IAAIV,YAAY,CAACC,KAAK,CAAC,EAAE;IACpE,OAAO,IAAI;EACf;EACA;AACJ;AACA;EACI,IAAI,CAACA,KAAK,CAACC,aAAa,EAAE;IACtB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,CAAC,KAAK;MACrD,OAAOA,MAAM,IAAI,CAAC,CAAC;IACvB,CAAC;EACL;EAEA,MAAMC,UAAU,GAAG,IAAIC,wCAAmB,CAAC;IACvCH;EACJ,CAAC,CAAC;EAEF,OAAO,CAAC;IAAEI,MAAM;IAAEH;EAAyC,CAAC,KAAK;IAC7D,MAAMI,MAAM,GAAGH,UAAU,CAACO,kBAAkB,CAAC;MACzCL,MAAM,EAAEA,MAAM,IAAItB,KAAK,CAACsB,MAAM;MAC9BH;IACJ,CAAC,CAAC;IACF,OAAOI,MAAM,IAAI,CAAC,CAAC;EACvB,CAAC;AACL,CAAC;AAACE,OAAA,CAAAC,kCAAA,GAAAA,kCAAA;AAEK,MAAME,0CAA0C,GAAIV,OAAyB,IAAK;EACrF,OAAQlB,KAA2C,IAAgC;IAC/E,MAAM6B,YAAY,GAAG7B,KAA2C;IAChE,IAAI,CAAC,CAAC6B,YAAY,CAACC,wBAAwB,IAAI,CAAC,CAACD,YAAY,CAACE,0BAA0B,EAAE;MACtF,OAAOF,YAAY;IACvB;IACA,OAAO;MACH,GAAG7B,KAAK;MACR8B,wBAAwB,EAAEd,gCAAgC,CAAC;QACvDhB,KAAK;QACLkB;MACJ,CAAC,CAAC;MACFa,0BAA0B,EAAEL,kCAAkC,CAAC;QAC3D1B,KAAK;QACLkB;MACJ,CAAC;IACL,CAAC;EACL,CAAC;AACL,CAAC;AAACO,OAAA,CAAAG,0CAAA,GAAAA,0CAAA","ignoreList":[]}
1
+ {"version":3,"names":["_ConverterCollection","require","_semver","_interopRequireDefault","featureVersion","semver","coerce","isBetaOrNext","model","webinyVersion","startsWith","match","isFeatureEnabled","disableConversion","process","env","WEBINY_API_TEST_STORAGE_ID_CONVERSION_DISABLE","nodeEnv","NODE_ENV","modelVersion","console","log","modelId","compare","createValueKeyToStorageConverter","params","plugins","values","converters","ConverterCollection","fields","result","convertToStorage","exports","createValueKeyFromStorageConverter","convertFromStorage","createCmsModelFieldConvertersAttachFactory","storageModel","convertValueKeyToStorage","convertValueKeyFromStorage"],"sources":["valueKeyStorageConverter.ts"],"sourcesContent":["import type { PluginsContainer } from \"@webiny/plugins\";\nimport type {\n CmsModelConverterCallable,\n ConverterCollectionConvertParams as BaseConverterCollectionConvertParams\n} from \"~/utils/converters/ConverterCollection\";\nimport { ConverterCollection } from \"~/utils/converters/ConverterCollection\";\nimport type { CmsModel, StorageOperationsCmsModel } from \"~/types\";\nimport type { SemVer } from \"semver\";\nimport semver from \"semver\";\n\nconst featureVersion = semver.coerce(\"5.33.0\") as SemVer;\n\nconst isBetaOrNext = (model: CmsModel): boolean => {\n if (!model.webinyVersion) {\n return false;\n } else if (model.webinyVersion.startsWith(\"0.0.0\")) {\n return true;\n }\n return model.webinyVersion.match(/next|beta|unstable/) !== null;\n};\n\nconst isFeatureEnabled = (model: CmsModel): boolean => {\n /**\n * In case of disabled webinyVersion value, we disable this feature.\n * This is only for testing...\n */\n const disableConversion = !!process.env.WEBINY_API_TEST_STORAGE_ID_CONVERSION_DISABLE;\n if (model.webinyVersion === \"disable\" || disableConversion) {\n return false;\n }\n /**\n * If is a test environment, always have this turned on.\n */\n const nodeEnv = process.env.NODE_ENV as string;\n if (nodeEnv === \"test\" || nodeEnv === \"disable\" || isBetaOrNext(model)) {\n return true;\n }\n /**\n * Possibility that the version is not defined, this means it is a quite old system where models did not change.\n */\n if (!model.webinyVersion) {\n return false;\n }\n /**\n * In case feature version value is greater than the model version, feature is not enabled as it is an older model with no storageId.\n *\n * TODO change if necessary after the update to the system\n */\n const modelVersion = semver.coerce(model.webinyVersion);\n if (!modelVersion) {\n console.log(`Warning: Model \"${model.modelId}\" does not have valid Webiny version set.`);\n return true;\n } else if (semver.compare(modelVersion, featureVersion) === -1) {\n return false;\n }\n return true;\n};\n\ninterface Params {\n /**\n * We need a model to determine if the conversion feature is enabled.\n */\n model: CmsModel;\n plugins: PluginsContainer;\n}\n\n/**\n * In the first call of the converter we do not need the fields property as it will be taken directly from the model.\n */\ninterface ConverterCollectionConvertParams\n extends Omit<BaseConverterCollectionConvertParams, \"fields\"> {\n fields?: BaseConverterCollectionConvertParams[\"fields\"];\n}\n\nexport const createValueKeyToStorageConverter = (params: Params): CmsModelConverterCallable => {\n const { plugins, model } = params;\n\n if (isFeatureEnabled(model) === false) {\n return ({ values }: ConverterCollectionConvertParams) => {\n return values || {};\n };\n }\n\n const converters = new ConverterCollection({\n plugins\n });\n\n return ({ fields, values }: ConverterCollectionConvertParams) => {\n const result = converters.convertToStorage({\n fields: fields || model.fields,\n values\n });\n return result || {};\n };\n};\n\nexport const createValueKeyFromStorageConverter = (params: Params): CmsModelConverterCallable => {\n const { plugins, model } = params;\n\n if (isFeatureEnabled(model) === false) {\n return ({ values }: ConverterCollectionConvertParams) => {\n return values || {};\n };\n }\n\n const converters = new ConverterCollection({\n plugins\n });\n\n return ({ fields, values }: ConverterCollectionConvertParams) => {\n const result = converters.convertFromStorage({\n fields: fields || model.fields,\n values\n });\n return result || {};\n };\n};\n\nexport const createCmsModelFieldConvertersAttachFactory = (plugins: PluginsContainer) => {\n return (model: StorageOperationsCmsModel | CmsModel): StorageOperationsCmsModel => {\n const storageModel = model as Partial<StorageOperationsCmsModel>;\n if (!!storageModel.convertValueKeyToStorage && !!storageModel.convertValueKeyFromStorage) {\n return storageModel as StorageOperationsCmsModel;\n }\n return {\n ...model,\n convertValueKeyToStorage: createValueKeyToStorageConverter({\n model,\n plugins\n }),\n convertValueKeyFromStorage: createValueKeyFromStorageConverter({\n model,\n plugins\n })\n };\n };\n};\n"],"mappings":";;;;;;;AAKA,IAAAA,oBAAA,GAAAC,OAAA;AAGA,IAAAC,OAAA,GAAAC,sBAAA,CAAAF,OAAA;AAEA,MAAMG,cAAc,GAAGC,eAAM,CAACC,MAAM,CAAC,QAAQ,CAAW;AAExD,MAAMC,YAAY,GAAIC,KAAe,IAAc;EAC/C,IAAI,CAACA,KAAK,CAACC,aAAa,EAAE;IACtB,OAAO,KAAK;EAChB,CAAC,MAAM,IAAID,KAAK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,YAAY,CAACE,0BAA0B,EAAE;MACtF,OAAOF,YAAY;IACvB;IACA,OAAO;MACH,GAAG7B,KAAK;MACR8B,wBAAwB,EAAEd,gCAAgC,CAAC;QACvDhB,KAAK;QACLkB;MACJ,CAAC,CAAC;MACFa,0BAA0B,EAAEL,kCAAkC,CAAC;QAC3D1B,KAAK;QACLkB;MACJ,CAAC;IACL,CAAC;EACL,CAAC;AACL,CAAC;AAACO,OAAA,CAAAG,0CAAA,GAAAA,0CAAA","ignoreList":[]}
@@ -1,4 +1,4 @@
1
- import { CmsModelField } from "../types";
1
+ import type { CmsModelField } from "../types";
2
2
  export interface CreateModelFieldParams extends Omit<CmsModelField, "id" | "storageId" | "fieldId"> {
3
3
  id?: string;
4
4
  fieldId?: string;
@@ -1 +1 @@
1
- {"version":3,"names":["_camelCase","_interopRequireDefault","require","createModelField","params","id","label","fieldId","initialFieldId","storageId","type","tags","settings","listValidation","validation","multipleValues","predefinedValues","values","enabled","helpText","placeholderText","renderer","camelCase","exports"],"sources":["createModelField.ts"],"sourcesContent":["import camelCase from \"lodash/camelCase\";\nimport { CmsModelField } from \"~/types\";\n\nexport interface CreateModelFieldParams\n extends Omit<CmsModelField, \"id\" | \"storageId\" | \"fieldId\"> {\n id?: string;\n fieldId?: string;\n storageId?: string;\n}\n\nexport const createModelField = (params: CreateModelFieldParams): CmsModelField => {\n // We are not just spreading `params` because we want to ensure\n // a default value is set for every property of the model field.\n const {\n id,\n label,\n fieldId: initialFieldId,\n storageId,\n type,\n tags,\n settings = {},\n listValidation = [],\n validation = [],\n multipleValues = false,\n predefinedValues = {\n values: [],\n enabled: false\n },\n helpText = null,\n placeholderText = null,\n renderer = null\n } = params;\n\n const fieldId = initialFieldId ? camelCase(initialFieldId) : camelCase(label);\n\n return {\n id: id ?? fieldId,\n storageId: storageId ?? `${type}@${fieldId}`,\n fieldId,\n label,\n type,\n settings,\n tags,\n listValidation,\n validation,\n multipleValues,\n predefinedValues,\n helpText,\n placeholderText,\n renderer\n };\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,UAAA,GAAAC,sBAAA,CAAAC,OAAA;AAUO,MAAMC,gBAAgB,GAAIC,MAA8B,IAAoB;EAC/E;EACA;EACA,MAAM;IACFC,EAAE;IACFC,KAAK;IACLC,OAAO,EAAEC,cAAc;IACvBC,SAAS;IACTC,IAAI;IACJC,IAAI;IACJC,QAAQ,GAAG,CAAC,CAAC;IACbC,cAAc,GAAG,EAAE;IACnBC,UAAU,GAAG,EAAE;IACfC,cAAc,GAAG,KAAK;IACtBC,gBAAgB,GAAG;MACfC,MAAM,EAAE,EAAE;MACVC,OAAO,EAAE;IACb,CAAC;IACDC,QAAQ,GAAG,IAAI;IACfC,eAAe,GAAG,IAAI;IACtBC,QAAQ,GAAG;EACf,CAAC,GAAGjB,MAAM;EAEV,MAAMG,OAAO,GAAGC,cAAc,GAAG,IAAAc,kBAAS,EAACd,cAAc,CAAC,GAAG,IAAAc,kBAAS,EAAChB,KAAK,CAAC;EAE7E,OAAO;IACHD,EAAE,EAAEA,EAAE,IAAIE,OAAO;IACjBE,SAAS,EAAEA,SAAS,IAAI,GAAGC,IAAI,IAAIH,OAAO,EAAE;IAC5CA,OAAO;IACPD,KAAK;IACLI,IAAI;IACJE,QAAQ;IACRD,IAAI;IACJE,cAAc;IACdC,UAAU;IACVC,cAAc;IACdC,gBAAgB;IAChBG,QAAQ;IACRC,eAAe;IACfC;EACJ,CAAC;AACL,CAAC;AAACE,OAAA,CAAApB,gBAAA,GAAAA,gBAAA","ignoreList":[]}
1
+ {"version":3,"names":["_camelCase","_interopRequireDefault","require","createModelField","params","id","label","fieldId","initialFieldId","storageId","type","tags","settings","listValidation","validation","multipleValues","predefinedValues","values","enabled","helpText","placeholderText","renderer","camelCase","exports"],"sources":["createModelField.ts"],"sourcesContent":["import camelCase from \"lodash/camelCase\";\nimport type { CmsModelField } from \"~/types\";\n\nexport interface CreateModelFieldParams\n extends Omit<CmsModelField, \"id\" | \"storageId\" | \"fieldId\"> {\n id?: string;\n fieldId?: string;\n storageId?: string;\n}\n\nexport const createModelField = (params: CreateModelFieldParams): CmsModelField => {\n // We are not just spreading `params` because we want to ensure\n // a default value is set for every property of the model field.\n const {\n id,\n label,\n fieldId: initialFieldId,\n storageId,\n type,\n tags,\n settings = {},\n listValidation = [],\n validation = [],\n multipleValues = false,\n predefinedValues = {\n values: [],\n enabled: false\n },\n helpText = null,\n placeholderText = null,\n renderer = null\n } = params;\n\n const fieldId = initialFieldId ? camelCase(initialFieldId) : camelCase(label);\n\n return {\n id: id ?? fieldId,\n storageId: storageId ?? `${type}@${fieldId}`,\n fieldId,\n label,\n type,\n settings,\n tags,\n listValidation,\n validation,\n multipleValues,\n predefinedValues,\n helpText,\n placeholderText,\n renderer\n };\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,UAAA,GAAAC,sBAAA,CAAAC,OAAA;AAUO,MAAMC,gBAAgB,GAAIC,MAA8B,IAAoB;EAC/E;EACA;EACA,MAAM;IACFC,EAAE;IACFC,KAAK;IACLC,OAAO,EAAEC,cAAc;IACvBC,SAAS;IACTC,IAAI;IACJC,IAAI;IACJC,QAAQ,GAAG,CAAC,CAAC;IACbC,cAAc,GAAG,EAAE;IACnBC,UAAU,GAAG,EAAE;IACfC,cAAc,GAAG,KAAK;IACtBC,gBAAgB,GAAG;MACfC,MAAM,EAAE,EAAE;MACVC,OAAO,EAAE;IACb,CAAC;IACDC,QAAQ,GAAG,IAAI;IACfC,eAAe,GAAG,IAAI;IACtBC,QAAQ,GAAG;EACf,CAAC,GAAGjB,MAAM;EAEV,MAAMG,OAAO,GAAGC,cAAc,GAAG,IAAAc,kBAAS,EAACd,cAAc,CAAC,GAAG,IAAAc,kBAAS,EAAChB,KAAK,CAAC;EAE7E,OAAO;IACHD,EAAE,EAAEA,EAAE,IAAIE,OAAO;IACjBE,SAAS,EAAEA,SAAS,IAAI,GAAGC,IAAI,IAAIH,OAAO,EAAE;IAC5CA,OAAO;IACPD,KAAK;IACLI,IAAI;IACJE,QAAQ;IACRD,IAAI;IACJE,cAAc;IACdC,UAAU;IACVC,cAAc;IACdC,gBAAgB;IAChBG,QAAQ;IACRC,eAAe;IACfC;EACJ,CAAC;AACL,CAAC;AAACE,OAAA,CAAApB,gBAAA,GAAAA,gBAAA","ignoreList":[]}
@@ -1,4 +1,4 @@
1
- import { ApiEndpoint, CmsFieldTypePlugins, CmsModel, CmsModelField } from "../types";
1
+ import type { ApiEndpoint, CmsFieldTypePlugins, CmsModel, CmsModelField } from "../types";
2
2
  interface TypeFromFieldParams {
3
3
  typeOfType: "type" | "input";
4
4
  models: CmsModel[];
@@ -1 +1 @@
1
- {"version":3,"names":["_renderFields","require","_renderInputFields","createTypeFromFields","params","typeOfType","model","models","type","typeNamePrefix","fields","fieldTypePlugins","typeSuffix","mTypeName","singularApiName","typeFields","nestedTypes","replace","RegExp","field","result","renderField","renderInputField","typeDefs","push","length","fieldType","join","exports"],"sources":["createTypeFromFields.ts"],"sourcesContent":["import { renderField } from \"~/utils/renderFields\";\nimport { renderInputField } from \"~/utils/renderInputFields\";\nimport { ApiEndpoint, CmsFieldTypePlugins, CmsModel, CmsModelField } from \"~/types\";\n\ninterface TypeFromFieldParams {\n typeOfType: \"type\" | \"input\";\n models: CmsModel[];\n model: CmsModel;\n type: ApiEndpoint;\n typeNamePrefix: string;\n fields: CmsModelField[];\n fieldTypePlugins: CmsFieldTypePlugins;\n}\n\ninterface TypeFromFieldResponse {\n fieldType: string;\n typeDefs: string;\n}\n\nexport const createTypeFromFields = (params: TypeFromFieldParams): TypeFromFieldResponse | null => {\n const { typeOfType, model, models, type, typeNamePrefix, fields, fieldTypePlugins } = params;\n const typeSuffix = typeOfType === \"input\" ? \"Input\" : \"\";\n const mTypeName = model.singularApiName;\n\n const typeFields: string[] = [];\n const nestedTypes: string[] = [];\n\n // Once the loop below starts, we'll be executing a recursive \"object\" type generation.\n // The main trick here is that nested objects don't know who the parent is, and will generate\n // type names using the \"model\", as if they're at the top level:\n // Every time the types are returned, we need to replace the model name in the generated type name\n // with the actual prefix which includes parent field name type.\n const replace = new RegExp(`${mTypeName}_`, \"g\");\n\n for (const field of fields) {\n const result =\n typeOfType === \"type\"\n ? renderField({ field, type, models, model, fieldTypePlugins })\n : renderInputField({ field, models, model, fieldTypePlugins });\n\n if (!result) {\n continue;\n }\n\n const { fields, typeDefs } = result;\n\n typeFields.push(fields.replace(replace, `${typeNamePrefix}_`));\n if (typeDefs) {\n nestedTypes.push(typeDefs.replace(replace, `${typeNamePrefix}_`));\n }\n }\n\n if (!typeFields.length) {\n typeFields.push(\"_empty: String\");\n }\n\n return {\n fieldType: `${typeNamePrefix}${typeSuffix}`,\n typeDefs: /* GraphQL */ `\n ${nestedTypes.join(\"\\n\")}\n\n ${typeOfType} ${typeNamePrefix}${typeSuffix} {\n ${typeFields.join(\"\\n\")}\n }\\n\n `\n };\n};\n"],"mappings":";;;;;;AAAA,IAAAA,aAAA,GAAAC,OAAA;AACA,IAAAC,kBAAA,GAAAD,OAAA;AAkBO,MAAME,oBAAoB,GAAIC,MAA2B,IAAmC;EAC/F,MAAM;IAAEC,UAAU;IAAEC,KAAK;IAAEC,MAAM;IAAEC,IAAI;IAAEC,cAAc;IAAEC,MAAM;IAAEC;EAAiB,CAAC,GAAGP,MAAM;EAC5F,MAAMQ,UAAU,GAAGP,UAAU,KAAK,OAAO,GAAG,OAAO,GAAG,EAAE;EACxD,MAAMQ,SAAS,GAAGP,KAAK,CAACQ,eAAe;EAEvC,MAAMC,UAAoB,GAAG,EAAE;EAC/B,MAAMC,WAAqB,GAAG,EAAE;;EAEhC;EACA;EACA;EACA;EACA;EACA,MAAMC,OAAO,GAAG,IAAIC,MAAM,CAAC,GAAGL,SAAS,GAAG,EAAE,GAAG,CAAC;EAEhD,KAAK,MAAMM,KAAK,IAAIT,MAAM,EAAE;IACxB,MAAMU,MAAM,GACRf,UAAU,KAAK,MAAM,GACf,IAAAgB,yBAAW,EAAC;MAAEF,KAAK;MAAEX,IAAI;MAAED,MAAM;MAAED,KAAK;MAAEK;IAAiB,CAAC,CAAC,GAC7D,IAAAW,mCAAgB,EAAC;MAAEH,KAAK;MAAEZ,MAAM;MAAED,KAAK;MAAEK;IAAiB,CAAC,CAAC;IAEtE,IAAI,CAACS,MAAM,EAAE;MACT;IACJ;IAEA,MAAM;MAAEV,MAAM;MAAEa;IAAS,CAAC,GAAGH,MAAM;IAEnCL,UAAU,CAACS,IAAI,CAACd,MAAM,CAACO,OAAO,CAACA,OAAO,EAAE,GAAGR,cAAc,GAAG,CAAC,CAAC;IAC9D,IAAIc,QAAQ,EAAE;MACVP,WAAW,CAACQ,IAAI,CAACD,QAAQ,CAACN,OAAO,CAACA,OAAO,EAAE,GAAGR,cAAc,GAAG,CAAC,CAAC;IACrE;EACJ;EAEA,IAAI,CAACM,UAAU,CAACU,MAAM,EAAE;IACpBV,UAAU,CAACS,IAAI,CAAC,gBAAgB,CAAC;EACrC;EAEA,OAAO;IACHE,SAAS,EAAE,GAAGjB,cAAc,GAAGG,UAAU,EAAE;IAC3CW,QAAQ,EAAE,aAAc;AAChC,cAAcP,WAAW,CAACW,IAAI,CAAC,IAAI,CAAC;AACpC;AACA,cAActB,UAAU,IAAII,cAAc,GAAGG,UAAU;AACvD,kBAAkBG,UAAU,CAACY,IAAI,CAAC,IAAI,CAAC;AACvC;AACA;EACI,CAAC;AACL,CAAC;AAACC,OAAA,CAAAzB,oBAAA,GAAAA,oBAAA","ignoreList":[]}
1
+ {"version":3,"names":["_renderFields","require","_renderInputFields","createTypeFromFields","params","typeOfType","model","models","type","typeNamePrefix","fields","fieldTypePlugins","typeSuffix","mTypeName","singularApiName","typeFields","nestedTypes","replace","RegExp","field","result","renderField","renderInputField","typeDefs","push","length","fieldType","join","exports"],"sources":["createTypeFromFields.ts"],"sourcesContent":["import { renderField } from \"~/utils/renderFields\";\nimport { renderInputField } from \"~/utils/renderInputFields\";\nimport type { ApiEndpoint, CmsFieldTypePlugins, CmsModel, CmsModelField } from \"~/types\";\n\ninterface TypeFromFieldParams {\n typeOfType: \"type\" | \"input\";\n models: CmsModel[];\n model: CmsModel;\n type: ApiEndpoint;\n typeNamePrefix: string;\n fields: CmsModelField[];\n fieldTypePlugins: CmsFieldTypePlugins;\n}\n\ninterface TypeFromFieldResponse {\n fieldType: string;\n typeDefs: string;\n}\n\nexport const createTypeFromFields = (params: TypeFromFieldParams): TypeFromFieldResponse | null => {\n const { typeOfType, model, models, type, typeNamePrefix, fields, fieldTypePlugins } = params;\n const typeSuffix = typeOfType === \"input\" ? \"Input\" : \"\";\n const mTypeName = model.singularApiName;\n\n const typeFields: string[] = [];\n const nestedTypes: string[] = [];\n\n // Once the loop below starts, we'll be executing a recursive \"object\" type generation.\n // The main trick here is that nested objects don't know who the parent is, and will generate\n // type names using the \"model\", as if they're at the top level:\n // Every time the types are returned, we need to replace the model name in the generated type name\n // with the actual prefix which includes parent field name type.\n const replace = new RegExp(`${mTypeName}_`, \"g\");\n\n for (const field of fields) {\n const result =\n typeOfType === \"type\"\n ? renderField({ field, type, models, model, fieldTypePlugins })\n : renderInputField({ field, models, model, fieldTypePlugins });\n\n if (!result) {\n continue;\n }\n\n const { fields, typeDefs } = result;\n\n typeFields.push(fields.replace(replace, `${typeNamePrefix}_`));\n if (typeDefs) {\n nestedTypes.push(typeDefs.replace(replace, `${typeNamePrefix}_`));\n }\n }\n\n if (!typeFields.length) {\n typeFields.push(\"_empty: String\");\n }\n\n return {\n fieldType: `${typeNamePrefix}${typeSuffix}`,\n typeDefs: /* GraphQL */ `\n ${nestedTypes.join(\"\\n\")}\n\n ${typeOfType} ${typeNamePrefix}${typeSuffix} {\n ${typeFields.join(\"\\n\")}\n }\\n\n `\n };\n};\n"],"mappings":";;;;;;AAAA,IAAAA,aAAA,GAAAC,OAAA;AACA,IAAAC,kBAAA,GAAAD,OAAA;AAkBO,MAAME,oBAAoB,GAAIC,MAA2B,IAAmC;EAC/F,MAAM;IAAEC,UAAU;IAAEC,KAAK;IAAEC,MAAM;IAAEC,IAA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B,UAAU,IAAII,cAAc,GAAGG,UAAU;AACvD,kBAAkBG,UAAU,CAACY,IAAI,CAAC,IAAI,CAAC;AACvC;AACA;EACI,CAAC;AACL,CAAC;AAACC,OAAA,CAAAzB,oBAAA,GAAAA,oBAAA","ignoreList":[]}
@@ -1,5 +1,5 @@
1
1
  import { StorageTransformPlugin } from "../plugins/StorageTransformPlugin";
2
- import { CmsContext, CmsEntry, CmsModel, CmsModelField } from "../types";
2
+ import type { CmsContext, CmsEntry, CmsEntryValues, CmsModel, CmsModelField } from "../types";
3
3
  export interface GetStoragePluginFactory {
4
4
  (context: Pick<CmsContext, "plugins">): (fieldType: string) => StorageTransformPlugin<any>;
5
5
  }
@@ -19,4 +19,11 @@ interface EntryFieldFromStorageTransformParams {
19
19
  value: any;
20
20
  }
21
21
  export declare const entryFieldFromStorageTransform: <T = any>(params: EntryFieldFromStorageTransformParams) => Promise<T>;
22
+ export interface ICreateTransformEntryCallable {
23
+ context: Pick<CmsContext, "plugins">;
24
+ }
25
+ export interface ITransformEntryCallable<T extends CmsEntryValues = CmsEntryValues> {
26
+ (model: CmsModel, entry: CmsEntry): Promise<CmsEntry<T>>;
27
+ }
28
+ export declare const createTransformEntryCallable: (params: ICreateTransformEntryCallable) => ITransformEntryCallable;
22
29
  export {};
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.getStoragePluginFactory = exports.entryToStorageTransform = exports.entryFromStorageTransform = exports.entryFieldFromStorageTransform = void 0;
7
+ exports.getStoragePluginFactory = exports.entryToStorageTransform = exports.entryFromStorageTransform = exports.entryFieldFromStorageTransform = exports.createTransformEntryCallable = void 0;
8
8
  var _error = _interopRequireDefault(require("@webiny/error"));
9
9
  var _StorageTransformPlugin = require("../plugins/StorageTransformPlugin");
10
10
  var _getBaseFieldType = require("./getBaseFieldType");
@@ -32,15 +32,30 @@ const getStoragePluginFactory = context => {
32
32
  return plugins[fieldType] || defaultStoragePlugin;
33
33
  };
34
34
  };
35
+ exports.getStoragePluginFactory = getStoragePluginFactory;
36
+ const doNotTouchProperty = Symbol("__DO_NOT_TOUCH_AS_WE_USE_IT_TO_SKIP_UNNECESSARY_OPERATIONS");
35
37
 
36
38
  /**
37
39
  * This should be used when transforming the whole entry.
38
40
  */
39
- exports.getStoragePluginFactory = getStoragePluginFactory;
40
41
  const entryStorageTransform = async (context, model, operation, entry) => {
42
+ /**
43
+ * We use this property to skip unnecessary operations.
44
+ */
45
+ // @ts-expect-error
46
+ if (entry[doNotTouchProperty] === operation) {
47
+ return entry;
48
+ }
41
49
  const getStoragePlugin = getStoragePluginFactory(context);
42
50
  const transformedValues = {};
43
51
  for (const field of model.fields) {
52
+ /**
53
+ * We can safely skip fields that are not present in the entry values.
54
+ */
55
+ if (entry.values.hasOwnProperty(field.fieldId) === false) {
56
+ continue;
57
+ }
58
+ const value = entry.values[field.fieldId];
44
59
  const baseType = (0, _getBaseFieldType.getBaseFieldType)(field);
45
60
  const plugin = getStoragePlugin(baseType);
46
61
  // TODO: remove this once plugins are converted into classes
@@ -51,14 +66,23 @@ const entryStorageTransform = async (context, model, operation, entry) => {
51
66
  plugins: context.plugins,
52
67
  model,
53
68
  field,
54
- value: entry.values[field.fieldId],
69
+ value,
55
70
  getStoragePlugin
56
71
  });
57
72
  }
58
- return {
73
+ const result = {
59
74
  ...entry,
60
75
  values: transformedValues
61
76
  };
77
+ /**
78
+ * We need to assign the variable so that we can skip unnecessary operations next time.
79
+ */
80
+ Object.defineProperty(result, doNotTouchProperty, {
81
+ enumerable: false,
82
+ value: operation,
83
+ configurable: true
84
+ });
85
+ return result;
62
86
  };
63
87
 
64
88
  /**
@@ -103,5 +127,14 @@ const entryFieldFromStorageTransform = async params => {
103
127
  });
104
128
  };
105
129
  exports.entryFieldFromStorageTransform = entryFieldFromStorageTransform;
130
+ const createTransformEntryCallable = params => {
131
+ const {
132
+ context
133
+ } = params;
134
+ return async (model, entry) => {
135
+ return entryFromStorageTransform(context, model, entry);
136
+ };
137
+ };
138
+ exports.createTransformEntryCallable = createTransformEntryCallable;
106
139
 
107
140
  //# sourceMappingURL=entryStorage.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["_error","_interopRequireDefault","require","_StorageTransformPlugin","_getBaseFieldType","getStoragePluginFactory","context","defaultStoragePlugin","plugins","byType","StorageTransformPlugin","type","reverse","reduce","collection","plugin","fieldType","exports","entryStorageTransform","model","operation","entry","getStoragePlugin","transformedValues","field","fields","baseType","getBaseFieldType","WebinyError","name","fieldId","value","values","entryToStorageTransform","entryFromStorageTransform","entryFieldFromStorageTransform","params","fromStorage"],"sources":["entryStorage.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { StorageTransformPlugin } from \"~/plugins/StorageTransformPlugin\";\nimport { CmsContext, CmsEntry, CmsModel, CmsModelField } from \"~/types\";\nimport { getBaseFieldType } from \"~/utils/getBaseFieldType\";\n\nexport interface GetStoragePluginFactory {\n (context: Pick<CmsContext, \"plugins\">): (fieldType: string) => StorageTransformPlugin<any>;\n}\n\nexport const getStoragePluginFactory: GetStoragePluginFactory = context => {\n let defaultStoragePlugin: StorageTransformPlugin;\n\n const plugins = context.plugins\n .byType<StorageTransformPlugin>(StorageTransformPlugin.type)\n // we reverse plugins because we want to get latest added only\n .reverse()\n .reduce((collection, plugin) => {\n /**\n * Check if it's a default plugin and set it - always override the previous one.\n */\n if (plugin.fieldType === \"*\") {\n defaultStoragePlugin = plugin;\n return collection;\n }\n\n /**\n * We will just set the plugin for given type.\n * The last one will override existing one - so users can override our default ones.\n */\n collection[plugin.fieldType] = plugin;\n\n return collection;\n }, {} as Record<string, StorageTransformPlugin>);\n\n return (fieldType: string) => {\n return plugins[fieldType] || defaultStoragePlugin;\n };\n};\n\n/**\n * This should be used when transforming the whole entry.\n */\nconst entryStorageTransform = async (\n context: Pick<CmsContext, \"plugins\">,\n model: CmsModel,\n operation: \"toStorage\" | \"fromStorage\",\n entry: CmsEntry\n): Promise<CmsEntry> => {\n const getStoragePlugin = getStoragePluginFactory(context);\n\n const transformedValues: Record<string, any> = {};\n for (const field of model.fields) {\n const baseType = getBaseFieldType(field);\n const plugin = getStoragePlugin(baseType);\n // TODO: remove this once plugins are converted into classes\n if (typeof plugin[operation] !== \"function\") {\n throw new WebinyError(\n `Missing \"${operation}\" function in storage plugin \"${plugin.name}\" for field type \"${baseType}\"`\n );\n }\n\n transformedValues[field.fieldId] = await plugin[operation]({\n plugins: context.plugins,\n model,\n field,\n value: entry.values[field.fieldId],\n getStoragePlugin\n });\n }\n\n return { ...entry, values: transformedValues };\n};\n\n/**\n * A function that is used in crud to transform entry into the storage type.\n */\nexport const entryToStorageTransform = async (\n context: Pick<CmsContext, \"plugins\">,\n model: CmsModel,\n entry: CmsEntry\n): Promise<CmsEntry> => {\n return entryStorageTransform(context, model, \"toStorage\", entry);\n};\n\n/**\n * A function that is used to transform the whole entry from storage into its native form.\n */\nexport const entryFromStorageTransform = async (\n context: Pick<CmsContext, \"plugins\">,\n model: CmsModel,\n entry: CmsEntry\n): Promise<CmsEntry> => {\n return entryStorageTransform(context, model, \"fromStorage\", entry);\n};\n\ninterface EntryFieldFromStorageTransformParams {\n context: Pick<CmsContext, \"plugins\">;\n model: CmsModel;\n field: CmsModelField;\n value: any;\n}\n/*\n * A function that is used to transform a single field from storage\n */\nexport const entryFieldFromStorageTransform = async <T = any>(\n params: EntryFieldFromStorageTransformParams\n): Promise<T> => {\n const { context, model, field, value } = params;\n const getStoragePlugin = getStoragePluginFactory(context);\n\n const baseType = getBaseFieldType(field);\n const plugin = getStoragePlugin(baseType);\n\n // TODO: remove this once plugins are converted into classes\n if (typeof plugin.fromStorage !== \"function\") {\n throw new WebinyError(\n `Missing \"fromStorage\" function in storage plugin \"${plugin.name}\" for field type \"${baseType}\"`\n );\n }\n\n return plugin.fromStorage({\n plugins: context.plugins,\n model,\n field,\n value,\n getStoragePlugin\n });\n};\n"],"mappings":";;;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,CAACsB,WAAW,KAAK,UAAU,EAAE;IAC1C,MAAM,IAAIT,cAAW,CACjB,qDAAqDb,MAAM,CAACc,IAAI,qBAAqBH,QAAQ,GACjG,CAAC;EACL;EAEA,OAAOX,MAAM,CAACsB,WAAW,CAAC;IACtB7B,OAAO,EAAEF,OAAO,CAACE,OAAO;IACxBW,KAAK;IACLK,KAAK;IACLO,KAAK;IACLT;EACJ,CAAC,CAAC;AACN,CAAC;AAACL,OAAA,CAAAkB,8BAAA,GAAAA,8BAAA","ignoreList":[]}
1
+ {"version":3,"names":["_error","_interopRequireDefault","require","_StorageTransformPlugin","_getBaseFieldType","getStoragePluginFactory","context","defaultStoragePlugin","plugins","byType","StorageTransformPlugin","type","reverse","reduce","collection","plugin","fieldType","exports","doNotTouchProperty","Symbol","entryStorageTransform","model","operation","entry","getStoragePlugin","transformedValues","field","fields","values","hasOwnProperty","fieldId","value","baseType","getBaseFieldType","WebinyError","name","result","Object","defineProperty","enumerable","configurable","entryToStorageTransform","entryFromStorageTransform","entryFieldFromStorageTransform","params","fromStorage","createTransformEntryCallable"],"sources":["entryStorage.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { StorageTransformPlugin } from \"~/plugins/StorageTransformPlugin\";\nimport type { CmsContext, CmsEntry, CmsEntryValues, CmsModel, CmsModelField } from \"~/types\";\nimport { getBaseFieldType } from \"~/utils/getBaseFieldType\";\n\nexport interface GetStoragePluginFactory {\n (context: Pick<CmsContext, \"plugins\">): (fieldType: string) => StorageTransformPlugin<any>;\n}\n\nexport const getStoragePluginFactory: GetStoragePluginFactory = context => {\n let defaultStoragePlugin: StorageTransformPlugin;\n\n const plugins = context.plugins\n .byType<StorageTransformPlugin>(StorageTransformPlugin.type)\n // we reverse plugins because we want to get latest added only\n .reverse()\n .reduce((collection, plugin) => {\n /**\n * Check if it's a default plugin and set it - always override the previous one.\n */\n if (plugin.fieldType === \"*\") {\n defaultStoragePlugin = plugin;\n return collection;\n }\n\n /**\n * We will just set the plugin for given type.\n * The last one will override existing one - so users can override our default ones.\n */\n collection[plugin.fieldType] = plugin;\n\n return collection;\n }, {} as Record<string, StorageTransformPlugin>);\n\n return (fieldType: string) => {\n return plugins[fieldType] || defaultStoragePlugin;\n };\n};\n\nconst doNotTouchProperty = Symbol(\"__DO_NOT_TOUCH_AS_WE_USE_IT_TO_SKIP_UNNECESSARY_OPERATIONS\");\n\n/**\n * This should be used when transforming the whole entry.\n */\nconst entryStorageTransform = async (\n context: Pick<CmsContext, \"plugins\">,\n model: CmsModel,\n operation: \"toStorage\" | \"fromStorage\",\n entry: CmsEntry\n): Promise<CmsEntry> => {\n /**\n * We use this property to skip unnecessary operations.\n */\n // @ts-expect-error\n if (entry[doNotTouchProperty] === operation) {\n return entry;\n }\n\n const getStoragePlugin = getStoragePluginFactory(context);\n\n const transformedValues: Record<string, any> = {};\n for (const field of model.fields) {\n /**\n * We can safely skip fields that are not present in the entry values.\n */\n if (entry.values.hasOwnProperty(field.fieldId) === false) {\n continue;\n }\n const value = entry.values[field.fieldId];\n\n const baseType = getBaseFieldType(field);\n const plugin = getStoragePlugin(baseType);\n // TODO: remove this once plugins are converted into classes\n if (typeof plugin[operation] !== \"function\") {\n throw new WebinyError(\n `Missing \"${operation}\" function in storage plugin \"${plugin.name}\" for field type \"${baseType}\"`\n );\n }\n\n transformedValues[field.fieldId] = await plugin[operation]({\n plugins: context.plugins,\n model,\n field,\n value,\n getStoragePlugin\n });\n }\n\n const result = {\n ...entry,\n values: transformedValues\n };\n /**\n * We need to assign the variable so that we can skip unnecessary operations next time.\n */\n Object.defineProperty(result, doNotTouchProperty, {\n enumerable: false,\n value: operation,\n configurable: true\n });\n\n return result;\n};\n\n/**\n * A function that is used in crud to transform entry into the storage type.\n */\nexport const entryToStorageTransform = async (\n context: Pick<CmsContext, \"plugins\">,\n model: CmsModel,\n entry: CmsEntry\n): Promise<CmsEntry> => {\n return entryStorageTransform(context, model, \"toStorage\", entry);\n};\n\n/**\n * A function that is used to transform the whole entry from storage into its native form.\n */\nexport const entryFromStorageTransform = async (\n context: Pick<CmsContext, \"plugins\">,\n model: CmsModel,\n entry: CmsEntry\n): Promise<CmsEntry> => {\n return entryStorageTransform(context, model, \"fromStorage\", entry);\n};\n\ninterface EntryFieldFromStorageTransformParams {\n context: Pick<CmsContext, \"plugins\">;\n model: CmsModel;\n field: CmsModelField;\n value: any;\n}\n/*\n * A function that is used to transform a single field from storage\n */\nexport const entryFieldFromStorageTransform = async <T = any>(\n params: EntryFieldFromStorageTransformParams\n): Promise<T> => {\n const { context, model, field, value } = params;\n const getStoragePlugin = getStoragePluginFactory(context);\n\n const baseType = getBaseFieldType(field);\n const plugin = getStoragePlugin(baseType);\n\n // TODO: remove this once plugins are converted into classes\n if (typeof plugin.fromStorage !== \"function\") {\n throw new WebinyError(\n `Missing \"fromStorage\" function in storage plugin \"${plugin.name}\" for field type \"${baseType}\"`\n );\n }\n\n return plugin.fromStorage({\n plugins: context.plugins,\n model,\n field,\n value,\n getStoragePlugin\n });\n};\n\nexport interface ICreateTransformEntryCallable {\n context: Pick<CmsContext, \"plugins\">;\n}\n\nexport interface ITransformEntryCallable<T extends CmsEntryValues = CmsEntryValues> {\n (model: CmsModel, entry: CmsEntry): Promise<CmsEntry<T>>;\n}\n\nexport const createTransformEntryCallable = (\n params: ICreateTransformEntryCallable\n): ITransformEntryCallable => {\n const { context } = params;\n\n return async (model, entry) => {\n return entryFromStorageTransform(context, model, entry);\n };\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,uBAAA,GAAAD,OAAA;AAEA,IAAAE,iBAAA,GAAAF,OAAA;AAMO,MAAMG,uBAAgD,GAAGC,OAAO,IAAI;EACvE,IAAIC,oBAA4C;EAEhD,MAAMC,OAAO,GAAGF,OAAO,CAACE,OAAO,CAC1BC,MAAM,CAAyBC,8CAAsB,CAACC,IAAI;EAC3D;EAAA,CACCC,OAAO,CAAC,CAAC,CACTC,MAAM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uBAAuB,CAACC,OAAO,CAAC;EAEzD,MAAM0B,QAAQ,GAAG,IAAAC,kCAAgB,EAACP,KAAK,CAAC;EACxC,MAAMX,MAAM,GAAGS,gBAAgB,CAACQ,QAAQ,CAAC;;EAEzC;EACA,IAAI,OAAOjB,MAAM,CAAC8B,WAAW,KAAK,UAAU,EAAE;IAC1C,MAAM,IAAIX,cAAW,CACjB,qDAAqDnB,MAAM,CAACoB,IAAI,qBAAqBH,QAAQ,GACjG,CAAC;EACL;EAEA,OAAOjB,MAAM,CAAC8B,WAAW,CAAC;IACtBrC,OAAO,EAAEF,OAAO,CAACE,OAAO;IACxBa,KAAK;IACLK,KAAK;IACLK,KAAK;IACLP;EACJ,CAAC,CAAC;AACN,CAAC;AAACP,OAAA,CAAA0B,8BAAA,GAAAA,8BAAA;AAUK,MAAMG,4BAA4B,GACrCF,MAAqC,IACX;EAC1B,MAAM;IAAEtC;EAAQ,CAAC,GAAGsC,MAAM;EAE1B,OAAO,OAAOvB,KAAK,EAAEE,KAAK,KAAK;IAC3B,OAAOmB,yBAAyB,CAACpC,OAAO,EAAEe,KAAK,EAAEE,KAAK,CAAC;EAC3D,CAAC;AACL,CAAC;AAACN,OAAA,CAAA6B,4BAAA,GAAAA,4BAAA","ignoreList":[]}
@@ -1,2 +1,2 @@
1
- import { CmsModelField } from "../types";
1
+ import type { CmsModelField } from "../types";
2
2
  export declare const getBaseFieldType: (field: Pick<CmsModelField, "type">) => string;
@@ -1 +1 @@
1
- {"version":3,"names":["getBaseFieldType","field","type","split","exports"],"sources":["getBaseFieldType.ts"],"sourcesContent":["import { CmsModelField } from \"~/types\";\n\nexport const getBaseFieldType = (field: Pick<CmsModelField, \"type\">) => {\n return field.type.split(\":\")[0];\n};\n"],"mappings":";;;;;;AAEO,MAAMA,gBAAgB,GAAIC,KAAkC,IAAK;EACpE,OAAOA,KAAK,CAACC,IAAI,CAACC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AACnC,CAAC;AAACC,OAAA,CAAAJ,gBAAA,GAAAA,gBAAA","ignoreList":[]}
1
+ {"version":3,"names":["getBaseFieldType","field","type","split","exports"],"sources":["getBaseFieldType.ts"],"sourcesContent":["import type { CmsModelField } from \"~/types\";\n\nexport const getBaseFieldType = (field: Pick<CmsModelField, \"type\">) => {\n return field.type.split(\":\")[0];\n};\n"],"mappings":";;;;;;AAEO,MAAMA,gBAAgB,GAAIC,KAAkC,IAAK;EACpE,OAAOA,KAAK,CAACC,IAAI,CAACC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AACnC,CAAC;AAACC,OAAA,CAAAJ,gBAAA,GAAAA,gBAAA","ignoreList":[]}
@@ -1,2 +1,2 @@
1
- import { CmsEntry, CmsModel } from "../types";
1
+ import type { CmsEntry, CmsModel } from "../types";
2
2
  export declare function getEntryDescription(model: Pick<CmsModel, "descriptionFieldId" | "fields">, entry: CmsEntry): string;
@@ -1 +1 @@
1
- {"version":3,"names":["getEntryDescription","model","entry","descriptionFieldId","field","fields","find","f","fieldId","values"],"sources":["getEntryDescription.ts"],"sourcesContent":["import { CmsEntry, CmsModel } from \"~/types\";\n\nexport function getEntryDescription(\n model: Pick<CmsModel, \"descriptionFieldId\" | \"fields\">,\n entry: CmsEntry\n): string {\n if (!model.descriptionFieldId) {\n return \"\";\n }\n const field = model.fields.find(f => f.fieldId === model.descriptionFieldId);\n if (!field) {\n return \"\";\n }\n const descriptionFieldId = field.fieldId;\n return entry.values[descriptionFieldId] || \"\";\n}\n"],"mappings":";;;;;;AAEO,SAASA,mBAAmBA,CAC/BC,KAAsD,EACtDC,KAAe,EACT;EACN,IAAI,CAACD,KAAK,CAACE,kBAAkB,EAAE;IAC3B,OAAO,EAAE;EACb;EACA,MAAMC,KAAK,GAAGH,KAAK,CAACI,MAAM,CAACC,IAAI,CAACC,CAAC,IAAIA,CAAC,CAACC,OAAO,KAAKP,KAAK,CAACE,kBAAkB,CAAC;EAC5E,IAAI,CAACC,KAAK,EAAE;IACR,OAAO,EAAE;EACb;EACA,MAAMD,kBAAkB,GAAGC,KAAK,CAACI,OAAO;EACxC,OAAON,KAAK,CAACO,MAAM,CAACN,kBAAkB,CAAC,IAAI,EAAE;AACjD","ignoreList":[]}
1
+ {"version":3,"names":["getEntryDescription","model","entry","descriptionFieldId","field","fields","find","f","fieldId","values"],"sources":["getEntryDescription.ts"],"sourcesContent":["import type { CmsEntry, CmsModel } from \"~/types\";\n\nexport function getEntryDescription(\n model: Pick<CmsModel, \"descriptionFieldId\" | \"fields\">,\n entry: CmsEntry\n): string {\n if (!model.descriptionFieldId) {\n return \"\";\n }\n const field = model.fields.find(f => f.fieldId === model.descriptionFieldId);\n if (!field) {\n return \"\";\n }\n const descriptionFieldId = field.fieldId;\n return entry.values[descriptionFieldId] || \"\";\n}\n"],"mappings":";;;;;;AAEO,SAASA,mBAAmBA,CAC/BC,KAAsD,EACtDC,KAAe,EACT;EACN,IAAI,CAACD,KAAK,CAACE,kBAAkB,EAAE;IAC3B,OAAO,EAAE;EACb;EACA,MAAMC,KAAK,GAAGH,KAAK,CAACI,MAAM,CAACC,IAAI,CAACC,CAAC,IAAIA,CAAC,CAACC,OAAO,KAAKP,KAAK,CAACE,kBAAkB,CAAC;EAC5E,IAAI,CAACC,KAAK,EAAE;IACR,OAAO,EAAE;EACb;EACA,MAAMD,kBAAkB,GAAGC,KAAK,CAACI,OAAO;EACxC,OAAON,KAAK,CAACO,MAAM,CAACN,kBAAkB,CAAC,IAAI,EAAE;AACjD","ignoreList":[]}
@@ -1,2 +1,2 @@
1
- import { CmsEntry, CmsModel } from "../types";
1
+ import type { CmsEntry, CmsModel } from "../types";
2
2
  export declare function getEntryImage(model: Pick<CmsModel, "imageFieldId" | "fields">, entry: CmsEntry): string | null;
@@ -1 +1 @@
1
- {"version":3,"names":["getEntryImage","model","entry","imageFieldId","field","fields","find","f","fieldId","values"],"sources":["getEntryImage.ts"],"sourcesContent":["import { CmsEntry, CmsModel } from \"~/types\";\n\nexport function getEntryImage(\n model: Pick<CmsModel, \"imageFieldId\" | \"fields\">,\n entry: CmsEntry\n): string | null {\n if (!model.imageFieldId) {\n return null;\n }\n const field = model.fields.find(f => f.fieldId === model.imageFieldId);\n if (!field) {\n return null;\n }\n const imageFieldId = field.fieldId;\n return entry.values[imageFieldId] || null;\n}\n"],"mappings":";;;;;;AAEO,SAASA,aAAaA,CACzBC,KAAgD,EAChDC,KAAe,EACF;EACb,IAAI,CAACD,KAAK,CAACE,YAAY,EAAE;IACrB,OAAO,IAAI;EACf;EACA,MAAMC,KAAK,GAAGH,KAAK,CAACI,MAAM,CAACC,IAAI,CAACC,CAAC,IAAIA,CAAC,CAACC,OAAO,KAAKP,KAAK,CAACE,YAAY,CAAC;EACtE,IAAI,CAACC,KAAK,EAAE;IACR,OAAO,IAAI;EACf;EACA,MAAMD,YAAY,GAAGC,KAAK,CAACI,OAAO;EAClC,OAAON,KAAK,CAACO,MAAM,CAACN,YAAY,CAAC,IAAI,IAAI;AAC7C","ignoreList":[]}
1
+ {"version":3,"names":["getEntryImage","model","entry","imageFieldId","field","fields","find","f","fieldId","values"],"sources":["getEntryImage.ts"],"sourcesContent":["import type { CmsEntry, CmsModel } from \"~/types\";\n\nexport function getEntryImage(\n model: Pick<CmsModel, \"imageFieldId\" | \"fields\">,\n entry: CmsEntry\n): string | null {\n if (!model.imageFieldId) {\n return null;\n }\n const field = model.fields.find(f => f.fieldId === model.imageFieldId);\n if (!field) {\n return null;\n }\n const imageFieldId = field.fieldId;\n return entry.values[imageFieldId] || null;\n}\n"],"mappings":";;;;;;AAEO,SAASA,aAAaA,CACzBC,KAAgD,EAChDC,KAAe,EACF;EACb,IAAI,CAACD,KAAK,CAACE,YAAY,EAAE;IACrB,OAAO,IAAI;EACf;EACA,MAAMC,KAAK,GAAGH,KAAK,CAACI,MAAM,CAACC,IAAI,CAACC,CAAC,IAAIA,CAAC,CAACC,OAAO,KAAKP,KAAK,CAACE,YAAY,CAAC;EACtE,IAAI,CAACC,KAAK,EAAE;IACR,OAAO,IAAI;EACf;EACA,MAAMD,YAAY,GAAGC,KAAK,CAACI,OAAO;EAClC,OAAON,KAAK,CAACO,MAAM,CAACN,YAAY,CAAC,IAAI,IAAI;AAC7C","ignoreList":[]}
@@ -1,2 +1,2 @@
1
- import { CmsEntry, CmsModel } from "../types";
1
+ import type { CmsEntry, CmsModel } from "../types";
2
2
  export declare function getEntryTitle(model: Pick<CmsModel, "titleFieldId" | "fields">, entry: CmsEntry): string;
@@ -1 +1 @@
1
- {"version":3,"names":["getEntryTitle","model","entry","titleFieldId","id","field","fields","find","f","fieldId","titleValue","values","enabled","predefinedValues","Array","isArray","value","label"],"sources":["getEntryTitle.ts"],"sourcesContent":["import { CmsEntry, CmsModel } from \"~/types\";\n\nexport function getEntryTitle(\n model: Pick<CmsModel, \"titleFieldId\" | \"fields\">,\n entry: CmsEntry\n): string {\n if (!model.titleFieldId) {\n return entry.id;\n }\n const field = model.fields.find(f => f.fieldId === model.titleFieldId);\n if (!field) {\n return entry.id;\n }\n const titleFieldId = field.fieldId;\n const titleValue = entry.values[titleFieldId];\n if (!titleValue) {\n return entry.id;\n }\n\n const { enabled = false, values } = field.predefinedValues || {};\n if (!enabled || !values || Array.isArray(values) === false) {\n return titleValue;\n }\n for (const value of values) {\n // needs to be loose because titleValue can be a number and value can be a string - but it must match\n if (value.value == titleValue) {\n return value.label;\n }\n }\n return titleValue;\n}\n"],"mappings":";;;;;;AAEO,SAASA,aAAaA,CACzBC,KAAgD,EAChDC,KAAe,EACT;EACN,IAAI,CAACD,KAAK,CAACE,YAAY,EAAE;IACrB,OAAOD,KAAK,CAACE,EAAE;EACnB;EACA,MAAMC,KAAK,GAAGJ,KAAK,CAACK,MAAM,CAACC,IAAI,CAACC,CAAC,IAAIA,CAAC,CAACC,OAAO,KAAKR,KAAK,CAACE,YAAY,CAAC;EACtE,IAAI,CAACE,KAAK,EAAE;IACR,OAAOH,KAAK,CAACE,EAAE;EACnB;EACA,MAAMD,YAAY,GAAGE,KAAK,CAACI,OAAO;EAClC,MAAMC,UAAU,GAAGR,KAAK,CAACS,MAAM,CAACR,YAAY,CAAC;EAC7C,IAAI,CAACO,UAAU,EAAE;IACb,OAAOR,KAAK,CAACE,EAAE;EACnB;EAEA,MAAM;IAAEQ,OAAO,GAAG,KAAK;IAAED;EAAO,CAAC,GAAGN,KAAK,CAACQ,gBAAgB,IAAI,CAAC,CAAC;EAChE,IAAI,CAACD,OAAO,IAAI,CAACD,MAAM,IAAIG,KAAK,CAACC,OAAO,CAACJ,MAAM,CAAC,KAAK,KAAK,EAAE;IACxD,OAAOD,UAAU;EACrB;EACA,KAAK,MAAMM,KAAK,IAAIL,MAAM,EAAE;IACxB;IACA,IAAIK,KAAK,CAACA,KAAK,IAAIN,UAAU,EAAE;MAC3B,OAAOM,KAAK,CAACC,KAAK;IACtB;EACJ;EACA,OAAOP,UAAU;AACrB","ignoreList":[]}
1
+ {"version":3,"names":["getEntryTitle","model","entry","titleFieldId","id","field","fields","find","f","fieldId","titleValue","values","enabled","predefinedValues","Array","isArray","value","label"],"sources":["getEntryTitle.ts"],"sourcesContent":["import type { CmsEntry, CmsModel } from \"~/types\";\n\nexport function getEntryTitle(\n model: Pick<CmsModel, \"titleFieldId\" | \"fields\">,\n entry: CmsEntry\n): string {\n if (!model.titleFieldId) {\n return entry.id;\n }\n const field = model.fields.find(f => f.fieldId === model.titleFieldId);\n if (!field) {\n return entry.id;\n }\n const titleFieldId = field.fieldId;\n const titleValue = entry.values[titleFieldId];\n if (!titleValue) {\n return entry.id;\n }\n\n const { enabled = false, values } = field.predefinedValues || {};\n if (!enabled || !values || Array.isArray(values) === false) {\n return titleValue;\n }\n for (const value of values) {\n // needs to be loose because titleValue can be a number and value can be a string - but it must match\n if (value.value == titleValue) {\n return value.label;\n }\n }\n return titleValue;\n}\n"],"mappings":";;;;;;AAEO,SAASA,aAAaA,CACzBC,KAAgD,EAChDC,KAAe,EACT;EACN,IAAI,CAACD,KAAK,CAACE,YAAY,EAAE;IACrB,OAAOD,KAAK,CAACE,EAAE;EACnB;EACA,MAAMC,KAAK,GAAGJ,KAAK,CAACK,MAAM,CAACC,IAAI,CAACC,CAAC,IAAIA,CAAC,CAACC,OAAO,KAAKR,KAAK,CAACE,YAAY,CAAC;EACtE,IAAI,CAACE,KAAK,EAAE;IACR,OAAOH,KAAK,CAACE,EAAE;EACnB;EACA,MAAMD,YAAY,GAAGE,KAAK,CAACI,OAAO;EAClC,MAAMC,UAAU,GAAGR,KAAK,CAACS,MAAM,CAACR,YAAY,CAAC;EAC7C,IAAI,CAACO,UAAU,EAAE;IACb,OAAOR,KAAK,CAACE,EAAE;EACnB;EAEA,MAAM;IAAEQ,OAAO,GAAG,KAAK;IAAED;EAAO,CAAC,GAAGN,KAAK,CAACQ,gBAAgB,IAAI,CAAC,CAAC;EAChE,IAAI,CAACD,OAAO,IAAI,CAACD,MAAM,IAAIG,KAAK,CAACC,OAAO,CAACJ,MAAM,CAAC,KAAK,KAAK,EAAE;IACxD,OAAOD,UAAU;EACrB;EACA,KAAK,MAAMM,KAAK,IAAIL,MAAM,EAAE;IACxB;IACA,IAAIK,KAAK,CAACA,KAAK,IAAIN,UAAU,EAAE;MAC3B,OAAOM,KAAK,CAACC,KAAK;IACtB;EACJ;EACA,OAAOP,UAAU;AACrB","ignoreList":[]}
@@ -1,7 +1,7 @@
1
- import { ApiEndpoint, CmsContext, CmsFieldTypePlugins, CmsModel } from "../types";
2
- import { ICmsGraphQLSchemaPlugin } from "../plugins";
3
- import { IGraphQLSchemaPlugin } from "@webiny/handler-graphql";
4
- import { GraphQLSchemaDefinition } from "@webiny/handler-graphql/types";
1
+ import type { ApiEndpoint, CmsContext, CmsFieldTypePlugins, CmsModel } from "../types";
2
+ import type { ICmsGraphQLSchemaPlugin } from "../plugins";
3
+ import type { IGraphQLSchemaPlugin } from "@webiny/handler-graphql";
4
+ import type { GraphQLSchemaDefinition } from "@webiny/handler-graphql/types";
5
5
  interface CreatePluginCallableParams {
6
6
  schema: GraphQLSchemaDefinition<CmsContext>;
7
7
  type: "manage" | "preview" | "read";
@@ -1 +1 @@
1
- {"version":3,"names":["_plugins","require","TYPE_MAP","preview","read","manage","defaultCreatePlugin","schema","type","fieldType","plugin","createCmsGraphQLSchemaPlugin","name","createGraphQLSchemaPluginFromFieldPlugins","params","models","fieldTypePlugins","createPlugin","apiType","plugins","key","fieldTypePlugin","createSchema","push","exports"],"sources":["getSchemaFromFieldPlugins.ts"],"sourcesContent":["import { ApiEndpoint, CmsContext, CmsFieldTypePlugins, CmsModel } from \"~/types\";\nimport { createCmsGraphQLSchemaPlugin, ICmsGraphQLSchemaPlugin } from \"~/plugins\";\nimport { IGraphQLSchemaPlugin } from \"@webiny/handler-graphql\";\nimport { GraphQLSchemaDefinition } from \"@webiny/handler-graphql/types\";\n\nconst TYPE_MAP: Record<string, \"manage\" | \"read\"> = {\n preview: \"read\",\n read: \"read\",\n manage: \"manage\"\n};\n\ninterface CreatePluginCallableParams {\n schema: GraphQLSchemaDefinition<CmsContext>;\n type: \"manage\" | \"preview\" | \"read\";\n fieldType: string;\n}\n\ninterface CreatePluginCallable {\n (params: CreatePluginCallableParams): IGraphQLSchemaPlugin<CmsContext>;\n}\n\nconst defaultCreatePlugin: CreatePluginCallable = ({ schema, type, fieldType }) => {\n const plugin = createCmsGraphQLSchemaPlugin(schema);\n plugin.name = `headless-cms.graphql.schema.${type}.field.${fieldType}`;\n return plugin;\n};\n\ninterface Params {\n models: CmsModel[];\n fieldTypePlugins: CmsFieldTypePlugins;\n type: ApiEndpoint;\n createPlugin?: CreatePluginCallable;\n}\nexport const createGraphQLSchemaPluginFromFieldPlugins = (params: Params) => {\n const { models, fieldTypePlugins, type, createPlugin = defaultCreatePlugin } = params;\n\n const apiType = TYPE_MAP[type];\n\n const plugins: ICmsGraphQLSchemaPlugin[] = [];\n for (const key in fieldTypePlugins) {\n const fieldTypePlugin = fieldTypePlugins[key];\n if (!apiType || !fieldTypePlugin[apiType]) {\n continue;\n }\n const createSchema = fieldTypePlugin[apiType].createSchema;\n // Render gql types generated by field type plugins\n if (!createSchema) {\n continue;\n }\n const schema = createSchema({ models });\n\n // const plugin = createCmsGraphQLSchemaPlugin(schema);\n // plugin.name = `headless-cms.graphql.schema.${type}.field.${fieldTypePlugin.fieldType}`;\n const plugin = createPlugin({\n schema,\n type,\n fieldType: fieldTypePlugin.fieldType\n });\n plugins.push(plugin);\n }\n return plugins;\n};\n"],"mappings":";;;;;;AACA,IAAAA,QAAA,GAAAC,OAAA;AAIA,MAAMC,QAA2C,GAAG;EAChDC,OAAO,EAAE,MAAM;EACfC,IAAI,EAAE,MAAM;EACZC,MAAM,EAAE;AACZ,CAAC;AAYD,MAAMC,mBAAyC,GAAGA,CAAC;EAAEC,MAAM;EAAEC,IAAI;EAAEC;AAAU,CAAC,KAAK;EAC/E,MAAMC,MAAM,GAAG,IAAAC,qCAA4B,EAACJ,MAAM,CAAC;EACnDG,MAAM,CAACE,IAAI,GAAG,+BAA+BJ,IAAI,UAAUC,SAAS,EAAE;EACtE,OAAOC,MAAM;AACjB,CAAC;AAQM,MAAMG,yCAAyC,GAAIC,MAAc,IAAK;EACzE,MAAM;IAAEC,MAAM;IAAEC,gBAAgB;IAAER,IAAI;IAAES,YAAY,GAAGX;EAAoB,CAAC,GAAGQ,MAAM;EAErF,MAAMI,OAAO,GAAGhB,QAAQ,CAACM,IAAI,CAAC;EAE9B,MAAMW,OAAkC,GAAG,EAAE;EAC7C,KAAK,MAAMC,GAAG,IAAIJ,gBAAgB,EAAE;IAChC,MAAMK,eAAe,GAAGL,gBAAgB,CAACI,GAAG,CAAC;IAC7C,IAAI,CAACF,OAAO,IAAI,CAACG,eAAe,CAACH,OAAO,CAAC,EAAE;MACvC;IACJ;IACA,MAAMI,YAAY,GAAGD,eAAe,CAACH,OAAO,CAAC,CAACI,YAAY;IAC1D;IACA,IAAI,CAACA,YAAY,EAAE;MACf;IACJ;IACA,MAAMf,MAAM,GAAGe,YAAY,CAAC;MAAEP;IAAO,CAAC,CAAC;;IAEvC;IACA;IACA,MAAML,MAAM,GAAGO,YAAY,CAAC;MACxBV,MAAM;MACNC,IAAI;MACJC,SAAS,EAAEY,eAAe,CAACZ;IAC/B,CAAC,CAAC;IACFU,OAAO,CAACI,IAAI,CAACb,MAAM,CAAC;EACxB;EACA,OAAOS,OAAO;AAClB,CAAC;AAACK,OAAA,CAAAX,yCAAA,GAAAA,yCAAA","ignoreList":[]}
1
+ {"version":3,"names":["_plugins","require","TYPE_MAP","preview","read","manage","defaultCreatePlugin","schema","type","fieldType","plugin","createCmsGraphQLSchemaPlugin","name","createGraphQLSchemaPluginFromFieldPlugins","params","models","fieldTypePlugins","createPlugin","apiType","plugins","key","fieldTypePlugin","createSchema","push","exports"],"sources":["getSchemaFromFieldPlugins.ts"],"sourcesContent":["import type { ApiEndpoint, CmsContext, CmsFieldTypePlugins, CmsModel } from \"~/types\";\nimport type { ICmsGraphQLSchemaPlugin } from \"~/plugins\";\nimport { createCmsGraphQLSchemaPlugin } from \"~/plugins\";\nimport type { IGraphQLSchemaPlugin } from \"@webiny/handler-graphql\";\nimport type { GraphQLSchemaDefinition } from \"@webiny/handler-graphql/types\";\n\nconst TYPE_MAP: Record<string, \"manage\" | \"read\"> = {\n preview: \"read\",\n read: \"read\",\n manage: \"manage\"\n};\n\ninterface CreatePluginCallableParams {\n schema: GraphQLSchemaDefinition<CmsContext>;\n type: \"manage\" | \"preview\" | \"read\";\n fieldType: string;\n}\n\ninterface CreatePluginCallable {\n (params: CreatePluginCallableParams): IGraphQLSchemaPlugin<CmsContext>;\n}\n\nconst defaultCreatePlugin: CreatePluginCallable = ({ schema, type, fieldType }) => {\n const plugin = createCmsGraphQLSchemaPlugin(schema);\n plugin.name = `headless-cms.graphql.schema.${type}.field.${fieldType}`;\n return plugin;\n};\n\ninterface Params {\n models: CmsModel[];\n fieldTypePlugins: CmsFieldTypePlugins;\n type: ApiEndpoint;\n createPlugin?: CreatePluginCallable;\n}\nexport const createGraphQLSchemaPluginFromFieldPlugins = (params: Params) => {\n const { models, fieldTypePlugins, type, createPlugin = defaultCreatePlugin } = params;\n\n const apiType = TYPE_MAP[type];\n\n const plugins: ICmsGraphQLSchemaPlugin[] = [];\n for (const key in fieldTypePlugins) {\n const fieldTypePlugin = fieldTypePlugins[key];\n if (!apiType || !fieldTypePlugin[apiType]) {\n continue;\n }\n const createSchema = fieldTypePlugin[apiType].createSchema;\n // Render gql types generated by field type plugins\n if (!createSchema) {\n continue;\n }\n const schema = createSchema({ models });\n\n // const plugin = createCmsGraphQLSchemaPlugin(schema);\n // plugin.name = `headless-cms.graphql.schema.${type}.field.${fieldTypePlugin.fieldType}`;\n const plugin = createPlugin({\n schema,\n type,\n fieldType: fieldTypePlugin.fieldType\n });\n plugins.push(plugin);\n }\n return plugins;\n};\n"],"mappings":";;;;;;AAEA,IAAAA,QAAA,GAAAC,OAAA;AAIA,MAAMC,QAA2C,GAAG;EAChDC,OAAO,EAAE,MAAM;EACfC,IAAI,EAAE,MAAM;EACZC,MAAM,EAAE;AACZ,CAAC;AAYD,MAAMC,mBAAyC,GAAGA,CAAC;EAAEC,MAAM;EAAEC,IAAI;EAAEC;AAAU,CAAC,KAAK;EAC/E,MAAMC,MAAM,GAAG,IAAAC,qCAA4B,EAACJ,MAAM,CAAC;EACnDG,MAAM,CAACE,IAAI,GAAG,+BAA+BJ,IAAI,UAAUC,SAAS,EAAE;EACtE,OAAOC,MAAM;AACjB,CAAC;AAQM,MAAMG,yCAAyC,GAAIC,MAAc,IAAK;EACzE,MAAM;IAAEC,MAAM;IAAEC,gBAAgB;IAAER,IAAI;IAAES,YAAY,GAAGX;EAAoB,CAAC,GAAGQ,MAAM;EAErF,MAAMI,OAAO,GAAGhB,QAAQ,CAACM,IAAI,CAAC;EAE9B,MAAMW,OAAkC,GAAG,EAAE;EAC7C,KAAK,MAAMC,GAAG,IAAIJ,gBAAgB,EAAE;IAChC,MAAMK,eAAe,GAAGL,gBAAgB,CAACI,GAAG,CAAC;IAC7C,IAAI,CAACF,OAAO,IAAI,CAACG,eAAe,CAACH,OAAO,CAAC,EAAE;MACvC;IACJ;IACA,MAAMI,YAAY,GAAGD,eAAe,CAACH,OAAO,CAAC,CAACI,YAAY;IAC1D;IACA,IAAI,CAACA,YAAY,EAAE;MACf;IACJ;IACA,MAAMf,MAAM,GAAGe,YAAY,CAAC;MAAEP;IAAO,CAAC,CAAC;;IAEvC;IACA;IACA,MAAML,MAAM,GAAGO,YAAY,CAAC;MACxBV,MAAM;MACNC,IAAI;MACJC,SAAS,EAAEY,eAAe,CAACZ;IAC/B,CAAC,CAAC;IACFU,OAAO,CAACI,IAAI,CAACb,MAAM,CAAC;EACxB;EACA,OAAOS,OAAO;AAClB,CAAC;AAACK,OAAA,CAAAX,yCAAA,GAAAA,yCAAA","ignoreList":[]}
@@ -1,2 +1,2 @@
1
- import { SecurityIdentity } from "@webiny/api-security/types";
1
+ import type { SecurityIdentity } from "@webiny/api-security/types";
2
2
  export declare const getIdentity: <T extends import("@webiny/api-authentication/types").Identity | null>(input: SecurityIdentity | null | undefined, defaultValue?: T | null) => T;
@@ -1 +1 @@
1
- {"version":3,"names":["getIdentity","input","defaultValue","identity","id","displayName","type","exports"],"sources":["identity.ts"],"sourcesContent":["import { SecurityIdentity } from \"@webiny/api-security/types\";\n\nexport const getIdentity = <T extends SecurityIdentity | null>(\n input: SecurityIdentity | null | undefined,\n defaultValue: T | null = null\n): T => {\n const identity = input?.id && input?.displayName && input?.type ? input : defaultValue;\n if (!identity) {\n return null as T;\n }\n return {\n id: identity.id,\n displayName: identity.displayName,\n type: identity.type\n } as T;\n};\n"],"mappings":";;;;;;AAEO,MAAMA,WAAW,GAAGA,CACvBC,KAA0C,EAC1CC,YAAsB,GAAG,IAAI,KACzB;EACJ,MAAMC,QAAQ,GAAGF,KAAK,EAAEG,EAAE,IAAIH,KAAK,EAAEI,WAAW,IAAIJ,KAAK,EAAEK,IAAI,GAAGL,KAAK,GAAGC,YAAY;EACtF,IAAI,CAACC,QAAQ,EAAE;IACX,OAAO,IAAI;EACf;EACA,OAAO;IACHC,EAAE,EAAED,QAAQ,CAACC,EAAE;IACfC,WAAW,EAAEF,QAAQ,CAACE,WAAW;IACjCC,IAAI,EAAEH,QAAQ,CAACG;EACnB,CAAC;AACL,CAAC;AAACC,OAAA,CAAAP,WAAA,GAAAA,WAAA","ignoreList":[]}
1
+ {"version":3,"names":["getIdentity","input","defaultValue","identity","id","displayName","type","exports"],"sources":["identity.ts"],"sourcesContent":["import type { SecurityIdentity } from \"@webiny/api-security/types\";\n\nexport const getIdentity = <T extends SecurityIdentity | null>(\n input: SecurityIdentity | null | undefined,\n defaultValue: T | null = null\n): T => {\n const identity = input?.id && input?.displayName && input?.type ? input : defaultValue;\n if (!identity) {\n return null as T;\n }\n return {\n id: identity.id,\n displayName: identity.displayName,\n type: identity.type\n } as T;\n};\n"],"mappings":";;;;;;AAEO,MAAMA,WAAW,GAAGA,CACvBC,KAA0C,EAC1CC,YAAsB,GAAG,IAAI,KACzB;EACJ,MAAMC,QAAQ,GAAGF,KAAK,EAAEG,EAAE,IAAIH,KAAK,EAAEI,WAAW,IAAIJ,KAAK,EAAEK,IAAI,GAAGL,KAAK,GAAGC,YAAY;EACtF,IAAI,CAACC,QAAQ,EAAE;IACX,OAAO,IAAI;EACf;EACA,OAAO;IACHC,EAAE,EAAED,QAAQ,CAACC,EAAE;IACfC,WAAW,EAAEF,QAAQ,CAACE,WAAW;IACjCC,IAAI,EAAEH,QAAQ,CAACG;EACnB,CAAC;AACL,CAAC;AAACC,OAAA,CAAAP,WAAA,GAAAA,WAAA","ignoreList":[]}
@@ -1,2 +1,2 @@
1
- import { CmsContext } from "../types";
1
+ import type { CmsContext } from "../types";
2
2
  export declare const isHeadlessCmsReady: ({ tenancy, i18n }: CmsContext) => Promise<boolean>;
@@ -1 +1 @@
1
- {"version":3,"names":["isHeadlessCmsReady","tenancy","i18n","tenant","getCurrentTenant","locale","getContentLocale","undefined","exports"],"sources":["isHeadlessCmsReady.ts"],"sourcesContent":["import { CmsContext } from \"~/types\";\n\nexport const isHeadlessCmsReady = async ({ tenancy, i18n }: CmsContext): Promise<boolean> => {\n /**\n * In case of a fresh webiny project \"tenant\" and \"locale\" won't be there until the installation is completed.\n */\n const tenant = tenancy.getCurrentTenant();\n if (!tenant) {\n return false;\n }\n\n const locale = i18n.getContentLocale();\n\n return locale !== undefined;\n};\n"],"mappings":";;;;;;AAEO,MAAMA,kBAAkB,GAAG,MAAAA,CAAO;EAAEC,OAAO;EAAEC;AAAiB,CAAC,KAAuB;EACzF;AACJ;AACA;EACI,MAAMC,MAAM,GAAGF,OAAO,CAACG,gBAAgB,CAAC,CAAC;EACzC,IAAI,CAACD,MAAM,EAAE;IACT,OAAO,KAAK;EAChB;EAEA,MAAME,MAAM,GAAGH,IAAI,CAACI,gBAAgB,CAAC,CAAC;EAEtC,OAAOD,MAAM,KAAKE,SAAS;AAC/B,CAAC;AAACC,OAAA,CAAAR,kBAAA,GAAAA,kBAAA","ignoreList":[]}
1
+ {"version":3,"names":["isHeadlessCmsReady","tenancy","i18n","tenant","getCurrentTenant","locale","getContentLocale","undefined","exports"],"sources":["isHeadlessCmsReady.ts"],"sourcesContent":["import type { CmsContext } from \"~/types\";\n\nexport const isHeadlessCmsReady = async ({ tenancy, i18n }: CmsContext): Promise<boolean> => {\n /**\n * In case of a fresh webiny project \"tenant\" and \"locale\" won't be there until the installation is completed.\n */\n const tenant = tenancy.getCurrentTenant();\n if (!tenant) {\n return false;\n }\n\n const locale = i18n.getContentLocale();\n\n return locale !== undefined;\n};\n"],"mappings":";;;;;;AAEO,MAAMA,kBAAkB,GAAG,MAAAA,CAAO;EAAEC,OAAO;EAAEC;AAAiB,CAAC,KAAuB;EACzF;AACJ;AACA;EACI,MAAMC,MAAM,GAAGF,OAAO,CAACG,gBAAgB,CAAC,CAAC;EACzC,IAAI,CAACD,MAAM,EAAE;IACT,OAAO,KAAK;EAChB;EAEA,MAAME,MAAM,GAAGH,IAAI,CAACI,gBAAgB,CAAC,CAAC;EAEtC,OAAOD,MAAM,KAAKE,SAAS;AAC/B,CAAC;AAACC,OAAA,CAAAR,kBAAA,GAAAA,kBAAA","ignoreList":[]}
@@ -1,4 +1,4 @@
1
- import { CmsModelAst, CmsModelField } from "../../types";
1
+ import type { CmsModelAst, CmsModelField } from "../../types";
2
2
  export interface IModelFieldTraverserTraverseOnFieldCallableParams {
3
3
  field: CmsModelField;
4
4
  path: string[];
@@ -1 +1 @@
1
- {"version":3,"names":["nodeHasChildren","node","children","length","ModelFieldTraverser","traverse","modelAst","onField","execute","root","path","field","getFieldFromNode","parent","fieldId","type","exports"],"sources":["ModelFieldTraverser.ts"],"sourcesContent":["import {\n CmsModelAst,\n CmsModelField,\n CmsModelFieldAstNode,\n CmsModelFieldAstNodeField\n} from \"~/types\";\n\nconst nodeHasChildren = (node: CmsModelFieldAstNode) => {\n return node.children.length > 0;\n};\n\ntype IParentNode = CmsModelAst | CmsModelFieldAstNode | null;\n\ninterface IVisitorContext {\n node: CmsModelFieldAstNode;\n parent: IParentNode;\n}\n\nexport interface IModelFieldTraverserTraverseOnFieldCallableParams {\n field: CmsModelField;\n path: string[];\n}\n\nexport interface IModelFieldTraverserTraverseOnFieldCallable {\n (params: IModelFieldTraverserTraverseOnFieldCallableParams): void;\n}\n\nexport interface IModelFieldTraverser {\n traverse(modelAst: CmsModelAst, onField: IModelFieldTraverserTraverseOnFieldCallable): void;\n}\n\nexport class ModelFieldTraverser implements IModelFieldTraverser {\n public traverse(modelAst: CmsModelAst, onField: IModelFieldTraverserTraverseOnFieldCallable) {\n this.execute(modelAst, [], onField);\n }\n\n private execute(\n root: CmsModelAst | CmsModelFieldAstNode,\n path: string[],\n onField: IModelFieldTraverserTraverseOnFieldCallable\n ) {\n for (const node of root.children) {\n const field = this.getFieldFromNode({ node, parent: root });\n onField({\n field,\n path: [...path, field.fieldId]\n });\n\n if (nodeHasChildren(node)) {\n this.execute(node, [...path, field.fieldId], onField);\n }\n }\n }\n\n private getFieldFromNode({ node, parent }: IVisitorContext) {\n if (node.type === \"collection\") {\n return (parent as CmsModelFieldAstNodeField).field;\n }\n\n return (node as CmsModelFieldAstNodeField).field;\n }\n}\n"],"mappings":";;;;;;AAOA,MAAMA,eAAe,GAAIC,IAA0B,IAAK;EACpD,OAAOA,IAAI,CAACC,QAAQ,CAACC,MAAM,GAAG,CAAC;AACnC,CAAC;AAsBM,MAAMC,mBAAmB,CAAiC;EACtDC,QAAQA,CAACC,QAAqB,EAAEC,OAAoD,EAAE;IACzF,IAAI,CAACC,OAAO,CAACF,QAAQ,EAAE,EAAE,EAAEC,OAAO,CAAC;EACvC;EAEQC,OAAOA,CACXC,IAAwC,EACxCC,IAAc,EACdH,OAAoD,EACtD;IACE,KAAK,MAAMN,IAAI,IAAIQ,IAAI,CAACP,QAAQ,EAAE;MAC9B,MAAMS,KAAK,GAAG,IAAI,CAACC,gBAAgB,CAAC;QAAEX,IAAI;QAAEY,MAAM,EAAEJ;MAAK,CAAC,CAAC;MAC3DF,OAAO,CAAC;QACJI,KAAK;QACLD,IAAI,EAAE,CAAC,GAAGA,IAAI,EAAEC,KAAK,CAACG,OAAO;MACjC,CAAC,CAAC;MAEF,IAAId,eAAe,CAACC,IAAI,CAAC,EAAE;QACvB,IAAI,CAACO,OAAO,CAACP,IAAI,EAAE,CAAC,GAAGS,IAAI,EAAEC,KAAK,CAACG,OAAO,CAAC,EAAEP,OAAO,CAAC;MACzD;IACJ;EACJ;EAEQK,gBAAgBA,CAAC;IAAEX,IAAI;IAAEY;EAAwB,CAAC,EAAE;IACxD,IAAIZ,IAAI,CAACc,IAAI,KAAK,YAAY,EAAE;MAC5B,OAAQF,MAAM,CAA+BF,KAAK;IACtD;IAEA,OAAQV,IAAI,CAA+BU,KAAK;EACpD;AACJ;AAACK,OAAA,CAAAZ,mBAAA,GAAAA,mBAAA","ignoreList":[]}
1
+ {"version":3,"names":["nodeHasChildren","node","children","length","ModelFieldTraverser","traverse","modelAst","onField","execute","root","path","field","getFieldFromNode","parent","fieldId","type","exports"],"sources":["ModelFieldTraverser.ts"],"sourcesContent":["import type {\n CmsModelAst,\n CmsModelField,\n CmsModelFieldAstNode,\n CmsModelFieldAstNodeField\n} from \"~/types\";\n\nconst nodeHasChildren = (node: CmsModelFieldAstNode) => {\n return node.children.length > 0;\n};\n\ntype IParentNode = CmsModelAst | CmsModelFieldAstNode | null;\n\ninterface IVisitorContext {\n node: CmsModelFieldAstNode;\n parent: IParentNode;\n}\n\nexport interface IModelFieldTraverserTraverseOnFieldCallableParams {\n field: CmsModelField;\n path: string[];\n}\n\nexport interface IModelFieldTraverserTraverseOnFieldCallable {\n (params: IModelFieldTraverserTraverseOnFieldCallableParams): void;\n}\n\nexport interface IModelFieldTraverser {\n traverse(modelAst: CmsModelAst, onField: IModelFieldTraverserTraverseOnFieldCallable): void;\n}\n\nexport class ModelFieldTraverser implements IModelFieldTraverser {\n public traverse(modelAst: CmsModelAst, onField: IModelFieldTraverserTraverseOnFieldCallable) {\n this.execute(modelAst, [], onField);\n }\n\n private execute(\n root: CmsModelAst | CmsModelFieldAstNode,\n path: string[],\n onField: IModelFieldTraverserTraverseOnFieldCallable\n ) {\n for (const node of root.children) {\n const field = this.getFieldFromNode({ node, parent: root });\n onField({\n field,\n path: [...path, field.fieldId]\n });\n\n if (nodeHasChildren(node)) {\n this.execute(node, [...path, field.fieldId], onField);\n }\n }\n }\n\n private getFieldFromNode({ node, parent }: IVisitorContext) {\n if (node.type === \"collection\") {\n return (parent as CmsModelFieldAstNodeField).field;\n }\n\n return (node as CmsModelFieldAstNodeField).field;\n }\n}\n"],"mappings":";;;;;;AAOA,MAAMA,eAAe,GAAIC,IAA0B,IAAK;EACpD,OAAOA,IAAI,CAACC,QAAQ,CAACC,MAAM,GAAG,CAAC;AACnC,CAAC;AAsBM,MAAMC,mBAAmB,CAAiC;EACtDC,QAAQA,CAACC,QAAqB,EAAEC,OAAoD,EAAE;IACzF,IAAI,CAACC,OAAO,CAACF,QAAQ,EAAE,EAAE,EAAEC,OAAO,CAAC;EACvC;EAEQC,OAAOA,CACXC,IAAwC,EACxCC,IAAc,EACdH,OAAoD,EACtD;IACE,KAAK,MAAMN,IAAI,IAAIQ,IAAI,CAACP,QAAQ,EAAE;MAC9B,MAAMS,KAAK,GAAG,IAAI,CAACC,gBAAgB,CAAC;QAAEX,IAAI;QAAEY,MAAM,EAAEJ;MAAK,CAAC,CAAC;MAC3DF,OAAO,CAAC;QACJI,KAAK;QACLD,IAAI,EAAE,CAAC,GAAGA,IAAI,EAAEC,KAAK,CAACG,OAAO;MACjC,CAAC,CAAC;MAEF,IAAId,eAAe,CAACC,IAAI,CAAC,EAAE;QACvB,IAAI,CAACO,OAAO,CAACP,IAAI,EAAE,CAAC,GAAGS,IAAI,EAAEC,KAAK,CAACG,OAAO,CAAC,EAAEP,OAAO,CAAC;MACzD;IACJ;EACJ;EAEQK,gBAAgBA,CAAC;IAAEX,IAAI;IAAEY;EAAwB,CAAC,EAAE;IACxD,IAAIZ,IAAI,CAACc,IAAI,KAAK,YAAY,EAAE;MAC5B,OAAQF,MAAM,CAA+BF,KAAK;IACtD;IAEA,OAAQV,IAAI,CAA+BU,KAAK;EACpD;AACJ;AAACK,OAAA,CAAAZ,mBAAA,GAAAA,mBAAA","ignoreList":[]}
@@ -1,4 +1,4 @@
1
- import { ApiEndpoint, CmsFieldTypePlugins, CmsModel, CmsModelField, CmsModelFieldDefinition } from "../types";
1
+ import type { ApiEndpoint, CmsFieldTypePlugins, CmsModel, CmsModelField, CmsModelFieldDefinition } from "../types";
2
2
  interface RenderFieldsParams {
3
3
  models: CmsModel[];
4
4
  model: CmsModel;
@@ -1 +1 @@
1
- {"version":3,"names":["_getBaseFieldType","require","renderFields","models","model","fields","type","fieldTypePlugins","map","field","renderField","filter","Boolean","exports","plugin","getBaseFieldType","Error","createTypeField","defs"],"sources":["renderFields.ts"],"sourcesContent":["import {\n ApiEndpoint,\n CmsFieldTypePlugins,\n CmsModel,\n CmsModelField,\n CmsModelFieldDefinition,\n CmsModelFieldToGraphQLPlugin\n} from \"~/types\";\nimport { getBaseFieldType } from \"~/utils/getBaseFieldType\";\n\ninterface RenderFieldsParams {\n models: CmsModel[];\n model: CmsModel;\n fields: CmsModelField[];\n type: ApiEndpoint;\n fieldTypePlugins: CmsFieldTypePlugins;\n}\n\ninterface RenderFields {\n (params: RenderFieldsParams): CmsModelFieldDefinition[];\n}\n\nexport const renderFields: RenderFields = ({\n models,\n model,\n fields,\n type,\n fieldTypePlugins\n}): CmsModelFieldDefinition[] => {\n return fields\n .map(field => renderField({ models, model, type, field, fieldTypePlugins }))\n .filter(Boolean) as CmsModelFieldDefinition[];\n};\n\ninterface RenderFieldParams extends Omit<RenderFieldsParams, \"fields\"> {\n field: CmsModelField;\n}\n\nexport const renderField = ({\n models,\n model,\n type,\n field,\n fieldTypePlugins\n}: RenderFieldParams): CmsModelFieldDefinition | null => {\n const plugin = fieldTypePlugins[getBaseFieldType(field)];\n if (!plugin) {\n // Let's not render the field if it does not exist in the field plugins.\n return null;\n } else if (!plugin[type]) {\n throw new Error(`Missing \"${type}\" plugin for field type \"${field.type}\".`);\n }\n const { createTypeField } = plugin[type] as CmsModelFieldToGraphQLPlugin[\"manage\"];\n const defs = createTypeField({\n models,\n model,\n field,\n fieldTypePlugins\n });\n\n if (!defs) {\n return null;\n } else if (typeof defs === \"string\") {\n return {\n fields: defs\n };\n }\n\n return defs;\n};\n"],"mappings":";;;;;;AAQA,IAAAA,iBAAA,GAAAC,OAAA;AAcO,MAAMC,YAA0B,GAAGA,CAAC;EACvCC,MAAM;EACNC,KAAK;EACLC,MAAM;EACNC,IAAI;EACJC;AACJ,CAAC,KAAgC;EAC7B,OAAOF,MAAM,CACRG,GAAG,CAACC,KAAK,IAAIC,WAAW,CAAC;IAAEP,MAAM;IAAEC,KAAK;IAAEE,IAAI;IAAEG,KAAK;IAAEF;EAAiB,CAAC,CAAC,CAAC,CAC3EI,MAAM,CAACC,OAAO,CAAC;AACxB,CAAC;AAACC,OAAA,CAAAX,YAAA,GAAAA,YAAA;AAMK,MAAMQ,WAAW,GAAGA,CAAC;EACxBP,MAAM;EACNC,KAAK;EACLE,IAAI;EACJG,KAAK;EACLF;AACe,CAAC,KAAqC;EACrD,MAAMO,MAAM,GAAGP,gBAAgB,CAAC,IAAAQ,kCAAgB,EAACN,KAAK,CAAC,CAAC;EACxD,IAAI,CAACK,MAAM,EAAE;IACT;IACA,OAAO,IAAI;EACf,CAAC,MAAM,IAAI,CAACA,MAAM,CAACR,IAAI,CAAC,EAAE;IACtB,MAAM,IAAIU,KAAK,CAAC,YAAYV,IAAI,4BAA4BG,KAAK,CAACH,IAAI,IAAI,CAAC;EAC/E;EACA,MAAM;IAAEW;EAAgB,CAAC,GAAGH,MAAM,CAACR,IAAI,CAA2C;EAClF,MAAMY,IAAI,GAAGD,eAAe,CAAC;IACzBd,MAAM;IACNC,KAAK;IACLK,KAAK;IACLF;EACJ,CAAC,CAAC;EAEF,IAAI,CAACW,IAAI,EAAE;IACP,OAAO,IAAI;EACf,CAAC,MAAM,IAAI,OAAOA,IAAI,KAAK,QAAQ,EAAE;IACjC,OAAO;MACHb,MAAM,EAAEa;IACZ,CAAC;EACL;EAEA,OAAOA,IAAI;AACf,CAAC;AAACL,OAAA,CAAAH,WAAA,GAAAA,WAAA","ignoreList":[]}
1
+ {"version":3,"names":["_getBaseFieldType","require","renderFields","models","model","fields","type","fieldTypePlugins","map","field","renderField","filter","Boolean","exports","plugin","getBaseFieldType","Error","createTypeField","defs"],"sources":["renderFields.ts"],"sourcesContent":["import type {\n ApiEndpoint,\n CmsFieldTypePlugins,\n CmsModel,\n CmsModelField,\n CmsModelFieldDefinition,\n CmsModelFieldToGraphQLPlugin\n} from \"~/types\";\nimport { getBaseFieldType } from \"~/utils/getBaseFieldType\";\n\ninterface RenderFieldsParams {\n models: CmsModel[];\n model: CmsModel;\n fields: CmsModelField[];\n type: ApiEndpoint;\n fieldTypePlugins: CmsFieldTypePlugins;\n}\n\ninterface RenderFields {\n (params: RenderFieldsParams): CmsModelFieldDefinition[];\n}\n\nexport const renderFields: RenderFields = ({\n models,\n model,\n fields,\n type,\n fieldTypePlugins\n}): CmsModelFieldDefinition[] => {\n return fields\n .map(field => renderField({ models, model, type, field, fieldTypePlugins }))\n .filter(Boolean) as CmsModelFieldDefinition[];\n};\n\ninterface RenderFieldParams extends Omit<RenderFieldsParams, \"fields\"> {\n field: CmsModelField;\n}\n\nexport const renderField = ({\n models,\n model,\n type,\n field,\n fieldTypePlugins\n}: RenderFieldParams): CmsModelFieldDefinition | null => {\n const plugin = fieldTypePlugins[getBaseFieldType(field)];\n if (!plugin) {\n // Let's not render the field if it does not exist in the field plugins.\n return null;\n } else if (!plugin[type]) {\n throw new Error(`Missing \"${type}\" plugin for field type \"${field.type}\".`);\n }\n const { createTypeField } = plugin[type] as CmsModelFieldToGraphQLPlugin[\"manage\"];\n const defs = createTypeField({\n models,\n model,\n field,\n fieldTypePlugins\n });\n\n if (!defs) {\n return null;\n } else if (typeof defs === \"string\") {\n return {\n fields: defs\n };\n }\n\n return defs;\n};\n"],"mappings":";;;;;;AAQA,IAAAA,iBAAA,GAAAC,OAAA;AAcO,MAAMC,YAA0B,GAAGA,CAAC;EACvCC,MAAM;EACNC,KAAK;EACLC,MAAM;EACNC,IAAI;EACJC;AACJ,CAAC,KAAgC;EAC7B,OAAOF,MAAM,CACRG,GAAG,CAACC,KAAK,IAAIC,WAAW,CAAC;IAAEP,MAAM;IAAEC,KAAK;IAAEE,IAAI;IAAEG,KAAK;IAAEF;EAAiB,CAAC,CAAC,CAAC,CAC3EI,MAAM,CAACC,OAAO,CAAC;AACxB,CAAC;AAACC,OAAA,CAAAX,YAAA,GAAAA,YAAA;AAMK,MAAMQ,WAAW,GAAGA,CAAC;EACxBP,MAAM;EACNC,KAAK;EACLE,IAAI;EACJG,KAAK;EACLF;AACe,CAAC,KAAqC;EACrD,MAAMO,MAAM,GAAGP,gBAAgB,CAAC,IAAAQ,kCAAgB,EAACN,KAAK,CAAC,CAAC;EACxD,IAAI,CAACK,MAAM,EAAE;IACT;IACA,OAAO,IAAI;EACf,CAAC,MAAM,IAAI,CAACA,MAAM,CAACR,IAAI,CAAC,EAAE;IACtB,MAAM,IAAIU,KAAK,CAAC,YAAYV,IAAI,4BAA4BG,KAAK,CAACH,IAAI,IAAI,CAAC;EAC/E;EACA,MAAM;IAAEW;EAAgB,CAAC,GAAGH,MAAM,CAACR,IAAI,CAA2C;EAClF,MAAMY,IAAI,GAAGD,eAAe,CAAC;IACzBd,MAAM;IACNC,KAAK;IACLK,KAAK;IACLF;EACJ,CAAC,CAAC;EAEF,IAAI,CAACW,IAAI,EAAE;IACP,OAAO,IAAI;EACf,CAAC,MAAM,IAAI,OAAOA,IAAI,KAAK,QAAQ,EAAE;IACjC,OAAO;MACHb,MAAM,EAAEa;IACZ,CAAC;EACL;EAEA,OAAOA,IAAI;AACf,CAAC;AAACL,OAAA,CAAAH,WAAA,GAAAA,WAAA","ignoreList":[]}
@@ -1,4 +1,4 @@
1
- import { CmsFieldTypePlugins, CmsModelField } from "../types";
1
+ import type { CmsFieldTypePlugins, CmsModelField } from "../types";
2
2
  interface RenderGetFilterFieldsParams {
3
3
  fields: CmsModelField[];
4
4
  fieldTypePlugins: CmsFieldTypePlugins;
@@ -1 +1 @@
1
- {"version":3,"names":["_getBaseFieldType","require","renderGetFilterFields","fields","fieldTypePlugins","filters","field","baseType","getBaseFieldType","plugin","isSearchable","createGetFilters","read","push","filter","Boolean","join","exports"],"sources":["renderGetFilterFields.ts"],"sourcesContent":["import { CmsFieldTypePlugins, CmsModelField } from \"~/types\";\nimport { getBaseFieldType } from \"~/utils/getBaseFieldType\";\n\ninterface RenderGetFilterFieldsParams {\n fields: CmsModelField[];\n fieldTypePlugins: CmsFieldTypePlugins;\n}\ninterface RenderGetFilterFields {\n (params: RenderGetFilterFieldsParams): string;\n}\n\nexport const renderGetFilterFields: RenderGetFilterFields = ({ fields, fieldTypePlugins }) => {\n const filters: string[] = [\"id: ID\", \"entryId: String\"];\n\n for (const field of fields) {\n // Every time a client updates content model's fields, we check the type of each field. If a field plugin\n // for a particular \"field.type\" doesn't exist on the backend yet, we throw an error. But still, we also\n // want to be careful when accessing the field plugin here too. It is still possible to have a content model\n // that contains a field, for which we don't have a plugin registered on the backend. For example, user\n // could've just removed the plugin from the backend.\n const baseType = getBaseFieldType(field);\n const plugin = fieldTypePlugins[baseType];\n if (!plugin?.isSearchable) {\n continue;\n }\n const createGetFilters = plugin.read?.createGetFilters;\n if (typeof createGetFilters !== \"function\") {\n continue;\n }\n filters.push(createGetFilters({ field }));\n }\n\n return filters.filter(Boolean).join(\"\\n\");\n};\n"],"mappings":";;;;;;AACA,IAAAA,iBAAA,GAAAC,OAAA;AAUO,MAAMC,qBAA4C,GAAGA,CAAC;EAAEC,MAAM;EAAEC;AAAiB,CAAC,KAAK;EAC1F,MAAMC,OAAiB,GAAG,CAAC,QAAQ,EAAE,iBAAiB,CAAC;EAEvD,KAAK,MAAMC,KAAK,IAAIH,MAAM,EAAE;IACxB;IACA;IACA;IACA;IACA;IACA,MAAMI,QAAQ,GAAG,IAAAC,kCAAgB,EAACF,KAAK,CAAC;IACxC,MAAMG,MAAM,GAAGL,gBAAgB,CAACG,QAAQ,CAAC;IACzC,IAAI,CAACE,MAAM,EAAEC,YAAY,EAAE;MACvB;IACJ;IACA,MAAMC,gBAAgB,GAAGF,MAAM,CAACG,IAAI,EAAED,gBAAgB;IACtD,IAAI,OAAOA,gBAAgB,KAAK,UAAU,EAAE;MACxC;IACJ;IACAN,OAAO,CAACQ,IAAI,CAACF,gBAAgB,CAAC;MAAEL;IAAM,CAAC,CAAC,CAAC;EAC7C;EAEA,OAAOD,OAAO,CAACS,MAAM,CAACC,OAAO,CAAC,CAACC,IAAI,CAAC,IAAI,CAAC;AAC7C,CAAC;AAACC,OAAA,CAAAf,qBAAA,GAAAA,qBAAA","ignoreList":[]}
1
+ {"version":3,"names":["_getBaseFieldType","require","renderGetFilterFields","fields","fieldTypePlugins","filters","field","baseType","getBaseFieldType","plugin","isSearchable","createGetFilters","read","push","filter","Boolean","join","exports"],"sources":["renderGetFilterFields.ts"],"sourcesContent":["import type { CmsFieldTypePlugins, CmsModelField } from \"~/types\";\nimport { getBaseFieldType } from \"~/utils/getBaseFieldType\";\n\ninterface RenderGetFilterFieldsParams {\n fields: CmsModelField[];\n fieldTypePlugins: CmsFieldTypePlugins;\n}\ninterface RenderGetFilterFields {\n (params: RenderGetFilterFieldsParams): string;\n}\n\nexport const renderGetFilterFields: RenderGetFilterFields = ({ fields, fieldTypePlugins }) => {\n const filters: string[] = [\"id: ID\", \"entryId: String\"];\n\n for (const field of fields) {\n // Every time a client updates content model's fields, we check the type of each field. If a field plugin\n // for a particular \"field.type\" doesn't exist on the backend yet, we throw an error. But still, we also\n // want to be careful when accessing the field plugin here too. It is still possible to have a content model\n // that contains a field, for which we don't have a plugin registered on the backend. For example, user\n // could've just removed the plugin from the backend.\n const baseType = getBaseFieldType(field);\n const plugin = fieldTypePlugins[baseType];\n if (!plugin?.isSearchable) {\n continue;\n }\n const createGetFilters = plugin.read?.createGetFilters;\n if (typeof createGetFilters !== \"function\") {\n continue;\n }\n filters.push(createGetFilters({ field }));\n }\n\n return filters.filter(Boolean).join(\"\\n\");\n};\n"],"mappings":";;;;;;AACA,IAAAA,iBAAA,GAAAC,OAAA;AAUO,MAAMC,qBAA4C,GAAGA,CAAC;EAAEC,MAAM;EAAEC;AAAiB,CAAC,KAAK;EAC1F,MAAMC,OAAiB,GAAG,CAAC,QAAQ,EAAE,iBAAiB,CAAC;EAEvD,KAAK,MAAMC,KAAK,IAAIH,MAAM,EAAE;IACxB;IACA;IACA;IACA;IACA;IACA,MAAMI,QAAQ,GAAG,IAAAC,kCAAgB,EAACF,KAAK,CAAC;IACxC,MAAMG,MAAM,GAAGL,gBAAgB,CAACG,QAAQ,CAAC;IACzC,IAAI,CAACE,MAAM,EAAEC,YAAY,EAAE;MACvB;IACJ;IACA,MAAMC,gBAAgB,GAAGF,MAAM,CAACG,IAAI,EAAED,gBAAgB;IACtD,IAAI,OAAOA,gBAAgB,KAAK,UAAU,EAAE;MACxC;IACJ;IACAN,OAAO,CAACQ,IAAI,CAACF,gBAAgB,CAAC;MAAEL;IAAM,CAAC,CAAC,CAAC;EAC7C;EAEA,OAAOD,OAAO,CAACS,MAAM,CAACC,OAAO,CAAC,CAACC,IAAI,CAAC,IAAI,CAAC;AAC7C,CAAC;AAACC,OAAA,CAAAf,qBAAA,GAAAA,qBAAA","ignoreList":[]}
@@ -1,4 +1,4 @@
1
- import { CmsFieldTypePlugins, CmsModel, CmsModelField, CmsModelFieldDefinition } from "../types";
1
+ import type { CmsFieldTypePlugins, CmsModel, CmsModelField, CmsModelFieldDefinition } from "../types";
2
2
  interface RenderInputFieldsParams {
3
3
  models: CmsModel[];
4
4
  model: CmsModel;
@@ -1 +1 @@
1
- {"version":3,"names":["_getBaseFieldType","require","renderInputFields","models","model","fields","fieldTypePlugins","reduce","result","field","input","renderInputField","push","exports","plugin","getBaseFieldType","def","manage","createInputField"],"sources":["renderInputFields.ts"],"sourcesContent":["import { CmsFieldTypePlugins, CmsModel, CmsModelField, CmsModelFieldDefinition } from \"~/types\";\nimport { getBaseFieldType } from \"~/utils/getBaseFieldType\";\n\ninterface RenderInputFieldsParams {\n models: CmsModel[];\n model: CmsModel;\n fields: CmsModelField[];\n fieldTypePlugins: CmsFieldTypePlugins;\n}\n\ninterface RenderInputFieldParams extends Omit<RenderInputFieldsParams, \"fields\"> {\n field: CmsModelField;\n}\n\ninterface RenderInputFields {\n (params: RenderInputFieldsParams): CmsModelFieldDefinition[];\n}\n\nexport const renderInputFields: RenderInputFields = ({\n models,\n model,\n fields,\n fieldTypePlugins\n}): CmsModelFieldDefinition[] => {\n return fields.reduce<CmsModelFieldDefinition[]>((result, field) => {\n const input = renderInputField({ models, model, field, fieldTypePlugins });\n if (!input) {\n return result;\n }\n result.push(input);\n return result;\n }, []);\n};\n\nexport const renderInputField = ({\n models,\n model,\n field,\n fieldTypePlugins\n}: RenderInputFieldParams): CmsModelFieldDefinition | null => {\n // Every time a client updates content model's fields, we check the type of each field. If a field plugin\n // for a particular \"field.type\" doesn't exist on the backend yet, we throw an error. But still, we also\n // want to be careful when accessing the field plugin here too. It is still possible to have a content model\n // that contains a field, for which we don't have a plugin registered on the backend. For example, user\n // could've just removed the plugin from the backend.\n const plugin = fieldTypePlugins[getBaseFieldType(field)];\n\n if (!plugin) {\n // Let's not render the field if it does not exist in the field plugins.\n return null;\n }\n\n const def = plugin.manage.createInputField({\n models,\n model,\n field,\n fieldTypePlugins\n });\n if (typeof def === \"string\") {\n return {\n fields: def\n };\n }\n\n return def;\n};\n"],"mappings":";;;;;;AACA,IAAAA,iBAAA,GAAAC,OAAA;AAiBO,MAAMC,iBAAoC,GAAGA,CAAC;EACjDC,MAAM;EACNC,KAAK;EACLC,MAAM;EACNC;AACJ,CAAC,KAAgC;EAC7B,OAAOD,MAAM,CAACE,MAAM,CAA4B,CAACC,MAAM,EAAEC,KAAK,KAAK;IAC/D,MAAMC,KAAK,GAAGC,gBAAgB,CAAC;MAAER,MAAM;MAAEC,KAAK;MAAEK,KAAK;MAAEH;IAAiB,CAAC,CAAC;IAC1E,IAAI,CAACI,KAAK,EAAE;MACR,OAAOF,MAAM;IACjB;IACAA,MAAM,CAACI,IAAI,CAACF,KAAK,CAAC;IAClB,OAAOF,MAAM;EACjB,CAAC,EAAE,EAAE,CAAC;AACV,CAAC;AAACK,OAAA,CAAAX,iBAAA,GAAAA,iBAAA;AAEK,MAAMS,gBAAgB,GAAGA,CAAC;EAC7BR,MAAM;EACNC,KAAK;EACLK,KAAK;EACLH;AACoB,CAAC,KAAqC;EAC1D;EACA;EACA;EACA;EACA;EACA,MAAMQ,MAAM,GAAGR,gBAAgB,CAAC,IAAAS,kCAAgB,EAACN,KAAK,CAAC,CAAC;EAExD,IAAI,CAACK,MAAM,EAAE;IACT;IACA,OAAO,IAAI;EACf;EAEA,MAAME,GAAG,GAAGF,MAAM,CAACG,MAAM,CAACC,gBAAgB,CAAC;IACvCf,MAAM;IACNC,KAAK;IACLK,KAAK;IACLH;EACJ,CAAC,CAAC;EACF,IAAI,OAAOU,GAAG,KAAK,QAAQ,EAAE;IACzB,OAAO;MACHX,MAAM,EAAEW;IACZ,CAAC;EACL;EAEA,OAAOA,GAAG;AACd,CAAC;AAACH,OAAA,CAAAF,gBAAA,GAAAA,gBAAA","ignoreList":[]}
1
+ {"version":3,"names":["_getBaseFieldType","require","renderInputFields","models","model","fields","fieldTypePlugins","reduce","result","field","input","renderInputField","push","exports","plugin","getBaseFieldType","def","manage","createInputField"],"sources":["renderInputFields.ts"],"sourcesContent":["import type {\n CmsFieldTypePlugins,\n CmsModel,\n CmsModelField,\n CmsModelFieldDefinition\n} from \"~/types\";\nimport { getBaseFieldType } from \"~/utils/getBaseFieldType\";\n\ninterface RenderInputFieldsParams {\n models: CmsModel[];\n model: CmsModel;\n fields: CmsModelField[];\n fieldTypePlugins: CmsFieldTypePlugins;\n}\n\ninterface RenderInputFieldParams extends Omit<RenderInputFieldsParams, \"fields\"> {\n field: CmsModelField;\n}\n\ninterface RenderInputFields {\n (params: RenderInputFieldsParams): CmsModelFieldDefinition[];\n}\n\nexport const renderInputFields: RenderInputFields = ({\n models,\n model,\n fields,\n fieldTypePlugins\n}): CmsModelFieldDefinition[] => {\n return fields.reduce<CmsModelFieldDefinition[]>((result, field) => {\n const input = renderInputField({ models, model, field, fieldTypePlugins });\n if (!input) {\n return result;\n }\n result.push(input);\n return result;\n }, []);\n};\n\nexport const renderInputField = ({\n models,\n model,\n field,\n fieldTypePlugins\n}: RenderInputFieldParams): CmsModelFieldDefinition | null => {\n // Every time a client updates content model's fields, we check the type of each field. If a field plugin\n // for a particular \"field.type\" doesn't exist on the backend yet, we throw an error. But still, we also\n // want to be careful when accessing the field plugin here too. It is still possible to have a content model\n // that contains a field, for which we don't have a plugin registered on the backend. For example, user\n // could've just removed the plugin from the backend.\n const plugin = fieldTypePlugins[getBaseFieldType(field)];\n\n if (!plugin) {\n // Let's not render the field if it does not exist in the field plugins.\n return null;\n }\n\n const def = plugin.manage.createInputField({\n models,\n model,\n field,\n fieldTypePlugins\n });\n if (typeof def === \"string\") {\n return {\n fields: def\n };\n }\n\n return def;\n};\n"],"mappings":";;;;;;AAMA,IAAAA,iBAAA,GAAAC,OAAA;AAiBO,MAAMC,iBAAoC,GAAGA,CAAC;EACjDC,MAAM;EACNC,KAAK;EACLC,MAAM;EACNC;AACJ,CAAC,KAAgC;EAC7B,OAAOD,MAAM,CAACE,MAAM,CAA4B,CAACC,MAAM,EAAEC,KAAK,KAAK;IAC/D,MAAMC,KAAK,GAAGC,gBAAgB,CAAC;MAAER,MAAM;MAAEC,KAAK;MAAEK,KAAK;MAAEH;IAAiB,CAAC,CAAC;IAC1E,IAAI,CAACI,KAAK,EAAE;MACR,OAAOF,MAAM;IACjB;IACAA,MAAM,CAACI,IAAI,CAACF,KAAK,CAAC;IAClB,OAAOF,MAAM;EACjB,CAAC,EAAE,EAAE,CAAC;AACV,CAAC;AAACK,OAAA,CAAAX,iBAAA,GAAAA,iBAAA;AAEK,MAAMS,gBAAgB,GAAGA,CAAC;EAC7BR,MAAM;EACNC,KAAK;EACLK,KAAK;EACLH;AACoB,CAAC,KAAqC;EAC1D;EACA;EACA;EACA;EACA;EACA,MAAMQ,MAAM,GAAGR,gBAAgB,CAAC,IAAAS,kCAAgB,EAACN,KAAK,CAAC,CAAC;EAExD,IAAI,CAACK,MAAM,EAAE;IACT;IACA,OAAO,IAAI;EACf;EAEA,MAAME,GAAG,GAAGF,MAAM,CAACG,MAAM,CAACC,gBAAgB,CAAC;IACvCf,MAAM;IACNC,KAAK;IACLK,KAAK;IACLH;EACJ,CAAC,CAAC;EACF,IAAI,OAAOU,GAAG,KAAK,QAAQ,EAAE;IACzB,OAAO;MACHX,MAAM,EAAEW;IACZ,CAAC;EACL;EAEA,OAAOA,GAAG;AACd,CAAC;AAACH,OAAA,CAAAF,gBAAA,GAAAA,gBAAA","ignoreList":[]}
@@ -1,4 +1,4 @@
1
- import { ApiEndpoint, CmsFieldTypePlugins, CmsModel, CmsModelField } from "../types";
1
+ import type { ApiEndpoint, CmsFieldTypePlugins, CmsModel, CmsModelField } from "../types";
2
2
  interface RenderListFilterFieldsParams {
3
3
  model: CmsModel;
4
4
  fields: CmsModelField[];
@@ -1 +1 @@
1
- {"version":3,"names":["_getBaseFieldType","require","_constants","renderListFilterFields","params","model","fields","type","fieldTypePlugins","excludeFields","result","ENTRY_META_FIELDS","map","field","isDateTimeEntryMetaField","flat","push","finalFields","filter","some","excl","startsWith","baseType","getBaseFieldType","createListFilters","plugins","Boolean","join","exports"],"sources":["renderListFilterFields.ts"],"sourcesContent":["import {\n ApiEndpoint,\n CmsFieldTypePlugins,\n CmsModel,\n CmsModelField,\n CmsModelFieldToGraphQLPlugin\n} from \"~/types\";\nimport { getBaseFieldType } from \"~/utils/getBaseFieldType\";\nimport { ENTRY_META_FIELDS, isDateTimeEntryMetaField } from \"~/constants\";\n\ninterface RenderListFilterFieldsParams {\n model: CmsModel;\n fields: CmsModelField[];\n type: ApiEndpoint;\n fieldTypePlugins: CmsFieldTypePlugins;\n excludeFields?: string[];\n}\n\ninterface RenderListFilterFields {\n (params: RenderListFilterFieldsParams): string;\n}\n\ntype CreateListFiltersType =\n | CmsModelFieldToGraphQLPlugin[\"read\"][\"createListFilters\"]\n | CmsModelFieldToGraphQLPlugin[\"manage\"][\"createListFilters\"];\n\nexport const renderListFilterFields: RenderListFilterFields = (params): string => {\n const { model, fields, type, fieldTypePlugins, excludeFields = [] } = params;\n const result: string[] = [\n \"id: ID\",\n \"id_not: ID\",\n \"id_in: [ID!]\",\n \"id_not_in: [ID!]\",\n \"entryId: String\",\n \"entryId_not: String\",\n \"entryId_in: [String!]\",\n \"entryId_not_in: [String!]\",\n\n ...ENTRY_META_FIELDS.map(field => {\n if (isDateTimeEntryMetaField(field)) {\n return [\n `${field}: DateTime`,\n `${field}_gt: DateTime`,\n `${field}_gte: DateTime`,\n `${field}_lt: DateTime`,\n `${field}_lte: DateTime`,\n `${field}_between: [DateTime!]`,\n `${field}_not_between: [DateTime!]`\n ];\n }\n\n return [\n `${field}: ID`,\n `${field}_not: ID`,\n `${field}_in: [ID!]`,\n `${field}_not_in: [ID!]`\n ];\n }).flat()\n ];\n\n /**\n * We can find different statuses only in the manage API endpoint.\n */\n if (type === \"manage\") {\n result.push(\n \"status: String\",\n \"status_not: String\",\n \"status_in: [String!]\",\n \"status_not_in: [String!]\"\n );\n }\n\n const finalFields = result.filter(field => {\n return !excludeFields.some(excl => {\n return field.startsWith(`${excl}_`) || field.startsWith(`${excl}: `);\n });\n });\n\n for (const field of fields) {\n // Every time a client updates content model's fields, we check the type of each field. If a field plugin\n // for a particular \"field.type\" doesn't exist on the backend yet, we throw an error. But still, we also\n // want to be careful when accessing the field plugin here too. It is still possible to have a content model\n // that contains a field, for which we don't have a plugin registered on the backend. For example, user\n // could've just removed the plugin from the backend.\n const baseType = getBaseFieldType(field);\n const createListFilters: CreateListFiltersType | undefined =\n fieldTypePlugins[baseType]?.[type]?.createListFilters;\n if (typeof createListFilters !== \"function\") {\n continue;\n }\n finalFields.push(createListFilters({ model, field, plugins: fieldTypePlugins }));\n }\n\n return finalFields.filter(Boolean).join(\"\\n\");\n};\n"],"mappings":";;;;;;AAOA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AAkBO,MAAME,sBAA8C,GAAIC,MAAM,IAAa;EAC9E,MAAM;IAAEC,KAAK;IAAEC,MAAM;IAAEC,IAAI;IAAEC,gBAAgB;IAAEC,aAAa,GAAG;EAAG,CAAC,GAAGL,MAAM;EAC5E,MAAMM,MAAgB,GAAG,CACrB,QAAQ,EACR,YAAY,EACZ,cAAc,EACd,kBAAkB,EAClB,iBAAiB,EACjB,qBAAqB,EACrB,uBAAuB,EACvB,2BAA2B,EAE3B,GAAGC,4BAAiB,CAACC,GAA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EY,OAAO,EAAEjB;IAAiB,CAAC,CAAC,CAAC;EACpF;EAEA,OAAOS,WAAW,CAACC,MAAM,CAACQ,OAAO,CAAC,CAACC,IAAI,CAAC,IAAI,CAAC;AACjD,CAAC;AAACC,OAAA,CAAAzB,sBAAA,GAAAA,sBAAA","ignoreList":[]}
1
+ {"version":3,"names":["_getBaseFieldType","require","_constants","renderListFilterFields","params","model","fields","type","fieldTypePlugins","excludeFields","result","ENTRY_META_FIELDS","map","field","isDateTimeEntryMetaField","flat","push","finalFields","filter","some","excl","startsWith","baseType","getBaseFieldType","createListFilters","plugins","Boolean","join","exports"],"sources":["renderListFilterFields.ts"],"sourcesContent":["import type {\n ApiEndpoint,\n CmsFieldTypePlugins,\n CmsModel,\n CmsModelField,\n CmsModelFieldToGraphQLPlugin\n} from \"~/types\";\nimport { getBaseFieldType } from \"~/utils/getBaseFieldType\";\nimport { ENTRY_META_FIELDS, isDateTimeEntryMetaField } from \"~/constants\";\n\ninterface RenderListFilterFieldsParams {\n model: CmsModel;\n fields: CmsModelField[];\n type: ApiEndpoint;\n fieldTypePlugins: CmsFieldTypePlugins;\n excludeFields?: string[];\n}\n\ninterface RenderListFilterFields {\n (params: RenderListFilterFieldsParams): string;\n}\n\ntype CreateListFiltersType =\n | CmsModelFieldToGraphQLPlugin[\"read\"][\"createListFilters\"]\n | CmsModelFieldToGraphQLPlugin[\"manage\"][\"createListFilters\"];\n\nexport const renderListFilterFields: RenderListFilterFields = (params): string => {\n const { model, fields, type, fieldTypePlugins, excludeFields = [] } = params;\n const result: string[] = [\n \"id: ID\",\n \"id_not: ID\",\n \"id_in: [ID!]\",\n \"id_not_in: [ID!]\",\n \"entryId: String\",\n \"entryId_not: String\",\n \"entryId_in: [String!]\",\n \"entryId_not_in: [String!]\",\n\n ...ENTRY_META_FIELDS.map(field => {\n if (isDateTimeEntryMetaField(field)) {\n return [\n `${field}: DateTime`,\n `${field}_gt: DateTime`,\n `${field}_gte: DateTime`,\n `${field}_lt: DateTime`,\n `${field}_lte: DateTime`,\n `${field}_between: [DateTime!]`,\n `${field}_not_between: [DateTime!]`\n ];\n }\n\n return [\n `${field}: ID`,\n `${field}_not: ID`,\n `${field}_in: [ID!]`,\n `${field}_not_in: [ID!]`\n ];\n }).flat()\n ];\n\n /**\n * We can find different statuses only in the manage API endpoint.\n */\n if (type === \"manage\") {\n result.push(\n \"status: String\",\n \"status_not: String\",\n \"status_in: [String!]\",\n \"status_not_in: [String!]\"\n );\n }\n\n const finalFields = result.filter(field => {\n return !excludeFields.some(excl => {\n return field.startsWith(`${excl}_`) || field.startsWith(`${excl}: `);\n });\n });\n\n for (const field of fields) {\n // Every time a client updates content model's fields, we check the type of each field. If a field plugin\n // for a particular \"field.type\" doesn't exist on the backend yet, we throw an error. But still, we also\n // want to be careful when accessing the field plugin here too. It is still possible to have a content model\n // that contains a field, for which we don't have a plugin registered on the backend. For example, user\n // could've just removed the plugin from the backend.\n const baseType = getBaseFieldType(field);\n const createListFilters: CreateListFiltersType | undefined =\n fieldTypePlugins[baseType]?.[type]?.createListFilters;\n if (typeof createListFilters !== \"function\") {\n continue;\n }\n finalFields.push(createListFilters({ model, field, plugins: fieldTypePlugins }));\n }\n\n return finalFields.filter(Boolean).join(\"\\n\");\n};\n"],"mappings":";;;;;;AAOA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AAkBO,MAAME,sBAA8C,GAAIC,MAAM,IAAa;EAC9E,MAAM;IAAEC,KAAK;IAAEC,MAAM;IAAEC,IAAI;IAAEC,gBAAgB;IAAEC,aAAa,GAAG;EAAG,CAAC,GAAGL,MAAM;EAC5E,MAAMM,MAAgB,GAAG,CACrB,QAAQ,EACR,YAAY,EACZ,cAAc,EACd,kBAAkB,EAClB,iBAAiB,EACjB,qBAAqB,EACrB,uBAAuB,EACvB,2BAA2B,EAE3B,GAAGC,4BAAiB,CAACC,GAAG,CAACC,KAAK,IAAI;IAC9B,IAAI,IAAAC,mCAAwB,EAACD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,OAAOS,WAAW,CAACC,MAAM,CAACQ,OAAO,CAAC,CAACC,IAAI,CAAC,IAAI,CAAC;AACjD,CAAC;AAACC,OAAA,CAAAzB,sBAAA,GAAAA,sBAAA","ignoreList":[]}
@@ -1,5 +1,5 @@
1
- import { CmsFieldTypePlugins, CmsModel, CmsModelField } from "../types";
2
- import { CmsGraphQLSchemaSorterPlugin } from "../plugins/CmsGraphQLSchemaSorterPlugin";
1
+ import type { CmsFieldTypePlugins, CmsModel, CmsModelField } from "../types";
2
+ import type { CmsGraphQLSchemaSorterPlugin } from "../plugins/CmsGraphQLSchemaSorterPlugin";
3
3
  interface RenderSortEnumParams {
4
4
  model: CmsModel;
5
5
  fields: CmsModelField[];
@@ -1 +1 @@
1
- {"version":3,"names":["_getBaseFieldType","require","_constants","renderSortEnum","model","fields","fieldTypePlugins","sorterPlugins","sorters","ENTRY_META_FIELDS","filter","isDateTimeEntryMetaField","map","field","flat","plugin","getBaseFieldType","createSorters","result","isSortable","push","fieldId","join","reduce","createSorter","exports"],"sources":["renderSortEnum.ts"],"sourcesContent":["import { CmsFieldTypePlugins, CmsModel, CmsModelField } from \"~/types\";\nimport { getBaseFieldType } from \"~/utils/getBaseFieldType\";\nimport { CmsGraphQLSchemaSorterPlugin } from \"~/plugins/CmsGraphQLSchemaSorterPlugin\";\nimport { ENTRY_META_FIELDS, isDateTimeEntryMetaField } from \"~/constants\";\n\ninterface RenderSortEnumParams {\n model: CmsModel;\n fields: CmsModelField[];\n fieldTypePlugins: CmsFieldTypePlugins;\n sorterPlugins?: CmsGraphQLSchemaSorterPlugin[];\n}\n\ninterface RenderSortEnum {\n (params: RenderSortEnumParams): string;\n}\n\nexport const renderSortEnum: RenderSortEnum = ({\n model,\n fields,\n fieldTypePlugins,\n sorterPlugins\n}): string => {\n let sorters: string[] = [\n `id_ASC`,\n `id_DESC`,\n\n ...ENTRY_META_FIELDS.filter(isDateTimeEntryMetaField)\n .map(field => [`${field}_ASC`, `${field}_DESC`])\n .flat()\n ];\n\n for (const field of fields) {\n const plugin = fieldTypePlugins[getBaseFieldType(field)];\n if (!plugin) {\n continue;\n } else if (plugin.createSorters) {\n const result = plugin.createSorters({\n model,\n field,\n sorters\n });\n if (result) {\n sorters = result;\n continue;\n }\n }\n if (!plugin.isSortable) {\n continue;\n }\n sorters.push(`${field.fieldId}_ASC`);\n sorters.push(`${field.fieldId}_DESC`);\n }\n if (!sorterPlugins) {\n return sorters.join(\"\\n\");\n }\n\n return sorterPlugins\n .reduce((result, plugin) => {\n return plugin.createSorter({\n model,\n sorters: result\n });\n }, sorters)\n .join(\"\\n\");\n};\n"],"mappings":";;;;;;AACA,IAAAA,iBAAA,GAAAC,OAAA;AAEA,IAAAC,UAAA,GAAAD,OAAA;AAaO,MAAME,cAA8B,GAAGA,CAAC;EAC3CC,KAAK;EACLC,MAAM;EACNC,gBAAgB;EAChBC;AACJ,CAAC,KAAa;EACV,IAAIC,OAAiB,GAAG,CACpB,QAAQ,EACR,SAAS,EAET,GAAGC,4BAAiB,CAACC,MAAM,CAACC,mCAAwB,CAAC,CAChDC,GAAG,CAACC,KAAK,IAAI,CAAC,GAAGA,KAAK,MAAM,EAAE,GAAGA,KAAK,OAAO,CAAC,CAAC,CAC/CC,IAAI,CAAC,CAAC,CACd;EAED,KAAK,MAAMD,KAAK,IAAIR,MAAM,EAAE;IACxB,MAAMU,MAAM,GAAGT,gBAAgB,CAAC,IAAAU,kCAAgB,EAACH,KAAK,CAAC,CAAC;IACxD,IAAI,CAACE,MAAM,EAAE;MACT;IACJ,CAAC,MAAM,IAAIA,MAAM,CAACE,aAAa,EAAE;MAC7B,MAAMC,MAAM,GAAGH,MAAM,CAACE,aAAa,CAAC;QAChCb,KAAK;QACLS,KAAK;QACLL;MACJ,CAAC,CAAC;MACF,IAAIU,MAAM,EAAE;QACRV,OAAO,GAAGU,MAAM;QAChB;MACJ;IACJ;IACA,IAAI,CAACH,MAAM,CAACI,UAAU,EAAE;MACpB;IACJ;IACAX,OAAO,CAACY,IAAI,CAAC,GAAGP,KAAK,CAACQ,OAAO,MAAM,CAAC;IACpCb,OAAO,CAACY,IAAI,CAAC,GAAGP,KAAK,CAACQ,OAAO,OAAO,CAAC;EACzC;EACA,IAAI,CAACd,aAAa,EAAE;IAChB,OAAOC,OAAO,CAACc,IAAI,CAAC,IAAI,CAAC;EAC7B;EAEA,OAAOf,aAAa,CACfgB,MAAM,CAAC,CAACL,MAAM,EAAEH,MAAM,KAAK;IACxB,OAAOA,MAAM,CAACS,YAAY,CAAC;MACvBpB,KAAK;MACLI,OAAO,EAAEU;IACb,CAAC,CAAC;EACN,CAAC,EAAEV,OAAO,CAAC,CACVc,IAAI,CAAC,IAAI,CAAC;AACnB,CAAC;AAACG,OAAA,CAAAtB,cAAA,GAAAA,cAAA","ignoreList":[]}
1
+ {"version":3,"names":["_getBaseFieldType","require","_constants","renderSortEnum","model","fields","fieldTypePlugins","sorterPlugins","sorters","ENTRY_META_FIELDS","filter","isDateTimeEntryMetaField","map","field","flat","plugin","getBaseFieldType","createSorters","result","isSortable","push","fieldId","join","reduce","createSorter","exports"],"sources":["renderSortEnum.ts"],"sourcesContent":["import type { CmsFieldTypePlugins, CmsModel, CmsModelField } from \"~/types\";\nimport { getBaseFieldType } from \"~/utils/getBaseFieldType\";\nimport type { CmsGraphQLSchemaSorterPlugin } from \"~/plugins/CmsGraphQLSchemaSorterPlugin\";\nimport { ENTRY_META_FIELDS, isDateTimeEntryMetaField } from \"~/constants\";\n\ninterface RenderSortEnumParams {\n model: CmsModel;\n fields: CmsModelField[];\n fieldTypePlugins: CmsFieldTypePlugins;\n sorterPlugins?: CmsGraphQLSchemaSorterPlugin[];\n}\n\ninterface RenderSortEnum {\n (params: RenderSortEnumParams): string;\n}\n\nexport const renderSortEnum: RenderSortEnum = ({\n model,\n fields,\n fieldTypePlugins,\n sorterPlugins\n}): string => {\n let sorters: string[] = [\n `id_ASC`,\n `id_DESC`,\n\n ...ENTRY_META_FIELDS.filter(isDateTimeEntryMetaField)\n .map(field => [`${field}_ASC`, `${field}_DESC`])\n .flat()\n ];\n\n for (const field of fields) {\n const plugin = fieldTypePlugins[getBaseFieldType(field)];\n if (!plugin) {\n continue;\n } else if (plugin.createSorters) {\n const result = plugin.createSorters({\n model,\n field,\n sorters\n });\n if (result) {\n sorters = result;\n continue;\n }\n }\n if (!plugin.isSortable) {\n continue;\n }\n sorters.push(`${field.fieldId}_ASC`);\n sorters.push(`${field.fieldId}_DESC`);\n }\n if (!sorterPlugins) {\n return sorters.join(\"\\n\");\n }\n\n return sorterPlugins\n .reduce((result, plugin) => {\n return plugin.createSorter({\n model,\n sorters: result\n });\n }, sorters)\n .join(\"\\n\");\n};\n"],"mappings":";;;;;;AACA,IAAAA,iBAAA,GAAAC,OAAA;AAEA,IAAAC,UAAA,GAAAD,OAAA;AAaO,MAAME,cAA8B,GAAGA,CAAC;EAC3CC,KAAK;EACLC,MAAM;EACNC,gBAAgB;EAChBC;AACJ,CAAC,KAAa;EACV,IAAIC,OAAiB,GAAG,CACpB,QAAQ,EACR,SAAS,EAET,GAAGC,4BAAiB,CAACC,MAAM,CAACC,mCAAwB,CAAC,CAChDC,GAAG,CAACC,KAAK,IAAI,CAAC,GAAGA,KAAK,MAAM,EAAE,GAAGA,KAAK,OAAO,CAAC,CAAC,CAC/CC,IAAI,CAAC,CAAC,CACd;EAED,KAAK,MAAMD,KAAK,IAAIR,MAAM,EAAE;IACxB,MAAMU,MAAM,GAAGT,gBAAgB,CAAC,IAAAU,kCAAgB,EAACH,KAAK,CAAC,CAAC;IACxD,IAAI,CAACE,MAAM,EAAE;MACT;IACJ,CAAC,MAAM,IAAIA,MAAM,CAACE,aAAa,EAAE;MAC7B,MAAMC,MAAM,GAAGH,MAAM,CAACE,aAAa,CAAC;QAChCb,KAAK;QACLS,KAAK;QACLL;MACJ,CAAC,CAAC;MACF,IAAIU,MAAM,EAAE;QACRV,OAAO,GAAGU,MAAM;QAChB;MACJ;IACJ;IACA,IAAI,CAACH,MAAM,CAACI,UAAU,EAAE;MACpB;IACJ;IACAX,OAAO,CAACY,IAAI,CAAC,GAAGP,KAAK,CAACQ,OAAO,MAAM,CAAC;IACpCb,OAAO,CAACY,IAAI,CAAC,GAAGP,KAAK,CAACQ,OAAO,OAAO,CAAC;EACzC;EACA,IAAI,CAACd,aAAa,EAAE;IAChB,OAAOC,OAAO,CAACc,IAAI,CAAC,IAAI,CAAC;EAC7B;EAEA,OAAOf,aAAa,CACfgB,MAAM,CAAC,CAACL,MAAM,EAAEH,MAAM,KAAK;IACxB,OAAOA,MAAM,CAACS,YAAY,CAAC;MACvBpB,KAAK;MACLI,OAAO,EAAEU;IACb,CAAC,CAAC;EACN,CAAC,EAAEV,OAAO,CAAC,CACVc,IAAI,CAAC,IAAI,CAAC;AACnB,CAAC;AAACG,OAAA,CAAAtB,cAAA,GAAAA,cAAA","ignoreList":[]}
@@ -1,2 +1,2 @@
1
- import { CmsModelFieldValidatorPlugin } from "../types";
1
+ import type { CmsModelFieldValidatorPlugin } from "../types";
2
2
  export declare const createDateGteValidator: () => CmsModelFieldValidatorPlugin;
@@ -1 +1 @@
1
- {"version":3,"names":["_validation","require","createDateGteValidator","type","name","validator","validate","value","gteValue","settings","validation","then","v","catch","exports"],"sources":["dateGte.ts"],"sourcesContent":["import { validation } from \"@webiny/validation\";\nimport { CmsModelFieldValidatorPlugin } from \"~/types\";\n\nexport const createDateGteValidator = (): CmsModelFieldValidatorPlugin => ({\n type: \"cms-model-field-validator\",\n name: \"cms-model-field-validator-date-gte\",\n validator: {\n name: \"dateGte\",\n async validate({ value, validator }) {\n const { value: gteValue, type } = validator.settings || {};\n if (typeof gteValue === \"undefined\") {\n return true;\n } else if (type === \"time\") {\n return validation\n .validate(value, `timeGte:${gteValue}`)\n .then(v => v === true)\n .catch(() => false);\n }\n return validation\n .validate(value, `dateGte:${gteValue}`)\n .then(v => v === true)\n .catch(() => false);\n }\n }\n});\n"],"mappings":";;;;;;AAAA,IAAAA,WAAA,GAAAC,OAAA;AAGO,MAAMC,sBAAsB,GAAGA,CAAA,MAAqC;EACvEC,IAAI,EAAE,2BAA2B;EACjCC,IAAI,EAAE,oCAAoC;EAC1CC,SAAS,EAAE;IACPD,IAAI,EAAE,SAAS;IACf,MAAME,QAAQA,CAAC;MAAEC,KAAK;MAAEF;IAAU,CAAC,EAAE;MACjC,MAAM;QAAEE,KAAK,EAAEC,QAAQ;QAAEL;MAAK,CAAC,GAAGE,SAAS,CAACI,QAAQ,IAAI,CAAC,CAAC;MAC1D,IAAI,OAAOD,QAAQ,KAAK,WAAW,EAAE;QACjC,OAAO,IAAI;MACf,CAAC,MAAM,IAAIL,IAAI,KAAK,MAAM,EAAE;QACxB,OAAOO,sBAAU,CACZJ,QAAQ,CAACC,KAAK,EAAE,WAAWC,QAAQ,EAAE,CAAC,CACtCG,IAAI,CAACC,CAAC,IAAIA,CAAC,KAAK,IAAI,CAAC,CACrBC,KAAK,CAAC,MAAM,KAAK,CAAC;MAC3B;MACA,OAAOH,sBAAU,CACZJ,QAAQ,CAACC,KAAK,EAAE,WAAWC,QAAQ,EAAE,CAAC,CACtCG,IAAI,CAACC,CAAC,IAAIA,CAAC,KAAK,IAAI,CAAC,CACrBC,KAAK,CAAC,MAAM,KAAK,CAAC;IAC3B;EACJ;AACJ,CAAC,CAAC;AAACC,OAAA,CAAAZ,sBAAA,GAAAA,sBAAA","ignoreList":[]}
1
+ {"version":3,"names":["_validation","require","createDateGteValidator","type","name","validator","validate","value","gteValue","settings","validation","then","v","catch","exports"],"sources":["dateGte.ts"],"sourcesContent":["import { validation } from \"@webiny/validation\";\nimport type { CmsModelFieldValidatorPlugin } from \"~/types\";\n\nexport const createDateGteValidator = (): CmsModelFieldValidatorPlugin => ({\n type: \"cms-model-field-validator\",\n name: \"cms-model-field-validator-date-gte\",\n validator: {\n name: \"dateGte\",\n async validate({ value, validator }) {\n const { value: gteValue, type } = validator.settings || {};\n if (typeof gteValue === \"undefined\") {\n return true;\n } else if (type === \"time\") {\n return validation\n .validate(value, `timeGte:${gteValue}`)\n .then(v => v === true)\n .catch(() => false);\n }\n return validation\n .validate(value, `dateGte:${gteValue}`)\n .then(v => v === true)\n .catch(() => false);\n }\n }\n});\n"],"mappings":";;;;;;AAAA,IAAAA,WAAA,GAAAC,OAAA;AAGO,MAAMC,sBAAsB,GAAGA,CAAA,MAAqC;EACvEC,IAAI,EAAE,2BAA2B;EACjCC,IAAI,EAAE,oCAAoC;EAC1CC,SAAS,EAAE;IACPD,IAAI,EAAE,SAAS;IACf,MAAME,QAAQA,CAAC;MAAEC,KAAK;MAAEF;IAAU,CAAC,EAAE;MACjC,MAAM;QAAEE,KAAK,EAAEC,QAAQ;QAAEL;MAAK,CAAC,GAAGE,SAAS,CAACI,QAAQ,IAAI,CAAC,CAAC;MAC1D,IAAI,OAAOD,QAAQ,KAAK,WAAW,EAAE;QACjC,OAAO,IAAI;MACf,CAAC,MAAM,IAAIL,IAAI,KAAK,MAAM,EAAE;QACxB,OAAOO,sBAAU,CACZJ,QAAQ,CAACC,KAAK,EAAE,WAAWC,QAAQ,EAAE,CAAC,CACtCG,IAAI,CAACC,CAAC,IAAIA,CAAC,KAAK,IAAI,CAAC,CACrBC,KAAK,CAAC,MAAM,KAAK,CAAC;MAC3B;MACA,OAAOH,sBAAU,CACZJ,QAAQ,CAACC,KAAK,EAAE,WAAWC,QAAQ,EAAE,CAAC,CACtCG,IAAI,CAACC,CAAC,IAAIA,CAAC,KAAK,IAAI,CAAC,CACrBC,KAAK,CAAC,MAAM,KAAK,CAAC;IAC3B;EACJ;AACJ,CAAC,CAAC;AAACC,OAAA,CAAAZ,sBAAA,GAAAA,sBAAA","ignoreList":[]}
@@ -1,2 +1,2 @@
1
- import { CmsModelFieldValidatorPlugin } from "../types";
1
+ import type { CmsModelFieldValidatorPlugin } from "../types";
2
2
  export declare const createDateLteValidator: () => CmsModelFieldValidatorPlugin;