@webiny/api-headless-cms 5.29.0 → 5.30.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (548) hide show
  1. package/context.d.ts +3 -0
  2. package/{content/contextSetup.js → context.js} +13 -8
  3. package/context.js.map +1 -0
  4. package/{content/plugins/crud → crud}/contentEntry/afterDelete.d.ts +1 -1
  5. package/{content/plugins/crud → crud}/contentEntry/afterDelete.js +0 -0
  6. package/{content/plugins/crud → crud}/contentEntry/afterDelete.js.map +0 -0
  7. package/{content/plugins/crud → crud}/contentEntry/beforeCreate.d.ts +1 -1
  8. package/{content/plugins/crud → crud}/contentEntry/beforeCreate.js +0 -0
  9. package/{content/plugins/crud → crud}/contentEntry/beforeCreate.js.map +0 -0
  10. package/{content/plugins/crud → crud}/contentEntry/beforeUpdate.d.ts +1 -1
  11. package/{content/plugins/crud → crud}/contentEntry/beforeUpdate.js +0 -0
  12. package/{content/plugins/crud → crud}/contentEntry/beforeUpdate.js.map +0 -0
  13. package/{content/plugins/crud → crud}/contentEntry/entryDataValidation.d.ts +1 -1
  14. package/{content/plugins/crud → crud}/contentEntry/entryDataValidation.js +7 -1
  15. package/crud/contentEntry/entryDataValidation.js.map +1 -0
  16. package/{content/plugins/crud → crud}/contentEntry/markLockedFields.d.ts +1 -1
  17. package/{content/plugins/crud → crud}/contentEntry/markLockedFields.js +1 -1
  18. package/crud/contentEntry/markLockedFields.js.map +1 -0
  19. package/{content/plugins/crud → crud}/contentEntry/referenceFieldsMapping.d.ts +1 -1
  20. package/{content/plugins/crud → crud}/contentEntry/referenceFieldsMapping.js +0 -0
  21. package/{content/plugins/crud → crud}/contentEntry/referenceFieldsMapping.js.map +0 -0
  22. package/{content/plugins/crud → crud}/contentEntry.crud.d.ts +1 -1
  23. package/{content/plugins/crud → crud}/contentEntry.crud.js +68 -42
  24. package/crud/contentEntry.crud.js.map +1 -0
  25. package/{content/plugins/crud → crud}/contentModel/afterCreate.d.ts +1 -1
  26. package/{content/plugins/crud → crud}/contentModel/afterCreate.js +0 -0
  27. package/{content/plugins/crud → crud}/contentModel/afterCreate.js.map +0 -0
  28. package/{content/plugins/crud → crud}/contentModel/afterCreateFrom.d.ts +1 -1
  29. package/{content/plugins/crud → crud}/contentModel/afterCreateFrom.js +0 -0
  30. package/{content/plugins/crud → crud}/contentModel/afterCreateFrom.js.map +0 -0
  31. package/{content/plugins/crud → crud}/contentModel/afterDelete.d.ts +1 -1
  32. package/{content/plugins/crud → crud}/contentModel/afterDelete.js +0 -0
  33. package/{content/plugins/crud → crud}/contentModel/afterDelete.js.map +0 -0
  34. package/{content/plugins/crud → crud}/contentModel/afterUpdate.d.ts +1 -1
  35. package/{content/plugins/crud → crud}/contentModel/afterUpdate.js +0 -0
  36. package/{content/plugins/crud → crud}/contentModel/afterUpdate.js.map +0 -0
  37. package/{content/plugins/crud → crud}/contentModel/beforeCreate.d.ts +1 -1
  38. package/{content/plugins/crud → crud}/contentModel/beforeCreate.js +1 -1
  39. package/crud/contentModel/beforeCreate.js.map +1 -0
  40. package/{content/plugins/crud → crud}/contentModel/beforeDelete.d.ts +1 -1
  41. package/{content/plugins/crud → crud}/contentModel/beforeDelete.js +1 -1
  42. package/crud/contentModel/beforeDelete.js.map +1 -0
  43. package/{content/plugins/crud → crud}/contentModel/beforeUpdate.d.ts +1 -1
  44. package/{content/plugins/crud → crud}/contentModel/beforeUpdate.js +0 -0
  45. package/crud/contentModel/beforeUpdate.js.map +1 -0
  46. package/{content/plugins/crud → crud}/contentModel/contentModelManagerFactory.d.ts +1 -1
  47. package/{content/plugins/crud → crud}/contentModel/contentModelManagerFactory.js +0 -0
  48. package/{content/plugins/crud → crud}/contentModel/contentModelManagerFactory.js.map +0 -0
  49. package/crud/contentModel/createFieldModels.d.ts +2 -0
  50. package/{content/plugins/crud → crud}/contentModel/createFieldModels.js +0 -0
  51. package/{content/plugins/crud → crud}/contentModel/createFieldModels.js.map +0 -0
  52. package/crud/contentModel/idValidation.d.ts +1 -0
  53. package/{content/plugins/crud → crud}/contentModel/idValidation.js +3 -3
  54. package/crud/contentModel/idValidation.js.map +1 -0
  55. package/{content/plugins/crud → crud}/contentModel/models.d.ts +0 -0
  56. package/{content/plugins/crud → crud}/contentModel/models.js +2 -2
  57. package/crud/contentModel/models.js.map +1 -0
  58. package/{content/plugins/crud → crud}/contentModel/validateLayout.d.ts +1 -1
  59. package/{content/plugins/crud → crud}/contentModel/validateLayout.js +0 -0
  60. package/{content/plugins/crud → crud}/contentModel/validateLayout.js.map +0 -0
  61. package/{content/plugins/crud → crud}/contentModel/validateModelFields.d.ts +1 -1
  62. package/{content/plugins/crud → crud}/contentModel/validateModelFields.js +2 -2
  63. package/crud/contentModel/validateModelFields.js.map +1 -0
  64. package/{content/plugins/crud → crud}/contentModel.crud.d.ts +1 -1
  65. package/{content/plugins/crud → crud}/contentModel.crud.js +14 -12
  66. package/crud/contentModel.crud.js.map +1 -0
  67. package/{content/plugins/crud → crud}/contentModelGroup/beforeCreate.d.ts +1 -1
  68. package/{content/plugins/crud → crud}/contentModelGroup/beforeCreate.js +5 -5
  69. package/crud/contentModelGroup/beforeCreate.js.map +1 -0
  70. package/{content/plugins/crud → crud}/contentModelGroup/beforeDelete.d.ts +1 -1
  71. package/{content/plugins/crud → crud}/contentModelGroup/beforeDelete.js +1 -1
  72. package/crud/contentModelGroup/beforeDelete.js.map +1 -0
  73. package/{content/plugins/crud → crud}/contentModelGroup/beforeUpdate.d.ts +1 -1
  74. package/{content/plugins/crud → crud}/contentModelGroup/beforeUpdate.js +1 -1
  75. package/crud/contentModelGroup/beforeUpdate.js.map +1 -0
  76. package/{content/plugins/crud → crud}/contentModelGroup.crud.d.ts +1 -1
  77. package/{content/plugins/crud → crud}/contentModelGroup.crud.js +15 -13
  78. package/crud/contentModelGroup.crud.js.map +1 -0
  79. package/crud/index.d.ts +6 -0
  80. package/{content/plugins/crud → crud}/index.js +5 -17
  81. package/crud/index.js.map +1 -0
  82. package/{plugins/crud → crud}/settings.crud.d.ts +1 -1
  83. package/{plugins/crud → crud}/settings.crud.js +3 -7
  84. package/crud/settings.crud.js.map +1 -0
  85. package/{plugins/crud → crud}/system.crud.d.ts +1 -1
  86. package/{plugins/crud → crud}/system.crud.js +0 -0
  87. package/{plugins/crud → crud}/system.crud.js.map +0 -0
  88. package/{content/plugins → graphql}/buildSchemaPlugins.d.ts +2 -3
  89. package/graphql/buildSchemaPlugins.js +27 -0
  90. package/graphql/buildSchemaPlugins.js.map +1 -0
  91. package/graphql/graphQLHandlerFactory.d.ts +5 -0
  92. package/{content → graphql}/graphQLHandlerFactory.js +26 -18
  93. package/graphql/graphQLHandlerFactory.js.map +1 -0
  94. package/graphql/index.d.ts +5 -0
  95. package/graphql/index.js +57 -0
  96. package/graphql/index.js.map +1 -0
  97. package/graphql/schema/baseContentSchema.d.ts +3 -0
  98. package/{content/plugins/schema/baseSchema.js → graphql/schema/baseContentSchema.js} +3 -27
  99. package/graphql/schema/baseContentSchema.js.map +1 -0
  100. package/graphql/schema/contentEntries.d.ts +3 -0
  101. package/{content/plugins → graphql}/schema/contentEntries.js +5 -58
  102. package/graphql/schema/contentEntries.js.map +1 -0
  103. package/graphql/schema/contentModelGroups.d.ts +3 -0
  104. package/{content/plugins → graphql}/schema/contentModelGroups.js +27 -11
  105. package/graphql/schema/contentModelGroups.js.map +1 -0
  106. package/graphql/schema/contentModels.d.ts +3 -0
  107. package/{content/plugins → graphql}/schema/contentModels.js +13 -7
  108. package/graphql/schema/contentModels.js.map +1 -0
  109. package/{content/plugins → graphql}/schema/createFieldResolvers.d.ts +1 -1
  110. package/{content/plugins → graphql}/schema/createFieldResolvers.js +1 -1
  111. package/graphql/schema/createFieldResolvers.js.map +1 -0
  112. package/{content/plugins → graphql}/schema/createManageResolvers.d.ts +1 -1
  113. package/{content/plugins → graphql}/schema/createManageResolvers.js +7 -3
  114. package/graphql/schema/createManageResolvers.js.map +1 -0
  115. package/{content/plugins → graphql}/schema/createManageSDL.d.ts +1 -1
  116. package/{content/plugins → graphql}/schema/createManageSDL.js +11 -7
  117. package/graphql/schema/createManageSDL.js.map +1 -0
  118. package/{content/plugins → graphql}/schema/createPreviewResolvers.d.ts +1 -1
  119. package/{content/plugins → graphql}/schema/createPreviewResolvers.js +2 -2
  120. package/graphql/schema/createPreviewResolvers.js.map +1 -0
  121. package/{content/plugins → graphql}/schema/createReadResolvers.d.ts +1 -1
  122. package/{content/plugins → graphql}/schema/createReadResolvers.js +2 -2
  123. package/graphql/schema/createReadResolvers.js.map +1 -0
  124. package/{content/plugins → graphql}/schema/createReadSDL.d.ts +1 -1
  125. package/{content/plugins → graphql}/schema/createReadSDL.js +6 -6
  126. package/graphql/schema/createReadSDL.js.map +1 -0
  127. package/graphql/schema/resolvers/commonFieldResolvers.d.ts +6 -0
  128. package/{content/plugins → graphql}/schema/resolvers/commonFieldResolvers.js +0 -0
  129. package/{content/plugins → graphql}/schema/resolvers/commonFieldResolvers.js.map +0 -0
  130. package/{content/plugins → graphql}/schema/resolvers/manage/resolveCreate.d.ts +1 -1
  131. package/{content/plugins → graphql}/schema/resolvers/manage/resolveCreate.js +0 -0
  132. package/{content/plugins → graphql}/schema/resolvers/manage/resolveCreate.js.map +0 -0
  133. package/{content/plugins → graphql}/schema/resolvers/manage/resolveCreateFrom.d.ts +1 -1
  134. package/{content/plugins → graphql}/schema/resolvers/manage/resolveCreateFrom.js +0 -0
  135. package/{content/plugins → graphql}/schema/resolvers/manage/resolveCreateFrom.js.map +0 -0
  136. package/{content/plugins → graphql}/schema/resolvers/manage/resolveDelete.d.ts +1 -1
  137. package/{content/plugins → graphql}/schema/resolvers/manage/resolveDelete.js +0 -0
  138. package/{content/plugins → graphql}/schema/resolvers/manage/resolveDelete.js.map +0 -0
  139. package/{content/plugins → graphql}/schema/resolvers/manage/resolveGet.d.ts +1 -1
  140. package/{content/plugins → graphql}/schema/resolvers/manage/resolveGet.js +0 -0
  141. package/{content/plugins → graphql}/schema/resolvers/manage/resolveGet.js.map +0 -0
  142. package/{content/plugins → graphql}/schema/resolvers/manage/resolveGetByIds.d.ts +1 -1
  143. package/{content/plugins → graphql}/schema/resolvers/manage/resolveGetByIds.js +0 -0
  144. package/{content/plugins → graphql}/schema/resolvers/manage/resolveGetByIds.js.map +0 -0
  145. package/{content/plugins → graphql}/schema/resolvers/manage/resolveGetRevisions.d.ts +1 -1
  146. package/{content/plugins → graphql}/schema/resolvers/manage/resolveGetRevisions.js +0 -0
  147. package/{content/plugins → graphql}/schema/resolvers/manage/resolveGetRevisions.js.map +0 -0
  148. package/{content/plugins → graphql}/schema/resolvers/manage/resolveList.d.ts +1 -1
  149. package/{content/plugins → graphql}/schema/resolvers/manage/resolveList.js +0 -0
  150. package/{content/plugins → graphql}/schema/resolvers/manage/resolveList.js.map +0 -0
  151. package/{content/plugins → graphql}/schema/resolvers/manage/resolvePublish.d.ts +1 -1
  152. package/{content/plugins → graphql}/schema/resolvers/manage/resolvePublish.js +0 -0
  153. package/{content/plugins → graphql}/schema/resolvers/manage/resolvePublish.js.map +0 -0
  154. package/{content/plugins → graphql}/schema/resolvers/manage/resolveRepublish.d.ts +1 -1
  155. package/{content/plugins → graphql}/schema/resolvers/manage/resolveRepublish.js +0 -0
  156. package/{content/plugins → graphql}/schema/resolvers/manage/resolveRepublish.js.map +0 -0
  157. package/{content/plugins → graphql}/schema/resolvers/manage/resolveRequestChanges.d.ts +1 -1
  158. package/{content/plugins → graphql}/schema/resolvers/manage/resolveRequestChanges.js +0 -0
  159. package/{content/plugins → graphql}/schema/resolvers/manage/resolveRequestChanges.js.map +0 -0
  160. package/{content/plugins → graphql}/schema/resolvers/manage/resolveRequestReview.d.ts +1 -1
  161. package/{content/plugins → graphql}/schema/resolvers/manage/resolveRequestReview.js +0 -0
  162. package/{content/plugins → graphql}/schema/resolvers/manage/resolveRequestReview.js.map +0 -0
  163. package/{content/plugins → graphql}/schema/resolvers/manage/resolveUnpublish.d.ts +1 -1
  164. package/{content/plugins → graphql}/schema/resolvers/manage/resolveUnpublish.js +0 -0
  165. package/{content/plugins → graphql}/schema/resolvers/manage/resolveUnpublish.js.map +0 -0
  166. package/{content/plugins → graphql}/schema/resolvers/manage/resolveUpdate.d.ts +1 -1
  167. package/{content/plugins → graphql}/schema/resolvers/manage/resolveUpdate.js +0 -0
  168. package/{content/plugins → graphql}/schema/resolvers/manage/resolveUpdate.js.map +0 -0
  169. package/{content/plugins/schema/resolvers/read → graphql/schema/resolvers/preview}/resolveGet.d.ts +1 -1
  170. package/{content/plugins → graphql}/schema/resolvers/preview/resolveGet.js +0 -0
  171. package/{content/plugins → graphql}/schema/resolvers/preview/resolveGet.js.map +0 -0
  172. package/{content/plugins → graphql}/schema/resolvers/preview/resolveList.d.ts +1 -1
  173. package/{content/plugins → graphql}/schema/resolvers/preview/resolveList.js +0 -0
  174. package/{content/plugins → graphql}/schema/resolvers/preview/resolveList.js.map +0 -0
  175. package/{content/plugins/schema/resolvers/preview → graphql/schema/resolvers/read}/resolveGet.d.ts +1 -1
  176. package/{content/plugins → graphql}/schema/resolvers/read/resolveGet.js +0 -0
  177. package/{content/plugins → graphql}/schema/resolvers/read/resolveGet.js.map +0 -0
  178. package/{content/plugins → graphql}/schema/resolvers/read/resolveList.d.ts +1 -1
  179. package/{content/plugins → graphql}/schema/resolvers/read/resolveList.js +0 -0
  180. package/{content/plugins → graphql}/schema/resolvers/read/resolveList.js.map +0 -0
  181. package/{content/plugins → graphql}/schema/schemaPlugins.d.ts +1 -1
  182. package/{content/plugins → graphql}/schema/schemaPlugins.js +18 -5
  183. package/graphql/schema/schemaPlugins.js.map +1 -0
  184. package/graphql/system.d.ts +6 -0
  185. package/graphql/system.js +119 -0
  186. package/graphql/system.js.map +1 -0
  187. package/graphqlFields/boolean.d.ts +2 -0
  188. package/graphqlFields/boolean.js +69 -0
  189. package/graphqlFields/boolean.js.map +1 -0
  190. package/graphqlFields/datetime.d.ts +2 -0
  191. package/{content/plugins/graphqlFields → graphqlFields}/datetime.js +42 -40
  192. package/graphqlFields/datetime.js.map +1 -0
  193. package/graphqlFields/file.d.ts +2 -0
  194. package/graphqlFields/file.js +50 -0
  195. package/graphqlFields/file.js.map +1 -0
  196. package/{content/plugins/graphqlFields → graphqlFields}/helpers.d.ts +1 -1
  197. package/{content/plugins/graphqlFields → graphqlFields}/helpers.js +0 -0
  198. package/{content/plugins/graphqlFields → graphqlFields}/helpers.js.map +0 -0
  199. package/graphqlFields/index.d.ts +2 -0
  200. package/graphqlFields/index.js +28 -0
  201. package/graphqlFields/index.js.map +1 -0
  202. package/graphqlFields/longText.d.ts +2 -0
  203. package/graphqlFields/longText.js +63 -0
  204. package/graphqlFields/longText.js.map +1 -0
  205. package/graphqlFields/number.d.ts +2 -0
  206. package/graphqlFields/number.js +75 -0
  207. package/graphqlFields/number.js.map +1 -0
  208. package/graphqlFields/object.d.ts +2 -0
  209. package/graphqlFields/object.js +225 -0
  210. package/graphqlFields/object.js.map +1 -0
  211. package/graphqlFields/ref.d.ts +2 -0
  212. package/graphqlFields/ref.js +279 -0
  213. package/graphqlFields/ref.js.map +1 -0
  214. package/graphqlFields/richText.d.ts +2 -0
  215. package/graphqlFields/richText.js +56 -0
  216. package/graphqlFields/richText.js.map +1 -0
  217. package/graphqlFields/text.d.ts +2 -0
  218. package/graphqlFields/text.js +73 -0
  219. package/graphqlFields/text.js.map +1 -0
  220. package/index.d.ts +10 -17
  221. package/index.js +73 -56
  222. package/index.js.map +1 -1
  223. package/modelManager/DefaultCmsModelManager.d.ts +14 -0
  224. package/{content/plugins/modelManager → modelManager}/DefaultCmsModelManager.js +0 -0
  225. package/{content/plugins/modelManager → modelManager}/DefaultCmsModelManager.js.map +0 -0
  226. package/modelManager/index.d.ts +2 -0
  227. package/{content/plugins/modelManager → modelManager}/index.js +3 -3
  228. package/modelManager/index.js.map +1 -0
  229. package/package.json +26 -27
  230. package/parameters/context.d.ts +2 -0
  231. package/parameters/context.js +22 -0
  232. package/parameters/context.js.map +1 -0
  233. package/parameters/header.d.ts +2 -0
  234. package/parameters/header.js +55 -0
  235. package/parameters/header.js.map +1 -0
  236. package/parameters/index.d.ts +4 -0
  237. package/parameters/index.js +57 -0
  238. package/parameters/index.js.map +1 -0
  239. package/parameters/manual.d.ts +6 -0
  240. package/{plugins/context.js → parameters/manual.js} +27 -27
  241. package/parameters/manual.js.map +1 -0
  242. package/parameters/path.d.ts +2 -0
  243. package/parameters/path.js +54 -0
  244. package/parameters/path.js.map +1 -0
  245. package/{content/plugins → plugins}/CmsGroupPlugin.d.ts +1 -1
  246. package/{content/plugins → plugins}/CmsGroupPlugin.js +0 -0
  247. package/{content/plugins → plugins}/CmsGroupPlugin.js.map +0 -0
  248. package/{content/plugins → plugins}/CmsModelPlugin.d.ts +1 -1
  249. package/{content/plugins → plugins}/CmsModelPlugin.js +0 -0
  250. package/{content/plugins → plugins}/CmsModelPlugin.js.map +0 -0
  251. package/{content/plugins → plugins}/CmsParametersPlugin.d.ts +8 -3
  252. package/{content/plugins → plugins}/CmsParametersPlugin.js +0 -0
  253. package/plugins/CmsParametersPlugin.js.map +1 -0
  254. package/{content/plugins/storage → plugins}/StorageTransformPlugin.d.ts +2 -1
  255. package/{content/plugins/storage → plugins}/StorageTransformPlugin.js +1 -0
  256. package/plugins/StorageTransformPlugin.js.map +1 -0
  257. package/plugins/index.d.ts +4 -0
  258. package/plugins/index.js +57 -0
  259. package/plugins/index.js.map +1 -0
  260. package/storage/default.d.ts +2 -0
  261. package/storage/default.js +27 -0
  262. package/storage/default.js.map +1 -0
  263. package/storage/object.d.ts +2 -0
  264. package/{content/plugins/storage → storage}/object.js +63 -64
  265. package/storage/object.js.map +1 -0
  266. package/types.d.ts +28 -3
  267. package/types.js.map +1 -1
  268. package/upgrades/index.d.ts +1 -0
  269. package/upgrades/index.js +10 -0
  270. package/upgrades/index.js.map +1 -0
  271. package/utils/access.d.ts +8 -0
  272. package/utils/access.js +90 -0
  273. package/utils/access.js.map +1 -0
  274. package/{content/plugins/utils → utils}/createTypeName.d.ts +0 -0
  275. package/{content/plugins/utils → utils}/createTypeName.js +0 -0
  276. package/{content/plugins/utils → utils}/createTypeName.js.map +0 -0
  277. package/{content/plugins/utils → utils}/entryStorage.d.ts +1 -1
  278. package/{content/plugins/utils → utils}/entryStorage.js +1 -1
  279. package/utils/entryStorage.js.map +1 -0
  280. package/utils/filterAsync.d.ts +1 -0
  281. package/utils/filterAsync.js +23 -0
  282. package/utils/filterAsync.js.map +1 -0
  283. package/{content/plugins/utils → utils}/getEntryTitle.d.ts +1 -1
  284. package/{content/plugins/utils → utils}/getEntryTitle.js +0 -0
  285. package/{content/plugins/utils → utils}/getEntryTitle.js.map +0 -0
  286. package/{content/plugins/utils → utils}/getSchemaFromFieldPlugins.d.ts +1 -1
  287. package/{content/plugins/utils → utils}/getSchemaFromFieldPlugins.js +0 -0
  288. package/{content/plugins/utils → utils}/getSchemaFromFieldPlugins.js.map +0 -0
  289. package/utils/ownership.d.ts +8 -0
  290. package/utils/ownership.js +39 -0
  291. package/utils/ownership.js.map +1 -0
  292. package/utils/permissions.d.ts +7 -0
  293. package/utils/permissions.js +110 -0
  294. package/utils/permissions.js.map +1 -0
  295. package/{content/plugins/utils → utils}/pluralizedTypeName.d.ts +0 -0
  296. package/{content/plugins/utils → utils}/pluralizedTypeName.js +0 -0
  297. package/{content/plugins/utils → utils}/pluralizedTypeName.js.map +0 -0
  298. package/{content/plugins/utils → utils}/renderFields.d.ts +1 -1
  299. package/{content/plugins/utils → utils}/renderFields.js +0 -0
  300. package/{content/plugins/utils → utils}/renderFields.js.map +0 -0
  301. package/{content/plugins/utils → utils}/renderGetFilterFields.d.ts +1 -1
  302. package/{content/plugins/utils → utils}/renderGetFilterFields.js +0 -0
  303. package/{content/plugins/utils → utils}/renderGetFilterFields.js.map +0 -0
  304. package/{content/plugins/utils → utils}/renderInputFields.d.ts +1 -1
  305. package/{content/plugins/utils → utils}/renderInputFields.js +0 -0
  306. package/{content/plugins/utils → utils}/renderInputFields.js.map +0 -0
  307. package/{content/plugins/utils → utils}/renderListFilterFields.d.ts +1 -1
  308. package/{content/plugins/utils → utils}/renderListFilterFields.js +0 -0
  309. package/{content/plugins/utils → utils}/renderListFilterFields.js.map +0 -0
  310. package/{content/plugins/utils → utils}/renderSortEnum.d.ts +1 -1
  311. package/{content/plugins/utils → utils}/renderSortEnum.js +0 -0
  312. package/{content/plugins/utils → utils}/renderSortEnum.js.map +0 -0
  313. package/utils/toSlug.d.ts +1 -0
  314. package/utils/toSlug.js +20 -0
  315. package/utils/toSlug.js.map +1 -0
  316. package/validators/dateGte.d.ts +2 -0
  317. package/{content/plugins/validators → validators}/dateGte.js +3 -3
  318. package/validators/dateGte.js.map +1 -0
  319. package/validators/dateLte.d.ts +2 -0
  320. package/{content/plugins/validators → validators}/dateLte.js +3 -3
  321. package/validators/dateLte.js.map +1 -0
  322. package/validators/gte.d.ts +2 -0
  323. package/validators/gte.js +36 -0
  324. package/validators/gte.js.map +1 -0
  325. package/validators/in.d.ts +2 -0
  326. package/validators/in.js +36 -0
  327. package/validators/in.js.map +1 -0
  328. package/validators/index.d.ts +1 -0
  329. package/validators/index.js +36 -0
  330. package/validators/index.js.map +1 -0
  331. package/validators/lte.d.ts +2 -0
  332. package/validators/lte.js +36 -0
  333. package/validators/lte.js.map +1 -0
  334. package/validators/maxLength.d.ts +2 -0
  335. package/validators/maxLength.js +36 -0
  336. package/validators/maxLength.js.map +1 -0
  337. package/validators/minLength.d.ts +2 -0
  338. package/validators/minLength.js +36 -0
  339. package/validators/minLength.js.map +1 -0
  340. package/validators/pattern.d.ts +2 -0
  341. package/validators/pattern.js +50 -0
  342. package/validators/pattern.js.map +1 -0
  343. package/validators/patternPlugins/email.d.ts +2 -0
  344. package/validators/patternPlugins/email.js +20 -0
  345. package/validators/patternPlugins/email.js.map +1 -0
  346. package/validators/patternPlugins/index.d.ts +2 -0
  347. package/validators/patternPlugins/index.js +24 -0
  348. package/validators/patternPlugins/index.js.map +1 -0
  349. package/validators/patternPlugins/lowerCase.d.ts +2 -0
  350. package/validators/patternPlugins/lowerCase.js +20 -0
  351. package/validators/patternPlugins/lowerCase.js.map +1 -0
  352. package/validators/patternPlugins/lowerCaseSpace.d.ts +2 -0
  353. package/validators/patternPlugins/lowerCaseSpace.js +20 -0
  354. package/validators/patternPlugins/lowerCaseSpace.js.map +1 -0
  355. package/validators/patternPlugins/upperCase.d.ts +2 -0
  356. package/validators/patternPlugins/upperCase.js +20 -0
  357. package/validators/patternPlugins/upperCase.js.map +1 -0
  358. package/validators/patternPlugins/upperCaseSpace.d.ts +2 -0
  359. package/validators/patternPlugins/upperCaseSpace.js +20 -0
  360. package/validators/patternPlugins/upperCaseSpace.js.map +1 -0
  361. package/validators/patternPlugins/url.d.ts +2 -0
  362. package/validators/patternPlugins/url.js +20 -0
  363. package/validators/patternPlugins/url.js.map +1 -0
  364. package/validators/required.d.ts +2 -0
  365. package/validators/required.js +27 -0
  366. package/validators/required.js.map +1 -0
  367. package/validators/timeGte.d.ts +2 -0
  368. package/{content/plugins/validators → validators}/timeGte.js +3 -3
  369. package/validators/timeGte.js.map +1 -0
  370. package/validators/timeLte.d.ts +2 -0
  371. package/{content/plugins/validators → validators}/timeLte.js +3 -3
  372. package/validators/timeLte.js.map +1 -0
  373. package/{content/plugins/validators → validators}/unique.d.ts +2 -3
  374. package/{content/plugins/validators → validators}/unique.js +3 -3
  375. package/validators/unique.js.map +1 -0
  376. package/content/contextSetup.d.ts +0 -4
  377. package/content/contextSetup.js.map +0 -1
  378. package/content/graphQLHandlerFactory.d.ts +0 -5
  379. package/content/graphQLHandlerFactory.js.map +0 -1
  380. package/content/parameterPlugins.d.ts +0 -6
  381. package/content/parameterPlugins.js +0 -78
  382. package/content/parameterPlugins.js.map +0 -1
  383. package/content/plugins/CmsParametersPlugin.js.map +0 -1
  384. package/content/plugins/buildSchemaPlugins.js +0 -29
  385. package/content/plugins/buildSchemaPlugins.js.map +0 -1
  386. package/content/plugins/crud/contentEntry/entryDataValidation.js.map +0 -1
  387. package/content/plugins/crud/contentEntry/markLockedFields.js.map +0 -1
  388. package/content/plugins/crud/contentEntry.crud.js.map +0 -1
  389. package/content/plugins/crud/contentModel/beforeCreate.js.map +0 -1
  390. package/content/plugins/crud/contentModel/beforeDelete.js.map +0 -1
  391. package/content/plugins/crud/contentModel/beforeUpdate.js.map +0 -1
  392. package/content/plugins/crud/contentModel/createFieldModels.d.ts +0 -2
  393. package/content/plugins/crud/contentModel/idValidation.d.ts +0 -2
  394. package/content/plugins/crud/contentModel/idValidation.js.map +0 -1
  395. package/content/plugins/crud/contentModel/models.js.map +0 -1
  396. package/content/plugins/crud/contentModel/validateModelFields.js.map +0 -1
  397. package/content/plugins/crud/contentModel.crud.js.map +0 -1
  398. package/content/plugins/crud/contentModelGroup/beforeCreate.js.map +0 -1
  399. package/content/plugins/crud/contentModelGroup/beforeDelete.js.map +0 -1
  400. package/content/plugins/crud/contentModelGroup/beforeUpdate.js.map +0 -1
  401. package/content/plugins/crud/contentModelGroup.crud.js.map +0 -1
  402. package/content/plugins/crud/index.d.ts +0 -6
  403. package/content/plugins/crud/index.js.map +0 -1
  404. package/content/plugins/graphqlFields/boolean.d.ts +0 -3
  405. package/content/plugins/graphqlFields/boolean.js +0 -67
  406. package/content/plugins/graphqlFields/boolean.js.map +0 -1
  407. package/content/plugins/graphqlFields/datetime.d.ts +0 -3
  408. package/content/plugins/graphqlFields/datetime.js.map +0 -1
  409. package/content/plugins/graphqlFields/file.d.ts +0 -3
  410. package/content/plugins/graphqlFields/file.js +0 -48
  411. package/content/plugins/graphqlFields/file.js.map +0 -1
  412. package/content/plugins/graphqlFields/index.d.ts +0 -2
  413. package/content/plugins/graphqlFields/index.js +0 -30
  414. package/content/plugins/graphqlFields/index.js.map +0 -1
  415. package/content/plugins/graphqlFields/longText.d.ts +0 -3
  416. package/content/plugins/graphqlFields/longText.js +0 -61
  417. package/content/plugins/graphqlFields/longText.js.map +0 -1
  418. package/content/plugins/graphqlFields/number.d.ts +0 -3
  419. package/content/plugins/graphqlFields/number.js +0 -73
  420. package/content/plugins/graphqlFields/number.js.map +0 -1
  421. package/content/plugins/graphqlFields/object.d.ts +0 -3
  422. package/content/plugins/graphqlFields/object.js +0 -223
  423. package/content/plugins/graphqlFields/object.js.map +0 -1
  424. package/content/plugins/graphqlFields/ref.d.ts +0 -3
  425. package/content/plugins/graphqlFields/ref.js +0 -276
  426. package/content/plugins/graphqlFields/ref.js.map +0 -1
  427. package/content/plugins/graphqlFields/richText.d.ts +0 -3
  428. package/content/plugins/graphqlFields/richText.js +0 -54
  429. package/content/plugins/graphqlFields/richText.js.map +0 -1
  430. package/content/plugins/graphqlFields/text.d.ts +0 -3
  431. package/content/plugins/graphqlFields/text.js +0 -71
  432. package/content/plugins/graphqlFields/text.js.map +0 -1
  433. package/content/plugins/internalSecurity/InternalAuthenticationPlugin.d.ts +0 -8
  434. package/content/plugins/internalSecurity/InternalAuthenticationPlugin.js +0 -55
  435. package/content/plugins/internalSecurity/InternalAuthenticationPlugin.js.map +0 -1
  436. package/content/plugins/internalSecurity/InternalAuthorizationPlugin.d.ts +0 -7
  437. package/content/plugins/internalSecurity/InternalAuthorizationPlugin.js +0 -36
  438. package/content/plugins/internalSecurity/InternalAuthorizationPlugin.js.map +0 -1
  439. package/content/plugins/modelManager/DefaultCmsModelManager.d.ts +0 -14
  440. package/content/plugins/modelManager/index.d.ts +0 -3
  441. package/content/plugins/modelManager/index.js.map +0 -1
  442. package/content/plugins/schema/baseSchema.d.ts +0 -4
  443. package/content/plugins/schema/baseSchema.js.map +0 -1
  444. package/content/plugins/schema/contentEntries.d.ts +0 -4
  445. package/content/plugins/schema/contentEntries.js.map +0 -1
  446. package/content/plugins/schema/contentModelGroups.d.ts +0 -4
  447. package/content/plugins/schema/contentModelGroups.js.map +0 -1
  448. package/content/plugins/schema/contentModels.d.ts +0 -4
  449. package/content/plugins/schema/contentModels.js.map +0 -1
  450. package/content/plugins/schema/createFieldResolvers.js.map +0 -1
  451. package/content/plugins/schema/createManageResolvers.js.map +0 -1
  452. package/content/plugins/schema/createManageSDL.js.map +0 -1
  453. package/content/plugins/schema/createPreviewResolvers.js.map +0 -1
  454. package/content/plugins/schema/createReadResolvers.js.map +0 -1
  455. package/content/plugins/schema/createReadSDL.js.map +0 -1
  456. package/content/plugins/schema/resolvers/commonFieldResolvers.d.ts +0 -6
  457. package/content/plugins/schema/schemaPlugins.js.map +0 -1
  458. package/content/plugins/storage/StorageTransformPlugin.js.map +0 -1
  459. package/content/plugins/storage/default.d.ts +0 -3
  460. package/content/plugins/storage/default.js +0 -28
  461. package/content/plugins/storage/default.js.map +0 -1
  462. package/content/plugins/storage/object.d.ts +0 -3
  463. package/content/plugins/storage/object.js.map +0 -1
  464. package/content/plugins/utils/entryStorage.js.map +0 -1
  465. package/content/plugins/validators/dateGte.d.ts +0 -3
  466. package/content/plugins/validators/dateGte.js.map +0 -1
  467. package/content/plugins/validators/dateLte.d.ts +0 -3
  468. package/content/plugins/validators/dateLte.js.map +0 -1
  469. package/content/plugins/validators/gte.d.ts +0 -3
  470. package/content/plugins/validators/gte.js +0 -34
  471. package/content/plugins/validators/gte.js.map +0 -1
  472. package/content/plugins/validators/in.d.ts +0 -3
  473. package/content/plugins/validators/in.js +0 -34
  474. package/content/plugins/validators/in.js.map +0 -1
  475. package/content/plugins/validators/index.d.ts +0 -2
  476. package/content/plugins/validators/index.js +0 -38
  477. package/content/plugins/validators/index.js.map +0 -1
  478. package/content/plugins/validators/lte.d.ts +0 -3
  479. package/content/plugins/validators/lte.js +0 -34
  480. package/content/plugins/validators/lte.js.map +0 -1
  481. package/content/plugins/validators/maxLength.d.ts +0 -3
  482. package/content/plugins/validators/maxLength.js +0 -34
  483. package/content/plugins/validators/maxLength.js.map +0 -1
  484. package/content/plugins/validators/minLength.d.ts +0 -3
  485. package/content/plugins/validators/minLength.js +0 -34
  486. package/content/plugins/validators/minLength.js.map +0 -1
  487. package/content/plugins/validators/pattern.d.ts +0 -3
  488. package/content/plugins/validators/pattern.js +0 -47
  489. package/content/plugins/validators/pattern.js.map +0 -1
  490. package/content/plugins/validators/patternPlugins/email.d.ts +0 -3
  491. package/content/plugins/validators/patternPlugins/email.js +0 -17
  492. package/content/plugins/validators/patternPlugins/email.js.map +0 -1
  493. package/content/plugins/validators/patternPlugins/index.d.ts +0 -2
  494. package/content/plugins/validators/patternPlugins/index.js +0 -23
  495. package/content/plugins/validators/patternPlugins/index.js.map +0 -1
  496. package/content/plugins/validators/patternPlugins/lowerCase.d.ts +0 -3
  497. package/content/plugins/validators/patternPlugins/lowerCase.js +0 -17
  498. package/content/plugins/validators/patternPlugins/lowerCase.js.map +0 -1
  499. package/content/plugins/validators/patternPlugins/lowerCaseSpace.d.ts +0 -3
  500. package/content/plugins/validators/patternPlugins/lowerCaseSpace.js +0 -17
  501. package/content/plugins/validators/patternPlugins/lowerCaseSpace.js.map +0 -1
  502. package/content/plugins/validators/patternPlugins/upperCase.d.ts +0 -3
  503. package/content/plugins/validators/patternPlugins/upperCase.js +0 -17
  504. package/content/plugins/validators/patternPlugins/upperCase.js.map +0 -1
  505. package/content/plugins/validators/patternPlugins/upperCaseSpace.d.ts +0 -3
  506. package/content/plugins/validators/patternPlugins/upperCaseSpace.js +0 -17
  507. package/content/plugins/validators/patternPlugins/upperCaseSpace.js.map +0 -1
  508. package/content/plugins/validators/patternPlugins/url.d.ts +0 -3
  509. package/content/plugins/validators/patternPlugins/url.js +0 -17
  510. package/content/plugins/validators/patternPlugins/url.js.map +0 -1
  511. package/content/plugins/validators/required.d.ts +0 -3
  512. package/content/plugins/validators/required.js +0 -25
  513. package/content/plugins/validators/required.js.map +0 -1
  514. package/content/plugins/validators/timeGte.d.ts +0 -3
  515. package/content/plugins/validators/timeGte.js.map +0 -1
  516. package/content/plugins/validators/timeLte.d.ts +0 -3
  517. package/content/plugins/validators/timeLte.js.map +0 -1
  518. package/content/plugins/validators/unique.js.map +0 -1
  519. package/migrateCMSPermissions.d.ts +0 -17
  520. package/migrateCMSPermissions.js +0 -199
  521. package/migrateCMSPermissions.js.map +0 -1
  522. package/plugins/context.d.ts +0 -4
  523. package/plugins/context.js.map +0 -1
  524. package/plugins/crud/index.d.ts +0 -6
  525. package/plugins/crud/index.js +0 -108
  526. package/plugins/crud/index.js.map +0 -1
  527. package/plugins/crud/settings.crud.js.map +0 -1
  528. package/plugins/graphql/system.d.ts +0 -18
  529. package/plugins/graphql/system.js +0 -74
  530. package/plugins/graphql/system.js.map +0 -1
  531. package/plugins/graphql.d.ts +0 -2
  532. package/plugins/graphql.js +0 -86
  533. package/plugins/graphql.js.map +0 -1
  534. package/plugins/upgrades/index.d.ts +0 -2
  535. package/plugins/upgrades/index.js +0 -14
  536. package/plugins/upgrades/index.js.map +0 -1
  537. package/plugins/upgrades/v5.5.0/helpers.d.ts +0 -6
  538. package/plugins/upgrades/v5.5.0/helpers.js +0 -10
  539. package/plugins/upgrades/v5.5.0/helpers.js.map +0 -1
  540. package/plugins/upgrades/v5.5.0/index.d.ts +0 -4
  541. package/plugins/upgrades/v5.5.0/index.js +0 -134
  542. package/plugins/upgrades/v5.5.0/index.js.map +0 -1
  543. package/transformers.d.ts +0 -2
  544. package/transformers.js +0 -25
  545. package/transformers.js.map +0 -1
  546. package/utils.d.ts +0 -23
  547. package/utils.js +0 -251
  548. package/utils.js.map +0 -1
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.createPatternValidator = void 0;
7
+
8
+ const createPatternValidator = () => {
9
+ return {
10
+ type: "cms-model-field-validator",
11
+ name: "cms-model-field-validator-pattern",
12
+ validator: {
13
+ name: "pattern",
14
+
15
+ async validate({
16
+ value,
17
+ validator,
18
+ context
19
+ }) {
20
+ if (!value) {
21
+ return true;
22
+ }
23
+
24
+ const {
25
+ settings
26
+ } = validator;
27
+ let pattern;
28
+
29
+ if ((settings === null || settings === void 0 ? void 0 : settings.preset) === "custom") {
30
+ pattern = settings;
31
+ } else {
32
+ const patternPlugin = context.plugins.byType("cms-model-field-validator-pattern").find(item => item.pattern.name === (settings === null || settings === void 0 ? void 0 : settings.preset));
33
+
34
+ if (patternPlugin) {
35
+ pattern = patternPlugin.pattern;
36
+ }
37
+ }
38
+
39
+ if (!pattern) {
40
+ return true;
41
+ }
42
+
43
+ return new RegExp(pattern.regex, pattern.flags).test(value);
44
+ }
45
+
46
+ }
47
+ };
48
+ };
49
+
50
+ exports.createPatternValidator = createPatternValidator;
@@ -0,0 +1 @@
1
+ {"version":3,"names":["createPatternValidator","type","name","validator","validate","value","context","settings","pattern","preset","patternPlugin","plugins","byType","find","item","RegExp","regex","flags","test"],"sources":["pattern.ts"],"sourcesContent":["import { CmsModelFieldPatternValidatorPlugin, CmsModelFieldValidatorPlugin } from \"~/types\";\n\nexport const createPatternValidator = (): CmsModelFieldValidatorPlugin => {\n return {\n type: \"cms-model-field-validator\",\n name: \"cms-model-field-validator-pattern\",\n validator: {\n name: \"pattern\",\n async validate({ value, validator, context }) {\n if (!value) {\n return true;\n }\n\n const { settings } = validator;\n\n let pattern;\n if (settings?.preset === \"custom\") {\n pattern = settings;\n } else {\n const patternPlugin = context.plugins\n .byType<CmsModelFieldPatternValidatorPlugin>(\n \"cms-model-field-validator-pattern\"\n )\n .find(item => item.pattern.name === settings?.preset);\n\n if (patternPlugin) {\n pattern = patternPlugin.pattern;\n }\n }\n\n if (!pattern) {\n return true;\n }\n\n return new RegExp(pattern.regex, pattern.flags).test(value);\n }\n }\n };\n};\n"],"mappings":";;;;;;;AAEO,MAAMA,sBAAsB,GAAG,MAAoC;EACtE,OAAO;IACHC,IAAI,EAAE,2BADH;IAEHC,IAAI,EAAE,mCAFH;IAGHC,SAAS,EAAE;MACPD,IAAI,EAAE,SADC;;MAEP,MAAME,QAAN,CAAe;QAAEC,KAAF;QAASF,SAAT;QAAoBG;MAApB,CAAf,EAA8C;QAC1C,IAAI,CAACD,KAAL,EAAY;UACR,OAAO,IAAP;QACH;;QAED,MAAM;UAAEE;QAAF,IAAeJ,SAArB;QAEA,IAAIK,OAAJ;;QACA,IAAI,CAAAD,QAAQ,SAAR,IAAAA,QAAQ,WAAR,YAAAA,QAAQ,CAAEE,MAAV,MAAqB,QAAzB,EAAmC;UAC/BD,OAAO,GAAGD,QAAV;QACH,CAFD,MAEO;UACH,MAAMG,aAAa,GAAGJ,OAAO,CAACK,OAAR,CACjBC,MADiB,CAEd,mCAFc,EAIjBC,IAJiB,CAIZC,IAAI,IAAIA,IAAI,CAACN,OAAL,CAAaN,IAAb,MAAsBK,QAAtB,aAAsBA,QAAtB,uBAAsBA,QAAQ,CAAEE,MAAhC,CAJI,CAAtB;;UAMA,IAAIC,aAAJ,EAAmB;YACfF,OAAO,GAAGE,aAAa,CAACF,OAAxB;UACH;QACJ;;QAED,IAAI,CAACA,OAAL,EAAc;UACV,OAAO,IAAP;QACH;;QAED,OAAO,IAAIO,MAAJ,CAAWP,OAAO,CAACQ,KAAnB,EAA0BR,OAAO,CAACS,KAAlC,EAAyCC,IAAzC,CAA8Cb,KAA9C,CAAP;MACH;;IA7BM;EAHR,CAAP;AAmCH,CApCM"}
@@ -0,0 +1,2 @@
1
+ import { CmsModelFieldPatternValidatorPlugin } from "../../types";
2
+ export declare const createEmailPatternValidator: () => CmsModelFieldPatternValidatorPlugin;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.createEmailPatternValidator = void 0;
7
+
8
+ const createEmailPatternValidator = () => {
9
+ return {
10
+ type: "cms-model-field-validator-pattern",
11
+ name: "cms-model-field-validator-pattern-email",
12
+ pattern: {
13
+ name: "email",
14
+ regex: `^\\w[\\w.-]*@([\\w-]+\\.)+[\\w-]+$`,
15
+ flags: "i"
16
+ }
17
+ };
18
+ };
19
+
20
+ exports.createEmailPatternValidator = createEmailPatternValidator;
@@ -0,0 +1 @@
1
+ {"version":3,"names":["createEmailPatternValidator","type","name","pattern","regex","flags"],"sources":["email.ts"],"sourcesContent":["import { CmsModelFieldPatternValidatorPlugin } from \"~/types\";\n\nexport const createEmailPatternValidator = (): CmsModelFieldPatternValidatorPlugin => {\n return {\n type: \"cms-model-field-validator-pattern\",\n name: \"cms-model-field-validator-pattern-email\",\n pattern: {\n name: \"email\",\n regex: `^\\\\w[\\\\w.-]*@([\\\\w-]+\\\\.)+[\\\\w-]+$`,\n flags: \"i\"\n }\n };\n};\n"],"mappings":";;;;;;;AAEO,MAAMA,2BAA2B,GAAG,MAA2C;EAClF,OAAO;IACHC,IAAI,EAAE,mCADH;IAEHC,IAAI,EAAE,yCAFH;IAGHC,OAAO,EAAE;MACLD,IAAI,EAAE,OADD;MAELE,KAAK,EAAG,oCAFH;MAGLC,KAAK,EAAE;IAHF;EAHN,CAAP;AASH,CAVM"}
@@ -0,0 +1,2 @@
1
+ import { CmsModelFieldPatternValidatorPlugin } from "../../types";
2
+ export declare const createPatternValidatorPlugins: () => CmsModelFieldPatternValidatorPlugin[];
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.createPatternValidatorPlugins = void 0;
7
+
8
+ var _email = require("./email");
9
+
10
+ var _url = require("./url");
11
+
12
+ var _lowerCase = require("./lowerCase");
13
+
14
+ var _upperCase = require("./upperCase");
15
+
16
+ var _lowerCaseSpace = require("./lowerCaseSpace");
17
+
18
+ var _upperCaseSpace = require("./upperCaseSpace");
19
+
20
+ const createPatternValidatorPlugins = () => {
21
+ return [(0, _email.createEmailPatternValidator)(), (0, _url.createUrlPatternValidator)(), (0, _lowerCase.createLowerCasePatternValidator)(), (0, _upperCase.createUpperCasePatternValidator)(), (0, _lowerCaseSpace.createLowerCaseSpacePatternValidator)(), (0, _upperCaseSpace.createUpperCaseSpacePatternValidator)()];
22
+ };
23
+
24
+ exports.createPatternValidatorPlugins = createPatternValidatorPlugins;
@@ -0,0 +1 @@
1
+ {"version":3,"names":["createPatternValidatorPlugins","createEmailPatternValidator","createUrlPatternValidator","createLowerCasePatternValidator","createUpperCasePatternValidator","createLowerCaseSpacePatternValidator","createUpperCaseSpacePatternValidator"],"sources":["index.ts"],"sourcesContent":["import { createEmailPatternValidator } from \"./email\";\nimport { createUrlPatternValidator } from \"./url\";\nimport { createLowerCasePatternValidator } from \"./lowerCase\";\nimport { createUpperCasePatternValidator } from \"./upperCase\";\nimport { createLowerCaseSpacePatternValidator } from \"./lowerCaseSpace\";\nimport { createUpperCaseSpacePatternValidator } from \"./upperCaseSpace\";\nimport { CmsModelFieldPatternValidatorPlugin } from \"~/types\";\n\nexport const createPatternValidatorPlugins = (): CmsModelFieldPatternValidatorPlugin[] => {\n return [\n createEmailPatternValidator(),\n createUrlPatternValidator(),\n createLowerCasePatternValidator(),\n createUpperCasePatternValidator(),\n createLowerCaseSpacePatternValidator(),\n createUpperCaseSpacePatternValidator()\n ];\n};\n"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAGO,MAAMA,6BAA6B,GAAG,MAA6C;EACtF,OAAO,CACH,IAAAC,kCAAA,GADG,EAEH,IAAAC,8BAAA,GAFG,EAGH,IAAAC,0CAAA,GAHG,EAIH,IAAAC,0CAAA,GAJG,EAKH,IAAAC,oDAAA,GALG,EAMH,IAAAC,oDAAA,GANG,CAAP;AAQH,CATM"}
@@ -0,0 +1,2 @@
1
+ import { CmsModelFieldPatternValidatorPlugin } from "../../types";
2
+ export declare const createLowerCasePatternValidator: () => CmsModelFieldPatternValidatorPlugin;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.createLowerCasePatternValidator = void 0;
7
+
8
+ const createLowerCasePatternValidator = () => {
9
+ return {
10
+ type: "cms-model-field-validator-pattern",
11
+ name: "cms-model-field-validator-pattern-lower-case",
12
+ pattern: {
13
+ name: "lowerCase",
14
+ regex: `^([a-z]*)$`,
15
+ flags: ""
16
+ }
17
+ };
18
+ };
19
+
20
+ exports.createLowerCasePatternValidator = createLowerCasePatternValidator;
@@ -0,0 +1 @@
1
+ {"version":3,"names":["createLowerCasePatternValidator","type","name","pattern","regex","flags"],"sources":["lowerCase.ts"],"sourcesContent":["import { CmsModelFieldPatternValidatorPlugin } from \"~/types\";\n\nexport const createLowerCasePatternValidator = (): CmsModelFieldPatternValidatorPlugin => {\n return {\n type: \"cms-model-field-validator-pattern\",\n name: \"cms-model-field-validator-pattern-lower-case\",\n pattern: {\n name: \"lowerCase\",\n regex: `^([a-z]*)$`,\n flags: \"\"\n }\n };\n};\n"],"mappings":";;;;;;;AAEO,MAAMA,+BAA+B,GAAG,MAA2C;EACtF,OAAO;IACHC,IAAI,EAAE,mCADH;IAEHC,IAAI,EAAE,8CAFH;IAGHC,OAAO,EAAE;MACLD,IAAI,EAAE,WADD;MAELE,KAAK,EAAG,YAFH;MAGLC,KAAK,EAAE;IAHF;EAHN,CAAP;AASH,CAVM"}
@@ -0,0 +1,2 @@
1
+ import { CmsModelFieldPatternValidatorPlugin } from "../../types";
2
+ export declare const createLowerCaseSpacePatternValidator: () => CmsModelFieldPatternValidatorPlugin;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.createLowerCaseSpacePatternValidator = void 0;
7
+
8
+ const createLowerCaseSpacePatternValidator = () => {
9
+ return {
10
+ type: "cms-model-field-validator-pattern",
11
+ name: "cms-model-field-validator-pattern-lower-case-space",
12
+ pattern: {
13
+ name: "lowerCaseSpace",
14
+ regex: `^([a-z\\s]+)$`,
15
+ flags: ""
16
+ }
17
+ };
18
+ };
19
+
20
+ exports.createLowerCaseSpacePatternValidator = createLowerCaseSpacePatternValidator;
@@ -0,0 +1 @@
1
+ {"version":3,"names":["createLowerCaseSpacePatternValidator","type","name","pattern","regex","flags"],"sources":["lowerCaseSpace.ts"],"sourcesContent":["import { CmsModelFieldPatternValidatorPlugin } from \"~/types\";\n\nexport const createLowerCaseSpacePatternValidator = (): CmsModelFieldPatternValidatorPlugin => {\n return {\n type: \"cms-model-field-validator-pattern\",\n name: \"cms-model-field-validator-pattern-lower-case-space\",\n pattern: {\n name: \"lowerCaseSpace\",\n regex: `^([a-z\\\\s]+)$`,\n flags: \"\"\n }\n };\n};\n"],"mappings":";;;;;;;AAEO,MAAMA,oCAAoC,GAAG,MAA2C;EAC3F,OAAO;IACHC,IAAI,EAAE,mCADH;IAEHC,IAAI,EAAE,oDAFH;IAGHC,OAAO,EAAE;MACLD,IAAI,EAAE,gBADD;MAELE,KAAK,EAAG,eAFH;MAGLC,KAAK,EAAE;IAHF;EAHN,CAAP;AASH,CAVM"}
@@ -0,0 +1,2 @@
1
+ import { CmsModelFieldPatternValidatorPlugin } from "../../types";
2
+ export declare const createUpperCasePatternValidator: () => CmsModelFieldPatternValidatorPlugin;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.createUpperCasePatternValidator = void 0;
7
+
8
+ const createUpperCasePatternValidator = () => {
9
+ return {
10
+ type: "cms-model-field-validator-pattern",
11
+ name: "cms-model-field-validator-pattern-upper-case",
12
+ pattern: {
13
+ name: "upperCase",
14
+ regex: `^([A-Z]*)$`,
15
+ flags: ""
16
+ }
17
+ };
18
+ };
19
+
20
+ exports.createUpperCasePatternValidator = createUpperCasePatternValidator;
@@ -0,0 +1 @@
1
+ {"version":3,"names":["createUpperCasePatternValidator","type","name","pattern","regex","flags"],"sources":["upperCase.ts"],"sourcesContent":["import { CmsModelFieldPatternValidatorPlugin } from \"~/types\";\n\nexport const createUpperCasePatternValidator = (): CmsModelFieldPatternValidatorPlugin => {\n return {\n type: \"cms-model-field-validator-pattern\",\n name: \"cms-model-field-validator-pattern-upper-case\",\n pattern: {\n name: \"upperCase\",\n regex: `^([A-Z]*)$`,\n flags: \"\"\n }\n };\n};\n"],"mappings":";;;;;;;AAEO,MAAMA,+BAA+B,GAAG,MAA2C;EACtF,OAAO;IACHC,IAAI,EAAE,mCADH;IAEHC,IAAI,EAAE,8CAFH;IAGHC,OAAO,EAAE;MACLD,IAAI,EAAE,WADD;MAELE,KAAK,EAAG,YAFH;MAGLC,KAAK,EAAE;IAHF;EAHN,CAAP;AASH,CAVM"}
@@ -0,0 +1,2 @@
1
+ import { CmsModelFieldPatternValidatorPlugin } from "../../types";
2
+ export declare const createUpperCaseSpacePatternValidator: () => CmsModelFieldPatternValidatorPlugin;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.createUpperCaseSpacePatternValidator = void 0;
7
+
8
+ const createUpperCaseSpacePatternValidator = () => {
9
+ return {
10
+ type: "cms-model-field-validator-pattern",
11
+ name: "cms-model-field-validator-pattern-upper-case-space",
12
+ pattern: {
13
+ name: "upperCaseSpace",
14
+ regex: `^([A-Z\\s]+)$`,
15
+ flags: ""
16
+ }
17
+ };
18
+ };
19
+
20
+ exports.createUpperCaseSpacePatternValidator = createUpperCaseSpacePatternValidator;
@@ -0,0 +1 @@
1
+ {"version":3,"names":["createUpperCaseSpacePatternValidator","type","name","pattern","regex","flags"],"sources":["upperCaseSpace.ts"],"sourcesContent":["import { CmsModelFieldPatternValidatorPlugin } from \"~/types\";\n\nexport const createUpperCaseSpacePatternValidator = (): CmsModelFieldPatternValidatorPlugin => {\n return {\n type: \"cms-model-field-validator-pattern\",\n name: \"cms-model-field-validator-pattern-upper-case-space\",\n pattern: {\n name: \"upperCaseSpace\",\n regex: `^([A-Z\\\\s]+)$`,\n flags: \"\"\n }\n };\n};\n"],"mappings":";;;;;;;AAEO,MAAMA,oCAAoC,GAAG,MAA2C;EAC3F,OAAO;IACHC,IAAI,EAAE,mCADH;IAEHC,IAAI,EAAE,oDAFH;IAGHC,OAAO,EAAE;MACLD,IAAI,EAAE,gBADD;MAELE,KAAK,EAAG,eAFH;MAGLC,KAAK,EAAE;IAHF;EAHN,CAAP;AASH,CAVM"}
@@ -0,0 +1,2 @@
1
+ import { CmsModelFieldPatternValidatorPlugin } from "../../types";
2
+ export declare const createUrlPatternValidator: () => CmsModelFieldPatternValidatorPlugin;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.createUrlPatternValidator = void 0;
7
+
8
+ const createUrlPatternValidator = () => {
9
+ return {
10
+ type: "cms-model-field-validator-pattern",
11
+ name: "cms-model-field-validator-pattern-url",
12
+ pattern: {
13
+ name: "url",
14
+ regex: "^(ftp|http|https):\\/\\/(\\w+:{0,1}\\w*@)?(\\S+)(:[0-9]+)?(\\/|\\/([\\w#!:.?+=&%@!\\-\\/]))?$",
15
+ flags: "i"
16
+ }
17
+ };
18
+ };
19
+
20
+ exports.createUrlPatternValidator = createUrlPatternValidator;
@@ -0,0 +1 @@
1
+ {"version":3,"names":["createUrlPatternValidator","type","name","pattern","regex","flags"],"sources":["url.ts"],"sourcesContent":["import { CmsModelFieldPatternValidatorPlugin } from \"~/types\";\n\nexport const createUrlPatternValidator = (): CmsModelFieldPatternValidatorPlugin => {\n return {\n type: \"cms-model-field-validator-pattern\",\n name: \"cms-model-field-validator-pattern-url\",\n pattern: {\n name: \"url\",\n regex: \"^(ftp|http|https):\\\\/\\\\/(\\\\w+:{0,1}\\\\w*@)?(\\\\S+)(:[0-9]+)?(\\\\/|\\\\/([\\\\w#!:.?+=&%@!\\\\-\\\\/]))?$\",\n flags: \"i\"\n }\n };\n};\n"],"mappings":";;;;;;;AAEO,MAAMA,yBAAyB,GAAG,MAA2C;EAChF,OAAO;IACHC,IAAI,EAAE,mCADH;IAEHC,IAAI,EAAE,uCAFH;IAGHC,OAAO,EAAE;MACLD,IAAI,EAAE,KADD;MAELE,KAAK,EAAE,+FAFF;MAGLC,KAAK,EAAE;IAHF;EAHN,CAAP;AASH,CAVM"}
@@ -0,0 +1,2 @@
1
+ import { CmsModelFieldValidatorPlugin } from "../types";
2
+ export declare const createRequiredValidator: () => CmsModelFieldValidatorPlugin;
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.createRequiredValidator = void 0;
7
+
8
+ var _validation = require("@webiny/validation");
9
+
10
+ const createRequiredValidator = () => {
11
+ return {
12
+ type: "cms-model-field-validator",
13
+ name: "cms-model-field-validator-required",
14
+ validator: {
15
+ name: "required",
16
+
17
+ validate({
18
+ value
19
+ }) {
20
+ return _validation.validation.validate(value, "required").then(v => v === true).catch(() => false);
21
+ }
22
+
23
+ }
24
+ };
25
+ };
26
+
27
+ exports.createRequiredValidator = createRequiredValidator;
@@ -0,0 +1 @@
1
+ {"version":3,"names":["createRequiredValidator","type","name","validator","validate","value","validation","then","v","catch"],"sources":["required.ts"],"sourcesContent":["import { validation } from \"@webiny/validation\";\nimport { CmsModelFieldValidatorPlugin } from \"~/types\";\n\nexport const createRequiredValidator = (): CmsModelFieldValidatorPlugin => {\n return {\n type: \"cms-model-field-validator\",\n name: \"cms-model-field-validator-required\",\n validator: {\n name: \"required\",\n validate({ value }) {\n return validation\n .validate(value, \"required\")\n .then(v => v === true)\n .catch(() => false);\n }\n }\n };\n};\n"],"mappings":";;;;;;;AAAA;;AAGO,MAAMA,uBAAuB,GAAG,MAAoC;EACvE,OAAO;IACHC,IAAI,EAAE,2BADH;IAEHC,IAAI,EAAE,oCAFH;IAGHC,SAAS,EAAE;MACPD,IAAI,EAAE,UADC;;MAEPE,QAAQ,CAAC;QAAEC;MAAF,CAAD,EAAY;QAChB,OAAOC,sBAAA,CACFF,QADE,CACOC,KADP,EACc,UADd,EAEFE,IAFE,CAEGC,CAAC,IAAIA,CAAC,KAAK,IAFd,EAGFC,KAHE,CAGI,MAAM,KAHV,CAAP;MAIH;;IAPM;EAHR,CAAP;AAaH,CAdM"}
@@ -0,0 +1,2 @@
1
+ import { CmsModelFieldValidatorPlugin } from "../types";
2
+ export declare const createTimeGteValidator: () => CmsModelFieldValidatorPlugin;
@@ -3,11 +3,11 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.default = void 0;
6
+ exports.createTimeGteValidator = void 0;
7
7
 
8
8
  var _validation = require("@webiny/validation");
9
9
 
10
- var _default = () => ({
10
+ const createTimeGteValidator = () => ({
11
11
  type: "cms-model-field-validator",
12
12
  name: "cms-model-field-validator-time-gte",
13
13
  validator: {
@@ -31,4 +31,4 @@ var _default = () => ({
31
31
  }
32
32
  });
33
33
 
34
- exports.default = _default;
34
+ exports.createTimeGteValidator = createTimeGteValidator;
@@ -0,0 +1 @@
1
+ {"version":3,"names":["createTimeGteValidator","type","name","validator","validate","value","gteValue","settings","validation","then","v","catch"],"sources":["timeGte.ts"],"sourcesContent":["import { validation } from \"@webiny/validation\";\nimport { CmsModelFieldValidatorPlugin } from \"~/types\";\n\nexport const createTimeGteValidator = (): CmsModelFieldValidatorPlugin => ({\n type: \"cms-model-field-validator\",\n name: \"cms-model-field-validator-time-gte\",\n validator: {\n name: \"timeGte\",\n async validate({ value, validator }) {\n const gteValue = validator.settings?.value;\n if (typeof gteValue === \"undefined\") {\n return true;\n }\n return validation\n .validate(value, `timeGte:${gteValue}`)\n .then(v => v === true)\n .catch(() => false);\n }\n }\n});\n"],"mappings":";;;;;;;AAAA;;AAGO,MAAMA,sBAAsB,GAAG,OAAqC;EACvEC,IAAI,EAAE,2BADiE;EAEvEC,IAAI,EAAE,oCAFiE;EAGvEC,SAAS,EAAE;IACPD,IAAI,EAAE,SADC;;IAEP,MAAME,QAAN,CAAe;MAAEC,KAAF;MAASF;IAAT,CAAf,EAAqC;MAAA;;MACjC,MAAMG,QAAQ,0BAAGH,SAAS,CAACI,QAAb,wDAAG,oBAAoBF,KAArC;;MACA,IAAI,OAAOC,QAAP,KAAoB,WAAxB,EAAqC;QACjC,OAAO,IAAP;MACH;;MACD,OAAOE,sBAAA,CACFJ,QADE,CACOC,KADP,EACe,WAAUC,QAAS,EADlC,EAEFG,IAFE,CAEGC,CAAC,IAAIA,CAAC,KAAK,IAFd,EAGFC,KAHE,CAGI,MAAM,KAHV,CAAP;IAIH;;EAXM;AAH4D,CAArC,CAA/B"}
@@ -0,0 +1,2 @@
1
+ import { CmsModelFieldValidatorPlugin } from "../types";
2
+ export declare const createTimeLteValidator: () => CmsModelFieldValidatorPlugin;
@@ -3,11 +3,11 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.default = void 0;
6
+ exports.createTimeLteValidator = void 0;
7
7
 
8
8
  var _validation = require("@webiny/validation");
9
9
 
10
- var _default = () => ({
10
+ const createTimeLteValidator = () => ({
11
11
  type: "cms-model-field-validator",
12
12
  name: "cms-model-field-validator-time-lte",
13
13
  validator: {
@@ -31,4 +31,4 @@ var _default = () => ({
31
31
  }
32
32
  });
33
33
 
34
- exports.default = _default;
34
+ exports.createTimeLteValidator = createTimeLteValidator;
@@ -0,0 +1 @@
1
+ {"version":3,"names":["createTimeLteValidator","type","name","validator","validate","value","lteValue","settings","validation","then","v","catch"],"sources":["timeLte.ts"],"sourcesContent":["import { validation } from \"@webiny/validation\";\nimport { CmsModelFieldValidatorPlugin } from \"~/types\";\n\nexport const createTimeLteValidator = (): CmsModelFieldValidatorPlugin => ({\n type: \"cms-model-field-validator\",\n name: \"cms-model-field-validator-time-lte\",\n validator: {\n name: \"timeLte\",\n async validate({ value, validator }) {\n const lteValue = validator.settings?.value;\n if (typeof lteValue === \"undefined\") {\n return true;\n }\n return validation\n .validate(value, `timeLte:${lteValue}`)\n .then(v => v === true)\n .catch(() => false);\n }\n }\n});\n"],"mappings":";;;;;;;AAAA;;AAGO,MAAMA,sBAAsB,GAAG,OAAqC;EACvEC,IAAI,EAAE,2BADiE;EAEvEC,IAAI,EAAE,oCAFiE;EAGvEC,SAAS,EAAE;IACPD,IAAI,EAAE,SADC;;IAEP,MAAME,QAAN,CAAe;MAAEC,KAAF;MAASF;IAAT,CAAf,EAAqC;MAAA;;MACjC,MAAMG,QAAQ,0BAAGH,SAAS,CAACI,QAAb,wDAAG,oBAAoBF,KAArC;;MACA,IAAI,OAAOC,QAAP,KAAoB,WAAxB,EAAqC;QACjC,OAAO,IAAP;MACH;;MACD,OAAOE,sBAAA,CACFJ,QADE,CACOC,KADP,EACe,WAAUC,QAAS,EADlC,EAEFG,IAFE,CAEGC,CAAC,IAAIA,CAAC,KAAK,IAFd,EAGFC,KAHE,CAGI,MAAM,KAHV,CAAP;IAIH;;EAXM;AAH4D,CAArC,CAA/B"}
@@ -1,7 +1,6 @@
1
- import { CmsModelFieldValidatorPlugin } from "../../../types";
2
- declare const _default: () => CmsModelFieldValidatorPlugin;
1
+ import { CmsModelFieldValidatorPlugin } from "../types";
3
2
  /**
4
3
  * Validation if the field value is unique.
5
4
  * Be aware of using this in DynamoDB only environment as all records will be loaded to check for the unique value.
6
5
  */
7
- export default _default;
6
+ export declare const createUniqueValidator: () => CmsModelFieldValidatorPlugin;
@@ -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.createUniqueValidator = void 0;
9
9
 
10
10
  var _error = _interopRequireDefault(require("@webiny/error"));
11
11
 
@@ -13,7 +13,7 @@ var _error = _interopRequireDefault(require("@webiny/error"));
13
13
  * Validation if the field value is unique.
14
14
  * Be aware of using this in DynamoDB only environment as all records will be loaded to check for the unique value.
15
15
  */
16
- var _default = () => {
16
+ const createUniqueValidator = () => {
17
17
  return {
18
18
  type: "cms-model-field-validator",
19
19
  name: "cms-model-field-validator-unique",
@@ -59,4 +59,4 @@ var _default = () => {
59
59
  };
60
60
  };
61
61
 
62
- exports.default = _default;
62
+ exports.createUniqueValidator = createUniqueValidator;
@@ -0,0 +1 @@
1
+ {"version":3,"names":["createUniqueValidator","type","name","validator","validate","field","value","initialValue","context","model","entry","manager","cms","getModelManager","trim","items","listLatest","where","entryId_not","entryId","undefined","fieldId","limit","length","ex","WebinyError"],"sources":["unique.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport { CmsModelFieldValidatorPlugin } from \"~/types\";\n\n/**\n * Validation if the field value is unique.\n * Be aware of using this in DynamoDB only environment as all records will be loaded to check for the unique value.\n */\nexport const createUniqueValidator = (): CmsModelFieldValidatorPlugin => {\n return {\n type: \"cms-model-field-validator\",\n name: \"cms-model-field-validator-unique\",\n validator: {\n name: \"unique\",\n validate: async ({ field, value: initialValue, context, model, entry }) => {\n const manager = await context.cms.getModelManager(model);\n /**\n * If there is no value passed, we are assuming that user does not want any value to be validated.\n * If user needs something to passed into a unique field, they must add \"required\" validator.\n */\n const value = (initialValue || \"\").trim();\n if (!value) {\n return true;\n }\n try {\n const [items] = await manager.listLatest({\n where: {\n entryId_not: entry ? entry.entryId : undefined,\n [field.fieldId]: value\n },\n limit: 1\n });\n return items.length === 0;\n } catch (ex) {\n throw new WebinyError(\n \"Error while checking if the field value is unique.\",\n \"UNIQUE_CHECK_ERROR\",\n {\n field,\n value,\n model\n }\n );\n }\n }\n }\n };\n};\n"],"mappings":";;;;;;;;;AAAA;;AAGA;AACA;AACA;AACA;AACO,MAAMA,qBAAqB,GAAG,MAAoC;EACrE,OAAO;IACHC,IAAI,EAAE,2BADH;IAEHC,IAAI,EAAE,kCAFH;IAGHC,SAAS,EAAE;MACPD,IAAI,EAAE,QADC;MAEPE,QAAQ,EAAE,OAAO;QAAEC,KAAF;QAASC,KAAK,EAAEC,YAAhB;QAA8BC,OAA9B;QAAuCC,KAAvC;QAA8CC;MAA9C,CAAP,KAAiE;QACvE,MAAMC,OAAO,GAAG,MAAMH,OAAO,CAACI,GAAR,CAAYC,eAAZ,CAA4BJ,KAA5B,CAAtB;QACA;AAChB;AACA;AACA;;QACgB,MAAMH,KAAK,GAAG,CAACC,YAAY,IAAI,EAAjB,EAAqBO,IAArB,EAAd;;QACA,IAAI,CAACR,KAAL,EAAY;UACR,OAAO,IAAP;QACH;;QACD,IAAI;UACA,MAAM,CAACS,KAAD,IAAU,MAAMJ,OAAO,CAACK,UAAR,CAAmB;YACrCC,KAAK,EAAE;cACHC,WAAW,EAAER,KAAK,GAAGA,KAAK,CAACS,OAAT,GAAmBC,SADlC;cAEH,CAACf,KAAK,CAACgB,OAAP,GAAiBf;YAFd,CAD8B;YAKrCgB,KAAK,EAAE;UAL8B,CAAnB,CAAtB;UAOA,OAAOP,KAAK,CAACQ,MAAN,KAAiB,CAAxB;QACH,CATD,CASE,OAAOC,EAAP,EAAW;UACT,MAAM,IAAIC,cAAJ,CACF,oDADE,EAEF,oBAFE,EAGF;YACIpB,KADJ;YAEIC,KAFJ;YAGIG;UAHJ,CAHE,CAAN;QASH;MACJ;IAhCM;EAHR,CAAP;AAsCH,CAvCM"}
@@ -1,4 +0,0 @@
1
- import { CmsContext } from "../types";
2
- import { ContextPlugin } from "@webiny/handler";
3
- declare const _default: () => ContextPlugin<CmsContext>;
4
- export default _default;
@@ -1 +0,0 @@
1
- {"version":3,"names":["getParameters","context","plugins","byType","CmsParametersPlugin","type","plugin","result","WebinyError","ContextPlugin","http","request","method","locale","systemLocale","i18n","getLocale","cms","READ","PREVIEW","MANAGE"],"sources":["contextSetup.ts"],"sourcesContent":["import { CmsContext } from \"~/types\";\nimport WebinyError from \"@webiny/error\";\nimport { ContextPlugin } from \"@webiny/handler\";\nimport {\n CmsParametersPlugin,\n CmsParametersPluginResponse\n} from \"~/content/plugins/CmsParametersPlugin\";\n\nconst getParameters = async (context: CmsContext): Promise<CmsParametersPluginResponse> => {\n const plugins = context.plugins.byType<CmsParametersPlugin>(CmsParametersPlugin.type);\n\n for (const plugin of plugins) {\n const result = await plugin.getParameters(context);\n if (result !== null) {\n return result;\n }\n }\n throw new WebinyError(\n \"Could not determine locale and/or type of the CMS.\",\n \"CMS_LOCALE_AND_TYPE_ERROR\"\n );\n};\n\nexport default () => {\n return new ContextPlugin<CmsContext>(async context => {\n if (context.http?.request?.method === \"OPTIONS\") {\n return;\n }\n\n const { type, locale } = await getParameters(context);\n\n const systemLocale = context.i18n.getLocale(locale);\n if (!systemLocale) {\n throw new WebinyError(`There is no locale \"${locale}\" in the system.`);\n }\n\n context.cms = {\n ...((context.cms || {}) as any),\n type,\n locale,\n getLocale: () => systemLocale,\n READ: type === \"read\",\n PREVIEW: type === \"preview\",\n MANAGE: type === \"manage\"\n } as any;\n });\n};\n"],"mappings":";;;;;;;;;;;AACA;;AACA;;AACA;;;;;;AAKA,MAAMA,aAAa,GAAG,MAAOC,OAAP,IAAqE;EACvF,MAAMC,OAAO,GAAGD,OAAO,CAACC,OAAR,CAAgBC,MAAhB,CAA4CC,wCAAA,CAAoBC,IAAhE,CAAhB;;EAEA,KAAK,MAAMC,MAAX,IAAqBJ,OAArB,EAA8B;IAC1B,MAAMK,MAAM,GAAG,MAAMD,MAAM,CAACN,aAAP,CAAqBC,OAArB,CAArB;;IACA,IAAIM,MAAM,KAAK,IAAf,EAAqB;MACjB,OAAOA,MAAP;IACH;EACJ;;EACD,MAAM,IAAIC,cAAJ,CACF,oDADE,EAEF,2BAFE,CAAN;AAIH,CAbD;;eAee,MAAM;EACjB,OAAO,IAAIC,sBAAJ,CAA8B,MAAMR,OAAN,IAAiB;IAAA;;IAClD,IAAI,kBAAAA,OAAO,CAACS,IAAR,yFAAcC,OAAd,gFAAuBC,MAAvB,MAAkC,SAAtC,EAAiD;MAC7C;IACH;;IAED,MAAM;MAAEP,IAAF;MAAQQ;IAAR,IAAmB,MAAMb,aAAa,CAACC,OAAD,CAA5C;IAEA,MAAMa,YAAY,GAAGb,OAAO,CAACc,IAAR,CAAaC,SAAb,CAAuBH,MAAvB,CAArB;;IACA,IAAI,CAACC,YAAL,EAAmB;MACf,MAAM,IAAIN,cAAJ,CAAiB,uBAAsBK,MAAO,kBAA9C,CAAN;IACH;;IAEDZ,OAAO,CAACgB,GAAR,mCACShB,OAAO,CAACgB,GAAR,IAAe,EADxB;MAEIZ,IAFJ;MAGIQ,MAHJ;MAIIG,SAAS,EAAE,MAAMF,YAJrB;MAKII,IAAI,EAAEb,IAAI,KAAK,MALnB;MAMIc,OAAO,EAAEd,IAAI,KAAK,SANtB;MAOIe,MAAM,EAAEf,IAAI,KAAK;IAPrB;EASH,CArBM,CAAP;AAsBH,C"}
@@ -1,5 +0,0 @@
1
- import { PluginCollection } from "@webiny/plugins/types";
2
- export interface CreateGraphQLHandlerOptions {
3
- debug?: boolean;
4
- }
5
- export declare const graphQLHandlerFactory: (options?: CreateGraphQLHandlerOptions) => PluginCollection;
@@ -1 +0,0 @@
1
- {"version":3,"names":["DEFAULT_HEADERS","getWebinyVersionHeaders","DEFAULT_CACHE_MAX_AGE","OPTIONS_HEADERS","respond","http","result","response","body","JSON","stringify","statusCode","headers","schemaList","Map","generateCacheKey","args","context","locale","type","lastModelChange","cms","getModelLastChange","code","toISOString","join","generateSchema","plugins","register","buildSchemaPlugins","typeDefs","resolvers","schemaPlugins","byType","GraphQLSchemaPlugin","pl","push","schema","makeExecutableSchema","getSchema","tenantId","tenancy","getCurrentTenant","id","cacheKey","has","set","key","cache","get","checkEndpointAccess","permission","security","getPermission","NotAuthorizedError","data","reason","graphQLHandlerFactory","options","debug","boolean","handler","name","handle","next","request","method","toLowerCase","ex","NotAuthorizedResponse","getLocale","parse","processRequestBody","debugPlugins"],"sources":["graphQLHandlerFactory.ts"],"sourcesContent":["import { boolean } from \"boolean\";\nimport { GraphQLSchema } from \"graphql\";\nimport { makeExecutableSchema } from \"@graphql-tools/schema\";\nimport { CmsContext } from \"~/types\";\nimport { I18NLocale } from \"@webiny/api-i18n/types\";\nimport { NotAuthorizedError, NotAuthorizedResponse } from \"@webiny/api-security\";\nimport { PluginCollection } from \"@webiny/plugins/types\";\nimport debugPlugins from \"@webiny/handler-graphql/debugPlugins\";\nimport processRequestBody from \"@webiny/handler-graphql/processRequestBody\";\nimport buildSchemaPlugins from \"./plugins/buildSchemaPlugins\";\nimport { GraphQLSchemaPlugin } from \"@webiny/handler-graphql/plugins\";\nimport { getWebinyVersionHeaders } from \"@webiny/utils\";\nimport { HttpObject } from \"@webiny/handler-http/types\";\nimport { HandlerPlugin } from \"@webiny/handler/types\";\nimport { GraphQLRequestBody } from \"@webiny/handler-graphql/types\";\n\nexport interface CreateGraphQLHandlerOptions {\n debug?: boolean;\n}\ninterface SchemaCache {\n key: string;\n schema: GraphQLSchema;\n}\ninterface Args {\n context: CmsContext;\n type: string;\n locale: I18NLocale;\n}\n\nconst DEFAULT_HEADERS: Record<string, string> = {\n \"Access-Control-Allow-Origin\": \"*\",\n \"Access-Control-Allow-Headers\": \"*\",\n \"Access-Control-Allow-Methods\": \"OPTIONS,POST\",\n \"Content-Type\": \"application/json\",\n ...getWebinyVersionHeaders()\n};\n\nconst DEFAULT_CACHE_MAX_AGE = 30758400; // 1 year\n\nconst OPTIONS_HEADERS: Record<string, string> = {\n \"Access-Control-Max-Age\": `${DEFAULT_CACHE_MAX_AGE}`,\n \"Cache-Control\": `public, max-age=${DEFAULT_CACHE_MAX_AGE}`\n};\n\nconst respond = (http: HttpObject, result: unknown) => {\n return http.response({\n body: JSON.stringify(result),\n statusCode: 200,\n headers: DEFAULT_HEADERS\n });\n};\nconst schemaList = new Map<string, SchemaCache>();\n\nconst generateCacheKey = async (args: Args): Promise<string> => {\n const { context, locale, type } = args;\n const lastModelChange = await context.cms.getModelLastChange();\n return [locale.code, type, lastModelChange.toISOString()].join(\"#\");\n};\n\nconst generateSchema = async (args: Args): Promise<GraphQLSchema> => {\n const { context } = args;\n\n context.plugins.register(await buildSchemaPlugins(context));\n /**\n * Really hard to type this to satisfy the makeExecutableSchema\n */\n // TODO @ts-refactor\n const typeDefs: any = [];\n const resolvers: any = [];\n\n // Get schema definitions from plugins\n const schemaPlugins = context.plugins.byType<GraphQLSchemaPlugin>(GraphQLSchemaPlugin.type);\n for (const pl of schemaPlugins) {\n typeDefs.push(pl.schema.typeDefs);\n resolvers.push(pl.schema.resolvers);\n }\n\n return makeExecutableSchema({\n typeDefs,\n resolvers\n });\n};\n\n// gets an existing schema or rewrites existing one or creates a completely new one\n// depending on the schemaId created from type and locale parameters\nconst getSchema = async (args: Args): Promise<GraphQLSchema> => {\n const { context, type, locale } = args;\n const tenantId = context.tenancy.getCurrentTenant().id;\n const id = `${tenantId}#${type}#${locale.code}`;\n\n const cacheKey = await generateCacheKey(args);\n if (!schemaList.has(id)) {\n const schema = await generateSchema(args);\n\n schemaList.set(id, {\n key: cacheKey,\n schema\n });\n return schema;\n }\n /**\n * Safe to cast because check was done few lines up.\n */\n const cache = schemaList.get(id) as SchemaCache;\n if (cache.key === cacheKey) {\n return cache.schema;\n }\n const schema = await generateSchema(args);\n schemaList.set(id, {\n key: cacheKey,\n schema\n });\n return schema;\n};\n\nconst checkEndpointAccess = async (context: CmsContext): Promise<void> => {\n const permission = await context.security.getPermission(`cms.endpoint.${context.cms.type}`);\n if (!permission) {\n throw new NotAuthorizedError({\n data: {\n reason: `Not allowed to access \"${context.cms.type}\" endpoint.`\n }\n });\n }\n};\n\nexport const graphQLHandlerFactory = (\n options: CreateGraphQLHandlerOptions = {}\n): PluginCollection => {\n const debug = boolean(options.debug);\n\n const handler: HandlerPlugin = {\n type: \"handler\",\n name: \"handler-graphql-content-model\",\n async handle(context: CmsContext, next) {\n const { http } = context;\n\n if (!http || !http.request) {\n return next();\n }\n\n const method = (http.request.method || \"\").toLowerCase();\n /**\n * In case of OPTIONS method we just return the headers since there is no need to go further.\n */\n if (method.toLowerCase() === \"options\") {\n return http.response({\n statusCode: 204,\n headers: {\n ...DEFAULT_HEADERS,\n ...OPTIONS_HEADERS\n }\n });\n }\n /**\n * We expect, and allow, only POST method to access our GraphQL\n */\n if (method !== \"post\") {\n return next();\n }\n\n try {\n await checkEndpointAccess(context);\n } catch (ex) {\n return respond(http, new NotAuthorizedResponse(ex));\n }\n\n const schema = await getSchema({\n context,\n locale: context.cms.getLocale(),\n type: context.cms.type\n });\n\n const body: GraphQLRequestBody | GraphQLRequestBody[] = JSON.parse(http.request.body);\n\n const result = await processRequestBody(body, schema, context);\n return respond(http, result);\n }\n };\n\n return [...(debug ? debugPlugins() : []), handler, { type: \"wcp-telemetry-tracker\" }];\n};\n"],"mappings":"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"}
@@ -1,6 +0,0 @@
1
- import { CmsParametersPlugin, CmsParametersPluginResponse } from "./plugins/CmsParametersPlugin";
2
- export interface CreateParametersPluginsParams {
3
- endpointType?: CmsParametersPluginResponse["type"];
4
- locale?: CmsParametersPluginResponse["locale"];
5
- }
6
- export declare const createParametersPlugins: (params: CreateParametersPluginsParams) => CmsParametersPlugin[];
@@ -1,78 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.createParametersPlugins = void 0;
9
-
10
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
-
12
- var _error = _interopRequireDefault(require("@webiny/error"));
13
-
14
- var _CmsParametersPlugin = require("./plugins/CmsParametersPlugin");
15
-
16
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
17
-
18
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
19
-
20
- const createRequestPlugin = () => {
21
- return new _CmsParametersPlugin.CmsParametersPlugin(async context => {
22
- /**
23
- * If any of the properties is not defined, just ignore this plugin
24
- */
25
- if (!context.http || !context.http.request || !context.http.request.path || !context.http.request.path.parameters) {
26
- return null;
27
- }
28
-
29
- const {
30
- key
31
- } = context.http.request.path.parameters;
32
-
33
- if (typeof key !== "string") {
34
- throw new _error.default("The key property in context.http.request.path.parameters is not a string.", "MALFORMED_KEY", {
35
- key
36
- });
37
- }
38
-
39
- const [type, locale] = key.split("/");
40
-
41
- if (!type) {
42
- throw new _error.default(`Missing context.http.request.path.parameters.key parameter "type".`);
43
- } else if (!locale) {
44
- throw new _error.default(`Missing context.http.request.path.parameters.key "locale".`);
45
- }
46
-
47
- return {
48
- type,
49
- locale
50
- };
51
- });
52
- };
53
-
54
- const createManualPlugin = params => {
55
- return new _CmsParametersPlugin.CmsParametersPlugin(async () => {
56
- /**
57
- * if both of parameters are not existing, just skip this plugin.
58
- */
59
- if (!params.endpointType && !params.locale) {
60
- return null;
61
- } else if (!params.endpointType) {
62
- throw new _error.default(`There is defined locale CMS parameter but no endpointType.`, "MALFORMED_ENDPOINT_TYPE", _objectSpread({}, params));
63
- } else if (!params.locale) {
64
- throw new _error.default(`There is defined endpointType CMS parameter but no locale.`, "MALFORMED_LOCALE_TYPE", _objectSpread({}, params));
65
- }
66
-
67
- return {
68
- type: params.endpointType,
69
- locale: params.locale
70
- };
71
- });
72
- };
73
-
74
- const createParametersPlugins = params => {
75
- return [createManualPlugin(params), createRequestPlugin()];
76
- };
77
-
78
- exports.createParametersPlugins = createParametersPlugins;
@@ -1 +0,0 @@
1
- {"version":3,"names":["createRequestPlugin","CmsParametersPlugin","context","http","request","path","parameters","key","WebinyError","type","locale","split","createManualPlugin","params","endpointType","createParametersPlugins"],"sources":["parameterPlugins.ts"],"sourcesContent":["import WebinyError from \"@webiny/error\";\nimport {\n CmsParametersPlugin,\n CmsParametersPluginResponse\n} from \"~/content/plugins/CmsParametersPlugin\";\n\nexport interface CreateParametersPluginsParams {\n endpointType?: CmsParametersPluginResponse[\"type\"];\n locale?: CmsParametersPluginResponse[\"locale\"];\n}\n\nconst createRequestPlugin = () => {\n return new CmsParametersPlugin(async context => {\n /**\n * If any of the properties is not defined, just ignore this plugin\n */\n if (\n !context.http ||\n !context.http.request ||\n !context.http.request.path ||\n !context.http.request.path.parameters\n ) {\n return null;\n }\n\n const { key } = context.http.request.path.parameters;\n if (typeof key !== \"string\") {\n throw new WebinyError(\n \"The key property in context.http.request.path.parameters is not a string.\",\n \"MALFORMED_KEY\",\n {\n key\n }\n );\n }\n const [type, locale] = key.split(\"/\");\n if (!type) {\n throw new WebinyError(\n `Missing context.http.request.path.parameters.key parameter \"type\".`\n );\n } else if (!locale) {\n throw new WebinyError(`Missing context.http.request.path.parameters.key \"locale\".`);\n }\n\n return {\n type,\n locale\n };\n });\n};\n\nconst createManualPlugin = (params: CreateParametersPluginsParams): CmsParametersPlugin => {\n return new CmsParametersPlugin(async () => {\n /**\n * if both of parameters are not existing, just skip this plugin.\n */\n if (!params.endpointType && !params.locale) {\n return null;\n } else if (!params.endpointType) {\n throw new WebinyError(\n `There is defined locale CMS parameter but no endpointType.`,\n \"MALFORMED_ENDPOINT_TYPE\",\n {\n ...params\n }\n );\n } else if (!params.locale) {\n throw new WebinyError(\n `There is defined endpointType CMS parameter but no locale.`,\n \"MALFORMED_LOCALE_TYPE\",\n {\n ...params\n }\n );\n }\n\n return {\n type: params.endpointType,\n locale: params.locale\n };\n });\n};\nexport const createParametersPlugins = (\n params: CreateParametersPluginsParams\n): CmsParametersPlugin[] => {\n return [createManualPlugin(params), createRequestPlugin()];\n};\n"],"mappings":";;;;;;;;;;;AAAA;;AACA;;;;;;AAUA,MAAMA,mBAAmB,GAAG,MAAM;EAC9B,OAAO,IAAIC,wCAAJ,CAAwB,MAAMC,OAAN,IAAiB;IAC5C;AACR;AACA;IACQ,IACI,CAACA,OAAO,CAACC,IAAT,IACA,CAACD,OAAO,CAACC,IAAR,CAAaC,OADd,IAEA,CAACF,OAAO,CAACC,IAAR,CAAaC,OAAb,CAAqBC,IAFtB,IAGA,CAACH,OAAO,CAACC,IAAR,CAAaC,OAAb,CAAqBC,IAArB,CAA0BC,UAJ/B,EAKE;MACE,OAAO,IAAP;IACH;;IAED,MAAM;MAAEC;IAAF,IAAUL,OAAO,CAACC,IAAR,CAAaC,OAAb,CAAqBC,IAArB,CAA0BC,UAA1C;;IACA,IAAI,OAAOC,GAAP,KAAe,QAAnB,EAA6B;MACzB,MAAM,IAAIC,cAAJ,CACF,2EADE,EAEF,eAFE,EAGF;QACID;MADJ,CAHE,CAAN;IAOH;;IACD,MAAM,CAACE,IAAD,EAAOC,MAAP,IAAiBH,GAAG,CAACI,KAAJ,CAAU,GAAV,CAAvB;;IACA,IAAI,CAACF,IAAL,EAAW;MACP,MAAM,IAAID,cAAJ,CACD,oEADC,CAAN;IAGH,CAJD,MAIO,IAAI,CAACE,MAAL,EAAa;MAChB,MAAM,IAAIF,cAAJ,CAAiB,4DAAjB,CAAN;IACH;;IAED,OAAO;MACHC,IADG;MAEHC;IAFG,CAAP;EAIH,CApCM,CAAP;AAqCH,CAtCD;;AAwCA,MAAME,kBAAkB,GAAIC,MAAD,IAAgE;EACvF,OAAO,IAAIZ,wCAAJ,CAAwB,YAAY;IACvC;AACR;AACA;IACQ,IAAI,CAACY,MAAM,CAACC,YAAR,IAAwB,CAACD,MAAM,CAACH,MAApC,EAA4C;MACxC,OAAO,IAAP;IACH,CAFD,MAEO,IAAI,CAACG,MAAM,CAACC,YAAZ,EAA0B;MAC7B,MAAM,IAAIN,cAAJ,CACD,4DADC,EAEF,yBAFE,oBAIKK,MAJL,EAAN;IAOH,CARM,MAQA,IAAI,CAACA,MAAM,CAACH,MAAZ,EAAoB;MACvB,MAAM,IAAIF,cAAJ,CACD,4DADC,EAEF,uBAFE,oBAIKK,MAJL,EAAN;IAOH;;IAED,OAAO;MACHJ,IAAI,EAAEI,MAAM,CAACC,YADV;MAEHJ,MAAM,EAAEG,MAAM,CAACH;IAFZ,CAAP;EAIH,CA5BM,CAAP;AA6BH,CA9BD;;AA+BO,MAAMK,uBAAuB,GAChCF,MADmC,IAEX;EACxB,OAAO,CAACD,kBAAkB,CAACC,MAAD,CAAnB,EAA6Bb,mBAAmB,EAAhD,CAAP;AACH,CAJM"}
@@ -1 +0,0 @@
1
- {"version":3,"names":["CmsParametersPlugin","Plugin","constructor","callable","getParameters","context"],"sources":["CmsParametersPlugin.ts"],"sourcesContent":["import { Plugin } from \"@webiny/plugins\";\nimport { CmsContext } from \"~/types\";\n\nexport interface CmsParametersPluginResponse {\n type: \"read\" | \"manage\" | \"preview\" | string;\n locale: string;\n}\n\nexport interface CmsParametersPluginCallable {\n (context: CmsContext): Promise<CmsParametersPluginResponse | null>;\n}\n\nexport class CmsParametersPlugin extends Plugin {\n public static override readonly type: string = \"cms-parameters-plugin\";\n\n private readonly callable: CmsParametersPluginCallable;\n\n public constructor(callable: CmsParametersPluginCallable) {\n super();\n\n this.callable = callable;\n }\n\n public async getParameters(context: CmsContext): Promise<CmsParametersPluginResponse | null> {\n return this.callable(context);\n }\n}\n"],"mappings":";;;;;;;;;;;AAAA;;AAYO,MAAMA,mBAAN,SAAkCC,eAAlC,CAAyC;EAKrCC,WAAW,CAACC,QAAD,EAAwC;IACtD;IADsD;IAGtD,KAAKA,QAAL,GAAgBA,QAAhB;EACH;;EAEyB,MAAbC,aAAa,CAACC,OAAD,EAAmE;IACzF,OAAO,KAAKF,QAAL,CAAcE,OAAd,CAAP;EACH;;AAb2C;;;8BAAnCL,mB,UACsC,uB"}
@@ -1,29 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.default = void 0;
9
-
10
- var _contentModels = _interopRequireDefault(require("./schema/contentModels"));
11
-
12
- var _contentEntries = _interopRequireDefault(require("./schema/contentEntries"));
13
-
14
- var _contentModelGroups = _interopRequireDefault(require("./schema/contentModelGroups"));
15
-
16
- var _baseSchema = _interopRequireDefault(require("./schema/baseSchema"));
17
-
18
- var _schemaPlugins = require("./schema/schemaPlugins");
19
-
20
- /**
21
- * This factory is called whenever we need to generate graphql-schema plugins using the current context.
22
- */
23
- var _default = async context => {
24
- return [// Base GQL types and scalars
25
- (0, _baseSchema.default)(context), (0, _contentModels.default)(context), (0, _contentEntries.default)(context), (0, _contentModelGroups.default)(context), // Dynamic schema
26
- ...(await (0, _schemaPlugins.generateSchemaPlugins)(context))].filter(Boolean);
27
- };
28
-
29
- exports.default = _default;
@@ -1 +0,0 @@
1
- {"version":3,"names":["context","baseSchema","contentModels","contentEntries","contentModelGroups","generateSchemaPlugins","filter","Boolean"],"sources":["buildSchemaPlugins.ts"],"sourcesContent":["import { GraphQLSchemaPlugin } from \"@webiny/handler-graphql/plugins/GraphQLSchemaPlugin\";\nimport { CmsContext } from \"~/types\";\nimport contentModels from \"./schema/contentModels\";\nimport contentEntries from \"./schema/contentEntries\";\nimport contentModelGroups from \"./schema/contentModelGroups\";\nimport baseSchema from \"./schema/baseSchema\";\nimport { generateSchemaPlugins } from \"./schema/schemaPlugins\";\n\n/**\n * This factory is called whenever we need to generate graphql-schema plugins using the current context.\n */\nexport default async (context: CmsContext): Promise<GraphQLSchemaPlugin<CmsContext>[]> => {\n return [\n // Base GQL types and scalars\n baseSchema(context),\n contentModels(context),\n contentEntries(context),\n contentModelGroups(context),\n // Dynamic schema\n ...(await generateSchemaPlugins(context))\n ].filter(Boolean);\n};\n"],"mappings":";;;;;;;;;AAEA;;AACA;;AACA;;AACA;;AACA;;AAEA;AACA;AACA;eACe,MAAOA,OAAP,IAA2E;EACtF,OAAO,CACH;EACA,IAAAC,mBAAA,EAAWD,OAAX,CAFG,EAGH,IAAAE,sBAAA,EAAcF,OAAd,CAHG,EAIH,IAAAG,uBAAA,EAAeH,OAAf,CAJG,EAKH,IAAAI,2BAAA,EAAmBJ,OAAnB,CALG,EAMH;EACA,IAAI,MAAM,IAAAK,oCAAA,EAAsBL,OAAtB,CAAV,CAPG,EAQLM,MARK,CAQEC,OARF,CAAP;AASH,C"}