@webiny/api-headless-cms 5.17.4 → 5.18.0-beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (395) hide show
  1. package/content/contextSetup.js +1 -2
  2. package/content/graphQLHandlerFactory.d.ts +1 -2
  3. package/content/graphQLHandlerFactory.js +12 -4
  4. package/content/plugins/CmsGroupPlugin.d.ts +11 -0
  5. package/content/plugins/{ContentModelGroupPlugin.js → CmsGroupPlugin.js} +4 -5
  6. package/content/plugins/CmsModelPlugin.d.ts +11 -0
  7. package/content/plugins/{ContentModelPlugin.js → CmsModelPlugin.js} +4 -5
  8. package/content/plugins/buildSchemaPlugins.js +1 -2
  9. package/content/plugins/crud/contentEntry/beforeCreate.d.ts +7 -0
  10. package/content/plugins/crud/contentEntry/beforeCreate.js +28 -0
  11. package/content/plugins/crud/contentEntry/beforeUpdate.d.ts +7 -0
  12. package/content/plugins/crud/contentEntry/beforeUpdate.js +28 -0
  13. package/content/plugins/crud/contentEntry/entryDataValidation.d.ts +2 -2
  14. package/content/plugins/crud/contentEntry/entryDataValidation.js +1 -2
  15. package/content/plugins/crud/contentEntry/markLockedFields.d.ts +3 -3
  16. package/content/plugins/crud/contentEntry/markLockedFields.js +10 -7
  17. package/content/plugins/crud/contentEntry.crud.d.ts +12 -4
  18. package/content/plugins/crud/contentEntry.crud.js +807 -757
  19. package/content/plugins/crud/contentModel/afterCreate.d.ts +7 -0
  20. package/content/plugins/crud/contentModel/afterCreate.js +18 -0
  21. package/content/plugins/crud/contentModel/afterDelete.d.ts +7 -0
  22. package/content/plugins/crud/contentModel/afterDelete.js +18 -0
  23. package/content/plugins/crud/contentModel/afterUpdate.d.ts +7 -0
  24. package/content/plugins/crud/contentModel/afterUpdate.js +18 -0
  25. package/content/plugins/crud/contentModel/beforeCreate.d.ts +9 -0
  26. package/content/plugins/crud/contentModel/beforeCreate.js +146 -0
  27. package/content/plugins/crud/contentModel/beforeDelete.d.ts +9 -0
  28. package/content/plugins/crud/contentModel/beforeDelete.js +56 -0
  29. package/content/plugins/crud/contentModel/beforeUpdate.d.ts +9 -0
  30. package/content/plugins/crud/contentModel/beforeUpdate.js +128 -0
  31. package/content/plugins/crud/contentModel/contentModelManagerFactory.d.ts +2 -2
  32. package/content/plugins/crud/contentModel/contentModelManagerFactory.js +2 -3
  33. package/content/plugins/crud/contentModel/createFieldModels.d.ts +2 -2
  34. package/content/plugins/crud/contentModel/createFieldModels.js +2 -3
  35. package/content/plugins/crud/contentModel/idValidation.js +1 -2
  36. package/content/plugins/crud/contentModel/models.js +1 -2
  37. package/content/plugins/crud/contentModel/validateLayout.d.ts +2 -2
  38. package/content/plugins/crud/contentModel/validateLayout.js +1 -2
  39. package/content/plugins/crud/contentModel.crud.d.ts +12 -4
  40. package/content/plugins/crud/contentModel.crud.js +351 -279
  41. package/content/plugins/crud/contentModelGroup/beforeCreate.d.ts +9 -0
  42. package/content/plugins/crud/contentModelGroup/beforeCreate.js +66 -0
  43. package/content/plugins/crud/contentModelGroup/beforeDelete.d.ts +9 -0
  44. package/content/plugins/crud/contentModelGroup/beforeDelete.js +48 -0
  45. package/content/plugins/crud/contentModelGroup/beforeUpdate.d.ts +8 -0
  46. package/content/plugins/crud/contentModelGroup/beforeUpdate.js +28 -0
  47. package/content/plugins/crud/contentModelGroup.crud.d.ts +12 -4
  48. package/content/plugins/crud/contentModelGroup.crud.js +259 -219
  49. package/content/plugins/crud/index.d.ts +6 -0
  50. package/content/plugins/crud/index.js +96 -0
  51. package/content/plugins/graphqlFields/boolean.js +1 -2
  52. package/content/plugins/graphqlFields/datetime.js +1 -2
  53. package/content/plugins/graphqlFields/file.js +1 -2
  54. package/content/plugins/graphqlFields/index.js +1 -2
  55. package/content/plugins/graphqlFields/longText.js +1 -2
  56. package/content/plugins/graphqlFields/number.js +1 -2
  57. package/content/plugins/graphqlFields/object.js +1 -2
  58. package/content/plugins/graphqlFields/ref.js +22 -11
  59. package/content/plugins/graphqlFields/richText.js +1 -2
  60. package/content/plugins/graphqlFields/text.js +1 -2
  61. package/content/plugins/internalSecurity/InternalAuthenticationPlugin.js +2 -3
  62. package/content/plugins/internalSecurity/InternalAuthorizationPlugin.js +1 -2
  63. package/content/plugins/modelManager/DefaultCmsModelManager.d.ts +15 -0
  64. package/content/plugins/modelManager/DefaultCmsModelManager.js +62 -0
  65. package/content/plugins/modelManager/index.d.ts +2 -2
  66. package/content/plugins/modelManager/index.js +3 -4
  67. package/content/plugins/schema/baseSchema.js +1 -2
  68. package/content/plugins/schema/contentEntries.js +9 -10
  69. package/content/plugins/schema/contentModelGroups.js +13 -14
  70. package/content/plugins/schema/contentModels.js +9 -10
  71. package/content/plugins/schema/createFieldResolvers.d.ts +2 -2
  72. package/content/plugins/schema/createFieldResolvers.js +14 -20
  73. package/content/plugins/schema/createManageResolvers.d.ts +3 -3
  74. package/content/plugins/schema/createManageResolvers.js +6 -10
  75. package/content/plugins/schema/createManageSDL.d.ts +2 -2
  76. package/content/plugins/schema/createManageSDL.js +5 -6
  77. package/content/plugins/schema/createPreviewResolvers.d.ts +3 -3
  78. package/content/plugins/schema/createPreviewResolvers.js +5 -6
  79. package/content/plugins/schema/createReadResolvers.d.ts +3 -3
  80. package/content/plugins/schema/createReadResolvers.js +5 -6
  81. package/content/plugins/schema/createReadSDL.d.ts +2 -2
  82. package/content/plugins/schema/createReadSDL.js +3 -4
  83. package/content/plugins/schema/resolvers/commonFieldResolvers.d.ts +4 -4
  84. package/content/plugins/schema/resolvers/commonFieldResolvers.js +1 -2
  85. package/content/plugins/schema/resolvers/manage/resolveCreate.d.ts +1 -1
  86. package/content/plugins/schema/resolvers/manage/resolveCreate.js +3 -4
  87. package/content/plugins/schema/resolvers/manage/resolveCreateFrom.d.ts +1 -1
  88. package/content/plugins/schema/resolvers/manage/resolveCreateFrom.js +3 -4
  89. package/content/plugins/schema/resolvers/manage/resolveDelete.d.ts +1 -1
  90. package/content/plugins/schema/resolvers/manage/resolveDelete.js +4 -5
  91. package/content/plugins/schema/resolvers/manage/resolveGet.d.ts +1 -1
  92. package/content/plugins/schema/resolvers/manage/resolveGet.js +3 -4
  93. package/content/plugins/schema/resolvers/manage/resolveGetByIds.d.ts +1 -1
  94. package/content/plugins/schema/resolvers/manage/resolveGetByIds.js +3 -4
  95. package/content/plugins/schema/resolvers/manage/resolveGetRevisions.d.ts +1 -1
  96. package/content/plugins/schema/resolvers/manage/resolveGetRevisions.js +3 -4
  97. package/content/plugins/schema/resolvers/manage/resolveList.d.ts +1 -1
  98. package/content/plugins/schema/resolvers/manage/resolveList.js +3 -4
  99. package/content/plugins/schema/resolvers/manage/resolvePublish.d.ts +1 -1
  100. package/content/plugins/schema/resolvers/manage/resolvePublish.js +3 -4
  101. package/content/plugins/schema/resolvers/manage/resolveRequestChanges.d.ts +1 -1
  102. package/content/plugins/schema/resolvers/manage/resolveRequestChanges.js +3 -4
  103. package/content/plugins/schema/resolvers/manage/resolveRequestReview.d.ts +1 -1
  104. package/content/plugins/schema/resolvers/manage/resolveRequestReview.js +3 -4
  105. package/content/plugins/schema/resolvers/manage/resolveUnpublish.d.ts +1 -1
  106. package/content/plugins/schema/resolvers/manage/resolveUnpublish.js +3 -4
  107. package/content/plugins/schema/resolvers/manage/resolveUpdate.d.ts +1 -1
  108. package/content/plugins/schema/resolvers/manage/resolveUpdate.js +3 -4
  109. package/content/plugins/schema/resolvers/preview/resolveGet.d.ts +1 -1
  110. package/content/plugins/schema/resolvers/preview/resolveGet.js +3 -4
  111. package/content/plugins/schema/resolvers/preview/resolveList.d.ts +1 -1
  112. package/content/plugins/schema/resolvers/preview/resolveList.js +3 -4
  113. package/content/plugins/schema/resolvers/read/resolveGet.d.ts +1 -1
  114. package/content/plugins/schema/resolvers/read/resolveGet.js +3 -4
  115. package/content/plugins/schema/resolvers/read/resolveList.d.ts +1 -1
  116. package/content/plugins/schema/resolvers/read/resolveList.js +3 -4
  117. package/content/plugins/schema/schemaPlugins.js +4 -3
  118. package/content/plugins/storage/StorageTransformPlugin.d.ts +30 -0
  119. package/content/plugins/storage/StorageTransformPlugin.js +36 -0
  120. package/content/plugins/storage/default.d.ts +2 -2
  121. package/content/plugins/storage/default.js +12 -12
  122. package/content/plugins/storage/object.d.ts +2 -2
  123. package/content/plugins/storage/object.js +28 -29
  124. package/content/plugins/utils/createTypeName.js +1 -2
  125. package/content/plugins/utils/entryStorage.d.ts +5 -5
  126. package/content/plugins/utils/entryStorage.js +21 -14
  127. package/content/plugins/utils/getEntryTitle.d.ts +2 -2
  128. package/content/plugins/utils/getEntryTitle.js +1 -2
  129. package/content/plugins/utils/getSchemaFromFieldPlugins.d.ts +2 -2
  130. package/content/plugins/utils/getSchemaFromFieldPlugins.js +1 -2
  131. package/content/plugins/utils/pluralizedTypeName.js +1 -2
  132. package/content/plugins/utils/renderFields.d.ts +2 -2
  133. package/content/plugins/utils/renderFields.js +1 -2
  134. package/content/plugins/utils/renderGetFilterFields.d.ts +2 -2
  135. package/content/plugins/utils/renderGetFilterFields.js +1 -2
  136. package/content/plugins/utils/renderInputFields.d.ts +2 -2
  137. package/content/plugins/utils/renderInputFields.js +1 -2
  138. package/content/plugins/utils/renderListFilterFields.d.ts +2 -2
  139. package/content/plugins/utils/renderListFilterFields.js +1 -2
  140. package/content/plugins/utils/renderSortEnum.d.ts +2 -2
  141. package/content/plugins/utils/renderSortEnum.js +1 -2
  142. package/content/plugins/validators/dateGte.js +1 -2
  143. package/content/plugins/validators/dateLte.js +1 -2
  144. package/content/plugins/validators/gte.js +1 -2
  145. package/content/plugins/validators/in.js +1 -2
  146. package/content/plugins/validators/index.js +1 -2
  147. package/content/plugins/validators/lte.js +1 -2
  148. package/content/plugins/validators/maxLength.js +1 -2
  149. package/content/plugins/validators/minLength.js +1 -2
  150. package/content/plugins/validators/pattern.js +1 -2
  151. package/content/plugins/validators/patternPlugins/email.js +1 -2
  152. package/content/plugins/validators/patternPlugins/index.js +1 -2
  153. package/content/plugins/validators/patternPlugins/lowerCase.js +1 -2
  154. package/content/plugins/validators/patternPlugins/upperCase.js +1 -2
  155. package/content/plugins/validators/patternPlugins/url.js +1 -2
  156. package/content/plugins/validators/required.js +1 -2
  157. package/content/plugins/validators/timeGte.js +1 -2
  158. package/content/plugins/validators/timeLte.js +1 -2
  159. package/index.d.ts +12 -0
  160. package/index.js +66 -0
  161. package/migrateCMSPermissions.d.ts +2 -2
  162. package/migrateCMSPermissions.js +1 -2
  163. package/package.json +23 -21
  164. package/plugins/context.js +1 -2
  165. package/plugins/crud/index.d.ts +6 -2
  166. package/plugins/crud/index.js +69 -6
  167. package/plugins/crud/settings.crud.d.ts +10 -4
  168. package/plugins/crud/settings.crud.js +64 -77
  169. package/plugins/crud/system.crud.d.ts +10 -4
  170. package/plugins/crud/system.crud.js +139 -126
  171. package/plugins/graphql/system.js +5 -6
  172. package/plugins/graphql.d.ts +1 -2
  173. package/plugins/graphql.js +49 -50
  174. package/plugins/upgrades/index.js +1 -2
  175. package/plugins/upgrades/v5.5.0/helpers.js +1 -2
  176. package/plugins/upgrades/v5.5.0/index.js +3 -4
  177. package/transformers.js +1 -2
  178. package/types.d.ts +742 -1232
  179. package/types.js +104 -254
  180. package/utils.d.ts +4 -11
  181. package/utils.js +2 -49
  182. package/content/contextSetup.js.map +0 -1
  183. package/content/graphQLHandlerFactory.js.map +0 -1
  184. package/content/index.d.ts +0 -5
  185. package/content/index.js +0 -37
  186. package/content/index.js.map +0 -1
  187. package/content/plugins/ContentModelGroupPlugin.d.ts +0 -7
  188. package/content/plugins/ContentModelGroupPlugin.js.map +0 -1
  189. package/content/plugins/ContentModelPlugin.d.ts +0 -7
  190. package/content/plugins/ContentModelPlugin.js.map +0 -1
  191. package/content/plugins/buildSchemaPlugins.js.map +0 -1
  192. package/content/plugins/crud/contentEntry/afterCreate.hook.d.ts +0 -2
  193. package/content/plugins/crud/contentEntry/afterCreate.hook.js +0 -15
  194. package/content/plugins/crud/contentEntry/afterCreate.hook.js.map +0 -1
  195. package/content/plugins/crud/contentEntry/afterCreateRevisionFrom.hook.d.ts +0 -2
  196. package/content/plugins/crud/contentEntry/afterCreateRevisionFrom.hook.js +0 -15
  197. package/content/plugins/crud/contentEntry/afterCreateRevisionFrom.hook.js.map +0 -1
  198. package/content/plugins/crud/contentEntry/afterDelete.hook.d.ts +0 -2
  199. package/content/plugins/crud/contentEntry/afterDelete.hook.js +0 -15
  200. package/content/plugins/crud/contentEntry/afterDelete.hook.js.map +0 -1
  201. package/content/plugins/crud/contentEntry/afterDeleteRevision.hook.d.ts +0 -2
  202. package/content/plugins/crud/contentEntry/afterDeleteRevision.hook.js +0 -15
  203. package/content/plugins/crud/contentEntry/afterDeleteRevision.hook.js.map +0 -1
  204. package/content/plugins/crud/contentEntry/afterPublish.hook.d.ts +0 -2
  205. package/content/plugins/crud/contentEntry/afterPublish.hook.js +0 -15
  206. package/content/plugins/crud/contentEntry/afterPublish.hook.js.map +0 -1
  207. package/content/plugins/crud/contentEntry/afterRequestChanges.hook.d.ts +0 -2
  208. package/content/plugins/crud/contentEntry/afterRequestChanges.hook.js +0 -15
  209. package/content/plugins/crud/contentEntry/afterRequestChanges.hook.js.map +0 -1
  210. package/content/plugins/crud/contentEntry/afterRequestReview.hook.d.ts +0 -2
  211. package/content/plugins/crud/contentEntry/afterRequestReview.hook.js +0 -15
  212. package/content/plugins/crud/contentEntry/afterRequestReview.hook.js.map +0 -1
  213. package/content/plugins/crud/contentEntry/afterUnpublish.hook.d.ts +0 -2
  214. package/content/plugins/crud/contentEntry/afterUnpublish.hook.js +0 -15
  215. package/content/plugins/crud/contentEntry/afterUnpublish.hook.js.map +0 -1
  216. package/content/plugins/crud/contentEntry/afterUpdate.hook.d.ts +0 -2
  217. package/content/plugins/crud/contentEntry/afterUpdate.hook.js +0 -15
  218. package/content/plugins/crud/contentEntry/afterUpdate.hook.js.map +0 -1
  219. package/content/plugins/crud/contentEntry/beforeCreate.hook.d.ts +0 -2
  220. package/content/plugins/crud/contentEntry/beforeCreate.hook.js +0 -18
  221. package/content/plugins/crud/contentEntry/beforeCreate.hook.js.map +0 -1
  222. package/content/plugins/crud/contentEntry/beforeCreateRevisionFrom.hook.d.ts +0 -2
  223. package/content/plugins/crud/contentEntry/beforeCreateRevisionFrom.hook.js +0 -15
  224. package/content/plugins/crud/contentEntry/beforeCreateRevisionFrom.hook.js.map +0 -1
  225. package/content/plugins/crud/contentEntry/beforeDelete.hook.d.ts +0 -2
  226. package/content/plugins/crud/contentEntry/beforeDelete.hook.js +0 -15
  227. package/content/plugins/crud/contentEntry/beforeDelete.hook.js.map +0 -1
  228. package/content/plugins/crud/contentEntry/beforeDeleteRevision.hook.d.ts +0 -2
  229. package/content/plugins/crud/contentEntry/beforeDeleteRevision.hook.js +0 -15
  230. package/content/plugins/crud/contentEntry/beforeDeleteRevision.hook.js.map +0 -1
  231. package/content/plugins/crud/contentEntry/beforePublish.hook.d.ts +0 -2
  232. package/content/plugins/crud/contentEntry/beforePublish.hook.js +0 -15
  233. package/content/plugins/crud/contentEntry/beforePublish.hook.js.map +0 -1
  234. package/content/plugins/crud/contentEntry/beforeRequestChanges.hook.d.ts +0 -2
  235. package/content/plugins/crud/contentEntry/beforeRequestChanges.hook.js +0 -15
  236. package/content/plugins/crud/contentEntry/beforeRequestChanges.hook.js.map +0 -1
  237. package/content/plugins/crud/contentEntry/beforeRequestReview.hook.d.ts +0 -2
  238. package/content/plugins/crud/contentEntry/beforeRequestReview.hook.js +0 -15
  239. package/content/plugins/crud/contentEntry/beforeRequestReview.hook.js.map +0 -1
  240. package/content/plugins/crud/contentEntry/beforeUnpublish.hook.d.ts +0 -2
  241. package/content/plugins/crud/contentEntry/beforeUnpublish.hook.js +0 -15
  242. package/content/plugins/crud/contentEntry/beforeUnpublish.hook.js.map +0 -1
  243. package/content/plugins/crud/contentEntry/beforeUpdate.hook.d.ts +0 -2
  244. package/content/plugins/crud/contentEntry/beforeUpdate.hook.js +0 -18
  245. package/content/plugins/crud/contentEntry/beforeUpdate.hook.js.map +0 -1
  246. package/content/plugins/crud/contentEntry/entryDataValidation.js.map +0 -1
  247. package/content/plugins/crud/contentEntry/hooks.d.ts +0 -18
  248. package/content/plugins/crud/contentEntry/hooks.js +0 -240
  249. package/content/plugins/crud/contentEntry/hooks.js.map +0 -1
  250. package/content/plugins/crud/contentEntry/markLockedFields.js.map +0 -1
  251. package/content/plugins/crud/contentEntry/runContentEntryLifecycleHooks.d.ts +0 -4
  252. package/content/plugins/crud/contentEntry/runContentEntryLifecycleHooks.js +0 -24
  253. package/content/plugins/crud/contentEntry/runContentEntryLifecycleHooks.js.map +0 -1
  254. package/content/plugins/crud/contentEntry.crud.js.map +0 -1
  255. package/content/plugins/crud/contentModel/afterCreate.hook.d.ts +0 -7
  256. package/content/plugins/crud/contentModel/afterCreate.hook.js +0 -24
  257. package/content/plugins/crud/contentModel/afterCreate.hook.js.map +0 -1
  258. package/content/plugins/crud/contentModel/afterDelete.hook.d.ts +0 -7
  259. package/content/plugins/crud/contentModel/afterDelete.hook.js +0 -24
  260. package/content/plugins/crud/contentModel/afterDelete.hook.js.map +0 -1
  261. package/content/plugins/crud/contentModel/afterUpdate.hook.d.ts +0 -7
  262. package/content/plugins/crud/contentModel/afterUpdate.hook.js +0 -24
  263. package/content/plugins/crud/contentModel/afterUpdate.hook.js.map +0 -1
  264. package/content/plugins/crud/contentModel/beforeCreate.hook.d.ts +0 -7
  265. package/content/plugins/crud/contentModel/beforeCreate.hook.js +0 -137
  266. package/content/plugins/crud/contentModel/beforeCreate.hook.js.map +0 -1
  267. package/content/plugins/crud/contentModel/beforeDelete.hook.d.ts +0 -7
  268. package/content/plugins/crud/contentModel/beforeDelete.hook.js +0 -58
  269. package/content/plugins/crud/contentModel/beforeDelete.hook.js.map +0 -1
  270. package/content/plugins/crud/contentModel/beforeUpdate.hook.d.ts +0 -7
  271. package/content/plugins/crud/contentModel/beforeUpdate.hook.js +0 -141
  272. package/content/plugins/crud/contentModel/beforeUpdate.hook.js.map +0 -1
  273. package/content/plugins/crud/contentModel/contentModelManagerFactory.js.map +0 -1
  274. package/content/plugins/crud/contentModel/createFieldModels.js.map +0 -1
  275. package/content/plugins/crud/contentModel/hooks.d.ts +0 -6
  276. package/content/plugins/crud/contentModel/hooks.js +0 -84
  277. package/content/plugins/crud/contentModel/hooks.js.map +0 -1
  278. package/content/plugins/crud/contentModel/idValidation.js.map +0 -1
  279. package/content/plugins/crud/contentModel/models.js.map +0 -1
  280. package/content/plugins/crud/contentModel/runContentModelLifecycleHooks.d.ts +0 -2
  281. package/content/plugins/crud/contentModel/runContentModelLifecycleHooks.js +0 -24
  282. package/content/plugins/crud/contentModel/runContentModelLifecycleHooks.js.map +0 -1
  283. package/content/plugins/crud/contentModel/validateLayout.js.map +0 -1
  284. package/content/plugins/crud/contentModel.crud.js.map +0 -1
  285. package/content/plugins/crud/contentModelGroup/afterCreate.hook.d.ts +0 -7
  286. package/content/plugins/crud/contentModelGroup/afterCreate.hook.js +0 -24
  287. package/content/plugins/crud/contentModelGroup/afterCreate.hook.js.map +0 -1
  288. package/content/plugins/crud/contentModelGroup/afterDelete.hook.d.ts +0 -8
  289. package/content/plugins/crud/contentModelGroup/afterDelete.hook.js +0 -22
  290. package/content/plugins/crud/contentModelGroup/afterDelete.hook.js.map +0 -1
  291. package/content/plugins/crud/contentModelGroup/afterUpdate.hook.d.ts +0 -7
  292. package/content/plugins/crud/contentModelGroup/afterUpdate.hook.js +0 -26
  293. package/content/plugins/crud/contentModelGroup/afterUpdate.hook.js.map +0 -1
  294. package/content/plugins/crud/contentModelGroup/beforeCreate.hook.d.ts +0 -7
  295. package/content/plugins/crud/contentModelGroup/beforeCreate.hook.js +0 -87
  296. package/content/plugins/crud/contentModelGroup/beforeCreate.hook.js.map +0 -1
  297. package/content/plugins/crud/contentModelGroup/beforeDelete.hook.d.ts +0 -7
  298. package/content/plugins/crud/contentModelGroup/beforeDelete.hook.js +0 -46
  299. package/content/plugins/crud/contentModelGroup/beforeDelete.hook.js.map +0 -1
  300. package/content/plugins/crud/contentModelGroup/beforeUpdate.hook.d.ts +0 -7
  301. package/content/plugins/crud/contentModelGroup/beforeUpdate.hook.js +0 -35
  302. package/content/plugins/crud/contentModelGroup/beforeUpdate.hook.js.map +0 -1
  303. package/content/plugins/crud/contentModelGroup.crud.js.map +0 -1
  304. package/content/plugins/graphqlFields/boolean.js.map +0 -1
  305. package/content/plugins/graphqlFields/datetime.js.map +0 -1
  306. package/content/plugins/graphqlFields/file.js.map +0 -1
  307. package/content/plugins/graphqlFields/index.js.map +0 -1
  308. package/content/plugins/graphqlFields/longText.js.map +0 -1
  309. package/content/plugins/graphqlFields/number.js.map +0 -1
  310. package/content/plugins/graphqlFields/object.js.map +0 -1
  311. package/content/plugins/graphqlFields/ref.js.map +0 -1
  312. package/content/plugins/graphqlFields/richText.js.map +0 -1
  313. package/content/plugins/graphqlFields/text.js.map +0 -1
  314. package/content/plugins/internalSecurity/InternalAuthenticationPlugin.js.map +0 -1
  315. package/content/plugins/internalSecurity/InternalAuthorizationPlugin.js.map +0 -1
  316. package/content/plugins/modelManager/DefaultContentModelManager.d.ts +0 -15
  317. package/content/plugins/modelManager/DefaultContentModelManager.js +0 -63
  318. package/content/plugins/modelManager/DefaultContentModelManager.js.map +0 -1
  319. package/content/plugins/modelManager/index.js.map +0 -1
  320. package/content/plugins/schema/baseSchema.js.map +0 -1
  321. package/content/plugins/schema/contentEntries.js.map +0 -1
  322. package/content/plugins/schema/contentModelGroups.js.map +0 -1
  323. package/content/plugins/schema/contentModels.js.map +0 -1
  324. package/content/plugins/schema/createFieldResolvers.js.map +0 -1
  325. package/content/plugins/schema/createManageResolvers.js.map +0 -1
  326. package/content/plugins/schema/createManageSDL.js.map +0 -1
  327. package/content/plugins/schema/createPreviewResolvers.js.map +0 -1
  328. package/content/plugins/schema/createReadResolvers.js.map +0 -1
  329. package/content/plugins/schema/createReadSDL.js.map +0 -1
  330. package/content/plugins/schema/resolvers/commonFieldResolvers.js.map +0 -1
  331. package/content/plugins/schema/resolvers/manage/resolveCreate.js.map +0 -1
  332. package/content/plugins/schema/resolvers/manage/resolveCreateFrom.js.map +0 -1
  333. package/content/plugins/schema/resolvers/manage/resolveDelete.js.map +0 -1
  334. package/content/plugins/schema/resolvers/manage/resolveGet.js.map +0 -1
  335. package/content/plugins/schema/resolvers/manage/resolveGetByIds.js.map +0 -1
  336. package/content/plugins/schema/resolvers/manage/resolveGetRevisions.js.map +0 -1
  337. package/content/plugins/schema/resolvers/manage/resolveList.js.map +0 -1
  338. package/content/plugins/schema/resolvers/manage/resolvePublish.js.map +0 -1
  339. package/content/plugins/schema/resolvers/manage/resolveRequestChanges.js.map +0 -1
  340. package/content/plugins/schema/resolvers/manage/resolveRequestReview.js.map +0 -1
  341. package/content/plugins/schema/resolvers/manage/resolveUnpublish.js.map +0 -1
  342. package/content/plugins/schema/resolvers/manage/resolveUpdate.js.map +0 -1
  343. package/content/plugins/schema/resolvers/preview/resolveGet.js.map +0 -1
  344. package/content/plugins/schema/resolvers/preview/resolveList.js.map +0 -1
  345. package/content/plugins/schema/resolvers/read/resolveGet.js.map +0 -1
  346. package/content/plugins/schema/resolvers/read/resolveList.js.map +0 -1
  347. package/content/plugins/schema/schemaPlugins.js.map +0 -1
  348. package/content/plugins/storage/default.js.map +0 -1
  349. package/content/plugins/storage/object.js.map +0 -1
  350. package/content/plugins/utils/createTypeName.js.map +0 -1
  351. package/content/plugins/utils/entryStorage.js.map +0 -1
  352. package/content/plugins/utils/getEntryTitle.js.map +0 -1
  353. package/content/plugins/utils/getSchemaFromFieldPlugins.js.map +0 -1
  354. package/content/plugins/utils/pluralizedTypeName.js.map +0 -1
  355. package/content/plugins/utils/renderFields.js.map +0 -1
  356. package/content/plugins/utils/renderGetFilterFields.js.map +0 -1
  357. package/content/plugins/utils/renderInputFields.js.map +0 -1
  358. package/content/plugins/utils/renderListFilterFields.js.map +0 -1
  359. package/content/plugins/utils/renderSortEnum.js.map +0 -1
  360. package/content/plugins/validators/dateGte.js.map +0 -1
  361. package/content/plugins/validators/dateLte.js.map +0 -1
  362. package/content/plugins/validators/gte.js.map +0 -1
  363. package/content/plugins/validators/in.js.map +0 -1
  364. package/content/plugins/validators/index.js.map +0 -1
  365. package/content/plugins/validators/lte.js.map +0 -1
  366. package/content/plugins/validators/maxLength.js.map +0 -1
  367. package/content/plugins/validators/minLength.js.map +0 -1
  368. package/content/plugins/validators/pattern.js.map +0 -1
  369. package/content/plugins/validators/patternPlugins/email.js.map +0 -1
  370. package/content/plugins/validators/patternPlugins/index.js.map +0 -1
  371. package/content/plugins/validators/patternPlugins/lowerCase.js.map +0 -1
  372. package/content/plugins/validators/patternPlugins/upperCase.js.map +0 -1
  373. package/content/plugins/validators/patternPlugins/url.js.map +0 -1
  374. package/content/plugins/validators/required.js.map +0 -1
  375. package/content/plugins/validators/timeGte.js.map +0 -1
  376. package/content/plugins/validators/timeLte.js.map +0 -1
  377. package/migrateCMSPermissions.js.map +0 -1
  378. package/plugins/InstallationPlugin.d.ts +0 -19
  379. package/plugins/InstallationPlugin.js +0 -39
  380. package/plugins/InstallationPlugin.js.map +0 -1
  381. package/plugins/context.js.map +0 -1
  382. package/plugins/crud/index.js.map +0 -1
  383. package/plugins/crud/settings.crud.js.map +0 -1
  384. package/plugins/crud/system.crud.js.map +0 -1
  385. package/plugins/graphql/system.js.map +0 -1
  386. package/plugins/graphql.js.map +0 -1
  387. package/plugins/index.d.ts +0 -2
  388. package/plugins/index.js +0 -25
  389. package/plugins/index.js.map +0 -1
  390. package/plugins/upgrades/index.js.map +0 -1
  391. package/plugins/upgrades/v5.5.0/helpers.js.map +0 -1
  392. package/plugins/upgrades/v5.5.0/index.js.map +0 -1
  393. package/transformers.js.map +0 -1
  394. package/types.js.map +0 -1
  395. package/utils.js.map +0 -1
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.default = void 0;
8
+ exports.createSystemCrud = void 0;
9
9
 
10
10
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
11
 
@@ -15,13 +15,9 @@ var _apiSecurity = require("@webiny/api-security");
15
15
 
16
16
  var _apiUpgrade = require("@webiny/api-upgrade");
17
17
 
18
- var _ContextPlugin = require("@webiny/handler/plugins/ContextPlugin");
19
-
20
18
  var _error = _interopRequireDefault(require("@webiny/error"));
21
19
 
22
- var _InstallationPlugin = require("../InstallationPlugin");
23
-
24
- var _utils = require("../../utils");
20
+ var _pubsub = require("@webiny/pubsub");
25
21
 
26
22
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
27
23
 
@@ -34,136 +30,153 @@ const initialContentModelGroup = {
34
30
  icon: "fas/star"
35
31
  };
36
32
 
37
- var _default = new _ContextPlugin.ContextPlugin(async context => {
38
- /**
39
- * If cms is not defined on the context, do not continue, but log it.
40
- */
41
- if (!context.cms) {
42
- return;
43
- }
44
-
45
- const pluginType = "cms-system-storage-operations-provider";
46
- const providerPlugins = context.plugins.byType(pluginType);
47
- const providerPlugin = providerPlugins[providerPlugins.length - 1];
48
-
49
- if (!providerPlugin) {
50
- throw new _error.default(`Missing "${pluginType}" plugin.`, "PLUGIN_NOT_FOUND", {
51
- type: pluginType
52
- });
53
- }
54
-
55
- const storageOperations = await providerPlugin.provide({
56
- context
57
- });
33
+ const createSystemCrud = params => {
34
+ const {
35
+ getTenant,
36
+ storageOperations,
37
+ context,
38
+ getIdentity
39
+ } = params;
40
+ const onBeforeInstall = (0, _pubsub.createTopic)();
41
+ const onAfterInstall = (0, _pubsub.createTopic)();
58
42
 
59
43
  const createReadAPIKey = () => {
60
44
  return _crypto.default.randomBytes(Math.ceil(48 / 2)).toString("hex");
61
45
  };
62
46
 
63
- context.cms = _objectSpread(_objectSpread({}, context.cms), {}, {
64
- system: {
65
- async getVersion() {
66
- if (!context.tenancy.getCurrentTenant()) {
67
- return null;
68
- }
69
-
70
- const system = await storageOperations.get();
71
- return system ? system.version : null;
72
- },
73
-
74
- async setVersion(version) {
75
- const system = await storageOperations.get();
76
-
77
- if (!system) {
78
- await storageOperations.create({
79
- version
80
- });
81
- return;
82
- }
83
-
84
- await storageOperations.update({
85
- version
47
+ const getVersion = async () => {
48
+ if (!getTenant()) {
49
+ return null;
50
+ }
51
+
52
+ const system = await storageOperations.system.get({
53
+ tenant: getTenant().id
54
+ });
55
+ return system ? system.version : null;
56
+ };
57
+
58
+ const setVersion = async version => {
59
+ const original = await storageOperations.system.get({
60
+ tenant: getTenant().id
61
+ });
62
+
63
+ const system = _objectSpread(_objectSpread({}, original || {}), {}, {
64
+ version,
65
+ tenant: getTenant().id
66
+ });
67
+
68
+ if (!original) {
69
+ await storageOperations.system.create({
70
+ system
71
+ });
72
+ return;
73
+ }
74
+
75
+ await storageOperations.system.update({
76
+ original,
77
+ system
78
+ });
79
+ };
80
+
81
+ return {
82
+ onBeforeSystemInstall: onBeforeInstall,
83
+ onAfterSystemInstall: onAfterInstall,
84
+ getSystemVersion: getVersion,
85
+ setSystemVersion: setVersion,
86
+ getReadAPIKey: async () => {
87
+ const original = await storageOperations.system.get({
88
+ tenant: getTenant().id
89
+ });
90
+
91
+ if (!original) {
92
+ return null;
93
+ }
94
+
95
+ if (!original.readAPIKey) {
96
+ const readAPIKey = createReadAPIKey();
97
+
98
+ const system = _objectSpread(_objectSpread({}, original), {}, {
99
+ readAPIKey
86
100
  });
87
- },
88
-
89
- getReadAPIKey: async () => {
90
- const system = await storageOperations.get();
91
-
92
- if (!system) {
93
- return null;
94
- }
95
-
96
- if (!system.readAPIKey) {
97
- const apiKey = createReadAPIKey();
98
- await context.cms.system.setReadAPIKey(apiKey);
99
- return apiKey;
100
- }
101
-
102
- return system.readAPIKey;
103
- },
104
- setReadAPIKey: async apiKey => {
105
- await storageOperations.update({
106
- readAPIKey: apiKey
101
+
102
+ await storageOperations.system.update({
103
+ original,
104
+ system
107
105
  });
108
- },
109
- install: async () => {
110
- const identity = context.security.getIdentity();
111
-
112
- if (!identity) {
113
- throw new _apiSecurity.NotAuthorizedError();
114
- }
115
-
116
- const version = await context.cms.system.getVersion();
117
-
118
- if (version) {
119
- return;
120
- }
121
-
122
- const installationPlugins = context.plugins.byType(_InstallationPlugin.InstallationPlugin.type);
123
- await (0, _utils.executeCallbacks)(installationPlugins, "beforeInstall", {
124
- context
125
- }); // Add default content model group.
126
-
127
- try {
128
- await context.cms.groups.create(initialContentModelGroup);
129
- } catch (ex) {
130
- throw new _error.default(ex.message, "CMS_INSTALLATION_CONTENT_MODEL_GROUP_ERROR", {
131
- group: initialContentModelGroup
132
- });
133
- }
134
-
135
- await (0, _utils.executeCallbacks)(installationPlugins, "afterInstall", {
136
- context
137
- }); // Set app version
138
-
139
- await context.cms.system.setVersion(context.WEBINY_VERSION); // Set internal API key to access Read API
140
-
141
- await context.cms.system.setReadAPIKey(createReadAPIKey());
142
- },
143
-
144
- async upgrade(version) {
145
- const identity = context.security.getIdentity();
146
-
147
- if (!identity) {
148
- throw new _apiSecurity.NotAuthorizedError();
149
- }
150
-
151
- const upgradePlugins = context.plugins.byType("api-upgrade").filter(pl => pl.app === "headless-cms");
152
- const plugin = (0, _apiUpgrade.getApplicablePlugin)({
153
- deployedVersion: context.WEBINY_VERSION,
154
- installedAppVersion: await this.getVersion(),
155
- upgradePlugins,
156
- upgradeToVersion: version
106
+ return readAPIKey;
107
+ }
108
+
109
+ return original.readAPIKey;
110
+ },
111
+ installSystem: async () => {
112
+ const identity = getIdentity();
113
+
114
+ if (!identity) {
115
+ throw new _apiSecurity.NotAuthorizedError();
116
+ }
117
+
118
+ const version = await getVersion();
119
+
120
+ if (version) {
121
+ return;
122
+ }
123
+
124
+ await onBeforeInstall.publish({
125
+ tenant: getTenant().id
126
+ });
127
+ /**
128
+ * Add default content model group.
129
+ */
130
+
131
+ try {
132
+ await context.cms.createGroup(initialContentModelGroup);
133
+ } catch (ex) {
134
+ throw new _error.default(ex.message, "CMS_INSTALLATION_CONTENT_MODEL_GROUP_ERROR", {
135
+ group: initialContentModelGroup
157
136
  });
158
- await plugin.apply(context); // Store new app version
137
+ }
159
138
 
160
- await context.cms.system.setVersion(version);
161
- return true;
139
+ await onAfterInstall.publish({
140
+ tenant: getTenant().id
141
+ });
142
+ const system = {
143
+ version: context.WEBINY_VERSION,
144
+ readAPIKey: createReadAPIKey(),
145
+ tenant: getTenant().id
146
+ };
147
+ /**
148
+ * We need to create the system data.
149
+ */
150
+
151
+ await storageOperations.system.create({
152
+ system
153
+ });
154
+ },
155
+
156
+ async upgradeSystem(version) {
157
+ const identity = getIdentity();
158
+
159
+ if (!identity) {
160
+ throw new _apiSecurity.NotAuthorizedError();
162
161
  }
163
162
 
163
+ const upgradePlugins = context.plugins.byType("api-upgrade").filter(pl => pl.app === "headless-cms");
164
+ const plugin = (0, _apiUpgrade.getApplicablePlugin)({
165
+ deployedVersion: context.WEBINY_VERSION,
166
+ installedAppVersion: await this.getVersion(),
167
+ upgradePlugins,
168
+ upgradeToVersion: version
169
+ });
170
+ await plugin.apply(context);
171
+ /**
172
+ * Store new app version.
173
+ */
174
+
175
+ await setVersion(version);
176
+ return true;
164
177
  }
165
- });
166
- });
167
178
 
168
- exports.default = _default;
169
- //# sourceMappingURL=system.crud.js.map
179
+ };
180
+ };
181
+
182
+ exports.createSystemCrud = createSystemCrud;
@@ -28,7 +28,7 @@ var _default = {
28
28
  CmsQuery: {
29
29
  version: async (_, __, context) => {
30
30
  try {
31
- return context.cms.system.getVersion();
31
+ return context.cms.getSystemVersion();
32
32
  } catch (e) {
33
33
  return new _handlerGraphql.ErrorResponse(e);
34
34
  }
@@ -39,7 +39,7 @@ var _default = {
39
39
  cms
40
40
  }) => {
41
41
  try {
42
- const version = await cms.system.getVersion();
42
+ const version = await cms.getSystemVersion();
43
43
 
44
44
  if (version) {
45
45
  return new _handlerGraphql.ErrorResponse({
@@ -48,7 +48,7 @@ var _default = {
48
48
  });
49
49
  }
50
50
 
51
- await cms.system.install();
51
+ await cms.installSystem();
52
52
  return new _handlerGraphql.Response(true);
53
53
  } catch (e) {
54
54
  return new _handlerGraphql.ErrorResponse(e);
@@ -60,7 +60,7 @@ var _default = {
60
60
  cms
61
61
  }) => {
62
62
  try {
63
- await cms.system.upgrade(version);
63
+ await cms.upgradeSystem(version);
64
64
  return new _handlerGraphql.Response(true);
65
65
  } catch (e) {
66
66
  return new _handlerGraphql.ErrorResponse(e);
@@ -69,5 +69,4 @@ var _default = {
69
69
  }
70
70
  }
71
71
  };
72
- exports.default = _default;
73
- //# sourceMappingURL=system.js.map
72
+ exports.default = _default;
@@ -1,3 +1,2 @@
1
1
  import { GraphQLSchemaPlugin } from "@webiny/handler-graphql/types";
2
- declare const _default: () => GraphQLSchemaPlugin<import("@webiny/handler/types").ContextInterface>[];
3
- export default _default;
2
+ export declare const createGraphQLPlugin: () => GraphQLSchemaPlugin;
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.default = void 0;
8
+ exports.createGraphQLPlugin = void 0;
9
9
 
10
10
  var _merge = _interopRequireDefault(require("lodash/merge"));
11
11
 
@@ -13,58 +13,58 @@ var _system = _interopRequireDefault(require("./graphql/system"));
13
13
 
14
14
  const emptyResolver = () => ({});
15
15
 
16
- var _default = () => [{
16
+ const createGraphQLPlugin = () => ({
17
17
  name: "graphql-schema-headless",
18
18
  type: "graphql-schema",
19
19
  schema: {
20
20
  typeDefs:
21
21
  /* GraphQL */
22
22
  `
23
- type CmsError {
24
- code: String
25
- message: String
26
- data: JSON
27
- }
28
-
29
- type CmsCursors {
30
- next: String
31
- previous: String
32
- }
33
-
34
- type CmsListMeta {
35
- cursor: String
36
- hasMoreItems: Boolean
37
- totalCount: Int
38
- }
39
-
40
- type CmsDeleteResponse {
41
- data: Boolean
42
- error: CmsError
43
- }
44
-
45
- type CmsBooleanResponse {
46
- data: Boolean
47
- error: CmsError
48
- }
49
-
50
- extend type Query {
51
- cms: CmsQuery
52
- }
53
-
54
- extend type Mutation {
55
- cms: CmsMutation
56
- }
57
-
58
- type CmsQuery {
59
- _empty: String
60
- }
61
-
62
- type CmsMutation {
63
- _empty: String
64
- }
65
-
66
- ${_system.default.typeDefs}
67
- `,
23
+ type CmsError {
24
+ code: String
25
+ message: String
26
+ data: JSON
27
+ }
28
+
29
+ type CmsCursors {
30
+ next: String
31
+ previous: String
32
+ }
33
+
34
+ type CmsListMeta {
35
+ cursor: String
36
+ hasMoreItems: Boolean
37
+ totalCount: Int
38
+ }
39
+
40
+ type CmsDeleteResponse {
41
+ data: Boolean
42
+ error: CmsError
43
+ }
44
+
45
+ type CmsBooleanResponse {
46
+ data: Boolean
47
+ error: CmsError
48
+ }
49
+
50
+ extend type Query {
51
+ cms: CmsQuery
52
+ }
53
+
54
+ extend type Mutation {
55
+ cms: CmsMutation
56
+ }
57
+
58
+ type CmsQuery {
59
+ _empty: String
60
+ }
61
+
62
+ type CmsMutation {
63
+ _empty: String
64
+ }
65
+
66
+ ${_system.default.typeDefs}
67
+ `,
68
68
  resolvers: (0, _merge.default)({
69
69
  Query: {
70
70
  cms: emptyResolver
@@ -74,7 +74,6 @@ var _default = () => [{
74
74
  }
75
75
  }, _system.default.resolvers)
76
76
  }
77
- }];
77
+ });
78
78
 
79
- exports.default = _default;
80
- //# sourceMappingURL=graphql.js.map
79
+ exports.createGraphQLPlugin = createGraphQLPlugin;
@@ -11,5 +11,4 @@ var _v = _interopRequireDefault(require("./v5.5.0"));
11
11
 
12
12
  var _default = () => [_v.default];
13
13
 
14
- exports.default = _default;
15
- //# sourceMappingURL=index.js.map
14
+ exports.default = _default;
@@ -7,5 +7,4 @@ exports.isCmsContentPermission = void 0;
7
7
 
8
8
  const isCmsContentPermission = permission => permission.name.includes("cms.") && !permission.name.includes("cms.endpoint.");
9
9
 
10
- exports.isCmsContentPermission = isCmsContentPermission;
11
- //# sourceMappingURL=helpers.js.map
10
+ exports.isCmsContentPermission = isCmsContentPermission;
@@ -54,7 +54,7 @@ const plugin = {
54
54
  } // Migrate CMS permissions
55
55
 
56
56
 
57
- const newCMSContentPermissions = await (0, _migrateCMSPermissions.migrateCMSPermissions)(CmsContentPermissions, cms.models.get);
57
+ const newCMSContentPermissions = await (0, _migrateCMSPermissions.migrateCMSPermissions)(CmsContentPermissions, cms.getModel);
58
58
  const newPermissions = [...restPermissions, ...newCMSContentPermissions];
59
59
  console.log(`Saving new permissions for group: ${securityGroup.slug}`);
60
60
  console.log("newPermissions: ", JSON.stringify(newPermissions, null, 2)); // Save group
@@ -103,7 +103,7 @@ const plugin = {
103
103
  } // Migrate CMS permissions.
104
104
 
105
105
 
106
- const newCMSContentPermissions = await (0, _migrateCMSPermissions.migrateCMSPermissions)(CmsContentPermissions, cms.models.get);
106
+ const newCMSContentPermissions = await (0, _migrateCMSPermissions.migrateCMSPermissions)(CmsContentPermissions, cms.getModel);
107
107
  const newPermissions = [...restPermissions, ...newCMSContentPermissions];
108
108
  console.log(`Saving new permissions for API key: ${apiKey.name}`);
109
109
  console.log("newPermissions: ", JSON.stringify(newPermissions, null, 2)); // Save API key
@@ -126,5 +126,4 @@ const plugin = {
126
126
 
127
127
  };
128
128
  var _default = plugin;
129
- exports.default = _default;
130
- //# sourceMappingURL=index.js.map
129
+ exports.default = _default;
package/transformers.js CHANGED
@@ -22,5 +22,4 @@ Object.defineProperty(exports, "entryToStorageTransform", {
22
22
  }
23
23
  });
24
24
 
25
- var _entryStorage = require("./content/plugins/utils/entryStorage");
26
- //# sourceMappingURL=transformers.js.map
25
+ var _entryStorage = require("./content/plugins/utils/entryStorage");