@webiny/api-headless-cms 0.0.0-mt-3 → 0.0.0-unstable.3386f66516

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 (614) hide show
  1. package/context.d.ts +6 -0
  2. package/context.js +119 -0
  3. package/context.js.map +1 -0
  4. package/crud/contentEntry/afterDelete.d.ts +8 -0
  5. package/{content/plugins/crud → crud}/contentEntry/afterDelete.js +2 -2
  6. package/crud/contentEntry/afterDelete.js.map +1 -0
  7. package/crud/contentEntry/beforeCreate.d.ts +8 -0
  8. package/{content/plugins/crud → crud}/contentEntry/beforeCreate.js +2 -2
  9. package/crud/contentEntry/beforeCreate.js.map +1 -0
  10. package/crud/contentEntry/beforeUpdate.d.ts +8 -0
  11. package/{content/plugins/crud → crud}/contentEntry/beforeUpdate.js +2 -2
  12. package/crud/contentEntry/beforeUpdate.js.map +1 -0
  13. package/crud/contentEntry/entryDataValidation.d.ts +10 -0
  14. package/{content/plugins/crud → crud}/contentEntry/entryDataValidation.js +23 -11
  15. package/crud/contentEntry/entryDataValidation.js.map +1 -0
  16. package/{content/plugins/crud → crud}/contentEntry/markLockedFields.d.ts +3 -2
  17. package/{content/plugins/crud → crud}/contentEntry/markLockedFields.js +14 -15
  18. package/crud/contentEntry/markLockedFields.js.map +1 -0
  19. package/crud/contentEntry/referenceFieldsMapping.d.ts +13 -0
  20. package/crud/contentEntry/referenceFieldsMapping.js +292 -0
  21. package/crud/contentEntry/referenceFieldsMapping.js.map +1 -0
  22. package/crud/contentEntry/searchableFields.d.ts +9 -0
  23. package/crud/contentEntry/searchableFields.js +83 -0
  24. package/crud/contentEntry/searchableFields.js.map +1 -0
  25. package/{content/plugins/crud → crud}/contentEntry.crud.d.ts +5 -9
  26. package/crud/contentEntry.crud.js +1309 -0
  27. package/crud/contentEntry.crud.js.map +1 -0
  28. package/crud/contentModel/afterCreate.d.ts +8 -0
  29. package/crud/contentModel/afterCreate.js +18 -0
  30. package/crud/contentModel/afterCreate.js.map +1 -0
  31. package/crud/contentModel/afterCreateFrom.d.ts +8 -0
  32. package/crud/contentModel/afterCreateFrom.js +18 -0
  33. package/crud/contentModel/afterCreateFrom.js.map +1 -0
  34. package/crud/contentModel/afterDelete.d.ts +8 -0
  35. package/crud/contentModel/afterDelete.js +18 -0
  36. package/crud/contentModel/afterDelete.js.map +1 -0
  37. package/crud/contentModel/afterUpdate.d.ts +8 -0
  38. package/crud/contentModel/afterUpdate.js +18 -0
  39. package/crud/contentModel/afterUpdate.js.map +1 -0
  40. package/crud/contentModel/beforeCreate.d.ts +14 -0
  41. package/{content/plugins/crud → crud}/contentModel/beforeCreate.js +61 -13
  42. package/crud/contentModel/beforeCreate.js.map +1 -0
  43. package/crud/contentModel/beforeDelete.d.ts +10 -0
  44. package/{content/plugins/crud → crud}/contentModel/beforeDelete.js +14 -10
  45. package/crud/contentModel/beforeDelete.js.map +1 -0
  46. package/crud/contentModel/beforeUpdate.d.ts +8 -0
  47. package/crud/contentModel/beforeUpdate.js +37 -0
  48. package/crud/contentModel/beforeUpdate.js.map +1 -0
  49. package/crud/contentModel/contentModelManagerFactory.d.ts +2 -0
  50. package/{content/plugins/crud → crud}/contentModel/contentModelManagerFactory.js +0 -0
  51. package/crud/contentModel/contentModelManagerFactory.js.map +1 -0
  52. package/crud/contentModel/createFieldModels.d.ts +2 -0
  53. package/{content/plugins/crud → crud}/contentModel/createFieldModels.js +6 -2
  54. package/crud/contentModel/createFieldModels.js.map +1 -0
  55. package/crud/contentModel/createFieldStorageId.d.ts +2 -0
  56. package/crud/contentModel/createFieldStorageId.js +20 -0
  57. package/crud/contentModel/createFieldStorageId.js.map +1 -0
  58. package/crud/contentModel/fieldIdValidation.d.ts +1 -0
  59. package/crud/contentModel/fieldIdValidation.js +25 -0
  60. package/crud/contentModel/fieldIdValidation.js.map +1 -0
  61. package/crud/contentModel/idValidation.d.ts +1 -0
  62. package/{content/plugins/crud → crud}/contentModel/idValidation.js +3 -3
  63. package/crud/contentModel/idValidation.js.map +1 -0
  64. package/{content/plugins/crud → crud}/contentModel/models.d.ts +2 -1
  65. package/{content/plugins/crud → crud}/contentModel/models.js +76 -25
  66. package/crud/contentModel/models.js.map +1 -0
  67. package/crud/contentModel/systemFields.d.ts +1 -0
  68. package/crud/contentModel/systemFields.js +8 -0
  69. package/crud/contentModel/systemFields.js.map +1 -0
  70. package/crud/contentModel/validateLayout.d.ts +2 -0
  71. package/{content/plugins/crud → crud}/contentModel/validateLayout.js +1 -3
  72. package/crud/contentModel/validateLayout.js.map +1 -0
  73. package/crud/contentModel/validateModel.d.ts +8 -0
  74. package/crud/contentModel/validateModel.js +35 -0
  75. package/crud/contentModel/validateModel.js.map +1 -0
  76. package/crud/contentModel/validateModelFields.d.ts +8 -0
  77. package/crud/contentModel/validateModelFields.js +436 -0
  78. package/crud/contentModel/validateModelFields.js.map +1 -0
  79. package/crud/contentModel/validation.d.ts +477 -0
  80. package/crud/contentModel/validation.js +109 -0
  81. package/crud/contentModel/validation.js.map +1 -0
  82. package/{content/plugins/crud → crud}/contentModel.crud.d.ts +3 -3
  83. package/crud/contentModel.crud.js +642 -0
  84. package/crud/contentModel.crud.js.map +1 -0
  85. package/crud/contentModelGroup/beforeCreate.d.ts +10 -0
  86. package/{content/plugins/crud → crud}/contentModelGroup/beforeCreate.js +9 -9
  87. package/crud/contentModelGroup/beforeCreate.js.map +1 -0
  88. package/crud/contentModelGroup/beforeDelete.d.ts +10 -0
  89. package/{content/plugins/crud → crud}/contentModelGroup/beforeDelete.js +4 -4
  90. package/crud/contentModelGroup/beforeDelete.js.map +1 -0
  91. package/crud/contentModelGroup/beforeUpdate.d.ts +9 -0
  92. package/{content/plugins/crud → crud}/contentModelGroup/beforeUpdate.js +3 -3
  93. package/crud/contentModelGroup/beforeUpdate.js.map +1 -0
  94. package/crud/contentModelGroup/validation.d.ts +30 -0
  95. package/crud/contentModelGroup/validation.js +43 -0
  96. package/crud/contentModelGroup/validation.js.map +1 -0
  97. package/{content/plugins/crud → crud}/contentModelGroup.crud.d.ts +3 -3
  98. package/crud/contentModelGroup.crud.js +366 -0
  99. package/crud/contentModelGroup.crud.js.map +1 -0
  100. package/{plugins/crud → crud}/settings.crud.d.ts +3 -3
  101. package/crud/settings.crud.js +83 -0
  102. package/crud/settings.crud.js.map +1 -0
  103. package/{plugins/crud → crud}/system.crud.d.ts +6 -3
  104. package/crud/system.crud.js +221 -0
  105. package/crud/system.crud.js.map +1 -0
  106. package/fieldConverters/CmsModelDefaultFieldConverterPlugin.d.ts +7 -0
  107. package/fieldConverters/CmsModelDefaultFieldConverterPlugin.js +66 -0
  108. package/fieldConverters/CmsModelDefaultFieldConverterPlugin.js.map +1 -0
  109. package/fieldConverters/CmsModelDynamicZoneFieldConverterPlugin.d.ts +11 -0
  110. package/fieldConverters/CmsModelDynamicZoneFieldConverterPlugin.js +239 -0
  111. package/fieldConverters/CmsModelDynamicZoneFieldConverterPlugin.js.map +1 -0
  112. package/fieldConverters/CmsModelObjectFieldConverterPlugin.d.ts +11 -0
  113. package/fieldConverters/CmsModelObjectFieldConverterPlugin.js +304 -0
  114. package/fieldConverters/CmsModelObjectFieldConverterPlugin.js.map +1 -0
  115. package/fieldConverters/index.d.ts +4 -0
  116. package/fieldConverters/index.js +18 -0
  117. package/fieldConverters/index.js.map +1 -0
  118. package/graphql/buildSchemaPlugins.d.ts +11 -0
  119. package/graphql/buildSchemaPlugins.js +24 -0
  120. package/graphql/buildSchemaPlugins.js.map +1 -0
  121. package/graphql/createExecutableSchema.d.ts +7 -0
  122. package/graphql/createExecutableSchema.js +33 -0
  123. package/graphql/createExecutableSchema.js.map +1 -0
  124. package/graphql/generateSchema.d.ts +8 -0
  125. package/graphql/generateSchema.js +38 -0
  126. package/graphql/generateSchema.js.map +1 -0
  127. package/graphql/graphQLHandlerFactory.d.ts +5 -0
  128. package/graphql/graphQLHandlerFactory.js +202 -0
  129. package/graphql/graphQLHandlerFactory.js.map +1 -0
  130. package/graphql/index.d.ts +3 -0
  131. package/graphql/index.js +18 -0
  132. package/graphql/index.js.map +1 -0
  133. package/graphql/schema/baseContentSchema.d.ts +7 -0
  134. package/graphql/schema/baseContentSchema.js +78 -0
  135. package/graphql/schema/baseContentSchema.js.map +1 -0
  136. package/graphql/schema/baseSchema.d.ts +3 -0
  137. package/graphql/schema/baseSchema.js +60 -0
  138. package/graphql/schema/baseSchema.js.map +1 -0
  139. package/graphql/schema/contentEntries.d.ts +7 -0
  140. package/graphql/schema/contentEntries.js +357 -0
  141. package/graphql/schema/contentEntries.js.map +1 -0
  142. package/graphql/schema/contentModelGroups.d.ts +7 -0
  143. package/{content/plugins → graphql}/schema/contentModelGroups.js +40 -17
  144. package/graphql/schema/contentModelGroups.js.map +1 -0
  145. package/graphql/schema/contentModels.d.ts +7 -0
  146. package/{content/plugins → graphql}/schema/contentModels.js +108 -13
  147. package/graphql/schema/contentModels.js.map +1 -0
  148. package/graphql/schema/createFieldResolvers.d.ts +20 -0
  149. package/graphql/schema/createFieldResolvers.js +133 -0
  150. package/graphql/schema/createFieldResolvers.js.map +1 -0
  151. package/graphql/schema/createManageResolvers.d.ts +12 -0
  152. package/{content/plugins → graphql}/schema/createManageResolvers.js +36 -34
  153. package/graphql/schema/createManageResolvers.js.map +1 -0
  154. package/graphql/schema/createManageSDL.d.ts +12 -0
  155. package/{content/plugins → graphql}/schema/createManageSDL.js +31 -21
  156. package/graphql/schema/createManageSDL.js.map +1 -0
  157. package/graphql/schema/createPreviewResolvers.d.ts +12 -0
  158. package/graphql/schema/createPreviewResolvers.js +58 -0
  159. package/graphql/schema/createPreviewResolvers.js.map +1 -0
  160. package/graphql/schema/createReadResolvers.d.ts +12 -0
  161. package/graphql/schema/createReadResolvers.js +63 -0
  162. package/graphql/schema/createReadResolvers.js.map +1 -0
  163. package/graphql/schema/createReadSDL.d.ts +12 -0
  164. package/{content/plugins → graphql}/schema/createReadSDL.js +25 -13
  165. package/graphql/schema/createReadSDL.js.map +1 -0
  166. package/graphql/schema/resolvers/commonFieldResolvers.d.ts +6 -0
  167. package/{content/plugins → graphql}/schema/resolvers/commonFieldResolvers.js +0 -0
  168. package/graphql/schema/resolvers/commonFieldResolvers.js.map +1 -0
  169. package/graphql/schema/resolvers/manage/resolveCreate.d.ts +7 -0
  170. package/{content/plugins → graphql}/schema/resolvers/manage/resolveCreate.js +2 -4
  171. package/graphql/schema/resolvers/manage/resolveCreate.js.map +1 -0
  172. package/graphql/schema/resolvers/manage/resolveCreateFrom.d.ts +8 -0
  173. package/{content/plugins → graphql}/schema/resolvers/manage/resolveCreateFrom.js +2 -4
  174. package/graphql/schema/resolvers/manage/resolveCreateFrom.js.map +1 -0
  175. package/graphql/schema/resolvers/manage/resolveDelete.d.ts +7 -0
  176. package/{content/plugins → graphql}/schema/resolvers/manage/resolveDelete.js +10 -8
  177. package/graphql/schema/resolvers/manage/resolveDelete.js.map +1 -0
  178. package/graphql/schema/resolvers/manage/resolveGet.d.ts +7 -0
  179. package/graphql/schema/resolvers/manage/resolveGet.js +79 -0
  180. package/graphql/schema/resolvers/manage/resolveGet.js.map +1 -0
  181. package/graphql/schema/resolvers/manage/resolveGetByIds.d.ts +7 -0
  182. package/{content/plugins → graphql}/schema/resolvers/manage/resolveGetByIds.js +2 -4
  183. package/graphql/schema/resolvers/manage/resolveGetByIds.js.map +1 -0
  184. package/graphql/schema/resolvers/manage/resolveGetRevisions.d.ts +7 -0
  185. package/{content/plugins → graphql}/schema/resolvers/manage/resolveGetRevisions.js +2 -4
  186. package/graphql/schema/resolvers/manage/resolveGetRevisions.js.map +1 -0
  187. package/graphql/schema/resolvers/manage/resolveList.d.ts +4 -0
  188. package/{content/plugins/schema/resolvers/read → graphql/schema/resolvers/manage}/resolveList.js +2 -4
  189. package/graphql/schema/resolvers/manage/resolveList.js.map +1 -0
  190. package/graphql/schema/resolvers/manage/resolvePublish.d.ts +7 -0
  191. package/{content/plugins → graphql}/schema/resolvers/manage/resolvePublish.js +0 -0
  192. package/graphql/schema/resolvers/manage/resolvePublish.js.map +1 -0
  193. package/graphql/schema/resolvers/manage/resolveRepublish.d.ts +7 -0
  194. package/{content/plugins/schema/resolvers/manage/resolveGet.js → graphql/schema/resolvers/manage/resolveRepublish.js} +4 -4
  195. package/graphql/schema/resolvers/manage/resolveRepublish.js.map +1 -0
  196. package/graphql/schema/resolvers/manage/resolveUnpublish.d.ts +7 -0
  197. package/{content/plugins → graphql}/schema/resolvers/manage/resolveUnpublish.js +0 -0
  198. package/graphql/schema/resolvers/manage/resolveUnpublish.js.map +1 -0
  199. package/graphql/schema/resolvers/manage/resolveUpdate.d.ts +8 -0
  200. package/{content/plugins → graphql}/schema/resolvers/manage/resolveUpdate.js +2 -4
  201. package/graphql/schema/resolvers/manage/resolveUpdate.js.map +1 -0
  202. package/graphql/schema/resolvers/preview/resolveGet.d.ts +4 -0
  203. package/graphql/schema/resolvers/preview/resolveGet.js +34 -0
  204. package/graphql/schema/resolvers/preview/resolveGet.js.map +1 -0
  205. package/graphql/schema/resolvers/preview/resolveList.d.ts +4 -0
  206. package/{content/plugins → graphql}/schema/resolvers/preview/resolveList.js +2 -4
  207. package/graphql/schema/resolvers/preview/resolveList.js.map +1 -0
  208. package/graphql/schema/resolvers/read/resolveGet.d.ts +4 -0
  209. package/graphql/schema/resolvers/read/resolveGet.js +34 -0
  210. package/graphql/schema/resolvers/read/resolveGet.js.map +1 -0
  211. package/graphql/schema/resolvers/read/resolveList.d.ts +4 -0
  212. package/{content/plugins/schema/resolvers/manage → graphql/schema/resolvers/read}/resolveList.js +2 -4
  213. package/graphql/schema/resolvers/read/resolveList.js.map +1 -0
  214. package/graphql/schema/schemaPlugins.d.ts +8 -0
  215. package/graphql/schema/schemaPlugins.js +119 -0
  216. package/graphql/schema/schemaPlugins.js.map +1 -0
  217. package/graphql/system.d.ts +6 -0
  218. package/{plugins/graphql → graphql}/system.js +50 -6
  219. package/graphql/system.js.map +1 -0
  220. package/graphqlFields/boolean.d.ts +2 -0
  221. package/graphqlFields/boolean.js +69 -0
  222. package/graphqlFields/boolean.js.map +1 -0
  223. package/graphqlFields/datetime.d.ts +2 -0
  224. package/graphqlFields/datetime.js +95 -0
  225. package/graphqlFields/datetime.js.map +1 -0
  226. package/graphqlFields/dynamicZone/dynamicZoneField.d.ts +2 -0
  227. package/graphqlFields/dynamicZone/dynamicZoneField.js +234 -0
  228. package/graphqlFields/dynamicZone/dynamicZoneField.js.map +1 -0
  229. package/graphqlFields/dynamicZone/dynamicZoneStorage.d.ts +3 -0
  230. package/graphqlFields/dynamicZone/dynamicZoneStorage.js +79 -0
  231. package/graphqlFields/dynamicZone/dynamicZoneStorage.js.map +1 -0
  232. package/graphqlFields/dynamicZone/index.d.ts +2 -0
  233. package/graphqlFields/dynamicZone/index.js +21 -0
  234. package/graphqlFields/dynamicZone/index.js.map +1 -0
  235. package/graphqlFields/file.d.ts +2 -0
  236. package/graphqlFields/file.js +50 -0
  237. package/graphqlFields/file.js.map +1 -0
  238. package/graphqlFields/helpers.d.ts +6 -0
  239. package/graphqlFields/helpers.js +49 -0
  240. package/graphqlFields/helpers.js.map +1 -0
  241. package/graphqlFields/index.d.ts +2 -0
  242. package/graphqlFields/index.js +30 -0
  243. package/graphqlFields/index.js.map +1 -0
  244. package/graphqlFields/longText.d.ts +2 -0
  245. package/graphqlFields/longText.js +63 -0
  246. package/graphqlFields/longText.js.map +1 -0
  247. package/graphqlFields/number.d.ts +2 -0
  248. package/graphqlFields/number.js +79 -0
  249. package/graphqlFields/number.js.map +1 -0
  250. package/graphqlFields/object.d.ts +2 -0
  251. package/graphqlFields/object.js +275 -0
  252. package/graphqlFields/object.js.map +1 -0
  253. package/graphqlFields/ref.d.ts +2 -0
  254. package/graphqlFields/ref.js +261 -0
  255. package/graphqlFields/ref.js.map +1 -0
  256. package/graphqlFields/richText.d.ts +2 -0
  257. package/graphqlFields/richText.js +56 -0
  258. package/graphqlFields/richText.js.map +1 -0
  259. package/graphqlFields/text.d.ts +2 -0
  260. package/graphqlFields/text.js +73 -0
  261. package/graphqlFields/text.js.map +1 -0
  262. package/index.d.ts +10 -12
  263. package/index.js +75 -36
  264. package/index.js.map +1 -0
  265. package/modelManager/DefaultCmsModelManager.d.ts +14 -0
  266. package/{content/plugins/modelManager → modelManager}/DefaultCmsModelManager.js +12 -10
  267. package/modelManager/DefaultCmsModelManager.js.map +1 -0
  268. package/modelManager/index.d.ts +2 -0
  269. package/{content/plugins/modelManager → modelManager}/index.js +3 -3
  270. package/modelManager/index.js.map +1 -0
  271. package/package.json +38 -38
  272. package/parameters/context.d.ts +2 -0
  273. package/parameters/context.js +22 -0
  274. package/parameters/context.js.map +1 -0
  275. package/parameters/header.d.ts +2 -0
  276. package/parameters/header.js +55 -0
  277. package/parameters/header.js.map +1 -0
  278. package/parameters/index.d.ts +4 -0
  279. package/parameters/index.js +57 -0
  280. package/parameters/index.js.map +1 -0
  281. package/parameters/manual.d.ts +6 -0
  282. package/parameters/manual.js +44 -0
  283. package/parameters/manual.js.map +1 -0
  284. package/parameters/path.d.ts +2 -0
  285. package/parameters/path.js +51 -0
  286. package/parameters/path.js.map +1 -0
  287. package/plugins/CmsGraphQLSchemaPlugin.d.ts +5 -0
  288. package/plugins/CmsGraphQLSchemaPlugin.js +17 -0
  289. package/plugins/CmsGraphQLSchemaPlugin.js.map +1 -0
  290. package/plugins/CmsGraphQLSchemaSorterPlugin.d.ts +20 -0
  291. package/plugins/CmsGraphQLSchemaSorterPlugin.js +38 -0
  292. package/plugins/CmsGraphQLSchemaSorterPlugin.js.map +1 -0
  293. package/plugins/CmsGroupPlugin.d.ts +13 -0
  294. package/{content/plugins → plugins}/CmsGroupPlugin.js +9 -3
  295. package/plugins/CmsGroupPlugin.js.map +1 -0
  296. package/plugins/CmsModelFieldConverterPlugin.d.ts +14 -0
  297. package/plugins/CmsModelFieldConverterPlugin.js +17 -0
  298. package/plugins/CmsModelFieldConverterPlugin.js.map +1 -0
  299. package/plugins/CmsModelPlugin.d.ts +45 -0
  300. package/plugins/CmsModelPlugin.js +194 -0
  301. package/plugins/CmsModelPlugin.js.map +1 -0
  302. package/plugins/CmsParametersPlugin.d.ts +20 -0
  303. package/plugins/CmsParametersPlugin.js +28 -0
  304. package/plugins/CmsParametersPlugin.js.map +1 -0
  305. package/plugins/StorageTransformPlugin.d.ts +31 -0
  306. package/{content/plugins/storage → plugins}/StorageTransformPlugin.js +2 -1
  307. package/plugins/StorageTransformPlugin.js.map +1 -0
  308. package/plugins/index.d.ts +7 -0
  309. package/plugins/index.js +96 -0
  310. package/plugins/index.js.map +1 -0
  311. package/storage/default.d.ts +2 -0
  312. package/storage/default.js +27 -0
  313. package/storage/default.js.map +1 -0
  314. package/storage/object.d.ts +2 -0
  315. package/storage/object.js +127 -0
  316. package/storage/object.js.map +1 -0
  317. package/types.d.ts +878 -387
  318. package/types.js +130 -8
  319. package/types.js.map +1 -0
  320. package/upgrades/5.33.0/index.d.ts +3 -0
  321. package/upgrades/5.33.0/index.js +182 -0
  322. package/upgrades/5.33.0/index.js.map +1 -0
  323. package/upgrades/index.d.ts +1 -0
  324. package/upgrades/index.js +12 -0
  325. package/upgrades/index.js.map +1 -0
  326. package/utils/access.d.ts +8 -0
  327. package/utils/access.js +90 -0
  328. package/utils/access.js.map +1 -0
  329. package/utils/converters/Converter.d.ts +27 -0
  330. package/utils/converters/Converter.js +71 -0
  331. package/utils/converters/Converter.js.map +1 -0
  332. package/utils/converters/ConverterCollection.d.ts +31 -0
  333. package/utils/converters/ConverterCollection.js +143 -0
  334. package/utils/converters/ConverterCollection.js.map +1 -0
  335. package/utils/converters/valueKeyStorageConverter.d.ts +18 -0
  336. package/utils/converters/valueKeyStorageConverter.js +148 -0
  337. package/utils/converters/valueKeyStorageConverter.js.map +1 -0
  338. package/utils/createTypeFromFields.d.ts +15 -0
  339. package/utils/createTypeFromFields.js +75 -0
  340. package/utils/createTypeFromFields.js.map +1 -0
  341. package/{content/plugins/utils → utils}/createTypeName.d.ts +3 -3
  342. package/{content/plugins/utils → utils}/createTypeName.js +4 -2
  343. package/utils/createTypeName.js.map +1 -0
  344. package/{content/plugins/utils → utils}/entryStorage.d.ts +3 -3
  345. package/{content/plugins/utils → utils}/entryStorage.js +18 -23
  346. package/utils/entryStorage.js.map +1 -0
  347. package/utils/filterAsync.d.ts +1 -0
  348. package/utils/filterAsync.js +23 -0
  349. package/utils/filterAsync.js.map +1 -0
  350. package/utils/getBaseFieldType.d.ts +4 -0
  351. package/utils/getBaseFieldType.js +12 -0
  352. package/utils/getBaseFieldType.js.map +1 -0
  353. package/utils/getEntryTitle.d.ts +2 -0
  354. package/{content/plugins/utils → utils}/getEntryTitle.js +7 -6
  355. package/utils/getEntryTitle.js.map +1 -0
  356. package/utils/getSchemaFromFieldPlugins.d.ts +9 -0
  357. package/utils/getSchemaFromFieldPlugins.js +48 -0
  358. package/utils/getSchemaFromFieldPlugins.js.map +1 -0
  359. package/utils/ownership.d.ts +8 -0
  360. package/utils/ownership.js +41 -0
  361. package/utils/ownership.js.map +1 -0
  362. package/utils/permissions.d.ts +7 -0
  363. package/utils/permissions.js +106 -0
  364. package/utils/permissions.js.map +1 -0
  365. package/utils/pluralizedTypeName.d.ts +1 -0
  366. package/{content/plugins/utils → utils}/pluralizedTypeName.js +1 -1
  367. package/utils/pluralizedTypeName.js.map +1 -0
  368. package/utils/renderFields.d.ts +15 -0
  369. package/{content/plugins/utils → utils}/renderFields.js +7 -3
  370. package/utils/renderFields.js.map +1 -0
  371. package/utils/renderGetFilterFields.d.ts +10 -0
  372. package/utils/renderGetFilterFields.js +61 -0
  373. package/utils/renderGetFilterFields.js.map +1 -0
  374. package/utils/renderInputFields.d.ts +14 -0
  375. package/{content/plugins/utils → utils}/renderInputFields.js +4 -2
  376. package/utils/renderInputFields.js.map +1 -0
  377. package/utils/renderListFilterFields.d.ts +11 -0
  378. package/{content/plugins/utils → utils}/renderListFilterFields.js +40 -17
  379. package/utils/renderListFilterFields.js.map +1 -0
  380. package/utils/renderSortEnum.d.ts +12 -0
  381. package/utils/renderSortEnum.js +51 -0
  382. package/utils/renderSortEnum.js.map +1 -0
  383. package/utils/toSlug.d.ts +1 -0
  384. package/utils/toSlug.js +20 -0
  385. package/utils/toSlug.js.map +1 -0
  386. package/validators/dateGte.d.ts +2 -0
  387. package/{content/plugins/validators → validators}/dateGte.js +4 -4
  388. package/validators/dateGte.js.map +1 -0
  389. package/validators/dateLte.d.ts +2 -0
  390. package/{content/plugins/validators → validators}/dateLte.js +4 -4
  391. package/validators/dateLte.js.map +1 -0
  392. package/validators/dynamicZone.d.ts +2 -0
  393. package/validators/dynamicZone.js +24 -0
  394. package/validators/dynamicZone.js.map +1 -0
  395. package/validators/gte.d.ts +2 -0
  396. package/validators/gte.js +36 -0
  397. package/validators/gte.js.map +1 -0
  398. package/validators/in.d.ts +2 -0
  399. package/validators/in.js +36 -0
  400. package/validators/in.js.map +1 -0
  401. package/validators/index.d.ts +1 -0
  402. package/validators/index.js +38 -0
  403. package/validators/index.js.map +1 -0
  404. package/validators/lte.d.ts +2 -0
  405. package/validators/lte.js +36 -0
  406. package/validators/lte.js.map +1 -0
  407. package/validators/maxLength.d.ts +2 -0
  408. package/validators/maxLength.js +36 -0
  409. package/validators/maxLength.js.map +1 -0
  410. package/validators/minLength.d.ts +2 -0
  411. package/validators/minLength.js +36 -0
  412. package/validators/minLength.js.map +1 -0
  413. package/validators/pattern.d.ts +2 -0
  414. package/validators/pattern.js +50 -0
  415. package/validators/pattern.js.map +1 -0
  416. package/validators/patternPlugins/email.d.ts +2 -0
  417. package/validators/patternPlugins/email.js +20 -0
  418. package/validators/patternPlugins/email.js.map +1 -0
  419. package/validators/patternPlugins/index.d.ts +2 -0
  420. package/validators/patternPlugins/index.js +24 -0
  421. package/validators/patternPlugins/index.js.map +1 -0
  422. package/validators/patternPlugins/lowerCase.d.ts +2 -0
  423. package/validators/patternPlugins/lowerCase.js +20 -0
  424. package/validators/patternPlugins/lowerCase.js.map +1 -0
  425. package/validators/patternPlugins/lowerCaseSpace.d.ts +2 -0
  426. package/validators/patternPlugins/lowerCaseSpace.js +20 -0
  427. package/validators/patternPlugins/lowerCaseSpace.js.map +1 -0
  428. package/validators/patternPlugins/upperCase.d.ts +2 -0
  429. package/validators/patternPlugins/upperCase.js +20 -0
  430. package/validators/patternPlugins/upperCase.js.map +1 -0
  431. package/validators/patternPlugins/upperCaseSpace.d.ts +2 -0
  432. package/validators/patternPlugins/upperCaseSpace.js +20 -0
  433. package/validators/patternPlugins/upperCaseSpace.js.map +1 -0
  434. package/validators/patternPlugins/url.d.ts +2 -0
  435. package/validators/patternPlugins/url.js +20 -0
  436. package/validators/patternPlugins/url.js.map +1 -0
  437. package/validators/required.d.ts +2 -0
  438. package/validators/required.js +27 -0
  439. package/validators/required.js.map +1 -0
  440. package/validators/timeGte.d.ts +2 -0
  441. package/{content/plugins/validators → validators}/timeGte.js +6 -4
  442. package/validators/timeGte.js.map +1 -0
  443. package/validators/timeLte.d.ts +2 -0
  444. package/{content/plugins/validators → validators}/timeLte.js +6 -4
  445. package/validators/timeLte.js.map +1 -0
  446. package/validators/unique.d.ts +6 -0
  447. package/validators/unique.js +63 -0
  448. package/validators/unique.js.map +1 -0
  449. package/content/contextSetup.d.ts +0 -4
  450. package/content/contextSetup.js +0 -65
  451. package/content/graphQLHandlerFactory.d.ts +0 -5
  452. package/content/graphQLHandlerFactory.js +0 -173
  453. package/content/plugins/CmsGroupPlugin.d.ts +0 -11
  454. package/content/plugins/CmsModelPlugin.d.ts +0 -11
  455. package/content/plugins/CmsModelPlugin.js +0 -24
  456. package/content/plugins/buildSchemaPlugins.d.ts +0 -7
  457. package/content/plugins/buildSchemaPlugins.js +0 -29
  458. package/content/plugins/crud/contentEntry/afterDelete.d.ts +0 -7
  459. package/content/plugins/crud/contentEntry/beforeCreate.d.ts +0 -7
  460. package/content/plugins/crud/contentEntry/beforeUpdate.d.ts +0 -7
  461. package/content/plugins/crud/contentEntry/entryDataValidation.d.ts +0 -4
  462. package/content/plugins/crud/contentEntry.crud.js +0 -931
  463. package/content/plugins/crud/contentModel/afterCreate.d.ts +0 -7
  464. package/content/plugins/crud/contentModel/afterCreate.js +0 -18
  465. package/content/plugins/crud/contentModel/afterDelete.d.ts +0 -7
  466. package/content/plugins/crud/contentModel/afterDelete.js +0 -18
  467. package/content/plugins/crud/contentModel/afterUpdate.d.ts +0 -7
  468. package/content/plugins/crud/contentModel/afterUpdate.js +0 -18
  469. package/content/plugins/crud/contentModel/beforeCreate.d.ts +0 -9
  470. package/content/plugins/crud/contentModel/beforeDelete.d.ts +0 -9
  471. package/content/plugins/crud/contentModel/beforeUpdate.d.ts +0 -9
  472. package/content/plugins/crud/contentModel/beforeUpdate.js +0 -128
  473. package/content/plugins/crud/contentModel/contentModelManagerFactory.d.ts +0 -2
  474. package/content/plugins/crud/contentModel/createFieldModels.d.ts +0 -2
  475. package/content/plugins/crud/contentModel/idValidation.d.ts +0 -2
  476. package/content/plugins/crud/contentModel/validateLayout.d.ts +0 -2
  477. package/content/plugins/crud/contentModel.crud.js +0 -425
  478. package/content/plugins/crud/contentModelGroup/beforeCreate.d.ts +0 -9
  479. package/content/plugins/crud/contentModelGroup/beforeDelete.d.ts +0 -9
  480. package/content/plugins/crud/contentModelGroup/beforeUpdate.d.ts +0 -8
  481. package/content/plugins/crud/contentModelGroup.crud.js +0 -351
  482. package/content/plugins/crud/index.d.ts +0 -6
  483. package/content/plugins/crud/index.js +0 -100
  484. package/content/plugins/graphqlFields/boolean.d.ts +0 -3
  485. package/content/plugins/graphqlFields/boolean.js +0 -69
  486. package/content/plugins/graphqlFields/datetime.d.ts +0 -3
  487. package/content/plugins/graphqlFields/datetime.js +0 -83
  488. package/content/plugins/graphqlFields/file.d.ts +0 -3
  489. package/content/plugins/graphqlFields/file.js +0 -49
  490. package/content/plugins/graphqlFields/index.d.ts +0 -2
  491. package/content/plugins/graphqlFields/index.js +0 -30
  492. package/content/plugins/graphqlFields/longText.d.ts +0 -3
  493. package/content/plugins/graphqlFields/longText.js +0 -62
  494. package/content/plugins/graphqlFields/number.d.ts +0 -3
  495. package/content/plugins/graphqlFields/number.js +0 -75
  496. package/content/plugins/graphqlFields/object.d.ts +0 -3
  497. package/content/plugins/graphqlFields/object.js +0 -180
  498. package/content/plugins/graphqlFields/ref.d.ts +0 -3
  499. package/content/plugins/graphqlFields/ref.js +0 -205
  500. package/content/plugins/graphqlFields/richText.d.ts +0 -3
  501. package/content/plugins/graphqlFields/richText.js +0 -55
  502. package/content/plugins/graphqlFields/text.d.ts +0 -3
  503. package/content/plugins/graphqlFields/text.js +0 -72
  504. package/content/plugins/internalSecurity/InternalAuthenticationPlugin.d.ts +0 -8
  505. package/content/plugins/internalSecurity/InternalAuthenticationPlugin.js +0 -54
  506. package/content/plugins/internalSecurity/InternalAuthorizationPlugin.d.ts +0 -7
  507. package/content/plugins/internalSecurity/InternalAuthorizationPlugin.js +0 -35
  508. package/content/plugins/modelManager/DefaultCmsModelManager.d.ts +0 -15
  509. package/content/plugins/modelManager/index.d.ts +0 -3
  510. package/content/plugins/schema/baseSchema.d.ts +0 -4
  511. package/content/plugins/schema/baseSchema.js +0 -98
  512. package/content/plugins/schema/contentEntries.d.ts +0 -4
  513. package/content/plugins/schema/contentEntries.js +0 -166
  514. package/content/plugins/schema/contentModelGroups.d.ts +0 -4
  515. package/content/plugins/schema/contentModels.d.ts +0 -4
  516. package/content/plugins/schema/createFieldResolvers.d.ts +0 -19
  517. package/content/plugins/schema/createFieldResolvers.js +0 -92
  518. package/content/plugins/schema/createManageResolvers.d.ts +0 -11
  519. package/content/plugins/schema/createManageSDL.d.ts +0 -9
  520. package/content/plugins/schema/createPreviewResolvers.d.ts +0 -10
  521. package/content/plugins/schema/createPreviewResolvers.js +0 -55
  522. package/content/plugins/schema/createReadResolvers.d.ts +0 -10
  523. package/content/plugins/schema/createReadResolvers.js +0 -55
  524. package/content/plugins/schema/createReadSDL.d.ts +0 -9
  525. package/content/plugins/schema/resolvers/commonFieldResolvers.d.ts +0 -6
  526. package/content/plugins/schema/resolvers/manage/resolveCreate.d.ts +0 -6
  527. package/content/plugins/schema/resolvers/manage/resolveCreateFrom.d.ts +0 -7
  528. package/content/plugins/schema/resolvers/manage/resolveDelete.d.ts +0 -2
  529. package/content/plugins/schema/resolvers/manage/resolveGet.d.ts +0 -2
  530. package/content/plugins/schema/resolvers/manage/resolveGetByIds.d.ts +0 -2
  531. package/content/plugins/schema/resolvers/manage/resolveGetRevisions.d.ts +0 -2
  532. package/content/plugins/schema/resolvers/manage/resolveList.d.ts +0 -2
  533. package/content/plugins/schema/resolvers/manage/resolvePublish.d.ts +0 -2
  534. package/content/plugins/schema/resolvers/manage/resolveRequestChanges.d.ts +0 -6
  535. package/content/plugins/schema/resolvers/manage/resolveRequestChanges.js +0 -23
  536. package/content/plugins/schema/resolvers/manage/resolveRequestReview.d.ts +0 -6
  537. package/content/plugins/schema/resolvers/manage/resolveRequestReview.js +0 -23
  538. package/content/plugins/schema/resolvers/manage/resolveUnpublish.d.ts +0 -2
  539. package/content/plugins/schema/resolvers/manage/resolveUpdate.d.ts +0 -7
  540. package/content/plugins/schema/resolvers/preview/resolveGet.d.ts +0 -2
  541. package/content/plugins/schema/resolvers/preview/resolveGet.js +0 -38
  542. package/content/plugins/schema/resolvers/preview/resolveList.d.ts +0 -2
  543. package/content/plugins/schema/resolvers/read/resolveGet.d.ts +0 -2
  544. package/content/plugins/schema/resolvers/read/resolveGet.js +0 -38
  545. package/content/plugins/schema/resolvers/read/resolveList.d.ts +0 -2
  546. package/content/plugins/schema/schemaPlugins.d.ts +0 -3
  547. package/content/plugins/schema/schemaPlugins.js +0 -92
  548. package/content/plugins/storage/StorageTransformPlugin.d.ts +0 -30
  549. package/content/plugins/storage/default.d.ts +0 -3
  550. package/content/plugins/storage/default.js +0 -28
  551. package/content/plugins/storage/object.d.ts +0 -3
  552. package/content/plugins/storage/object.js +0 -119
  553. package/content/plugins/utils/getEntryTitle.d.ts +0 -2
  554. package/content/plugins/utils/getSchemaFromFieldPlugins.d.ts +0 -11
  555. package/content/plugins/utils/getSchemaFromFieldPlugins.js +0 -30
  556. package/content/plugins/utils/pluralizedTypeName.d.ts +0 -1
  557. package/content/plugins/utils/renderFields.d.ts +0 -16
  558. package/content/plugins/utils/renderGetFilterFields.d.ts +0 -9
  559. package/content/plugins/utils/renderGetFilterFields.js +0 -41
  560. package/content/plugins/utils/renderInputFields.d.ts +0 -14
  561. package/content/plugins/utils/renderListFilterFields.d.ts +0 -10
  562. package/content/plugins/utils/renderSortEnum.d.ts +0 -9
  563. package/content/plugins/utils/renderSortEnum.js +0 -32
  564. package/content/plugins/validators/dateGte.d.ts +0 -3
  565. package/content/plugins/validators/dateLte.d.ts +0 -3
  566. package/content/plugins/validators/gte.d.ts +0 -3
  567. package/content/plugins/validators/gte.js +0 -32
  568. package/content/plugins/validators/in.d.ts +0 -3
  569. package/content/plugins/validators/in.js +0 -32
  570. package/content/plugins/validators/index.d.ts +0 -2
  571. package/content/plugins/validators/index.js +0 -36
  572. package/content/plugins/validators/lte.d.ts +0 -3
  573. package/content/plugins/validators/lte.js +0 -32
  574. package/content/plugins/validators/maxLength.d.ts +0 -3
  575. package/content/plugins/validators/maxLength.js +0 -32
  576. package/content/plugins/validators/minLength.d.ts +0 -3
  577. package/content/plugins/validators/minLength.js +0 -32
  578. package/content/plugins/validators/pattern.d.ts +0 -3
  579. package/content/plugins/validators/pattern.js +0 -47
  580. package/content/plugins/validators/patternPlugins/email.d.ts +0 -3
  581. package/content/plugins/validators/patternPlugins/email.js +0 -17
  582. package/content/plugins/validators/patternPlugins/index.d.ts +0 -2
  583. package/content/plugins/validators/patternPlugins/index.js +0 -19
  584. package/content/plugins/validators/patternPlugins/lowerCase.d.ts +0 -3
  585. package/content/plugins/validators/patternPlugins/lowerCase.js +0 -17
  586. package/content/plugins/validators/patternPlugins/upperCase.d.ts +0 -3
  587. package/content/plugins/validators/patternPlugins/upperCase.js +0 -17
  588. package/content/plugins/validators/patternPlugins/url.d.ts +0 -3
  589. package/content/plugins/validators/patternPlugins/url.js +0 -17
  590. package/content/plugins/validators/required.d.ts +0 -3
  591. package/content/plugins/validators/required.js +0 -25
  592. package/content/plugins/validators/timeGte.d.ts +0 -3
  593. package/content/plugins/validators/timeLte.d.ts +0 -3
  594. package/migrateCMSPermissions.d.ts +0 -17
  595. package/migrateCMSPermissions.js +0 -193
  596. package/plugins/context.d.ts +0 -4
  597. package/plugins/context.js +0 -34
  598. package/plugins/crud/index.d.ts +0 -6
  599. package/plugins/crud/index.js +0 -100
  600. package/plugins/crud/settings.crud.js +0 -93
  601. package/plugins/crud/system.crud.js +0 -182
  602. package/plugins/graphql/system.d.ts +0 -17
  603. package/plugins/graphql.d.ts +0 -2
  604. package/plugins/graphql.js +0 -79
  605. package/plugins/upgrades/index.d.ts +0 -2
  606. package/plugins/upgrades/index.js +0 -14
  607. package/plugins/upgrades/v5.5.0/helpers.d.ts +0 -6
  608. package/plugins/upgrades/v5.5.0/helpers.js +0 -10
  609. package/plugins/upgrades/v5.5.0/index.d.ts +0 -4
  610. package/plugins/upgrades/v5.5.0/index.js +0 -129
  611. package/transformers.d.ts +0 -2
  612. package/transformers.js +0 -25
  613. package/utils.d.ts +0 -25
  614. package/utils.js +0 -251
@@ -0,0 +1,436 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.validateModelFields = void 0;
9
+
10
+ var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
11
+
12
+ var _error = _interopRequireDefault(require("@webiny/error"));
13
+
14
+ var _createManageSDL = require("../../graphql/schema/createManageSDL");
15
+
16
+ var _graphqlTag = _interopRequireDefault(require("graphql-tag"));
17
+
18
+ var _createFieldStorageId = require("./createFieldStorageId");
19
+
20
+ var _getBaseFieldType = require("../../utils/getBaseFieldType");
21
+
22
+ var _plugins = require("../../plugins");
23
+
24
+ var _buildSchemaPlugins = require("../../graphql/buildSchemaPlugins");
25
+
26
+ var _createExecutableSchema = require("../../graphql/createExecutableSchema");
27
+
28
+ var _handlerGraphql = require("@webiny/handler-graphql");
29
+
30
+ const defaultTitleFieldId = "id";
31
+ const allowedTitleFieldTypes = ["text", "number"];
32
+
33
+ const getContentModelTitleFieldId = (fields, titleFieldId) => {
34
+ /**
35
+ * If there are no fields defined, we will return the default field
36
+ */
37
+ if (fields.length === 0) {
38
+ return defaultTitleFieldId;
39
+ }
40
+ /**
41
+ * if there is no title field defined either in input data or existing content model data
42
+ * we will take first text field that has no multiple values enabled
43
+ * or if initial titleFieldId is the default one also try to find first available text field
44
+ */
45
+
46
+
47
+ if (!titleFieldId || titleFieldId === defaultTitleFieldId) {
48
+ const titleField = fields.find(field => {
49
+ return (0, _getBaseFieldType.getBaseFieldType)(field) === "text" && !field.multipleValues;
50
+ });
51
+ return (titleField === null || titleField === void 0 ? void 0 : titleField.fieldId) || defaultTitleFieldId;
52
+ }
53
+ /**
54
+ * check existing titleFieldId for existence in the model
55
+ * for correct type
56
+ * and that it is not multiple values field
57
+ */
58
+
59
+
60
+ const target = fields.find(f => f.fieldId === titleFieldId);
61
+
62
+ if (!target) {
63
+ throw new _error.default(`Field selected for the title field does not exist in the model.`, "VALIDATION_ERROR", {
64
+ fieldId: titleFieldId,
65
+ fields
66
+ });
67
+ }
68
+
69
+ if (allowedTitleFieldTypes.includes(target.type) === false) {
70
+ throw new _error.default(`Only ${allowedTitleFieldTypes.join(", ")} and id fields can be used as an entry title.`, "ENTRY_TITLE_FIELD_TYPE", {
71
+ storageId: target.storageId,
72
+ fieldId: target.fieldId,
73
+ type: target.type
74
+ });
75
+ }
76
+
77
+ if (target.multipleValues) {
78
+ throw new _error.default(`Fields that accept multiple values cannot be used as the entry title.`, "ENTRY_TITLE_FIELD_TYPE", {
79
+ storageId: target.storageId,
80
+ fieldId: target.fieldId,
81
+ type: target.type
82
+ });
83
+ }
84
+
85
+ return target.fieldId;
86
+ };
87
+
88
+ const extractInvalidField = (model, err) => {
89
+ var _err$source;
90
+
91
+ const sdl = ((_err$source = err.source) === null || _err$source === void 0 ? void 0 : _err$source.body) || "";
92
+ /**
93
+ * Find the invalid type
94
+ */
95
+
96
+ const {
97
+ line: lineNumber
98
+ } = err.locations ? err.locations[0] : {
99
+ line: 0
100
+ };
101
+ const sdlLines = sdl.split("\n");
102
+ let sdlLine;
103
+ let gqlType;
104
+
105
+ for (let i = lineNumber; i > 0; i--) {
106
+ if (sdlLine && sdlLine.includes("type ")) {
107
+ gqlType = sdlLine.match(/type\s+(.*?)\s+{/);
108
+ break;
109
+ }
110
+
111
+ sdlLine = sdlLines[i];
112
+ }
113
+
114
+ let invalidField = undefined;
115
+
116
+ if (Array.isArray(gqlType)) {
117
+ const fieldRegex = new RegExp(`([^\\s+].*?):\\s+\\[?${gqlType[1]}!?\\]?`);
118
+ const matched = sdl.match(fieldRegex);
119
+
120
+ if (matched) {
121
+ invalidField = matched[1];
122
+ }
123
+ }
124
+
125
+ let message = `See more details in the browser console.`;
126
+
127
+ if (invalidField) {
128
+ message = `Please review the definition of "${invalidField}" field.`;
129
+ }
130
+
131
+ return {
132
+ data: {
133
+ modelId: model.modelId,
134
+ sdl,
135
+ invalidField
136
+ },
137
+ code: "INVALID_MODEL_DEFINITION",
138
+ message: [`Model "${model.modelId}" was not saved!`, message].join("\n")
139
+ };
140
+ };
141
+
142
+ const createValidateChildFields = plugins => {
143
+ return ({
144
+ fields,
145
+ originalFields
146
+ }) => {
147
+ if (fields.length === 0 && originalFields.length === 0) {
148
+ return;
149
+ }
150
+
151
+ validateFields({
152
+ fields,
153
+ originalFields,
154
+ plugins,
155
+ lockedFields: []
156
+ });
157
+ };
158
+ };
159
+
160
+ const validateFields = params => {
161
+ const {
162
+ plugins,
163
+ fields,
164
+ originalFields,
165
+ lockedFields
166
+ } = params;
167
+ const idList = [];
168
+ const fieldIdList = [];
169
+ const storageIdList = [];
170
+
171
+ for (const field of fields) {
172
+ const baseType = (0, _getBaseFieldType.getBaseFieldType)(field);
173
+ const plugin = plugins.find(plugin => plugin.fieldType === baseType);
174
+
175
+ if (!plugin) {
176
+ throw new Error(`Cannot update content model because of the unknown "${baseType}" field.`);
177
+ }
178
+ /**
179
+ * Check the field's id against existing ones.
180
+ * There cannot be two fields with the same id.
181
+ */
182
+
183
+
184
+ if (idList.includes(field.id)) {
185
+ throw new _error.default(`Cannot update content model because field "${field.storageId || field.fieldId}" has id "${field.id}", which is already used.`);
186
+ }
187
+
188
+ idList.push(field.id);
189
+ const originalField = originalFields.find(f => f.id === field.id);
190
+ /**
191
+ * Field MUST have an fieldId defined.
192
+ */
193
+
194
+ if (!field.fieldId) {
195
+ throw new _error.default(`Field does not have an "fieldId" defined.`, "MISSING_FIELD_ID", {
196
+ field
197
+ });
198
+ }
199
+ /**
200
+ * If storageId does not match a certain pattern, add that pattern, but only if field is not locked (used) already.
201
+ * This is to avoid errors in the already installed systems.
202
+ *
203
+ * Why are we using the @?
204
+ *
205
+ * It is not part of special characters for the query syntax in the Lucene.
206
+ *
207
+ * Relevant links:
208
+ * https://lucene.apache.org/core/3_4_0/queryparsersyntax.html
209
+ * https://discuss.elastic.co/t/special-characters-in-field-names/10658/3
210
+ * https://discuss.elastic.co/t/illegal-characters-in-elasticsearch-field-names/17196/2
211
+ */
212
+
213
+
214
+ const isLocked = lockedFields.some(lockedField => {
215
+ return lockedField.fieldId === field.storageId || lockedField.fieldId === field.fieldId;
216
+ });
217
+
218
+ if (!field.storageId) {
219
+ /**
220
+ * In case field is locked, we must set the storageId to the fieldId value.
221
+ * This should not happen, because we upgrade all the fields in 5.33.0, but let's have a check just in case of some upgrade miss.
222
+ */
223
+ //
224
+ if (isLocked) {
225
+ field.storageId = field.fieldId;
226
+ }
227
+ /**
228
+ * When having original field, just set the storageId to value from the originalField
229
+ */
230
+ //
231
+ else if (originalField) {
232
+ field.storageId = originalField.storageId;
233
+ }
234
+ /**
235
+ * The last case is when no original field and not locked - so this is a completely new field.
236
+ */
237
+ //
238
+ else {
239
+ field.storageId = (0, _createFieldStorageId.createFieldStorageId)(field);
240
+ }
241
+ }
242
+ /**
243
+ * Check the field's fieldId against existing ones.
244
+ * There cannot be two fields with the same fieldId - outside world identifier.
245
+ */
246
+
247
+
248
+ if (fieldIdList.includes(field.fieldId)) {
249
+ throw new _error.default(`Cannot update content model because field "${field.storageId}" has fieldId "${field.fieldId}", which is already used.`);
250
+ }
251
+
252
+ fieldIdList.push(field.fieldId);
253
+ /**
254
+ * Check the field's storageId against the existing ones.
255
+ * There cannot be two fields with the same storageId.
256
+ */
257
+
258
+ if (storageIdList.includes(field.storageId)) {
259
+ throw new _error.default(`Cannot update content model because field "${field.label}" has storageId "${field.storageId}", which is already used.`);
260
+ }
261
+
262
+ storageIdList.push(field.storageId);
263
+ /**
264
+ * There might be some plugins which allow child fields.
265
+ * We use this method to validate them as well.
266
+ */
267
+
268
+ if (!plugin.validateChildFields) {
269
+ continue;
270
+ }
271
+
272
+ const validateChildFields = createValidateChildFields(plugins);
273
+ plugin.validateChildFields({
274
+ field,
275
+ originalField,
276
+ validate: validateChildFields
277
+ });
278
+ }
279
+ };
280
+
281
+ const createGraphQLSchema = async params => {
282
+ const {
283
+ context,
284
+ model
285
+ } = params;
286
+ const modelPlugins = await (0, _buildSchemaPlugins.buildSchemaPlugins)({
287
+ context,
288
+ models: [model]
289
+ });
290
+ const plugins = context.plugins.byType(_handlerGraphql.GraphQLSchemaPlugin.type);
291
+ plugins.push(...modelPlugins);
292
+ return (0, _createExecutableSchema.createExecutableSchema)({
293
+ plugins
294
+ });
295
+ };
296
+
297
+ const extractErrorObject = error => {
298
+ return ["message", "code", "data", "stack"].reduce((output, key) => {
299
+ if (!error[key]) {
300
+ return output;
301
+ }
302
+
303
+ output[key] = error[key];
304
+ return output;
305
+ }, {});
306
+ };
307
+
308
+ const validateModelFields = async params => {
309
+ const {
310
+ model,
311
+ original,
312
+ context
313
+ } = params;
314
+ const {
315
+ titleFieldId
316
+ } = model;
317
+ const {
318
+ plugins
319
+ } = context;
320
+ /**
321
+ * There should be fields/locked fields in either model or data to be updated.
322
+ */
323
+
324
+ const {
325
+ fields = [],
326
+ lockedFields = []
327
+ } = model;
328
+ /**
329
+ * Let's inspect the fields of the received content model. We prevent saving of a content model if it
330
+ * contains a field for which a "cms-model-field-to-graphql" plugin does not exist on the backend.
331
+ */
332
+
333
+ const fieldTypePlugins = plugins.byType("cms-model-field-to-graphql");
334
+ validateFields({
335
+ fields,
336
+ originalFields: (original === null || original === void 0 ? void 0 : original.fields) || [],
337
+ lockedFields,
338
+ plugins: fieldTypePlugins
339
+ });
340
+
341
+ if (fields.length) {
342
+ const sorterPlugins = plugins.byType(_plugins.CmsGraphQLSchemaSorterPlugin.type);
343
+ /**
344
+ * Make sure that this model can be safely converted to a GraphQL SDL
345
+ */
346
+
347
+ const schema = (0, _createManageSDL.createManageSDL)({
348
+ model,
349
+ fieldTypePlugins: fieldTypePlugins.reduce((acc, pl) => (0, _objectSpread2.default)((0, _objectSpread2.default)({}, acc), {}, {
350
+ [pl.fieldType]: pl
351
+ }), {}),
352
+ sorterPlugins
353
+ });
354
+
355
+ try {
356
+ (0, _graphqlTag.default)(schema);
357
+ } catch (err) {
358
+ throw new _error.default(extractInvalidField(model, err));
359
+ }
360
+ /**
361
+ *
362
+ */
363
+
364
+
365
+ try {
366
+ await createGraphQLSchema({
367
+ context,
368
+ model
369
+ });
370
+ } catch (err) {
371
+ throw new _error.default({
372
+ message: "Cannot generate GraphQL schema when testing with the given model. Please check the response for more details.",
373
+ code: "GRAPHQL_SCHEMA_ERROR",
374
+ data: {
375
+ modelId: model.modelId,
376
+ error: extractErrorObject(err)
377
+ }
378
+ });
379
+ }
380
+ }
381
+
382
+ model.titleFieldId = getContentModelTitleFieldId(fields, titleFieldId);
383
+ const cmsLockedFieldPlugins = plugins.byType("cms-model-locked-field");
384
+ /**
385
+ * We must not allow removal or changes in fields that are already in use in content entries.
386
+ * Locked fields still have fieldId (should be storageId) because of the old existing locked fields in the models.
387
+ */
388
+
389
+ for (const lockedField of lockedFields) {
390
+ const existingField = fields.find(item => item.storageId === lockedField.fieldId);
391
+ /**
392
+ * Starting with 5.33.0 fields can be deleted.
393
+ * Our UI gives a warning upon locked field deletion, but if user is managing fields through API directly - we cannot do anything.
394
+ */
395
+
396
+ if (!existingField) {
397
+ continue;
398
+ }
399
+
400
+ if (lockedField.multipleValues !== existingField.multipleValues) {
401
+ throw new _error.default(`Cannot change "multipleValues" for the "${lockedField.fieldId}" field because it's already in use in created content.`, "ENTRY_FIELD_USED", {
402
+ reason: `"multipleValues" changed`,
403
+ field: existingField
404
+ });
405
+ }
406
+
407
+ const fieldType = (0, _getBaseFieldType.getBaseFieldType)(existingField);
408
+
409
+ if (lockedField.type !== fieldType) {
410
+ throw new _error.default(`Cannot change field type for the "${lockedField.fieldId}" field because it's already in use in created content.`, "ENTRY_FIELD_USED", {
411
+ reason: `"type" changed`,
412
+ lockedFieldType: lockedField.type,
413
+ existingFieldType: fieldType
414
+ });
415
+ }
416
+ /**
417
+ * Check `lockedField` invariant for specific field
418
+ */
419
+
420
+
421
+ const lockedFieldsByType = cmsLockedFieldPlugins.filter(pl => pl.fieldType === (0, _getBaseFieldType.getBaseFieldType)(lockedField));
422
+
423
+ for (const plugin of lockedFieldsByType) {
424
+ if (typeof plugin.checkLockedField !== "function") {
425
+ continue;
426
+ }
427
+
428
+ plugin.checkLockedField({
429
+ lockedField,
430
+ field: existingField
431
+ });
432
+ }
433
+ }
434
+ };
435
+
436
+ exports.validateModelFields = validateModelFields;
@@ -0,0 +1 @@
1
+ {"version":3,"names":["defaultTitleFieldId","allowedTitleFieldTypes","getContentModelTitleFieldId","fields","titleFieldId","length","titleField","find","field","getBaseFieldType","multipleValues","fieldId","target","f","WebinyError","includes","type","join","storageId","extractInvalidField","model","err","sdl","source","body","line","lineNumber","locations","sdlLines","split","sdlLine","gqlType","i","match","invalidField","undefined","Array","isArray","fieldRegex","RegExp","matched","message","data","modelId","code","createValidateChildFields","plugins","originalFields","validateFields","lockedFields","params","idList","fieldIdList","storageIdList","baseType","plugin","fieldType","Error","id","push","originalField","isLocked","some","lockedField","createFieldStorageId","label","validateChildFields","validate","createGraphQLSchema","context","modelPlugins","buildSchemaPlugins","models","byType","GraphQLSchemaPlugin","createExecutableSchema","extractErrorObject","error","reduce","output","key","validateModelFields","original","fieldTypePlugins","sorterPlugins","CmsGraphQLSchemaSorterPlugin","schema","createManageSDL","acc","pl","gql","cmsLockedFieldPlugins","existingField","item","reason","lockedFieldType","existingFieldType","lockedFieldsByType","filter","checkLockedField"],"sources":["validateModelFields.ts"],"sourcesContent":["import {\n CmsContext,\n CmsModel,\n CmsModelField,\n CmsModelFieldToGraphQLPlugin,\n CmsModelFieldToGraphQLPluginValidateChildFieldsValidate,\n CmsModelLockedFieldPlugin,\n LockedField\n} from \"~/types\";\nimport WebinyError from \"@webiny/error\";\nimport { createManageSDL } from \"~/graphql/schema/createManageSDL\";\nimport gql from \"graphql-tag\";\nimport { createFieldStorageId } from \"./createFieldStorageId\";\nimport { GraphQLError } from \"graphql\";\nimport { getBaseFieldType } from \"~/utils/getBaseFieldType\";\nimport { CmsGraphQLSchemaSorterPlugin } from \"~/plugins\";\nimport { buildSchemaPlugins } from \"~/graphql/buildSchemaPlugins\";\nimport { createExecutableSchema } from \"~/graphql/createExecutableSchema\";\nimport { GraphQLSchemaPlugin } from \"@webiny/handler-graphql\";\n\nconst defaultTitleFieldId = \"id\";\n\nconst allowedTitleFieldTypes = [\"text\", \"number\"];\n\nconst getContentModelTitleFieldId = (fields: CmsModelField[], titleFieldId?: string): string => {\n /**\n * If there are no fields defined, we will return the default field\n */\n if (fields.length === 0) {\n return defaultTitleFieldId;\n }\n /**\n * if there is no title field defined either in input data or existing content model data\n * we will take first text field that has no multiple values enabled\n * or if initial titleFieldId is the default one also try to find first available text field\n */\n if (!titleFieldId || titleFieldId === defaultTitleFieldId) {\n const titleField = fields.find(field => {\n return getBaseFieldType(field) === \"text\" && !field.multipleValues;\n });\n return titleField?.fieldId || defaultTitleFieldId;\n }\n /**\n * check existing titleFieldId for existence in the model\n * for correct type\n * and that it is not multiple values field\n */\n const target = fields.find(f => f.fieldId === titleFieldId);\n if (!target) {\n throw new WebinyError(\n `Field selected for the title field does not exist in the model.`,\n \"VALIDATION_ERROR\",\n {\n fieldId: titleFieldId,\n fields\n }\n );\n }\n\n if (allowedTitleFieldTypes.includes(target.type) === false) {\n throw new WebinyError(\n `Only ${allowedTitleFieldTypes.join(\n \", \"\n )} and id fields can be used as an entry title.`,\n \"ENTRY_TITLE_FIELD_TYPE\",\n {\n storageId: target.storageId,\n fieldId: target.fieldId,\n type: target.type\n }\n );\n }\n\n if (target.multipleValues) {\n throw new WebinyError(\n `Fields that accept multiple values cannot be used as the entry title.`,\n \"ENTRY_TITLE_FIELD_TYPE\",\n {\n storageId: target.storageId,\n fieldId: target.fieldId,\n type: target.type\n }\n );\n }\n\n return target.fieldId;\n};\n\nconst extractInvalidField = (model: CmsModel, err: GraphQLError) => {\n const sdl = err.source?.body || \"\";\n\n /**\n * Find the invalid type\n */\n const { line: lineNumber } = err.locations\n ? err.locations[0]\n : {\n line: 0\n };\n const sdlLines = sdl.split(\"\\n\");\n let sdlLine;\n let gqlType;\n for (let i = lineNumber; i > 0; i--) {\n if (sdlLine && sdlLine.includes(\"type \")) {\n gqlType = sdlLine.match(/type\\s+(.*?)\\s+{/);\n break;\n }\n\n sdlLine = sdlLines[i];\n }\n\n let invalidField: string | undefined = undefined;\n if (Array.isArray(gqlType)) {\n const fieldRegex = new RegExp(`([^\\\\s+].*?):\\\\s+\\\\[?${gqlType[1]}!?\\\\]?`);\n\n const matched = sdl.match(fieldRegex);\n if (matched) {\n invalidField = matched[1];\n }\n }\n\n let message = `See more details in the browser console.`;\n if (invalidField) {\n message = `Please review the definition of \"${invalidField}\" field.`;\n }\n\n return {\n data: {\n modelId: model.modelId,\n sdl,\n invalidField\n },\n code: \"INVALID_MODEL_DEFINITION\",\n message: [`Model \"${model.modelId}\" was not saved!`, message].join(\"\\n\")\n };\n};\n\nconst createValidateChildFields = (\n plugins: CmsModelFieldToGraphQLPlugin[]\n): CmsModelFieldToGraphQLPluginValidateChildFieldsValidate => {\n return ({ fields, originalFields }) => {\n if (fields.length === 0 && originalFields.length === 0) {\n return;\n }\n validateFields({\n fields,\n originalFields,\n plugins,\n lockedFields: []\n });\n };\n};\n\ninterface ValidateFieldsParams {\n plugins: CmsModelFieldToGraphQLPlugin[];\n fields: CmsModelField[];\n originalFields: CmsModelField[];\n lockedFields: LockedField[];\n}\nconst validateFields = (params: ValidateFieldsParams) => {\n const { plugins, fields, originalFields, lockedFields } = params;\n\n const idList: string[] = [];\n const fieldIdList: string[] = [];\n const storageIdList: string[] = [];\n\n for (const field of fields) {\n const baseType = getBaseFieldType(field);\n const plugin = plugins.find(plugin => plugin.fieldType === baseType);\n\n if (!plugin) {\n throw new Error(\n `Cannot update content model because of the unknown \"${baseType}\" field.`\n );\n }\n /**\n * Check the field's id against existing ones.\n * There cannot be two fields with the same id.\n */\n if (idList.includes(field.id)) {\n throw new WebinyError(\n `Cannot update content model because field \"${\n field.storageId || field.fieldId\n }\" has id \"${field.id}\", which is already used.`\n );\n }\n idList.push(field.id);\n\n const originalField = originalFields.find(f => f.id === field.id);\n /**\n * Field MUST have an fieldId defined.\n */\n if (!field.fieldId) {\n throw new WebinyError(`Field does not have an \"fieldId\" defined.`, \"MISSING_FIELD_ID\", {\n field\n });\n }\n /**\n * If storageId does not match a certain pattern, add that pattern, but only if field is not locked (used) already.\n * This is to avoid errors in the already installed systems.\n *\n * Why are we using the @?\n *\n * It is not part of special characters for the query syntax in the Lucene.\n *\n * Relevant links:\n * https://lucene.apache.org/core/3_4_0/queryparsersyntax.html\n * https://discuss.elastic.co/t/special-characters-in-field-names/10658/3\n * https://discuss.elastic.co/t/illegal-characters-in-elasticsearch-field-names/17196/2\n */\n const isLocked = lockedFields.some(lockedField => {\n return lockedField.fieldId === field.storageId || lockedField.fieldId === field.fieldId;\n });\n if (!field.storageId) {\n /**\n * In case field is locked, we must set the storageId to the fieldId value.\n * This should not happen, because we upgrade all the fields in 5.33.0, but let's have a check just in case of some upgrade miss.\n */\n //\n if (isLocked) {\n field.storageId = field.fieldId;\n }\n /**\n * When having original field, just set the storageId to value from the originalField\n */\n //\n else if (originalField) {\n field.storageId = originalField.storageId;\n }\n /**\n * The last case is when no original field and not locked - so this is a completely new field.\n */\n //\n else {\n field.storageId = createFieldStorageId(field);\n }\n }\n /**\n * Check the field's fieldId against existing ones.\n * There cannot be two fields with the same fieldId - outside world identifier.\n */\n if (fieldIdList.includes(field.fieldId)) {\n throw new WebinyError(\n `Cannot update content model because field \"${field.storageId}\" has fieldId \"${field.fieldId}\", which is already used.`\n );\n }\n fieldIdList.push(field.fieldId);\n /**\n * Check the field's storageId against the existing ones.\n * There cannot be two fields with the same storageId.\n */\n if (storageIdList.includes(field.storageId)) {\n throw new WebinyError(\n `Cannot update content model because field \"${field.label}\" has storageId \"${field.storageId}\", which is already used.`\n );\n }\n storageIdList.push(field.storageId);\n /**\n * There might be some plugins which allow child fields.\n * We use this method to validate them as well.\n */\n if (!plugin.validateChildFields) {\n continue;\n }\n const validateChildFields = createValidateChildFields(plugins);\n plugin.validateChildFields({\n field,\n originalField,\n validate: validateChildFields\n });\n }\n};\ninterface CreateGraphQLSchemaParams {\n context: CmsContext;\n model: CmsModel;\n}\nconst createGraphQLSchema = async (params: CreateGraphQLSchemaParams): Promise<any> => {\n const { context, model } = params;\n\n const modelPlugins = await buildSchemaPlugins({\n context,\n models: [model]\n });\n\n const plugins = context.plugins.byType<GraphQLSchemaPlugin<CmsContext>>(\n GraphQLSchemaPlugin.type\n );\n plugins.push(...modelPlugins);\n\n return createExecutableSchema({\n plugins\n });\n};\n\nconst extractErrorObject = (error: any) => {\n return [\"message\", \"code\", \"data\", \"stack\"].reduce<Record<string, any>>((output, key) => {\n if (!error[key]) {\n return output;\n }\n output[key] = error[key];\n return output;\n }, {});\n};\n\ninterface ValidateModelFieldsParams {\n model: CmsModel;\n original?: CmsModel;\n context: CmsContext;\n}\nexport const validateModelFields = async (params: ValidateModelFieldsParams): Promise<void> => {\n const { model, original, context } = params;\n const { titleFieldId } = model;\n const { plugins } = context;\n\n /**\n * There should be fields/locked fields in either model or data to be updated.\n */\n const { fields = [], lockedFields = [] } = model;\n\n /**\n * Let's inspect the fields of the received content model. We prevent saving of a content model if it\n * contains a field for which a \"cms-model-field-to-graphql\" plugin does not exist on the backend.\n */\n const fieldTypePlugins = plugins.byType<CmsModelFieldToGraphQLPlugin>(\n \"cms-model-field-to-graphql\"\n );\n\n validateFields({\n fields,\n originalFields: original?.fields || [],\n lockedFields,\n plugins: fieldTypePlugins\n });\n\n if (fields.length) {\n const sorterPlugins = plugins.byType<CmsGraphQLSchemaSorterPlugin>(\n CmsGraphQLSchemaSorterPlugin.type\n );\n /**\n * Make sure that this model can be safely converted to a GraphQL SDL\n */\n const schema = createManageSDL({\n model,\n fieldTypePlugins: fieldTypePlugins.reduce(\n (acc, pl) => ({ ...acc, [pl.fieldType]: pl }),\n {}\n ),\n sorterPlugins\n });\n\n try {\n gql(schema);\n } catch (err) {\n throw new WebinyError(extractInvalidField(model, err));\n }\n /**\n *\n */\n try {\n await createGraphQLSchema({\n context,\n model\n });\n } catch (err) {\n throw new WebinyError({\n message:\n \"Cannot generate GraphQL schema when testing with the given model. Please check the response for more details.\",\n code: \"GRAPHQL_SCHEMA_ERROR\",\n data: {\n modelId: model.modelId,\n error: extractErrorObject(err)\n }\n });\n }\n }\n\n model.titleFieldId = getContentModelTitleFieldId(fields, titleFieldId);\n\n const cmsLockedFieldPlugins =\n plugins.byType<CmsModelLockedFieldPlugin>(\"cms-model-locked-field\");\n\n /**\n * We must not allow removal or changes in fields that are already in use in content entries.\n * Locked fields still have fieldId (should be storageId) because of the old existing locked fields in the models.\n */\n for (const lockedField of lockedFields) {\n const existingField = fields.find(item => item.storageId === lockedField.fieldId);\n\n /**\n * Starting with 5.33.0 fields can be deleted.\n * Our UI gives a warning upon locked field deletion, but if user is managing fields through API directly - we cannot do anything.\n */\n if (!existingField) {\n continue;\n }\n\n if (lockedField.multipleValues !== existingField.multipleValues) {\n throw new WebinyError(\n `Cannot change \"multipleValues\" for the \"${lockedField.fieldId}\" field because it's already in use in created content.`,\n \"ENTRY_FIELD_USED\",\n {\n reason: `\"multipleValues\" changed`,\n field: existingField\n }\n );\n }\n\n const fieldType = getBaseFieldType(existingField);\n if (lockedField.type !== fieldType) {\n throw new WebinyError(\n `Cannot change field type for the \"${lockedField.fieldId}\" field because it's already in use in created content.`,\n \"ENTRY_FIELD_USED\",\n {\n reason: `\"type\" changed`,\n lockedFieldType: lockedField.type,\n existingFieldType: fieldType\n }\n );\n }\n\n /**\n * Check `lockedField` invariant for specific field\n */\n const lockedFieldsByType = cmsLockedFieldPlugins.filter(\n pl => pl.fieldType === getBaseFieldType(lockedField)\n );\n for (const plugin of lockedFieldsByType) {\n if (typeof plugin.checkLockedField !== \"function\") {\n continue;\n }\n plugin.checkLockedField({\n lockedField,\n field: existingField\n });\n }\n }\n};\n"],"mappings":";;;;;;;;;;;AASA;;AACA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AAEA,MAAMA,mBAAmB,GAAG,IAA5B;AAEA,MAAMC,sBAAsB,GAAG,CAAC,MAAD,EAAS,QAAT,CAA/B;;AAEA,MAAMC,2BAA2B,GAAG,CAACC,MAAD,EAA0BC,YAA1B,KAA4D;EAC5F;AACJ;AACA;EACI,IAAID,MAAM,CAACE,MAAP,KAAkB,CAAtB,EAAyB;IACrB,OAAOL,mBAAP;EACH;EACD;AACJ;AACA;AACA;AACA;;;EACI,IAAI,CAACI,YAAD,IAAiBA,YAAY,KAAKJ,mBAAtC,EAA2D;IACvD,MAAMM,UAAU,GAAGH,MAAM,CAACI,IAAP,CAAYC,KAAK,IAAI;MACpC,OAAO,IAAAC,kCAAA,EAAiBD,KAAjB,MAA4B,MAA5B,IAAsC,CAACA,KAAK,CAACE,cAApD;IACH,CAFkB,CAAnB;I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