@contember/engine-content-api 2.0.0-alpha.9 → 2.0.0-beta.1

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 (1022) hide show
  1. package/dist/development/index.cjs +3 -2
  2. package/dist/development/index.cjs.map +1 -1
  3. package/dist/development/index.js +3 -2
  4. package/dist/development/index.js.map +1 -1
  5. package/dist/development/src/ExecutionContainer.cjs +2 -2
  6. package/dist/development/src/ExecutionContainer.cjs.map +1 -1
  7. package/dist/development/src/ExecutionContainer.js +2 -2
  8. package/dist/development/src/ExecutionContainer.js.map +1 -1
  9. package/dist/development/src/acl/Authorizator.cjs.map +1 -1
  10. package/dist/development/src/acl/Authorizator.js.map +1 -1
  11. package/dist/development/src/acl/EvaluatedPredicateReplacer.cjs.map +1 -1
  12. package/dist/development/src/acl/EvaluatedPredicateReplacer.js.map +1 -1
  13. package/dist/development/src/acl/PermissionFactory.cjs.map +1 -1
  14. package/dist/development/src/acl/PermissionFactory.js.map +1 -1
  15. package/dist/development/src/acl/PredicateFactory.cjs.map +1 -1
  16. package/dist/development/src/acl/PredicateFactory.js.map +1 -1
  17. package/dist/development/src/acl/PredicatesInjector.cjs.map +1 -1
  18. package/dist/development/src/acl/PredicatesInjector.js.map +1 -1
  19. package/dist/development/src/acl/VariableInjector.cjs.map +1 -1
  20. package/dist/development/src/acl/VariableInjector.js.map +1 -1
  21. package/dist/development/src/acl/VariableUtils.cjs.map +1 -1
  22. package/dist/development/src/acl/VariableUtils.js.map +1 -1
  23. package/dist/development/src/exception.cjs.map +1 -1
  24. package/dist/development/src/exception.js.map +1 -1
  25. package/dist/development/src/extensions/hasManyToHasOneReducer/HasManyToHasOneReducer.cjs.map +1 -1
  26. package/dist/development/src/extensions/hasManyToHasOneReducer/HasManyToHasOneReducer.js.map +1 -1
  27. package/dist/development/src/extensions/hasManyToHasOneReducer/HasManyToHasOneReducerExecutionHandler.cjs.map +1 -1
  28. package/dist/development/src/extensions/hasManyToHasOneReducer/HasManyToHasOneReducerExecutionHandler.js.map +1 -1
  29. package/dist/development/src/extensions/hasManyToHasOneReducer/HasManyToHasOneRelationReducerVisitor.cjs +31 -6
  30. package/dist/development/src/extensions/hasManyToHasOneReducer/HasManyToHasOneRelationReducerVisitor.cjs.map +1 -1
  31. package/dist/development/src/extensions/hasManyToHasOneReducer/HasManyToHasOneRelationReducerVisitor.js +31 -6
  32. package/dist/development/src/extensions/hasManyToHasOneReducer/HasManyToHasOneRelationReducerVisitor.js.map +1 -1
  33. package/dist/development/src/extensions/paginatedHasMany/PaginatedHasManyCountVisitor.cjs.map +1 -1
  34. package/dist/development/src/extensions/paginatedHasMany/PaginatedHasManyCountVisitor.js.map +1 -1
  35. package/dist/development/src/extensions/paginatedHasMany/PaginatedHasManyExecutionHandler.cjs.map +1 -1
  36. package/dist/development/src/extensions/paginatedHasMany/PaginatedHasManyExecutionHandler.js.map +1 -1
  37. package/dist/development/src/extensions/paginatedHasMany/PaginatedHasManyFieldProvider.cjs.map +1 -1
  38. package/dist/development/src/extensions/paginatedHasMany/PaginatedHasManyFieldProvider.js.map +1 -1
  39. package/dist/development/src/extensions/paginatedHasMany/PaginatedHasManyFieldProviderVisitor.cjs.map +1 -1
  40. package/dist/development/src/extensions/paginatedHasMany/PaginatedHasManyFieldProviderVisitor.js.map +1 -1
  41. package/dist/development/src/extensions/paginatedHasMany/PaginatedHasManyNodesVisitor.cjs.map +1 -1
  42. package/dist/development/src/extensions/paginatedHasMany/PaginatedHasManyNodesVisitor.js.map +1 -1
  43. package/dist/development/src/input-validation/ColumnValueResolver.cjs.map +1 -1
  44. package/dist/development/src/input-validation/ColumnValueResolver.js.map +1 -1
  45. package/dist/development/src/input-validation/EntityRulesResolver.cjs.map +1 -1
  46. package/dist/development/src/input-validation/EntityRulesResolver.js.map +1 -1
  47. package/dist/development/src/input-validation/QueryAstFactory.cjs.map +1 -1
  48. package/dist/development/src/input-validation/QueryAstFactory.js.map +1 -1
  49. package/dist/development/src/input-validation/ValidationContext.cjs.map +1 -1
  50. package/dist/development/src/input-validation/ValidationContext.js.map +1 -1
  51. package/dist/development/src/input-validation/ValidationDataSelector.cjs.map +1 -1
  52. package/dist/development/src/input-validation/ValidationDataSelector.js.map +1 -1
  53. package/dist/development/src/input-validation/ValidationEvaluation.cjs.map +1 -1
  54. package/dist/development/src/input-validation/ValidationEvaluation.js.map +1 -1
  55. package/dist/development/src/input-validation/ValidationPath.cjs.map +1 -1
  56. package/dist/development/src/input-validation/ValidationPath.js.map +1 -1
  57. package/dist/development/src/input-validation/dependencies/DependencyCollector.cjs.map +1 -1
  58. package/dist/development/src/input-validation/dependencies/DependencyCollector.js.map +1 -1
  59. package/dist/development/src/input-validation/dependencies/DependencyMerger.cjs.map +1 -1
  60. package/dist/development/src/input-validation/dependencies/DependencyMerger.js.map +1 -1
  61. package/dist/development/src/input-validation/preValidation/CreateInputPreValidationProcessor.cjs.map +1 -1
  62. package/dist/development/src/input-validation/preValidation/CreateInputPreValidationProcessor.js.map +1 -1
  63. package/dist/development/src/input-validation/preValidation/InputPreValidator.cjs +1 -1
  64. package/dist/development/src/input-validation/preValidation/InputPreValidator.cjs.map +1 -1
  65. package/dist/development/src/input-validation/preValidation/InputPreValidator.js +1 -1
  66. package/dist/development/src/input-validation/preValidation/InputPreValidator.js.map +1 -1
  67. package/dist/development/src/input-validation/preValidation/UpdateInputPreValidationProcessor.cjs.map +1 -1
  68. package/dist/development/src/input-validation/preValidation/UpdateInputPreValidationProcessor.js.map +1 -1
  69. package/dist/development/src/inputProcessing/CreateInputVisitor.cjs +16 -17
  70. package/dist/development/src/inputProcessing/CreateInputVisitor.cjs.map +1 -1
  71. package/dist/development/src/inputProcessing/CreateInputVisitor.js +16 -17
  72. package/dist/development/src/inputProcessing/CreateInputVisitor.js.map +1 -1
  73. package/dist/development/src/inputProcessing/FieldNode.cjs.map +1 -1
  74. package/dist/development/src/inputProcessing/FieldNode.js.map +1 -1
  75. package/dist/development/src/inputProcessing/ObjectNode.cjs.map +1 -1
  76. package/dist/development/src/inputProcessing/ObjectNode.js.map +1 -1
  77. package/dist/development/src/inputProcessing/UniqueWhereExpander.cjs.map +1 -1
  78. package/dist/development/src/inputProcessing/UniqueWhereExpander.js.map +1 -1
  79. package/dist/development/src/inputProcessing/UpdateInputVisitor.cjs +29 -27
  80. package/dist/development/src/inputProcessing/UpdateInputVisitor.cjs.map +1 -1
  81. package/dist/development/src/inputProcessing/UpdateInputVisitor.js +29 -27
  82. package/dist/development/src/inputProcessing/UpdateInputVisitor.js.map +1 -1
  83. package/dist/development/src/introspection/IntrospectionSchemaDefinitionFactory.cjs +6 -163
  84. package/dist/development/src/introspection/IntrospectionSchemaDefinitionFactory.cjs.map +1 -1
  85. package/dist/development/src/introspection/IntrospectionSchemaDefinitionFactory.js +5 -162
  86. package/dist/development/src/introspection/IntrospectionSchemaDefinitionFactory.js.map +1 -1
  87. package/dist/development/src/introspection/IntrospectionSchemaFactory.cjs.map +1 -1
  88. package/dist/development/src/introspection/IntrospectionSchemaFactory.js.map +1 -1
  89. package/dist/development/src/introspection/introspection.schema.cjs +163 -0
  90. package/dist/development/src/introspection/introspection.schema.cjs.map +1 -0
  91. package/dist/development/src/introspection/introspection.schema.js +163 -0
  92. package/dist/development/src/introspection/introspection.schema.js.map +1 -0
  93. package/dist/development/src/mapper/CheckedPrimary.cjs.map +1 -1
  94. package/dist/development/src/mapper/CheckedPrimary.js.map +1 -1
  95. package/dist/development/src/mapper/ColumnValue.cjs +8 -18
  96. package/dist/development/src/mapper/ColumnValue.cjs.map +1 -1
  97. package/dist/development/src/mapper/ColumnValue.js +8 -18
  98. package/dist/development/src/mapper/ColumnValue.js.map +1 -1
  99. package/dist/development/src/mapper/ErrorUtils.cjs +1 -1
  100. package/dist/development/src/mapper/ErrorUtils.cjs.map +1 -1
  101. package/dist/development/src/mapper/ErrorUtils.js +1 -1
  102. package/dist/development/src/mapper/ErrorUtils.js.map +1 -1
  103. package/dist/development/src/mapper/EventManager.cjs +4 -7
  104. package/dist/development/src/mapper/EventManager.cjs.map +1 -1
  105. package/dist/development/src/mapper/EventManager.js +4 -7
  106. package/dist/development/src/mapper/EventManager.js.map +1 -1
  107. package/dist/development/src/mapper/JunctionTableManager.cjs.map +1 -1
  108. package/dist/development/src/mapper/JunctionTableManager.js.map +1 -1
  109. package/dist/development/src/mapper/Mapper.cjs +8 -28
  110. package/dist/development/src/mapper/Mapper.cjs.map +1 -1
  111. package/dist/development/src/mapper/Mapper.js +8 -28
  112. package/dist/development/src/mapper/Mapper.js.map +1 -1
  113. package/dist/development/src/mapper/MapperFactory.cjs.map +1 -1
  114. package/dist/development/src/mapper/MapperFactory.js.map +1 -1
  115. package/dist/development/src/mapper/MutationProcessorHelper.cjs +10 -2
  116. package/dist/development/src/mapper/MutationProcessorHelper.cjs.map +1 -1
  117. package/dist/development/src/mapper/MutationProcessorHelper.js +10 -2
  118. package/dist/development/src/mapper/MutationProcessorHelper.js.map +1 -1
  119. package/dist/development/src/mapper/Result.cjs +10 -27
  120. package/dist/development/src/mapper/Result.cjs.map +1 -1
  121. package/dist/development/src/mapper/Result.js +10 -27
  122. package/dist/development/src/mapper/Result.js.map +1 -1
  123. package/dist/development/src/mapper/delete/DeleteExecutor.cjs +4 -8
  124. package/dist/development/src/mapper/delete/DeleteExecutor.cjs.map +1 -1
  125. package/dist/development/src/mapper/delete/DeleteExecutor.js +5 -9
  126. package/dist/development/src/mapper/delete/DeleteExecutor.js.map +1 -1
  127. package/dist/development/src/mapper/delete/DeleteState.cjs.map +1 -1
  128. package/dist/development/src/mapper/delete/DeleteState.js.map +1 -1
  129. package/dist/development/src/mapper/delete/DeletedEntitiesStorage.cjs.map +1 -1
  130. package/dist/development/src/mapper/delete/DeletedEntitiesStorage.js.map +1 -1
  131. package/dist/development/src/mapper/delete/helpers.cjs.map +1 -1
  132. package/dist/development/src/mapper/delete/helpers.js.map +1 -1
  133. package/dist/development/src/mapper/insert/InsertBuilder.cjs +13 -21
  134. package/dist/development/src/mapper/insert/InsertBuilder.cjs.map +1 -1
  135. package/dist/development/src/mapper/insert/InsertBuilder.js +14 -22
  136. package/dist/development/src/mapper/insert/InsertBuilder.js.map +1 -1
  137. package/dist/development/src/mapper/insert/InsertBuilderFactory.cjs.map +1 -1
  138. package/dist/development/src/mapper/insert/InsertBuilderFactory.js.map +1 -1
  139. package/dist/development/src/mapper/insert/Inserter.cjs +43 -21
  140. package/dist/development/src/mapper/insert/Inserter.cjs.map +1 -1
  141. package/dist/development/src/mapper/insert/Inserter.js +45 -23
  142. package/dist/development/src/mapper/insert/Inserter.js.map +1 -1
  143. package/dist/development/src/mapper/insert/SqlCreateInputProcessor.cjs +23 -79
  144. package/dist/development/src/mapper/insert/SqlCreateInputProcessor.cjs.map +1 -1
  145. package/dist/development/src/mapper/insert/SqlCreateInputProcessor.js +23 -79
  146. package/dist/development/src/mapper/insert/SqlCreateInputProcessor.js.map +1 -1
  147. package/dist/development/src/mapper/insert/relations/ManyHasManyCreateInputProcessor.cjs +43 -0
  148. package/dist/development/src/mapper/insert/relations/ManyHasManyCreateInputProcessor.cjs.map +1 -0
  149. package/dist/development/src/mapper/insert/relations/ManyHasManyCreateInputProcessor.js +43 -0
  150. package/dist/development/src/mapper/insert/relations/ManyHasManyCreateInputProcessor.js.map +1 -0
  151. package/dist/development/src/mapper/insert/relations/ManyHasOneCreateInputProcessor.cjs +40 -0
  152. package/dist/development/src/mapper/insert/relations/ManyHasOneCreateInputProcessor.cjs.map +1 -0
  153. package/dist/development/src/mapper/insert/relations/ManyHasOneCreateInputProcessor.js +40 -0
  154. package/dist/development/src/mapper/insert/relations/ManyHasOneCreateInputProcessor.js.map +1 -0
  155. package/dist/development/src/mapper/insert/relations/OneHasManyCreateInputProcessor.cjs +38 -0
  156. package/dist/development/src/mapper/insert/relations/OneHasManyCreateInputProcessor.cjs.map +1 -0
  157. package/dist/development/src/mapper/insert/relations/OneHasManyCreateInputProcessor.js +38 -0
  158. package/dist/development/src/mapper/insert/relations/OneHasManyCreateInputProcessor.js.map +1 -0
  159. package/dist/development/src/mapper/{relations → insert/relations}/OneHasOneInverseCreateInputProcessor.cjs +23 -32
  160. package/dist/development/src/mapper/insert/relations/OneHasOneInverseCreateInputProcessor.cjs.map +1 -0
  161. package/dist/development/src/mapper/{relations → insert/relations}/OneHasOneInverseCreateInputProcessor.js +23 -32
  162. package/dist/development/src/mapper/insert/relations/OneHasOneInverseCreateInputProcessor.js.map +1 -0
  163. package/dist/development/src/mapper/insert/relations/OneHasOneOwningCreateInputProcessor.cjs +65 -0
  164. package/dist/development/src/mapper/insert/relations/OneHasOneOwningCreateInputProcessor.cjs.map +1 -0
  165. package/dist/development/src/mapper/insert/relations/OneHasOneOwningCreateInputProcessor.js +65 -0
  166. package/dist/development/src/mapper/insert/relations/OneHasOneOwningCreateInputProcessor.js.map +1 -0
  167. package/dist/development/src/mapper/select/ConditionBuilder.cjs.map +1 -1
  168. package/dist/development/src/mapper/select/ConditionBuilder.js.map +1 -1
  169. package/dist/development/src/mapper/select/JoinBuilder.cjs.map +1 -1
  170. package/dist/development/src/mapper/select/JoinBuilder.js.map +1 -1
  171. package/dist/development/src/mapper/select/JoinVisitor.cjs.map +1 -1
  172. package/dist/development/src/mapper/select/JoinVisitor.js.map +1 -1
  173. package/dist/development/src/mapper/select/OrderByBuilder.cjs.map +1 -1
  174. package/dist/development/src/mapper/select/OrderByBuilder.js.map +1 -1
  175. package/dist/development/src/mapper/select/OrderByHelper.cjs.map +1 -1
  176. package/dist/development/src/mapper/select/OrderByHelper.js.map +1 -1
  177. package/dist/development/src/mapper/select/Path.cjs.map +1 -1
  178. package/dist/development/src/mapper/select/Path.js.map +1 -1
  179. package/dist/development/src/mapper/select/RelationFetcher.cjs.map +1 -1
  180. package/dist/development/src/mapper/select/RelationFetcher.js.map +1 -1
  181. package/dist/development/src/mapper/select/SelectBuilder.cjs.map +1 -1
  182. package/dist/development/src/mapper/select/SelectBuilder.js.map +1 -1
  183. package/dist/development/src/mapper/select/SelectHydrator.cjs.map +1 -1
  184. package/dist/development/src/mapper/select/SelectHydrator.js.map +1 -1
  185. package/dist/development/src/mapper/select/WhereBuilder.cjs.map +1 -1
  186. package/dist/development/src/mapper/select/WhereBuilder.js.map +1 -1
  187. package/dist/development/src/mapper/select/handlers/FieldsVisitor.cjs +3 -0
  188. package/dist/development/src/mapper/select/handlers/FieldsVisitor.cjs.map +1 -1
  189. package/dist/development/src/mapper/select/handlers/FieldsVisitor.js +3 -0
  190. package/dist/development/src/mapper/select/handlers/FieldsVisitor.js.map +1 -1
  191. package/dist/development/src/mapper/select/handlers/FieldsVisitorFactory.cjs.map +1 -1
  192. package/dist/development/src/mapper/select/handlers/FieldsVisitorFactory.js.map +1 -1
  193. package/dist/development/src/mapper/select/handlers/MetaHandler.cjs.map +1 -1
  194. package/dist/development/src/mapper/select/handlers/MetaHandler.js.map +1 -1
  195. package/dist/development/src/mapper/select/optimizer/ConditionOptimizer.cjs.map +1 -1
  196. package/dist/development/src/mapper/select/optimizer/ConditionOptimizer.js.map +1 -1
  197. package/dist/development/src/mapper/select/optimizer/WhereOptimizer.cjs.map +1 -1
  198. package/dist/development/src/mapper/select/optimizer/WhereOptimizer.js.map +1 -1
  199. package/dist/development/src/mapper/select/optimizer/WhereReplacer.cjs.map +1 -1
  200. package/dist/development/src/mapper/select/optimizer/WhereReplacer.js.map +1 -1
  201. package/dist/development/src/mapper/select/optimizer/helpers.cjs.map +1 -1
  202. package/dist/development/src/mapper/select/optimizer/helpers.js.map +1 -1
  203. package/dist/development/src/mapper/update/SqlUpdateInputProcessor.cjs +36 -36
  204. package/dist/development/src/mapper/update/SqlUpdateInputProcessor.cjs.map +1 -1
  205. package/dist/development/src/mapper/update/SqlUpdateInputProcessor.js +36 -36
  206. package/dist/development/src/mapper/update/SqlUpdateInputProcessor.js.map +1 -1
  207. package/dist/development/src/mapper/update/UpdateBuilder.cjs +14 -19
  208. package/dist/development/src/mapper/update/UpdateBuilder.cjs.map +1 -1
  209. package/dist/development/src/mapper/update/UpdateBuilder.js +15 -20
  210. package/dist/development/src/mapper/update/UpdateBuilder.js.map +1 -1
  211. package/dist/development/src/mapper/update/UpdateBuilderFactory.cjs.map +1 -1
  212. package/dist/development/src/mapper/update/UpdateBuilderFactory.js.map +1 -1
  213. package/dist/development/src/mapper/update/Updater.cjs +45 -17
  214. package/dist/development/src/mapper/update/Updater.cjs.map +1 -1
  215. package/dist/development/src/mapper/update/Updater.js +47 -19
  216. package/dist/development/src/mapper/update/Updater.js.map +1 -1
  217. package/dist/development/src/mapper/update/relations/ManyHasManyUpdateInputProcessor.cjs +84 -0
  218. package/dist/development/src/mapper/update/relations/ManyHasManyUpdateInputProcessor.cjs.map +1 -0
  219. package/dist/development/src/mapper/update/relations/ManyHasManyUpdateInputProcessor.js +84 -0
  220. package/dist/development/src/mapper/update/relations/ManyHasManyUpdateInputProcessor.js.map +1 -0
  221. package/dist/development/src/mapper/update/relations/ManyHasOneUpdateInputProcessor.cjs +88 -0
  222. package/dist/development/src/mapper/update/relations/ManyHasOneUpdateInputProcessor.cjs.map +1 -0
  223. package/dist/development/src/mapper/update/relations/ManyHasOneUpdateInputProcessor.js +88 -0
  224. package/dist/development/src/mapper/update/relations/ManyHasOneUpdateInputProcessor.js.map +1 -0
  225. package/dist/development/src/mapper/update/relations/OneHasManyUpdateInputProcessor.cjs +87 -0
  226. package/dist/development/src/mapper/update/relations/OneHasManyUpdateInputProcessor.cjs.map +1 -0
  227. package/dist/development/src/mapper/update/relations/OneHasManyUpdateInputProcessor.js +87 -0
  228. package/dist/development/src/mapper/update/relations/OneHasManyUpdateInputProcessor.js.map +1 -0
  229. package/dist/development/src/mapper/update/relations/OneHasOneInverseUpdateInputProcessor.cjs +147 -0
  230. package/dist/development/src/mapper/update/relations/OneHasOneInverseUpdateInputProcessor.cjs.map +1 -0
  231. package/dist/development/src/mapper/update/relations/OneHasOneInverseUpdateInputProcessor.js +147 -0
  232. package/dist/development/src/mapper/update/relations/OneHasOneInverseUpdateInputProcessor.js.map +1 -0
  233. package/dist/development/src/mapper/update/relations/OneHasOneOwningUpdateInputProcessor.cjs +183 -0
  234. package/dist/development/src/mapper/update/relations/OneHasOneOwningUpdateInputProcessor.cjs.map +1 -0
  235. package/dist/development/src/mapper/update/relations/OneHasOneOwningUpdateInputProcessor.js +183 -0
  236. package/dist/development/src/mapper/update/relations/OneHasOneOwningUpdateInputProcessor.js.map +1 -0
  237. package/dist/development/src/resolvers/GraphQlQueryAstFactory.cjs.map +1 -1
  238. package/dist/development/src/resolvers/GraphQlQueryAstFactory.js.map +1 -1
  239. package/dist/development/src/resolvers/MutationResolver.cjs +8 -4
  240. package/dist/development/src/resolvers/MutationResolver.cjs.map +1 -1
  241. package/dist/development/src/resolvers/MutationResolver.js +8 -4
  242. package/dist/development/src/resolvers/MutationResolver.js.map +1 -1
  243. package/dist/development/src/resolvers/ReadHelpers.cjs.map +1 -1
  244. package/dist/development/src/resolvers/ReadHelpers.js.map +1 -1
  245. package/dist/development/src/resolvers/ReadResolver.cjs.map +1 -1
  246. package/dist/development/src/resolvers/ReadResolver.js.map +1 -1
  247. package/dist/development/src/resolvers/ValidationResolver.cjs.map +1 -1
  248. package/dist/development/src/resolvers/ValidationResolver.js.map +1 -1
  249. package/dist/development/src/schema/ColumnTypeResolver.cjs.map +1 -1
  250. package/dist/development/src/schema/ColumnTypeResolver.js.map +1 -1
  251. package/dist/development/src/schema/ConditionTypeProvider.cjs.map +1 -1
  252. package/dist/development/src/schema/ConditionTypeProvider.js.map +1 -1
  253. package/dist/development/src/schema/CustomTypesProvider.cjs.map +1 -1
  254. package/dist/development/src/schema/CustomTypesProvider.js.map +1 -1
  255. package/dist/development/src/schema/EntityTypeProvider.cjs.map +1 -1
  256. package/dist/development/src/schema/EntityTypeProvider.js.map +1 -1
  257. package/dist/development/src/schema/EnumsProvider.cjs.map +1 -1
  258. package/dist/development/src/schema/EnumsProvider.js.map +1 -1
  259. package/dist/development/src/schema/FieldAccessVisitor.cjs.map +1 -1
  260. package/dist/development/src/schema/FieldAccessVisitor.js.map +1 -1
  261. package/dist/development/src/schema/GraphQlSchemaBuilder.cjs.map +1 -1
  262. package/dist/development/src/schema/GraphQlSchemaBuilder.js.map +1 -1
  263. package/dist/development/src/schema/GraphQlSchemaBuilderFactory.cjs.map +1 -1
  264. package/dist/development/src/schema/GraphQlSchemaBuilderFactory.js.map +1 -1
  265. package/dist/development/src/schema/MutationProvider.cjs.map +1 -1
  266. package/dist/development/src/schema/MutationProvider.js.map +1 -1
  267. package/dist/development/src/schema/OperationExtension.cjs.map +1 -1
  268. package/dist/development/src/schema/OperationExtension.js.map +1 -1
  269. package/dist/development/src/schema/OrderByTypeProvider.cjs.map +1 -1
  270. package/dist/development/src/schema/OrderByTypeProvider.js.map +1 -1
  271. package/dist/development/src/schema/PaginatedFieldConfigFactory.cjs.map +1 -1
  272. package/dist/development/src/schema/PaginatedFieldConfigFactory.js.map +1 -1
  273. package/dist/development/src/schema/QueryProvider.cjs.map +1 -1
  274. package/dist/development/src/schema/QueryProvider.js.map +1 -1
  275. package/dist/development/src/schema/ResultSchemaTypeProvider.cjs.map +1 -1
  276. package/dist/development/src/schema/ResultSchemaTypeProvider.js.map +1 -1
  277. package/dist/development/src/schema/ValidationQueriesProvider.cjs.map +1 -1
  278. package/dist/development/src/schema/ValidationQueriesProvider.js.map +1 -1
  279. package/dist/development/src/schema/WhereTypeProvider.cjs.map +1 -1
  280. package/dist/development/src/schema/WhereTypeProvider.js.map +1 -1
  281. package/dist/development/src/schema/entities/FieldArgsVisitor.cjs.map +1 -1
  282. package/dist/development/src/schema/entities/FieldArgsVisitor.js.map +1 -1
  283. package/dist/development/src/schema/entities/FieldTypeVisitor.cjs.map +1 -1
  284. package/dist/development/src/schema/entities/FieldTypeVisitor.js.map +1 -1
  285. package/dist/development/src/schema/mutations/ConnectOrCreateRelationInputProvider.cjs.map +1 -1
  286. package/dist/development/src/schema/mutations/ConnectOrCreateRelationInputProvider.js.map +1 -1
  287. package/dist/development/src/schema/mutations/CreateEntityInputFieldVisitor.cjs.map +1 -1
  288. package/dist/development/src/schema/mutations/CreateEntityInputFieldVisitor.js.map +1 -1
  289. package/dist/development/src/schema/mutations/CreateEntityRelationAllowedOperationsVisitor.cjs.map +1 -1
  290. package/dist/development/src/schema/mutations/CreateEntityRelationAllowedOperationsVisitor.js.map +1 -1
  291. package/dist/development/src/schema/mutations/CreateEntityRelationInputFieldVisitor.cjs.map +1 -1
  292. package/dist/development/src/schema/mutations/CreateEntityRelationInputFieldVisitor.js.map +1 -1
  293. package/dist/development/src/schema/mutations/CreateEntityRelationInputProvider.cjs.map +1 -1
  294. package/dist/development/src/schema/mutations/CreateEntityRelationInputProvider.js.map +1 -1
  295. package/dist/development/src/schema/mutations/EntityInputProvider.cjs.map +1 -1
  296. package/dist/development/src/schema/mutations/EntityInputProvider.js.map +1 -1
  297. package/dist/development/src/schema/mutations/UpdateEntityInputFieldVisitor.cjs.map +1 -1
  298. package/dist/development/src/schema/mutations/UpdateEntityInputFieldVisitor.js.map +1 -1
  299. package/dist/development/src/schema/mutations/UpdateEntityRelationAllowedOperationsVisitor.cjs.map +1 -1
  300. package/dist/development/src/schema/mutations/UpdateEntityRelationAllowedOperationsVisitor.js.map +1 -1
  301. package/dist/development/src/schema/mutations/UpdateEntityRelationInputFieldVisitor.cjs +2 -0
  302. package/dist/development/src/schema/mutations/UpdateEntityRelationInputFieldVisitor.cjs.map +1 -1
  303. package/dist/development/src/schema/mutations/UpdateEntityRelationInputFieldVisitor.js +2 -0
  304. package/dist/development/src/schema/mutations/UpdateEntityRelationInputFieldVisitor.js.map +1 -1
  305. package/dist/development/src/schema/mutations/UpdateEntityRelationInputProvider.cjs.map +1 -1
  306. package/dist/development/src/schema/mutations/UpdateEntityRelationInputProvider.js.map +1 -1
  307. package/dist/development/src/schema/utils.cjs.map +1 -1
  308. package/dist/development/src/schema/utils.js.map +1 -1
  309. package/dist/development/src/utils/Mutex.cjs.map +1 -1
  310. package/dist/development/src/utils/Mutex.js.map +1 -1
  311. package/dist/development/src/utils/ResolveInfoUtils.cjs.map +1 -1
  312. package/dist/development/src/utils/ResolveInfoUtils.js.map +1 -1
  313. package/dist/development/src/utils/accessor.cjs.map +1 -1
  314. package/dist/development/src/utils/accessor.js.map +1 -1
  315. package/dist/development/src/utils/isIt.cjs.map +1 -1
  316. package/dist/development/src/utils/isIt.js.map +1 -1
  317. package/dist/development/src/utils/object.cjs.map +1 -1
  318. package/dist/development/src/utils/object.js.map +1 -1
  319. package/dist/development/src/utils/paginationUtils.cjs.map +1 -1
  320. package/dist/development/src/utils/paginationUtils.js.map +1 -1
  321. package/dist/development/src/utils/singletonFactory.cjs.map +1 -1
  322. package/dist/development/src/utils/singletonFactory.js.map +1 -1
  323. package/dist/development/src/utils/uniqueWhereFields.cjs.map +1 -1
  324. package/dist/development/src/utils/uniqueWhereFields.js.map +1 -1
  325. package/dist/production/index.cjs +3 -2
  326. package/dist/production/index.cjs.map +1 -1
  327. package/dist/production/index.js +3 -2
  328. package/dist/production/index.js.map +1 -1
  329. package/dist/production/src/ExecutionContainer.cjs +2 -2
  330. package/dist/production/src/ExecutionContainer.cjs.map +1 -1
  331. package/dist/production/src/ExecutionContainer.js +2 -2
  332. package/dist/production/src/ExecutionContainer.js.map +1 -1
  333. package/dist/production/src/acl/Authorizator.cjs.map +1 -1
  334. package/dist/production/src/acl/Authorizator.js.map +1 -1
  335. package/dist/production/src/acl/EvaluatedPredicateReplacer.cjs.map +1 -1
  336. package/dist/production/src/acl/EvaluatedPredicateReplacer.js.map +1 -1
  337. package/dist/production/src/acl/PermissionFactory.cjs.map +1 -1
  338. package/dist/production/src/acl/PermissionFactory.js.map +1 -1
  339. package/dist/production/src/acl/PredicateFactory.cjs.map +1 -1
  340. package/dist/production/src/acl/PredicateFactory.js.map +1 -1
  341. package/dist/production/src/acl/PredicatesInjector.cjs.map +1 -1
  342. package/dist/production/src/acl/PredicatesInjector.js.map +1 -1
  343. package/dist/production/src/acl/VariableInjector.cjs.map +1 -1
  344. package/dist/production/src/acl/VariableInjector.js.map +1 -1
  345. package/dist/production/src/acl/VariableUtils.cjs.map +1 -1
  346. package/dist/production/src/acl/VariableUtils.js.map +1 -1
  347. package/dist/production/src/exception.cjs.map +1 -1
  348. package/dist/production/src/exception.js.map +1 -1
  349. package/dist/production/src/extensions/hasManyToHasOneReducer/HasManyToHasOneReducer.cjs.map +1 -1
  350. package/dist/production/src/extensions/hasManyToHasOneReducer/HasManyToHasOneReducer.js.map +1 -1
  351. package/dist/production/src/extensions/hasManyToHasOneReducer/HasManyToHasOneReducerExecutionHandler.cjs.map +1 -1
  352. package/dist/production/src/extensions/hasManyToHasOneReducer/HasManyToHasOneReducerExecutionHandler.js.map +1 -1
  353. package/dist/production/src/extensions/hasManyToHasOneReducer/HasManyToHasOneRelationReducerVisitor.cjs +31 -6
  354. package/dist/production/src/extensions/hasManyToHasOneReducer/HasManyToHasOneRelationReducerVisitor.cjs.map +1 -1
  355. package/dist/production/src/extensions/hasManyToHasOneReducer/HasManyToHasOneRelationReducerVisitor.js +31 -6
  356. package/dist/production/src/extensions/hasManyToHasOneReducer/HasManyToHasOneRelationReducerVisitor.js.map +1 -1
  357. package/dist/production/src/extensions/paginatedHasMany/PaginatedHasManyCountVisitor.cjs.map +1 -1
  358. package/dist/production/src/extensions/paginatedHasMany/PaginatedHasManyCountVisitor.js.map +1 -1
  359. package/dist/production/src/extensions/paginatedHasMany/PaginatedHasManyExecutionHandler.cjs.map +1 -1
  360. package/dist/production/src/extensions/paginatedHasMany/PaginatedHasManyExecutionHandler.js.map +1 -1
  361. package/dist/production/src/extensions/paginatedHasMany/PaginatedHasManyFieldProvider.cjs.map +1 -1
  362. package/dist/production/src/extensions/paginatedHasMany/PaginatedHasManyFieldProvider.js.map +1 -1
  363. package/dist/production/src/extensions/paginatedHasMany/PaginatedHasManyFieldProviderVisitor.cjs.map +1 -1
  364. package/dist/production/src/extensions/paginatedHasMany/PaginatedHasManyFieldProviderVisitor.js.map +1 -1
  365. package/dist/production/src/extensions/paginatedHasMany/PaginatedHasManyNodesVisitor.cjs.map +1 -1
  366. package/dist/production/src/extensions/paginatedHasMany/PaginatedHasManyNodesVisitor.js.map +1 -1
  367. package/dist/production/src/input-validation/ColumnValueResolver.cjs.map +1 -1
  368. package/dist/production/src/input-validation/ColumnValueResolver.js.map +1 -1
  369. package/dist/production/src/input-validation/EntityRulesResolver.cjs.map +1 -1
  370. package/dist/production/src/input-validation/EntityRulesResolver.js.map +1 -1
  371. package/dist/production/src/input-validation/QueryAstFactory.cjs.map +1 -1
  372. package/dist/production/src/input-validation/QueryAstFactory.js.map +1 -1
  373. package/dist/production/src/input-validation/ValidationContext.cjs.map +1 -1
  374. package/dist/production/src/input-validation/ValidationContext.js.map +1 -1
  375. package/dist/production/src/input-validation/ValidationDataSelector.cjs.map +1 -1
  376. package/dist/production/src/input-validation/ValidationDataSelector.js.map +1 -1
  377. package/dist/production/src/input-validation/ValidationEvaluation.cjs.map +1 -1
  378. package/dist/production/src/input-validation/ValidationEvaluation.js.map +1 -1
  379. package/dist/production/src/input-validation/ValidationPath.cjs.map +1 -1
  380. package/dist/production/src/input-validation/ValidationPath.js.map +1 -1
  381. package/dist/production/src/input-validation/dependencies/DependencyCollector.cjs.map +1 -1
  382. package/dist/production/src/input-validation/dependencies/DependencyCollector.js.map +1 -1
  383. package/dist/production/src/input-validation/dependencies/DependencyMerger.cjs.map +1 -1
  384. package/dist/production/src/input-validation/dependencies/DependencyMerger.js.map +1 -1
  385. package/dist/production/src/input-validation/preValidation/CreateInputPreValidationProcessor.cjs.map +1 -1
  386. package/dist/production/src/input-validation/preValidation/CreateInputPreValidationProcessor.js.map +1 -1
  387. package/dist/production/src/input-validation/preValidation/InputPreValidator.cjs +1 -1
  388. package/dist/production/src/input-validation/preValidation/InputPreValidator.cjs.map +1 -1
  389. package/dist/production/src/input-validation/preValidation/InputPreValidator.js +1 -1
  390. package/dist/production/src/input-validation/preValidation/InputPreValidator.js.map +1 -1
  391. package/dist/production/src/input-validation/preValidation/UpdateInputPreValidationProcessor.cjs.map +1 -1
  392. package/dist/production/src/input-validation/preValidation/UpdateInputPreValidationProcessor.js.map +1 -1
  393. package/dist/production/src/inputProcessing/CreateInputVisitor.cjs +16 -17
  394. package/dist/production/src/inputProcessing/CreateInputVisitor.cjs.map +1 -1
  395. package/dist/production/src/inputProcessing/CreateInputVisitor.js +16 -17
  396. package/dist/production/src/inputProcessing/CreateInputVisitor.js.map +1 -1
  397. package/dist/production/src/inputProcessing/FieldNode.cjs.map +1 -1
  398. package/dist/production/src/inputProcessing/FieldNode.js.map +1 -1
  399. package/dist/production/src/inputProcessing/ObjectNode.cjs.map +1 -1
  400. package/dist/production/src/inputProcessing/ObjectNode.js.map +1 -1
  401. package/dist/production/src/inputProcessing/UniqueWhereExpander.cjs.map +1 -1
  402. package/dist/production/src/inputProcessing/UniqueWhereExpander.js.map +1 -1
  403. package/dist/production/src/inputProcessing/UpdateInputVisitor.cjs +29 -27
  404. package/dist/production/src/inputProcessing/UpdateInputVisitor.cjs.map +1 -1
  405. package/dist/production/src/inputProcessing/UpdateInputVisitor.js +29 -27
  406. package/dist/production/src/inputProcessing/UpdateInputVisitor.js.map +1 -1
  407. package/dist/production/src/introspection/IntrospectionSchemaDefinitionFactory.cjs +6 -163
  408. package/dist/production/src/introspection/IntrospectionSchemaDefinitionFactory.cjs.map +1 -1
  409. package/dist/production/src/introspection/IntrospectionSchemaDefinitionFactory.js +5 -162
  410. package/dist/production/src/introspection/IntrospectionSchemaDefinitionFactory.js.map +1 -1
  411. package/dist/production/src/introspection/IntrospectionSchemaFactory.cjs.map +1 -1
  412. package/dist/production/src/introspection/IntrospectionSchemaFactory.js.map +1 -1
  413. package/dist/production/src/introspection/introspection.schema.cjs +163 -0
  414. package/dist/production/src/introspection/introspection.schema.cjs.map +1 -0
  415. package/dist/production/src/introspection/introspection.schema.js +163 -0
  416. package/dist/production/src/introspection/introspection.schema.js.map +1 -0
  417. package/dist/production/src/mapper/CheckedPrimary.cjs.map +1 -1
  418. package/dist/production/src/mapper/CheckedPrimary.js.map +1 -1
  419. package/dist/production/src/mapper/ColumnValue.cjs +8 -18
  420. package/dist/production/src/mapper/ColumnValue.cjs.map +1 -1
  421. package/dist/production/src/mapper/ColumnValue.js +8 -18
  422. package/dist/production/src/mapper/ColumnValue.js.map +1 -1
  423. package/dist/production/src/mapper/ErrorUtils.cjs +1 -1
  424. package/dist/production/src/mapper/ErrorUtils.cjs.map +1 -1
  425. package/dist/production/src/mapper/ErrorUtils.js +1 -1
  426. package/dist/production/src/mapper/ErrorUtils.js.map +1 -1
  427. package/dist/production/src/mapper/EventManager.cjs +4 -7
  428. package/dist/production/src/mapper/EventManager.cjs.map +1 -1
  429. package/dist/production/src/mapper/EventManager.js +4 -7
  430. package/dist/production/src/mapper/EventManager.js.map +1 -1
  431. package/dist/production/src/mapper/JunctionTableManager.cjs.map +1 -1
  432. package/dist/production/src/mapper/JunctionTableManager.js.map +1 -1
  433. package/dist/production/src/mapper/Mapper.cjs +8 -28
  434. package/dist/production/src/mapper/Mapper.cjs.map +1 -1
  435. package/dist/production/src/mapper/Mapper.js +8 -28
  436. package/dist/production/src/mapper/Mapper.js.map +1 -1
  437. package/dist/production/src/mapper/MapperFactory.cjs.map +1 -1
  438. package/dist/production/src/mapper/MapperFactory.js.map +1 -1
  439. package/dist/production/src/mapper/MutationProcessorHelper.cjs +10 -2
  440. package/dist/production/src/mapper/MutationProcessorHelper.cjs.map +1 -1
  441. package/dist/production/src/mapper/MutationProcessorHelper.js +10 -2
  442. package/dist/production/src/mapper/MutationProcessorHelper.js.map +1 -1
  443. package/dist/production/src/mapper/Result.cjs +10 -27
  444. package/dist/production/src/mapper/Result.cjs.map +1 -1
  445. package/dist/production/src/mapper/Result.js +10 -27
  446. package/dist/production/src/mapper/Result.js.map +1 -1
  447. package/dist/production/src/mapper/delete/DeleteExecutor.cjs +4 -8
  448. package/dist/production/src/mapper/delete/DeleteExecutor.cjs.map +1 -1
  449. package/dist/production/src/mapper/delete/DeleteExecutor.js +5 -9
  450. package/dist/production/src/mapper/delete/DeleteExecutor.js.map +1 -1
  451. package/dist/production/src/mapper/delete/DeleteState.cjs.map +1 -1
  452. package/dist/production/src/mapper/delete/DeleteState.js.map +1 -1
  453. package/dist/production/src/mapper/delete/DeletedEntitiesStorage.cjs.map +1 -1
  454. package/dist/production/src/mapper/delete/DeletedEntitiesStorage.js.map +1 -1
  455. package/dist/production/src/mapper/delete/helpers.cjs.map +1 -1
  456. package/dist/production/src/mapper/delete/helpers.js.map +1 -1
  457. package/dist/production/src/mapper/insert/InsertBuilder.cjs +13 -21
  458. package/dist/production/src/mapper/insert/InsertBuilder.cjs.map +1 -1
  459. package/dist/production/src/mapper/insert/InsertBuilder.js +14 -22
  460. package/dist/production/src/mapper/insert/InsertBuilder.js.map +1 -1
  461. package/dist/production/src/mapper/insert/InsertBuilderFactory.cjs.map +1 -1
  462. package/dist/production/src/mapper/insert/InsertBuilderFactory.js.map +1 -1
  463. package/dist/production/src/mapper/insert/Inserter.cjs +43 -21
  464. package/dist/production/src/mapper/insert/Inserter.cjs.map +1 -1
  465. package/dist/production/src/mapper/insert/Inserter.js +45 -23
  466. package/dist/production/src/mapper/insert/Inserter.js.map +1 -1
  467. package/dist/production/src/mapper/insert/SqlCreateInputProcessor.cjs +23 -79
  468. package/dist/production/src/mapper/insert/SqlCreateInputProcessor.cjs.map +1 -1
  469. package/dist/production/src/mapper/insert/SqlCreateInputProcessor.js +23 -79
  470. package/dist/production/src/mapper/insert/SqlCreateInputProcessor.js.map +1 -1
  471. package/dist/production/src/mapper/insert/relations/ManyHasManyCreateInputProcessor.cjs +43 -0
  472. package/dist/production/src/mapper/insert/relations/ManyHasManyCreateInputProcessor.cjs.map +1 -0
  473. package/dist/production/src/mapper/insert/relations/ManyHasManyCreateInputProcessor.js +43 -0
  474. package/dist/production/src/mapper/insert/relations/ManyHasManyCreateInputProcessor.js.map +1 -0
  475. package/dist/production/src/mapper/insert/relations/ManyHasOneCreateInputProcessor.cjs +40 -0
  476. package/dist/production/src/mapper/insert/relations/ManyHasOneCreateInputProcessor.cjs.map +1 -0
  477. package/dist/production/src/mapper/insert/relations/ManyHasOneCreateInputProcessor.js +40 -0
  478. package/dist/production/src/mapper/insert/relations/ManyHasOneCreateInputProcessor.js.map +1 -0
  479. package/dist/production/src/mapper/insert/relations/OneHasManyCreateInputProcessor.cjs +38 -0
  480. package/dist/production/src/mapper/insert/relations/OneHasManyCreateInputProcessor.cjs.map +1 -0
  481. package/dist/production/src/mapper/insert/relations/OneHasManyCreateInputProcessor.js +38 -0
  482. package/dist/production/src/mapper/insert/relations/OneHasManyCreateInputProcessor.js.map +1 -0
  483. package/dist/production/src/mapper/{relations → insert/relations}/OneHasOneInverseCreateInputProcessor.cjs +23 -32
  484. package/dist/production/src/mapper/insert/relations/OneHasOneInverseCreateInputProcessor.cjs.map +1 -0
  485. package/dist/production/src/mapper/{relations → insert/relations}/OneHasOneInverseCreateInputProcessor.js +23 -32
  486. package/dist/production/src/mapper/insert/relations/OneHasOneInverseCreateInputProcessor.js.map +1 -0
  487. package/dist/production/src/mapper/insert/relations/OneHasOneOwningCreateInputProcessor.cjs +65 -0
  488. package/dist/production/src/mapper/insert/relations/OneHasOneOwningCreateInputProcessor.cjs.map +1 -0
  489. package/dist/production/src/mapper/insert/relations/OneHasOneOwningCreateInputProcessor.js +65 -0
  490. package/dist/production/src/mapper/insert/relations/OneHasOneOwningCreateInputProcessor.js.map +1 -0
  491. package/dist/production/src/mapper/select/ConditionBuilder.cjs.map +1 -1
  492. package/dist/production/src/mapper/select/ConditionBuilder.js.map +1 -1
  493. package/dist/production/src/mapper/select/JoinBuilder.cjs.map +1 -1
  494. package/dist/production/src/mapper/select/JoinBuilder.js.map +1 -1
  495. package/dist/production/src/mapper/select/JoinVisitor.cjs.map +1 -1
  496. package/dist/production/src/mapper/select/JoinVisitor.js.map +1 -1
  497. package/dist/production/src/mapper/select/OrderByBuilder.cjs.map +1 -1
  498. package/dist/production/src/mapper/select/OrderByBuilder.js.map +1 -1
  499. package/dist/production/src/mapper/select/OrderByHelper.cjs.map +1 -1
  500. package/dist/production/src/mapper/select/OrderByHelper.js.map +1 -1
  501. package/dist/production/src/mapper/select/Path.cjs.map +1 -1
  502. package/dist/production/src/mapper/select/Path.js.map +1 -1
  503. package/dist/production/src/mapper/select/RelationFetcher.cjs.map +1 -1
  504. package/dist/production/src/mapper/select/RelationFetcher.js.map +1 -1
  505. package/dist/production/src/mapper/select/SelectBuilder.cjs.map +1 -1
  506. package/dist/production/src/mapper/select/SelectBuilder.js.map +1 -1
  507. package/dist/production/src/mapper/select/SelectHydrator.cjs.map +1 -1
  508. package/dist/production/src/mapper/select/SelectHydrator.js.map +1 -1
  509. package/dist/production/src/mapper/select/WhereBuilder.cjs.map +1 -1
  510. package/dist/production/src/mapper/select/WhereBuilder.js.map +1 -1
  511. package/dist/production/src/mapper/select/handlers/FieldsVisitor.cjs +3 -0
  512. package/dist/production/src/mapper/select/handlers/FieldsVisitor.cjs.map +1 -1
  513. package/dist/production/src/mapper/select/handlers/FieldsVisitor.js +3 -0
  514. package/dist/production/src/mapper/select/handlers/FieldsVisitor.js.map +1 -1
  515. package/dist/production/src/mapper/select/handlers/FieldsVisitorFactory.cjs.map +1 -1
  516. package/dist/production/src/mapper/select/handlers/FieldsVisitorFactory.js.map +1 -1
  517. package/dist/production/src/mapper/select/handlers/MetaHandler.cjs.map +1 -1
  518. package/dist/production/src/mapper/select/handlers/MetaHandler.js.map +1 -1
  519. package/dist/production/src/mapper/select/optimizer/ConditionOptimizer.cjs.map +1 -1
  520. package/dist/production/src/mapper/select/optimizer/ConditionOptimizer.js.map +1 -1
  521. package/dist/production/src/mapper/select/optimizer/WhereOptimizer.cjs.map +1 -1
  522. package/dist/production/src/mapper/select/optimizer/WhereOptimizer.js.map +1 -1
  523. package/dist/production/src/mapper/select/optimizer/WhereReplacer.cjs.map +1 -1
  524. package/dist/production/src/mapper/select/optimizer/WhereReplacer.js.map +1 -1
  525. package/dist/production/src/mapper/select/optimizer/helpers.cjs.map +1 -1
  526. package/dist/production/src/mapper/select/optimizer/helpers.js.map +1 -1
  527. package/dist/production/src/mapper/update/SqlUpdateInputProcessor.cjs +36 -36
  528. package/dist/production/src/mapper/update/SqlUpdateInputProcessor.cjs.map +1 -1
  529. package/dist/production/src/mapper/update/SqlUpdateInputProcessor.js +36 -36
  530. package/dist/production/src/mapper/update/SqlUpdateInputProcessor.js.map +1 -1
  531. package/dist/production/src/mapper/update/UpdateBuilder.cjs +14 -19
  532. package/dist/production/src/mapper/update/UpdateBuilder.cjs.map +1 -1
  533. package/dist/production/src/mapper/update/UpdateBuilder.js +15 -20
  534. package/dist/production/src/mapper/update/UpdateBuilder.js.map +1 -1
  535. package/dist/production/src/mapper/update/UpdateBuilderFactory.cjs.map +1 -1
  536. package/dist/production/src/mapper/update/UpdateBuilderFactory.js.map +1 -1
  537. package/dist/production/src/mapper/update/Updater.cjs +45 -17
  538. package/dist/production/src/mapper/update/Updater.cjs.map +1 -1
  539. package/dist/production/src/mapper/update/Updater.js +47 -19
  540. package/dist/production/src/mapper/update/Updater.js.map +1 -1
  541. package/dist/production/src/mapper/update/relations/ManyHasManyUpdateInputProcessor.cjs +84 -0
  542. package/dist/production/src/mapper/update/relations/ManyHasManyUpdateInputProcessor.cjs.map +1 -0
  543. package/dist/production/src/mapper/update/relations/ManyHasManyUpdateInputProcessor.js +84 -0
  544. package/dist/production/src/mapper/update/relations/ManyHasManyUpdateInputProcessor.js.map +1 -0
  545. package/dist/production/src/mapper/update/relations/ManyHasOneUpdateInputProcessor.cjs +88 -0
  546. package/dist/production/src/mapper/update/relations/ManyHasOneUpdateInputProcessor.cjs.map +1 -0
  547. package/dist/production/src/mapper/update/relations/ManyHasOneUpdateInputProcessor.js +88 -0
  548. package/dist/production/src/mapper/update/relations/ManyHasOneUpdateInputProcessor.js.map +1 -0
  549. package/dist/production/src/mapper/update/relations/OneHasManyUpdateInputProcessor.cjs +87 -0
  550. package/dist/production/src/mapper/update/relations/OneHasManyUpdateInputProcessor.cjs.map +1 -0
  551. package/dist/production/src/mapper/update/relations/OneHasManyUpdateInputProcessor.js +87 -0
  552. package/dist/production/src/mapper/update/relations/OneHasManyUpdateInputProcessor.js.map +1 -0
  553. package/dist/production/src/mapper/update/relations/OneHasOneInverseUpdateInputProcessor.cjs +147 -0
  554. package/dist/production/src/mapper/update/relations/OneHasOneInverseUpdateInputProcessor.cjs.map +1 -0
  555. package/dist/production/src/mapper/update/relations/OneHasOneInverseUpdateInputProcessor.js +147 -0
  556. package/dist/production/src/mapper/update/relations/OneHasOneInverseUpdateInputProcessor.js.map +1 -0
  557. package/dist/production/src/mapper/update/relations/OneHasOneOwningUpdateInputProcessor.cjs +183 -0
  558. package/dist/production/src/mapper/update/relations/OneHasOneOwningUpdateInputProcessor.cjs.map +1 -0
  559. package/dist/production/src/mapper/update/relations/OneHasOneOwningUpdateInputProcessor.js +183 -0
  560. package/dist/production/src/mapper/update/relations/OneHasOneOwningUpdateInputProcessor.js.map +1 -0
  561. package/dist/production/src/resolvers/GraphQlQueryAstFactory.cjs.map +1 -1
  562. package/dist/production/src/resolvers/GraphQlQueryAstFactory.js.map +1 -1
  563. package/dist/production/src/resolvers/MutationResolver.cjs +8 -4
  564. package/dist/production/src/resolvers/MutationResolver.cjs.map +1 -1
  565. package/dist/production/src/resolvers/MutationResolver.js +8 -4
  566. package/dist/production/src/resolvers/MutationResolver.js.map +1 -1
  567. package/dist/production/src/resolvers/ReadHelpers.cjs.map +1 -1
  568. package/dist/production/src/resolvers/ReadHelpers.js.map +1 -1
  569. package/dist/production/src/resolvers/ReadResolver.cjs.map +1 -1
  570. package/dist/production/src/resolvers/ReadResolver.js.map +1 -1
  571. package/dist/production/src/resolvers/ValidationResolver.cjs.map +1 -1
  572. package/dist/production/src/resolvers/ValidationResolver.js.map +1 -1
  573. package/dist/production/src/schema/ColumnTypeResolver.cjs.map +1 -1
  574. package/dist/production/src/schema/ColumnTypeResolver.js.map +1 -1
  575. package/dist/production/src/schema/ConditionTypeProvider.cjs.map +1 -1
  576. package/dist/production/src/schema/ConditionTypeProvider.js.map +1 -1
  577. package/dist/production/src/schema/CustomTypesProvider.cjs.map +1 -1
  578. package/dist/production/src/schema/CustomTypesProvider.js.map +1 -1
  579. package/dist/production/src/schema/EntityTypeProvider.cjs.map +1 -1
  580. package/dist/production/src/schema/EntityTypeProvider.js.map +1 -1
  581. package/dist/production/src/schema/EnumsProvider.cjs.map +1 -1
  582. package/dist/production/src/schema/EnumsProvider.js.map +1 -1
  583. package/dist/production/src/schema/FieldAccessVisitor.cjs.map +1 -1
  584. package/dist/production/src/schema/FieldAccessVisitor.js.map +1 -1
  585. package/dist/production/src/schema/GraphQlSchemaBuilder.cjs.map +1 -1
  586. package/dist/production/src/schema/GraphQlSchemaBuilder.js.map +1 -1
  587. package/dist/production/src/schema/GraphQlSchemaBuilderFactory.cjs.map +1 -1
  588. package/dist/production/src/schema/GraphQlSchemaBuilderFactory.js.map +1 -1
  589. package/dist/production/src/schema/MutationProvider.cjs.map +1 -1
  590. package/dist/production/src/schema/MutationProvider.js.map +1 -1
  591. package/dist/production/src/schema/OperationExtension.cjs.map +1 -1
  592. package/dist/production/src/schema/OperationExtension.js.map +1 -1
  593. package/dist/production/src/schema/OrderByTypeProvider.cjs.map +1 -1
  594. package/dist/production/src/schema/OrderByTypeProvider.js.map +1 -1
  595. package/dist/production/src/schema/PaginatedFieldConfigFactory.cjs.map +1 -1
  596. package/dist/production/src/schema/PaginatedFieldConfigFactory.js.map +1 -1
  597. package/dist/production/src/schema/QueryProvider.cjs.map +1 -1
  598. package/dist/production/src/schema/QueryProvider.js.map +1 -1
  599. package/dist/production/src/schema/ResultSchemaTypeProvider.cjs.map +1 -1
  600. package/dist/production/src/schema/ResultSchemaTypeProvider.js.map +1 -1
  601. package/dist/production/src/schema/ValidationQueriesProvider.cjs.map +1 -1
  602. package/dist/production/src/schema/ValidationQueriesProvider.js.map +1 -1
  603. package/dist/production/src/schema/WhereTypeProvider.cjs.map +1 -1
  604. package/dist/production/src/schema/WhereTypeProvider.js.map +1 -1
  605. package/dist/production/src/schema/entities/FieldArgsVisitor.cjs.map +1 -1
  606. package/dist/production/src/schema/entities/FieldArgsVisitor.js.map +1 -1
  607. package/dist/production/src/schema/entities/FieldTypeVisitor.cjs.map +1 -1
  608. package/dist/production/src/schema/entities/FieldTypeVisitor.js.map +1 -1
  609. package/dist/production/src/schema/mutations/ConnectOrCreateRelationInputProvider.cjs.map +1 -1
  610. package/dist/production/src/schema/mutations/ConnectOrCreateRelationInputProvider.js.map +1 -1
  611. package/dist/production/src/schema/mutations/CreateEntityInputFieldVisitor.cjs.map +1 -1
  612. package/dist/production/src/schema/mutations/CreateEntityInputFieldVisitor.js.map +1 -1
  613. package/dist/production/src/schema/mutations/CreateEntityRelationAllowedOperationsVisitor.cjs.map +1 -1
  614. package/dist/production/src/schema/mutations/CreateEntityRelationAllowedOperationsVisitor.js.map +1 -1
  615. package/dist/production/src/schema/mutations/CreateEntityRelationInputFieldVisitor.cjs.map +1 -1
  616. package/dist/production/src/schema/mutations/CreateEntityRelationInputFieldVisitor.js.map +1 -1
  617. package/dist/production/src/schema/mutations/CreateEntityRelationInputProvider.cjs.map +1 -1
  618. package/dist/production/src/schema/mutations/CreateEntityRelationInputProvider.js.map +1 -1
  619. package/dist/production/src/schema/mutations/EntityInputProvider.cjs.map +1 -1
  620. package/dist/production/src/schema/mutations/EntityInputProvider.js.map +1 -1
  621. package/dist/production/src/schema/mutations/UpdateEntityInputFieldVisitor.cjs.map +1 -1
  622. package/dist/production/src/schema/mutations/UpdateEntityInputFieldVisitor.js.map +1 -1
  623. package/dist/production/src/schema/mutations/UpdateEntityRelationAllowedOperationsVisitor.cjs.map +1 -1
  624. package/dist/production/src/schema/mutations/UpdateEntityRelationAllowedOperationsVisitor.js.map +1 -1
  625. package/dist/production/src/schema/mutations/UpdateEntityRelationInputFieldVisitor.cjs +2 -0
  626. package/dist/production/src/schema/mutations/UpdateEntityRelationInputFieldVisitor.cjs.map +1 -1
  627. package/dist/production/src/schema/mutations/UpdateEntityRelationInputFieldVisitor.js +2 -0
  628. package/dist/production/src/schema/mutations/UpdateEntityRelationInputFieldVisitor.js.map +1 -1
  629. package/dist/production/src/schema/mutations/UpdateEntityRelationInputProvider.cjs.map +1 -1
  630. package/dist/production/src/schema/mutations/UpdateEntityRelationInputProvider.js.map +1 -1
  631. package/dist/production/src/schema/utils.cjs.map +1 -1
  632. package/dist/production/src/schema/utils.js.map +1 -1
  633. package/dist/production/src/utils/Mutex.cjs.map +1 -1
  634. package/dist/production/src/utils/Mutex.js.map +1 -1
  635. package/dist/production/src/utils/ResolveInfoUtils.cjs.map +1 -1
  636. package/dist/production/src/utils/ResolveInfoUtils.js.map +1 -1
  637. package/dist/production/src/utils/accessor.cjs.map +1 -1
  638. package/dist/production/src/utils/accessor.js.map +1 -1
  639. package/dist/production/src/utils/isIt.cjs.map +1 -1
  640. package/dist/production/src/utils/isIt.js.map +1 -1
  641. package/dist/production/src/utils/object.cjs.map +1 -1
  642. package/dist/production/src/utils/object.js.map +1 -1
  643. package/dist/production/src/utils/paginationUtils.cjs.map +1 -1
  644. package/dist/production/src/utils/paginationUtils.js.map +1 -1
  645. package/dist/production/src/utils/singletonFactory.cjs.map +1 -1
  646. package/dist/production/src/utils/singletonFactory.js.map +1 -1
  647. package/dist/production/src/utils/uniqueWhereFields.cjs.map +1 -1
  648. package/dist/production/src/utils/uniqueWhereFields.js.map +1 -1
  649. package/dist/tests/cases/integration/graphQlRequests/insert/jsonInsert.test.d.ts +2 -0
  650. package/dist/tests/cases/integration/graphQlRequests/insert/jsonInsert.test.d.ts.map +1 -0
  651. package/dist/tests/cases/integration/graphQlRequests/update/manyHasManyOwning/connectOrCreate.test.d.ts +2 -0
  652. package/dist/tests/cases/integration/graphQlRequests/update/manyHasManyOwning/connectOrCreate.test.d.ts.map +1 -0
  653. package/dist/tests/cases/integration/graphQlRequests/update/oneHasMany/connectOrCreate.test.d.ts +2 -0
  654. package/dist/tests/cases/integration/graphQlRequests/update/oneHasMany/connectOrCreate.test.d.ts.map +1 -0
  655. package/dist/tests/cases/integration/graphQlRequests/validation/conditions.test.d.ts +2 -2
  656. package/dist/tests/cases/integration/graphQlRequests/validation/conditions.test.d.ts.map +1 -1
  657. package/dist/tests/cases/integration/graphQlRequests/validation/requiredWhen.test.d.ts +1 -1
  658. package/dist/tests/cases/integration/graphQlRequests/validation/requiredWhen.test.d.ts.map +1 -1
  659. package/dist/tests/cases/integration/graphQlSchema/model.d.ts +4 -4
  660. package/dist/tests/cases/integration/graphQlSchema/model.d.ts.map +1 -1
  661. package/dist/tests/src/assert.d.ts +5 -0
  662. package/dist/tests/src/assert.d.ts.map +1 -0
  663. package/dist/tests/src/test.d.ts.map +1 -1
  664. package/dist/tests/tsconfig.tsbuildinfo +1 -1
  665. package/dist/types/ExecutionContainer.d.ts +8 -5
  666. package/dist/types/ExecutionContainer.d.ts.map +1 -1
  667. package/dist/types/extensions/hasManyToHasOneReducer/HasManyToHasOneRelationReducerVisitor.d.ts.map +1 -1
  668. package/dist/types/input-validation/ColumnValueResolver.d.ts +1 -1
  669. package/dist/types/input-validation/ColumnValueResolver.d.ts.map +1 -1
  670. package/dist/types/input-validation/ValidationDataSelector.d.ts +1 -1
  671. package/dist/types/input-validation/preValidation/CreateInputPreValidationProcessor.d.ts +3 -3
  672. package/dist/types/input-validation/preValidation/CreateInputPreValidationProcessor.d.ts.map +1 -1
  673. package/dist/types/input-validation/preValidation/InputPreValidator.d.ts +3 -3
  674. package/dist/types/input-validation/preValidation/InputPreValidator.d.ts.map +1 -1
  675. package/dist/types/input-validation/preValidation/UpdateInputPreValidationProcessor.d.ts +4 -4
  676. package/dist/types/input-validation/preValidation/UpdateInputPreValidationProcessor.d.ts.map +1 -1
  677. package/dist/types/inputProcessing/CreateInputProcessor.d.ts +8 -6
  678. package/dist/types/inputProcessing/CreateInputProcessor.d.ts.map +1 -1
  679. package/dist/types/inputProcessing/CreateInputVisitor.d.ts +11 -10
  680. package/dist/types/inputProcessing/CreateInputVisitor.d.ts.map +1 -1
  681. package/dist/types/inputProcessing/UpdateInputProcessor.d.ts +14 -12
  682. package/dist/types/inputProcessing/UpdateInputProcessor.d.ts.map +1 -1
  683. package/dist/types/inputProcessing/UpdateInputVisitor.d.ts +11 -10
  684. package/dist/types/inputProcessing/UpdateInputVisitor.d.ts.map +1 -1
  685. package/dist/types/introspection/IntrospectionSchemaDefinitionFactory.d.ts +1 -3
  686. package/dist/types/introspection/IntrospectionSchemaDefinitionFactory.d.ts.map +1 -1
  687. package/dist/types/introspection/index.d.ts +2 -1
  688. package/dist/types/introspection/index.d.ts.map +1 -1
  689. package/dist/types/introspection/introspection.schema.d.ts +5 -0
  690. package/dist/types/introspection/introspection.schema.d.ts.map +1 -0
  691. package/dist/types/mapper/ColumnValue.d.ts +4 -8
  692. package/dist/types/mapper/ColumnValue.d.ts.map +1 -1
  693. package/dist/types/mapper/EventManager.d.ts +9 -9
  694. package/dist/types/mapper/EventManager.d.ts.map +1 -1
  695. package/dist/types/mapper/Mapper.d.ts +6 -7
  696. package/dist/types/mapper/Mapper.d.ts.map +1 -1
  697. package/dist/types/mapper/MutationProcessorHelper.d.ts +2 -2
  698. package/dist/types/mapper/MutationProcessorHelper.d.ts.map +1 -1
  699. package/dist/types/mapper/Result.d.ts +16 -9
  700. package/dist/types/mapper/Result.d.ts.map +1 -1
  701. package/dist/types/mapper/delete/DeleteExecutor.d.ts.map +1 -1
  702. package/dist/types/mapper/insert/InsertBuilder.d.ts +4 -9
  703. package/dist/types/mapper/insert/InsertBuilder.d.ts.map +1 -1
  704. package/dist/types/mapper/insert/Inserter.d.ts +3 -3
  705. package/dist/types/mapper/insert/Inserter.d.ts.map +1 -1
  706. package/dist/types/mapper/insert/SqlCreateInputProcessor.d.ts +11 -8
  707. package/dist/types/mapper/insert/SqlCreateInputProcessor.d.ts.map +1 -1
  708. package/dist/types/mapper/insert/relations/ManyHasManyCreateInputProcessor.d.ts +26 -0
  709. package/dist/types/mapper/insert/relations/ManyHasManyCreateInputProcessor.d.ts.map +1 -0
  710. package/dist/types/mapper/insert/relations/ManyHasOneCreateInputProcessor.d.ts +25 -0
  711. package/dist/types/mapper/insert/relations/ManyHasOneCreateInputProcessor.d.ts.map +1 -0
  712. package/dist/types/mapper/insert/relations/OneHasManyCreateInputProcessor.d.ts +28 -0
  713. package/dist/types/mapper/insert/relations/OneHasManyCreateInputProcessor.d.ts.map +1 -0
  714. package/dist/types/mapper/insert/relations/OneHasOneInverseCreateInputProcessor.d.ts +31 -0
  715. package/dist/types/mapper/insert/relations/OneHasOneInverseCreateInputProcessor.d.ts.map +1 -0
  716. package/dist/types/mapper/insert/relations/OneHasOneOwningCreateInputProcessor.d.ts +26 -0
  717. package/dist/types/mapper/insert/relations/OneHasOneOwningCreateInputProcessor.d.ts.map +1 -0
  718. package/dist/types/mapper/select/handlers/FieldsVisitor.d.ts.map +1 -1
  719. package/dist/types/mapper/types.d.ts +84 -1
  720. package/dist/types/mapper/types.d.ts.map +1 -1
  721. package/dist/types/mapper/update/SqlUpdateInputProcessor.d.ts +12 -8
  722. package/dist/types/mapper/update/SqlUpdateInputProcessor.d.ts.map +1 -1
  723. package/dist/types/mapper/update/UpdateBuilder.d.ts +4 -8
  724. package/dist/types/mapper/update/UpdateBuilder.d.ts.map +1 -1
  725. package/dist/types/mapper/update/Updater.d.ts +2 -2
  726. package/dist/types/mapper/update/Updater.d.ts.map +1 -1
  727. package/dist/types/mapper/update/relations/ManyHasManyUpdateInputProcessor.d.ts +48 -0
  728. package/dist/types/mapper/update/relations/ManyHasManyUpdateInputProcessor.d.ts.map +1 -0
  729. package/dist/types/mapper/update/relations/ManyHasOneUpdateInputProcessor.d.ts +42 -0
  730. package/dist/types/mapper/update/relations/ManyHasOneUpdateInputProcessor.d.ts.map +1 -0
  731. package/dist/types/mapper/update/relations/OneHasManyUpdateInputProcessor.d.ts +48 -0
  732. package/dist/types/mapper/update/relations/OneHasManyUpdateInputProcessor.d.ts.map +1 -0
  733. package/dist/types/mapper/update/relations/OneHasOneInverseUpdateInputProcessor.d.ts +38 -0
  734. package/dist/types/mapper/update/relations/OneHasOneInverseUpdateInputProcessor.d.ts.map +1 -0
  735. package/dist/types/mapper/update/relations/OneHasOneOwningUpdateInputProcessor.d.ts +42 -0
  736. package/dist/types/mapper/update/relations/OneHasOneOwningUpdateInputProcessor.d.ts.map +1 -0
  737. package/dist/types/resolvers/MutationResolver.d.ts.map +1 -1
  738. package/dist/types/schema/mutations/UpdateEntityRelationInputFieldVisitor.d.ts.map +1 -1
  739. package/dist/types/tsconfig.tsbuildinfo +1 -1
  740. package/graphql.codegen.yml +2 -2
  741. package/package.json +14 -18
  742. package/src/ExecutionContainer.ts +5 -2
  743. package/src/extensions/hasManyToHasOneReducer/HasManyToHasOneRelationReducerVisitor.ts +35 -2
  744. package/src/input-validation/ColumnValueResolver.ts +1 -1
  745. package/src/input-validation/preValidation/CreateInputPreValidationProcessor.ts +2 -2
  746. package/src/input-validation/preValidation/InputPreValidator.ts +10 -12
  747. package/src/input-validation/preValidation/UpdateInputPreValidationProcessor.ts +3 -3
  748. package/src/inputProcessing/CreateInputProcessor.ts +8 -6
  749. package/src/inputProcessing/CreateInputVisitor.ts +32 -33
  750. package/src/inputProcessing/UpdateInputProcessor.ts +13 -11
  751. package/src/inputProcessing/UpdateInputVisitor.ts +44 -40
  752. package/src/introspection/IntrospectionSchemaDefinitionFactory.ts +2 -194
  753. package/src/introspection/index.ts +2 -1
  754. package/src/introspection/introspection.schema.ts +194 -0
  755. package/src/mapper/ColumnValue.ts +11 -25
  756. package/src/mapper/ErrorUtils.ts +1 -1
  757. package/src/mapper/EventManager.ts +9 -13
  758. package/src/mapper/Mapper.ts +19 -37
  759. package/src/mapper/MutationProcessorHelper.ts +16 -8
  760. package/src/mapper/Result.ts +14 -49
  761. package/src/mapper/delete/DeleteExecutor.ts +4 -8
  762. package/src/mapper/insert/InsertBuilder.ts +23 -34
  763. package/src/mapper/insert/Inserter.ts +55 -41
  764. package/src/mapper/insert/SqlCreateInputProcessor.ts +36 -91
  765. package/src/mapper/insert/relations/ManyHasManyCreateInputProcessor.ts +59 -0
  766. package/src/mapper/insert/relations/ManyHasOneCreateInputProcessor.ts +57 -0
  767. package/src/mapper/insert/relations/OneHasManyCreateInputProcessor.ts +52 -0
  768. package/src/mapper/insert/relations/OneHasOneInverseCreateInputProcessor.ts +90 -0
  769. package/src/mapper/insert/relations/OneHasOneOwningCreateInputProcessor.ts +87 -0
  770. package/src/mapper/select/handlers/FieldsVisitor.ts +3 -0
  771. package/src/mapper/types.ts +115 -1
  772. package/src/mapper/update/SqlUpdateInputProcessor.ts +50 -47
  773. package/src/mapper/update/UpdateBuilder.ts +25 -31
  774. package/src/mapper/update/Updater.ts +55 -35
  775. package/src/mapper/update/relations/ManyHasManyUpdateInputProcessor.ts +112 -0
  776. package/src/mapper/update/relations/ManyHasOneUpdateInputProcessor.ts +125 -0
  777. package/src/mapper/update/relations/OneHasManyUpdateInputProcessor.ts +113 -0
  778. package/src/mapper/update/relations/OneHasOneInverseUpdateInputProcessor.ts +184 -0
  779. package/src/mapper/update/relations/OneHasOneOwningUpdateInputProcessor.ts +240 -0
  780. package/src/resolvers/MutationResolver.ts +6 -4
  781. package/src/schema/mutations/UpdateEntityRelationInputFieldVisitor.ts +5 -0
  782. package/tests/cases/bugs/bug-filter-or.test.ts +1 -1
  783. package/tests/cases/bugs/bug-update-by-nested-unique.test.ts +1 -1
  784. package/tests/cases/bugs/bug102.test.ts +1 -1
  785. package/tests/cases/integration/graphQlRequests/delete/aclDelete.test.ts +1 -1
  786. package/tests/cases/integration/graphQlRequests/delete/additionalDeleteFilter.test.ts +1 -1
  787. package/tests/cases/integration/graphQlRequests/delete/cascadeDelete.test.ts +1 -1
  788. package/tests/cases/integration/graphQlRequests/delete/deleteById.test.ts +1 -1
  789. package/tests/cases/integration/graphQlRequests/delete/orphanRemoval.test.ts +1 -1
  790. package/tests/cases/integration/graphQlRequests/delete/restrictOnDelete.test.ts +1 -1
  791. package/tests/cases/integration/graphQlRequests/delete/setNullOnDelete.test.ts +1 -1
  792. package/tests/cases/integration/graphQlRequests/insert/acl/setField.test.ts +1 -1
  793. package/tests/cases/integration/graphQlRequests/insert/aclInsert.test.ts +1 -1
  794. package/tests/cases/integration/graphQlRequests/insert/basicInsert.test.ts +1 -1
  795. package/tests/cases/integration/graphQlRequests/insert/insertCustomId.test.ts +1 -1
  796. package/tests/cases/integration/graphQlRequests/insert/jsonInsert.test.ts +37 -0
  797. package/tests/cases/integration/graphQlRequests/insert/manyHasManyInverse/create.test.ts +1 -1
  798. package/tests/cases/integration/graphQlRequests/insert/manyHasManyOwning/create.test.ts +1 -1
  799. package/tests/cases/integration/graphQlRequests/insert/manyHasOne/connectOrCreate.test.ts +1 -1
  800. package/tests/cases/integration/graphQlRequests/insert/manyHasOne/create.test.ts +1 -1
  801. package/tests/cases/integration/graphQlRequests/insert/oneHasMany/connect.test.ts +1 -1
  802. package/tests/cases/integration/graphQlRequests/insert/oneHasMany/create.test.ts +9 -9
  803. package/tests/cases/integration/graphQlRequests/insert/oneHasOneInverse/create.test.ts +1 -1
  804. package/tests/cases/integration/graphQlRequests/insert/oneHasOneOwning/create.test.ts +1 -1
  805. package/tests/cases/integration/graphQlRequests/insert/oneHasOneOwning/empty.test.ts +1 -1
  806. package/tests/cases/integration/graphQlRequests/insert/validation/toBeFixed.test.ts +1 -1
  807. package/tests/cases/integration/graphQlRequests/query/acl/differentRowAndFieldPredicate.test.ts +1 -1
  808. package/tests/cases/integration/graphQlRequests/query/acl/fieldRestrictedByLocale.test.ts +1 -1
  809. package/tests/cases/integration/graphQlRequests/query/acl/isNullAcl.test.ts +1 -1
  810. package/tests/cases/integration/graphQlRequests/query/acl/nestedPredicate.test.ts +1 -1
  811. package/tests/cases/integration/graphQlRequests/query/acl/orPredicate.test.ts +1 -1
  812. package/tests/cases/integration/graphQlRequests/query/acl/predicateElimination.test.ts +1 -1
  813. package/tests/cases/integration/graphQlRequests/query/acl/relationAcl.test.ts +1 -1
  814. package/tests/cases/integration/graphQlRequests/query/acl/rowPredicateSubset.test.ts +1 -1
  815. package/tests/cases/integration/graphQlRequests/query/acl/sameRowAndFieldPredicate.test.ts +1 -1
  816. package/tests/cases/integration/graphQlRequests/query/filter/backReferencedFilter.test.ts +1 -1
  817. package/tests/cases/integration/graphQlRequests/query/filter/complexCondition.test.ts +1 -1
  818. package/tests/cases/integration/graphQlRequests/query/filter/composedFilter.test.ts +1 -1
  819. package/tests/cases/integration/graphQlRequests/query/filter/containsQuery.test.ts +1 -1
  820. package/tests/cases/integration/graphQlRequests/query/filter/manyHasManyOwnerRelation.test.ts +1 -1
  821. package/tests/cases/integration/graphQlRequests/query/filter/manyHasOneRelation.test.ts +1 -1
  822. package/tests/cases/integration/graphQlRequests/query/filter/oneHasManyRelation.test.ts +1 -1
  823. package/tests/cases/integration/graphQlRequests/query/formatting/dateFormat.test.ts +1 -1
  824. package/tests/cases/integration/graphQlRequests/query/graphqlFeatures/alias.test.ts +1 -1
  825. package/tests/cases/integration/graphQlRequests/query/graphqlFeatures/fragments.test.ts +1 -1
  826. package/tests/cases/integration/graphQlRequests/query/misc/aliasedType.test.ts +1 -1
  827. package/tests/cases/integration/graphQlRequests/query/misc/longAliasHash.test.ts +1 -1
  828. package/tests/cases/integration/graphQlRequests/query/misc/reducedHasMany.test.ts +70 -1
  829. package/tests/cases/integration/graphQlRequests/query/misc/transaction.test.ts +1 -1
  830. package/tests/cases/integration/graphQlRequests/query/pagination/hasManyLimit.test.ts +1 -1
  831. package/tests/cases/integration/graphQlRequests/query/pagination/paginate.test.ts +1 -1
  832. package/tests/cases/integration/graphQlRequests/query/pagination/paginateAliased.test.ts +1 -1
  833. package/tests/cases/integration/graphQlRequests/query/pagination/simpleLimit.test.ts +1 -1
  834. package/tests/cases/integration/graphQlRequests/query/relations/advanced.test.ts +1 -1
  835. package/tests/cases/integration/graphQlRequests/query/relations/manyHasManyInverse.test.ts +1 -1
  836. package/tests/cases/integration/graphQlRequests/query/relations/manyHasManyOwning.test.ts +2 -2
  837. package/tests/cases/integration/graphQlRequests/query/relations/manyHasOne.test.ts +1 -1
  838. package/tests/cases/integration/graphQlRequests/query/relations/oneHasMany.test.ts +1 -1
  839. package/tests/cases/integration/graphQlRequests/query/relations/oneHasOneInverse.test.ts +1 -1
  840. package/tests/cases/integration/graphQlRequests/query/relations/oneHasOneOwner.test.ts +1 -1
  841. package/tests/cases/integration/graphQlRequests/query/sorting/byRelations.test.ts +1 -1
  842. package/tests/cases/integration/graphQlRequests/query/sorting/defaultOrdering.test.ts +1 -1
  843. package/tests/cases/integration/graphQlRequests/query/sorting/orderBy.test.ts +1 -1
  844. package/tests/cases/integration/graphQlRequests/query/sorting/randomSort.test.ts +1 -1
  845. package/tests/cases/integration/graphQlRequests/query/sorting/sortNulls.test.ts +1 -1
  846. package/tests/cases/integration/graphQlRequests/query/sorting/sortedHasMany.test.ts +1 -1
  847. package/tests/cases/integration/graphQlRequests/query/unique/basicQueryById.test.ts +1 -1
  848. package/tests/cases/integration/graphQlRequests/query/unique/composedUnique.test.ts +1 -1
  849. package/tests/cases/integration/graphQlRequests/query/unique/oneHasManyUnique.test.ts +1 -1
  850. package/tests/cases/integration/graphQlRequests/query/unique/uniqueWithFilter.test.ts +1 -1
  851. package/tests/cases/integration/graphQlRequests/query/view/view.test.ts +1 -1
  852. package/tests/cases/integration/graphQlRequests/update/acl/aclUpdate.test.ts +1 -1
  853. package/tests/cases/integration/graphQlRequests/update/additionalFilter.test.ts +1 -1
  854. package/tests/cases/integration/graphQlRequests/update/basic/columnUpdate.test.ts +1 -1
  855. package/tests/cases/integration/graphQlRequests/update/manyHasManyInverse/connect.test.ts +1 -1
  856. package/tests/cases/integration/graphQlRequests/update/manyHasManyInverse/create.test.ts +1 -1
  857. package/tests/cases/integration/graphQlRequests/update/manyHasManyInverse/delete.test.ts +1 -1
  858. package/tests/cases/integration/graphQlRequests/update/manyHasManyInverse/disconnect.test.ts +1 -1
  859. package/tests/cases/integration/graphQlRequests/update/manyHasManyInverse/update.test.ts +1 -1
  860. package/tests/cases/integration/graphQlRequests/update/manyHasManyInverse/upsert.test.ts +1 -1
  861. package/tests/cases/integration/graphQlRequests/update/manyHasManyOwning/connect.test.ts +1 -1
  862. package/tests/cases/integration/graphQlRequests/update/manyHasManyOwning/connectOrCreate.test.ts +100 -0
  863. package/tests/cases/integration/graphQlRequests/update/manyHasManyOwning/create.test.ts +1 -1
  864. package/tests/cases/integration/graphQlRequests/update/manyHasManyOwning/delete.test.ts +1 -1
  865. package/tests/cases/integration/graphQlRequests/update/manyHasManyOwning/disconnect.test.ts +1 -1
  866. package/tests/cases/integration/graphQlRequests/update/manyHasManyOwning/update.test.ts +1 -1
  867. package/tests/cases/integration/graphQlRequests/update/manyHasManyOwning/upsert.test.ts +1 -1
  868. package/tests/cases/integration/graphQlRequests/update/manyHasOne/connect.test.ts +1 -1
  869. package/tests/cases/integration/graphQlRequests/update/manyHasOne/create.test.ts +1 -1
  870. package/tests/cases/integration/graphQlRequests/update/manyHasOne/delete.test.ts +1 -1
  871. package/tests/cases/integration/graphQlRequests/update/manyHasOne/disconnect.test.ts +1 -1
  872. package/tests/cases/integration/graphQlRequests/update/manyHasOne/update.test.ts +1 -6
  873. package/tests/cases/integration/graphQlRequests/update/manyHasOne/upsert.test.ts +1 -6
  874. package/tests/cases/integration/graphQlRequests/update/oneHasMany/combination.test.ts +1 -1
  875. package/tests/cases/integration/graphQlRequests/update/oneHasMany/connect.test.ts +1 -1
  876. package/tests/cases/integration/graphQlRequests/update/oneHasMany/connectOrCreate.test.ts +90 -0
  877. package/tests/cases/integration/graphQlRequests/update/oneHasMany/create.test.ts +1 -1
  878. package/tests/cases/integration/graphQlRequests/update/oneHasMany/delete.test.ts +1 -1
  879. package/tests/cases/integration/graphQlRequests/update/oneHasMany/disconnect.test.ts +1 -1
  880. package/tests/cases/integration/graphQlRequests/update/oneHasMany/update.test.ts +1 -1
  881. package/tests/cases/integration/graphQlRequests/update/oneHasMany/upsert.test.ts +1 -1
  882. package/tests/cases/integration/graphQlRequests/update/oneHasOneInverse/connect.test.ts +1 -1
  883. package/tests/cases/integration/graphQlRequests/update/oneHasOneInverse/create.test.ts +1 -1
  884. package/tests/cases/integration/graphQlRequests/update/oneHasOneInverse/delete.test.ts +1 -1
  885. package/tests/cases/integration/graphQlRequests/update/oneHasOneInverse/disconnect.test.ts +1 -1
  886. package/tests/cases/integration/graphQlRequests/update/oneHasOneInverse/update.test.ts +1 -1
  887. package/tests/cases/integration/graphQlRequests/update/oneHasOneInverse/upsert.test.ts +10 -1
  888. package/tests/cases/integration/graphQlRequests/update/oneHasOneOwning/connect.test.ts +1 -1
  889. package/tests/cases/integration/graphQlRequests/update/oneHasOneOwning/connectOrCreate.test.ts +1 -1
  890. package/tests/cases/integration/graphQlRequests/update/oneHasOneOwning/create.test.ts +1 -1
  891. package/tests/cases/integration/graphQlRequests/update/oneHasOneOwning/delete.test.ts +1 -1
  892. package/tests/cases/integration/graphQlRequests/update/oneHasOneOwning/disconnect.test.ts +1 -1
  893. package/tests/cases/integration/graphQlRequests/update/oneHasOneOwning/update.test.ts +1 -6
  894. package/tests/cases/integration/graphQlRequests/update/oneHasOneOwning/upsert.test.ts +1 -6
  895. package/tests/cases/integration/graphQlRequests/update/queryPortal.test.ts +1 -1
  896. package/tests/cases/integration/graphQlRequests/update/transaction.test.ts +1 -1
  897. package/tests/cases/integration/graphQlRequests/update/validation/toBeFixed.test.ts +1 -1
  898. package/tests/cases/integration/graphQlRequests/upsert/basicUpsert.test.ts +1 -1
  899. package/tests/cases/integration/graphQlRequests/validation/conditions.test.ts +1 -1
  900. package/tests/cases/integration/graphQlRequests/validation/nestedValidation.test.ts +1 -1
  901. package/tests/cases/integration/graphQlRequests/validation/optionalAssert.test.ts +1 -1
  902. package/tests/cases/integration/graphQlRequests/validation/required.test.ts +1 -1
  903. package/tests/cases/integration/graphQlRequests/validation/requiredWhen.test.ts +1 -1
  904. package/tests/cases/integration/graphQlRequests/validation/rules/andRule.test.ts +1 -1
  905. package/tests/cases/integration/graphQlRequests/validation/rules/lengthRangeRule.test.ts +1 -1
  906. package/tests/cases/integration/graphQlRequests/validation/rules/maxLengthRule.test.ts +1 -1
  907. package/tests/cases/integration/graphQlRequests/validation/rules/minLength.test.ts +1 -1
  908. package/tests/cases/integration/graphQlRequests/validation/rules/notEmptyRule.test.ts +1 -1
  909. package/tests/cases/integration/graphQlRequests/validation/rules/notRule.test.ts +1 -1
  910. package/tests/cases/integration/graphQlRequests/validation/rules/orRule.test.ts +1 -1
  911. package/tests/cases/integration/graphQlRequests/validation/rules/patternRule.test.ts +1 -2
  912. package/tests/cases/integration/graphQlRequests/validation/rules/rangeRule.test.ts +1 -1
  913. package/tests/cases/integration/graphQlSchema/graphQlSchemaBuilder.test.ts +4 -4
  914. package/tests/cases/integration/graphQlSchema/schema-acl-allowed.gql +6 -0
  915. package/tests/cases/integration/graphQlSchema/schema-acl-create-only.gql +28 -28
  916. package/tests/cases/integration/graphQlSchema/schema-acl-restricted-create.gql +5 -0
  917. package/tests/cases/integration/graphQlSchema/schema-acl-restricted-delete.gql +6 -0
  918. package/tests/cases/integration/graphQlSchema/schema-acl-restricted-update.gql +5 -0
  919. package/tests/cases/integration/graphQlSchema/schema-basic.gql +15 -0
  920. package/tests/cases/integration/graphQlSchema/schema-bug-66.gql +7 -0
  921. package/tests/cases/integration/graphQlSchema/schema-custom-primary.gql +15 -0
  922. package/tests/cases/integration/graphQlSchema/schema-has-many-reduction.gql +7 -0
  923. package/tests/cases/integration/graphQlSchema/schema-new-builder.gql +123 -107
  924. package/tests/cases/unit/aclVariablesFactory.test.ts +5 -5
  925. package/tests/cases/unit/conditionOptimizer.test.ts +7 -1
  926. package/tests/cases/unit/inputPreValidator.test.ts +3 -2
  927. package/tests/cases/unit/inputValidation.test.ts +7 -6
  928. package/tests/cases/unit/orderbyHelper.test.ts +3 -2
  929. package/tests/cases/unit/permissionMerger.test.ts +2 -1
  930. package/tests/cases/unit/predicatesFactory.test.ts +2 -1
  931. package/tests/cases/unit/predicatesInjector.test.ts +2 -1
  932. package/tests/cases/unit/uuidType.test.ts +5 -5
  933. package/tests/cases/unit/variableInjector.test.ts +2 -1
  934. package/tests/cases/unit/whereBuilder.test.ts +2 -1
  935. package/tests/cases/unit/whereOptimizer.test.ts +2 -1
  936. package/tests/src/assert.ts +10 -0
  937. package/tests/src/test.ts +4 -1
  938. package/tests/src/testGraphql.ts +3 -3
  939. package/dist/development/src/mapper/DataManipulationBuilder.cjs +0 -5
  940. package/dist/development/src/mapper/DataManipulationBuilder.cjs.map +0 -1
  941. package/dist/development/src/mapper/DataManipulationBuilder.js +0 -5
  942. package/dist/development/src/mapper/DataManipulationBuilder.js.map +0 -1
  943. package/dist/development/src/mapper/relations/ManyHasManyInputProcessor.cjs +0 -75
  944. package/dist/development/src/mapper/relations/ManyHasManyInputProcessor.cjs.map +0 -1
  945. package/dist/development/src/mapper/relations/ManyHasManyInputProcessor.js +0 -75
  946. package/dist/development/src/mapper/relations/ManyHasManyInputProcessor.js.map +0 -1
  947. package/dist/development/src/mapper/relations/ManyHasOneInputProcessor.cjs +0 -114
  948. package/dist/development/src/mapper/relations/ManyHasOneInputProcessor.cjs.map +0 -1
  949. package/dist/development/src/mapper/relations/ManyHasOneInputProcessor.js +0 -114
  950. package/dist/development/src/mapper/relations/ManyHasOneInputProcessor.js.map +0 -1
  951. package/dist/development/src/mapper/relations/OneHasManyInputProcessor.cjs +0 -72
  952. package/dist/development/src/mapper/relations/OneHasManyInputProcessor.cjs.map +0 -1
  953. package/dist/development/src/mapper/relations/OneHasManyInputProcessor.js +0 -72
  954. package/dist/development/src/mapper/relations/OneHasManyInputProcessor.js.map +0 -1
  955. package/dist/development/src/mapper/relations/OneHasOneInverseCreateInputProcessor.cjs.map +0 -1
  956. package/dist/development/src/mapper/relations/OneHasOneInverseCreateInputProcessor.js.map +0 -1
  957. package/dist/development/src/mapper/relations/OneHasOneInverseUpdateInputProcessor.cjs +0 -131
  958. package/dist/development/src/mapper/relations/OneHasOneInverseUpdateInputProcessor.cjs.map +0 -1
  959. package/dist/development/src/mapper/relations/OneHasOneInverseUpdateInputProcessor.js +0 -131
  960. package/dist/development/src/mapper/relations/OneHasOneInverseUpdateInputProcessor.js.map +0 -1
  961. package/dist/development/src/mapper/relations/OneHasOneOwningCreateInputProcessor.cjs +0 -71
  962. package/dist/development/src/mapper/relations/OneHasOneOwningCreateInputProcessor.cjs.map +0 -1
  963. package/dist/development/src/mapper/relations/OneHasOneOwningCreateInputProcessor.js +0 -71
  964. package/dist/development/src/mapper/relations/OneHasOneOwningCreateInputProcessor.js.map +0 -1
  965. package/dist/development/src/mapper/relations/OneHasOneOwningUpdateInputProcessor.cjs +0 -200
  966. package/dist/development/src/mapper/relations/OneHasOneOwningUpdateInputProcessor.cjs.map +0 -1
  967. package/dist/development/src/mapper/relations/OneHasOneOwningUpdateInputProcessor.js +0 -200
  968. package/dist/development/src/mapper/relations/OneHasOneOwningUpdateInputProcessor.js.map +0 -1
  969. package/dist/production/src/mapper/DataManipulationBuilder.cjs +0 -5
  970. package/dist/production/src/mapper/DataManipulationBuilder.cjs.map +0 -1
  971. package/dist/production/src/mapper/DataManipulationBuilder.js +0 -5
  972. package/dist/production/src/mapper/DataManipulationBuilder.js.map +0 -1
  973. package/dist/production/src/mapper/relations/ManyHasManyInputProcessor.cjs +0 -75
  974. package/dist/production/src/mapper/relations/ManyHasManyInputProcessor.cjs.map +0 -1
  975. package/dist/production/src/mapper/relations/ManyHasManyInputProcessor.js +0 -75
  976. package/dist/production/src/mapper/relations/ManyHasManyInputProcessor.js.map +0 -1
  977. package/dist/production/src/mapper/relations/ManyHasOneInputProcessor.cjs +0 -114
  978. package/dist/production/src/mapper/relations/ManyHasOneInputProcessor.cjs.map +0 -1
  979. package/dist/production/src/mapper/relations/ManyHasOneInputProcessor.js +0 -114
  980. package/dist/production/src/mapper/relations/ManyHasOneInputProcessor.js.map +0 -1
  981. package/dist/production/src/mapper/relations/OneHasManyInputProcessor.cjs +0 -72
  982. package/dist/production/src/mapper/relations/OneHasManyInputProcessor.cjs.map +0 -1
  983. package/dist/production/src/mapper/relations/OneHasManyInputProcessor.js +0 -72
  984. package/dist/production/src/mapper/relations/OneHasManyInputProcessor.js.map +0 -1
  985. package/dist/production/src/mapper/relations/OneHasOneInverseCreateInputProcessor.cjs.map +0 -1
  986. package/dist/production/src/mapper/relations/OneHasOneInverseCreateInputProcessor.js.map +0 -1
  987. package/dist/production/src/mapper/relations/OneHasOneInverseUpdateInputProcessor.cjs +0 -131
  988. package/dist/production/src/mapper/relations/OneHasOneInverseUpdateInputProcessor.cjs.map +0 -1
  989. package/dist/production/src/mapper/relations/OneHasOneInverseUpdateInputProcessor.js +0 -131
  990. package/dist/production/src/mapper/relations/OneHasOneInverseUpdateInputProcessor.js.map +0 -1
  991. package/dist/production/src/mapper/relations/OneHasOneOwningCreateInputProcessor.cjs +0 -71
  992. package/dist/production/src/mapper/relations/OneHasOneOwningCreateInputProcessor.cjs.map +0 -1
  993. package/dist/production/src/mapper/relations/OneHasOneOwningCreateInputProcessor.js +0 -71
  994. package/dist/production/src/mapper/relations/OneHasOneOwningCreateInputProcessor.js.map +0 -1
  995. package/dist/production/src/mapper/relations/OneHasOneOwningUpdateInputProcessor.cjs +0 -200
  996. package/dist/production/src/mapper/relations/OneHasOneOwningUpdateInputProcessor.cjs.map +0 -1
  997. package/dist/production/src/mapper/relations/OneHasOneOwningUpdateInputProcessor.js +0 -200
  998. package/dist/production/src/mapper/relations/OneHasOneOwningUpdateInputProcessor.js.map +0 -1
  999. package/dist/types/mapper/DataManipulationBuilder.d.ts +0 -7
  1000. package/dist/types/mapper/DataManipulationBuilder.d.ts.map +0 -1
  1001. package/dist/types/mapper/relations/ManyHasManyInputProcessor.d.ts +0 -32
  1002. package/dist/types/mapper/relations/ManyHasManyInputProcessor.d.ts.map +0 -1
  1003. package/dist/types/mapper/relations/ManyHasOneInputProcessor.d.ts +0 -32
  1004. package/dist/types/mapper/relations/ManyHasOneInputProcessor.d.ts.map +0 -1
  1005. package/dist/types/mapper/relations/OneHasManyInputProcessor.d.ts +0 -29
  1006. package/dist/types/mapper/relations/OneHasManyInputProcessor.d.ts.map +0 -1
  1007. package/dist/types/mapper/relations/OneHasOneInverseCreateInputProcessor.d.ts +0 -21
  1008. package/dist/types/mapper/relations/OneHasOneInverseCreateInputProcessor.d.ts.map +0 -1
  1009. package/dist/types/mapper/relations/OneHasOneInverseUpdateInputProcessor.d.ts +0 -32
  1010. package/dist/types/mapper/relations/OneHasOneInverseUpdateInputProcessor.d.ts.map +0 -1
  1011. package/dist/types/mapper/relations/OneHasOneOwningCreateInputProcessor.d.ts +0 -21
  1012. package/dist/types/mapper/relations/OneHasOneOwningCreateInputProcessor.d.ts.map +0 -1
  1013. package/dist/types/mapper/relations/OneHasOneOwningUpdateInputProcessor.d.ts +0 -37
  1014. package/dist/types/mapper/relations/OneHasOneOwningUpdateInputProcessor.d.ts.map +0 -1
  1015. package/src/mapper/DataManipulationBuilder.ts +0 -12
  1016. package/src/mapper/relations/ManyHasManyInputProcessor.ts +0 -108
  1017. package/src/mapper/relations/ManyHasOneInputProcessor.ts +0 -158
  1018. package/src/mapper/relations/OneHasManyInputProcessor.ts +0 -101
  1019. package/src/mapper/relations/OneHasOneInverseCreateInputProcessor.ts +0 -99
  1020. package/src/mapper/relations/OneHasOneInverseUpdateInputProcessor.ts +0 -164
  1021. package/src/mapper/relations/OneHasOneOwningCreateInputProcessor.ts +0 -92
  1022. package/src/mapper/relations/OneHasOneOwningUpdateInputProcessor.ts +0 -253
@@ -1 +1 @@
1
- {"version":3,"file":"PredicateFactory.js","sources":["../../../../../packages/engine-content-api/src/acl/PredicateFactory.ts"],"sourcesContent":["import { Acl, Input, Model } from '@contember/schema'\nimport { VariableInjector } from './VariableInjector'\nimport { EvaluatedPredicateReplacer } from './EvaluatedPredicateReplacer'\n\nconst getRowLevelPredicatePseudoField = (entity: Model.Entity) => entity.primary\n\nexport interface FieldRequiredPredicate {\n\tpredicate: Acl.Predicate\n\tisSameAsPrimary: boolean\n}\n\nexport class PredicateFactory {\n\tconstructor(\n\t\tprivate readonly permissions: Acl.Permissions,\n\t\tprivate readonly model: Model.Schema,\n\t\tprivate readonly variableInjector: VariableInjector,\n\t) {}\n\n\tpublic getFieldPredicate(\n\t\tentity: Model.Entity,\n\t\toperation: Acl.Operation.update | Acl.Operation.read | Acl.Operation.create,\n\t\tfieldName: string,\n\t): FieldRequiredPredicate {\n\t\tconst permissions = this.permissions[entity.name]?.operations?.[operation]\n\t\tconst predicate = permissions?.[fieldName] ?? false\n\t\tconst rowLevelField = getRowLevelPredicatePseudoField(entity)\n\n\t\tconst primaryPredicate = permissions?.[rowLevelField] ?? false\n\t\tconst isSameAsPrimary = predicate === primaryPredicate\n\n\t\treturn {\n\t\t\tisSameAsPrimary,\n\t\t\tpredicate,\n\t\t}\n\t}\n\n\tpublic shouldApplyCellLevelPredicate(\n\t\tentity: Model.Entity,\n\t\toperation: Acl.Operation.read,\n\t\tfieldName: string,\n\t): boolean {\n\t\tconst rowLevelField = getRowLevelPredicatePseudoField(entity)\n\t\tconst permissions = this.permissions[entity.name]?.operations?.[operation]\n\t\treturn permissions?.[fieldName] !== permissions?.[rowLevelField]\n\t}\n\n\tpublic createDeletePredicate(entity: Model.Entity) {\n\t\tconst neverCondition: Input.Where = { [entity.primary]: { never: true } }\n\t\tconst entityPermissions = this.permissions[entity.name]\n\t\tif (!entityPermissions) {\n\t\t\treturn neverCondition\n\t\t}\n\t\tconst deletePredicate = entityPermissions.operations.delete\n\t\tif (deletePredicate === undefined || deletePredicate === false) {\n\t\t\treturn neverCondition\n\t\t}\n\t\tif (deletePredicate === true) {\n\t\t\treturn {}\n\t\t}\n\t\treturn this.buildPredicates(entity, [deletePredicate])\n\t}\n\n\tpublic create(\n\t\tentity: Model.Entity,\n\t\toperation: Acl.Operation.update | Acl.Operation.read | Acl.Operation.create,\n\t\tfieldNames: string[] = [getRowLevelPredicatePseudoField(entity)],\n\t\trelationContext?: Model.AnyRelationContext,\n\t): Input.OptionalWhere {\n\t\tconst entityPermissions: Acl.EntityPermissions = this.permissions[entity.name]\n\t\tconst neverCondition: Input.Where = { [entity.primary]: { never: true } }\n\n\t\tif (!entityPermissions) {\n\t\t\treturn neverCondition\n\t\t}\n\n\t\tif (fieldNames === undefined) {\n\t\t\tfieldNames = [getRowLevelPredicatePseudoField(entity)]\n\t\t}\n\t\tconst fieldPermissions = entityPermissions.operations[operation]\n\t\tif (fieldPermissions === undefined) {\n\t\t\treturn neverCondition\n\t\t}\n\t\tconst operationPredicates = this.getRequiredPredicates(fieldNames, fieldPermissions)\n\t\tif (operationPredicates === false) {\n\t\t\treturn neverCondition\n\t\t}\n\n\t\treturn this.buildPredicates(entity, operationPredicates, relationContext)\n\t}\n\n\tpublic buildPredicates(entity: Model.Entity, predicates: Acl.PredicateReference[], relationContext?: Model.AnyRelationContext): Input.OptionalWhere {\n\t\tconst entityPermissions: Acl.EntityPermissions = this.permissions[entity.name] ?? {}\n\n\t\tconst predicatesWhere: Input.Where[] = predicates.reduce(\n\t\t\t(result: Input.Where[], name: Acl.PredicateReference): Input.Where[] => {\n\t\t\t\tif (!entityPermissions.predicates[name]) {\n\t\t\t\t\tthrow new Error(`${entity.name}: Undefined predicate ${name}`)\n\t\t\t\t}\n\t\t\t\tconst predicateWhere: Input.Where = this.variableInjector.inject(entity, entityPermissions.predicates[name])\n\t\t\t\treturn [...result, predicateWhere]\n\t\t\t},\n\t\t\t[],\n\t\t)\n\t\tif (predicatesWhere.length === 0) {\n\t\t\treturn {}\n\t\t}\n\t\tconst where: Input.Where = predicatesWhere.length === 1 ? predicatesWhere[0] : { and: predicatesWhere }\n\t\treturn this.optimizePredicates(where, relationContext)\n\n\t}\n\n\tprivate getRequiredPredicates(\n\t\tfieldNames: string[],\n\t\tfieldPermissions: Acl.FieldPermissions,\n\t): Acl.PredicateReference[] | false {\n\t\tconst predicates: Acl.PredicateReference[] = []\n\t\tfor (let name of fieldNames) {\n\t\t\tconst fieldPredicate = fieldPermissions[name]\n\t\t\tif (fieldPredicate === undefined || fieldPredicate === false) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t\tif (fieldPredicate === true) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif (!predicates.includes(fieldPredicate)) {\n\t\t\t\tpredicates.push(fieldPredicate)\n\t\t\t}\n\t\t}\n\t\treturn predicates\n\t}\n\n\tpublic optimizePredicates(where: Input.OptionalWhere, relationContext?: Model.AnyRelationContext) {\n\t\tif (!relationContext || !relationContext.targetRelation) {\n\t\t\treturn where\n\t\t}\n\t\tconst sourcePredicate = this.create(relationContext.entity, Acl.Operation.read, [relationContext.relation.name])\n\t\tif (Object.keys(sourcePredicate).length === 0) {\n\t\t\treturn where\n\t\t}\n\n\t\tconst replacer = new EvaluatedPredicateReplacer(sourcePredicate, relationContext.entity, relationContext.targetRelation)\n\t\treturn replacer.replace(where)\n\t}\n}\n"],"names":[],"mappings":"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"}
1
+ {"version":3,"file":"PredicateFactory.js","sources":["../../../../../packages/engine-content-api/src/acl/PredicateFactory.ts"],"sourcesContent":["import { Acl, Input, Model } from '@contember/schema'\nimport { VariableInjector } from './VariableInjector'\nimport { EvaluatedPredicateReplacer } from './EvaluatedPredicateReplacer'\n\nconst getRowLevelPredicatePseudoField = (entity: Model.Entity) => entity.primary\n\nexport interface FieldRequiredPredicate {\n\tpredicate: Acl.Predicate\n\tisSameAsPrimary: boolean\n}\n\nexport class PredicateFactory {\n\tconstructor(\n\t\tprivate readonly permissions: Acl.Permissions,\n\t\tprivate readonly model: Model.Schema,\n\t\tprivate readonly variableInjector: VariableInjector,\n\t) {}\n\n\tpublic getFieldPredicate(\n\t\tentity: Model.Entity,\n\t\toperation: Acl.Operation.update | Acl.Operation.read | Acl.Operation.create,\n\t\tfieldName: string,\n\t): FieldRequiredPredicate {\n\t\tconst permissions = this.permissions[entity.name]?.operations?.[operation]\n\t\tconst predicate = permissions?.[fieldName] ?? false\n\t\tconst rowLevelField = getRowLevelPredicatePseudoField(entity)\n\n\t\tconst primaryPredicate = permissions?.[rowLevelField] ?? false\n\t\tconst isSameAsPrimary = predicate === primaryPredicate\n\n\t\treturn {\n\t\t\tisSameAsPrimary,\n\t\t\tpredicate,\n\t\t}\n\t}\n\n\tpublic shouldApplyCellLevelPredicate(\n\t\tentity: Model.Entity,\n\t\toperation: Acl.Operation.read,\n\t\tfieldName: string,\n\t): boolean {\n\t\tconst rowLevelField = getRowLevelPredicatePseudoField(entity)\n\t\tconst permissions = this.permissions[entity.name]?.operations?.[operation]\n\t\treturn permissions?.[fieldName] !== permissions?.[rowLevelField]\n\t}\n\n\tpublic createDeletePredicate(entity: Model.Entity) {\n\t\tconst neverCondition: Input.Where = { [entity.primary]: { never: true } }\n\t\tconst entityPermissions = this.permissions[entity.name]\n\t\tif (!entityPermissions) {\n\t\t\treturn neverCondition\n\t\t}\n\t\tconst deletePredicate = entityPermissions.operations.delete\n\t\tif (deletePredicate === undefined || deletePredicate === false) {\n\t\t\treturn neverCondition\n\t\t}\n\t\tif (deletePredicate === true) {\n\t\t\treturn {}\n\t\t}\n\t\treturn this.buildPredicates(entity, [deletePredicate])\n\t}\n\n\tpublic create(\n\t\tentity: Model.Entity,\n\t\toperation: Acl.Operation.update | Acl.Operation.read | Acl.Operation.create,\n\t\tfieldNames: string[] = [getRowLevelPredicatePseudoField(entity)],\n\t\trelationContext?: Model.AnyRelationContext,\n\t): Input.OptionalWhere {\n\t\tconst entityPermissions: Acl.EntityPermissions = this.permissions[entity.name]\n\t\tconst neverCondition: Input.Where = { [entity.primary]: { never: true } }\n\n\t\tif (!entityPermissions) {\n\t\t\treturn neverCondition\n\t\t}\n\n\t\tif (fieldNames === undefined) {\n\t\t\tfieldNames = [getRowLevelPredicatePseudoField(entity)]\n\t\t}\n\t\tconst fieldPermissions = entityPermissions.operations[operation]\n\t\tif (fieldPermissions === undefined) {\n\t\t\treturn neverCondition\n\t\t}\n\t\tconst operationPredicates = this.getRequiredPredicates(fieldNames, fieldPermissions)\n\t\tif (operationPredicates === false) {\n\t\t\treturn neverCondition\n\t\t}\n\n\t\treturn this.buildPredicates(entity, operationPredicates, relationContext)\n\t}\n\n\tpublic buildPredicates(entity: Model.Entity, predicates: Acl.PredicateReference[], relationContext?: Model.AnyRelationContext): Input.OptionalWhere {\n\t\tconst entityPermissions: Acl.EntityPermissions = this.permissions[entity.name] ?? {}\n\n\t\tconst predicatesWhere: Input.Where[] = predicates.reduce(\n\t\t\t(result: Input.Where[], name: Acl.PredicateReference): Input.Where[] => {\n\t\t\t\tif (!entityPermissions.predicates[name]) {\n\t\t\t\t\tthrow new Error(`${entity.name}: Undefined predicate ${name}`)\n\t\t\t\t}\n\t\t\t\tconst predicateWhere: Input.Where = this.variableInjector.inject(entity, entityPermissions.predicates[name])\n\t\t\t\treturn [...result, predicateWhere]\n\t\t\t},\n\t\t\t[],\n\t\t)\n\t\tif (predicatesWhere.length === 0) {\n\t\t\treturn {}\n\t\t}\n\t\tconst where: Input.Where = predicatesWhere.length === 1 ? predicatesWhere[0] : { and: predicatesWhere }\n\t\treturn this.optimizePredicates(where, relationContext)\n\n\t}\n\n\tprivate getRequiredPredicates(\n\t\tfieldNames: string[],\n\t\tfieldPermissions: Acl.FieldPermissions,\n\t): Acl.PredicateReference[] | false {\n\t\tconst predicates: Acl.PredicateReference[] = []\n\t\tfor (let name of fieldNames) {\n\t\t\tconst fieldPredicate = fieldPermissions[name]\n\t\t\tif (fieldPredicate === undefined || fieldPredicate === false) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t\tif (fieldPredicate === true) {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif (!predicates.includes(fieldPredicate)) {\n\t\t\t\tpredicates.push(fieldPredicate)\n\t\t\t}\n\t\t}\n\t\treturn predicates\n\t}\n\n\tpublic optimizePredicates(where: Input.OptionalWhere, relationContext?: Model.AnyRelationContext) {\n\t\tif (!relationContext || !relationContext.targetRelation) {\n\t\t\treturn where\n\t\t}\n\t\tconst sourcePredicate = this.create(relationContext.entity, Acl.Operation.read, [relationContext.relation.name])\n\t\tif (Object.keys(sourcePredicate).length === 0) {\n\t\t\treturn where\n\t\t}\n\n\t\tconst replacer = new EvaluatedPredicateReplacer(sourcePredicate, relationContext.entity, relationContext.targetRelation)\n\t\treturn replacer.replace(where)\n\t}\n}\n"],"names":[],"mappings":"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"}
@@ -1 +1 @@
1
- {"version":3,"file":"PredicatesInjector.cjs","sources":["../../../../../packages/engine-content-api/src/acl/PredicatesInjector.ts"],"sourcesContent":["import { Acl, Input, Model, Writable } from '@contember/schema'\nimport { acceptFieldVisitor } from '@contember/schema-utils'\nimport { PredicateFactory } from './PredicateFactory'\n\nexport class PredicatesInjector {\n\tconstructor(private readonly schema: Model.Schema, private readonly predicateFactory: PredicateFactory) {}\n\n\tpublic inject(entity: Model.Entity, where: Input.OptionalWhere, relationContext?: Model.AnyRelationContext): Input.OptionalWhere {\n\t\tconst restrictedWhere = this.injectToWhere(where, entity, true)\n\t\treturn this.createWhere(entity, undefined, restrictedWhere, relationContext)\n\t}\n\n\tprivate createWhere(\n\t\tentity: Model.Entity,\n\t\tfieldNames: string[] | undefined,\n\t\twhere: Input.OptionalWhere,\n\t\trelationContext?: Model.AnyRelationContext,\n\t): Input.OptionalWhere {\n\t\tconst predicatesWhere = this.predicateFactory.create(entity, Acl.Operation.read, fieldNames, relationContext)\n\t\twhere = this.predicateFactory.optimizePredicates(where, relationContext)\n\n\t\tconst and = [where, predicatesWhere].filter(it => Object.keys(it).length > 0)\n\t\tif (and.length === 0) {\n\t\t\treturn {}\n\t\t}\n\t\tif (and.length === 1) {\n\t\t\treturn and[0]\n\t\t}\n\t\treturn { and: and }\n\t}\n\n\tprivate injectToWhere(\n\t\twhere: Input.OptionalWhere,\n\t\tentity: Model.Entity,\n\t\tisRoot: boolean,\n\t\trelationContext?: Model.AnyRelationContext,\n\t): Input.OptionalWhere {\n\t\tconst resultWhere: Writable<Input.OptionalWhere> = {}\n\t\tif (where.and) {\n\t\t\tresultWhere.and = where.and.filter((it): it is Input.Where => !!it).map(it => this.injectToWhere(it, entity, isRoot, relationContext))\n\t\t}\n\t\tif (where.or) {\n\t\t\tresultWhere.or = where.or.filter((it): it is Input.Where => !!it).map(it => this.injectToWhere(it, entity, isRoot, relationContext))\n\t\t}\n\t\tif (where.not) {\n\t\t\tresultWhere.not = this.injectToWhere(where.not, entity, isRoot, relationContext)\n\t\t}\n\n\t\tconst fields = Object.keys(where).filter(it => !['and', 'or', 'not'].includes(it))\n\n\t\tif (fields.length === 0) {\n\t\t\treturn resultWhere\n\t\t}\n\t\tfor (let field of fields) {\n\t\t\tresultWhere[field] = acceptFieldVisitor(this.schema, entity, field, {\n\t\t\t\tvisitColumn: () => where[field],\n\t\t\t\tvisitRelation: context => {\n\t\t\t\t\tconst relationWhere = where[field] as Input.OptionalWhere | null\n\t\t\t\t\tif (relationWhere === null) {\n\t\t\t\t\t\treturn null\n\t\t\t\t\t}\n\t\t\t\t\treturn this.injectToWhere(relationWhere, context.targetEntity, false, context)\n\t\t\t\t},\n\t\t\t})\n\t\t}\n\t\tconst fieldsForPredicate = !isRoot\n\t\t\t? fields\n\t\t\t: fields.filter(it => this.predicateFactory.shouldApplyCellLevelPredicate(entity, Acl.Operation.read, it))\n\n\t\treturn this.createWhere(entity, fieldsForPredicate, resultWhere, relationContext)\n\t}\n\n}\n"],"names":["schema","Acl","acceptFieldVisitor"],"mappings":";;;;AAIO,MAAM,mBAAmB;AAAA,EAC/B,YAA6BA,SAAuC,kBAAoC;AAA3E,SAAA,SAAAA;AAAuC,SAAA,mBAAA;AAAA,EAAqC;AAAA,EAElG,OAAO,QAAsB,OAA4B,iBAAiE;AAChI,UAAM,kBAAkB,KAAK,cAAc,OAAO,QAAQ,IAAI;AAC9D,WAAO,KAAK,YAAY,QAAQ,QAAW,iBAAiB,eAAe;AAAA,EAC5E;AAAA,EAEQ,YACP,QACA,YACA,OACA,iBACsB;AAChB,UAAA,kBAAkB,KAAK,iBAAiB,OAAO,QAAQC,OAAI,IAAA,UAAU,MAAM,YAAY,eAAe;AAC5G,YAAQ,KAAK,iBAAiB,mBAAmB,OAAO,eAAe;AAEvE,UAAM,MAAM,CAAC,OAAO,eAAe,EAAE,OAAO,CAAM,OAAA,OAAO,KAAK,EAAE,EAAE,SAAS,CAAC;AACxE,QAAA,IAAI,WAAW,GAAG;AACrB,aAAO;IACR;AACI,QAAA,IAAI,WAAW,GAAG;AACrB,aAAO,IAAI,CAAC;AAAA,IACb;AACA,WAAO,EAAE,IAAS;AAAA,EACnB;AAAA,EAEQ,cACP,OACA,QACA,QACA,iBACsB;AACtB,UAAM,cAA6C,CAAA;AACnD,QAAI,MAAM,KAAK;AACd,kBAAY,MAAM,MAAM,IAAI,OAAO,CAAC,OAA0B,CAAC,CAAC,EAAE,EAAE,IAAI,QAAM,KAAK,cAAc,IAAI,QAAQ,QAAQ,eAAe,CAAC;AAAA,IACtI;AACA,QAAI,MAAM,IAAI;AACb,kBAAY,KAAK,MAAM,GAAG,OAAO,CAAC,OAA0B,CAAC,CAAC,EAAE,EAAE,IAAI,QAAM,KAAK,cAAc,IAAI,QAAQ,QAAQ,eAAe,CAAC;AAAA,IACpI;AACA,QAAI,MAAM,KAAK;AACd,kBAAY,MAAM,KAAK,cAAc,MAAM,KAAK,QAAQ,QAAQ,eAAe;AAAA,IAChF;AAEA,UAAM,SAAS,OAAO,KAAK,KAAK,EAAE,OAAO,CAAA,OAAM,CAAC,CAAC,OAAO,MAAM,KAAK,EAAE,SAAS,EAAE,CAAC;AAE7E,QAAA,OAAO,WAAW,GAAG;AACjB,aAAA;AAAA,IACR;AACA,aAAS,SAAS,QAAQ;AACzB,kBAAY,KAAK,IAAIC,YAAA,mBAAmB,KAAK,QAAQ,QAAQ,OAAO;AAAA,QACnE,aAAa,MAAM,MAAM,KAAK;AAAA,QAC9B,eAAe,CAAW,YAAA;AACnB,gBAAA,gBAAgB,MAAM,KAAK;AACjC,cAAI,kBAAkB,MAAM;AACpB,mBAAA;AAAA,UACR;AACA,iBAAO,KAAK,cAAc,eAAe,QAAQ,cAAc,OAAO,OAAO;AAAA,QAC9E;AAAA,MAAA,CACA;AAAA,IACF;AACA,UAAM,qBAAqB,CAAC,SACzB,SACA,OAAO,OAAO,CAAA,OAAM,KAAK,iBAAiB,8BAA8B,QAAQD,OAAA,IAAI,UAAU,MAAM,EAAE,CAAC;AAE1G,WAAO,KAAK,YAAY,QAAQ,oBAAoB,aAAa,eAAe;AAAA,EACjF;AAED;;"}
1
+ {"version":3,"file":"PredicatesInjector.cjs","sources":["../../../../../packages/engine-content-api/src/acl/PredicatesInjector.ts"],"sourcesContent":["import { Acl, Input, Model, Writable } from '@contember/schema'\nimport { acceptFieldVisitor } from '@contember/schema-utils'\nimport { PredicateFactory } from './PredicateFactory'\n\nexport class PredicatesInjector {\n\tconstructor(private readonly schema: Model.Schema, private readonly predicateFactory: PredicateFactory) {}\n\n\tpublic inject(entity: Model.Entity, where: Input.OptionalWhere, relationContext?: Model.AnyRelationContext): Input.OptionalWhere {\n\t\tconst restrictedWhere = this.injectToWhere(where, entity, true)\n\t\treturn this.createWhere(entity, undefined, restrictedWhere, relationContext)\n\t}\n\n\tprivate createWhere(\n\t\tentity: Model.Entity,\n\t\tfieldNames: string[] | undefined,\n\t\twhere: Input.OptionalWhere,\n\t\trelationContext?: Model.AnyRelationContext,\n\t): Input.OptionalWhere {\n\t\tconst predicatesWhere = this.predicateFactory.create(entity, Acl.Operation.read, fieldNames, relationContext)\n\t\twhere = this.predicateFactory.optimizePredicates(where, relationContext)\n\n\t\tconst and = [where, predicatesWhere].filter(it => Object.keys(it).length > 0)\n\t\tif (and.length === 0) {\n\t\t\treturn {}\n\t\t}\n\t\tif (and.length === 1) {\n\t\t\treturn and[0]\n\t\t}\n\t\treturn { and: and }\n\t}\n\n\tprivate injectToWhere(\n\t\twhere: Input.OptionalWhere,\n\t\tentity: Model.Entity,\n\t\tisRoot: boolean,\n\t\trelationContext?: Model.AnyRelationContext,\n\t): Input.OptionalWhere {\n\t\tconst resultWhere: Writable<Input.OptionalWhere> = {}\n\t\tif (where.and) {\n\t\t\tresultWhere.and = where.and.filter((it): it is Input.Where => !!it).map(it => this.injectToWhere(it, entity, isRoot, relationContext))\n\t\t}\n\t\tif (where.or) {\n\t\t\tresultWhere.or = where.or.filter((it): it is Input.Where => !!it).map(it => this.injectToWhere(it, entity, isRoot, relationContext))\n\t\t}\n\t\tif (where.not) {\n\t\t\tresultWhere.not = this.injectToWhere(where.not, entity, isRoot, relationContext)\n\t\t}\n\n\t\tconst fields = Object.keys(where).filter(it => !['and', 'or', 'not'].includes(it))\n\n\t\tif (fields.length === 0) {\n\t\t\treturn resultWhere\n\t\t}\n\t\tfor (let field of fields) {\n\t\t\tresultWhere[field] = acceptFieldVisitor(this.schema, entity, field, {\n\t\t\t\tvisitColumn: () => where[field],\n\t\t\t\tvisitRelation: context => {\n\t\t\t\t\tconst relationWhere = where[field] as Input.OptionalWhere | null\n\t\t\t\t\tif (relationWhere === null) {\n\t\t\t\t\t\treturn null\n\t\t\t\t\t}\n\t\t\t\t\treturn this.injectToWhere(relationWhere, context.targetEntity, false, context)\n\t\t\t\t},\n\t\t\t})\n\t\t}\n\t\tconst fieldsForPredicate = !isRoot\n\t\t\t? fields\n\t\t\t: fields.filter(it => this.predicateFactory.shouldApplyCellLevelPredicate(entity, Acl.Operation.read, it))\n\n\t\treturn this.createWhere(entity, fieldsForPredicate, resultWhere, relationContext)\n\t}\n\n}\n"],"names":["schema","Acl","acceptFieldVisitor"],"mappings":";;;;AAIO,MAAM,mBAAmB;AAAA,EAC/B,YAA6BA,SAAuC,kBAAoC;AAA3E,SAAA,SAAAA;AAAuC,SAAA,mBAAA;AAAA,EAAA;AAAA,EAE7D,OAAO,QAAsB,OAA4B,iBAAiE;AAChI,UAAM,kBAAkB,KAAK,cAAc,OAAO,QAAQ,IAAI;AAC9D,WAAO,KAAK,YAAY,QAAQ,QAAW,iBAAiB,eAAe;AAAA,EAAA;AAAA,EAGpE,YACP,QACA,YACA,OACA,iBACsB;AAChB,UAAA,kBAAkB,KAAK,iBAAiB,OAAO,QAAQC,OAAI,IAAA,UAAU,MAAM,YAAY,eAAe;AAC5G,YAAQ,KAAK,iBAAiB,mBAAmB,OAAO,eAAe;AAEvE,UAAM,MAAM,CAAC,OAAO,eAAe,EAAE,OAAO,CAAM,OAAA,OAAO,KAAK,EAAE,EAAE,SAAS,CAAC;AACxE,QAAA,IAAI,WAAW,GAAG;AACrB,aAAO,CAAC;AAAA,IAAA;AAEL,QAAA,IAAI,WAAW,GAAG;AACrB,aAAO,IAAI,CAAC;AAAA,IAAA;AAEb,WAAO,EAAE,IAAS;AAAA,EAAA;AAAA,EAGX,cACP,OACA,QACA,QACA,iBACsB;AACtB,UAAM,cAA6C,CAAC;AACpD,QAAI,MAAM,KAAK;AACd,kBAAY,MAAM,MAAM,IAAI,OAAO,CAAC,OAA0B,CAAC,CAAC,EAAE,EAAE,IAAI,QAAM,KAAK,cAAc,IAAI,QAAQ,QAAQ,eAAe,CAAC;AAAA,IAAA;AAEtI,QAAI,MAAM,IAAI;AACb,kBAAY,KAAK,MAAM,GAAG,OAAO,CAAC,OAA0B,CAAC,CAAC,EAAE,EAAE,IAAI,QAAM,KAAK,cAAc,IAAI,QAAQ,QAAQ,eAAe,CAAC;AAAA,IAAA;AAEpI,QAAI,MAAM,KAAK;AACd,kBAAY,MAAM,KAAK,cAAc,MAAM,KAAK,QAAQ,QAAQ,eAAe;AAAA,IAAA;AAGhF,UAAM,SAAS,OAAO,KAAK,KAAK,EAAE,OAAO,CAAA,OAAM,CAAC,CAAC,OAAO,MAAM,KAAK,EAAE,SAAS,EAAE,CAAC;AAE7E,QAAA,OAAO,WAAW,GAAG;AACjB,aAAA;AAAA,IAAA;AAER,aAAS,SAAS,QAAQ;AACzB,kBAAY,KAAK,IAAIC,YAAA,mBAAmB,KAAK,QAAQ,QAAQ,OAAO;AAAA,QACnE,aAAa,MAAM,MAAM,KAAK;AAAA,QAC9B,eAAe,CAAW,YAAA;AACnB,gBAAA,gBAAgB,MAAM,KAAK;AACjC,cAAI,kBAAkB,MAAM;AACpB,mBAAA;AAAA,UAAA;AAER,iBAAO,KAAK,cAAc,eAAe,QAAQ,cAAc,OAAO,OAAO;AAAA,QAAA;AAAA,MAC9E,CACA;AAAA,IAAA;AAEF,UAAM,qBAAqB,CAAC,SACzB,SACA,OAAO,OAAO,CAAA,OAAM,KAAK,iBAAiB,8BAA8B,QAAQD,OAAAA,IAAI,UAAU,MAAM,EAAE,CAAC;AAE1G,WAAO,KAAK,YAAY,QAAQ,oBAAoB,aAAa,eAAe;AAAA,EAAA;AAGlF;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"PredicatesInjector.js","sources":["../../../../../packages/engine-content-api/src/acl/PredicatesInjector.ts"],"sourcesContent":["import { Acl, Input, Model, Writable } from '@contember/schema'\nimport { acceptFieldVisitor } from '@contember/schema-utils'\nimport { PredicateFactory } from './PredicateFactory'\n\nexport class PredicatesInjector {\n\tconstructor(private readonly schema: Model.Schema, private readonly predicateFactory: PredicateFactory) {}\n\n\tpublic inject(entity: Model.Entity, where: Input.OptionalWhere, relationContext?: Model.AnyRelationContext): Input.OptionalWhere {\n\t\tconst restrictedWhere = this.injectToWhere(where, entity, true)\n\t\treturn this.createWhere(entity, undefined, restrictedWhere, relationContext)\n\t}\n\n\tprivate createWhere(\n\t\tentity: Model.Entity,\n\t\tfieldNames: string[] | undefined,\n\t\twhere: Input.OptionalWhere,\n\t\trelationContext?: Model.AnyRelationContext,\n\t): Input.OptionalWhere {\n\t\tconst predicatesWhere = this.predicateFactory.create(entity, Acl.Operation.read, fieldNames, relationContext)\n\t\twhere = this.predicateFactory.optimizePredicates(where, relationContext)\n\n\t\tconst and = [where, predicatesWhere].filter(it => Object.keys(it).length > 0)\n\t\tif (and.length === 0) {\n\t\t\treturn {}\n\t\t}\n\t\tif (and.length === 1) {\n\t\t\treturn and[0]\n\t\t}\n\t\treturn { and: and }\n\t}\n\n\tprivate injectToWhere(\n\t\twhere: Input.OptionalWhere,\n\t\tentity: Model.Entity,\n\t\tisRoot: boolean,\n\t\trelationContext?: Model.AnyRelationContext,\n\t): Input.OptionalWhere {\n\t\tconst resultWhere: Writable<Input.OptionalWhere> = {}\n\t\tif (where.and) {\n\t\t\tresultWhere.and = where.and.filter((it): it is Input.Where => !!it).map(it => this.injectToWhere(it, entity, isRoot, relationContext))\n\t\t}\n\t\tif (where.or) {\n\t\t\tresultWhere.or = where.or.filter((it): it is Input.Where => !!it).map(it => this.injectToWhere(it, entity, isRoot, relationContext))\n\t\t}\n\t\tif (where.not) {\n\t\t\tresultWhere.not = this.injectToWhere(where.not, entity, isRoot, relationContext)\n\t\t}\n\n\t\tconst fields = Object.keys(where).filter(it => !['and', 'or', 'not'].includes(it))\n\n\t\tif (fields.length === 0) {\n\t\t\treturn resultWhere\n\t\t}\n\t\tfor (let field of fields) {\n\t\t\tresultWhere[field] = acceptFieldVisitor(this.schema, entity, field, {\n\t\t\t\tvisitColumn: () => where[field],\n\t\t\t\tvisitRelation: context => {\n\t\t\t\t\tconst relationWhere = where[field] as Input.OptionalWhere | null\n\t\t\t\t\tif (relationWhere === null) {\n\t\t\t\t\t\treturn null\n\t\t\t\t\t}\n\t\t\t\t\treturn this.injectToWhere(relationWhere, context.targetEntity, false, context)\n\t\t\t\t},\n\t\t\t})\n\t\t}\n\t\tconst fieldsForPredicate = !isRoot\n\t\t\t? fields\n\t\t\t: fields.filter(it => this.predicateFactory.shouldApplyCellLevelPredicate(entity, Acl.Operation.read, it))\n\n\t\treturn this.createWhere(entity, fieldsForPredicate, resultWhere, relationContext)\n\t}\n\n}\n"],"names":[],"mappings":";;AAIO,MAAM,mBAAmB;AAAA,EAC/B,YAA6B,QAAuC,kBAAoC;AAA3E,SAAA,SAAA;AAAuC,SAAA,mBAAA;AAAA,EAAqC;AAAA,EAElG,OAAO,QAAsB,OAA4B,iBAAiE;AAChI,UAAM,kBAAkB,KAAK,cAAc,OAAO,QAAQ,IAAI;AAC9D,WAAO,KAAK,YAAY,QAAQ,QAAW,iBAAiB,eAAe;AAAA,EAC5E;AAAA,EAEQ,YACP,QACA,YACA,OACA,iBACsB;AAChB,UAAA,kBAAkB,KAAK,iBAAiB,OAAO,QAAQ,IAAI,UAAU,MAAM,YAAY,eAAe;AAC5G,YAAQ,KAAK,iBAAiB,mBAAmB,OAAO,eAAe;AAEvE,UAAM,MAAM,CAAC,OAAO,eAAe,EAAE,OAAO,CAAM,OAAA,OAAO,KAAK,EAAE,EAAE,SAAS,CAAC;AACxE,QAAA,IAAI,WAAW,GAAG;AACrB,aAAO;IACR;AACI,QAAA,IAAI,WAAW,GAAG;AACrB,aAAO,IAAI,CAAC;AAAA,IACb;AACA,WAAO,EAAE,IAAS;AAAA,EACnB;AAAA,EAEQ,cACP,OACA,QACA,QACA,iBACsB;AACtB,UAAM,cAA6C,CAAA;AACnD,QAAI,MAAM,KAAK;AACd,kBAAY,MAAM,MAAM,IAAI,OAAO,CAAC,OAA0B,CAAC,CAAC,EAAE,EAAE,IAAI,QAAM,KAAK,cAAc,IAAI,QAAQ,QAAQ,eAAe,CAAC;AAAA,IACtI;AACA,QAAI,MAAM,IAAI;AACb,kBAAY,KAAK,MAAM,GAAG,OAAO,CAAC,OAA0B,CAAC,CAAC,EAAE,EAAE,IAAI,QAAM,KAAK,cAAc,IAAI,QAAQ,QAAQ,eAAe,CAAC;AAAA,IACpI;AACA,QAAI,MAAM,KAAK;AACd,kBAAY,MAAM,KAAK,cAAc,MAAM,KAAK,QAAQ,QAAQ,eAAe;AAAA,IAChF;AAEA,UAAM,SAAS,OAAO,KAAK,KAAK,EAAE,OAAO,CAAA,OAAM,CAAC,CAAC,OAAO,MAAM,KAAK,EAAE,SAAS,EAAE,CAAC;AAE7E,QAAA,OAAO,WAAW,GAAG;AACjB,aAAA;AAAA,IACR;AACA,aAAS,SAAS,QAAQ;AACzB,kBAAY,KAAK,IAAI,mBAAmB,KAAK,QAAQ,QAAQ,OAAO;AAAA,QACnE,aAAa,MAAM,MAAM,KAAK;AAAA,QAC9B,eAAe,CAAW,YAAA;AACnB,gBAAA,gBAAgB,MAAM,KAAK;AACjC,cAAI,kBAAkB,MAAM;AACpB,mBAAA;AAAA,UACR;AACA,iBAAO,KAAK,cAAc,eAAe,QAAQ,cAAc,OAAO,OAAO;AAAA,QAC9E;AAAA,MAAA,CACA;AAAA,IACF;AACA,UAAM,qBAAqB,CAAC,SACzB,SACA,OAAO,OAAO,CAAA,OAAM,KAAK,iBAAiB,8BAA8B,QAAQ,IAAI,UAAU,MAAM,EAAE,CAAC;AAE1G,WAAO,KAAK,YAAY,QAAQ,oBAAoB,aAAa,eAAe;AAAA,EACjF;AAED;"}
1
+ {"version":3,"file":"PredicatesInjector.js","sources":["../../../../../packages/engine-content-api/src/acl/PredicatesInjector.ts"],"sourcesContent":["import { Acl, Input, Model, Writable } from '@contember/schema'\nimport { acceptFieldVisitor } from '@contember/schema-utils'\nimport { PredicateFactory } from './PredicateFactory'\n\nexport class PredicatesInjector {\n\tconstructor(private readonly schema: Model.Schema, private readonly predicateFactory: PredicateFactory) {}\n\n\tpublic inject(entity: Model.Entity, where: Input.OptionalWhere, relationContext?: Model.AnyRelationContext): Input.OptionalWhere {\n\t\tconst restrictedWhere = this.injectToWhere(where, entity, true)\n\t\treturn this.createWhere(entity, undefined, restrictedWhere, relationContext)\n\t}\n\n\tprivate createWhere(\n\t\tentity: Model.Entity,\n\t\tfieldNames: string[] | undefined,\n\t\twhere: Input.OptionalWhere,\n\t\trelationContext?: Model.AnyRelationContext,\n\t): Input.OptionalWhere {\n\t\tconst predicatesWhere = this.predicateFactory.create(entity, Acl.Operation.read, fieldNames, relationContext)\n\t\twhere = this.predicateFactory.optimizePredicates(where, relationContext)\n\n\t\tconst and = [where, predicatesWhere].filter(it => Object.keys(it).length > 0)\n\t\tif (and.length === 0) {\n\t\t\treturn {}\n\t\t}\n\t\tif (and.length === 1) {\n\t\t\treturn and[0]\n\t\t}\n\t\treturn { and: and }\n\t}\n\n\tprivate injectToWhere(\n\t\twhere: Input.OptionalWhere,\n\t\tentity: Model.Entity,\n\t\tisRoot: boolean,\n\t\trelationContext?: Model.AnyRelationContext,\n\t): Input.OptionalWhere {\n\t\tconst resultWhere: Writable<Input.OptionalWhere> = {}\n\t\tif (where.and) {\n\t\t\tresultWhere.and = where.and.filter((it): it is Input.Where => !!it).map(it => this.injectToWhere(it, entity, isRoot, relationContext))\n\t\t}\n\t\tif (where.or) {\n\t\t\tresultWhere.or = where.or.filter((it): it is Input.Where => !!it).map(it => this.injectToWhere(it, entity, isRoot, relationContext))\n\t\t}\n\t\tif (where.not) {\n\t\t\tresultWhere.not = this.injectToWhere(where.not, entity, isRoot, relationContext)\n\t\t}\n\n\t\tconst fields = Object.keys(where).filter(it => !['and', 'or', 'not'].includes(it))\n\n\t\tif (fields.length === 0) {\n\t\t\treturn resultWhere\n\t\t}\n\t\tfor (let field of fields) {\n\t\t\tresultWhere[field] = acceptFieldVisitor(this.schema, entity, field, {\n\t\t\t\tvisitColumn: () => where[field],\n\t\t\t\tvisitRelation: context => {\n\t\t\t\t\tconst relationWhere = where[field] as Input.OptionalWhere | null\n\t\t\t\t\tif (relationWhere === null) {\n\t\t\t\t\t\treturn null\n\t\t\t\t\t}\n\t\t\t\t\treturn this.injectToWhere(relationWhere, context.targetEntity, false, context)\n\t\t\t\t},\n\t\t\t})\n\t\t}\n\t\tconst fieldsForPredicate = !isRoot\n\t\t\t? fields\n\t\t\t: fields.filter(it => this.predicateFactory.shouldApplyCellLevelPredicate(entity, Acl.Operation.read, it))\n\n\t\treturn this.createWhere(entity, fieldsForPredicate, resultWhere, relationContext)\n\t}\n\n}\n"],"names":[],"mappings":";;AAIO,MAAM,mBAAmB;AAAA,EAC/B,YAA6B,QAAuC,kBAAoC;AAA3E,SAAA,SAAA;AAAuC,SAAA,mBAAA;AAAA,EAAA;AAAA,EAE7D,OAAO,QAAsB,OAA4B,iBAAiE;AAChI,UAAM,kBAAkB,KAAK,cAAc,OAAO,QAAQ,IAAI;AAC9D,WAAO,KAAK,YAAY,QAAQ,QAAW,iBAAiB,eAAe;AAAA,EAAA;AAAA,EAGpE,YACP,QACA,YACA,OACA,iBACsB;AAChB,UAAA,kBAAkB,KAAK,iBAAiB,OAAO,QAAQ,IAAI,UAAU,MAAM,YAAY,eAAe;AAC5G,YAAQ,KAAK,iBAAiB,mBAAmB,OAAO,eAAe;AAEvE,UAAM,MAAM,CAAC,OAAO,eAAe,EAAE,OAAO,CAAM,OAAA,OAAO,KAAK,EAAE,EAAE,SAAS,CAAC;AACxE,QAAA,IAAI,WAAW,GAAG;AACrB,aAAO,CAAC;AAAA,IAAA;AAEL,QAAA,IAAI,WAAW,GAAG;AACrB,aAAO,IAAI,CAAC;AAAA,IAAA;AAEb,WAAO,EAAE,IAAS;AAAA,EAAA;AAAA,EAGX,cACP,OACA,QACA,QACA,iBACsB;AACtB,UAAM,cAA6C,CAAC;AACpD,QAAI,MAAM,KAAK;AACd,kBAAY,MAAM,MAAM,IAAI,OAAO,CAAC,OAA0B,CAAC,CAAC,EAAE,EAAE,IAAI,QAAM,KAAK,cAAc,IAAI,QAAQ,QAAQ,eAAe,CAAC;AAAA,IAAA;AAEtI,QAAI,MAAM,IAAI;AACb,kBAAY,KAAK,MAAM,GAAG,OAAO,CAAC,OAA0B,CAAC,CAAC,EAAE,EAAE,IAAI,QAAM,KAAK,cAAc,IAAI,QAAQ,QAAQ,eAAe,CAAC;AAAA,IAAA;AAEpI,QAAI,MAAM,KAAK;AACd,kBAAY,MAAM,KAAK,cAAc,MAAM,KAAK,QAAQ,QAAQ,eAAe;AAAA,IAAA;AAGhF,UAAM,SAAS,OAAO,KAAK,KAAK,EAAE,OAAO,CAAA,OAAM,CAAC,CAAC,OAAO,MAAM,KAAK,EAAE,SAAS,EAAE,CAAC;AAE7E,QAAA,OAAO,WAAW,GAAG;AACjB,aAAA;AAAA,IAAA;AAER,aAAS,SAAS,QAAQ;AACzB,kBAAY,KAAK,IAAI,mBAAmB,KAAK,QAAQ,QAAQ,OAAO;AAAA,QACnE,aAAa,MAAM,MAAM,KAAK;AAAA,QAC9B,eAAe,CAAW,YAAA;AACnB,gBAAA,gBAAgB,MAAM,KAAK;AACjC,cAAI,kBAAkB,MAAM;AACpB,mBAAA;AAAA,UAAA;AAER,iBAAO,KAAK,cAAc,eAAe,QAAQ,cAAc,OAAO,OAAO;AAAA,QAAA;AAAA,MAC9E,CACA;AAAA,IAAA;AAEF,UAAM,qBAAqB,CAAC,SACzB,SACA,OAAO,OAAO,CAAA,OAAM,KAAK,iBAAiB,8BAA8B,QAAQ,IAAI,UAAU,MAAM,EAAE,CAAC;AAE1G,WAAO,KAAK,YAAY,QAAQ,oBAAoB,aAAa,eAAe;AAAA,EAAA;AAGlF;"}
@@ -1 +1 @@
1
- {"version":3,"file":"VariableInjector.cjs","sources":["../../../../../packages/engine-content-api/src/acl/VariableInjector.ts"],"sourcesContent":["import { Acl, Input, Model } from '@contember/schema'\nimport { PredicateDefinitionProcessor } from '@contember/schema-utils'\n\nexport class VariableInjector {\n\tprivate injectorCache = new WeakMap<Acl.PredicateDefinition, Input.Where>()\n\n\tconstructor(private readonly schema: Model.Schema, private readonly variables: Acl.VariablesMap) {}\n\n\tpublic inject(entity: Model.Entity, where: Acl.PredicateDefinition): Input.Where {\n\t\tconst cacheEntry = this.injectorCache.get(where)\n\t\tif (cacheEntry !== undefined) {\n\t\t\treturn cacheEntry\n\t\t}\n\t\tconst predicateDefinitionProcessor = new PredicateDefinitionProcessor(this.schema)\n\n\t\tconst resultWhere = predicateDefinitionProcessor.process(entity, where, {\n\t\t\thandleColumn: ({ value }) => {\n\t\t\t\tif (typeof value === 'string') {\n\t\t\t\t\treturn this.variables[value] ?? { never: true }\n\t\t\t\t}\n\t\t\t\treturn value as Input.Condition\n\t\t\t},\n\t\t\thandleRelation: ({ value, targetEntity }) => {\n\t\t\t\tif (typeof value === 'string') {\n\t\t\t\t\treturn { [targetEntity.primary]: this.variables[value] ?? { never: true } }\n\t\t\t\t}\n\t\t\t\treturn value\n\t\t\t},\n\t\t})\n\t\tthis.injectorCache.set(where, resultWhere)\n\t\treturn resultWhere\n\t}\n}\n"],"names":["PredicateDefinitionProcessor"],"mappings":";;;;;;AAGO,MAAM,iBAAiB;AAAA,EAG7B,YAA6B,QAAuC,WAA6B;AAApE,SAAA,SAAA;AAAuC,SAAA,YAAA;AAF5D,kBAAA,MAAA,qCAAoB,QAA8C,CAAA;AAAA,EAEwB;AAAA,EAE3F,OAAO,QAAsB,OAA6C;AAChF,UAAM,aAAa,KAAK,cAAc,IAAI,KAAK;AAC/C,QAAI,eAAe,QAAW;AACtB,aAAA;AAAA,IACR;AACA,UAAM,+BAA+B,IAAIA,YAAAA,6BAA6B,KAAK,MAAM;AAEjF,UAAM,cAAc,6BAA6B,QAAQ,QAAQ,OAAO;AAAA,MACvE,cAAc,CAAC,EAAE,YAAY;AACxB,YAAA,OAAO,UAAU,UAAU;AAC9B,iBAAO,KAAK,UAAU,KAAK,KAAK,EAAE,OAAO;QAC1C;AACO,eAAA;AAAA,MACR;AAAA,MACA,gBAAgB,CAAC,EAAE,OAAO,mBAAmB;AACxC,YAAA,OAAO,UAAU,UAAU;AAC9B,iBAAO,EAAE,CAAC,aAAa,OAAO,GAAG,KAAK,UAAU,KAAK,KAAK,EAAE,OAAO,KAAA;QACpE;AACO,eAAA;AAAA,MACR;AAAA,IAAA,CACA;AACI,SAAA,cAAc,IAAI,OAAO,WAAW;AAClC,WAAA;AAAA,EACR;AACD;;"}
1
+ {"version":3,"file":"VariableInjector.cjs","sources":["../../../../../packages/engine-content-api/src/acl/VariableInjector.ts"],"sourcesContent":["import { Acl, Input, Model } from '@contember/schema'\nimport { PredicateDefinitionProcessor } from '@contember/schema-utils'\n\nexport class VariableInjector {\n\tprivate injectorCache = new WeakMap<Acl.PredicateDefinition, Input.Where>()\n\n\tconstructor(private readonly schema: Model.Schema, private readonly variables: Acl.VariablesMap) {}\n\n\tpublic inject(entity: Model.Entity, where: Acl.PredicateDefinition): Input.Where {\n\t\tconst cacheEntry = this.injectorCache.get(where)\n\t\tif (cacheEntry !== undefined) {\n\t\t\treturn cacheEntry\n\t\t}\n\t\tconst predicateDefinitionProcessor = new PredicateDefinitionProcessor(this.schema)\n\n\t\tconst resultWhere = predicateDefinitionProcessor.process(entity, where, {\n\t\t\thandleColumn: ({ value }) => {\n\t\t\t\tif (typeof value === 'string') {\n\t\t\t\t\treturn this.variables[value] ?? { never: true }\n\t\t\t\t}\n\t\t\t\treturn value as Input.Condition\n\t\t\t},\n\t\t\thandleRelation: ({ value, targetEntity }) => {\n\t\t\t\tif (typeof value === 'string') {\n\t\t\t\t\treturn { [targetEntity.primary]: this.variables[value] ?? { never: true } }\n\t\t\t\t}\n\t\t\t\treturn value\n\t\t\t},\n\t\t})\n\t\tthis.injectorCache.set(where, resultWhere)\n\t\treturn resultWhere\n\t}\n}\n"],"names":["PredicateDefinitionProcessor"],"mappings":";;;;;;AAGO,MAAM,iBAAiB;AAAA,EAG7B,YAA6B,QAAuC,WAA6B;AAApE,SAAA,SAAA;AAAuC,SAAA,YAAA;AAF5D,kBAAA,MAAA,qCAAoB,QAA8C,CAAA;AAAA,EAAA;AAAA,EAInE,OAAO,QAAsB,OAA6C;AAChF,UAAM,aAAa,KAAK,cAAc,IAAI,KAAK;AAC/C,QAAI,eAAe,QAAW;AACtB,aAAA;AAAA,IAAA;AAER,UAAM,+BAA+B,IAAIA,yCAA6B,KAAK,MAAM;AAEjF,UAAM,cAAc,6BAA6B,QAAQ,QAAQ,OAAO;AAAA,MACvE,cAAc,CAAC,EAAE,YAAY;AACxB,YAAA,OAAO,UAAU,UAAU;AAC9B,iBAAO,KAAK,UAAU,KAAK,KAAK,EAAE,OAAO,KAAK;AAAA,QAAA;AAExC,eAAA;AAAA,MACR;AAAA,MACA,gBAAgB,CAAC,EAAE,OAAO,mBAAmB;AACxC,YAAA,OAAO,UAAU,UAAU;AAC9B,iBAAO,EAAE,CAAC,aAAa,OAAO,GAAG,KAAK,UAAU,KAAK,KAAK,EAAE,OAAO,OAAO;AAAA,QAAA;AAEpE,eAAA;AAAA,MAAA;AAAA,IACR,CACA;AACI,SAAA,cAAc,IAAI,OAAO,WAAW;AAClC,WAAA;AAAA,EAAA;AAET;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"VariableInjector.js","sources":["../../../../../packages/engine-content-api/src/acl/VariableInjector.ts"],"sourcesContent":["import { Acl, Input, Model } from '@contember/schema'\nimport { PredicateDefinitionProcessor } from '@contember/schema-utils'\n\nexport class VariableInjector {\n\tprivate injectorCache = new WeakMap<Acl.PredicateDefinition, Input.Where>()\n\n\tconstructor(private readonly schema: Model.Schema, private readonly variables: Acl.VariablesMap) {}\n\n\tpublic inject(entity: Model.Entity, where: Acl.PredicateDefinition): Input.Where {\n\t\tconst cacheEntry = this.injectorCache.get(where)\n\t\tif (cacheEntry !== undefined) {\n\t\t\treturn cacheEntry\n\t\t}\n\t\tconst predicateDefinitionProcessor = new PredicateDefinitionProcessor(this.schema)\n\n\t\tconst resultWhere = predicateDefinitionProcessor.process(entity, where, {\n\t\t\thandleColumn: ({ value }) => {\n\t\t\t\tif (typeof value === 'string') {\n\t\t\t\t\treturn this.variables[value] ?? { never: true }\n\t\t\t\t}\n\t\t\t\treturn value as Input.Condition\n\t\t\t},\n\t\t\thandleRelation: ({ value, targetEntity }) => {\n\t\t\t\tif (typeof value === 'string') {\n\t\t\t\t\treturn { [targetEntity.primary]: this.variables[value] ?? { never: true } }\n\t\t\t\t}\n\t\t\t\treturn value\n\t\t\t},\n\t\t})\n\t\tthis.injectorCache.set(where, resultWhere)\n\t\treturn resultWhere\n\t}\n}\n"],"names":[],"mappings":";;;;AAGO,MAAM,iBAAiB;AAAA,EAG7B,YAA6B,QAAuC,WAA6B;AAApE,SAAA,SAAA;AAAuC,SAAA,YAAA;AAF5D,kBAAA,MAAA,qCAAoB,QAA8C,CAAA;AAAA,EAEwB;AAAA,EAE3F,OAAO,QAAsB,OAA6C;AAChF,UAAM,aAAa,KAAK,cAAc,IAAI,KAAK;AAC/C,QAAI,eAAe,QAAW;AACtB,aAAA;AAAA,IACR;AACA,UAAM,+BAA+B,IAAI,6BAA6B,KAAK,MAAM;AAEjF,UAAM,cAAc,6BAA6B,QAAQ,QAAQ,OAAO;AAAA,MACvE,cAAc,CAAC,EAAE,YAAY;AACxB,YAAA,OAAO,UAAU,UAAU;AAC9B,iBAAO,KAAK,UAAU,KAAK,KAAK,EAAE,OAAO;QAC1C;AACO,eAAA;AAAA,MACR;AAAA,MACA,gBAAgB,CAAC,EAAE,OAAO,mBAAmB;AACxC,YAAA,OAAO,UAAU,UAAU;AAC9B,iBAAO,EAAE,CAAC,aAAa,OAAO,GAAG,KAAK,UAAU,KAAK,KAAK,EAAE,OAAO,KAAA;QACpE;AACO,eAAA;AAAA,MACR;AAAA,IAAA,CACA;AACI,SAAA,cAAc,IAAI,OAAO,WAAW;AAClC,WAAA;AAAA,EACR;AACD;"}
1
+ {"version":3,"file":"VariableInjector.js","sources":["../../../../../packages/engine-content-api/src/acl/VariableInjector.ts"],"sourcesContent":["import { Acl, Input, Model } from '@contember/schema'\nimport { PredicateDefinitionProcessor } from '@contember/schema-utils'\n\nexport class VariableInjector {\n\tprivate injectorCache = new WeakMap<Acl.PredicateDefinition, Input.Where>()\n\n\tconstructor(private readonly schema: Model.Schema, private readonly variables: Acl.VariablesMap) {}\n\n\tpublic inject(entity: Model.Entity, where: Acl.PredicateDefinition): Input.Where {\n\t\tconst cacheEntry = this.injectorCache.get(where)\n\t\tif (cacheEntry !== undefined) {\n\t\t\treturn cacheEntry\n\t\t}\n\t\tconst predicateDefinitionProcessor = new PredicateDefinitionProcessor(this.schema)\n\n\t\tconst resultWhere = predicateDefinitionProcessor.process(entity, where, {\n\t\t\thandleColumn: ({ value }) => {\n\t\t\t\tif (typeof value === 'string') {\n\t\t\t\t\treturn this.variables[value] ?? { never: true }\n\t\t\t\t}\n\t\t\t\treturn value as Input.Condition\n\t\t\t},\n\t\t\thandleRelation: ({ value, targetEntity }) => {\n\t\t\t\tif (typeof value === 'string') {\n\t\t\t\t\treturn { [targetEntity.primary]: this.variables[value] ?? { never: true } }\n\t\t\t\t}\n\t\t\t\treturn value\n\t\t\t},\n\t\t})\n\t\tthis.injectorCache.set(where, resultWhere)\n\t\treturn resultWhere\n\t}\n}\n"],"names":[],"mappings":";;;;AAGO,MAAM,iBAAiB;AAAA,EAG7B,YAA6B,QAAuC,WAA6B;AAApE,SAAA,SAAA;AAAuC,SAAA,YAAA;AAF5D,kBAAA,MAAA,qCAAoB,QAA8C,CAAA;AAAA,EAAA;AAAA,EAInE,OAAO,QAAsB,OAA6C;AAChF,UAAM,aAAa,KAAK,cAAc,IAAI,KAAK;AAC/C,QAAI,eAAe,QAAW;AACtB,aAAA;AAAA,IAAA;AAER,UAAM,+BAA+B,IAAI,6BAA6B,KAAK,MAAM;AAEjF,UAAM,cAAc,6BAA6B,QAAQ,QAAQ,OAAO;AAAA,MACvE,cAAc,CAAC,EAAE,YAAY;AACxB,YAAA,OAAO,UAAU,UAAU;AAC9B,iBAAO,KAAK,UAAU,KAAK,KAAK,EAAE,OAAO,KAAK;AAAA,QAAA;AAExC,eAAA;AAAA,MACR;AAAA,MACA,gBAAgB,CAAC,EAAE,OAAO,mBAAmB;AACxC,YAAA,OAAO,UAAU,UAAU;AAC9B,iBAAO,EAAE,CAAC,aAAa,OAAO,GAAG,KAAK,UAAU,KAAK,KAAK,EAAE,OAAO,OAAO;AAAA,QAAA;AAEpE,eAAA;AAAA,MAAA;AAAA,IACR,CACA;AACI,SAAA,cAAc,IAAI,OAAO,WAAW;AAClC,WAAA;AAAA,EAAA;AAET;"}
@@ -1 +1 @@
1
- {"version":3,"file":"VariableUtils.cjs","sources":["../../../../../packages/engine-content-api/src/acl/VariableUtils.ts"],"sourcesContent":["import { Acl, Input } from '@contember/schema'\nimport { getRoleVariables, ParsedMembership } from '@contember/schema-utils'\n\n\nexport const createAclVariables = (\n\taclSchema: Acl.Schema,\n\tmemberships: readonly ParsedMembership[],\n): Acl.VariablesMap => {\n\n\tconst variablesEntries = memberships.flatMap(\n\t\tmembership => {\n\t\t\tconst roleVariables = getRoleVariables(membership.role, aclSchema)\n\t\t\tconst membershipVariablesMap = Object.fromEntries(membership.variables.map(it => [it.name, it.condition]))\n\n\t\t\treturn Object.keys(roleVariables).map((name): [string, Input.Condition] => {\n\t\t\t\tconst prefixed = prefixVariable(membership.role, name)\n\t\t\t\treturn [prefixed, membershipVariablesMap[name] ?? { never: true }]\n\t\t\t})\n\t\t},\n\t)\n\n\treturn Object.fromEntries(variablesEntries)\n}\n\nexport const prefixVariable = (role: string, variableName: string) => `${role}__${variableName}`\n"],"names":["getRoleVariables"],"mappings":";;;AAIa,MAAA,qBAAqB,CACjC,WACA,gBACsB;AAEtB,QAAM,mBAAmB,YAAY;AAAA,IACpC,CAAc,eAAA;AACb,YAAM,gBAAgBA,YAAA,iBAAiB,WAAW,MAAM,SAAS;AACjE,YAAM,yBAAyB,OAAO,YAAY,WAAW,UAAU,IAAI,CAAM,OAAA,CAAC,GAAG,MAAM,GAAG,SAAS,CAAC,CAAC;AAEzG,aAAO,OAAO,KAAK,aAAa,EAAE,IAAI,CAAC,SAAoC;AAC1E,cAAM,WAAW,eAAe,WAAW,MAAM,IAAI;AAC9C,eAAA,CAAC,UAAU,uBAAuB,IAAI,KAAK,EAAE,OAAO,MAAM;AAAA,MAAA,CACjE;AAAA,IACF;AAAA,EAAA;AAGM,SAAA,OAAO,YAAY,gBAAgB;AAC3C;AAEO,MAAM,iBAAiB,CAAC,MAAc,iBAAyB,GAAG,IAAI,KAAK,YAAY;;;"}
1
+ {"version":3,"file":"VariableUtils.cjs","sources":["../../../../../packages/engine-content-api/src/acl/VariableUtils.ts"],"sourcesContent":["import { Acl, Input } from '@contember/schema'\nimport { getRoleVariables, ParsedMembership } from '@contember/schema-utils'\n\n\nexport const createAclVariables = (\n\taclSchema: Acl.Schema,\n\tmemberships: readonly ParsedMembership[],\n): Acl.VariablesMap => {\n\n\tconst variablesEntries = memberships.flatMap(\n\t\tmembership => {\n\t\t\tconst roleVariables = getRoleVariables(membership.role, aclSchema)\n\t\t\tconst membershipVariablesMap = Object.fromEntries(membership.variables.map(it => [it.name, it.condition]))\n\n\t\t\treturn Object.keys(roleVariables).map((name): [string, Input.Condition] => {\n\t\t\t\tconst prefixed = prefixVariable(membership.role, name)\n\t\t\t\treturn [prefixed, membershipVariablesMap[name] ?? { never: true }]\n\t\t\t})\n\t\t},\n\t)\n\n\treturn Object.fromEntries(variablesEntries)\n}\n\nexport const prefixVariable = (role: string, variableName: string) => `${role}__${variableName}`\n"],"names":["getRoleVariables"],"mappings":";;;AAIa,MAAA,qBAAqB,CACjC,WACA,gBACsB;AAEtB,QAAM,mBAAmB,YAAY;AAAA,IACpC,CAAc,eAAA;AACb,YAAM,gBAAgBA,YAAA,iBAAiB,WAAW,MAAM,SAAS;AACjE,YAAM,yBAAyB,OAAO,YAAY,WAAW,UAAU,IAAI,CAAM,OAAA,CAAC,GAAG,MAAM,GAAG,SAAS,CAAC,CAAC;AAEzG,aAAO,OAAO,KAAK,aAAa,EAAE,IAAI,CAAC,SAAoC;AAC1E,cAAM,WAAW,eAAe,WAAW,MAAM,IAAI;AAC9C,eAAA,CAAC,UAAU,uBAAuB,IAAI,KAAK,EAAE,OAAO,MAAM;AAAA,MAAA,CACjE;AAAA,IAAA;AAAA,EAEH;AAEO,SAAA,OAAO,YAAY,gBAAgB;AAC3C;AAEO,MAAM,iBAAiB,CAAC,MAAc,iBAAyB,GAAG,IAAI,KAAK,YAAY;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"VariableUtils.js","sources":["../../../../../packages/engine-content-api/src/acl/VariableUtils.ts"],"sourcesContent":["import { Acl, Input } from '@contember/schema'\nimport { getRoleVariables, ParsedMembership } from '@contember/schema-utils'\n\n\nexport const createAclVariables = (\n\taclSchema: Acl.Schema,\n\tmemberships: readonly ParsedMembership[],\n): Acl.VariablesMap => {\n\n\tconst variablesEntries = memberships.flatMap(\n\t\tmembership => {\n\t\t\tconst roleVariables = getRoleVariables(membership.role, aclSchema)\n\t\t\tconst membershipVariablesMap = Object.fromEntries(membership.variables.map(it => [it.name, it.condition]))\n\n\t\t\treturn Object.keys(roleVariables).map((name): [string, Input.Condition] => {\n\t\t\t\tconst prefixed = prefixVariable(membership.role, name)\n\t\t\t\treturn [prefixed, membershipVariablesMap[name] ?? { never: true }]\n\t\t\t})\n\t\t},\n\t)\n\n\treturn Object.fromEntries(variablesEntries)\n}\n\nexport const prefixVariable = (role: string, variableName: string) => `${role}__${variableName}`\n"],"names":[],"mappings":";AAIa,MAAA,qBAAqB,CACjC,WACA,gBACsB;AAEtB,QAAM,mBAAmB,YAAY;AAAA,IACpC,CAAc,eAAA;AACb,YAAM,gBAAgB,iBAAiB,WAAW,MAAM,SAAS;AACjE,YAAM,yBAAyB,OAAO,YAAY,WAAW,UAAU,IAAI,CAAM,OAAA,CAAC,GAAG,MAAM,GAAG,SAAS,CAAC,CAAC;AAEzG,aAAO,OAAO,KAAK,aAAa,EAAE,IAAI,CAAC,SAAoC;AAC1E,cAAM,WAAW,eAAe,WAAW,MAAM,IAAI;AAC9C,eAAA,CAAC,UAAU,uBAAuB,IAAI,KAAK,EAAE,OAAO,MAAM;AAAA,MAAA,CACjE;AAAA,IACF;AAAA,EAAA;AAGM,SAAA,OAAO,YAAY,gBAAgB;AAC3C;AAEO,MAAM,iBAAiB,CAAC,MAAc,iBAAyB,GAAG,IAAI,KAAK,YAAY;"}
1
+ {"version":3,"file":"VariableUtils.js","sources":["../../../../../packages/engine-content-api/src/acl/VariableUtils.ts"],"sourcesContent":["import { Acl, Input } from '@contember/schema'\nimport { getRoleVariables, ParsedMembership } from '@contember/schema-utils'\n\n\nexport const createAclVariables = (\n\taclSchema: Acl.Schema,\n\tmemberships: readonly ParsedMembership[],\n): Acl.VariablesMap => {\n\n\tconst variablesEntries = memberships.flatMap(\n\t\tmembership => {\n\t\t\tconst roleVariables = getRoleVariables(membership.role, aclSchema)\n\t\t\tconst membershipVariablesMap = Object.fromEntries(membership.variables.map(it => [it.name, it.condition]))\n\n\t\t\treturn Object.keys(roleVariables).map((name): [string, Input.Condition] => {\n\t\t\t\tconst prefixed = prefixVariable(membership.role, name)\n\t\t\t\treturn [prefixed, membershipVariablesMap[name] ?? { never: true }]\n\t\t\t})\n\t\t},\n\t)\n\n\treturn Object.fromEntries(variablesEntries)\n}\n\nexport const prefixVariable = (role: string, variableName: string) => `${role}__${variableName}`\n"],"names":[],"mappings":";AAIa,MAAA,qBAAqB,CACjC,WACA,gBACsB;AAEtB,QAAM,mBAAmB,YAAY;AAAA,IACpC,CAAc,eAAA;AACb,YAAM,gBAAgB,iBAAiB,WAAW,MAAM,SAAS;AACjE,YAAM,yBAAyB,OAAO,YAAY,WAAW,UAAU,IAAI,CAAM,OAAA,CAAC,GAAG,MAAM,GAAG,SAAS,CAAC,CAAC;AAEzG,aAAO,OAAO,KAAK,aAAa,EAAE,IAAI,CAAC,SAAoC;AAC1E,cAAM,WAAW,eAAe,WAAW,MAAM,IAAI;AAC9C,eAAA,CAAC,UAAU,uBAAuB,IAAI,KAAK,EAAE,OAAO,MAAM;AAAA,MAAA,CACjE;AAAA,IAAA;AAAA,EAEH;AAEO,SAAA,OAAO,YAAY,gBAAgB;AAC3C;AAEO,MAAM,iBAAiB,CAAC,MAAc,iBAAyB,GAAG,IAAI,KAAK,YAAY;"}
@@ -1 +1 @@
1
- {"version":3,"file":"exception.cjs","sources":["../../../../packages/engine-content-api/src/exception.ts"],"sourcesContent":["export class ImplementationException extends Error {\n\tconstructor(message: string = '') {\n\t\tsuper(message)\n\t}\n}\n\nexport class UserError extends Error {\n\tpublic path = [] // otherwise graphql converts it to GraphqlError\n}\n"],"names":[],"mappings":";;;;;AAAO,MAAM,gCAAgC,MAAM;AAAA,EAClD,YAAY,UAAkB,IAAI;AACjC,UAAM,OAAO;AAAA,EACd;AACD;AAEO,MAAM,kBAAkB,MAAM;AAAA,EAA9B,cAAA;AAAA,UAAA,GAAA,SAAA;AACN,kBAAA,MAAO,QAAO,CAAA,CAAC;AAAA,EAAA;AAAA;AAChB;;;"}
1
+ {"version":3,"file":"exception.cjs","sources":["../../../../packages/engine-content-api/src/exception.ts"],"sourcesContent":["export class ImplementationException extends Error {\n\tconstructor(message: string = '') {\n\t\tsuper(message)\n\t}\n}\n\nexport class UserError extends Error {\n\tpublic path = [] // otherwise graphql converts it to GraphqlError\n}\n"],"names":[],"mappings":";;;;;AAAO,MAAM,gCAAgC,MAAM;AAAA,EAClD,YAAY,UAAkB,IAAI;AACjC,UAAM,OAAO;AAAA,EAAA;AAEf;AAEO,MAAM,kBAAkB,MAAM;AAAA,EAA9B,cAAA;AAAA,UAAA,GAAA,SAAA;AACN,kBAAA,MAAO,QAAO,EAAC;AAAA,EAAA;AAAA;AAChB;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"exception.js","sources":["../../../../packages/engine-content-api/src/exception.ts"],"sourcesContent":["export class ImplementationException extends Error {\n\tconstructor(message: string = '') {\n\t\tsuper(message)\n\t}\n}\n\nexport class UserError extends Error {\n\tpublic path = [] // otherwise graphql converts it to GraphqlError\n}\n"],"names":[],"mappings":";;;AAAO,MAAM,gCAAgC,MAAM;AAAA,EAClD,YAAY,UAAkB,IAAI;AACjC,UAAM,OAAO;AAAA,EACd;AACD;AAEO,MAAM,kBAAkB,MAAM;AAAA,EAA9B,cAAA;AAAA,UAAA,GAAA,SAAA;AACN,kBAAA,MAAO,QAAO,CAAA,CAAC;AAAA,EAAA;AAAA;AAChB;"}
1
+ {"version":3,"file":"exception.js","sources":["../../../../packages/engine-content-api/src/exception.ts"],"sourcesContent":["export class ImplementationException extends Error {\n\tconstructor(message: string = '') {\n\t\tsuper(message)\n\t}\n}\n\nexport class UserError extends Error {\n\tpublic path = [] // otherwise graphql converts it to GraphqlError\n}\n"],"names":[],"mappings":";;;AAAO,MAAM,gCAAgC,MAAM;AAAA,EAClD,YAAY,UAAkB,IAAI;AACjC,UAAM,OAAO;AAAA,EAAA;AAEf;AAEO,MAAM,kBAAkB,MAAM;AAAA,EAA9B,cAAA;AAAA,UAAA,GAAA,SAAA;AACN,kBAAA,MAAO,QAAO,EAAC;AAAA,EAAA;AAAA;AAChB;"}
@@ -1 +1 @@
1
- {"version":3,"file":"HasManyToHasOneReducer.cjs","sources":["../../../../../../packages/engine-content-api/src/extensions/hasManyToHasOneReducer/HasManyToHasOneReducer.ts"],"sourcesContent":["import { EntityFieldsProvider, FieldMap } from '../EntityFieldsProvider'\nimport { acceptFieldVisitor } from '@contember/schema-utils'\nimport { Model } from '@contember/schema'\nimport { HasManyToHasOneRelationReducerFieldVisitor } from './HasManyToHasOneRelationReducerVisitor'\n\nexport class HasManyToHasOneReducer implements EntityFieldsProvider<HasManyToHasOneReducerExtension> {\n\tstatic extensionName: string = 'HasManyToHasOneReducer'\n\n\tconstructor(\n\t\tprivate readonly schema: Model.Schema,\n\t\tprivate readonly visitor: HasManyToHasOneRelationReducerFieldVisitor,\n\t) {}\n\n\tgetFields(entity: Model.Entity, accessibleFields: Model.AnyField[]): FieldMap<HasManyToHasOneReducerExtension> {\n\t\tconst fieldMap: FieldMap<HasManyToHasOneReducerExtension> = {}\n\t\tfor (const field of accessibleFields) {\n\t\t\tif (field.type !== Model.RelationType.OneHasMany) {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tfor (const [name, resultField] of acceptFieldVisitor(this.schema, entity, field, this.visitor)) {\n\t\t\t\tfieldMap[name] = resultField\n\t\t\t}\n\t\t}\n\t\treturn fieldMap\n\t}\n}\n\nexport interface HasManyToHasOneReducerExtension {\n\trelationName: string\n}\n"],"names":["schema","Model","acceptFieldVisitor"],"mappings":";;;;;;;AAKO,MAAM,uBAAwF;AAAA,EAGpG,YACkBA,SACA,SAChB;AAFgB,SAAA,SAAAA;AACA,SAAA,UAAA;AAAA,EACf;AAAA,EAEH,UAAU,QAAsB,kBAA+E;AAC9G,UAAM,WAAsD,CAAA;AAC5D,eAAW,SAAS,kBAAkB;AACrC,UAAI,MAAM,SAASC,aAAM,aAAa,YAAY;AACjD;AAAA,MACD;AAEW,iBAAA,CAAC,MAAM,WAAW,KAAKC,YAAAA,mBAAmB,KAAK,QAAQ,QAAQ,OAAO,KAAK,OAAO,GAAG;AAC/F,iBAAS,IAAI,IAAI;AAAA,MAClB;AAAA,IACD;AACO,WAAA;AAAA,EACR;AACD;AApBC,cADY,wBACL,iBAAwB,wBAAA;;"}
1
+ {"version":3,"file":"HasManyToHasOneReducer.cjs","sources":["../../../../../../packages/engine-content-api/src/extensions/hasManyToHasOneReducer/HasManyToHasOneReducer.ts"],"sourcesContent":["import { EntityFieldsProvider, FieldMap } from '../EntityFieldsProvider'\nimport { acceptFieldVisitor } from '@contember/schema-utils'\nimport { Model } from '@contember/schema'\nimport { HasManyToHasOneRelationReducerFieldVisitor } from './HasManyToHasOneRelationReducerVisitor'\n\nexport class HasManyToHasOneReducer implements EntityFieldsProvider<HasManyToHasOneReducerExtension> {\n\tstatic extensionName: string = 'HasManyToHasOneReducer'\n\n\tconstructor(\n\t\tprivate readonly schema: Model.Schema,\n\t\tprivate readonly visitor: HasManyToHasOneRelationReducerFieldVisitor,\n\t) {}\n\n\tgetFields(entity: Model.Entity, accessibleFields: Model.AnyField[]): FieldMap<HasManyToHasOneReducerExtension> {\n\t\tconst fieldMap: FieldMap<HasManyToHasOneReducerExtension> = {}\n\t\tfor (const field of accessibleFields) {\n\t\t\tif (field.type !== Model.RelationType.OneHasMany) {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tfor (const [name, resultField] of acceptFieldVisitor(this.schema, entity, field, this.visitor)) {\n\t\t\t\tfieldMap[name] = resultField\n\t\t\t}\n\t\t}\n\t\treturn fieldMap\n\t}\n}\n\nexport interface HasManyToHasOneReducerExtension {\n\trelationName: string\n}\n"],"names":["schema","Model","acceptFieldVisitor"],"mappings":";;;;;;;AAKO,MAAM,uBAAwF;AAAA,EAGpG,YACkBA,SACA,SAChB;AAFgB,SAAA,SAAAA;AACA,SAAA,UAAA;AAAA,EAAA;AAAA,EAGlB,UAAU,QAAsB,kBAA+E;AAC9G,UAAM,WAAsD,CAAC;AAC7D,eAAW,SAAS,kBAAkB;AACrC,UAAI,MAAM,SAASC,aAAM,aAAa,YAAY;AACjD;AAAA,MAAA;AAGU,iBAAA,CAAC,MAAM,WAAW,KAAKC,YAAAA,mBAAmB,KAAK,QAAQ,QAAQ,OAAO,KAAK,OAAO,GAAG;AAC/F,iBAAS,IAAI,IAAI;AAAA,MAAA;AAAA,IAClB;AAEM,WAAA;AAAA,EAAA;AAET;AApBC,cADY,wBACL,iBAAwB,wBAAA;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"HasManyToHasOneReducer.js","sources":["../../../../../../packages/engine-content-api/src/extensions/hasManyToHasOneReducer/HasManyToHasOneReducer.ts"],"sourcesContent":["import { EntityFieldsProvider, FieldMap } from '../EntityFieldsProvider'\nimport { acceptFieldVisitor } from '@contember/schema-utils'\nimport { Model } from '@contember/schema'\nimport { HasManyToHasOneRelationReducerFieldVisitor } from './HasManyToHasOneRelationReducerVisitor'\n\nexport class HasManyToHasOneReducer implements EntityFieldsProvider<HasManyToHasOneReducerExtension> {\n\tstatic extensionName: string = 'HasManyToHasOneReducer'\n\n\tconstructor(\n\t\tprivate readonly schema: Model.Schema,\n\t\tprivate readonly visitor: HasManyToHasOneRelationReducerFieldVisitor,\n\t) {}\n\n\tgetFields(entity: Model.Entity, accessibleFields: Model.AnyField[]): FieldMap<HasManyToHasOneReducerExtension> {\n\t\tconst fieldMap: FieldMap<HasManyToHasOneReducerExtension> = {}\n\t\tfor (const field of accessibleFields) {\n\t\t\tif (field.type !== Model.RelationType.OneHasMany) {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tfor (const [name, resultField] of acceptFieldVisitor(this.schema, entity, field, this.visitor)) {\n\t\t\t\tfieldMap[name] = resultField\n\t\t\t}\n\t\t}\n\t\treturn fieldMap\n\t}\n}\n\nexport interface HasManyToHasOneReducerExtension {\n\trelationName: string\n}\n"],"names":[],"mappings":";;;;;AAKO,MAAM,uBAAwF;AAAA,EAGpG,YACkB,QACA,SAChB;AAFgB,SAAA,SAAA;AACA,SAAA,UAAA;AAAA,EACf;AAAA,EAEH,UAAU,QAAsB,kBAA+E;AAC9G,UAAM,WAAsD,CAAA;AAC5D,eAAW,SAAS,kBAAkB;AACrC,UAAI,MAAM,SAAS,MAAM,aAAa,YAAY;AACjD;AAAA,MACD;AAEW,iBAAA,CAAC,MAAM,WAAW,KAAK,mBAAmB,KAAK,QAAQ,QAAQ,OAAO,KAAK,OAAO,GAAG;AAC/F,iBAAS,IAAI,IAAI;AAAA,MAClB;AAAA,IACD;AACO,WAAA;AAAA,EACR;AACD;AApBC,cADY,wBACL,iBAAwB,wBAAA;"}
1
+ {"version":3,"file":"HasManyToHasOneReducer.js","sources":["../../../../../../packages/engine-content-api/src/extensions/hasManyToHasOneReducer/HasManyToHasOneReducer.ts"],"sourcesContent":["import { EntityFieldsProvider, FieldMap } from '../EntityFieldsProvider'\nimport { acceptFieldVisitor } from '@contember/schema-utils'\nimport { Model } from '@contember/schema'\nimport { HasManyToHasOneRelationReducerFieldVisitor } from './HasManyToHasOneRelationReducerVisitor'\n\nexport class HasManyToHasOneReducer implements EntityFieldsProvider<HasManyToHasOneReducerExtension> {\n\tstatic extensionName: string = 'HasManyToHasOneReducer'\n\n\tconstructor(\n\t\tprivate readonly schema: Model.Schema,\n\t\tprivate readonly visitor: HasManyToHasOneRelationReducerFieldVisitor,\n\t) {}\n\n\tgetFields(entity: Model.Entity, accessibleFields: Model.AnyField[]): FieldMap<HasManyToHasOneReducerExtension> {\n\t\tconst fieldMap: FieldMap<HasManyToHasOneReducerExtension> = {}\n\t\tfor (const field of accessibleFields) {\n\t\t\tif (field.type !== Model.RelationType.OneHasMany) {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tfor (const [name, resultField] of acceptFieldVisitor(this.schema, entity, field, this.visitor)) {\n\t\t\t\tfieldMap[name] = resultField\n\t\t\t}\n\t\t}\n\t\treturn fieldMap\n\t}\n}\n\nexport interface HasManyToHasOneReducerExtension {\n\trelationName: string\n}\n"],"names":[],"mappings":";;;;;AAKO,MAAM,uBAAwF;AAAA,EAGpG,YACkB,QACA,SAChB;AAFgB,SAAA,SAAA;AACA,SAAA,UAAA;AAAA,EAAA;AAAA,EAGlB,UAAU,QAAsB,kBAA+E;AAC9G,UAAM,WAAsD,CAAC;AAC7D,eAAW,SAAS,kBAAkB;AACrC,UAAI,MAAM,SAAS,MAAM,aAAa,YAAY;AACjD;AAAA,MAAA;AAGU,iBAAA,CAAC,MAAM,WAAW,KAAK,mBAAmB,KAAK,QAAQ,QAAQ,OAAO,KAAK,OAAO,GAAG;AAC/F,iBAAS,IAAI,IAAI;AAAA,MAAA;AAAA,IAClB;AAEM,WAAA;AAAA,EAAA;AAET;AApBC,cADY,wBACL,iBAAwB,wBAAA;"}
@@ -1 +1 @@
1
- {"version":3,"file":"HasManyToHasOneReducerExecutionHandler.cjs","sources":["../../../../../../packages/engine-content-api/src/extensions/hasManyToHasOneReducer/HasManyToHasOneReducerExecutionHandler.ts"],"sourcesContent":["import { Input, Model } from '@contember/schema'\nimport { isIt } from '../../utils'\nimport { acceptFieldVisitor } from '@contember/schema-utils'\nimport { SelectExecutionHandler, SelectExecutionHandlerContext } from '../../mapper'\nimport { ImplementationException } from '../../exception'\nimport { UniqueWhereExpander } from '../../inputProcessing'\nimport { HasManyToHasOneReducerExtension } from './HasManyToHasOneReducer'\n\nexport class HasManyToHasOneReducerExecutionHandler implements SelectExecutionHandler<Input.UniqueQueryInput, HasManyToHasOneReducerExtension> {\n\n\tconstructor(private readonly schema: Model.Schema, private readonly uniqueWhereExpander: UniqueWhereExpander) {}\n\n\tprocess(context: SelectExecutionHandlerContext<Input.UniqueQueryInput, HasManyToHasOneReducerExtension>): void {\n\t\tconst { addData, entity, objectNode } = context\n\t\tif (!objectNode) {\n\t\t\tthrow new Error()\n\t\t}\n\t\taddData({\n\t\t\tfield: entity.primary,\n\t\t\tdataProvider: async (ids: Input.PrimaryValue[]) => {\n\n\t\t\t\tconst relationContext = acceptFieldVisitor(this.schema, entity, objectNode.extensions.relationName, {\n\t\t\t\t\tvisitRelation: context => context,\n\t\t\t\t\tvisitColumn: (): never => {\n\t\t\t\t\t\tthrow new ImplementationException('HasManyToHasOneReducerExecutionHandler: Not applicable for a column')\n\t\t\t\t\t},\n\t\t\t\t})\n\n\t\t\t\tconst { targetEntity, targetRelation } = relationContext\n\t\t\t\tif (!targetRelation || !isIt<Model.JoiningColumnRelation>(targetRelation, 'joiningColumn')) {\n\t\t\t\t\tthrow new Error('HasManyToHasOneReducerExecutionHandler: only applicable for relations with joiningColumn')\n\t\t\t\t}\n\n\t\t\t\tconst uniqueWhere = this.uniqueWhereExpander.expand(targetEntity, {\n\t\t\t\t\t...objectNode.args.by,\n\t\t\t\t\t[targetRelation.name]: { [entity.primary]: ids },\n\t\t\t\t})\n\t\t\t\tif (Object.keys(uniqueWhere).length !== 2) {\n\t\t\t\t\tthrow new Error('HasManyToHasOneReducerExecutionHandler: only tuple unique keys are allowed')\n\t\t\t\t}\n\t\t\t\tconst whereWithParentId = {\n\t\t\t\t\tand: [objectNode.args.filter || {}, uniqueWhere],\n\t\t\t\t}\n\t\t\t\tconst newObjectNode = objectNode.withArgs<Input.ListQueryInput>({ filter: whereWithParentId })\n\n\t\t\t\treturn context.mapper.selectAssoc(targetEntity, newObjectNode, [\n\t\t\t\t\t...context.relationPath,\n\t\t\t\t\trelationContext,\n\t\t\t\t], targetRelation.name)\n\t\t\t},\n\t\t\tdefaultValue: null,\n\t\t})\n\t}\n}\n"],"names":["acceptFieldVisitor","context","ImplementationException","isIt"],"mappings":";;;;;AAQO,MAAM,uCAAkI;AAAA,EAE9I,YAA6B,QAAuC,qBAA0C;AAAjF,SAAA,SAAA;AAAuC,SAAA,sBAAA;AAAA,EAA2C;AAAA,EAE/G,QAAQ,SAAuG;AAC9G,UAAM,EAAE,SAAS,QAAQ,WAAA,IAAe;AACxC,QAAI,CAAC,YAAY;AAChB,YAAM,IAAI,MAAM;AAAA,IACjB;AACQ,YAAA;AAAA,MACP,OAAO,OAAO;AAAA,MACd,cAAc,OAAO,QAA8B;AAElD,cAAM,kBAAkBA,YAAmB,mBAAA,KAAK,QAAQ,QAAQ,WAAW,WAAW,cAAc;AAAA,UACnG,eAAe,CAAAC,aAAWA;AAAAA,UAC1B,aAAa,MAAa;AACnB,kBAAA,IAAIC,UAAAA,wBAAwB,qEAAqE;AAAA,UACxG;AAAA,QAAA,CACA;AAEK,cAAA,EAAE,cAAc,eAAmB,IAAA;AACzC,YAAI,CAAC,kBAAkB,CAACC,KAAkC,KAAA,gBAAgB,eAAe,GAAG;AACrF,gBAAA,IAAI,MAAM,0FAA0F;AAAA,QAC3G;AAEA,cAAM,cAAc,KAAK,oBAAoB,OAAO,cAAc;AAAA,UACjE,GAAG,WAAW,KAAK;AAAA,UACnB,CAAC,eAAe,IAAI,GAAG,EAAE,CAAC,OAAO,OAAO,GAAG,IAAI;AAAA,QAAA,CAC/C;AACD,YAAI,OAAO,KAAK,WAAW,EAAE,WAAW,GAAG;AACpC,gBAAA,IAAI,MAAM,4EAA4E;AAAA,QAC7F;AACA,cAAM,oBAAoB;AAAA,UACzB,KAAK,CAAC,WAAW,KAAK,UAAU,CAAA,GAAI,WAAW;AAAA,QAAA;AAEhD,cAAM,gBAAgB,WAAW,SAA+B,EAAE,QAAQ,mBAAmB;AAE7F,eAAO,QAAQ,OAAO,YAAY,cAAc,eAAe;AAAA,UAC9D,GAAG,QAAQ;AAAA,UACX;AAAA,QAAA,GACE,eAAe,IAAI;AAAA,MACvB;AAAA,MACA,cAAc;AAAA,IAAA,CACd;AAAA,EACF;AACD;;"}
1
+ {"version":3,"file":"HasManyToHasOneReducerExecutionHandler.cjs","sources":["../../../../../../packages/engine-content-api/src/extensions/hasManyToHasOneReducer/HasManyToHasOneReducerExecutionHandler.ts"],"sourcesContent":["import { Input, Model } from '@contember/schema'\nimport { isIt } from '../../utils'\nimport { acceptFieldVisitor } from '@contember/schema-utils'\nimport { SelectExecutionHandler, SelectExecutionHandlerContext } from '../../mapper'\nimport { ImplementationException } from '../../exception'\nimport { UniqueWhereExpander } from '../../inputProcessing'\nimport { HasManyToHasOneReducerExtension } from './HasManyToHasOneReducer'\n\nexport class HasManyToHasOneReducerExecutionHandler implements SelectExecutionHandler<Input.UniqueQueryInput, HasManyToHasOneReducerExtension> {\n\n\tconstructor(private readonly schema: Model.Schema, private readonly uniqueWhereExpander: UniqueWhereExpander) {}\n\n\tprocess(context: SelectExecutionHandlerContext<Input.UniqueQueryInput, HasManyToHasOneReducerExtension>): void {\n\t\tconst { addData, entity, objectNode } = context\n\t\tif (!objectNode) {\n\t\t\tthrow new Error()\n\t\t}\n\t\taddData({\n\t\t\tfield: entity.primary,\n\t\t\tdataProvider: async (ids: Input.PrimaryValue[]) => {\n\n\t\t\t\tconst relationContext = acceptFieldVisitor(this.schema, entity, objectNode.extensions.relationName, {\n\t\t\t\t\tvisitRelation: context => context,\n\t\t\t\t\tvisitColumn: (): never => {\n\t\t\t\t\t\tthrow new ImplementationException('HasManyToHasOneReducerExecutionHandler: Not applicable for a column')\n\t\t\t\t\t},\n\t\t\t\t})\n\n\t\t\t\tconst { targetEntity, targetRelation } = relationContext\n\t\t\t\tif (!targetRelation || !isIt<Model.JoiningColumnRelation>(targetRelation, 'joiningColumn')) {\n\t\t\t\t\tthrow new Error('HasManyToHasOneReducerExecutionHandler: only applicable for relations with joiningColumn')\n\t\t\t\t}\n\n\t\t\t\tconst uniqueWhere = this.uniqueWhereExpander.expand(targetEntity, {\n\t\t\t\t\t...objectNode.args.by,\n\t\t\t\t\t[targetRelation.name]: { [entity.primary]: ids },\n\t\t\t\t})\n\t\t\t\tif (Object.keys(uniqueWhere).length !== 2) {\n\t\t\t\t\tthrow new Error('HasManyToHasOneReducerExecutionHandler: only tuple unique keys are allowed')\n\t\t\t\t}\n\t\t\t\tconst whereWithParentId = {\n\t\t\t\t\tand: [objectNode.args.filter || {}, uniqueWhere],\n\t\t\t\t}\n\t\t\t\tconst newObjectNode = objectNode.withArgs<Input.ListQueryInput>({ filter: whereWithParentId })\n\n\t\t\t\treturn context.mapper.selectAssoc(targetEntity, newObjectNode, [\n\t\t\t\t\t...context.relationPath,\n\t\t\t\t\trelationContext,\n\t\t\t\t], targetRelation.name)\n\t\t\t},\n\t\t\tdefaultValue: null,\n\t\t})\n\t}\n}\n"],"names":["acceptFieldVisitor","context","ImplementationException","isIt"],"mappings":";;;;;AAQO,MAAM,uCAAkI;AAAA,EAE9I,YAA6B,QAAuC,qBAA0C;AAAjF,SAAA,SAAA;AAAuC,SAAA,sBAAA;AAAA,EAAA;AAAA,EAEpE,QAAQ,SAAuG;AAC9G,UAAM,EAAE,SAAS,QAAQ,WAAe,IAAA;AACxC,QAAI,CAAC,YAAY;AAChB,YAAM,IAAI,MAAM;AAAA,IAAA;AAET,YAAA;AAAA,MACP,OAAO,OAAO;AAAA,MACd,cAAc,OAAO,QAA8B;AAElD,cAAM,kBAAkBA,YAAmB,mBAAA,KAAK,QAAQ,QAAQ,WAAW,WAAW,cAAc;AAAA,UACnG,eAAe,CAAAC,aAAWA;AAAAA,UAC1B,aAAa,MAAa;AACnB,kBAAA,IAAIC,kCAAwB,qEAAqE;AAAA,UAAA;AAAA,QACxG,CACA;AAEK,cAAA,EAAE,cAAc,eAAA,IAAmB;AACzC,YAAI,CAAC,kBAAkB,CAACC,KAAkC,KAAA,gBAAgB,eAAe,GAAG;AACrF,gBAAA,IAAI,MAAM,0FAA0F;AAAA,QAAA;AAG3G,cAAM,cAAc,KAAK,oBAAoB,OAAO,cAAc;AAAA,UACjE,GAAG,WAAW,KAAK;AAAA,UACnB,CAAC,eAAe,IAAI,GAAG,EAAE,CAAC,OAAO,OAAO,GAAG,IAAI;AAAA,QAAA,CAC/C;AACD,YAAI,OAAO,KAAK,WAAW,EAAE,WAAW,GAAG;AACpC,gBAAA,IAAI,MAAM,4EAA4E;AAAA,QAAA;AAE7F,cAAM,oBAAoB;AAAA,UACzB,KAAK,CAAC,WAAW,KAAK,UAAU,IAAI,WAAW;AAAA,QAChD;AACA,cAAM,gBAAgB,WAAW,SAA+B,EAAE,QAAQ,mBAAmB;AAE7F,eAAO,QAAQ,OAAO,YAAY,cAAc,eAAe;AAAA,UAC9D,GAAG,QAAQ;AAAA,UACX;AAAA,QAAA,GACE,eAAe,IAAI;AAAA,MACvB;AAAA,MACA,cAAc;AAAA,IAAA,CACd;AAAA,EAAA;AAEH;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"HasManyToHasOneReducerExecutionHandler.js","sources":["../../../../../../packages/engine-content-api/src/extensions/hasManyToHasOneReducer/HasManyToHasOneReducerExecutionHandler.ts"],"sourcesContent":["import { Input, Model } from '@contember/schema'\nimport { isIt } from '../../utils'\nimport { acceptFieldVisitor } from '@contember/schema-utils'\nimport { SelectExecutionHandler, SelectExecutionHandlerContext } from '../../mapper'\nimport { ImplementationException } from '../../exception'\nimport { UniqueWhereExpander } from '../../inputProcessing'\nimport { HasManyToHasOneReducerExtension } from './HasManyToHasOneReducer'\n\nexport class HasManyToHasOneReducerExecutionHandler implements SelectExecutionHandler<Input.UniqueQueryInput, HasManyToHasOneReducerExtension> {\n\n\tconstructor(private readonly schema: Model.Schema, private readonly uniqueWhereExpander: UniqueWhereExpander) {}\n\n\tprocess(context: SelectExecutionHandlerContext<Input.UniqueQueryInput, HasManyToHasOneReducerExtension>): void {\n\t\tconst { addData, entity, objectNode } = context\n\t\tif (!objectNode) {\n\t\t\tthrow new Error()\n\t\t}\n\t\taddData({\n\t\t\tfield: entity.primary,\n\t\t\tdataProvider: async (ids: Input.PrimaryValue[]) => {\n\n\t\t\t\tconst relationContext = acceptFieldVisitor(this.schema, entity, objectNode.extensions.relationName, {\n\t\t\t\t\tvisitRelation: context => context,\n\t\t\t\t\tvisitColumn: (): never => {\n\t\t\t\t\t\tthrow new ImplementationException('HasManyToHasOneReducerExecutionHandler: Not applicable for a column')\n\t\t\t\t\t},\n\t\t\t\t})\n\n\t\t\t\tconst { targetEntity, targetRelation } = relationContext\n\t\t\t\tif (!targetRelation || !isIt<Model.JoiningColumnRelation>(targetRelation, 'joiningColumn')) {\n\t\t\t\t\tthrow new Error('HasManyToHasOneReducerExecutionHandler: only applicable for relations with joiningColumn')\n\t\t\t\t}\n\n\t\t\t\tconst uniqueWhere = this.uniqueWhereExpander.expand(targetEntity, {\n\t\t\t\t\t...objectNode.args.by,\n\t\t\t\t\t[targetRelation.name]: { [entity.primary]: ids },\n\t\t\t\t})\n\t\t\t\tif (Object.keys(uniqueWhere).length !== 2) {\n\t\t\t\t\tthrow new Error('HasManyToHasOneReducerExecutionHandler: only tuple unique keys are allowed')\n\t\t\t\t}\n\t\t\t\tconst whereWithParentId = {\n\t\t\t\t\tand: [objectNode.args.filter || {}, uniqueWhere],\n\t\t\t\t}\n\t\t\t\tconst newObjectNode = objectNode.withArgs<Input.ListQueryInput>({ filter: whereWithParentId })\n\n\t\t\t\treturn context.mapper.selectAssoc(targetEntity, newObjectNode, [\n\t\t\t\t\t...context.relationPath,\n\t\t\t\t\trelationContext,\n\t\t\t\t], targetRelation.name)\n\t\t\t},\n\t\t\tdefaultValue: null,\n\t\t})\n\t}\n}\n"],"names":["context"],"mappings":";;;AAQO,MAAM,uCAAkI;AAAA,EAE9I,YAA6B,QAAuC,qBAA0C;AAAjF,SAAA,SAAA;AAAuC,SAAA,sBAAA;AAAA,EAA2C;AAAA,EAE/G,QAAQ,SAAuG;AAC9G,UAAM,EAAE,SAAS,QAAQ,WAAA,IAAe;AACxC,QAAI,CAAC,YAAY;AAChB,YAAM,IAAI,MAAM;AAAA,IACjB;AACQ,YAAA;AAAA,MACP,OAAO,OAAO;AAAA,MACd,cAAc,OAAO,QAA8B;AAElD,cAAM,kBAAkB,mBAAmB,KAAK,QAAQ,QAAQ,WAAW,WAAW,cAAc;AAAA,UACnG,eAAe,CAAAA,aAAWA;AAAAA,UAC1B,aAAa,MAAa;AACnB,kBAAA,IAAI,wBAAwB,qEAAqE;AAAA,UACxG;AAAA,QAAA,CACA;AAEK,cAAA,EAAE,cAAc,eAAmB,IAAA;AACzC,YAAI,CAAC,kBAAkB,CAAC,KAAkC,gBAAgB,eAAe,GAAG;AACrF,gBAAA,IAAI,MAAM,0FAA0F;AAAA,QAC3G;AAEA,cAAM,cAAc,KAAK,oBAAoB,OAAO,cAAc;AAAA,UACjE,GAAG,WAAW,KAAK;AAAA,UACnB,CAAC,eAAe,IAAI,GAAG,EAAE,CAAC,OAAO,OAAO,GAAG,IAAI;AAAA,QAAA,CAC/C;AACD,YAAI,OAAO,KAAK,WAAW,EAAE,WAAW,GAAG;AACpC,gBAAA,IAAI,MAAM,4EAA4E;AAAA,QAC7F;AACA,cAAM,oBAAoB;AAAA,UACzB,KAAK,CAAC,WAAW,KAAK,UAAU,CAAA,GAAI,WAAW;AAAA,QAAA;AAEhD,cAAM,gBAAgB,WAAW,SAA+B,EAAE,QAAQ,mBAAmB;AAE7F,eAAO,QAAQ,OAAO,YAAY,cAAc,eAAe;AAAA,UAC9D,GAAG,QAAQ;AAAA,UACX;AAAA,QAAA,GACE,eAAe,IAAI;AAAA,MACvB;AAAA,MACA,cAAc;AAAA,IAAA,CACd;AAAA,EACF;AACD;"}
1
+ {"version":3,"file":"HasManyToHasOneReducerExecutionHandler.js","sources":["../../../../../../packages/engine-content-api/src/extensions/hasManyToHasOneReducer/HasManyToHasOneReducerExecutionHandler.ts"],"sourcesContent":["import { Input, Model } from '@contember/schema'\nimport { isIt } from '../../utils'\nimport { acceptFieldVisitor } from '@contember/schema-utils'\nimport { SelectExecutionHandler, SelectExecutionHandlerContext } from '../../mapper'\nimport { ImplementationException } from '../../exception'\nimport { UniqueWhereExpander } from '../../inputProcessing'\nimport { HasManyToHasOneReducerExtension } from './HasManyToHasOneReducer'\n\nexport class HasManyToHasOneReducerExecutionHandler implements SelectExecutionHandler<Input.UniqueQueryInput, HasManyToHasOneReducerExtension> {\n\n\tconstructor(private readonly schema: Model.Schema, private readonly uniqueWhereExpander: UniqueWhereExpander) {}\n\n\tprocess(context: SelectExecutionHandlerContext<Input.UniqueQueryInput, HasManyToHasOneReducerExtension>): void {\n\t\tconst { addData, entity, objectNode } = context\n\t\tif (!objectNode) {\n\t\t\tthrow new Error()\n\t\t}\n\t\taddData({\n\t\t\tfield: entity.primary,\n\t\t\tdataProvider: async (ids: Input.PrimaryValue[]) => {\n\n\t\t\t\tconst relationContext = acceptFieldVisitor(this.schema, entity, objectNode.extensions.relationName, {\n\t\t\t\t\tvisitRelation: context => context,\n\t\t\t\t\tvisitColumn: (): never => {\n\t\t\t\t\t\tthrow new ImplementationException('HasManyToHasOneReducerExecutionHandler: Not applicable for a column')\n\t\t\t\t\t},\n\t\t\t\t})\n\n\t\t\t\tconst { targetEntity, targetRelation } = relationContext\n\t\t\t\tif (!targetRelation || !isIt<Model.JoiningColumnRelation>(targetRelation, 'joiningColumn')) {\n\t\t\t\t\tthrow new Error('HasManyToHasOneReducerExecutionHandler: only applicable for relations with joiningColumn')\n\t\t\t\t}\n\n\t\t\t\tconst uniqueWhere = this.uniqueWhereExpander.expand(targetEntity, {\n\t\t\t\t\t...objectNode.args.by,\n\t\t\t\t\t[targetRelation.name]: { [entity.primary]: ids },\n\t\t\t\t})\n\t\t\t\tif (Object.keys(uniqueWhere).length !== 2) {\n\t\t\t\t\tthrow new Error('HasManyToHasOneReducerExecutionHandler: only tuple unique keys are allowed')\n\t\t\t\t}\n\t\t\t\tconst whereWithParentId = {\n\t\t\t\t\tand: [objectNode.args.filter || {}, uniqueWhere],\n\t\t\t\t}\n\t\t\t\tconst newObjectNode = objectNode.withArgs<Input.ListQueryInput>({ filter: whereWithParentId })\n\n\t\t\t\treturn context.mapper.selectAssoc(targetEntity, newObjectNode, [\n\t\t\t\t\t...context.relationPath,\n\t\t\t\t\trelationContext,\n\t\t\t\t], targetRelation.name)\n\t\t\t},\n\t\t\tdefaultValue: null,\n\t\t})\n\t}\n}\n"],"names":["context"],"mappings":";;;AAQO,MAAM,uCAAkI;AAAA,EAE9I,YAA6B,QAAuC,qBAA0C;AAAjF,SAAA,SAAA;AAAuC,SAAA,sBAAA;AAAA,EAAA;AAAA,EAEpE,QAAQ,SAAuG;AAC9G,UAAM,EAAE,SAAS,QAAQ,WAAe,IAAA;AACxC,QAAI,CAAC,YAAY;AAChB,YAAM,IAAI,MAAM;AAAA,IAAA;AAET,YAAA;AAAA,MACP,OAAO,OAAO;AAAA,MACd,cAAc,OAAO,QAA8B;AAElD,cAAM,kBAAkB,mBAAmB,KAAK,QAAQ,QAAQ,WAAW,WAAW,cAAc;AAAA,UACnG,eAAe,CAAAA,aAAWA;AAAAA,UAC1B,aAAa,MAAa;AACnB,kBAAA,IAAI,wBAAwB,qEAAqE;AAAA,UAAA;AAAA,QACxG,CACA;AAEK,cAAA,EAAE,cAAc,eAAA,IAAmB;AACzC,YAAI,CAAC,kBAAkB,CAAC,KAAkC,gBAAgB,eAAe,GAAG;AACrF,gBAAA,IAAI,MAAM,0FAA0F;AAAA,QAAA;AAG3G,cAAM,cAAc,KAAK,oBAAoB,OAAO,cAAc;AAAA,UACjE,GAAG,WAAW,KAAK;AAAA,UACnB,CAAC,eAAe,IAAI,GAAG,EAAE,CAAC,OAAO,OAAO,GAAG,IAAI;AAAA,QAAA,CAC/C;AACD,YAAI,OAAO,KAAK,WAAW,EAAE,WAAW,GAAG;AACpC,gBAAA,IAAI,MAAM,4EAA4E;AAAA,QAAA;AAE7F,cAAM,oBAAoB;AAAA,UACzB,KAAK,CAAC,WAAW,KAAK,UAAU,IAAI,WAAW;AAAA,QAChD;AACA,cAAM,gBAAgB,WAAW,SAA+B,EAAE,QAAQ,mBAAmB;AAE7F,eAAO,QAAQ,OAAO,YAAY,cAAc,eAAe;AAAA,UAC9D,GAAG,QAAQ;AAAA,UACX;AAAA,QAAA,GACE,eAAe,IAAI;AAAA,MACvB;AAAA,MACA,cAAc;AAAA,IAAA,CACd;AAAA,EAAA;AAEH;"}
@@ -40,6 +40,32 @@ class HasManyToHasOneRelationReducerFieldVisitor {
40
40
  return [];
41
41
  }
42
42
  const uniqueConstraints = uniqueWhereFields.getFieldsForUniqueWhere(this.schema, targetEntity);
43
+ const uniqueKeys = uniqueConstraints.map((it) => it.filter((it2) => it2 !== targetRelation.name)).filter((it) => it.length > 0).filter((uniqueKey) => uniqueKey.every(
44
+ (it) => schemaUtils.acceptFieldVisitor(this.schema, targetEntity.name, it, new FieldAccessVisitor.FieldAccessVisitor(schema.Acl.Operation.read, this.authorizator))
45
+ ));
46
+ const graphQlName = relation.name + "By";
47
+ const uniqueWhere = new graphql.GraphQLInputObjectType({
48
+ name: utils.GqlTypeName`${relation.name}Of${entity.name}ByUniqueWhere`,
49
+ fields: () => {
50
+ return this.whereTypeProvider.getUniqueWhereFields(targetEntity, uniqueKeys);
51
+ }
52
+ });
53
+ const entityType = this.entityTypeProvider.getEntity(targetEntity.name);
54
+ const universalUnique = graphQlName in entity.fields ? null : [
55
+ graphQlName,
56
+ {
57
+ type: entityType,
58
+ extensions: {
59
+ relationName: relation.name,
60
+ extensionKey: HasManyToHasOneReducer.HasManyToHasOneReducer.extensionName
61
+ },
62
+ args: {
63
+ by: { type: new graphql.GraphQLNonNull(uniqueWhere) },
64
+ filter: { type: this.whereTypeProvider.getEntityWhereType(targetEntity.name) }
65
+ },
66
+ resolve: utils.aliasAwareResolver
67
+ }
68
+ ];
43
69
  const composedUnique = uniqueConstraints.filter((fields) => fields.length === 2).filter((fields) => fields.includes(targetRelation.name)).map((fields) => fields.filter((it) => it !== targetRelation.name)).map((fields) => fields[0]);
44
70
  const singleUnique = uniqueConstraints.filter((fields) => fields.length === 1 && fields[0] !== targetEntity.primary).map((fields) => fields[0]).filter((it) => it !== targetRelation.name);
45
71
  const existing = /* @__PURE__ */ new Set();
@@ -55,17 +81,16 @@ class HasManyToHasOneRelationReducerFieldVisitor {
55
81
  return null;
56
82
  }
57
83
  existing.add(fieldName);
58
- const graphQlName = relation.name + utils.GqlTypeName`By${fieldName}`;
59
- const uniqueWhere = new graphql.GraphQLInputObjectType({
84
+ const graphQlName2 = relation.name + utils.GqlTypeName`By${fieldName}`;
85
+ const uniqueWhere2 = new graphql.GraphQLInputObjectType({
60
86
  //todo this can be simplified to ${targetEntity.name}By${fieldName}, but singleton must be used
61
87
  name: utils.GqlTypeName`${entity.name}${relation.name}By${fieldName}UniqueWhere`,
62
88
  fields: () => {
63
89
  return this.whereTypeProvider.getUniqueWhereFields(targetEntity, [[fieldName]]);
64
90
  }
65
91
  });
66
- const entityType = this.entityTypeProvider.getEntity(targetEntity.name);
67
92
  return [
68
- graphQlName,
93
+ graphQlName2,
69
94
  {
70
95
  type: entityType,
71
96
  extensions: {
@@ -73,13 +98,13 @@ class HasManyToHasOneRelationReducerFieldVisitor {
73
98
  extensionKey: HasManyToHasOneReducer.HasManyToHasOneReducer.extensionName
74
99
  },
75
100
  args: {
76
- by: { type: new graphql.GraphQLNonNull(uniqueWhere) },
101
+ by: { type: new graphql.GraphQLNonNull(uniqueWhere2) },
77
102
  filter: { type: this.whereTypeProvider.getEntityWhereType(targetEntity.name) }
78
103
  },
79
104
  resolve: utils.aliasAwareResolver
80
105
  }
81
106
  ];
82
- }).filter((it) => it !== null);
107
+ }).concat([universalUnique]).filter((it) => it !== null);
83
108
  }
84
109
  }
85
110
  exports.HasManyToHasOneRelationReducerFieldVisitor = HasManyToHasOneRelationReducerFieldVisitor;
@@ -1 +1 @@
1
- {"version":3,"file":"HasManyToHasOneRelationReducerVisitor.cjs","sources":["../../../../../../packages/engine-content-api/src/extensions/hasManyToHasOneReducer/HasManyToHasOneRelationReducerVisitor.ts"],"sourcesContent":["import { GraphQLInputObjectType, GraphQLNonNull } from 'graphql'\nimport { Acl, Model } from '@contember/schema'\nimport { aliasAwareResolver, EntityTypeProvider, FieldAccessVisitor, GqlTypeName, WhereTypeProvider } from '../../schema'\nimport { acceptFieldVisitor } from '@contember/schema-utils'\nimport { Authorizator } from '../../acl'\nimport { getFieldsForUniqueWhere } from '../../utils'\nimport { HasManyToHasOneReducer, HasManyToHasOneReducerExtension } from './HasManyToHasOneReducer'\nimport { GraphQLFieldConfig } from 'graphql'\n\ntype Result = [\n\tstring,\n\tGraphQLFieldConfig<any, any> & {\n\t\textensions: HasManyToHasOneReducerExtension\n\t}\n]\n\nexport class HasManyToHasOneRelationReducerFieldVisitor implements\n\tModel.ColumnVisitor<Result[]>,\n\tModel.RelationByTypeVisitor<Result[]> {\n\n\tconstructor(\n\t\tprivate readonly schema: Model.Schema,\n\t\tprivate readonly authorizator: Authorizator,\n\t\tprivate readonly entityTypeProvider: EntityTypeProvider,\n\t\tprivate readonly whereTypeProvider: WhereTypeProvider,\n\t) {}\n\n\tpublic visitColumn() {\n\t\treturn []\n\t}\n\n\tpublic visitOneHasOneOwning() {\n\t\treturn []\n\t}\n\n\tpublic visitOneHasOneInverse() {\n\t\treturn []\n\t}\n\n\tpublic visitManyHasOne() {\n\t\treturn []\n\t}\n\n\tpublic visitManyHasManyInverse() {\n\t\treturn []\n\t}\n\n\tpublic visitManyHasManyOwning() {\n\t\treturn []\n\t}\n\n\tpublic visitOneHasMany({ entity, targetEntity, targetRelation, relation }: Model.OneHasManyContext) {\n\t\tif (!targetRelation) {\n\t\t\treturn []\n\t\t}\n\t\tconst uniqueConstraints = getFieldsForUniqueWhere(this.schema, targetEntity)\n\t\tconst composedUnique = uniqueConstraints\n\t\t\t.filter(fields => fields.length === 2) //todo support all uniques\n\t\t\t.filter(fields => fields.includes(targetRelation.name))\n\t\t\t.map(fields => fields.filter(it => it !== targetRelation.name))\n\t\t\t.map(fields => fields[0])\n\t\tconst singleUnique = uniqueConstraints\n\t\t\t.filter(fields => fields.length === 1 && fields[0] !== targetEntity.primary)\n\t\t\t.map(fields => fields[0])\n\t\t\t.filter(it => it !== targetRelation.name)\n\n\n\t\tconst existing = new Set<string>()\n\t\treturn [...composedUnique, ...singleUnique]\n\t\t\t.filter(field =>\n\t\t\t\tacceptFieldVisitor(\n\t\t\t\t\tthis.schema,\n\t\t\t\t\ttargetEntity.name,\n\t\t\t\t\tfield,\n\t\t\t\t\tnew FieldAccessVisitor(Acl.Operation.read, this.authorizator),\n\t\t\t\t),\n\t\t\t)\n\t\t\t.map<Result | null>(fieldName => {\n\t\t\t\tif (existing.has(fieldName)) {\n\t\t\t\t\treturn null\n\t\t\t\t}\n\t\t\t\texisting.add(fieldName)\n\t\t\t\tconst graphQlName = relation.name + GqlTypeName`By${fieldName}`\n\t\t\t\tconst uniqueWhere: GraphQLInputObjectType = new GraphQLInputObjectType({\n\t\t\t\t\t//todo this can be simplified to ${targetEntity.name}By${fieldName}, but singleton must be used\n\t\t\t\t\tname: GqlTypeName`${entity.name}${relation.name}By${fieldName}UniqueWhere`,\n\t\t\t\t\tfields: () => {\n\t\t\t\t\t\treturn this.whereTypeProvider.getUniqueWhereFields(targetEntity, [[fieldName]])\n\t\t\t\t\t},\n\t\t\t\t})\n\n\t\t\t\tconst entityType = this.entityTypeProvider.getEntity(targetEntity.name)\n\n\t\t\t\treturn [\n\t\t\t\t\tgraphQlName,\n\t\t\t\t\t{\n\t\t\t\t\t\ttype: entityType,\n\t\t\t\t\t\textensions: {\n\t\t\t\t\t\t\trelationName: relation.name,\n\t\t\t\t\t\t\textensionKey: HasManyToHasOneReducer.extensionName,\n\t\t\t\t\t\t},\n\t\t\t\t\t\targs: {\n\t\t\t\t\t\t\tby: { type: new GraphQLNonNull(uniqueWhere) },\n\t\t\t\t\t\t\tfilter: { type: this.whereTypeProvider.getEntityWhereType(targetEntity.name) },\n\t\t\t\t\t\t},\n\t\t\t\t\t\tresolve: aliasAwareResolver,\n\t\t\t\t\t},\n\t\t\t\t]\n\t\t\t})\n\t\t\t.filter((it): it is Result => it !== null)\n\t}\n}\n"],"names":["schema","getFieldsForUniqueWhere","acceptFieldVisitor","FieldAccessVisitor","Acl","GqlTypeName","GraphQLInputObjectType","HasManyToHasOneReducer","GraphQLNonNull","aliasAwareResolver"],"mappings":";;;;;;;;;;;;AAgBO,MAAM,2CAE0B;AAAA,EAEtC,YACkBA,SACA,cACA,oBACA,mBAChB;AAJgB,SAAA,SAAAA;AACA,SAAA,eAAA;AACA,SAAA,qBAAA;AACA,SAAA,oBAAA;AAAA,EACf;AAAA,EAEI,cAAc;AACpB,WAAO;EACR;AAAA,EAEO,uBAAuB;AAC7B,WAAO;EACR;AAAA,EAEO,wBAAwB;AAC9B,WAAO;EACR;AAAA,EAEO,kBAAkB;AACxB,WAAO;EACR;AAAA,EAEO,0BAA0B;AAChC,WAAO;EACR;AAAA,EAEO,yBAAyB;AAC/B,WAAO;EACR;AAAA,EAEO,gBAAgB,EAAE,QAAQ,cAAc,gBAAgB,YAAqC;AACnG,QAAI,CAAC,gBAAgB;AACpB,aAAO;IACR;AACA,UAAM,oBAAoBC,kBAAA,wBAAwB,KAAK,QAAQ,YAAY;AAC3E,UAAM,iBAAiB,kBACrB,OAAO,CAAA,WAAU,OAAO,WAAW,CAAC,EACpC,OAAO,CAAA,WAAU,OAAO,SAAS,eAAe,IAAI,CAAC,EACrD,IAAI,CAAU,WAAA,OAAO,OAAO,CAAA,OAAM,OAAO,eAAe,IAAI,CAAC,EAC7D,IAAI,CAAU,WAAA,OAAO,CAAC,CAAC;AACnB,UAAA,eAAe,kBACnB,OAAO,CAAA,WAAU,OAAO,WAAW,KAAK,OAAO,CAAC,MAAM,aAAa,OAAO,EAC1E,IAAI,CAAU,WAAA,OAAO,CAAC,CAAC,EACvB,OAAO,CAAA,OAAM,OAAO,eAAe,IAAI;AAGnC,UAAA,+BAAe;AACrB,WAAO,CAAC,GAAG,gBAAgB,GAAG,YAAY,EACxC;AAAA,MAAO,CACP,UAAAC,YAAA;AAAA,QACC,KAAK;AAAA,QACL,aAAa;AAAA,QACb;AAAA,QACA,IAAIC,mBAAAA,mBAAmBC,OAAAA,IAAI,UAAU,MAAM,KAAK,YAAY;AAAA,MAC7D;AAAA,IAAA,EAEA,IAAmB,CAAa,cAAA;AAC5B,UAAA,SAAS,IAAI,SAAS,GAAG;AACrB,eAAA;AAAA,MACR;AACA,eAAS,IAAI,SAAS;AACtB,YAAM,cAAc,SAAS,OAAOC,MAAA,gBAAgB,SAAS;AACvD,YAAA,cAAsC,IAAIC,+BAAuB;AAAA;AAAA,QAEtE,MAAMD,MAAAA,cAAc,OAAO,IAAI,GAAG,SAAS,IAAI,KAAK,SAAS;AAAA,QAC7D,QAAQ,MAAM;AACN,iBAAA,KAAK,kBAAkB,qBAAqB,cAAc,CAAC,CAAC,SAAS,CAAC,CAAC;AAAA,QAC/E;AAAA,MAAA,CACA;AAED,YAAM,aAAa,KAAK,mBAAmB,UAAU,aAAa,IAAI;AAE/D,aAAA;AAAA,QACN;AAAA,QACA;AAAA,UACC,MAAM;AAAA,UACN,YAAY;AAAA,YACX,cAAc,SAAS;AAAA,YACvB,cAAcE,uBAAuB,uBAAA;AAAA,UACtC;AAAA,UACA,MAAM;AAAA,YACL,IAAI,EAAE,MAAM,IAAIC,QAAA,eAAe,WAAW,EAAE;AAAA,YAC5C,QAAQ,EAAE,MAAM,KAAK,kBAAkB,mBAAmB,aAAa,IAAI,EAAE;AAAA,UAC9E;AAAA,UACA,SAASC,MAAA;AAAA,QACV;AAAA,MAAA;AAAA,IAED,CAAA,EACA,OAAO,CAAC,OAAqB,OAAO,IAAI;AAAA,EAC3C;AACD;;"}
1
+ {"version":3,"file":"HasManyToHasOneRelationReducerVisitor.cjs","sources":["../../../../../../packages/engine-content-api/src/extensions/hasManyToHasOneReducer/HasManyToHasOneRelationReducerVisitor.ts"],"sourcesContent":["import { GraphQLInputObjectType, GraphQLNonNull } from 'graphql'\nimport { Acl, Model } from '@contember/schema'\nimport { aliasAwareResolver, EntityTypeProvider, FieldAccessVisitor, GqlTypeName, WhereTypeProvider } from '../../schema'\nimport { acceptFieldVisitor } from '@contember/schema-utils'\nimport { Authorizator } from '../../acl'\nimport { getFieldsForUniqueWhere } from '../../utils'\nimport { HasManyToHasOneReducer, HasManyToHasOneReducerExtension } from './HasManyToHasOneReducer'\nimport { GraphQLFieldConfig } from 'graphql'\n\ntype Result = [\n\tstring,\n\tGraphQLFieldConfig<any, any> & {\n\t\textensions: HasManyToHasOneReducerExtension\n\t}\n]\n\nexport class HasManyToHasOneRelationReducerFieldVisitor implements\n\tModel.ColumnVisitor<Result[]>,\n\tModel.RelationByTypeVisitor<Result[]> {\n\n\tconstructor(\n\t\tprivate readonly schema: Model.Schema,\n\t\tprivate readonly authorizator: Authorizator,\n\t\tprivate readonly entityTypeProvider: EntityTypeProvider,\n\t\tprivate readonly whereTypeProvider: WhereTypeProvider,\n\t) {}\n\n\tpublic visitColumn() {\n\t\treturn []\n\t}\n\n\tpublic visitOneHasOneOwning() {\n\t\treturn []\n\t}\n\n\tpublic visitOneHasOneInverse() {\n\t\treturn []\n\t}\n\n\tpublic visitManyHasOne() {\n\t\treturn []\n\t}\n\n\tpublic visitManyHasManyInverse() {\n\t\treturn []\n\t}\n\n\tpublic visitManyHasManyOwning() {\n\t\treturn []\n\t}\n\n\tpublic visitOneHasMany({ entity, targetEntity, targetRelation, relation }: Model.OneHasManyContext) {\n\t\tif (!targetRelation) {\n\t\t\treturn []\n\t\t}\n\t\tconst uniqueConstraints = getFieldsForUniqueWhere(this.schema, targetEntity)\n\n\t\tconst uniqueKeys: (readonly string[])[] = uniqueConstraints\n\t\t\t.map(it => it.filter(it => it !== targetRelation.name))\n\t\t\t.filter(it => it.length > 0)\n\t\t\t.filter(uniqueKey => uniqueKey\n\t\t\t\t.every(it =>\n\t\t\t\t\tacceptFieldVisitor(this.schema, targetEntity.name, it, new FieldAccessVisitor(Acl.Operation.read, this.authorizator)),\n\t\t\t\t))\n\n\t\tconst graphQlName = relation.name + 'By'\n\t\tconst uniqueWhere: GraphQLInputObjectType = new GraphQLInputObjectType({\n\t\t\tname: GqlTypeName`${relation.name}Of${entity.name}ByUniqueWhere`,\n\t\t\tfields: () => {\n\t\t\t\treturn this.whereTypeProvider.getUniqueWhereFields(targetEntity, uniqueKeys)\n\t\t\t},\n\t\t})\n\n\t\tconst entityType = this.entityTypeProvider.getEntity(targetEntity.name)\n\t\tconst universalUnique: Result | null = graphQlName in entity.fields ? null : [\n\t\t\tgraphQlName,\n\t\t\t{\n\t\t\t\ttype: entityType,\n\t\t\t\textensions: {\n\t\t\t\t\trelationName: relation.name,\n\t\t\t\t\textensionKey: HasManyToHasOneReducer.extensionName,\n\t\t\t\t},\n\t\t\t\targs: {\n\t\t\t\t\tby: { type: new GraphQLNonNull(uniqueWhere) },\n\t\t\t\t\tfilter: { type: this.whereTypeProvider.getEntityWhereType(targetEntity.name) },\n\t\t\t\t},\n\t\t\t\tresolve: aliasAwareResolver,\n\t\t\t},\n\t\t]\n\n\t\tconst composedUnique = uniqueConstraints\n\t\t\t.filter(fields => fields.length === 2) //todo support all uniques\n\t\t\t.filter(fields => fields.includes(targetRelation.name))\n\t\t\t.map(fields => fields.filter(it => it !== targetRelation.name))\n\t\t\t.map(fields => fields[0])\n\t\tconst singleUnique = uniqueConstraints\n\t\t\t.filter(fields => fields.length === 1 && fields[0] !== targetEntity.primary)\n\t\t\t.map(fields => fields[0])\n\t\t\t.filter(it => it !== targetRelation.name)\n\n\n\t\tconst existing = new Set<string>()\n\t\treturn [...composedUnique, ...singleUnique]\n\t\t\t.filter(field =>\n\t\t\t\tacceptFieldVisitor(\n\t\t\t\t\tthis.schema,\n\t\t\t\t\ttargetEntity.name,\n\t\t\t\t\tfield,\n\t\t\t\t\tnew FieldAccessVisitor(Acl.Operation.read, this.authorizator),\n\t\t\t\t),\n\t\t\t)\n\t\t\t.map<Result | null>(fieldName => {\n\t\t\t\tif (existing.has(fieldName)) {\n\t\t\t\t\treturn null\n\t\t\t\t}\n\t\t\t\texisting.add(fieldName)\n\t\t\t\tconst graphQlName = relation.name + GqlTypeName`By${fieldName}`\n\t\t\t\tconst uniqueWhere: GraphQLInputObjectType = new GraphQLInputObjectType({\n\t\t\t\t\t//todo this can be simplified to ${targetEntity.name}By${fieldName}, but singleton must be used\n\t\t\t\t\tname: GqlTypeName`${entity.name}${relation.name}By${fieldName}UniqueWhere`,\n\t\t\t\t\tfields: () => {\n\t\t\t\t\t\treturn this.whereTypeProvider.getUniqueWhereFields(targetEntity, [[fieldName]])\n\t\t\t\t\t},\n\t\t\t\t})\n\n\t\t\t\treturn [\n\t\t\t\t\tgraphQlName,\n\t\t\t\t\t{\n\t\t\t\t\t\ttype: entityType,\n\t\t\t\t\t\textensions: {\n\t\t\t\t\t\t\trelationName: relation.name,\n\t\t\t\t\t\t\textensionKey: HasManyToHasOneReducer.extensionName,\n\t\t\t\t\t\t},\n\t\t\t\t\t\targs: {\n\t\t\t\t\t\t\tby: { type: new GraphQLNonNull(uniqueWhere) },\n\t\t\t\t\t\t\tfilter: { type: this.whereTypeProvider.getEntityWhereType(targetEntity.name) },\n\t\t\t\t\t\t},\n\t\t\t\t\t\tresolve: aliasAwareResolver,\n\t\t\t\t\t},\n\t\t\t\t]\n\t\t\t})\n\t\t\t.concat([universalUnique])\n\t\t\t.filter((it): it is Result => it !== null)\n\t}\n}\n"],"names":["schema","getFieldsForUniqueWhere","it","acceptFieldVisitor","FieldAccessVisitor","Acl","GraphQLInputObjectType","GqlTypeName","HasManyToHasOneReducer","GraphQLNonNull","aliasAwareResolver","graphQlName","uniqueWhere"],"mappings":"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"}
@@ -38,6 +38,32 @@ class HasManyToHasOneRelationReducerFieldVisitor {
38
38
  return [];
39
39
  }
40
40
  const uniqueConstraints = getFieldsForUniqueWhere(this.schema, targetEntity);
41
+ const uniqueKeys = uniqueConstraints.map((it) => it.filter((it2) => it2 !== targetRelation.name)).filter((it) => it.length > 0).filter((uniqueKey) => uniqueKey.every(
42
+ (it) => acceptFieldVisitor(this.schema, targetEntity.name, it, new FieldAccessVisitor(Acl.Operation.read, this.authorizator))
43
+ ));
44
+ const graphQlName = relation.name + "By";
45
+ const uniqueWhere = new GraphQLInputObjectType({
46
+ name: GqlTypeName`${relation.name}Of${entity.name}ByUniqueWhere`,
47
+ fields: () => {
48
+ return this.whereTypeProvider.getUniqueWhereFields(targetEntity, uniqueKeys);
49
+ }
50
+ });
51
+ const entityType = this.entityTypeProvider.getEntity(targetEntity.name);
52
+ const universalUnique = graphQlName in entity.fields ? null : [
53
+ graphQlName,
54
+ {
55
+ type: entityType,
56
+ extensions: {
57
+ relationName: relation.name,
58
+ extensionKey: HasManyToHasOneReducer.extensionName
59
+ },
60
+ args: {
61
+ by: { type: new GraphQLNonNull(uniqueWhere) },
62
+ filter: { type: this.whereTypeProvider.getEntityWhereType(targetEntity.name) }
63
+ },
64
+ resolve: aliasAwareResolver
65
+ }
66
+ ];
41
67
  const composedUnique = uniqueConstraints.filter((fields) => fields.length === 2).filter((fields) => fields.includes(targetRelation.name)).map((fields) => fields.filter((it) => it !== targetRelation.name)).map((fields) => fields[0]);
42
68
  const singleUnique = uniqueConstraints.filter((fields) => fields.length === 1 && fields[0] !== targetEntity.primary).map((fields) => fields[0]).filter((it) => it !== targetRelation.name);
43
69
  const existing = /* @__PURE__ */ new Set();
@@ -53,17 +79,16 @@ class HasManyToHasOneRelationReducerFieldVisitor {
53
79
  return null;
54
80
  }
55
81
  existing.add(fieldName);
56
- const graphQlName = relation.name + GqlTypeName`By${fieldName}`;
57
- const uniqueWhere = new GraphQLInputObjectType({
82
+ const graphQlName2 = relation.name + GqlTypeName`By${fieldName}`;
83
+ const uniqueWhere2 = new GraphQLInputObjectType({
58
84
  //todo this can be simplified to ${targetEntity.name}By${fieldName}, but singleton must be used
59
85
  name: GqlTypeName`${entity.name}${relation.name}By${fieldName}UniqueWhere`,
60
86
  fields: () => {
61
87
  return this.whereTypeProvider.getUniqueWhereFields(targetEntity, [[fieldName]]);
62
88
  }
63
89
  });
64
- const entityType = this.entityTypeProvider.getEntity(targetEntity.name);
65
90
  return [
66
- graphQlName,
91
+ graphQlName2,
67
92
  {
68
93
  type: entityType,
69
94
  extensions: {
@@ -71,13 +96,13 @@ class HasManyToHasOneRelationReducerFieldVisitor {
71
96
  extensionKey: HasManyToHasOneReducer.extensionName
72
97
  },
73
98
  args: {
74
- by: { type: new GraphQLNonNull(uniqueWhere) },
99
+ by: { type: new GraphQLNonNull(uniqueWhere2) },
75
100
  filter: { type: this.whereTypeProvider.getEntityWhereType(targetEntity.name) }
76
101
  },
77
102
  resolve: aliasAwareResolver
78
103
  }
79
104
  ];
80
- }).filter((it) => it !== null);
105
+ }).concat([universalUnique]).filter((it) => it !== null);
81
106
  }
82
107
  }
83
108
  export {
@@ -1 +1 @@
1
- {"version":3,"file":"HasManyToHasOneRelationReducerVisitor.js","sources":["../../../../../../packages/engine-content-api/src/extensions/hasManyToHasOneReducer/HasManyToHasOneRelationReducerVisitor.ts"],"sourcesContent":["import { GraphQLInputObjectType, GraphQLNonNull } from 'graphql'\nimport { Acl, Model } from '@contember/schema'\nimport { aliasAwareResolver, EntityTypeProvider, FieldAccessVisitor, GqlTypeName, WhereTypeProvider } from '../../schema'\nimport { acceptFieldVisitor } from '@contember/schema-utils'\nimport { Authorizator } from '../../acl'\nimport { getFieldsForUniqueWhere } from '../../utils'\nimport { HasManyToHasOneReducer, HasManyToHasOneReducerExtension } from './HasManyToHasOneReducer'\nimport { GraphQLFieldConfig } from 'graphql'\n\ntype Result = [\n\tstring,\n\tGraphQLFieldConfig<any, any> & {\n\t\textensions: HasManyToHasOneReducerExtension\n\t}\n]\n\nexport class HasManyToHasOneRelationReducerFieldVisitor implements\n\tModel.ColumnVisitor<Result[]>,\n\tModel.RelationByTypeVisitor<Result[]> {\n\n\tconstructor(\n\t\tprivate readonly schema: Model.Schema,\n\t\tprivate readonly authorizator: Authorizator,\n\t\tprivate readonly entityTypeProvider: EntityTypeProvider,\n\t\tprivate readonly whereTypeProvider: WhereTypeProvider,\n\t) {}\n\n\tpublic visitColumn() {\n\t\treturn []\n\t}\n\n\tpublic visitOneHasOneOwning() {\n\t\treturn []\n\t}\n\n\tpublic visitOneHasOneInverse() {\n\t\treturn []\n\t}\n\n\tpublic visitManyHasOne() {\n\t\treturn []\n\t}\n\n\tpublic visitManyHasManyInverse() {\n\t\treturn []\n\t}\n\n\tpublic visitManyHasManyOwning() {\n\t\treturn []\n\t}\n\n\tpublic visitOneHasMany({ entity, targetEntity, targetRelation, relation }: Model.OneHasManyContext) {\n\t\tif (!targetRelation) {\n\t\t\treturn []\n\t\t}\n\t\tconst uniqueConstraints = getFieldsForUniqueWhere(this.schema, targetEntity)\n\t\tconst composedUnique = uniqueConstraints\n\t\t\t.filter(fields => fields.length === 2) //todo support all uniques\n\t\t\t.filter(fields => fields.includes(targetRelation.name))\n\t\t\t.map(fields => fields.filter(it => it !== targetRelation.name))\n\t\t\t.map(fields => fields[0])\n\t\tconst singleUnique = uniqueConstraints\n\t\t\t.filter(fields => fields.length === 1 && fields[0] !== targetEntity.primary)\n\t\t\t.map(fields => fields[0])\n\t\t\t.filter(it => it !== targetRelation.name)\n\n\n\t\tconst existing = new Set<string>()\n\t\treturn [...composedUnique, ...singleUnique]\n\t\t\t.filter(field =>\n\t\t\t\tacceptFieldVisitor(\n\t\t\t\t\tthis.schema,\n\t\t\t\t\ttargetEntity.name,\n\t\t\t\t\tfield,\n\t\t\t\t\tnew FieldAccessVisitor(Acl.Operation.read, this.authorizator),\n\t\t\t\t),\n\t\t\t)\n\t\t\t.map<Result | null>(fieldName => {\n\t\t\t\tif (existing.has(fieldName)) {\n\t\t\t\t\treturn null\n\t\t\t\t}\n\t\t\t\texisting.add(fieldName)\n\t\t\t\tconst graphQlName = relation.name + GqlTypeName`By${fieldName}`\n\t\t\t\tconst uniqueWhere: GraphQLInputObjectType = new GraphQLInputObjectType({\n\t\t\t\t\t//todo this can be simplified to ${targetEntity.name}By${fieldName}, but singleton must be used\n\t\t\t\t\tname: GqlTypeName`${entity.name}${relation.name}By${fieldName}UniqueWhere`,\n\t\t\t\t\tfields: () => {\n\t\t\t\t\t\treturn this.whereTypeProvider.getUniqueWhereFields(targetEntity, [[fieldName]])\n\t\t\t\t\t},\n\t\t\t\t})\n\n\t\t\t\tconst entityType = this.entityTypeProvider.getEntity(targetEntity.name)\n\n\t\t\t\treturn [\n\t\t\t\t\tgraphQlName,\n\t\t\t\t\t{\n\t\t\t\t\t\ttype: entityType,\n\t\t\t\t\t\textensions: {\n\t\t\t\t\t\t\trelationName: relation.name,\n\t\t\t\t\t\t\textensionKey: HasManyToHasOneReducer.extensionName,\n\t\t\t\t\t\t},\n\t\t\t\t\t\targs: {\n\t\t\t\t\t\t\tby: { type: new GraphQLNonNull(uniqueWhere) },\n\t\t\t\t\t\t\tfilter: { type: this.whereTypeProvider.getEntityWhereType(targetEntity.name) },\n\t\t\t\t\t\t},\n\t\t\t\t\t\tresolve: aliasAwareResolver,\n\t\t\t\t\t},\n\t\t\t\t]\n\t\t\t})\n\t\t\t.filter((it): it is Result => it !== null)\n\t}\n}\n"],"names":[],"mappings":";;;;;;;;;;AAgBO,MAAM,2CAE0B;AAAA,EAEtC,YACkB,QACA,cACA,oBACA,mBAChB;AAJgB,SAAA,SAAA;AACA,SAAA,eAAA;AACA,SAAA,qBAAA;AACA,SAAA,oBAAA;AAAA,EACf;AAAA,EAEI,cAAc;AACpB,WAAO;EACR;AAAA,EAEO,uBAAuB;AAC7B,WAAO;EACR;AAAA,EAEO,wBAAwB;AAC9B,WAAO;EACR;AAAA,EAEO,kBAAkB;AACxB,WAAO;EACR;AAAA,EAEO,0BAA0B;AAChC,WAAO;EACR;AAAA,EAEO,yBAAyB;AAC/B,WAAO;EACR;AAAA,EAEO,gBAAgB,EAAE,QAAQ,cAAc,gBAAgB,YAAqC;AACnG,QAAI,CAAC,gBAAgB;AACpB,aAAO;IACR;AACA,UAAM,oBAAoB,wBAAwB,KAAK,QAAQ,YAAY;AAC3E,UAAM,iBAAiB,kBACrB,OAAO,CAAA,WAAU,OAAO,WAAW,CAAC,EACpC,OAAO,CAAA,WAAU,OAAO,SAAS,eAAe,IAAI,CAAC,EACrD,IAAI,CAAU,WAAA,OAAO,OAAO,CAAA,OAAM,OAAO,eAAe,IAAI,CAAC,EAC7D,IAAI,CAAU,WAAA,OAAO,CAAC,CAAC;AACnB,UAAA,eAAe,kBACnB,OAAO,CAAA,WAAU,OAAO,WAAW,KAAK,OAAO,CAAC,MAAM,aAAa,OAAO,EAC1E,IAAI,CAAU,WAAA,OAAO,CAAC,CAAC,EACvB,OAAO,CAAA,OAAM,OAAO,eAAe,IAAI;AAGnC,UAAA,+BAAe;AACrB,WAAO,CAAC,GAAG,gBAAgB,GAAG,YAAY,EACxC;AAAA,MAAO,CACP,UAAA;AAAA,QACC,KAAK;AAAA,QACL,aAAa;AAAA,QACb;AAAA,QACA,IAAI,mBAAmB,IAAI,UAAU,MAAM,KAAK,YAAY;AAAA,MAC7D;AAAA,IAAA,EAEA,IAAmB,CAAa,cAAA;AAC5B,UAAA,SAAS,IAAI,SAAS,GAAG;AACrB,eAAA;AAAA,MACR;AACA,eAAS,IAAI,SAAS;AACtB,YAAM,cAAc,SAAS,OAAO,gBAAgB,SAAS;AACvD,YAAA,cAAsC,IAAI,uBAAuB;AAAA;AAAA,QAEtE,MAAM,cAAc,OAAO,IAAI,GAAG,SAAS,IAAI,KAAK,SAAS;AAAA,QAC7D,QAAQ,MAAM;AACN,iBAAA,KAAK,kBAAkB,qBAAqB,cAAc,CAAC,CAAC,SAAS,CAAC,CAAC;AAAA,QAC/E;AAAA,MAAA,CACA;AAED,YAAM,aAAa,KAAK,mBAAmB,UAAU,aAAa,IAAI;AAE/D,aAAA;AAAA,QACN;AAAA,QACA;AAAA,UACC,MAAM;AAAA,UACN,YAAY;AAAA,YACX,cAAc,SAAS;AAAA,YACvB,cAAc,uBAAuB;AAAA,UACtC;AAAA,UACA,MAAM;AAAA,YACL,IAAI,EAAE,MAAM,IAAI,eAAe,WAAW,EAAE;AAAA,YAC5C,QAAQ,EAAE,MAAM,KAAK,kBAAkB,mBAAmB,aAAa,IAAI,EAAE;AAAA,UAC9E;AAAA,UACA,SAAS;AAAA,QACV;AAAA,MAAA;AAAA,IAED,CAAA,EACA,OAAO,CAAC,OAAqB,OAAO,IAAI;AAAA,EAC3C;AACD;"}
1
+ {"version":3,"file":"HasManyToHasOneRelationReducerVisitor.js","sources":["../../../../../../packages/engine-content-api/src/extensions/hasManyToHasOneReducer/HasManyToHasOneRelationReducerVisitor.ts"],"sourcesContent":["import { GraphQLInputObjectType, GraphQLNonNull } from 'graphql'\nimport { Acl, Model } from '@contember/schema'\nimport { aliasAwareResolver, EntityTypeProvider, FieldAccessVisitor, GqlTypeName, WhereTypeProvider } from '../../schema'\nimport { acceptFieldVisitor } from '@contember/schema-utils'\nimport { Authorizator } from '../../acl'\nimport { getFieldsForUniqueWhere } from '../../utils'\nimport { HasManyToHasOneReducer, HasManyToHasOneReducerExtension } from './HasManyToHasOneReducer'\nimport { GraphQLFieldConfig } from 'graphql'\n\ntype Result = [\n\tstring,\n\tGraphQLFieldConfig<any, any> & {\n\t\textensions: HasManyToHasOneReducerExtension\n\t}\n]\n\nexport class HasManyToHasOneRelationReducerFieldVisitor implements\n\tModel.ColumnVisitor<Result[]>,\n\tModel.RelationByTypeVisitor<Result[]> {\n\n\tconstructor(\n\t\tprivate readonly schema: Model.Schema,\n\t\tprivate readonly authorizator: Authorizator,\n\t\tprivate readonly entityTypeProvider: EntityTypeProvider,\n\t\tprivate readonly whereTypeProvider: WhereTypeProvider,\n\t) {}\n\n\tpublic visitColumn() {\n\t\treturn []\n\t}\n\n\tpublic visitOneHasOneOwning() {\n\t\treturn []\n\t}\n\n\tpublic visitOneHasOneInverse() {\n\t\treturn []\n\t}\n\n\tpublic visitManyHasOne() {\n\t\treturn []\n\t}\n\n\tpublic visitManyHasManyInverse() {\n\t\treturn []\n\t}\n\n\tpublic visitManyHasManyOwning() {\n\t\treturn []\n\t}\n\n\tpublic visitOneHasMany({ entity, targetEntity, targetRelation, relation }: Model.OneHasManyContext) {\n\t\tif (!targetRelation) {\n\t\t\treturn []\n\t\t}\n\t\tconst uniqueConstraints = getFieldsForUniqueWhere(this.schema, targetEntity)\n\n\t\tconst uniqueKeys: (readonly string[])[] = uniqueConstraints\n\t\t\t.map(it => it.filter(it => it !== targetRelation.name))\n\t\t\t.filter(it => it.length > 0)\n\t\t\t.filter(uniqueKey => uniqueKey\n\t\t\t\t.every(it =>\n\t\t\t\t\tacceptFieldVisitor(this.schema, targetEntity.name, it, new FieldAccessVisitor(Acl.Operation.read, this.authorizator)),\n\t\t\t\t))\n\n\t\tconst graphQlName = relation.name + 'By'\n\t\tconst uniqueWhere: GraphQLInputObjectType = new GraphQLInputObjectType({\n\t\t\tname: GqlTypeName`${relation.name}Of${entity.name}ByUniqueWhere`,\n\t\t\tfields: () => {\n\t\t\t\treturn this.whereTypeProvider.getUniqueWhereFields(targetEntity, uniqueKeys)\n\t\t\t},\n\t\t})\n\n\t\tconst entityType = this.entityTypeProvider.getEntity(targetEntity.name)\n\t\tconst universalUnique: Result | null = graphQlName in entity.fields ? null : [\n\t\t\tgraphQlName,\n\t\t\t{\n\t\t\t\ttype: entityType,\n\t\t\t\textensions: {\n\t\t\t\t\trelationName: relation.name,\n\t\t\t\t\textensionKey: HasManyToHasOneReducer.extensionName,\n\t\t\t\t},\n\t\t\t\targs: {\n\t\t\t\t\tby: { type: new GraphQLNonNull(uniqueWhere) },\n\t\t\t\t\tfilter: { type: this.whereTypeProvider.getEntityWhereType(targetEntity.name) },\n\t\t\t\t},\n\t\t\t\tresolve: aliasAwareResolver,\n\t\t\t},\n\t\t]\n\n\t\tconst composedUnique = uniqueConstraints\n\t\t\t.filter(fields => fields.length === 2) //todo support all uniques\n\t\t\t.filter(fields => fields.includes(targetRelation.name))\n\t\t\t.map(fields => fields.filter(it => it !== targetRelation.name))\n\t\t\t.map(fields => fields[0])\n\t\tconst singleUnique = uniqueConstraints\n\t\t\t.filter(fields => fields.length === 1 && fields[0] !== targetEntity.primary)\n\t\t\t.map(fields => fields[0])\n\t\t\t.filter(it => it !== targetRelation.name)\n\n\n\t\tconst existing = new Set<string>()\n\t\treturn [...composedUnique, ...singleUnique]\n\t\t\t.filter(field =>\n\t\t\t\tacceptFieldVisitor(\n\t\t\t\t\tthis.schema,\n\t\t\t\t\ttargetEntity.name,\n\t\t\t\t\tfield,\n\t\t\t\t\tnew FieldAccessVisitor(Acl.Operation.read, this.authorizator),\n\t\t\t\t),\n\t\t\t)\n\t\t\t.map<Result | null>(fieldName => {\n\t\t\t\tif (existing.has(fieldName)) {\n\t\t\t\t\treturn null\n\t\t\t\t}\n\t\t\t\texisting.add(fieldName)\n\t\t\t\tconst graphQlName = relation.name + GqlTypeName`By${fieldName}`\n\t\t\t\tconst uniqueWhere: GraphQLInputObjectType = new GraphQLInputObjectType({\n\t\t\t\t\t//todo this can be simplified to ${targetEntity.name}By${fieldName}, but singleton must be used\n\t\t\t\t\tname: GqlTypeName`${entity.name}${relation.name}By${fieldName}UniqueWhere`,\n\t\t\t\t\tfields: () => {\n\t\t\t\t\t\treturn this.whereTypeProvider.getUniqueWhereFields(targetEntity, [[fieldName]])\n\t\t\t\t\t},\n\t\t\t\t})\n\n\t\t\t\treturn [\n\t\t\t\t\tgraphQlName,\n\t\t\t\t\t{\n\t\t\t\t\t\ttype: entityType,\n\t\t\t\t\t\textensions: {\n\t\t\t\t\t\t\trelationName: relation.name,\n\t\t\t\t\t\t\textensionKey: HasManyToHasOneReducer.extensionName,\n\t\t\t\t\t\t},\n\t\t\t\t\t\targs: {\n\t\t\t\t\t\t\tby: { type: new GraphQLNonNull(uniqueWhere) },\n\t\t\t\t\t\t\tfilter: { type: this.whereTypeProvider.getEntityWhereType(targetEntity.name) },\n\t\t\t\t\t\t},\n\t\t\t\t\t\tresolve: aliasAwareResolver,\n\t\t\t\t\t},\n\t\t\t\t]\n\t\t\t})\n\t\t\t.concat([universalUnique])\n\t\t\t.filter((it): it is Result => it !== null)\n\t}\n}\n"],"names":["it","graphQlName","uniqueWhere"],"mappings":"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"}
@@ -1 +1 @@
1
- {"version":3,"file":"PaginatedHasManyCountVisitor.cjs","sources":["../../../../../../packages/engine-content-api/src/extensions/paginatedHasMany/PaginatedHasManyCountVisitor.ts"],"sourcesContent":["import { Input, Model } from '@contember/schema'\nimport { GroupedCounts, Mapper, RelationFetcher } from '../../mapper'\nimport { ObjectNode } from '../../inputProcessing'\n\nexport class PaginatedHasManyCountVisitor implements\n\tModel.ColumnVisitor<Promise<GroupedCounts>>,\n\tModel.RelationByTypeVisitor<Promise<GroupedCounts>> {\n\n\tconstructor(\n\t\tprivate readonly ids: Input.PrimaryValue[],\n\t\tprivate readonly objectNode: ObjectNode<Input.PaginationQueryInput>,\n\t\tprivate readonly relationFetcher: RelationFetcher,\n\t\tprivate readonly mapper: Mapper,\n\t\tprivate readonly relationPath: Model.AnyRelationContext[],\n\t) {}\n\n\tasync visitOneHasMany(relationContext: Model.OneHasManyContext): Promise<GroupedCounts> {\n\t\treturn await this.relationFetcher.countOneHasManyGroups(\n\t\t\t{\n\t\t\t\tmapper: this.mapper,\n\t\t\t\tfilter: this.objectNode.args.filter,\n\t\t\t\trelationContext,\n\t\t\t\trelationPath: this.relationPath,\n\t\t\t\tids: this.ids,\n\t\t\t},\n\t\t)\n\t}\n\n\tasync visitManyHasManyOwning(relationContext: Model.ManyHasManyOwningContext): Promise<GroupedCounts> {\n\t\treturn await this.relationFetcher.countManyHasManyGroups(\n\t\t\t{\n\t\t\t\tmapper: this.mapper,\n\t\t\t\tfilter: this.objectNode.args.filter,\n\t\t\t\trelationContext,\n\t\t\t\trelationPath: this.relationPath,\n\t\t\t\tids: this.ids,\n\t\t\t},\n\t\t)\n\t}\n\n\tasync visitManyHasManyInverse(relationContext: Model.ManyHasManyInverseContext): Promise<GroupedCounts> {\n\t\treturn await this.relationFetcher.countManyHasManyGroups(\n\t\t\t{\n\t\t\t\tmapper: this.mapper,\n\t\t\t\tfilter: this.objectNode.args.filter,\n\t\t\t\trelationContext,\n\t\t\t\trelationPath: this.relationPath,\n\t\t\t\tids: this.ids,\n\t\t\t},\n\t\t)\n\t}\n\n\tvisitColumn(): never {\n\t\tthrow new Error()\n\t}\n\n\tvisitManyHasOne(): never {\n\t\tthrow new Error()\n\t}\n\n\tvisitOneHasOneInverse(): never {\n\t\tthrow new Error()\n\t}\n\n\tvisitOneHasOneOwning(): never {\n\t\tthrow new Error()\n\t}\n}\n"],"names":[],"mappings":";;AAIO,MAAM,6BAEwC;AAAA,EAEpD,YACkB,KACA,YACA,iBACA,QACA,cAChB;AALgB,SAAA,MAAA;AACA,SAAA,aAAA;AACA,SAAA,kBAAA;AACA,SAAA,SAAA;AACA,SAAA,eAAA;AAAA,EACf;AAAA,EAEH,MAAM,gBAAgB,iBAAkE;AAChF,WAAA,MAAM,KAAK,gBAAgB;AAAA,MACjC;AAAA,QACC,QAAQ,KAAK;AAAA,QACb,QAAQ,KAAK,WAAW,KAAK;AAAA,QAC7B;AAAA,QACA,cAAc,KAAK;AAAA,QACnB,KAAK,KAAK;AAAA,MACX;AAAA,IAAA;AAAA,EAEF;AAAA,EAEA,MAAM,uBAAuB,iBAAyE;AAC9F,WAAA,MAAM,KAAK,gBAAgB;AAAA,MACjC;AAAA,QACC,QAAQ,KAAK;AAAA,QACb,QAAQ,KAAK,WAAW,KAAK;AAAA,QAC7B;AAAA,QACA,cAAc,KAAK;AAAA,QACnB,KAAK,KAAK;AAAA,MACX;AAAA,IAAA;AAAA,EAEF;AAAA,EAEA,MAAM,wBAAwB,iBAA0E;AAChG,WAAA,MAAM,KAAK,gBAAgB;AAAA,MACjC;AAAA,QACC,QAAQ,KAAK;AAAA,QACb,QAAQ,KAAK,WAAW,KAAK;AAAA,QAC7B;AAAA,QACA,cAAc,KAAK;AAAA,QACnB,KAAK,KAAK;AAAA,MACX;AAAA,IAAA;AAAA,EAEF;AAAA,EAEA,cAAqB;AACpB,UAAM,IAAI,MAAM;AAAA,EACjB;AAAA,EAEA,kBAAyB;AACxB,UAAM,IAAI,MAAM;AAAA,EACjB;AAAA,EAEA,wBAA+B;AAC9B,UAAM,IAAI,MAAM;AAAA,EACjB;AAAA,EAEA,uBAA8B;AAC7B,UAAM,IAAI,MAAM;AAAA,EACjB;AACD;;"}
1
+ {"version":3,"file":"PaginatedHasManyCountVisitor.cjs","sources":["../../../../../../packages/engine-content-api/src/extensions/paginatedHasMany/PaginatedHasManyCountVisitor.ts"],"sourcesContent":["import { Input, Model } from '@contember/schema'\nimport { GroupedCounts, Mapper, RelationFetcher } from '../../mapper'\nimport { ObjectNode } from '../../inputProcessing'\n\nexport class PaginatedHasManyCountVisitor implements\n\tModel.ColumnVisitor<Promise<GroupedCounts>>,\n\tModel.RelationByTypeVisitor<Promise<GroupedCounts>> {\n\n\tconstructor(\n\t\tprivate readonly ids: Input.PrimaryValue[],\n\t\tprivate readonly objectNode: ObjectNode<Input.PaginationQueryInput>,\n\t\tprivate readonly relationFetcher: RelationFetcher,\n\t\tprivate readonly mapper: Mapper,\n\t\tprivate readonly relationPath: Model.AnyRelationContext[],\n\t) {}\n\n\tasync visitOneHasMany(relationContext: Model.OneHasManyContext): Promise<GroupedCounts> {\n\t\treturn await this.relationFetcher.countOneHasManyGroups(\n\t\t\t{\n\t\t\t\tmapper: this.mapper,\n\t\t\t\tfilter: this.objectNode.args.filter,\n\t\t\t\trelationContext,\n\t\t\t\trelationPath: this.relationPath,\n\t\t\t\tids: this.ids,\n\t\t\t},\n\t\t)\n\t}\n\n\tasync visitManyHasManyOwning(relationContext: Model.ManyHasManyOwningContext): Promise<GroupedCounts> {\n\t\treturn await this.relationFetcher.countManyHasManyGroups(\n\t\t\t{\n\t\t\t\tmapper: this.mapper,\n\t\t\t\tfilter: this.objectNode.args.filter,\n\t\t\t\trelationContext,\n\t\t\t\trelationPath: this.relationPath,\n\t\t\t\tids: this.ids,\n\t\t\t},\n\t\t)\n\t}\n\n\tasync visitManyHasManyInverse(relationContext: Model.ManyHasManyInverseContext): Promise<GroupedCounts> {\n\t\treturn await this.relationFetcher.countManyHasManyGroups(\n\t\t\t{\n\t\t\t\tmapper: this.mapper,\n\t\t\t\tfilter: this.objectNode.args.filter,\n\t\t\t\trelationContext,\n\t\t\t\trelationPath: this.relationPath,\n\t\t\t\tids: this.ids,\n\t\t\t},\n\t\t)\n\t}\n\n\tvisitColumn(): never {\n\t\tthrow new Error()\n\t}\n\n\tvisitManyHasOne(): never {\n\t\tthrow new Error()\n\t}\n\n\tvisitOneHasOneInverse(): never {\n\t\tthrow new Error()\n\t}\n\n\tvisitOneHasOneOwning(): never {\n\t\tthrow new Error()\n\t}\n}\n"],"names":[],"mappings":";;AAIO,MAAM,6BAEwC;AAAA,EAEpD,YACkB,KACA,YACA,iBACA,QACA,cAChB;AALgB,SAAA,MAAA;AACA,SAAA,aAAA;AACA,SAAA,kBAAA;AACA,SAAA,SAAA;AACA,SAAA,eAAA;AAAA,EAAA;AAAA,EAGlB,MAAM,gBAAgB,iBAAkE;AAChF,WAAA,MAAM,KAAK,gBAAgB;AAAA,MACjC;AAAA,QACC,QAAQ,KAAK;AAAA,QACb,QAAQ,KAAK,WAAW,KAAK;AAAA,QAC7B;AAAA,QACA,cAAc,KAAK;AAAA,QACnB,KAAK,KAAK;AAAA,MAAA;AAAA,IAEZ;AAAA,EAAA;AAAA,EAGD,MAAM,uBAAuB,iBAAyE;AAC9F,WAAA,MAAM,KAAK,gBAAgB;AAAA,MACjC;AAAA,QACC,QAAQ,KAAK;AAAA,QACb,QAAQ,KAAK,WAAW,KAAK;AAAA,QAC7B;AAAA,QACA,cAAc,KAAK;AAAA,QACnB,KAAK,KAAK;AAAA,MAAA;AAAA,IAEZ;AAAA,EAAA;AAAA,EAGD,MAAM,wBAAwB,iBAA0E;AAChG,WAAA,MAAM,KAAK,gBAAgB;AAAA,MACjC;AAAA,QACC,QAAQ,KAAK;AAAA,QACb,QAAQ,KAAK,WAAW,KAAK;AAAA,QAC7B;AAAA,QACA,cAAc,KAAK;AAAA,QACnB,KAAK,KAAK;AAAA,MAAA;AAAA,IAEZ;AAAA,EAAA;AAAA,EAGD,cAAqB;AACpB,UAAM,IAAI,MAAM;AAAA,EAAA;AAAA,EAGjB,kBAAyB;AACxB,UAAM,IAAI,MAAM;AAAA,EAAA;AAAA,EAGjB,wBAA+B;AAC9B,UAAM,IAAI,MAAM;AAAA,EAAA;AAAA,EAGjB,uBAA8B;AAC7B,UAAM,IAAI,MAAM;AAAA,EAAA;AAElB;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"PaginatedHasManyCountVisitor.js","sources":["../../../../../../packages/engine-content-api/src/extensions/paginatedHasMany/PaginatedHasManyCountVisitor.ts"],"sourcesContent":["import { Input, Model } from '@contember/schema'\nimport { GroupedCounts, Mapper, RelationFetcher } from '../../mapper'\nimport { ObjectNode } from '../../inputProcessing'\n\nexport class PaginatedHasManyCountVisitor implements\n\tModel.ColumnVisitor<Promise<GroupedCounts>>,\n\tModel.RelationByTypeVisitor<Promise<GroupedCounts>> {\n\n\tconstructor(\n\t\tprivate readonly ids: Input.PrimaryValue[],\n\t\tprivate readonly objectNode: ObjectNode<Input.PaginationQueryInput>,\n\t\tprivate readonly relationFetcher: RelationFetcher,\n\t\tprivate readonly mapper: Mapper,\n\t\tprivate readonly relationPath: Model.AnyRelationContext[],\n\t) {}\n\n\tasync visitOneHasMany(relationContext: Model.OneHasManyContext): Promise<GroupedCounts> {\n\t\treturn await this.relationFetcher.countOneHasManyGroups(\n\t\t\t{\n\t\t\t\tmapper: this.mapper,\n\t\t\t\tfilter: this.objectNode.args.filter,\n\t\t\t\trelationContext,\n\t\t\t\trelationPath: this.relationPath,\n\t\t\t\tids: this.ids,\n\t\t\t},\n\t\t)\n\t}\n\n\tasync visitManyHasManyOwning(relationContext: Model.ManyHasManyOwningContext): Promise<GroupedCounts> {\n\t\treturn await this.relationFetcher.countManyHasManyGroups(\n\t\t\t{\n\t\t\t\tmapper: this.mapper,\n\t\t\t\tfilter: this.objectNode.args.filter,\n\t\t\t\trelationContext,\n\t\t\t\trelationPath: this.relationPath,\n\t\t\t\tids: this.ids,\n\t\t\t},\n\t\t)\n\t}\n\n\tasync visitManyHasManyInverse(relationContext: Model.ManyHasManyInverseContext): Promise<GroupedCounts> {\n\t\treturn await this.relationFetcher.countManyHasManyGroups(\n\t\t\t{\n\t\t\t\tmapper: this.mapper,\n\t\t\t\tfilter: this.objectNode.args.filter,\n\t\t\t\trelationContext,\n\t\t\t\trelationPath: this.relationPath,\n\t\t\t\tids: this.ids,\n\t\t\t},\n\t\t)\n\t}\n\n\tvisitColumn(): never {\n\t\tthrow new Error()\n\t}\n\n\tvisitManyHasOne(): never {\n\t\tthrow new Error()\n\t}\n\n\tvisitOneHasOneInverse(): never {\n\t\tthrow new Error()\n\t}\n\n\tvisitOneHasOneOwning(): never {\n\t\tthrow new Error()\n\t}\n}\n"],"names":[],"mappings":"AAIO,MAAM,6BAEwC;AAAA,EAEpD,YACkB,KACA,YACA,iBACA,QACA,cAChB;AALgB,SAAA,MAAA;AACA,SAAA,aAAA;AACA,SAAA,kBAAA;AACA,SAAA,SAAA;AACA,SAAA,eAAA;AAAA,EACf;AAAA,EAEH,MAAM,gBAAgB,iBAAkE;AAChF,WAAA,MAAM,KAAK,gBAAgB;AAAA,MACjC;AAAA,QACC,QAAQ,KAAK;AAAA,QACb,QAAQ,KAAK,WAAW,KAAK;AAAA,QAC7B;AAAA,QACA,cAAc,KAAK;AAAA,QACnB,KAAK,KAAK;AAAA,MACX;AAAA,IAAA;AAAA,EAEF;AAAA,EAEA,MAAM,uBAAuB,iBAAyE;AAC9F,WAAA,MAAM,KAAK,gBAAgB;AAAA,MACjC;AAAA,QACC,QAAQ,KAAK;AAAA,QACb,QAAQ,KAAK,WAAW,KAAK;AAAA,QAC7B;AAAA,QACA,cAAc,KAAK;AAAA,QACnB,KAAK,KAAK;AAAA,MACX;AAAA,IAAA;AAAA,EAEF;AAAA,EAEA,MAAM,wBAAwB,iBAA0E;AAChG,WAAA,MAAM,KAAK,gBAAgB;AAAA,MACjC;AAAA,QACC,QAAQ,KAAK;AAAA,QACb,QAAQ,KAAK,WAAW,KAAK;AAAA,QAC7B;AAAA,QACA,cAAc,KAAK;AAAA,QACnB,KAAK,KAAK;AAAA,MACX;AAAA,IAAA;AAAA,EAEF;AAAA,EAEA,cAAqB;AACpB,UAAM,IAAI,MAAM;AAAA,EACjB;AAAA,EAEA,kBAAyB;AACxB,UAAM,IAAI,MAAM;AAAA,EACjB;AAAA,EAEA,wBAA+B;AAC9B,UAAM,IAAI,MAAM;AAAA,EACjB;AAAA,EAEA,uBAA8B;AAC7B,UAAM,IAAI,MAAM;AAAA,EACjB;AACD;"}
1
+ {"version":3,"file":"PaginatedHasManyCountVisitor.js","sources":["../../../../../../packages/engine-content-api/src/extensions/paginatedHasMany/PaginatedHasManyCountVisitor.ts"],"sourcesContent":["import { Input, Model } from '@contember/schema'\nimport { GroupedCounts, Mapper, RelationFetcher } from '../../mapper'\nimport { ObjectNode } from '../../inputProcessing'\n\nexport class PaginatedHasManyCountVisitor implements\n\tModel.ColumnVisitor<Promise<GroupedCounts>>,\n\tModel.RelationByTypeVisitor<Promise<GroupedCounts>> {\n\n\tconstructor(\n\t\tprivate readonly ids: Input.PrimaryValue[],\n\t\tprivate readonly objectNode: ObjectNode<Input.PaginationQueryInput>,\n\t\tprivate readonly relationFetcher: RelationFetcher,\n\t\tprivate readonly mapper: Mapper,\n\t\tprivate readonly relationPath: Model.AnyRelationContext[],\n\t) {}\n\n\tasync visitOneHasMany(relationContext: Model.OneHasManyContext): Promise<GroupedCounts> {\n\t\treturn await this.relationFetcher.countOneHasManyGroups(\n\t\t\t{\n\t\t\t\tmapper: this.mapper,\n\t\t\t\tfilter: this.objectNode.args.filter,\n\t\t\t\trelationContext,\n\t\t\t\trelationPath: this.relationPath,\n\t\t\t\tids: this.ids,\n\t\t\t},\n\t\t)\n\t}\n\n\tasync visitManyHasManyOwning(relationContext: Model.ManyHasManyOwningContext): Promise<GroupedCounts> {\n\t\treturn await this.relationFetcher.countManyHasManyGroups(\n\t\t\t{\n\t\t\t\tmapper: this.mapper,\n\t\t\t\tfilter: this.objectNode.args.filter,\n\t\t\t\trelationContext,\n\t\t\t\trelationPath: this.relationPath,\n\t\t\t\tids: this.ids,\n\t\t\t},\n\t\t)\n\t}\n\n\tasync visitManyHasManyInverse(relationContext: Model.ManyHasManyInverseContext): Promise<GroupedCounts> {\n\t\treturn await this.relationFetcher.countManyHasManyGroups(\n\t\t\t{\n\t\t\t\tmapper: this.mapper,\n\t\t\t\tfilter: this.objectNode.args.filter,\n\t\t\t\trelationContext,\n\t\t\t\trelationPath: this.relationPath,\n\t\t\t\tids: this.ids,\n\t\t\t},\n\t\t)\n\t}\n\n\tvisitColumn(): never {\n\t\tthrow new Error()\n\t}\n\n\tvisitManyHasOne(): never {\n\t\tthrow new Error()\n\t}\n\n\tvisitOneHasOneInverse(): never {\n\t\tthrow new Error()\n\t}\n\n\tvisitOneHasOneOwning(): never {\n\t\tthrow new Error()\n\t}\n}\n"],"names":[],"mappings":"AAIO,MAAM,6BAEwC;AAAA,EAEpD,YACkB,KACA,YACA,iBACA,QACA,cAChB;AALgB,SAAA,MAAA;AACA,SAAA,aAAA;AACA,SAAA,kBAAA;AACA,SAAA,SAAA;AACA,SAAA,eAAA;AAAA,EAAA;AAAA,EAGlB,MAAM,gBAAgB,iBAAkE;AAChF,WAAA,MAAM,KAAK,gBAAgB;AAAA,MACjC;AAAA,QACC,QAAQ,KAAK;AAAA,QACb,QAAQ,KAAK,WAAW,KAAK;AAAA,QAC7B;AAAA,QACA,cAAc,KAAK;AAAA,QACnB,KAAK,KAAK;AAAA,MAAA;AAAA,IAEZ;AAAA,EAAA;AAAA,EAGD,MAAM,uBAAuB,iBAAyE;AAC9F,WAAA,MAAM,KAAK,gBAAgB;AAAA,MACjC;AAAA,QACC,QAAQ,KAAK;AAAA,QACb,QAAQ,KAAK,WAAW,KAAK;AAAA,QAC7B;AAAA,QACA,cAAc,KAAK;AAAA,QACnB,KAAK,KAAK;AAAA,MAAA;AAAA,IAEZ;AAAA,EAAA;AAAA,EAGD,MAAM,wBAAwB,iBAA0E;AAChG,WAAA,MAAM,KAAK,gBAAgB;AAAA,MACjC;AAAA,QACC,QAAQ,KAAK;AAAA,QACb,QAAQ,KAAK,WAAW,KAAK;AAAA,QAC7B;AAAA,QACA,cAAc,KAAK;AAAA,QACnB,KAAK,KAAK;AAAA,MAAA;AAAA,IAEZ;AAAA,EAAA;AAAA,EAGD,cAAqB;AACpB,UAAM,IAAI,MAAM;AAAA,EAAA;AAAA,EAGjB,kBAAyB;AACxB,UAAM,IAAI,MAAM;AAAA,EAAA;AAAA,EAGjB,wBAA+B;AAC9B,UAAM,IAAI,MAAM;AAAA,EAAA;AAAA,EAGjB,uBAA8B;AAC7B,UAAM,IAAI,MAAM;AAAA,EAAA;AAElB;"}
@@ -1 +1 @@
1
- {"version":3,"file":"PaginatedHasManyExecutionHandler.cjs","sources":["../../../../../../packages/engine-content-api/src/extensions/paginatedHasMany/PaginatedHasManyExecutionHandler.ts"],"sourcesContent":["import { Input, Model } from '@contember/schema'\nimport { RelationFetcher, SelectExecutionHandler, SelectExecutionHandlerContext } from '../../mapper'\nimport { PaginatedHasManyFieldProviderExtension } from './PaginatedHasManyFieldProvider'\nimport { acceptFieldVisitor } from '@contember/schema-utils'\nimport { createPaginationHelper } from '../../utils'\nimport { PaginatedHasManyCountVisitor } from './PaginatedHasManyCountVisitor'\nimport { PaginatedHasManyNodesVisitor } from './PaginatedHasManyNodesVisitor'\n\nexport class PaginatedHasManyExecutionHandler implements SelectExecutionHandler<Input.PaginationQueryInput, PaginatedHasManyFieldProviderExtension> {\n\tconstructor(\n\t\tprivate readonly schema: Model.Schema,\n\t\tprivate readonly relationFetcher: RelationFetcher,\n\t) {}\n\n\tprocess(\n\t\tcontext: SelectExecutionHandlerContext<Input.PaginationQueryInput, PaginatedHasManyFieldProviderExtension>,\n\t): void {\n\t\tconst { addData, entity, objectNode, mapper } = context\n\t\tif (!objectNode) {\n\t\t\tthrow new Error()\n\t\t}\n\t\tconst pagination = createPaginationHelper(objectNode)\n\t\taddData({\n\t\t\tfield: context.entity.primary,\n\t\t\tdataProvider: async ids => {\n\t\t\t\tconst counts = pagination.requiresTotalCount\n\t\t\t\t\t? await acceptFieldVisitor(\n\t\t\t\t\t\tthis.schema,\n\t\t\t\t\t\tentity,\n\t\t\t\t\t\tobjectNode.extensions.relationName,\n\t\t\t\t\t\tnew PaginatedHasManyCountVisitor(ids, objectNode, this.relationFetcher, mapper, context.relationPath),\n\t\t\t\t\t )\n\t\t\t\t\t: {}\n\n\t\t\t\tconst nodes = pagination.nodeField\n\t\t\t\t\t? await acceptFieldVisitor(\n\t\t\t\t\t\tthis.schema,\n\t\t\t\t\t\tentity,\n\t\t\t\t\t\tobjectNode.extensions.relationName,\n\t\t\t\t\t\tnew PaginatedHasManyNodesVisitor(ids, pagination.nodeField, this.relationFetcher, mapper, context.relationPath),\n\t\t\t\t\t )\n\t\t\t\t\t: undefined\n\t\t\t\tconst result = new Map<Input.PrimaryValue, any>()\n\t\t\t\tfor (const id of ids) {\n\t\t\t\t\tresult.set(id, pagination.createResponse(counts?.[id] ?? 0, nodes?.[id] ?? []))\n\t\t\t\t}\n\t\t\t\treturn Object.fromEntries(result)\n\t\t\t},\n\t\t\tdefaultValue: pagination.createResponse(0, []),\n\t\t})\n\t}\n}\n"],"names":["createPaginationHelper","acceptFieldVisitor","PaginatedHasManyCountVisitor","PaginatedHasManyNodesVisitor"],"mappings":";;;;;;AAQO,MAAM,iCAAuI;AAAA,EACnJ,YACkB,QACA,iBAChB;AAFgB,SAAA,SAAA;AACA,SAAA,kBAAA;AAAA,EACf;AAAA,EAEH,QACC,SACO;AACP,UAAM,EAAE,SAAS,QAAQ,YAAY,WAAW;AAChD,QAAI,CAAC,YAAY;AAChB,YAAM,IAAI,MAAM;AAAA,IACjB;AACM,UAAA,aAAaA,uCAAuB,UAAU;AAC5C,YAAA;AAAA,MACP,OAAO,QAAQ,OAAO;AAAA,MACtB,cAAc,OAAM,QAAO;AACpB,cAAA,SAAS,WAAW,qBACvB,MAAMC,YAAA;AAAA,UACP,KAAK;AAAA,UACL;AAAA,UACA,WAAW,WAAW;AAAA,UACtB,IAAIC,0DAA6B,KAAK,YAAY,KAAK,iBAAiB,QAAQ,QAAQ,YAAY;AAAA,YAEnG;AAEG,cAAA,QAAQ,WAAW,YACtB,MAAMD,YAAA;AAAA,UACP,KAAK;AAAA,UACL;AAAA,UACA,WAAW,WAAW;AAAA,UACtB,IAAIE,0DAA6B,KAAK,WAAW,WAAW,KAAK,iBAAiB,QAAQ,QAAQ,YAAY;AAAA,QAE7G,IAAA;AACG,cAAA,6BAAa;AACnB,mBAAW,MAAM,KAAK;AACrB,iBAAO,IAAI,IAAI,WAAW,eAAe,SAAS,EAAE,KAAK,GAAG,QAAQ,EAAE,KAAK,CAAA,CAAE,CAAC;AAAA,QAC/E;AACO,eAAA,OAAO,YAAY,MAAM;AAAA,MACjC;AAAA,MACA,cAAc,WAAW,eAAe,GAAG,CAAA,CAAE;AAAA,IAAA,CAC7C;AAAA,EACF;AACD;;"}
1
+ {"version":3,"file":"PaginatedHasManyExecutionHandler.cjs","sources":["../../../../../../packages/engine-content-api/src/extensions/paginatedHasMany/PaginatedHasManyExecutionHandler.ts"],"sourcesContent":["import { Input, Model } from '@contember/schema'\nimport { RelationFetcher, SelectExecutionHandler, SelectExecutionHandlerContext } from '../../mapper'\nimport { PaginatedHasManyFieldProviderExtension } from './PaginatedHasManyFieldProvider'\nimport { acceptFieldVisitor } from '@contember/schema-utils'\nimport { createPaginationHelper } from '../../utils'\nimport { PaginatedHasManyCountVisitor } from './PaginatedHasManyCountVisitor'\nimport { PaginatedHasManyNodesVisitor } from './PaginatedHasManyNodesVisitor'\n\nexport class PaginatedHasManyExecutionHandler implements SelectExecutionHandler<Input.PaginationQueryInput, PaginatedHasManyFieldProviderExtension> {\n\tconstructor(\n\t\tprivate readonly schema: Model.Schema,\n\t\tprivate readonly relationFetcher: RelationFetcher,\n\t) {}\n\n\tprocess(\n\t\tcontext: SelectExecutionHandlerContext<Input.PaginationQueryInput, PaginatedHasManyFieldProviderExtension>,\n\t): void {\n\t\tconst { addData, entity, objectNode, mapper } = context\n\t\tif (!objectNode) {\n\t\t\tthrow new Error()\n\t\t}\n\t\tconst pagination = createPaginationHelper(objectNode)\n\t\taddData({\n\t\t\tfield: context.entity.primary,\n\t\t\tdataProvider: async ids => {\n\t\t\t\tconst counts = pagination.requiresTotalCount\n\t\t\t\t\t? await acceptFieldVisitor(\n\t\t\t\t\t\tthis.schema,\n\t\t\t\t\t\tentity,\n\t\t\t\t\t\tobjectNode.extensions.relationName,\n\t\t\t\t\t\tnew PaginatedHasManyCountVisitor(ids, objectNode, this.relationFetcher, mapper, context.relationPath),\n\t\t\t\t\t )\n\t\t\t\t\t: {}\n\n\t\t\t\tconst nodes = pagination.nodeField\n\t\t\t\t\t? await acceptFieldVisitor(\n\t\t\t\t\t\tthis.schema,\n\t\t\t\t\t\tentity,\n\t\t\t\t\t\tobjectNode.extensions.relationName,\n\t\t\t\t\t\tnew PaginatedHasManyNodesVisitor(ids, pagination.nodeField, this.relationFetcher, mapper, context.relationPath),\n\t\t\t\t\t )\n\t\t\t\t\t: undefined\n\t\t\t\tconst result = new Map<Input.PrimaryValue, any>()\n\t\t\t\tfor (const id of ids) {\n\t\t\t\t\tresult.set(id, pagination.createResponse(counts?.[id] ?? 0, nodes?.[id] ?? []))\n\t\t\t\t}\n\t\t\t\treturn Object.fromEntries(result)\n\t\t\t},\n\t\t\tdefaultValue: pagination.createResponse(0, []),\n\t\t})\n\t}\n}\n"],"names":["createPaginationHelper","acceptFieldVisitor","PaginatedHasManyCountVisitor","PaginatedHasManyNodesVisitor"],"mappings":";;;;;;AAQO,MAAM,iCAAuI;AAAA,EACnJ,YACkB,QACA,iBAChB;AAFgB,SAAA,SAAA;AACA,SAAA,kBAAA;AAAA,EAAA;AAAA,EAGlB,QACC,SACO;AACP,UAAM,EAAE,SAAS,QAAQ,YAAY,OAAW,IAAA;AAChD,QAAI,CAAC,YAAY;AAChB,YAAM,IAAI,MAAM;AAAA,IAAA;AAEX,UAAA,aAAaA,uCAAuB,UAAU;AAC5C,YAAA;AAAA,MACP,OAAO,QAAQ,OAAO;AAAA,MACtB,cAAc,OAAM,QAAO;AACpB,cAAA,SAAS,WAAW,qBACvB,MAAMC,YAAA;AAAA,UACP,KAAK;AAAA,UACL;AAAA,UACA,WAAW,WAAW;AAAA,UACtB,IAAIC,6BAAAA,6BAA6B,KAAK,YAAY,KAAK,iBAAiB,QAAQ,QAAQ,YAAY;AAAA,QAAA,IAEnG,CAAC;AAEE,cAAA,QAAQ,WAAW,YACtB,MAAMD,YAAA;AAAA,UACP,KAAK;AAAA,UACL;AAAA,UACA,WAAW,WAAW;AAAA,UACtB,IAAIE,0DAA6B,KAAK,WAAW,WAAW,KAAK,iBAAiB,QAAQ,QAAQ,YAAY;AAAA,QAE7G,IAAA;AACG,cAAA,6BAAa,IAA6B;AAChD,mBAAW,MAAM,KAAK;AACrB,iBAAO,IAAI,IAAI,WAAW,eAAe,SAAS,EAAE,KAAK,GAAG,QAAQ,EAAE,KAAK,CAAE,CAAA,CAAC;AAAA,QAAA;AAExE,eAAA,OAAO,YAAY,MAAM;AAAA,MACjC;AAAA,MACA,cAAc,WAAW,eAAe,GAAG,CAAE,CAAA;AAAA,IAAA,CAC7C;AAAA,EAAA;AAEH;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"PaginatedHasManyExecutionHandler.js","sources":["../../../../../../packages/engine-content-api/src/extensions/paginatedHasMany/PaginatedHasManyExecutionHandler.ts"],"sourcesContent":["import { Input, Model } from '@contember/schema'\nimport { RelationFetcher, SelectExecutionHandler, SelectExecutionHandlerContext } from '../../mapper'\nimport { PaginatedHasManyFieldProviderExtension } from './PaginatedHasManyFieldProvider'\nimport { acceptFieldVisitor } from '@contember/schema-utils'\nimport { createPaginationHelper } from '../../utils'\nimport { PaginatedHasManyCountVisitor } from './PaginatedHasManyCountVisitor'\nimport { PaginatedHasManyNodesVisitor } from './PaginatedHasManyNodesVisitor'\n\nexport class PaginatedHasManyExecutionHandler implements SelectExecutionHandler<Input.PaginationQueryInput, PaginatedHasManyFieldProviderExtension> {\n\tconstructor(\n\t\tprivate readonly schema: Model.Schema,\n\t\tprivate readonly relationFetcher: RelationFetcher,\n\t) {}\n\n\tprocess(\n\t\tcontext: SelectExecutionHandlerContext<Input.PaginationQueryInput, PaginatedHasManyFieldProviderExtension>,\n\t): void {\n\t\tconst { addData, entity, objectNode, mapper } = context\n\t\tif (!objectNode) {\n\t\t\tthrow new Error()\n\t\t}\n\t\tconst pagination = createPaginationHelper(objectNode)\n\t\taddData({\n\t\t\tfield: context.entity.primary,\n\t\t\tdataProvider: async ids => {\n\t\t\t\tconst counts = pagination.requiresTotalCount\n\t\t\t\t\t? await acceptFieldVisitor(\n\t\t\t\t\t\tthis.schema,\n\t\t\t\t\t\tentity,\n\t\t\t\t\t\tobjectNode.extensions.relationName,\n\t\t\t\t\t\tnew PaginatedHasManyCountVisitor(ids, objectNode, this.relationFetcher, mapper, context.relationPath),\n\t\t\t\t\t )\n\t\t\t\t\t: {}\n\n\t\t\t\tconst nodes = pagination.nodeField\n\t\t\t\t\t? await acceptFieldVisitor(\n\t\t\t\t\t\tthis.schema,\n\t\t\t\t\t\tentity,\n\t\t\t\t\t\tobjectNode.extensions.relationName,\n\t\t\t\t\t\tnew PaginatedHasManyNodesVisitor(ids, pagination.nodeField, this.relationFetcher, mapper, context.relationPath),\n\t\t\t\t\t )\n\t\t\t\t\t: undefined\n\t\t\t\tconst result = new Map<Input.PrimaryValue, any>()\n\t\t\t\tfor (const id of ids) {\n\t\t\t\t\tresult.set(id, pagination.createResponse(counts?.[id] ?? 0, nodes?.[id] ?? []))\n\t\t\t\t}\n\t\t\t\treturn Object.fromEntries(result)\n\t\t\t},\n\t\t\tdefaultValue: pagination.createResponse(0, []),\n\t\t})\n\t}\n}\n"],"names":[],"mappings":";;;;AAQO,MAAM,iCAAuI;AAAA,EACnJ,YACkB,QACA,iBAChB;AAFgB,SAAA,SAAA;AACA,SAAA,kBAAA;AAAA,EACf;AAAA,EAEH,QACC,SACO;AACP,UAAM,EAAE,SAAS,QAAQ,YAAY,WAAW;AAChD,QAAI,CAAC,YAAY;AAChB,YAAM,IAAI,MAAM;AAAA,IACjB;AACM,UAAA,aAAa,uBAAuB,UAAU;AAC5C,YAAA;AAAA,MACP,OAAO,QAAQ,OAAO;AAAA,MACtB,cAAc,OAAM,QAAO;AACpB,cAAA,SAAS,WAAW,qBACvB,MAAM;AAAA,UACP,KAAK;AAAA,UACL;AAAA,UACA,WAAW,WAAW;AAAA,UACtB,IAAI,6BAA6B,KAAK,YAAY,KAAK,iBAAiB,QAAQ,QAAQ,YAAY;AAAA,YAEnG;AAEG,cAAA,QAAQ,WAAW,YACtB,MAAM;AAAA,UACP,KAAK;AAAA,UACL;AAAA,UACA,WAAW,WAAW;AAAA,UACtB,IAAI,6BAA6B,KAAK,WAAW,WAAW,KAAK,iBAAiB,QAAQ,QAAQ,YAAY;AAAA,QAE7G,IAAA;AACG,cAAA,6BAAa;AACnB,mBAAW,MAAM,KAAK;AACrB,iBAAO,IAAI,IAAI,WAAW,eAAe,SAAS,EAAE,KAAK,GAAG,QAAQ,EAAE,KAAK,CAAA,CAAE,CAAC;AAAA,QAC/E;AACO,eAAA,OAAO,YAAY,MAAM;AAAA,MACjC;AAAA,MACA,cAAc,WAAW,eAAe,GAAG,CAAA,CAAE;AAAA,IAAA,CAC7C;AAAA,EACF;AACD;"}
1
+ {"version":3,"file":"PaginatedHasManyExecutionHandler.js","sources":["../../../../../../packages/engine-content-api/src/extensions/paginatedHasMany/PaginatedHasManyExecutionHandler.ts"],"sourcesContent":["import { Input, Model } from '@contember/schema'\nimport { RelationFetcher, SelectExecutionHandler, SelectExecutionHandlerContext } from '../../mapper'\nimport { PaginatedHasManyFieldProviderExtension } from './PaginatedHasManyFieldProvider'\nimport { acceptFieldVisitor } from '@contember/schema-utils'\nimport { createPaginationHelper } from '../../utils'\nimport { PaginatedHasManyCountVisitor } from './PaginatedHasManyCountVisitor'\nimport { PaginatedHasManyNodesVisitor } from './PaginatedHasManyNodesVisitor'\n\nexport class PaginatedHasManyExecutionHandler implements SelectExecutionHandler<Input.PaginationQueryInput, PaginatedHasManyFieldProviderExtension> {\n\tconstructor(\n\t\tprivate readonly schema: Model.Schema,\n\t\tprivate readonly relationFetcher: RelationFetcher,\n\t) {}\n\n\tprocess(\n\t\tcontext: SelectExecutionHandlerContext<Input.PaginationQueryInput, PaginatedHasManyFieldProviderExtension>,\n\t): void {\n\t\tconst { addData, entity, objectNode, mapper } = context\n\t\tif (!objectNode) {\n\t\t\tthrow new Error()\n\t\t}\n\t\tconst pagination = createPaginationHelper(objectNode)\n\t\taddData({\n\t\t\tfield: context.entity.primary,\n\t\t\tdataProvider: async ids => {\n\t\t\t\tconst counts = pagination.requiresTotalCount\n\t\t\t\t\t? await acceptFieldVisitor(\n\t\t\t\t\t\tthis.schema,\n\t\t\t\t\t\tentity,\n\t\t\t\t\t\tobjectNode.extensions.relationName,\n\t\t\t\t\t\tnew PaginatedHasManyCountVisitor(ids, objectNode, this.relationFetcher, mapper, context.relationPath),\n\t\t\t\t\t )\n\t\t\t\t\t: {}\n\n\t\t\t\tconst nodes = pagination.nodeField\n\t\t\t\t\t? await acceptFieldVisitor(\n\t\t\t\t\t\tthis.schema,\n\t\t\t\t\t\tentity,\n\t\t\t\t\t\tobjectNode.extensions.relationName,\n\t\t\t\t\t\tnew PaginatedHasManyNodesVisitor(ids, pagination.nodeField, this.relationFetcher, mapper, context.relationPath),\n\t\t\t\t\t )\n\t\t\t\t\t: undefined\n\t\t\t\tconst result = new Map<Input.PrimaryValue, any>()\n\t\t\t\tfor (const id of ids) {\n\t\t\t\t\tresult.set(id, pagination.createResponse(counts?.[id] ?? 0, nodes?.[id] ?? []))\n\t\t\t\t}\n\t\t\t\treturn Object.fromEntries(result)\n\t\t\t},\n\t\t\tdefaultValue: pagination.createResponse(0, []),\n\t\t})\n\t}\n}\n"],"names":[],"mappings":";;;;AAQO,MAAM,iCAAuI;AAAA,EACnJ,YACkB,QACA,iBAChB;AAFgB,SAAA,SAAA;AACA,SAAA,kBAAA;AAAA,EAAA;AAAA,EAGlB,QACC,SACO;AACP,UAAM,EAAE,SAAS,QAAQ,YAAY,OAAW,IAAA;AAChD,QAAI,CAAC,YAAY;AAChB,YAAM,IAAI,MAAM;AAAA,IAAA;AAEX,UAAA,aAAa,uBAAuB,UAAU;AAC5C,YAAA;AAAA,MACP,OAAO,QAAQ,OAAO;AAAA,MACtB,cAAc,OAAM,QAAO;AACpB,cAAA,SAAS,WAAW,qBACvB,MAAM;AAAA,UACP,KAAK;AAAA,UACL;AAAA,UACA,WAAW,WAAW;AAAA,UACtB,IAAI,6BAA6B,KAAK,YAAY,KAAK,iBAAiB,QAAQ,QAAQ,YAAY;AAAA,QAAA,IAEnG,CAAC;AAEE,cAAA,QAAQ,WAAW,YACtB,MAAM;AAAA,UACP,KAAK;AAAA,UACL;AAAA,UACA,WAAW,WAAW;AAAA,UACtB,IAAI,6BAA6B,KAAK,WAAW,WAAW,KAAK,iBAAiB,QAAQ,QAAQ,YAAY;AAAA,QAE7G,IAAA;AACG,cAAA,6BAAa,IAA6B;AAChD,mBAAW,MAAM,KAAK;AACrB,iBAAO,IAAI,IAAI,WAAW,eAAe,SAAS,EAAE,KAAK,GAAG,QAAQ,EAAE,KAAK,CAAE,CAAA,CAAC;AAAA,QAAA;AAExE,eAAA,OAAO,YAAY,MAAM;AAAA,MACjC;AAAA,MACA,cAAc,WAAW,eAAe,GAAG,CAAE,CAAA;AAAA,IAAA,CAC7C;AAAA,EAAA;AAEH;"}
@@ -1 +1 @@
1
- {"version":3,"file":"PaginatedHasManyFieldProvider.cjs","sources":["../../../../../../packages/engine-content-api/src/extensions/paginatedHasMany/PaginatedHasManyFieldProvider.ts"],"sourcesContent":["import { EntityFieldsProvider, FieldMap } from '../EntityFieldsProvider'\nimport { acceptFieldVisitor } from '@contember/schema-utils'\nimport { Model } from '@contember/schema'\nimport { PaginatedHasManyFieldProviderVisitor } from './PaginatedHasManyFieldProviderVisitor'\n\nexport class PaginatedHasManyFieldProvider implements EntityFieldsProvider<PaginatedHasManyFieldProviderExtension> {\n\tstatic extensionName: string = 'PaginatedHasMany'\n\n\tconstructor(private readonly schema: Model.Schema, private readonly visitor: PaginatedHasManyFieldProviderVisitor) {}\n\n\tgetFields(entity: Model.Entity, accessibleFields: Model.AnyField[]): FieldMap<PaginatedHasManyFieldProviderExtension> {\n\t\tconst fields: FieldMap<PaginatedHasManyFieldProviderExtension> = {}\n\t\tfor (const field of accessibleFields) {\n\t\t\tfor (const [name, fieldConfig] of acceptFieldVisitor(this.schema, entity, field, this.visitor)) {\n\t\t\t\tfields[name] = fieldConfig\n\t\t\t}\n\t\t}\n\t\treturn fields\n\t}\n}\n\nexport interface PaginatedHasManyFieldProviderExtension {\n\trelationName: string\n}\n"],"names":["acceptFieldVisitor"],"mappings":";;;;;;AAKO,MAAM,8BAAsG;AAAA,EAGlH,YAA6B,QAAuC,SAA+C;AAAtF,SAAA,SAAA;AAAuC,SAAA,UAAA;AAAA,EAAgD;AAAA,EAEpH,UAAU,QAAsB,kBAAsF;AACrH,UAAM,SAA2D,CAAA;AACjE,eAAW,SAAS,kBAAkB;AAC1B,iBAAA,CAAC,MAAM,WAAW,KAAKA,YAAAA,mBAAmB,KAAK,QAAQ,QAAQ,OAAO,KAAK,OAAO,GAAG;AAC/F,eAAO,IAAI,IAAI;AAAA,MAChB;AAAA,IACD;AACO,WAAA;AAAA,EACR;AACD;AAbC,cADY,+BACL,iBAAwB,kBAAA;;"}
1
+ {"version":3,"file":"PaginatedHasManyFieldProvider.cjs","sources":["../../../../../../packages/engine-content-api/src/extensions/paginatedHasMany/PaginatedHasManyFieldProvider.ts"],"sourcesContent":["import { EntityFieldsProvider, FieldMap } from '../EntityFieldsProvider'\nimport { acceptFieldVisitor } from '@contember/schema-utils'\nimport { Model } from '@contember/schema'\nimport { PaginatedHasManyFieldProviderVisitor } from './PaginatedHasManyFieldProviderVisitor'\n\nexport class PaginatedHasManyFieldProvider implements EntityFieldsProvider<PaginatedHasManyFieldProviderExtension> {\n\tstatic extensionName: string = 'PaginatedHasMany'\n\n\tconstructor(private readonly schema: Model.Schema, private readonly visitor: PaginatedHasManyFieldProviderVisitor) {}\n\n\tgetFields(entity: Model.Entity, accessibleFields: Model.AnyField[]): FieldMap<PaginatedHasManyFieldProviderExtension> {\n\t\tconst fields: FieldMap<PaginatedHasManyFieldProviderExtension> = {}\n\t\tfor (const field of accessibleFields) {\n\t\t\tfor (const [name, fieldConfig] of acceptFieldVisitor(this.schema, entity, field, this.visitor)) {\n\t\t\t\tfields[name] = fieldConfig\n\t\t\t}\n\t\t}\n\t\treturn fields\n\t}\n}\n\nexport interface PaginatedHasManyFieldProviderExtension {\n\trelationName: string\n}\n"],"names":["acceptFieldVisitor"],"mappings":";;;;;;AAKO,MAAM,8BAAsG;AAAA,EAGlH,YAA6B,QAAuC,SAA+C;AAAtF,SAAA,SAAA;AAAuC,SAAA,UAAA;AAAA,EAAA;AAAA,EAEpE,UAAU,QAAsB,kBAAsF;AACrH,UAAM,SAA2D,CAAC;AAClE,eAAW,SAAS,kBAAkB;AAC1B,iBAAA,CAAC,MAAM,WAAW,KAAKA,YAAAA,mBAAmB,KAAK,QAAQ,QAAQ,OAAO,KAAK,OAAO,GAAG;AAC/F,eAAO,IAAI,IAAI;AAAA,MAAA;AAAA,IAChB;AAEM,WAAA;AAAA,EAAA;AAET;AAbC,cADY,+BACL,iBAAwB,kBAAA;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"PaginatedHasManyFieldProvider.js","sources":["../../../../../../packages/engine-content-api/src/extensions/paginatedHasMany/PaginatedHasManyFieldProvider.ts"],"sourcesContent":["import { EntityFieldsProvider, FieldMap } from '../EntityFieldsProvider'\nimport { acceptFieldVisitor } from '@contember/schema-utils'\nimport { Model } from '@contember/schema'\nimport { PaginatedHasManyFieldProviderVisitor } from './PaginatedHasManyFieldProviderVisitor'\n\nexport class PaginatedHasManyFieldProvider implements EntityFieldsProvider<PaginatedHasManyFieldProviderExtension> {\n\tstatic extensionName: string = 'PaginatedHasMany'\n\n\tconstructor(private readonly schema: Model.Schema, private readonly visitor: PaginatedHasManyFieldProviderVisitor) {}\n\n\tgetFields(entity: Model.Entity, accessibleFields: Model.AnyField[]): FieldMap<PaginatedHasManyFieldProviderExtension> {\n\t\tconst fields: FieldMap<PaginatedHasManyFieldProviderExtension> = {}\n\t\tfor (const field of accessibleFields) {\n\t\t\tfor (const [name, fieldConfig] of acceptFieldVisitor(this.schema, entity, field, this.visitor)) {\n\t\t\t\tfields[name] = fieldConfig\n\t\t\t}\n\t\t}\n\t\treturn fields\n\t}\n}\n\nexport interface PaginatedHasManyFieldProviderExtension {\n\trelationName: string\n}\n"],"names":[],"mappings":";;;;AAKO,MAAM,8BAAsG;AAAA,EAGlH,YAA6B,QAAuC,SAA+C;AAAtF,SAAA,SAAA;AAAuC,SAAA,UAAA;AAAA,EAAgD;AAAA,EAEpH,UAAU,QAAsB,kBAAsF;AACrH,UAAM,SAA2D,CAAA;AACjE,eAAW,SAAS,kBAAkB;AAC1B,iBAAA,CAAC,MAAM,WAAW,KAAK,mBAAmB,KAAK,QAAQ,QAAQ,OAAO,KAAK,OAAO,GAAG;AAC/F,eAAO,IAAI,IAAI;AAAA,MAChB;AAAA,IACD;AACO,WAAA;AAAA,EACR;AACD;AAbC,cADY,+BACL,iBAAwB,kBAAA;"}
1
+ {"version":3,"file":"PaginatedHasManyFieldProvider.js","sources":["../../../../../../packages/engine-content-api/src/extensions/paginatedHasMany/PaginatedHasManyFieldProvider.ts"],"sourcesContent":["import { EntityFieldsProvider, FieldMap } from '../EntityFieldsProvider'\nimport { acceptFieldVisitor } from '@contember/schema-utils'\nimport { Model } from '@contember/schema'\nimport { PaginatedHasManyFieldProviderVisitor } from './PaginatedHasManyFieldProviderVisitor'\n\nexport class PaginatedHasManyFieldProvider implements EntityFieldsProvider<PaginatedHasManyFieldProviderExtension> {\n\tstatic extensionName: string = 'PaginatedHasMany'\n\n\tconstructor(private readonly schema: Model.Schema, private readonly visitor: PaginatedHasManyFieldProviderVisitor) {}\n\n\tgetFields(entity: Model.Entity, accessibleFields: Model.AnyField[]): FieldMap<PaginatedHasManyFieldProviderExtension> {\n\t\tconst fields: FieldMap<PaginatedHasManyFieldProviderExtension> = {}\n\t\tfor (const field of accessibleFields) {\n\t\t\tfor (const [name, fieldConfig] of acceptFieldVisitor(this.schema, entity, field, this.visitor)) {\n\t\t\t\tfields[name] = fieldConfig\n\t\t\t}\n\t\t}\n\t\treturn fields\n\t}\n}\n\nexport interface PaginatedHasManyFieldProviderExtension {\n\trelationName: string\n}\n"],"names":[],"mappings":";;;;AAKO,MAAM,8BAAsG;AAAA,EAGlH,YAA6B,QAAuC,SAA+C;AAAtF,SAAA,SAAA;AAAuC,SAAA,UAAA;AAAA,EAAA;AAAA,EAEpE,UAAU,QAAsB,kBAAsF;AACrH,UAAM,SAA2D,CAAC;AAClE,eAAW,SAAS,kBAAkB;AAC1B,iBAAA,CAAC,MAAM,WAAW,KAAK,mBAAmB,KAAK,QAAQ,QAAQ,OAAO,KAAK,OAAO,GAAG;AAC/F,eAAO,IAAI,IAAI;AAAA,MAAA;AAAA,IAChB;AAEM,WAAA;AAAA,EAAA;AAET;AAbC,cADY,+BACL,iBAAwB,kBAAA;"}
@@ -1 +1 @@
1
- {"version":3,"file":"PaginatedHasManyFieldProviderVisitor.cjs","sources":["../../../../../../packages/engine-content-api/src/extensions/paginatedHasMany/PaginatedHasManyFieldProviderVisitor.ts"],"sourcesContent":["import { Model } from '@contember/schema'\nimport { PaginatedHasManyFieldProvider, PaginatedHasManyFieldProviderExtension } from './PaginatedHasManyFieldProvider'\nimport { capitalizeFirstLetter } from '../../utils'\nimport { PaginatedFieldConfigFactory } from '../../schema/PaginatedFieldConfigFactory'\nimport { aliasAwareResolver } from '../../schema'\nimport { GraphQLFieldConfig } from 'graphql'\n\ntype Result = [\n\tstring,\n\tGraphQLFieldConfig<any, any> & {\n\t\textensions: PaginatedHasManyFieldProviderExtension\n\t}\n]\n\nexport class PaginatedHasManyFieldProviderVisitor implements\n\tModel.ColumnVisitor<Result[]>,\n\tModel.RelationByTypeVisitor<Result[]> {\n\n\tconstructor(private readonly paginatedFieldFactory: PaginatedFieldConfigFactory) {}\n\n\tvisitOneHasMany({ targetEntity, relation }: Model.OneHasManyContext) {\n\t\treturn this.createField(targetEntity, relation)\n\t}\n\n\tvisitManyHasManyOwning({ targetEntity, relation }: Model.ManyHasManyOwningContext) {\n\t\treturn this.createField(targetEntity, relation)\n\t}\n\n\tvisitManyHasManyInverse({ targetEntity, relation }: Model.ManyHasManyInverseContext) {\n\t\treturn this.createField(targetEntity, relation)\n\t}\n\n\tprivate createField(entity: Model.Entity, relation: Model.Relation): Result[] {\n\t\treturn [\n\t\t\t[\n\t\t\t\t`paginate${capitalizeFirstLetter(relation.name)}`,\n\t\t\t\t{\n\t\t\t\t\t...this.paginatedFieldFactory.createFieldConfig(entity),\n\t\t\t\t\textensions: {\n\t\t\t\t\t\trelationName: relation.name,\n\t\t\t\t\t\textensionKey: PaginatedHasManyFieldProvider.extensionName,\n\t\t\t\t\t},\n\t\t\t\t\tresolve: aliasAwareResolver,\n\t\t\t\t},\n\t\t\t],\n\t\t]\n\t}\n\n\tvisitColumn() {\n\t\treturn []\n\t}\n\n\tvisitManyHasOne() {\n\t\treturn []\n\t}\n\n\tvisitOneHasOneInverse() {\n\t\treturn []\n\t}\n\n\tvisitOneHasOneOwning() {\n\t\treturn []\n\t}\n}\n"],"names":["capitalizeFirstLetter","PaginatedHasManyFieldProvider","aliasAwareResolver"],"mappings":";;;;;;;;;;;AAcO,MAAM,qCAE0B;AAAA,EAEtC,YAA6B,uBAAoD;AAApD,SAAA,wBAAA;AAAA,EAAqD;AAAA,EAElF,gBAAgB,EAAE,cAAc,YAAqC;AAC7D,WAAA,KAAK,YAAY,cAAc,QAAQ;AAAA,EAC/C;AAAA,EAEA,uBAAuB,EAAE,cAAc,YAA4C;AAC3E,WAAA,KAAK,YAAY,cAAc,QAAQ;AAAA,EAC/C;AAAA,EAEA,wBAAwB,EAAE,cAAc,YAA6C;AAC7E,WAAA,KAAK,YAAY,cAAc,QAAQ;AAAA,EAC/C;AAAA,EAEQ,YAAY,QAAsB,UAAoC;AACtE,WAAA;AAAA,MACN;AAAA,QACC,WAAWA,QAAA,sBAAsB,SAAS,IAAI,CAAC;AAAA,QAC/C;AAAA,UACC,GAAG,KAAK,sBAAsB,kBAAkB,MAAM;AAAA,UACtD,YAAY;AAAA,YACX,cAAc,SAAS;AAAA,YACvB,cAAcC,8BAA8B,8BAAA;AAAA,UAC7C;AAAA,UACA,SAASC,MAAA;AAAA,QACV;AAAA,MACD;AAAA,IAAA;AAAA,EAEF;AAAA,EAEA,cAAc;AACb,WAAO;EACR;AAAA,EAEA,kBAAkB;AACjB,WAAO;EACR;AAAA,EAEA,wBAAwB;AACvB,WAAO;EACR;AAAA,EAEA,uBAAuB;AACtB,WAAO;EACR;AACD;;"}
1
+ {"version":3,"file":"PaginatedHasManyFieldProviderVisitor.cjs","sources":["../../../../../../packages/engine-content-api/src/extensions/paginatedHasMany/PaginatedHasManyFieldProviderVisitor.ts"],"sourcesContent":["import { Model } from '@contember/schema'\nimport { PaginatedHasManyFieldProvider, PaginatedHasManyFieldProviderExtension } from './PaginatedHasManyFieldProvider'\nimport { capitalizeFirstLetter } from '../../utils'\nimport { PaginatedFieldConfigFactory } from '../../schema/PaginatedFieldConfigFactory'\nimport { aliasAwareResolver } from '../../schema'\nimport { GraphQLFieldConfig } from 'graphql'\n\ntype Result = [\n\tstring,\n\tGraphQLFieldConfig<any, any> & {\n\t\textensions: PaginatedHasManyFieldProviderExtension\n\t}\n]\n\nexport class PaginatedHasManyFieldProviderVisitor implements\n\tModel.ColumnVisitor<Result[]>,\n\tModel.RelationByTypeVisitor<Result[]> {\n\n\tconstructor(private readonly paginatedFieldFactory: PaginatedFieldConfigFactory) {}\n\n\tvisitOneHasMany({ targetEntity, relation }: Model.OneHasManyContext) {\n\t\treturn this.createField(targetEntity, relation)\n\t}\n\n\tvisitManyHasManyOwning({ targetEntity, relation }: Model.ManyHasManyOwningContext) {\n\t\treturn this.createField(targetEntity, relation)\n\t}\n\n\tvisitManyHasManyInverse({ targetEntity, relation }: Model.ManyHasManyInverseContext) {\n\t\treturn this.createField(targetEntity, relation)\n\t}\n\n\tprivate createField(entity: Model.Entity, relation: Model.Relation): Result[] {\n\t\treturn [\n\t\t\t[\n\t\t\t\t`paginate${capitalizeFirstLetter(relation.name)}`,\n\t\t\t\t{\n\t\t\t\t\t...this.paginatedFieldFactory.createFieldConfig(entity),\n\t\t\t\t\textensions: {\n\t\t\t\t\t\trelationName: relation.name,\n\t\t\t\t\t\textensionKey: PaginatedHasManyFieldProvider.extensionName,\n\t\t\t\t\t},\n\t\t\t\t\tresolve: aliasAwareResolver,\n\t\t\t\t},\n\t\t\t],\n\t\t]\n\t}\n\n\tvisitColumn() {\n\t\treturn []\n\t}\n\n\tvisitManyHasOne() {\n\t\treturn []\n\t}\n\n\tvisitOneHasOneInverse() {\n\t\treturn []\n\t}\n\n\tvisitOneHasOneOwning() {\n\t\treturn []\n\t}\n}\n"],"names":["capitalizeFirstLetter","PaginatedHasManyFieldProvider","aliasAwareResolver"],"mappings":";;;;;;;;;;;AAcO,MAAM,qCAE0B;AAAA,EAEtC,YAA6B,uBAAoD;AAApD,SAAA,wBAAA;AAAA,EAAA;AAAA,EAE7B,gBAAgB,EAAE,cAAc,YAAqC;AAC7D,WAAA,KAAK,YAAY,cAAc,QAAQ;AAAA,EAAA;AAAA,EAG/C,uBAAuB,EAAE,cAAc,YAA4C;AAC3E,WAAA,KAAK,YAAY,cAAc,QAAQ;AAAA,EAAA;AAAA,EAG/C,wBAAwB,EAAE,cAAc,YAA6C;AAC7E,WAAA,KAAK,YAAY,cAAc,QAAQ;AAAA,EAAA;AAAA,EAGvC,YAAY,QAAsB,UAAoC;AACtE,WAAA;AAAA,MACN;AAAA,QACC,WAAWA,QAAA,sBAAsB,SAAS,IAAI,CAAC;AAAA,QAC/C;AAAA,UACC,GAAG,KAAK,sBAAsB,kBAAkB,MAAM;AAAA,UACtD,YAAY;AAAA,YACX,cAAc,SAAS;AAAA,YACvB,cAAcC,8BAAAA,8BAA8B;AAAA,UAC7C;AAAA,UACA,SAASC,MAAAA;AAAAA,QAAA;AAAA,MACV;AAAA,IAEF;AAAA,EAAA;AAAA,EAGD,cAAc;AACb,WAAO,CAAC;AAAA,EAAA;AAAA,EAGT,kBAAkB;AACjB,WAAO,CAAC;AAAA,EAAA;AAAA,EAGT,wBAAwB;AACvB,WAAO,CAAC;AAAA,EAAA;AAAA,EAGT,uBAAuB;AACtB,WAAO,CAAC;AAAA,EAAA;AAEV;;"}