@contember/engine-content-api 2.2.0-alpha.18 → 2.2.0-alpha.19

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 (385) hide show
  1. package/dist/development/index.cjs +3 -0
  2. package/dist/development/index.cjs.map +1 -1
  3. package/dist/development/index.js +4 -1
  4. package/dist/development/index.js.map +1 -1
  5. package/dist/development/src/ExecutionContainer.cjs +1 -0
  6. package/dist/development/src/ExecutionContainer.cjs.map +1 -1
  7. package/dist/development/src/ExecutionContainer.js +1 -0
  8. package/dist/development/src/ExecutionContainer.js.map +1 -1
  9. package/dist/development/src/extensions/hasManyToHasOneReducer/HasManyToHasOneReducerExecutionHandler.cjs +2 -1
  10. package/dist/development/src/extensions/hasManyToHasOneReducer/HasManyToHasOneReducerExecutionHandler.cjs.map +1 -1
  11. package/dist/development/src/extensions/hasManyToHasOneReducer/HasManyToHasOneReducerExecutionHandler.js +2 -1
  12. package/dist/development/src/extensions/hasManyToHasOneReducer/HasManyToHasOneReducerExecutionHandler.js.map +1 -1
  13. package/dist/development/src/extensions/hasManyToHasOneReducer/HasManyToHasOneRelationReducerVisitor.cjs +5 -1
  14. package/dist/development/src/extensions/hasManyToHasOneReducer/HasManyToHasOneRelationReducerVisitor.cjs.map +1 -1
  15. package/dist/development/src/extensions/hasManyToHasOneReducer/HasManyToHasOneRelationReducerVisitor.js +5 -1
  16. package/dist/development/src/extensions/hasManyToHasOneReducer/HasManyToHasOneRelationReducerVisitor.js.map +1 -1
  17. package/dist/development/src/extensions/paginatedHasMany/PaginatedHasManyExecutionHandler.cjs +2 -1
  18. package/dist/development/src/extensions/paginatedHasMany/PaginatedHasManyExecutionHandler.cjs.map +1 -1
  19. package/dist/development/src/extensions/paginatedHasMany/PaginatedHasManyExecutionHandler.js +2 -1
  20. package/dist/development/src/extensions/paginatedHasMany/PaginatedHasManyExecutionHandler.js.map +1 -1
  21. package/dist/development/src/extensions/paginatedHasMany/PaginatedHasManyFieldProviderVisitor.cjs +4 -1
  22. package/dist/development/src/extensions/paginatedHasMany/PaginatedHasManyFieldProviderVisitor.cjs.map +1 -1
  23. package/dist/development/src/extensions/paginatedHasMany/PaginatedHasManyFieldProviderVisitor.js +4 -1
  24. package/dist/development/src/extensions/paginatedHasMany/PaginatedHasManyFieldProviderVisitor.js.map +1 -1
  25. package/dist/development/src/input-validation/preValidation/UpdateInputPreValidationProcessor.cjs +24 -3
  26. package/dist/development/src/input-validation/preValidation/UpdateInputPreValidationProcessor.cjs.map +1 -1
  27. package/dist/development/src/input-validation/preValidation/UpdateInputPreValidationProcessor.js +24 -3
  28. package/dist/development/src/input-validation/preValidation/UpdateInputPreValidationProcessor.js.map +1 -1
  29. package/dist/development/src/inputProcessing/UpdateInputVisitor.cjs +52 -2
  30. package/dist/development/src/inputProcessing/UpdateInputVisitor.cjs.map +1 -1
  31. package/dist/development/src/inputProcessing/UpdateInputVisitor.js +52 -2
  32. package/dist/development/src/inputProcessing/UpdateInputVisitor.js.map +1 -1
  33. package/dist/development/src/mapper/ErrorUtils.cjs +10 -0
  34. package/dist/development/src/mapper/ErrorUtils.cjs.map +1 -1
  35. package/dist/development/src/mapper/ErrorUtils.js +10 -0
  36. package/dist/development/src/mapper/ErrorUtils.js.map +1 -1
  37. package/dist/development/src/mapper/Mapper.cjs +37 -1
  38. package/dist/development/src/mapper/Mapper.cjs.map +1 -1
  39. package/dist/development/src/mapper/Mapper.js +38 -2
  40. package/dist/development/src/mapper/Mapper.js.map +1 -1
  41. package/dist/development/src/mapper/MutationProcessorHelper.cjs +12 -0
  42. package/dist/development/src/mapper/MutationProcessorHelper.cjs.map +1 -1
  43. package/dist/development/src/mapper/MutationProcessorHelper.js +13 -1
  44. package/dist/development/src/mapper/MutationProcessorHelper.js.map +1 -1
  45. package/dist/development/src/mapper/Result.cjs +1 -0
  46. package/dist/development/src/mapper/Result.cjs.map +1 -1
  47. package/dist/development/src/mapper/Result.js +1 -0
  48. package/dist/development/src/mapper/Result.js.map +1 -1
  49. package/dist/development/src/mapper/delete/DeleteExecutor.cjs +1 -1
  50. package/dist/development/src/mapper/delete/DeleteExecutor.js +1 -1
  51. package/dist/development/src/mapper/select/handlers/MetaHandler.cjs +1 -1
  52. package/dist/development/src/mapper/select/handlers/MetaHandler.js +1 -1
  53. package/dist/development/src/mapper/select/optimizer/WhereOptimizer.cjs +2 -2
  54. package/dist/development/src/mapper/select/optimizer/WhereOptimizer.cjs.map +1 -1
  55. package/dist/development/src/mapper/select/optimizer/WhereOptimizer.js +1 -1
  56. package/dist/development/src/mapper/select/optimizer/WhereOptimizer.js.map +1 -1
  57. package/dist/development/src/mapper/select/optimizer/WhereReplacer.cjs +3 -3
  58. package/dist/development/src/mapper/select/optimizer/WhereReplacer.cjs.map +1 -1
  59. package/dist/development/src/mapper/select/optimizer/WhereReplacer.js +1 -1
  60. package/dist/development/src/mapper/select/optimizer/WhereReplacer.js.map +1 -1
  61. package/dist/development/src/mapper/update/SqlUpdateInputProcessor.cjs +6 -3
  62. package/dist/development/src/mapper/update/SqlUpdateInputProcessor.cjs.map +1 -1
  63. package/dist/development/src/mapper/update/SqlUpdateInputProcessor.js +7 -4
  64. package/dist/development/src/mapper/update/SqlUpdateInputProcessor.js.map +1 -1
  65. package/dist/development/src/mapper/update/Updater.cjs +1 -1
  66. package/dist/development/src/mapper/update/Updater.js +1 -1
  67. package/dist/development/src/mapper/update/relations/ManyHasManyUpdateInputProcessor.cjs +6 -0
  68. package/dist/development/src/mapper/update/relations/ManyHasManyUpdateInputProcessor.cjs.map +1 -1
  69. package/dist/development/src/mapper/update/relations/ManyHasManyUpdateInputProcessor.js +6 -0
  70. package/dist/development/src/mapper/update/relations/ManyHasManyUpdateInputProcessor.js.map +1 -1
  71. package/dist/development/src/mapper/update/relations/OneHasManyUpdateInputProcessor.cjs +6 -0
  72. package/dist/development/src/mapper/update/relations/OneHasManyUpdateInputProcessor.cjs.map +1 -1
  73. package/dist/development/src/mapper/update/relations/OneHasManyUpdateInputProcessor.js +6 -0
  74. package/dist/development/src/mapper/update/relations/OneHasManyUpdateInputProcessor.js.map +1 -1
  75. package/dist/development/src/mapper/update/relations/SetManyRelationHelper.cjs +123 -0
  76. package/dist/development/src/mapper/update/relations/SetManyRelationHelper.cjs.map +1 -0
  77. package/dist/development/src/mapper/update/relations/SetManyRelationHelper.js +123 -0
  78. package/dist/development/src/mapper/update/relations/SetManyRelationHelper.js.map +1 -0
  79. package/dist/development/src/resolvers/MutationResolver.cjs +4 -1
  80. package/dist/development/src/resolvers/MutationResolver.cjs.map +1 -1
  81. package/dist/development/src/resolvers/MutationResolver.js +4 -1
  82. package/dist/development/src/resolvers/MutationResolver.js.map +1 -1
  83. package/dist/development/src/resolvers/ReadHelpers.cjs +2 -1
  84. package/dist/development/src/resolvers/ReadHelpers.cjs.map +1 -1
  85. package/dist/development/src/resolvers/ReadHelpers.js +2 -1
  86. package/dist/development/src/resolvers/ReadHelpers.js.map +1 -1
  87. package/dist/development/src/schema/CustomTypesProvider.cjs +35 -14
  88. package/dist/development/src/schema/CustomTypesProvider.cjs.map +1 -1
  89. package/dist/development/src/schema/CustomTypesProvider.js +36 -15
  90. package/dist/development/src/schema/CustomTypesProvider.js.map +1 -1
  91. package/dist/development/src/schema/EntityTypeProvider.cjs +8 -5
  92. package/dist/development/src/schema/EntityTypeProvider.cjs.map +1 -1
  93. package/dist/development/src/schema/EntityTypeProvider.js +8 -5
  94. package/dist/development/src/schema/EntityTypeProvider.js.map +1 -1
  95. package/dist/development/src/schema/GraphQlSchemaBuilderFactory.cjs +1 -1
  96. package/dist/development/src/schema/GraphQlSchemaBuilderFactory.js +1 -1
  97. package/dist/development/src/schema/MutationProvider.cjs +4 -0
  98. package/dist/development/src/schema/MutationProvider.cjs.map +1 -1
  99. package/dist/development/src/schema/MutationProvider.js +4 -0
  100. package/dist/development/src/schema/MutationProvider.js.map +1 -1
  101. package/dist/development/src/schema/OrderByTypeProvider.cjs +8 -2
  102. package/dist/development/src/schema/OrderByTypeProvider.cjs.map +1 -1
  103. package/dist/development/src/schema/OrderByTypeProvider.js +9 -3
  104. package/dist/development/src/schema/OrderByTypeProvider.js.map +1 -1
  105. package/dist/development/src/schema/QueryProvider.cjs +3 -0
  106. package/dist/development/src/schema/QueryProvider.cjs.map +1 -1
  107. package/dist/development/src/schema/QueryProvider.js +3 -0
  108. package/dist/development/src/schema/QueryProvider.js.map +1 -1
  109. package/dist/development/src/schema/ValidationQueriesProvider.cjs +2 -0
  110. package/dist/development/src/schema/ValidationQueriesProvider.cjs.map +1 -1
  111. package/dist/development/src/schema/ValidationQueriesProvider.js +2 -0
  112. package/dist/development/src/schema/ValidationQueriesProvider.js.map +1 -1
  113. package/dist/development/src/schema/WhereTypeProvider.cjs +17 -5
  114. package/dist/development/src/schema/WhereTypeProvider.cjs.map +1 -1
  115. package/dist/development/src/schema/WhereTypeProvider.js +18 -6
  116. package/dist/development/src/schema/WhereTypeProvider.js.map +1 -1
  117. package/dist/development/src/schema/calendarDate.cjs +21 -0
  118. package/dist/development/src/schema/calendarDate.cjs.map +1 -0
  119. package/dist/development/src/schema/calendarDate.js +21 -0
  120. package/dist/development/src/schema/calendarDate.js.map +1 -0
  121. package/dist/development/src/schema/mutations/CreateEntityInputFieldVisitor.cjs +11 -3
  122. package/dist/development/src/schema/mutations/CreateEntityInputFieldVisitor.cjs.map +1 -1
  123. package/dist/development/src/schema/mutations/CreateEntityInputFieldVisitor.js +11 -3
  124. package/dist/development/src/schema/mutations/CreateEntityInputFieldVisitor.js.map +1 -1
  125. package/dist/development/src/schema/mutations/UpdateEntityInputFieldVisitor.cjs +11 -3
  126. package/dist/development/src/schema/mutations/UpdateEntityInputFieldVisitor.cjs.map +1 -1
  127. package/dist/development/src/schema/mutations/UpdateEntityInputFieldVisitor.js +11 -3
  128. package/dist/development/src/schema/mutations/UpdateEntityInputFieldVisitor.js.map +1 -1
  129. package/dist/development/src/schema/mutations/UpdateEntityRelationInputFieldVisitor.cjs +39 -2
  130. package/dist/development/src/schema/mutations/UpdateEntityRelationInputFieldVisitor.cjs.map +1 -1
  131. package/dist/development/src/schema/mutations/UpdateEntityRelationInputFieldVisitor.js +40 -3
  132. package/dist/development/src/schema/mutations/UpdateEntityRelationInputFieldVisitor.js.map +1 -1
  133. package/dist/development/src/schema/utils.cjs +10 -0
  134. package/dist/development/src/schema/utils.cjs.map +1 -1
  135. package/dist/development/src/schema/utils.js +11 -1
  136. package/dist/development/src/schema/utils.js.map +1 -1
  137. package/dist/production/index.cjs +3 -0
  138. package/dist/production/index.cjs.map +1 -1
  139. package/dist/production/index.js +4 -1
  140. package/dist/production/index.js.map +1 -1
  141. package/dist/production/src/ExecutionContainer.cjs +1 -0
  142. package/dist/production/src/ExecutionContainer.cjs.map +1 -1
  143. package/dist/production/src/ExecutionContainer.js +1 -0
  144. package/dist/production/src/ExecutionContainer.js.map +1 -1
  145. package/dist/production/src/extensions/hasManyToHasOneReducer/HasManyToHasOneReducerExecutionHandler.cjs +2 -1
  146. package/dist/production/src/extensions/hasManyToHasOneReducer/HasManyToHasOneReducerExecutionHandler.cjs.map +1 -1
  147. package/dist/production/src/extensions/hasManyToHasOneReducer/HasManyToHasOneReducerExecutionHandler.js +2 -1
  148. package/dist/production/src/extensions/hasManyToHasOneReducer/HasManyToHasOneReducerExecutionHandler.js.map +1 -1
  149. package/dist/production/src/extensions/hasManyToHasOneReducer/HasManyToHasOneRelationReducerVisitor.cjs +5 -1
  150. package/dist/production/src/extensions/hasManyToHasOneReducer/HasManyToHasOneRelationReducerVisitor.cjs.map +1 -1
  151. package/dist/production/src/extensions/hasManyToHasOneReducer/HasManyToHasOneRelationReducerVisitor.js +5 -1
  152. package/dist/production/src/extensions/hasManyToHasOneReducer/HasManyToHasOneRelationReducerVisitor.js.map +1 -1
  153. package/dist/production/src/extensions/paginatedHasMany/PaginatedHasManyExecutionHandler.cjs +2 -1
  154. package/dist/production/src/extensions/paginatedHasMany/PaginatedHasManyExecutionHandler.cjs.map +1 -1
  155. package/dist/production/src/extensions/paginatedHasMany/PaginatedHasManyExecutionHandler.js +2 -1
  156. package/dist/production/src/extensions/paginatedHasMany/PaginatedHasManyExecutionHandler.js.map +1 -1
  157. package/dist/production/src/extensions/paginatedHasMany/PaginatedHasManyFieldProviderVisitor.cjs +4 -1
  158. package/dist/production/src/extensions/paginatedHasMany/PaginatedHasManyFieldProviderVisitor.cjs.map +1 -1
  159. package/dist/production/src/extensions/paginatedHasMany/PaginatedHasManyFieldProviderVisitor.js +4 -1
  160. package/dist/production/src/extensions/paginatedHasMany/PaginatedHasManyFieldProviderVisitor.js.map +1 -1
  161. package/dist/production/src/input-validation/preValidation/UpdateInputPreValidationProcessor.cjs +24 -3
  162. package/dist/production/src/input-validation/preValidation/UpdateInputPreValidationProcessor.cjs.map +1 -1
  163. package/dist/production/src/input-validation/preValidation/UpdateInputPreValidationProcessor.js +24 -3
  164. package/dist/production/src/input-validation/preValidation/UpdateInputPreValidationProcessor.js.map +1 -1
  165. package/dist/production/src/inputProcessing/UpdateInputVisitor.cjs +52 -2
  166. package/dist/production/src/inputProcessing/UpdateInputVisitor.cjs.map +1 -1
  167. package/dist/production/src/inputProcessing/UpdateInputVisitor.js +52 -2
  168. package/dist/production/src/inputProcessing/UpdateInputVisitor.js.map +1 -1
  169. package/dist/production/src/mapper/ErrorUtils.cjs +10 -0
  170. package/dist/production/src/mapper/ErrorUtils.cjs.map +1 -1
  171. package/dist/production/src/mapper/ErrorUtils.js +10 -0
  172. package/dist/production/src/mapper/ErrorUtils.js.map +1 -1
  173. package/dist/production/src/mapper/Mapper.cjs +37 -1
  174. package/dist/production/src/mapper/Mapper.cjs.map +1 -1
  175. package/dist/production/src/mapper/Mapper.js +38 -2
  176. package/dist/production/src/mapper/Mapper.js.map +1 -1
  177. package/dist/production/src/mapper/MutationProcessorHelper.cjs +12 -0
  178. package/dist/production/src/mapper/MutationProcessorHelper.cjs.map +1 -1
  179. package/dist/production/src/mapper/MutationProcessorHelper.js +13 -1
  180. package/dist/production/src/mapper/MutationProcessorHelper.js.map +1 -1
  181. package/dist/production/src/mapper/Result.cjs +1 -0
  182. package/dist/production/src/mapper/Result.cjs.map +1 -1
  183. package/dist/production/src/mapper/Result.js +1 -0
  184. package/dist/production/src/mapper/Result.js.map +1 -1
  185. package/dist/production/src/mapper/delete/DeleteExecutor.cjs +1 -1
  186. package/dist/production/src/mapper/delete/DeleteExecutor.js +1 -1
  187. package/dist/production/src/mapper/select/handlers/MetaHandler.cjs +1 -1
  188. package/dist/production/src/mapper/select/handlers/MetaHandler.js +1 -1
  189. package/dist/production/src/mapper/select/optimizer/WhereOptimizer.cjs +2 -2
  190. package/dist/production/src/mapper/select/optimizer/WhereOptimizer.cjs.map +1 -1
  191. package/dist/production/src/mapper/select/optimizer/WhereOptimizer.js +1 -1
  192. package/dist/production/src/mapper/select/optimizer/WhereOptimizer.js.map +1 -1
  193. package/dist/production/src/mapper/select/optimizer/WhereReplacer.cjs +3 -3
  194. package/dist/production/src/mapper/select/optimizer/WhereReplacer.cjs.map +1 -1
  195. package/dist/production/src/mapper/select/optimizer/WhereReplacer.js +1 -1
  196. package/dist/production/src/mapper/select/optimizer/WhereReplacer.js.map +1 -1
  197. package/dist/production/src/mapper/update/SqlUpdateInputProcessor.cjs +6 -3
  198. package/dist/production/src/mapper/update/SqlUpdateInputProcessor.cjs.map +1 -1
  199. package/dist/production/src/mapper/update/SqlUpdateInputProcessor.js +7 -4
  200. package/dist/production/src/mapper/update/SqlUpdateInputProcessor.js.map +1 -1
  201. package/dist/production/src/mapper/update/Updater.cjs +1 -1
  202. package/dist/production/src/mapper/update/Updater.js +1 -1
  203. package/dist/production/src/mapper/update/relations/ManyHasManyUpdateInputProcessor.cjs +6 -0
  204. package/dist/production/src/mapper/update/relations/ManyHasManyUpdateInputProcessor.cjs.map +1 -1
  205. package/dist/production/src/mapper/update/relations/ManyHasManyUpdateInputProcessor.js +6 -0
  206. package/dist/production/src/mapper/update/relations/ManyHasManyUpdateInputProcessor.js.map +1 -1
  207. package/dist/production/src/mapper/update/relations/OneHasManyUpdateInputProcessor.cjs +6 -0
  208. package/dist/production/src/mapper/update/relations/OneHasManyUpdateInputProcessor.cjs.map +1 -1
  209. package/dist/production/src/mapper/update/relations/OneHasManyUpdateInputProcessor.js +6 -0
  210. package/dist/production/src/mapper/update/relations/OneHasManyUpdateInputProcessor.js.map +1 -1
  211. package/dist/production/src/mapper/update/relations/SetManyRelationHelper.cjs +123 -0
  212. package/dist/production/src/mapper/update/relations/SetManyRelationHelper.cjs.map +1 -0
  213. package/dist/production/src/mapper/update/relations/SetManyRelationHelper.js +123 -0
  214. package/dist/production/src/mapper/update/relations/SetManyRelationHelper.js.map +1 -0
  215. package/dist/production/src/resolvers/MutationResolver.cjs +4 -1
  216. package/dist/production/src/resolvers/MutationResolver.cjs.map +1 -1
  217. package/dist/production/src/resolvers/MutationResolver.js +4 -1
  218. package/dist/production/src/resolvers/MutationResolver.js.map +1 -1
  219. package/dist/production/src/resolvers/ReadHelpers.cjs +2 -1
  220. package/dist/production/src/resolvers/ReadHelpers.cjs.map +1 -1
  221. package/dist/production/src/resolvers/ReadHelpers.js +2 -1
  222. package/dist/production/src/resolvers/ReadHelpers.js.map +1 -1
  223. package/dist/production/src/schema/CustomTypesProvider.cjs +35 -14
  224. package/dist/production/src/schema/CustomTypesProvider.cjs.map +1 -1
  225. package/dist/production/src/schema/CustomTypesProvider.js +36 -15
  226. package/dist/production/src/schema/CustomTypesProvider.js.map +1 -1
  227. package/dist/production/src/schema/EntityTypeProvider.cjs +8 -5
  228. package/dist/production/src/schema/EntityTypeProvider.cjs.map +1 -1
  229. package/dist/production/src/schema/EntityTypeProvider.js +8 -5
  230. package/dist/production/src/schema/EntityTypeProvider.js.map +1 -1
  231. package/dist/production/src/schema/GraphQlSchemaBuilderFactory.cjs +1 -1
  232. package/dist/production/src/schema/GraphQlSchemaBuilderFactory.js +1 -1
  233. package/dist/production/src/schema/MutationProvider.cjs +4 -0
  234. package/dist/production/src/schema/MutationProvider.cjs.map +1 -1
  235. package/dist/production/src/schema/MutationProvider.js +4 -0
  236. package/dist/production/src/schema/MutationProvider.js.map +1 -1
  237. package/dist/production/src/schema/OrderByTypeProvider.cjs +8 -2
  238. package/dist/production/src/schema/OrderByTypeProvider.cjs.map +1 -1
  239. package/dist/production/src/schema/OrderByTypeProvider.js +9 -3
  240. package/dist/production/src/schema/OrderByTypeProvider.js.map +1 -1
  241. package/dist/production/src/schema/QueryProvider.cjs +3 -0
  242. package/dist/production/src/schema/QueryProvider.cjs.map +1 -1
  243. package/dist/production/src/schema/QueryProvider.js +3 -0
  244. package/dist/production/src/schema/QueryProvider.js.map +1 -1
  245. package/dist/production/src/schema/ValidationQueriesProvider.cjs +2 -0
  246. package/dist/production/src/schema/ValidationQueriesProvider.cjs.map +1 -1
  247. package/dist/production/src/schema/ValidationQueriesProvider.js +2 -0
  248. package/dist/production/src/schema/ValidationQueriesProvider.js.map +1 -1
  249. package/dist/production/src/schema/WhereTypeProvider.cjs +17 -5
  250. package/dist/production/src/schema/WhereTypeProvider.cjs.map +1 -1
  251. package/dist/production/src/schema/WhereTypeProvider.js +18 -6
  252. package/dist/production/src/schema/WhereTypeProvider.js.map +1 -1
  253. package/dist/production/src/schema/calendarDate.cjs +21 -0
  254. package/dist/production/src/schema/calendarDate.cjs.map +1 -0
  255. package/dist/production/src/schema/calendarDate.js +21 -0
  256. package/dist/production/src/schema/calendarDate.js.map +1 -0
  257. package/dist/production/src/schema/mutations/CreateEntityInputFieldVisitor.cjs +11 -3
  258. package/dist/production/src/schema/mutations/CreateEntityInputFieldVisitor.cjs.map +1 -1
  259. package/dist/production/src/schema/mutations/CreateEntityInputFieldVisitor.js +11 -3
  260. package/dist/production/src/schema/mutations/CreateEntityInputFieldVisitor.js.map +1 -1
  261. package/dist/production/src/schema/mutations/UpdateEntityInputFieldVisitor.cjs +11 -3
  262. package/dist/production/src/schema/mutations/UpdateEntityInputFieldVisitor.cjs.map +1 -1
  263. package/dist/production/src/schema/mutations/UpdateEntityInputFieldVisitor.js +11 -3
  264. package/dist/production/src/schema/mutations/UpdateEntityInputFieldVisitor.js.map +1 -1
  265. package/dist/production/src/schema/mutations/UpdateEntityRelationInputFieldVisitor.cjs +39 -2
  266. package/dist/production/src/schema/mutations/UpdateEntityRelationInputFieldVisitor.cjs.map +1 -1
  267. package/dist/production/src/schema/mutations/UpdateEntityRelationInputFieldVisitor.js +40 -3
  268. package/dist/production/src/schema/mutations/UpdateEntityRelationInputFieldVisitor.js.map +1 -1
  269. package/dist/production/src/schema/utils.cjs +10 -0
  270. package/dist/production/src/schema/utils.cjs.map +1 -1
  271. package/dist/production/src/schema/utils.js +11 -1
  272. package/dist/production/src/schema/utils.js.map +1 -1
  273. package/dist/tests/cases/integration/graphQlRequests/update/manyHasManyInverse/set.test.d.ts +2 -0
  274. package/dist/tests/cases/integration/graphQlRequests/update/manyHasManyInverse/set.test.d.ts.map +1 -0
  275. package/dist/tests/cases/integration/graphQlRequests/update/manyHasManyOwning/set.test.d.ts +2 -0
  276. package/dist/tests/cases/integration/graphQlRequests/update/manyHasManyOwning/set.test.d.ts.map +1 -0
  277. package/dist/tests/cases/integration/graphQlRequests/update/oneHasMany/set.test.d.ts +2 -0
  278. package/dist/tests/cases/integration/graphQlRequests/update/oneHasMany/set.test.d.ts.map +1 -0
  279. package/dist/tests/cases/unit/checkViolationError.test.d.ts +2 -0
  280. package/dist/tests/cases/unit/checkViolationError.test.d.ts.map +1 -0
  281. package/dist/tests/cases/unit/dateType.test.d.ts +2 -0
  282. package/dist/tests/cases/unit/dateType.test.d.ts.map +1 -0
  283. package/dist/tests/tsconfig.tsbuildinfo +1 -1
  284. package/dist/types/extensions/hasManyToHasOneReducer/HasManyToHasOneRelationReducerVisitor.d.ts.map +1 -1
  285. package/dist/types/extensions/paginatedHasMany/PaginatedHasManyFieldProviderVisitor.d.ts.map +1 -1
  286. package/dist/types/input-validation/preValidation/UpdateInputPreValidationProcessor.d.ts +6 -0
  287. package/dist/types/input-validation/preValidation/UpdateInputPreValidationProcessor.d.ts.map +1 -1
  288. package/dist/types/inputProcessing/UpdateInputProcessor.d.ts +7 -0
  289. package/dist/types/inputProcessing/UpdateInputProcessor.d.ts.map +1 -1
  290. package/dist/types/inputProcessing/UpdateInputVisitor.d.ts +2 -0
  291. package/dist/types/inputProcessing/UpdateInputVisitor.d.ts.map +1 -1
  292. package/dist/types/mapper/ErrorUtils.d.ts.map +1 -1
  293. package/dist/types/mapper/Mapper.d.ts +5 -0
  294. package/dist/types/mapper/Mapper.d.ts.map +1 -1
  295. package/dist/types/mapper/MutationProcessorHelper.d.ts +3 -0
  296. package/dist/types/mapper/MutationProcessorHelper.d.ts.map +1 -1
  297. package/dist/types/mapper/Result.d.ts +2 -1
  298. package/dist/types/mapper/Result.d.ts.map +1 -1
  299. package/dist/types/mapper/types.d.ts +8 -1
  300. package/dist/types/mapper/types.d.ts.map +1 -1
  301. package/dist/types/mapper/update/SqlUpdateInputProcessor.d.ts.map +1 -1
  302. package/dist/types/mapper/update/relations/ManyHasManyUpdateInputProcessor.d.ts +5 -0
  303. package/dist/types/mapper/update/relations/ManyHasManyUpdateInputProcessor.d.ts.map +1 -1
  304. package/dist/types/mapper/update/relations/OneHasManyUpdateInputProcessor.d.ts +5 -0
  305. package/dist/types/mapper/update/relations/OneHasManyUpdateInputProcessor.d.ts.map +1 -1
  306. package/dist/types/mapper/update/relations/SetManyRelationHelper.d.ts +67 -0
  307. package/dist/types/mapper/update/relations/SetManyRelationHelper.d.ts.map +1 -0
  308. package/dist/types/resolvers/MutationResolver.d.ts.map +1 -1
  309. package/dist/types/schema/CustomTypesProvider.d.ts.map +1 -1
  310. package/dist/types/schema/EntityTypeProvider.d.ts.map +1 -1
  311. package/dist/types/schema/MutationProvider.d.ts.map +1 -1
  312. package/dist/types/schema/OrderByTypeProvider.d.ts.map +1 -1
  313. package/dist/types/schema/QueryProvider.d.ts.map +1 -1
  314. package/dist/types/schema/ValidationQueriesProvider.d.ts.map +1 -1
  315. package/dist/types/schema/WhereTypeProvider.d.ts.map +1 -1
  316. package/dist/types/schema/calendarDate.d.ts +6 -0
  317. package/dist/types/schema/calendarDate.d.ts.map +1 -0
  318. package/dist/types/schema/index.d.ts +1 -0
  319. package/dist/types/schema/index.d.ts.map +1 -1
  320. package/dist/types/schema/mutations/CreateEntityInputFieldVisitor.d.ts.map +1 -1
  321. package/dist/types/schema/mutations/UpdateEntityInputFieldVisitor.d.ts +3 -0
  322. package/dist/types/schema/mutations/UpdateEntityInputFieldVisitor.d.ts.map +1 -1
  323. package/dist/types/schema/mutations/UpdateEntityRelationInputFieldVisitor.d.ts +1 -0
  324. package/dist/types/schema/mutations/UpdateEntityRelationInputFieldVisitor.d.ts.map +1 -1
  325. package/dist/types/schema/utils.d.ts +7 -0
  326. package/dist/types/schema/utils.d.ts.map +1 -1
  327. package/dist/types/tsconfig.tsbuildinfo +1 -1
  328. package/package.json +10 -10
  329. package/src/extensions/hasManyToHasOneReducer/HasManyToHasOneRelationReducerVisitor.ts +3 -0
  330. package/src/extensions/paginatedHasMany/PaginatedHasManyFieldProviderVisitor.ts +9 -7
  331. package/src/input-validation/preValidation/UpdateInputPreValidationProcessor.ts +29 -0
  332. package/src/inputProcessing/UpdateInputProcessor.ts +6 -0
  333. package/src/inputProcessing/UpdateInputVisitor.ts +64 -2
  334. package/src/mapper/ErrorUtils.ts +11 -0
  335. package/src/mapper/Mapper.ts +61 -1
  336. package/src/mapper/MutationProcessorHelper.ts +14 -0
  337. package/src/mapper/Result.ts +1 -0
  338. package/src/mapper/select/optimizer/WhereOptimizer.ts +1 -1
  339. package/src/mapper/select/optimizer/WhereReplacer.ts +1 -1
  340. package/src/mapper/types.ts +16 -1
  341. package/src/mapper/update/SqlUpdateInputProcessor.ts +4 -1
  342. package/src/mapper/update/relations/ManyHasManyUpdateInputProcessor.ts +9 -0
  343. package/src/mapper/update/relations/OneHasManyUpdateInputProcessor.ts +9 -0
  344. package/src/mapper/update/relations/SetManyRelationHelper.ts +199 -0
  345. package/src/resolvers/MutationResolver.ts +2 -0
  346. package/src/schema/CustomTypesProvider.ts +40 -15
  347. package/src/schema/EntityTypeProvider.ts +8 -4
  348. package/src/schema/MutationProvider.ts +4 -0
  349. package/src/schema/OrderByTypeProvider.ts +9 -3
  350. package/src/schema/QueryProvider.ts +3 -0
  351. package/src/schema/ValidationQueriesProvider.ts +2 -0
  352. package/src/schema/WhereTypeProvider.ts +18 -6
  353. package/src/schema/calendarDate.ts +26 -0
  354. package/src/schema/index.ts +1 -0
  355. package/src/schema/mutations/CreateEntityInputFieldVisitor.ts +10 -2
  356. package/src/schema/mutations/UpdateEntityInputFieldVisitor.ts +10 -2
  357. package/src/schema/mutations/UpdateEntityRelationInputFieldVisitor.ts +66 -7
  358. package/src/schema/utils.ts +14 -0
  359. package/src/tsconfig.json +2 -1
  360. package/tests/cases/integration/graphQlRequests/update/manyHasManyInverse/set.test.ts +219 -0
  361. package/tests/cases/integration/graphQlRequests/update/manyHasManyOwning/set.test.ts +479 -0
  362. package/tests/cases/integration/graphQlRequests/update/oneHasMany/set.test.ts +948 -0
  363. package/tests/cases/integration/graphQlSchema/graphQlSchemaBuilder.test.ts +102 -1
  364. package/tests/cases/integration/graphQlSchema/schema-acl-allowed.gql +17 -0
  365. package/tests/cases/integration/graphQlSchema/schema-acl-create-only.gql +1 -0
  366. package/tests/cases/integration/graphQlSchema/schema-acl-restricted-create.gql +14 -0
  367. package/tests/cases/integration/graphQlSchema/schema-acl-restricted-delete.gql +11 -0
  368. package/tests/cases/integration/graphQlSchema/schema-acl-restricted-read.gql +254 -0
  369. package/tests/cases/integration/graphQlSchema/schema-acl-restricted-update.gql +1 -0
  370. package/tests/cases/integration/graphQlSchema/schema-acl.gql +1 -0
  371. package/tests/cases/integration/graphQlSchema/schema-aliased-type.gql +1 -0
  372. package/tests/cases/integration/graphQlSchema/schema-array.gql +1 -0
  373. package/tests/cases/integration/graphQlSchema/schema-basic.gql +50 -0
  374. package/tests/cases/integration/graphQlSchema/schema-bug-66.gql +17 -0
  375. package/tests/cases/integration/graphQlSchema/schema-column-types.gql +1 -0
  376. package/tests/cases/integration/graphQlSchema/schema-custom-primary.gql +50 -0
  377. package/tests/cases/integration/graphQlSchema/schema-deprecation.gql +962 -0
  378. package/tests/cases/integration/graphQlSchema/schema-description.gql +992 -0
  379. package/tests/cases/integration/graphQlSchema/schema-has-many-reduction.gql +17 -0
  380. package/tests/cases/integration/graphQlSchema/schema-mixed-root-through.gql +1 -0
  381. package/tests/cases/integration/graphQlSchema/schema-new-builder.gql +50 -0
  382. package/tests/cases/integration/graphQlSchema/schema-no-root-ops.gql +1 -0
  383. package/tests/cases/unit/checkViolationError.test.ts +49 -0
  384. package/tests/cases/unit/dateType.test.ts +46 -0
  385. package/tests/cases/unit/decimalType.test.ts +2 -2
@@ -1,4 +1,13 @@
1
- import { GraphQLBoolean, GraphQLInputFieldConfig, GraphQLInputFieldConfigMap, GraphQLInputObjectType, GraphQLNonNull, GraphQLString } from 'graphql'
1
+ import {
2
+ GraphQLBoolean,
3
+ GraphQLEnumType,
4
+ GraphQLInputFieldConfig,
5
+ GraphQLInputFieldConfigMap,
6
+ GraphQLInputObjectType,
7
+ GraphQLList,
8
+ GraphQLNonNull,
9
+ GraphQLString,
10
+ } from 'graphql'
2
11
  import { Acl, Input, Model } from '@contember/schema'
3
12
  import { GqlTypeName } from '../utils.js'
4
13
  import { WhereTypeProvider } from '../WhereTypeProvider.js'
@@ -10,6 +19,14 @@ import { Authorizator } from '../../acl/index.js'
10
19
  import { ImplementationException } from '../../exception.js'
11
20
  import { ConnectOrCreateRelationInputProvider } from './ConnectOrCreateRelationInputProvider.js'
12
21
 
22
+ const orphanRemovalStrategyEnum = new GraphQLEnumType({
23
+ name: 'OrphanRemovalStrategy',
24
+ values: {
25
+ [Input.OrphanRemovalStrategy.disconnect]: {},
26
+ [Input.OrphanRemovalStrategy.delete]: {},
27
+ },
28
+ })
29
+
13
30
  export class UpdateEntityRelationInputFieldVisitor
14
31
  implements Model.ColumnVisitor<never>, Model.RelationByGenericTypeVisitor<GraphQLInputObjectType | undefined>
15
32
  {
@@ -136,26 +153,68 @@ export class UpdateEntityRelationInputFieldVisitor
136
153
  return undefined
137
154
  }
138
155
 
156
+ // The `set` operation declaratively replaces the whole collection. Its items reuse the
157
+ // positive operations (no delete/disconnect); orphans are removed via `orphanStrategy`.
158
+ const setItemFields = this.filterAllowedOperations(entity, relation, {
159
+ [Input.UpdateRelationOperation.create]: createInput,
160
+ [Input.UpdateRelationOperation.connect]: whereInput,
161
+ [Input.UpdateRelationOperation.connectOrCreate]: connectOrCreateInput,
162
+ [Input.UpdateRelationOperation.update]: updateSpecifiedInput,
163
+ [Input.UpdateRelationOperation.upsert]: upsertInput,
164
+ })
165
+ // Orphans are computed by diffing the current members against the input, and that diff is taken
166
+ // through the target's read predicate. A role that cannot read the target sees an empty
167
+ // collection, so `set` could only ever add - it is not offered at all. This is about reading,
168
+ // not about `disconnect`: `orphanStrategy: delete` is just as unusable without it.
169
+ const canReadTarget = this.authorizator.getEntityPermission(Acl.Operation.read, targetEntity.name) !== 'no'
170
+ const canDeleteOrphans = this.getAllowedOperations(entity, relation).includes(Input.UpdateRelationOperation.delete)
171
+ const setField = canReadTarget && Object.keys(setItemFields).length > 0
172
+ ? {
173
+ type: new GraphQLList(
174
+ new GraphQLNonNull(
175
+ new GraphQLInputObjectType({
176
+ name: GqlTypeName`${entity.name}Set${relation.name}ItemRelationInput`,
177
+ fields: () => ({
178
+ ...setItemFields,
179
+ alias: { type: GraphQLString },
180
+ }),
181
+ }),
182
+ ),
183
+ ),
184
+ }
185
+ : undefined
186
+
139
187
  return new GraphQLInputObjectType({
140
188
  name: GqlTypeName`${entity.name}Update${relation.name}EntityRelationInput`,
141
189
  fields: () => ({
142
190
  ...filteredFields,
191
+ ...(setField
192
+ ? {
193
+ [Input.UpdateRelationOperation.set]: setField,
194
+ // Only exposed when the role may delete the target - `disconnect` is the default anyway.
195
+ ...(canDeleteOrphans ? { orphanStrategy: { type: orphanRemovalStrategyEnum } } : {}),
196
+ }
197
+ : {}),
143
198
  alias: { type: GraphQLString },
144
199
  }),
145
200
  })
146
201
  }
147
202
 
148
- private filterAllowedOperations(
149
- entity: Model.Entity,
150
- relation: Model.Relation,
151
- graphQlFields: { [key: string]: GraphQLInputFieldConfig | undefined },
152
- ): GraphQLInputFieldConfigMap {
153
- const allowedOperations = acceptFieldVisitor(
203
+ private getAllowedOperations(entity: Model.Entity, relation: Model.Relation): Input.UpdateRelationOperation[] {
204
+ return acceptFieldVisitor(
154
205
  this.schema,
155
206
  entity,
156
207
  relation.name,
157
208
  this.updateEntityRelationAllowedOperationsVisitor,
158
209
  )
210
+ }
211
+
212
+ private filterAllowedOperations(
213
+ entity: Model.Entity,
214
+ relation: Model.Relation,
215
+ graphQlFields: { [key: string]: GraphQLInputFieldConfig | undefined },
216
+ ): GraphQLInputFieldConfigMap {
217
+ const allowedOperations = this.getAllowedOperations(entity, relation)
159
218
  return filterObject(
160
219
  graphQlFields,
161
220
  (key, value): value is GraphQLInputFieldConfig => allowedOperations.includes(key as Input.UpdateRelationOperation) && value !== undefined,
@@ -1,5 +1,6 @@
1
1
  import { capitalizeFirstLetter } from '../utils/index.js'
2
2
  import { GraphQLFieldResolver } from 'graphql'
3
+ import { Model } from '@contember/schema'
3
4
 
4
5
  export const GqlTypeName = (strings: TemplateStringsArray, ...values: string[]) => {
5
6
  return strings.reduce((combined, string, i) => {
@@ -13,3 +14,16 @@ export const aliasAwareResolver: GraphQLFieldResolver<any, any> = (source, args,
13
14
  }
14
15
  return source[info.path.key]
15
16
  }
17
+
18
+ /**
19
+ * Description of a GraphQL input field derived from a schema field.
20
+ * Input fields are not marked as deprecated, because standard introspection hides deprecated input values,
21
+ * so the deprecation reason becomes part of the description instead.
22
+ */
23
+ export const inputFieldDescription = (field: Model.AnyField): string | undefined => {
24
+ if (field.deprecationReason === undefined) {
25
+ return field.description
26
+ }
27
+ const note = `Deprecated: ${field.deprecationReason}`
28
+ return field.description ? `${field.description}\n\n${note}` : note
29
+ }
package/src/tsconfig.json CHANGED
@@ -11,6 +11,7 @@
11
11
  { "path": "../../logger/src" },
12
12
  { "path": "../../schema/src" },
13
13
  { "path": "../../schema-definition/src" },
14
- { "path": "../../schema-utils/src" }
14
+ { "path": "../../schema-utils/src" },
15
+ { "path": "../../utilities/src" }
15
16
  ]
16
17
  }
@@ -0,0 +1,219 @@
1
+ import { test } from 'bun:test'
2
+ import { Acl } from '@contember/schema'
3
+ import { execute, sqlTransaction } from '../../../../../src/test.js'
4
+ import { GQL, SQL } from '../../../../../src/tags.js'
5
+ import { testUuid } from '../../../../../src/testUuid.js'
6
+ import { postWithCategories } from './schema.js'
7
+
8
+ test('set with default orphanStrategy (disconnect) - inverse junction', async () => {
9
+ await execute({
10
+ schema: postWithCategories,
11
+ query: GQL`mutation {
12
+ updateCategory(
13
+ by: {id: "${testUuid(2)}"},
14
+ data: {posts: {set: [{connect: {id: "${testUuid(1)}"}}]}}
15
+ ) {
16
+ ok
17
+ }
18
+ }`,
19
+ executes: [
20
+ ...sqlTransaction([
21
+ {
22
+ sql: SQL`select "root_"."id" from "public"."category" as "root_" where "root_"."id" = ?`,
23
+ parameters: [testUuid(2)],
24
+ response: { rows: [{ id: testUuid(2) }] },
25
+ },
26
+ {
27
+ sql: SQL`select "junction_"."post_id" as "primary_" from "public"."post_categories" as "junction_" where "junction_"."category_id" = ?`,
28
+ parameters: [testUuid(2)],
29
+ response: { rows: [{ primary_: testUuid(1) }, { primary_: testUuid(3) }] },
30
+ },
31
+ {
32
+ sql: SQL`select "root_"."id" from "public"."post" as "root_" where "root_"."id" = ?`,
33
+ parameters: [testUuid(1)],
34
+ response: { rows: [{ id: testUuid(1) }] },
35
+ },
36
+ {
37
+ sql: SQL`select "root_"."id" from "public"."post" as "root_" where "root_"."id" = ?`,
38
+ parameters: [testUuid(3)],
39
+ response: { rows: [{ id: testUuid(3) }] },
40
+ },
41
+ {
42
+ sql: SQL`delete from "public"."post_categories"
43
+ where "post_id" = ? and "category_id" = ?`,
44
+ parameters: [testUuid(3), testUuid(2)],
45
+ response: { rowCount: 1 },
46
+ },
47
+ {
48
+ sql: SQL`insert into "public"."post_categories" ("post_id", "category_id") values (?, ?) on conflict do nothing`,
49
+ parameters: [testUuid(1), testUuid(2)],
50
+ response: { rowCount: 1 },
51
+ },
52
+ ]),
53
+ ],
54
+ return: {
55
+ data: {
56
+ updateCategory: {
57
+ ok: true,
58
+ },
59
+ },
60
+ },
61
+ })
62
+ })
63
+
64
+ test('empty set clears the whole collection - inverse junction', async () => {
65
+ await execute({
66
+ schema: postWithCategories,
67
+ query: GQL`mutation {
68
+ updateCategory(
69
+ by: {id: "${testUuid(2)}"},
70
+ data: {posts: {set: []}}
71
+ ) {
72
+ ok
73
+ }
74
+ }`,
75
+ executes: [
76
+ ...sqlTransaction([
77
+ {
78
+ sql: SQL`select "root_"."id" from "public"."category" as "root_" where "root_"."id" = ?`,
79
+ parameters: [testUuid(2)],
80
+ response: { rows: [{ id: testUuid(2) }] },
81
+ },
82
+ // no desired members - every junction row keyed by this category is an orphan
83
+ {
84
+ sql: SQL`select "junction_"."post_id" as "primary_" from "public"."post_categories" as "junction_" where "junction_"."category_id" = ?`,
85
+ parameters: [testUuid(2)],
86
+ response: { rows: [{ primary_: testUuid(1) }, { primary_: testUuid(3) }] },
87
+ },
88
+ // orphan (id=1) disconnected
89
+ {
90
+ sql: SQL`select "root_"."id" from "public"."post" as "root_" where "root_"."id" = ?`,
91
+ parameters: [testUuid(1)],
92
+ response: { rows: [{ id: testUuid(1) }] },
93
+ },
94
+ {
95
+ sql: SQL`delete from "public"."post_categories"
96
+ where "post_id" = ? and "category_id" = ?`,
97
+ parameters: [testUuid(1), testUuid(2)],
98
+ response: { rowCount: 1 },
99
+ },
100
+ // orphan (id=3) disconnected
101
+ {
102
+ sql: SQL`select "root_"."id" from "public"."post" as "root_" where "root_"."id" = ?`,
103
+ parameters: [testUuid(3)],
104
+ response: { rows: [{ id: testUuid(3) }] },
105
+ },
106
+ {
107
+ sql: SQL`delete from "public"."post_categories"
108
+ where "post_id" = ? and "category_id" = ?`,
109
+ parameters: [testUuid(3), testUuid(2)],
110
+ response: { rowCount: 1 },
111
+ },
112
+ ]),
113
+ ],
114
+ return: {
115
+ data: {
116
+ updateCategory: {
117
+ ok: true,
118
+ },
119
+ },
120
+ },
121
+ })
122
+ })
123
+
124
+ // The orphan-candidate set is fetched through the target entity's ACL read predicate, so a current
125
+ // member the role cannot read is invisible to the diff and therefore never orphaned, while a readable
126
+ // omitted member is orphaned as usual. This mirrors the oneHasMany behavior, now also on the inverse side.
127
+ const restrictedReadPermissions: Acl.Permissions = {
128
+ Post: {
129
+ predicates: {
130
+ post_read_predicate: {
131
+ title: { eq: 'visible' },
132
+ },
133
+ },
134
+ operations: {
135
+ read: {
136
+ id: 'post_read_predicate',
137
+ },
138
+ update: {
139
+ categories: true,
140
+ },
141
+ },
142
+ },
143
+ Category: {
144
+ predicates: {},
145
+ operations: {
146
+ read: {
147
+ id: true,
148
+ },
149
+ update: {
150
+ id: true,
151
+ posts: true,
152
+ },
153
+ },
154
+ },
155
+ }
156
+
157
+ test('set applies the target read predicate when computing orphans - inverse junction', async () => {
158
+ await execute({
159
+ schema: postWithCategories,
160
+ permissions: restrictedReadPermissions,
161
+ variables: {},
162
+ query: GQL`mutation {
163
+ updateCategory(
164
+ by: {id: "${testUuid(2)}"},
165
+ data: {posts: {set: [{connect: {id: "${testUuid(1)}"}}]}}
166
+ ) {
167
+ ok
168
+ }
169
+ }`,
170
+ executes: [
171
+ ...sqlTransaction([
172
+ {
173
+ sql: SQL`select "root_"."id" from "public"."category" as "root_" where "root_"."id" = ?`,
174
+ parameters: [testUuid(2)],
175
+ response: { rows: [{ id: testUuid(2) }] },
176
+ },
177
+ // snapshot the members up front - orphans are members from *before* the operation
178
+ // snapshot the members up front - orphans are members from *before* the operation
179
+ {
180
+ sql: SQL`select "junction_"."post_id" as "primary_" from "public"."post_categories" as "junction_"
181
+ inner join "public"."post" as "root_" on "junction_"."post_id" = "root_"."id"
182
+ where "junction_"."category_id" = ? and "root_"."title" = ?`,
183
+ parameters: [testUuid(2), 'visible'],
184
+ response: { rows: [{ primary_: testUuid(1) }, { primary_: testUuid(3) }] },
185
+ },
186
+ // resolving the connect target applies Post's read predicate
187
+ {
188
+ sql: SQL`select "root_"."id" from "public"."post" as "root_" where "root_"."id" = ? and "root_"."title" = ?`,
189
+ parameters: [testUuid(1), 'visible'],
190
+ response: { rows: [{ id: testUuid(1) }] },
191
+ },
192
+ // the readable omitted member (id=3) is disconnected from the junction
193
+ {
194
+ sql: SQL`select "root_"."id" from "public"."post" as "root_" where "root_"."id" = ? and "root_"."title" = ?`,
195
+ parameters: [testUuid(3), 'visible'],
196
+ response: { rows: [{ id: testUuid(3) }] },
197
+ },
198
+ {
199
+ sql: SQL`delete from "public"."post_categories"
200
+ where "post_id" = ? and "category_id" = ?`,
201
+ parameters: [testUuid(3), testUuid(2)],
202
+ response: { rowCount: 1 },
203
+ },
204
+ {
205
+ sql: SQL`insert into "public"."post_categories" ("post_id", "category_id") values (?, ?) on conflict do nothing`,
206
+ parameters: [testUuid(1), testUuid(2)],
207
+ response: { rowCount: 1 },
208
+ },
209
+ ]),
210
+ ],
211
+ return: {
212
+ data: {
213
+ updateCategory: {
214
+ ok: true,
215
+ },
216
+ },
217
+ },
218
+ })
219
+ })