@contember/engine-actions 1.4.0-rc.8 → 2.0.0-alpha.10

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 (599) hide show
  1. package/dist/development/index.cjs +94 -0
  2. package/dist/development/index.cjs.map +1 -0
  3. package/dist/development/index.js +94 -0
  4. package/dist/development/index.js.map +1 -0
  5. package/dist/development/src/ActionsExecutionContainerHookFactory.cjs +30 -0
  6. package/dist/development/src/ActionsExecutionContainerHookFactory.cjs.map +1 -0
  7. package/dist/development/src/ActionsExecutionContainerHookFactory.js +30 -0
  8. package/dist/development/src/ActionsExecutionContainerHookFactory.js.map +1 -0
  9. package/dist/development/src/ImplementationException.cjs +6 -0
  10. package/dist/development/src/ImplementationException.cjs.map +1 -0
  11. package/dist/development/src/ImplementationException.js +6 -0
  12. package/dist/development/src/ImplementationException.js.map +1 -0
  13. package/dist/development/src/ListenerStoreProvider.cjs +25 -0
  14. package/dist/development/src/ListenerStoreProvider.cjs.map +1 -0
  15. package/dist/development/src/ListenerStoreProvider.js +25 -0
  16. package/dist/development/src/ListenerStoreProvider.js.map +1 -0
  17. package/dist/development/src/authorization/ActionsAuthorizationActions.cjs +15 -0
  18. package/dist/development/src/authorization/ActionsAuthorizationActions.cjs.map +1 -0
  19. package/dist/development/src/authorization/ActionsAuthorizationActions.js +16 -0
  20. package/dist/development/src/authorization/ActionsAuthorizationActions.js.map +1 -0
  21. package/dist/development/src/authorization/ActionsPermissionsFactory.cjs +16 -0
  22. package/dist/development/src/authorization/ActionsPermissionsFactory.cjs.map +1 -0
  23. package/dist/development/src/authorization/ActionsPermissionsFactory.js +16 -0
  24. package/dist/development/src/authorization/ActionsPermissionsFactory.js.map +1 -0
  25. package/dist/development/src/dispatch/DispatchWorkerSupervisor.cjs +125 -0
  26. package/dist/development/src/dispatch/DispatchWorkerSupervisor.cjs.map +1 -0
  27. package/dist/development/src/dispatch/DispatchWorkerSupervisor.js +125 -0
  28. package/dist/development/src/dispatch/DispatchWorkerSupervisor.js.map +1 -0
  29. package/dist/development/src/dispatch/EventDispatcher.cjs +43 -0
  30. package/dist/development/src/dispatch/EventDispatcher.cjs.map +1 -0
  31. package/dist/development/src/dispatch/EventDispatcher.js +43 -0
  32. package/dist/development/src/dispatch/EventDispatcher.js.map +1 -0
  33. package/dist/development/src/dispatch/EventsRepository.cjs +104 -0
  34. package/dist/development/src/dispatch/EventsRepository.cjs.map +1 -0
  35. package/dist/development/src/dispatch/EventsRepository.js +104 -0
  36. package/dist/development/src/dispatch/EventsRepository.js.map +1 -0
  37. package/dist/development/src/dispatch/ProjectDispatcher.cjs +99 -0
  38. package/dist/development/src/dispatch/ProjectDispatcher.cjs.map +1 -0
  39. package/dist/development/src/dispatch/ProjectDispatcher.js +99 -0
  40. package/dist/development/src/dispatch/ProjectDispatcher.js.map +1 -0
  41. package/dist/development/src/dispatch/TargetHandlerResolver.cjs +16 -0
  42. package/dist/development/src/dispatch/TargetHandlerResolver.cjs.map +1 -0
  43. package/dist/development/src/dispatch/TargetHandlerResolver.js +16 -0
  44. package/dist/development/src/dispatch/TargetHandlerResolver.js.map +1 -0
  45. package/dist/development/src/dispatch/WebhookFetcher.cjs +16 -0
  46. package/dist/development/src/dispatch/WebhookFetcher.cjs.map +1 -0
  47. package/dist/development/src/dispatch/WebhookFetcher.js +16 -0
  48. package/dist/development/src/dispatch/WebhookFetcher.js.map +1 -0
  49. package/dist/development/src/dispatch/WebhookTargetHandler.cjs +193 -0
  50. package/dist/development/src/dispatch/WebhookTargetHandler.cjs.map +1 -0
  51. package/dist/development/src/dispatch/WebhookTargetHandler.js +176 -0
  52. package/dist/development/src/dispatch/WebhookTargetHandler.js.map +1 -0
  53. package/dist/development/src/graphql/http/ActionsApiMiddlewareFactory.cjs +38 -0
  54. package/dist/development/src/graphql/http/ActionsApiMiddlewareFactory.cjs.map +1 -0
  55. package/dist/development/src/graphql/http/ActionsApiMiddlewareFactory.js +38 -0
  56. package/dist/development/src/graphql/http/ActionsApiMiddlewareFactory.js.map +1 -0
  57. package/dist/development/src/graphql/http/ActionsContextResolver.cjs +39 -0
  58. package/dist/development/src/graphql/http/ActionsContextResolver.cjs.map +1 -0
  59. package/dist/development/src/graphql/http/ActionsContextResolver.js +39 -0
  60. package/dist/development/src/graphql/http/ActionsContextResolver.js.map +1 -0
  61. package/dist/development/src/graphql/http/ActionsGraphQLHandlerFactory.cjs +20 -0
  62. package/dist/development/src/graphql/http/ActionsGraphQLHandlerFactory.cjs.map +1 -0
  63. package/dist/development/src/graphql/http/ActionsGraphQLHandlerFactory.js +20 -0
  64. package/dist/development/src/graphql/http/ActionsGraphQLHandlerFactory.js.map +1 -0
  65. package/dist/development/src/graphql/http/ActionsWebsocketControllerFactory.cjs +149 -0
  66. package/dist/development/src/graphql/http/ActionsWebsocketControllerFactory.cjs.map +1 -0
  67. package/dist/development/src/graphql/http/ActionsWebsocketControllerFactory.js +132 -0
  68. package/dist/development/src/graphql/http/ActionsWebsocketControllerFactory.js.map +1 -0
  69. package/dist/development/src/graphql/resolvers/ResolversFactory.cjs +31 -0
  70. package/dist/development/src/graphql/resolvers/ResolversFactory.cjs.map +1 -0
  71. package/dist/development/src/graphql/resolvers/ResolversFactory.js +31 -0
  72. package/dist/development/src/graphql/resolvers/ResolversFactory.js.map +1 -0
  73. package/dist/development/src/graphql/resolvers/mutation/ProcessBatchMutationResolver.cjs +19 -0
  74. package/dist/development/src/graphql/resolvers/mutation/ProcessBatchMutationResolver.cjs.map +1 -0
  75. package/dist/development/src/graphql/resolvers/mutation/ProcessBatchMutationResolver.js +19 -0
  76. package/dist/development/src/graphql/resolvers/mutation/ProcessBatchMutationResolver.js.map +1 -0
  77. package/dist/development/src/graphql/resolvers/mutation/SetVariablesMutationResolver.cjs +19 -0
  78. package/dist/development/src/graphql/resolvers/mutation/SetVariablesMutationResolver.cjs.map +1 -0
  79. package/dist/development/src/graphql/resolvers/mutation/SetVariablesMutationResolver.js +19 -0
  80. package/dist/development/src/graphql/resolvers/mutation/SetVariablesMutationResolver.js.map +1 -0
  81. package/dist/development/src/graphql/resolvers/query/EventsQueryResolver.cjs +48 -0
  82. package/dist/development/src/graphql/resolvers/query/EventsQueryResolver.cjs.map +1 -0
  83. package/dist/development/src/graphql/resolvers/query/EventsQueryResolver.js +48 -0
  84. package/dist/development/src/graphql/resolvers/query/EventsQueryResolver.js.map +1 -0
  85. package/dist/development/src/graphql/resolvers/query/VariablesQueryResolver.cjs +19 -0
  86. package/dist/development/src/graphql/resolvers/query/VariablesQueryResolver.cjs.map +1 -0
  87. package/dist/development/src/graphql/resolvers/query/VariablesQueryResolver.js +19 -0
  88. package/dist/development/src/graphql/resolvers/query/VariablesQueryResolver.js.map +1 -0
  89. package/dist/{src/graphql/schema/actions.graphql.js → development/src/graphql/schema/actions.graphql.cjs} +5 -5
  90. package/dist/development/src/graphql/schema/actions.graphql.cjs.map +1 -0
  91. package/dist/development/src/graphql/schema/actions.graphql.js +93 -0
  92. package/dist/development/src/graphql/schema/actions.graphql.js.map +1 -0
  93. package/dist/{src/migrations/2023-03-10-145000-actions-variables.js → development/src/migrations/2023-03-10-145000-actions-variables.cjs} +4 -5
  94. package/dist/development/src/migrations/2023-03-10-145000-actions-variables.cjs.map +1 -0
  95. package/dist/development/src/migrations/2023-03-10-145000-actions-variables.js +17 -0
  96. package/dist/development/src/migrations/2023-03-10-145000-actions-variables.js.map +1 -0
  97. package/dist/development/src/migrations/index.cjs +10 -0
  98. package/dist/development/src/migrations/index.cjs.map +1 -0
  99. package/dist/development/src/migrations/index.js +10 -0
  100. package/dist/development/src/migrations/index.js.map +1 -0
  101. package/dist/{src/migrations/snapshot.js → development/src/migrations/snapshot.cjs} +4 -5
  102. package/dist/development/src/migrations/snapshot.cjs.map +1 -0
  103. package/dist/development/src/migrations/snapshot.js +49 -0
  104. package/dist/development/src/migrations/snapshot.js.map +1 -0
  105. package/dist/development/src/model/EventsInProcessingQuery.cjs +14 -0
  106. package/dist/development/src/model/EventsInProcessingQuery.cjs.map +1 -0
  107. package/dist/development/src/model/EventsInProcessingQuery.js +14 -0
  108. package/dist/development/src/model/EventsInProcessingQuery.js.map +1 -0
  109. package/dist/development/src/model/EventsToProcessQuery.cjs +15 -0
  110. package/dist/development/src/model/EventsToProcessQuery.cjs.map +1 -0
  111. package/dist/development/src/model/EventsToProcessQuery.js +15 -0
  112. package/dist/development/src/model/EventsToProcessQuery.js.map +1 -0
  113. package/dist/development/src/model/EventsToProcessSpecification.cjs +8 -0
  114. package/dist/development/src/model/EventsToProcessSpecification.cjs.map +1 -0
  115. package/dist/development/src/model/EventsToProcessSpecification.js +8 -0
  116. package/dist/development/src/model/EventsToProcessSpecification.js.map +1 -0
  117. package/dist/development/src/model/FailedEventsQuery.cjs +14 -0
  118. package/dist/development/src/model/FailedEventsQuery.cjs.map +1 -0
  119. package/dist/development/src/model/FailedEventsQuery.js +14 -0
  120. package/dist/development/src/model/FailedEventsQuery.js.map +1 -0
  121. package/dist/development/src/model/SetVariableCommand.cjs +21 -0
  122. package/dist/development/src/model/SetVariableCommand.cjs.map +1 -0
  123. package/dist/development/src/model/SetVariableCommand.js +21 -0
  124. package/dist/development/src/model/SetVariableCommand.js.map +1 -0
  125. package/dist/development/src/model/VariablesManager.cjs +41 -0
  126. package/dist/development/src/model/VariablesManager.cjs.map +1 -0
  127. package/dist/development/src/model/VariablesManager.js +41 -0
  128. package/dist/development/src/model/VariablesManager.js.map +1 -0
  129. package/dist/development/src/model/VariablesQuery.cjs +10 -0
  130. package/dist/development/src/model/VariablesQuery.cjs.map +1 -0
  131. package/dist/development/src/model/VariablesQuery.js +10 -0
  132. package/dist/development/src/model/VariablesQuery.js.map +1 -0
  133. package/dist/development/src/triggers/TriggerHandler.cjs +126 -0
  134. package/dist/development/src/triggers/TriggerHandler.cjs.map +1 -0
  135. package/dist/development/src/triggers/TriggerHandler.js +126 -0
  136. package/dist/development/src/triggers/TriggerHandler.js.map +1 -0
  137. package/dist/development/src/triggers/TriggerIndirectChangesFetcher.cjs +21 -0
  138. package/dist/development/src/triggers/TriggerIndirectChangesFetcher.cjs.map +1 -0
  139. package/dist/development/src/triggers/TriggerIndirectChangesFetcher.js +21 -0
  140. package/dist/development/src/triggers/TriggerIndirectChangesFetcher.js.map +1 -0
  141. package/dist/development/src/triggers/TriggerListenersBuilder.cjs +169 -0
  142. package/dist/development/src/triggers/TriggerListenersBuilder.cjs.map +1 -0
  143. package/dist/development/src/triggers/TriggerListenersBuilder.js +169 -0
  144. package/dist/development/src/triggers/TriggerListenersBuilder.js.map +1 -0
  145. package/dist/development/src/triggers/TriggerListenersFactory.cjs +17 -0
  146. package/dist/development/src/triggers/TriggerListenersFactory.cjs.map +1 -0
  147. package/dist/development/src/triggers/TriggerListenersFactory.js +17 -0
  148. package/dist/development/src/triggers/TriggerListenersFactory.js.map +1 -0
  149. package/dist/development/src/triggers/TriggerListenersStore.cjs +24 -0
  150. package/dist/development/src/triggers/TriggerListenersStore.cjs.map +1 -0
  151. package/dist/development/src/triggers/TriggerListenersStore.js +24 -0
  152. package/dist/development/src/triggers/TriggerListenersStore.js.map +1 -0
  153. package/dist/development/src/triggers/TriggerPayloadBuilder.cjs +134 -0
  154. package/dist/development/src/triggers/TriggerPayloadBuilder.cjs.map +1 -0
  155. package/dist/development/src/triggers/TriggerPayloadBuilder.js +134 -0
  156. package/dist/development/src/triggers/TriggerPayloadBuilder.js.map +1 -0
  157. package/dist/development/src/triggers/TriggerPayloadManager.cjs +27 -0
  158. package/dist/development/src/triggers/TriggerPayloadManager.cjs.map +1 -0
  159. package/dist/development/src/triggers/TriggerPayloadManager.js +27 -0
  160. package/dist/development/src/triggers/TriggerPayloadManager.js.map +1 -0
  161. package/dist/development/src/triggers/TriggerPayloadPersister.cjs +40 -0
  162. package/dist/development/src/triggers/TriggerPayloadPersister.cjs.map +1 -0
  163. package/dist/development/src/triggers/TriggerPayloadPersister.js +40 -0
  164. package/dist/development/src/triggers/TriggerPayloadPersister.js.map +1 -0
  165. package/dist/development/src/utils/assertNever.cjs +7 -0
  166. package/dist/development/src/utils/assertNever.cjs.map +1 -0
  167. package/dist/development/src/utils/assertNever.js +7 -0
  168. package/dist/development/src/utils/assertNever.js.map +1 -0
  169. package/dist/development/src/utils/map.cjs +13 -0
  170. package/dist/development/src/utils/map.cjs.map +1 -0
  171. package/dist/development/src/utils/map.js +13 -0
  172. package/dist/development/src/utils/map.js.map +1 -0
  173. package/dist/production/index.cjs +94 -0
  174. package/dist/production/index.cjs.map +1 -0
  175. package/dist/production/index.js +94 -0
  176. package/dist/production/index.js.map +1 -0
  177. package/dist/production/src/ActionsExecutionContainerHookFactory.cjs +30 -0
  178. package/dist/production/src/ActionsExecutionContainerHookFactory.cjs.map +1 -0
  179. package/dist/production/src/ActionsExecutionContainerHookFactory.js +30 -0
  180. package/dist/production/src/ActionsExecutionContainerHookFactory.js.map +1 -0
  181. package/dist/production/src/ImplementationException.cjs +6 -0
  182. package/dist/production/src/ImplementationException.cjs.map +1 -0
  183. package/dist/production/src/ImplementationException.js +6 -0
  184. package/dist/production/src/ImplementationException.js.map +1 -0
  185. package/dist/production/src/ListenerStoreProvider.cjs +25 -0
  186. package/dist/production/src/ListenerStoreProvider.cjs.map +1 -0
  187. package/dist/production/src/ListenerStoreProvider.js +25 -0
  188. package/dist/production/src/ListenerStoreProvider.js.map +1 -0
  189. package/dist/production/src/authorization/ActionsAuthorizationActions.cjs +15 -0
  190. package/dist/production/src/authorization/ActionsAuthorizationActions.cjs.map +1 -0
  191. package/dist/production/src/authorization/ActionsAuthorizationActions.js +16 -0
  192. package/dist/production/src/authorization/ActionsAuthorizationActions.js.map +1 -0
  193. package/dist/production/src/authorization/ActionsPermissionsFactory.cjs +16 -0
  194. package/dist/production/src/authorization/ActionsPermissionsFactory.cjs.map +1 -0
  195. package/dist/production/src/authorization/ActionsPermissionsFactory.js +16 -0
  196. package/dist/production/src/authorization/ActionsPermissionsFactory.js.map +1 -0
  197. package/dist/production/src/dispatch/DispatchWorkerSupervisor.cjs +125 -0
  198. package/dist/production/src/dispatch/DispatchWorkerSupervisor.cjs.map +1 -0
  199. package/dist/production/src/dispatch/DispatchWorkerSupervisor.js +125 -0
  200. package/dist/production/src/dispatch/DispatchWorkerSupervisor.js.map +1 -0
  201. package/dist/production/src/dispatch/EventDispatcher.cjs +43 -0
  202. package/dist/production/src/dispatch/EventDispatcher.cjs.map +1 -0
  203. package/dist/production/src/dispatch/EventDispatcher.js +43 -0
  204. package/dist/production/src/dispatch/EventDispatcher.js.map +1 -0
  205. package/dist/production/src/dispatch/EventsRepository.cjs +104 -0
  206. package/dist/production/src/dispatch/EventsRepository.cjs.map +1 -0
  207. package/dist/production/src/dispatch/EventsRepository.js +104 -0
  208. package/dist/production/src/dispatch/EventsRepository.js.map +1 -0
  209. package/dist/production/src/dispatch/ProjectDispatcher.cjs +99 -0
  210. package/dist/production/src/dispatch/ProjectDispatcher.cjs.map +1 -0
  211. package/dist/production/src/dispatch/ProjectDispatcher.js +99 -0
  212. package/dist/production/src/dispatch/ProjectDispatcher.js.map +1 -0
  213. package/dist/production/src/dispatch/TargetHandlerResolver.cjs +16 -0
  214. package/dist/production/src/dispatch/TargetHandlerResolver.cjs.map +1 -0
  215. package/dist/production/src/dispatch/TargetHandlerResolver.js +16 -0
  216. package/dist/production/src/dispatch/TargetHandlerResolver.js.map +1 -0
  217. package/dist/production/src/dispatch/WebhookFetcher.cjs +16 -0
  218. package/dist/production/src/dispatch/WebhookFetcher.cjs.map +1 -0
  219. package/dist/production/src/dispatch/WebhookFetcher.js +16 -0
  220. package/dist/production/src/dispatch/WebhookFetcher.js.map +1 -0
  221. package/dist/production/src/dispatch/WebhookTargetHandler.cjs +193 -0
  222. package/dist/production/src/dispatch/WebhookTargetHandler.cjs.map +1 -0
  223. package/dist/production/src/dispatch/WebhookTargetHandler.js +176 -0
  224. package/dist/production/src/dispatch/WebhookTargetHandler.js.map +1 -0
  225. package/dist/production/src/graphql/http/ActionsApiMiddlewareFactory.cjs +38 -0
  226. package/dist/production/src/graphql/http/ActionsApiMiddlewareFactory.cjs.map +1 -0
  227. package/dist/production/src/graphql/http/ActionsApiMiddlewareFactory.js +38 -0
  228. package/dist/production/src/graphql/http/ActionsApiMiddlewareFactory.js.map +1 -0
  229. package/dist/production/src/graphql/http/ActionsContextResolver.cjs +39 -0
  230. package/dist/production/src/graphql/http/ActionsContextResolver.cjs.map +1 -0
  231. package/dist/production/src/graphql/http/ActionsContextResolver.js +39 -0
  232. package/dist/production/src/graphql/http/ActionsContextResolver.js.map +1 -0
  233. package/dist/production/src/graphql/http/ActionsGraphQLHandlerFactory.cjs +20 -0
  234. package/dist/production/src/graphql/http/ActionsGraphQLHandlerFactory.cjs.map +1 -0
  235. package/dist/production/src/graphql/http/ActionsGraphQLHandlerFactory.js +20 -0
  236. package/dist/production/src/graphql/http/ActionsGraphQLHandlerFactory.js.map +1 -0
  237. package/dist/production/src/graphql/http/ActionsWebsocketControllerFactory.cjs +149 -0
  238. package/dist/production/src/graphql/http/ActionsWebsocketControllerFactory.cjs.map +1 -0
  239. package/dist/production/src/graphql/http/ActionsWebsocketControllerFactory.js +132 -0
  240. package/dist/production/src/graphql/http/ActionsWebsocketControllerFactory.js.map +1 -0
  241. package/dist/production/src/graphql/resolvers/ResolversFactory.cjs +31 -0
  242. package/dist/production/src/graphql/resolvers/ResolversFactory.cjs.map +1 -0
  243. package/dist/production/src/graphql/resolvers/ResolversFactory.js +31 -0
  244. package/dist/production/src/graphql/resolvers/ResolversFactory.js.map +1 -0
  245. package/dist/production/src/graphql/resolvers/mutation/ProcessBatchMutationResolver.cjs +19 -0
  246. package/dist/production/src/graphql/resolvers/mutation/ProcessBatchMutationResolver.cjs.map +1 -0
  247. package/dist/production/src/graphql/resolvers/mutation/ProcessBatchMutationResolver.js +19 -0
  248. package/dist/production/src/graphql/resolvers/mutation/ProcessBatchMutationResolver.js.map +1 -0
  249. package/dist/production/src/graphql/resolvers/mutation/SetVariablesMutationResolver.cjs +19 -0
  250. package/dist/production/src/graphql/resolvers/mutation/SetVariablesMutationResolver.cjs.map +1 -0
  251. package/dist/production/src/graphql/resolvers/mutation/SetVariablesMutationResolver.js +19 -0
  252. package/dist/production/src/graphql/resolvers/mutation/SetVariablesMutationResolver.js.map +1 -0
  253. package/dist/production/src/graphql/resolvers/query/EventsQueryResolver.cjs +48 -0
  254. package/dist/production/src/graphql/resolvers/query/EventsQueryResolver.cjs.map +1 -0
  255. package/dist/production/src/graphql/resolvers/query/EventsQueryResolver.js +48 -0
  256. package/dist/production/src/graphql/resolvers/query/EventsQueryResolver.js.map +1 -0
  257. package/dist/production/src/graphql/resolvers/query/VariablesQueryResolver.cjs +19 -0
  258. package/dist/production/src/graphql/resolvers/query/VariablesQueryResolver.cjs.map +1 -0
  259. package/dist/production/src/graphql/resolvers/query/VariablesQueryResolver.js +19 -0
  260. package/dist/production/src/graphql/resolvers/query/VariablesQueryResolver.js.map +1 -0
  261. package/dist/production/src/graphql/schema/actions.graphql.cjs +93 -0
  262. package/dist/production/src/graphql/schema/actions.graphql.cjs.map +1 -0
  263. package/dist/production/src/graphql/schema/actions.graphql.js +93 -0
  264. package/dist/production/src/graphql/schema/actions.graphql.js.map +1 -0
  265. package/dist/production/src/migrations/2023-03-10-145000-actions-variables.cjs +16 -0
  266. package/dist/production/src/migrations/2023-03-10-145000-actions-variables.cjs.map +1 -0
  267. package/dist/production/src/migrations/2023-03-10-145000-actions-variables.js +17 -0
  268. package/dist/production/src/migrations/2023-03-10-145000-actions-variables.js.map +1 -0
  269. package/dist/production/src/migrations/index.cjs +10 -0
  270. package/dist/production/src/migrations/index.cjs.map +1 -0
  271. package/dist/production/src/migrations/index.js +10 -0
  272. package/dist/production/src/migrations/index.js.map +1 -0
  273. package/dist/production/src/migrations/snapshot.cjs +48 -0
  274. package/dist/production/src/migrations/snapshot.cjs.map +1 -0
  275. package/dist/production/src/migrations/snapshot.js +49 -0
  276. package/dist/production/src/migrations/snapshot.js.map +1 -0
  277. package/dist/production/src/model/EventsInProcessingQuery.cjs +14 -0
  278. package/dist/production/src/model/EventsInProcessingQuery.cjs.map +1 -0
  279. package/dist/production/src/model/EventsInProcessingQuery.js +14 -0
  280. package/dist/production/src/model/EventsInProcessingQuery.js.map +1 -0
  281. package/dist/production/src/model/EventsToProcessQuery.cjs +15 -0
  282. package/dist/production/src/model/EventsToProcessQuery.cjs.map +1 -0
  283. package/dist/production/src/model/EventsToProcessQuery.js +15 -0
  284. package/dist/production/src/model/EventsToProcessQuery.js.map +1 -0
  285. package/dist/production/src/model/EventsToProcessSpecification.cjs +8 -0
  286. package/dist/production/src/model/EventsToProcessSpecification.cjs.map +1 -0
  287. package/dist/production/src/model/EventsToProcessSpecification.js +8 -0
  288. package/dist/production/src/model/EventsToProcessSpecification.js.map +1 -0
  289. package/dist/production/src/model/FailedEventsQuery.cjs +14 -0
  290. package/dist/production/src/model/FailedEventsQuery.cjs.map +1 -0
  291. package/dist/production/src/model/FailedEventsQuery.js +14 -0
  292. package/dist/production/src/model/FailedEventsQuery.js.map +1 -0
  293. package/dist/production/src/model/SetVariableCommand.cjs +21 -0
  294. package/dist/production/src/model/SetVariableCommand.cjs.map +1 -0
  295. package/dist/production/src/model/SetVariableCommand.js +21 -0
  296. package/dist/production/src/model/SetVariableCommand.js.map +1 -0
  297. package/dist/production/src/model/VariablesManager.cjs +41 -0
  298. package/dist/production/src/model/VariablesManager.cjs.map +1 -0
  299. package/dist/production/src/model/VariablesManager.js +41 -0
  300. package/dist/production/src/model/VariablesManager.js.map +1 -0
  301. package/dist/production/src/model/VariablesQuery.cjs +10 -0
  302. package/dist/production/src/model/VariablesQuery.cjs.map +1 -0
  303. package/dist/production/src/model/VariablesQuery.js +10 -0
  304. package/dist/production/src/model/VariablesQuery.js.map +1 -0
  305. package/dist/production/src/triggers/TriggerHandler.cjs +126 -0
  306. package/dist/production/src/triggers/TriggerHandler.cjs.map +1 -0
  307. package/dist/production/src/triggers/TriggerHandler.js +126 -0
  308. package/dist/production/src/triggers/TriggerHandler.js.map +1 -0
  309. package/dist/production/src/triggers/TriggerIndirectChangesFetcher.cjs +21 -0
  310. package/dist/production/src/triggers/TriggerIndirectChangesFetcher.cjs.map +1 -0
  311. package/dist/production/src/triggers/TriggerIndirectChangesFetcher.js +21 -0
  312. package/dist/production/src/triggers/TriggerIndirectChangesFetcher.js.map +1 -0
  313. package/dist/production/src/triggers/TriggerListenersBuilder.cjs +169 -0
  314. package/dist/production/src/triggers/TriggerListenersBuilder.cjs.map +1 -0
  315. package/dist/production/src/triggers/TriggerListenersBuilder.js +169 -0
  316. package/dist/production/src/triggers/TriggerListenersBuilder.js.map +1 -0
  317. package/dist/production/src/triggers/TriggerListenersFactory.cjs +17 -0
  318. package/dist/production/src/triggers/TriggerListenersFactory.cjs.map +1 -0
  319. package/dist/production/src/triggers/TriggerListenersFactory.js +17 -0
  320. package/dist/production/src/triggers/TriggerListenersFactory.js.map +1 -0
  321. package/dist/production/src/triggers/TriggerListenersStore.cjs +24 -0
  322. package/dist/production/src/triggers/TriggerListenersStore.cjs.map +1 -0
  323. package/dist/production/src/triggers/TriggerListenersStore.js +24 -0
  324. package/dist/production/src/triggers/TriggerListenersStore.js.map +1 -0
  325. package/dist/production/src/triggers/TriggerPayloadBuilder.cjs +134 -0
  326. package/dist/production/src/triggers/TriggerPayloadBuilder.cjs.map +1 -0
  327. package/dist/production/src/triggers/TriggerPayloadBuilder.js +134 -0
  328. package/dist/production/src/triggers/TriggerPayloadBuilder.js.map +1 -0
  329. package/dist/production/src/triggers/TriggerPayloadManager.cjs +27 -0
  330. package/dist/production/src/triggers/TriggerPayloadManager.cjs.map +1 -0
  331. package/dist/production/src/triggers/TriggerPayloadManager.js +27 -0
  332. package/dist/production/src/triggers/TriggerPayloadManager.js.map +1 -0
  333. package/dist/production/src/triggers/TriggerPayloadPersister.cjs +40 -0
  334. package/dist/production/src/triggers/TriggerPayloadPersister.cjs.map +1 -0
  335. package/dist/production/src/triggers/TriggerPayloadPersister.js +40 -0
  336. package/dist/production/src/triggers/TriggerPayloadPersister.js.map +1 -0
  337. package/dist/production/src/utils/assertNever.cjs +7 -0
  338. package/dist/production/src/utils/assertNever.cjs.map +1 -0
  339. package/dist/production/src/utils/assertNever.js +7 -0
  340. package/dist/production/src/utils/assertNever.js.map +1 -0
  341. package/dist/production/src/utils/map.cjs +13 -0
  342. package/dist/production/src/utils/map.cjs.map +1 -0
  343. package/dist/production/src/utils/map.js +13 -0
  344. package/dist/production/src/utils/map.js.map +1 -0
  345. package/dist/tests/src/uuid.d.ts +3 -0
  346. package/dist/tests/src/uuid.d.ts.map +1 -0
  347. package/dist/tests/tsconfig.tsbuildinfo +1 -1
  348. package/dist/types/authorization/ActionsAuthorizationActions.d.ts +28 -0
  349. package/dist/types/authorization/ActionsAuthorizationActions.d.ts.map +1 -0
  350. package/dist/{src → types}/dispatch/types.d.ts +1 -1
  351. package/dist/types/dispatch/types.d.ts.map +1 -0
  352. package/dist/types/tsconfig.tsbuildinfo +1 -0
  353. package/dist/{src → types}/utils/map.d.ts.map +1 -1
  354. package/package.json +37 -24
  355. package/src/dispatch/types.ts +1 -1
  356. package/src/tsconfig.json +1 -1
  357. package/tests/cases/unit/webhookHandler.test.ts +1 -1
  358. package/tests/src/uuid.ts +4 -0
  359. package/tests/tsconfig.json +0 -3
  360. package/vitest.config.ts +3 -0
  361. package/dist/src/ActionsExecutionContainerHookFactory.js +0 -28
  362. package/dist/src/ActionsExecutionContainerHookFactory.js.map +0 -1
  363. package/dist/src/ImplementationException.js +0 -7
  364. package/dist/src/ImplementationException.js.map +0 -1
  365. package/dist/src/ListenerStoreProvider.js +0 -21
  366. package/dist/src/ListenerStoreProvider.js.map +0 -1
  367. package/dist/src/authorization/ActionsAuthorizationActions.d.ts +0 -27
  368. package/dist/src/authorization/ActionsAuthorizationActions.d.ts.map +0 -1
  369. package/dist/src/authorization/ActionsAuthorizationActions.js +0 -17
  370. package/dist/src/authorization/ActionsAuthorizationActions.js.map +0 -1
  371. package/dist/src/authorization/ActionsPermissionsFactory.js +0 -17
  372. package/dist/src/authorization/ActionsPermissionsFactory.js.map +0 -1
  373. package/dist/src/authorization/Identity.js +0 -3
  374. package/dist/src/authorization/Identity.js.map +0 -1
  375. package/dist/src/authorization/index.js +0 -20
  376. package/dist/src/authorization/index.js.map +0 -1
  377. package/dist/src/dispatch/DispatchWorkerSupervisor.js +0 -123
  378. package/dist/src/dispatch/DispatchWorkerSupervisor.js.map +0 -1
  379. package/dist/src/dispatch/EventDispatcher.js +0 -46
  380. package/dist/src/dispatch/EventDispatcher.js.map +0 -1
  381. package/dist/src/dispatch/EventsRepository.js +0 -138
  382. package/dist/src/dispatch/EventsRepository.js.map +0 -1
  383. package/dist/src/dispatch/ProjectDispatcher.js +0 -103
  384. package/dist/src/dispatch/ProjectDispatcher.js.map +0 -1
  385. package/dist/src/dispatch/TargetHandlerResolver.js +0 -17
  386. package/dist/src/dispatch/TargetHandlerResolver.js.map +0 -1
  387. package/dist/src/dispatch/WebhookFetcher.js +0 -17
  388. package/dist/src/dispatch/WebhookFetcher.js.map +0 -1
  389. package/dist/src/dispatch/WebhookTargetHandler.js +0 -203
  390. package/dist/src/dispatch/WebhookTargetHandler.js.map +0 -1
  391. package/dist/src/dispatch/types.d.ts.map +0 -1
  392. package/dist/src/dispatch/types.js +0 -3
  393. package/dist/src/dispatch/types.js.map +0 -1
  394. package/dist/src/graphql/http/ActionsApiMiddlewareFactory.js +0 -39
  395. package/dist/src/graphql/http/ActionsApiMiddlewareFactory.js.map +0 -1
  396. package/dist/src/graphql/http/ActionsContextResolver.js +0 -35
  397. package/dist/src/graphql/http/ActionsContextResolver.js.map +0 -1
  398. package/dist/src/graphql/http/ActionsGraphQLHandlerFactory.js +0 -21
  399. package/dist/src/graphql/http/ActionsGraphQLHandlerFactory.js.map +0 -1
  400. package/dist/src/graphql/http/ActionsWebsocketControllerFactory.js +0 -154
  401. package/dist/src/graphql/http/ActionsWebsocketControllerFactory.js.map +0 -1
  402. package/dist/src/graphql/resolvers/ActionsContext.js +0 -3
  403. package/dist/src/graphql/resolvers/ActionsContext.js.map +0 -1
  404. package/dist/src/graphql/resolvers/ResolversFactory.js +0 -32
  405. package/dist/src/graphql/resolvers/ResolversFactory.js.map +0 -1
  406. package/dist/src/graphql/resolvers/index.js +0 -19
  407. package/dist/src/graphql/resolvers/index.js.map +0 -1
  408. package/dist/src/graphql/resolvers/mutation/ProcessBatchMutationResolver.js +0 -18
  409. package/dist/src/graphql/resolvers/mutation/ProcessBatchMutationResolver.js.map +0 -1
  410. package/dist/src/graphql/resolvers/mutation/SetVariablesMutationResolver.js +0 -18
  411. package/dist/src/graphql/resolvers/mutation/SetVariablesMutationResolver.js.map +0 -1
  412. package/dist/src/graphql/resolvers/mutation/index.js +0 -19
  413. package/dist/src/graphql/resolvers/mutation/index.js.map +0 -1
  414. package/dist/src/graphql/resolvers/query/EventsQueryResolver.js +0 -47
  415. package/dist/src/graphql/resolvers/query/EventsQueryResolver.js.map +0 -1
  416. package/dist/src/graphql/resolvers/query/VariablesQueryResolver.js +0 -18
  417. package/dist/src/graphql/resolvers/query/VariablesQueryResolver.js.map +0 -1
  418. package/dist/src/graphql/resolvers/query/index.js +0 -18
  419. package/dist/src/graphql/resolvers/query/index.js.map +0 -1
  420. package/dist/src/graphql/schema/actions.graphql.js.map +0 -1
  421. package/dist/src/graphql/schema/index.js +0 -3
  422. package/dist/src/graphql/schema/index.js.map +0 -1
  423. package/dist/src/index.js +0 -87
  424. package/dist/src/index.js.map +0 -1
  425. package/dist/src/migrations/2023-03-10-145000-actions-variables.js.map +0 -1
  426. package/dist/src/migrations/index.js +0 -13
  427. package/dist/src/migrations/index.js.map +0 -1
  428. package/dist/src/migrations/snapshot.js.map +0 -1
  429. package/dist/src/model/EventsInProcessingQuery.js +0 -22
  430. package/dist/src/model/EventsInProcessingQuery.js.map +0 -1
  431. package/dist/src/model/EventsToProcessQuery.js +0 -22
  432. package/dist/src/model/EventsToProcessQuery.js.map +0 -1
  433. package/dist/src/model/EventsToProcessSpecification.js +0 -14
  434. package/dist/src/model/EventsToProcessSpecification.js.map +0 -1
  435. package/dist/src/model/FailedEventsQuery.js +0 -22
  436. package/dist/src/model/FailedEventsQuery.js.map +0 -1
  437. package/dist/src/model/SetVariableCommand.js +0 -26
  438. package/dist/src/model/SetVariableCommand.js.map +0 -1
  439. package/dist/src/model/VariablesManager.js +0 -46
  440. package/dist/src/model/VariablesManager.js.map +0 -1
  441. package/dist/src/model/VariablesQuery.js +0 -13
  442. package/dist/src/model/VariablesQuery.js.map +0 -1
  443. package/dist/src/model/types.js +0 -3
  444. package/dist/src/model/types.js.map +0 -1
  445. package/dist/src/triggers/TriggerHandler.js +0 -130
  446. package/dist/src/triggers/TriggerHandler.js.map +0 -1
  447. package/dist/src/triggers/TriggerIndirectChangesFetcher.js +0 -24
  448. package/dist/src/triggers/TriggerIndirectChangesFetcher.js.map +0 -1
  449. package/dist/src/triggers/TriggerListeners.js +0 -3
  450. package/dist/src/triggers/TriggerListeners.js.map +0 -1
  451. package/dist/src/triggers/TriggerListenersBuilder.js +0 -169
  452. package/dist/src/triggers/TriggerListenersBuilder.js.map +0 -1
  453. package/dist/src/triggers/TriggerListenersFactory.js +0 -18
  454. package/dist/src/triggers/TriggerListenersFactory.js.map +0 -1
  455. package/dist/src/triggers/TriggerListenersStore.js +0 -30
  456. package/dist/src/triggers/TriggerListenersStore.js.map +0 -1
  457. package/dist/src/triggers/TriggerPayloadBuilder.js +0 -140
  458. package/dist/src/triggers/TriggerPayloadBuilder.js.map +0 -1
  459. package/dist/src/triggers/TriggerPayloadManager.js +0 -26
  460. package/dist/src/triggers/TriggerPayloadManager.js.map +0 -1
  461. package/dist/src/triggers/TriggerPayloadPersister.js +0 -46
  462. package/dist/src/triggers/TriggerPayloadPersister.js.map +0 -1
  463. package/dist/src/triggers/index.js +0 -24
  464. package/dist/src/triggers/index.js.map +0 -1
  465. package/dist/src/tsconfig.tsbuildinfo +0 -1
  466. package/dist/src/utils/assertNever.js +0 -8
  467. package/dist/src/utils/assertNever.js.map +0 -1
  468. package/dist/src/utils/map.js +0 -14
  469. package/dist/src/utils/map.js.map +0 -1
  470. package/dist/tests/cases/integration/triggers.manyHasManyWatch.test.d.ts +0 -2
  471. package/dist/tests/cases/integration/triggers.manyHasManyWatch.test.d.ts.map +0 -1
  472. package/dist/tests/cases/integration/triggers.manyHasManyWatch.test.js +0 -442
  473. package/dist/tests/cases/integration/triggers.manyHasManyWatch.test.js.map +0 -1
  474. package/dist/tests/cases/integration/triggers.manyHasOneWatch.test.d.ts +0 -2
  475. package/dist/tests/cases/integration/triggers.manyHasOneWatch.test.d.ts.map +0 -1
  476. package/dist/tests/cases/integration/triggers.manyHasOneWatch.test.js +0 -449
  477. package/dist/tests/cases/integration/triggers.manyHasOneWatch.test.js.map +0 -1
  478. package/dist/tests/cases/integration/triggers.rootWatch.test.d.ts +0 -2
  479. package/dist/tests/cases/integration/triggers.rootWatch.test.d.ts.map +0 -1
  480. package/dist/tests/cases/integration/triggers.rootWatch.test.js +0 -222
  481. package/dist/tests/cases/integration/triggers.rootWatch.test.js.map +0 -1
  482. package/dist/tests/cases/integration/utils.d.ts +0 -4
  483. package/dist/tests/cases/integration/utils.d.ts.map +0 -1
  484. package/dist/tests/cases/integration/utils.js +0 -12
  485. package/dist/tests/cases/integration/utils.js.map +0 -1
  486. package/dist/tests/cases/unit/generator.test.js +0 -627
  487. package/dist/tests/cases/unit/generator.test.js.map +0 -1
  488. package/dist/tests/cases/unit/webhookHandler.test.js +0 -394
  489. package/dist/tests/cases/unit/webhookHandler.test.js.map +0 -1
  490. package/dist/tests/src/gql.js +0 -14
  491. package/dist/tests/src/gql.js.map +0 -1
  492. package/tests/cases/integration/triggers.manyHasManyWatch.test.ts +0 -437
  493. package/tests/cases/integration/triggers.manyHasOneWatch.test.ts +0 -446
  494. package/tests/cases/integration/triggers.rootWatch.test.ts +0 -216
  495. package/tests/cases/integration/utils.ts +0 -9
  496. package/vite.config.js +0 -3
  497. /package/dist/{src → types}/ActionsExecutionContainerHookFactory.d.ts +0 -0
  498. /package/dist/{src → types}/ActionsExecutionContainerHookFactory.d.ts.map +0 -0
  499. /package/dist/{src → types}/ImplementationException.d.ts +0 -0
  500. /package/dist/{src → types}/ImplementationException.d.ts.map +0 -0
  501. /package/dist/{src → types}/ListenerStoreProvider.d.ts +0 -0
  502. /package/dist/{src → types}/ListenerStoreProvider.d.ts.map +0 -0
  503. /package/dist/{src → types}/authorization/ActionsPermissionsFactory.d.ts +0 -0
  504. /package/dist/{src → types}/authorization/ActionsPermissionsFactory.d.ts.map +0 -0
  505. /package/dist/{src → types}/authorization/Identity.d.ts +0 -0
  506. /package/dist/{src → types}/authorization/Identity.d.ts.map +0 -0
  507. /package/dist/{src → types}/authorization/index.d.ts +0 -0
  508. /package/dist/{src → types}/authorization/index.d.ts.map +0 -0
  509. /package/dist/{src → types}/dispatch/DispatchWorkerSupervisor.d.ts +0 -0
  510. /package/dist/{src → types}/dispatch/DispatchWorkerSupervisor.d.ts.map +0 -0
  511. /package/dist/{src → types}/dispatch/EventDispatcher.d.ts +0 -0
  512. /package/dist/{src → types}/dispatch/EventDispatcher.d.ts.map +0 -0
  513. /package/dist/{src → types}/dispatch/EventsRepository.d.ts +0 -0
  514. /package/dist/{src → types}/dispatch/EventsRepository.d.ts.map +0 -0
  515. /package/dist/{src → types}/dispatch/ProjectDispatcher.d.ts +0 -0
  516. /package/dist/{src → types}/dispatch/ProjectDispatcher.d.ts.map +0 -0
  517. /package/dist/{src → types}/dispatch/TargetHandlerResolver.d.ts +0 -0
  518. /package/dist/{src → types}/dispatch/TargetHandlerResolver.d.ts.map +0 -0
  519. /package/dist/{src → types}/dispatch/WebhookFetcher.d.ts +0 -0
  520. /package/dist/{src → types}/dispatch/WebhookFetcher.d.ts.map +0 -0
  521. /package/dist/{src → types}/dispatch/WebhookTargetHandler.d.ts +0 -0
  522. /package/dist/{src → types}/dispatch/WebhookTargetHandler.d.ts.map +0 -0
  523. /package/dist/{src → types}/graphql/http/ActionsApiMiddlewareFactory.d.ts +0 -0
  524. /package/dist/{src → types}/graphql/http/ActionsApiMiddlewareFactory.d.ts.map +0 -0
  525. /package/dist/{src → types}/graphql/http/ActionsContextResolver.d.ts +0 -0
  526. /package/dist/{src → types}/graphql/http/ActionsContextResolver.d.ts.map +0 -0
  527. /package/dist/{src → types}/graphql/http/ActionsGraphQLHandlerFactory.d.ts +0 -0
  528. /package/dist/{src → types}/graphql/http/ActionsGraphQLHandlerFactory.d.ts.map +0 -0
  529. /package/dist/{src → types}/graphql/http/ActionsWebsocketControllerFactory.d.ts +0 -0
  530. /package/dist/{src → types}/graphql/http/ActionsWebsocketControllerFactory.d.ts.map +0 -0
  531. /package/dist/{src → types}/graphql/resolvers/ActionsContext.d.ts +0 -0
  532. /package/dist/{src → types}/graphql/resolvers/ActionsContext.d.ts.map +0 -0
  533. /package/dist/{src → types}/graphql/resolvers/ResolversFactory.d.ts +0 -0
  534. /package/dist/{src → types}/graphql/resolvers/ResolversFactory.d.ts.map +0 -0
  535. /package/dist/{src → types}/graphql/resolvers/index.d.ts +0 -0
  536. /package/dist/{src → types}/graphql/resolvers/index.d.ts.map +0 -0
  537. /package/dist/{src → types}/graphql/resolvers/mutation/ProcessBatchMutationResolver.d.ts +0 -0
  538. /package/dist/{src → types}/graphql/resolvers/mutation/ProcessBatchMutationResolver.d.ts.map +0 -0
  539. /package/dist/{src → types}/graphql/resolvers/mutation/SetVariablesMutationResolver.d.ts +0 -0
  540. /package/dist/{src → types}/graphql/resolvers/mutation/SetVariablesMutationResolver.d.ts.map +0 -0
  541. /package/dist/{src → types}/graphql/resolvers/mutation/index.d.ts +0 -0
  542. /package/dist/{src → types}/graphql/resolvers/mutation/index.d.ts.map +0 -0
  543. /package/dist/{src → types}/graphql/resolvers/query/EventsQueryResolver.d.ts +0 -0
  544. /package/dist/{src → types}/graphql/resolvers/query/EventsQueryResolver.d.ts.map +0 -0
  545. /package/dist/{src → types}/graphql/resolvers/query/VariablesQueryResolver.d.ts +0 -0
  546. /package/dist/{src → types}/graphql/resolvers/query/VariablesQueryResolver.d.ts.map +0 -0
  547. /package/dist/{src → types}/graphql/resolvers/query/index.d.ts +0 -0
  548. /package/dist/{src → types}/graphql/resolvers/query/index.d.ts.map +0 -0
  549. /package/dist/{src → types}/graphql/schema/actions.graphql.d.ts +0 -0
  550. /package/dist/{src → types}/graphql/schema/actions.graphql.d.ts.map +0 -0
  551. /package/dist/{src → types}/graphql/schema/index.d.ts +0 -0
  552. /package/dist/{src → types}/graphql/schema/index.d.ts.map +0 -0
  553. /package/dist/{src → types}/index.d.ts +0 -0
  554. /package/dist/{src → types}/index.d.ts.map +0 -0
  555. /package/dist/{src → types}/migrations/2023-03-10-145000-actions-variables.d.ts +0 -0
  556. /package/dist/{src → types}/migrations/2023-03-10-145000-actions-variables.d.ts.map +0 -0
  557. /package/dist/{src → types}/migrations/index.d.ts +0 -0
  558. /package/dist/{src → types}/migrations/index.d.ts.map +0 -0
  559. /package/dist/{src → types}/migrations/snapshot.d.ts +0 -0
  560. /package/dist/{src → types}/migrations/snapshot.d.ts.map +0 -0
  561. /package/dist/{src → types}/model/EventsInProcessingQuery.d.ts +0 -0
  562. /package/dist/{src → types}/model/EventsInProcessingQuery.d.ts.map +0 -0
  563. /package/dist/{src → types}/model/EventsToProcessQuery.d.ts +0 -0
  564. /package/dist/{src → types}/model/EventsToProcessQuery.d.ts.map +0 -0
  565. /package/dist/{src → types}/model/EventsToProcessSpecification.d.ts +0 -0
  566. /package/dist/{src → types}/model/EventsToProcessSpecification.d.ts.map +0 -0
  567. /package/dist/{src → types}/model/FailedEventsQuery.d.ts +0 -0
  568. /package/dist/{src → types}/model/FailedEventsQuery.d.ts.map +0 -0
  569. /package/dist/{src → types}/model/SetVariableCommand.d.ts +0 -0
  570. /package/dist/{src → types}/model/SetVariableCommand.d.ts.map +0 -0
  571. /package/dist/{src → types}/model/VariablesManager.d.ts +0 -0
  572. /package/dist/{src → types}/model/VariablesManager.d.ts.map +0 -0
  573. /package/dist/{src → types}/model/VariablesQuery.d.ts +0 -0
  574. /package/dist/{src → types}/model/VariablesQuery.d.ts.map +0 -0
  575. /package/dist/{src → types}/model/types.d.ts +0 -0
  576. /package/dist/{src → types}/model/types.d.ts.map +0 -0
  577. /package/dist/{src → types}/triggers/TriggerHandler.d.ts +0 -0
  578. /package/dist/{src → types}/triggers/TriggerHandler.d.ts.map +0 -0
  579. /package/dist/{src → types}/triggers/TriggerIndirectChangesFetcher.d.ts +0 -0
  580. /package/dist/{src → types}/triggers/TriggerIndirectChangesFetcher.d.ts.map +0 -0
  581. /package/dist/{src → types}/triggers/TriggerListeners.d.ts +0 -0
  582. /package/dist/{src → types}/triggers/TriggerListeners.d.ts.map +0 -0
  583. /package/dist/{src → types}/triggers/TriggerListenersBuilder.d.ts +0 -0
  584. /package/dist/{src → types}/triggers/TriggerListenersBuilder.d.ts.map +0 -0
  585. /package/dist/{src → types}/triggers/TriggerListenersFactory.d.ts +0 -0
  586. /package/dist/{src → types}/triggers/TriggerListenersFactory.d.ts.map +0 -0
  587. /package/dist/{src → types}/triggers/TriggerListenersStore.d.ts +0 -0
  588. /package/dist/{src → types}/triggers/TriggerListenersStore.d.ts.map +0 -0
  589. /package/dist/{src → types}/triggers/TriggerPayloadBuilder.d.ts +0 -0
  590. /package/dist/{src → types}/triggers/TriggerPayloadBuilder.d.ts.map +0 -0
  591. /package/dist/{src → types}/triggers/TriggerPayloadManager.d.ts +0 -0
  592. /package/dist/{src → types}/triggers/TriggerPayloadManager.d.ts.map +0 -0
  593. /package/dist/{src → types}/triggers/TriggerPayloadPersister.d.ts +0 -0
  594. /package/dist/{src → types}/triggers/TriggerPayloadPersister.d.ts.map +0 -0
  595. /package/dist/{src → types}/triggers/index.d.ts +0 -0
  596. /package/dist/{src → types}/triggers/index.d.ts.map +0 -0
  597. /package/dist/{src → types}/utils/assertNever.d.ts +0 -0
  598. /package/dist/{src → types}/utils/assertNever.d.ts.map +0 -0
  599. /package/dist/{src → types}/utils/map.d.ts +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ActionsApiMiddlewareFactory.cjs","sources":["../../../../../../packages/engine-actions/src/graphql/http/ActionsApiMiddlewareFactory.ts"],"sourcesContent":["import { HttpController } from '@contember/engine-http'\nimport { ActionsGraphQLHandler } from './ActionsGraphQLHandlerFactory'\nimport { ActionsContext } from '../resolvers/ActionsContext'\nimport { ActionsContextResolver } from './ActionsContextResolver'\nimport { AuthorizationScope, Authorizator } from '@contember/authorization'\nimport { Identity } from '../../authorization'\nimport { ForbiddenError } from '@contember/graphql-utils'\n\nexport class ActionsApiMiddlewareFactory {\n\tconstructor(\n\t\tprivate readonly actionsContextResolver: ActionsContextResolver,\n\t\tprivate readonly actionsGraphQLHandler: ActionsGraphQLHandler,\n\t\tprivate readonly authorizator: Authorizator<Identity>,\n\t) {\n\t}\n\n\tcreate(): HttpController {\n\t\treturn async ctx => {\n\t\t\tconst { timer, logger, koa } = ctx\n\t\t\tconst { projectContainer, identity } = await this.actionsContextResolver.resolve(ctx)\n\n\t\t\tconst systemDatabase = projectContainer.systemDatabaseContext\n\n\t\t\tlogger.debug('Actions query processing started')\n\t\t\tconst graphqlContext: ActionsContext = {\n\t\t\t\tdb: systemDatabase,\n\t\t\t\tlogger,\n\t\t\t\tcontentSchemaResolver: projectContainer.contentSchemaResolver,\n\t\t\t\trequireAccess: async (action, message) => {\n\t\t\t\t\tif (!(await this.authorizator.isAllowed(identity, new AuthorizationScope.Global(), action))) {\n\t\t\t\t\t\tthrow new ForbiddenError(message || 'Forbidden')\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t}\n\t\t\tconst handler = this.actionsGraphQLHandler\n\n\t\t\tawait timer('GraphQL', () => handler({\n\t\t\t\trequest: koa.request,\n\t\t\t\tresponse: koa.response,\n\t\t\t\tcreateContext: () => graphqlContext,\n\t\t\t}))\n\t\t\tlogger.debug('Actions query finished')\n\t\t}\n\t}\n}\n"],"names":["AuthorizationScope","ForbiddenError"],"mappings":";;;;AAQO,MAAM,4BAA4B;AAAA,EACxC,YACkB,wBACA,uBACA,cAChB;AAHgB,SAAA,yBAAA;AACA,SAAA,wBAAA;AACA,SAAA,eAAA;AAAA,EAElB;AAAA,EAEA,SAAyB;AACxB,WAAO,OAAM,QAAO;AACnB,YAAM,EAAE,OAAO,QAAQ,IAAA,IAAQ;AACzB,YAAA,EAAE,kBAAkB,aAAa,MAAM,KAAK,uBAAuB,QAAQ,GAAG;AAEpF,YAAM,iBAAiB,iBAAiB;AAExC,aAAO,MAAM,kCAAkC;AAC/C,YAAM,iBAAiC;AAAA,QACtC,IAAI;AAAA,QACJ;AAAA,QACA,uBAAuB,iBAAiB;AAAA,QACxC,eAAe,OAAO,QAAQ,YAAY;AACrC,cAAA,CAAE,MAAM,KAAK,aAAa,UAAU,UAAU,IAAIA,iCAAmB,UAAU,MAAM,GAAI;AACtF,kBAAA,IAAIC,aAAe,eAAA,WAAW,WAAW;AAAA,UAChD;AAAA,QACD;AAAA,MAAA;AAED,YAAM,UAAU,KAAK;AAEf,YAAA,MAAM,WAAW,MAAM,QAAQ;AAAA,QACpC,SAAS,IAAI;AAAA,QACb,UAAU,IAAI;AAAA,QACd,eAAe,MAAM;AAAA,MACrB,CAAA,CAAC;AACF,aAAO,MAAM,wBAAwB;AAAA,IAAA;AAAA,EAEvC;AACD;;"}
@@ -0,0 +1,38 @@
1
+ import { AuthorizationScope } from "@contember/authorization";
2
+ import { ForbiddenError } from "@contember/graphql-utils";
3
+ class ActionsApiMiddlewareFactory {
4
+ constructor(actionsContextResolver, actionsGraphQLHandler, authorizator) {
5
+ this.actionsContextResolver = actionsContextResolver;
6
+ this.actionsGraphQLHandler = actionsGraphQLHandler;
7
+ this.authorizator = authorizator;
8
+ }
9
+ create() {
10
+ return async (ctx) => {
11
+ const { timer, logger, koa } = ctx;
12
+ const { projectContainer, identity } = await this.actionsContextResolver.resolve(ctx);
13
+ const systemDatabase = projectContainer.systemDatabaseContext;
14
+ logger.debug("Actions query processing started");
15
+ const graphqlContext = {
16
+ db: systemDatabase,
17
+ logger,
18
+ contentSchemaResolver: projectContainer.contentSchemaResolver,
19
+ requireAccess: async (action, message) => {
20
+ if (!await this.authorizator.isAllowed(identity, new AuthorizationScope.Global(), action)) {
21
+ throw new ForbiddenError(message || "Forbidden");
22
+ }
23
+ }
24
+ };
25
+ const handler = this.actionsGraphQLHandler;
26
+ await timer("GraphQL", () => handler({
27
+ request: koa.request,
28
+ response: koa.response,
29
+ createContext: () => graphqlContext
30
+ }));
31
+ logger.debug("Actions query finished");
32
+ };
33
+ }
34
+ }
35
+ export {
36
+ ActionsApiMiddlewareFactory
37
+ };
38
+ //# sourceMappingURL=ActionsApiMiddlewareFactory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ActionsApiMiddlewareFactory.js","sources":["../../../../../../packages/engine-actions/src/graphql/http/ActionsApiMiddlewareFactory.ts"],"sourcesContent":["import { HttpController } from '@contember/engine-http'\nimport { ActionsGraphQLHandler } from './ActionsGraphQLHandlerFactory'\nimport { ActionsContext } from '../resolvers/ActionsContext'\nimport { ActionsContextResolver } from './ActionsContextResolver'\nimport { AuthorizationScope, Authorizator } from '@contember/authorization'\nimport { Identity } from '../../authorization'\nimport { ForbiddenError } from '@contember/graphql-utils'\n\nexport class ActionsApiMiddlewareFactory {\n\tconstructor(\n\t\tprivate readonly actionsContextResolver: ActionsContextResolver,\n\t\tprivate readonly actionsGraphQLHandler: ActionsGraphQLHandler,\n\t\tprivate readonly authorizator: Authorizator<Identity>,\n\t) {\n\t}\n\n\tcreate(): HttpController {\n\t\treturn async ctx => {\n\t\t\tconst { timer, logger, koa } = ctx\n\t\t\tconst { projectContainer, identity } = await this.actionsContextResolver.resolve(ctx)\n\n\t\t\tconst systemDatabase = projectContainer.systemDatabaseContext\n\n\t\t\tlogger.debug('Actions query processing started')\n\t\t\tconst graphqlContext: ActionsContext = {\n\t\t\t\tdb: systemDatabase,\n\t\t\t\tlogger,\n\t\t\t\tcontentSchemaResolver: projectContainer.contentSchemaResolver,\n\t\t\t\trequireAccess: async (action, message) => {\n\t\t\t\t\tif (!(await this.authorizator.isAllowed(identity, new AuthorizationScope.Global(), action))) {\n\t\t\t\t\t\tthrow new ForbiddenError(message || 'Forbidden')\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t}\n\t\t\tconst handler = this.actionsGraphQLHandler\n\n\t\t\tawait timer('GraphQL', () => handler({\n\t\t\t\trequest: koa.request,\n\t\t\t\tresponse: koa.response,\n\t\t\t\tcreateContext: () => graphqlContext,\n\t\t\t}))\n\t\t\tlogger.debug('Actions query finished')\n\t\t}\n\t}\n}\n"],"names":[],"mappings":";;AAQO,MAAM,4BAA4B;AAAA,EACxC,YACkB,wBACA,uBACA,cAChB;AAHgB,SAAA,yBAAA;AACA,SAAA,wBAAA;AACA,SAAA,eAAA;AAAA,EAElB;AAAA,EAEA,SAAyB;AACxB,WAAO,OAAM,QAAO;AACnB,YAAM,EAAE,OAAO,QAAQ,IAAA,IAAQ;AACzB,YAAA,EAAE,kBAAkB,aAAa,MAAM,KAAK,uBAAuB,QAAQ,GAAG;AAEpF,YAAM,iBAAiB,iBAAiB;AAExC,aAAO,MAAM,kCAAkC;AAC/C,YAAM,iBAAiC;AAAA,QACtC,IAAI;AAAA,QACJ;AAAA,QACA,uBAAuB,iBAAiB;AAAA,QACxC,eAAe,OAAO,QAAQ,YAAY;AACrC,cAAA,CAAE,MAAM,KAAK,aAAa,UAAU,UAAU,IAAI,mBAAmB,UAAU,MAAM,GAAI;AACtF,kBAAA,IAAI,eAAe,WAAW,WAAW;AAAA,UAChD;AAAA,QACD;AAAA,MAAA;AAED,YAAM,UAAU,KAAK;AAEf,YAAA,MAAM,WAAW,MAAM,QAAQ;AAAA,QACpC,SAAS,IAAI;AAAA,QACb,UAAU,IAAI;AAAA,QACd,eAAe,MAAM;AAAA,MACrB,CAAA,CAAC;AACF,aAAO,MAAM,wBAAwB;AAAA,IAAA;AAAA,EAEvC;AACD;"}
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const engineHttp = require("@contember/engine-http");
4
+ class ActionsContextResolver {
5
+ constructor(debug, projectContextResolver) {
6
+ this.debug = debug;
7
+ this.projectContextResolver = projectContextResolver;
8
+ }
9
+ async resolve(ctx) {
10
+ const { timer, projectGroup: { tenantContainer }, logger, authResult } = ctx;
11
+ const projectContext = await this.projectContextResolver.resolve(ctx);
12
+ const { project } = projectContext;
13
+ if (!authResult) {
14
+ throw new engineHttp.HttpErrorResponse(401, "Authentication required");
15
+ }
16
+ const memberships = await timer(
17
+ "MembershipFetch",
18
+ () => tenantContainer.projectMemberManager.getEffectiveProjectMemberships(
19
+ tenantContainer.databaseContext,
20
+ { slug: project.slug },
21
+ {
22
+ id: authResult.identityId,
23
+ roles: authResult.roles
24
+ }
25
+ )
26
+ );
27
+ logger.debug("Memberships fetched", { memberships });
28
+ if (memberships.length === 0) {
29
+ throw this.debug ? new engineHttp.HttpErrorResponse(404, `You are not allowed to access project ${project.slug}`) : new engineHttp.HttpErrorResponse(404, `Project ${project.slug} NOT found`);
30
+ }
31
+ const roles = memberships.map((it) => it.role);
32
+ return {
33
+ ...projectContext,
34
+ identity: { id: authResult.identityId, roles }
35
+ };
36
+ }
37
+ }
38
+ exports.ActionsContextResolver = ActionsContextResolver;
39
+ //# sourceMappingURL=ActionsContextResolver.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ActionsContextResolver.cjs","sources":["../../../../../../packages/engine-actions/src/graphql/http/ActionsContextResolver.ts"],"sourcesContent":["import { ApplicationContext, HttpErrorResponse, ProjectConfig, ProjectContainer, ProjectContextResolver } from '@contember/engine-http'\nimport { Identity } from '../../authorization'\n\nexport interface ActionsContext {\n\tprojectContainer: ProjectContainer\n\tproject: ProjectConfig\n\tidentity: Identity\n}\n\nexport class ActionsContextResolver {\n\tconstructor(\n\t\tprivate readonly debug: boolean,\n\t\tprivate readonly projectContextResolver: ProjectContextResolver,\n\t) {\n\t}\n\n\tasync resolve(ctx: ApplicationContext): Promise<ActionsContext> {\n\t\tconst { timer, projectGroup: { tenantContainer }, logger, authResult } = ctx\n\t\tconst projectContext = await this.projectContextResolver.resolve(ctx)\n\t\tconst { project } = projectContext\n\t\tif (!authResult) {\n\t\t\tthrow new HttpErrorResponse(401, 'Authentication required')\n\t\t}\n\t\tconst memberships = await timer('MembershipFetch', () =>\n\t\t\ttenantContainer.projectMemberManager.getEffectiveProjectMemberships(\n\t\t\t\ttenantContainer.databaseContext,\n\t\t\t\t{ slug: project.slug },\n\t\t\t\t{\n\t\t\t\t\tid: authResult.identityId,\n\t\t\t\t\troles: authResult.roles,\n\t\t\t\t},\n\t\t\t),\n\t\t)\n\t\tlogger.debug('Memberships fetched', { memberships })\n\n\t\tif (memberships.length === 0) {\n\t\t\tthrow this.debug\n\t\t\t\t? new HttpErrorResponse(404, `You are not allowed to access project ${project.slug}`)\n\t\t\t\t: new HttpErrorResponse(404, `Project ${project.slug} NOT found`)\n\t\t}\n\t\tconst roles = memberships.map(it => it.role)\n\t\treturn {\n\t\t\t...projectContext,\n\t\t\tidentity: { id: authResult.identityId, roles },\n\t\t}\n\t}\n}\n"],"names":["HttpErrorResponse"],"mappings":";;;AASO,MAAM,uBAAuB;AAAA,EACnC,YACkB,OACA,wBAChB;AAFgB,SAAA,QAAA;AACA,SAAA,yBAAA;AAAA,EAElB;AAAA,EAEA,MAAM,QAAQ,KAAkD;AACzD,UAAA,EAAE,OAAO,cAAc,EAAE,gBAAmB,GAAA,QAAQ,WAAe,IAAA;AACzE,UAAM,iBAAiB,MAAM,KAAK,uBAAuB,QAAQ,GAAG;AAC9D,UAAA,EAAE,QAAY,IAAA;AACpB,QAAI,CAAC,YAAY;AACV,YAAA,IAAIA,WAAkB,kBAAA,KAAK,yBAAyB;AAAA,IAC3D;AACA,UAAM,cAAc,MAAM;AAAA,MAAM;AAAA,MAAmB,MAClD,gBAAgB,qBAAqB;AAAA,QACpC,gBAAgB;AAAA,QAChB,EAAE,MAAM,QAAQ,KAAK;AAAA,QACrB;AAAA,UACC,IAAI,WAAW;AAAA,UACf,OAAO,WAAW;AAAA,QACnB;AAAA,MACD;AAAA,IAAA;AAED,WAAO,MAAM,uBAAuB,EAAE,YAAa,CAAA;AAE/C,QAAA,YAAY,WAAW,GAAG;AAC7B,YAAM,KAAK,QACR,IAAIA,WAAAA,kBAAkB,KAAK,yCAAyC,QAAQ,IAAI,EAAE,IAClF,IAAIA,WAAAA,kBAAkB,KAAK,WAAW,QAAQ,IAAI,YAAY;AAAA,IAClE;AACA,UAAM,QAAQ,YAAY,IAAI,CAAA,OAAM,GAAG,IAAI;AACpC,WAAA;AAAA,MACN,GAAG;AAAA,MACH,UAAU,EAAE,IAAI,WAAW,YAAY,MAAM;AAAA,IAAA;AAAA,EAE/C;AACD;;"}
@@ -0,0 +1,39 @@
1
+ import { HttpErrorResponse } from "@contember/engine-http";
2
+ class ActionsContextResolver {
3
+ constructor(debug, projectContextResolver) {
4
+ this.debug = debug;
5
+ this.projectContextResolver = projectContextResolver;
6
+ }
7
+ async resolve(ctx) {
8
+ const { timer, projectGroup: { tenantContainer }, logger, authResult } = ctx;
9
+ const projectContext = await this.projectContextResolver.resolve(ctx);
10
+ const { project } = projectContext;
11
+ if (!authResult) {
12
+ throw new HttpErrorResponse(401, "Authentication required");
13
+ }
14
+ const memberships = await timer(
15
+ "MembershipFetch",
16
+ () => tenantContainer.projectMemberManager.getEffectiveProjectMemberships(
17
+ tenantContainer.databaseContext,
18
+ { slug: project.slug },
19
+ {
20
+ id: authResult.identityId,
21
+ roles: authResult.roles
22
+ }
23
+ )
24
+ );
25
+ logger.debug("Memberships fetched", { memberships });
26
+ if (memberships.length === 0) {
27
+ throw this.debug ? new HttpErrorResponse(404, `You are not allowed to access project ${project.slug}`) : new HttpErrorResponse(404, `Project ${project.slug} NOT found`);
28
+ }
29
+ const roles = memberships.map((it) => it.role);
30
+ return {
31
+ ...projectContext,
32
+ identity: { id: authResult.identityId, roles }
33
+ };
34
+ }
35
+ }
36
+ export {
37
+ ActionsContextResolver
38
+ };
39
+ //# sourceMappingURL=ActionsContextResolver.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ActionsContextResolver.js","sources":["../../../../../../packages/engine-actions/src/graphql/http/ActionsContextResolver.ts"],"sourcesContent":["import { ApplicationContext, HttpErrorResponse, ProjectConfig, ProjectContainer, ProjectContextResolver } from '@contember/engine-http'\nimport { Identity } from '../../authorization'\n\nexport interface ActionsContext {\n\tprojectContainer: ProjectContainer\n\tproject: ProjectConfig\n\tidentity: Identity\n}\n\nexport class ActionsContextResolver {\n\tconstructor(\n\t\tprivate readonly debug: boolean,\n\t\tprivate readonly projectContextResolver: ProjectContextResolver,\n\t) {\n\t}\n\n\tasync resolve(ctx: ApplicationContext): Promise<ActionsContext> {\n\t\tconst { timer, projectGroup: { tenantContainer }, logger, authResult } = ctx\n\t\tconst projectContext = await this.projectContextResolver.resolve(ctx)\n\t\tconst { project } = projectContext\n\t\tif (!authResult) {\n\t\t\tthrow new HttpErrorResponse(401, 'Authentication required')\n\t\t}\n\t\tconst memberships = await timer('MembershipFetch', () =>\n\t\t\ttenantContainer.projectMemberManager.getEffectiveProjectMemberships(\n\t\t\t\ttenantContainer.databaseContext,\n\t\t\t\t{ slug: project.slug },\n\t\t\t\t{\n\t\t\t\t\tid: authResult.identityId,\n\t\t\t\t\troles: authResult.roles,\n\t\t\t\t},\n\t\t\t),\n\t\t)\n\t\tlogger.debug('Memberships fetched', { memberships })\n\n\t\tif (memberships.length === 0) {\n\t\t\tthrow this.debug\n\t\t\t\t? new HttpErrorResponse(404, `You are not allowed to access project ${project.slug}`)\n\t\t\t\t: new HttpErrorResponse(404, `Project ${project.slug} NOT found`)\n\t\t}\n\t\tconst roles = memberships.map(it => it.role)\n\t\treturn {\n\t\t\t...projectContext,\n\t\t\tidentity: { id: authResult.identityId, roles },\n\t\t}\n\t}\n}\n"],"names":[],"mappings":";AASO,MAAM,uBAAuB;AAAA,EACnC,YACkB,OACA,wBAChB;AAFgB,SAAA,QAAA;AACA,SAAA,yBAAA;AAAA,EAElB;AAAA,EAEA,MAAM,QAAQ,KAAkD;AACzD,UAAA,EAAE,OAAO,cAAc,EAAE,gBAAmB,GAAA,QAAQ,WAAe,IAAA;AACzE,UAAM,iBAAiB,MAAM,KAAK,uBAAuB,QAAQ,GAAG;AAC9D,UAAA,EAAE,QAAY,IAAA;AACpB,QAAI,CAAC,YAAY;AACV,YAAA,IAAI,kBAAkB,KAAK,yBAAyB;AAAA,IAC3D;AACA,UAAM,cAAc,MAAM;AAAA,MAAM;AAAA,MAAmB,MAClD,gBAAgB,qBAAqB;AAAA,QACpC,gBAAgB;AAAA,QAChB,EAAE,MAAM,QAAQ,KAAK;AAAA,QACrB;AAAA,UACC,IAAI,WAAW;AAAA,UACf,OAAO,WAAW;AAAA,QACnB;AAAA,MACD;AAAA,IAAA;AAED,WAAO,MAAM,uBAAuB,EAAE,YAAa,CAAA;AAE/C,QAAA,YAAY,WAAW,GAAG;AAC7B,YAAM,KAAK,QACR,IAAI,kBAAkB,KAAK,yCAAyC,QAAQ,IAAI,EAAE,IAClF,IAAI,kBAAkB,KAAK,WAAW,QAAQ,IAAI,YAAY;AAAA,IAClE;AACA,UAAM,QAAQ,YAAY,IAAI,CAAA,OAAM,GAAG,IAAI;AACpC,WAAA;AAAA,MACN,GAAG;AAAA,MACH,UAAU,EAAE,IAAI,WAAW,YAAY,MAAM;AAAA,IAAA;AAAA,EAE/C;AACD;"}
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const schema = require("@graphql-tools/schema");
4
+ const engineHttp = require("@contember/engine-http");
5
+ const actions_graphql = require("../schema/actions.graphql.cjs");
6
+ class ActionsGraphQLHandlerFactory {
7
+ create(resolversFactory) {
8
+ const resolvers = resolversFactory.create();
9
+ const schema$1 = schema.makeExecutableSchema({
10
+ typeDefs: actions_graphql.schema,
11
+ resolvers
12
+ });
13
+ return engineHttp.createGraphQLQueryHandler({
14
+ schema: schema$1,
15
+ listeners: []
16
+ });
17
+ }
18
+ }
19
+ exports.ActionsGraphQLHandlerFactory = ActionsGraphQLHandlerFactory;
20
+ //# sourceMappingURL=ActionsGraphQLHandlerFactory.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ActionsGraphQLHandlerFactory.cjs","sources":["../../../../../../packages/engine-actions/src/graphql/http/ActionsGraphQLHandlerFactory.ts"],"sourcesContent":["import { makeExecutableSchema } from '@graphql-tools/schema'\nimport { createGraphQLQueryHandler, GraphQLQueryHandler } from '@contember/engine-http'\nimport { ResolversFactory } from '../resolvers/ResolversFactory'\nimport { schema as graphqlDocument } from '../schema/actions.graphql'\nimport { ActionsContext } from '../resolvers/ActionsContext'\n\n\nexport type ActionsGraphQLHandler = GraphQLQueryHandler<ActionsContext>\n\nexport class ActionsGraphQLHandlerFactory {\n\tcreate(resolversFactory: ResolversFactory): ActionsGraphQLHandler {\n\t\tconst resolvers = resolversFactory.create()\n\t\tconst schema = makeExecutableSchema({\n\t\t\ttypeDefs: graphqlDocument,\n\t\t\tresolvers,\n\t\t})\n\n\t\treturn createGraphQLQueryHandler<ActionsContext>({\n\t\t\tschema,\n\t\t\tlisteners: [],\n\t\t})\n\t}\n}\n"],"names":["schema","makeExecutableSchema","graphqlDocument","createGraphQLQueryHandler"],"mappings":";;;;;AASO,MAAM,6BAA6B;AAAA,EACzC,OAAO,kBAA2D;AAC3D,UAAA,YAAY,iBAAiB;AACnC,UAAMA,WAASC,OAAAA,qBAAqB;AAAA,MACnC,UAAUC,gBAAA;AAAA,MACV;AAAA,IAAA,CACA;AAED,WAAOC,qCAA0C;AAAA,MAAA,QAChDH;AAAAA,MACA,WAAW,CAAC;AAAA,IAAA,CACZ;AAAA,EACF;AACD;;"}
@@ -0,0 +1,20 @@
1
+ import { makeExecutableSchema } from "@graphql-tools/schema";
2
+ import { createGraphQLQueryHandler } from "@contember/engine-http";
3
+ import { schema } from "../schema/actions.graphql.js";
4
+ class ActionsGraphQLHandlerFactory {
5
+ create(resolversFactory) {
6
+ const resolvers = resolversFactory.create();
7
+ const schema$1 = makeExecutableSchema({
8
+ typeDefs: schema,
9
+ resolvers
10
+ });
11
+ return createGraphQLQueryHandler({
12
+ schema: schema$1,
13
+ listeners: []
14
+ });
15
+ }
16
+ }
17
+ export {
18
+ ActionsGraphQLHandlerFactory
19
+ };
20
+ //# sourceMappingURL=ActionsGraphQLHandlerFactory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ActionsGraphQLHandlerFactory.js","sources":["../../../../../../packages/engine-actions/src/graphql/http/ActionsGraphQLHandlerFactory.ts"],"sourcesContent":["import { makeExecutableSchema } from '@graphql-tools/schema'\nimport { createGraphQLQueryHandler, GraphQLQueryHandler } from '@contember/engine-http'\nimport { ResolversFactory } from '../resolvers/ResolversFactory'\nimport { schema as graphqlDocument } from '../schema/actions.graphql'\nimport { ActionsContext } from '../resolvers/ActionsContext'\n\n\nexport type ActionsGraphQLHandler = GraphQLQueryHandler<ActionsContext>\n\nexport class ActionsGraphQLHandlerFactory {\n\tcreate(resolversFactory: ResolversFactory): ActionsGraphQLHandler {\n\t\tconst resolvers = resolversFactory.create()\n\t\tconst schema = makeExecutableSchema({\n\t\t\ttypeDefs: graphqlDocument,\n\t\t\tresolvers,\n\t\t})\n\n\t\treturn createGraphQLQueryHandler<ActionsContext>({\n\t\t\tschema,\n\t\t\tlisteners: [],\n\t\t})\n\t}\n}\n"],"names":["schema","graphqlDocument"],"mappings":";;;AASO,MAAM,6BAA6B;AAAA,EACzC,OAAO,kBAA2D;AAC3D,UAAA,YAAY,iBAAiB;AACnC,UAAMA,WAAS,qBAAqB;AAAA,MACnC,UAAUC;AAAAA,MACV;AAAA,IAAA,CACA;AAED,WAAO,0BAA0C;AAAA,MAAA,QAChDD;AAAAA,MACA,WAAW,CAAC;AAAA,IAAA,CACZ;AAAA,EACF;AACD;"}
@@ -0,0 +1,149 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const engineHttp = require("@contember/engine-http");
4
+ const Typesafe = require("@contember/typesafe");
5
+ const engineTenantApi = require("@contember/engine-tenant-api");
6
+ function _interopNamespaceDefault(e) {
7
+ const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
8
+ if (e) {
9
+ for (const k in e) {
10
+ if (k !== "default") {
11
+ const d = Object.getOwnPropertyDescriptor(e, k);
12
+ Object.defineProperty(n, k, d.get ? d : {
13
+ enumerable: true,
14
+ get: () => e[k]
15
+ });
16
+ }
17
+ }
18
+ }
19
+ n.default = e;
20
+ return Object.freeze(n);
21
+ }
22
+ const Typesafe__namespace = /* @__PURE__ */ _interopNamespaceDefault(Typesafe);
23
+ const IncomingMessage = Typesafe__namespace.discriminatedUnion(
24
+ "type",
25
+ {
26
+ startWorker: Typesafe__namespace.object({}),
27
+ stopAllWorkers: Typesafe__namespace.object({})
28
+ }
29
+ );
30
+ const OutgoingMessage = Typesafe__namespace.discriminatedUnion(
31
+ "type",
32
+ {
33
+ error: Typesafe__namespace.object({
34
+ message: Typesafe__namespace.string
35
+ }),
36
+ message: Typesafe__namespace.object({
37
+ message: Typesafe__namespace.string
38
+ }),
39
+ ready: Typesafe__namespace.object({}),
40
+ workerStarted: Typesafe__namespace.object({
41
+ workerId: Typesafe__namespace.string
42
+ }),
43
+ workedStopped: Typesafe__namespace.object({
44
+ workerId: Typesafe__namespace.string
45
+ }),
46
+ workerFailedToStart: Typesafe__namespace.object({
47
+ workerId: Typesafe__namespace.string
48
+ }),
49
+ workerCrashed: Typesafe__namespace.object({
50
+ workerId: Typesafe__namespace.string
51
+ })
52
+ }
53
+ );
54
+ class ActionsWebsocketControllerFactory {
55
+ constructor(debug, actionsContextResolver, dispatchWorkerSupervisorFactory) {
56
+ this.debug = debug;
57
+ this.actionsContextResolver = actionsContextResolver;
58
+ this.dispatchWorkerSupervisorFactory = dispatchWorkerSupervisorFactory;
59
+ }
60
+ create() {
61
+ return async (ctx) => {
62
+ const { ws, logger, authResult, projectGroup } = ctx;
63
+ if (!authResult) {
64
+ throw new engineHttp.HttpErrorResponse(401, "Authentication required");
65
+ }
66
+ if (!authResult.roles.some((it) => it === engineTenantApi.TenantRole.SUPER_ADMIN || it === engineTenantApi.TenantRole.PROJECT_ADMIN)) {
67
+ throw new engineHttp.HttpErrorResponse(403, "Not allowed to run actions worker");
68
+ }
69
+ const send = (message) => {
70
+ if (this.debug) {
71
+ OutgoingMessage(message);
72
+ }
73
+ ws.send(JSON.stringify(message));
74
+ };
75
+ let workers = [];
76
+ const abortListener = async () => {
77
+ send({ type: "message", message: "shutting down" });
78
+ await stopAll();
79
+ send({ type: "message", message: "closing connection" });
80
+ ws.close(1012);
81
+ };
82
+ ctx.abortSignal.addEventListener("abort", abortListener);
83
+ const stopAll = async () => {
84
+ const currentWorkers = workers.map(async (it) => {
85
+ await (await it.running).end();
86
+ send({
87
+ type: "workedStopped",
88
+ workerId: it.id
89
+ });
90
+ });
91
+ workers = [];
92
+ await Promise.all(currentWorkers);
93
+ };
94
+ send({ type: "ready" });
95
+ ws.addEventListener("message", async (message) => {
96
+ let json;
97
+ try {
98
+ json = JSON.parse(message.data.toString());
99
+ } catch {
100
+ send({ type: "error", message: "Invalid JSON" });
101
+ return;
102
+ }
103
+ let data;
104
+ try {
105
+ data = IncomingMessage(json);
106
+ } catch (e) {
107
+ if (e instanceof Typesafe__namespace.ParseError) {
108
+ send({ type: "error", message: e.message });
109
+ return;
110
+ } else {
111
+ throw e;
112
+ }
113
+ }
114
+ switch (data.type) {
115
+ case "startWorker":
116
+ const workerId = Math.random().toString().substring(2);
117
+ const dispatchSupervisor = this.dispatchWorkerSupervisorFactory.create(projectGroup);
118
+ try {
119
+ const running = dispatchSupervisor.run({ logger, onError: () => {
120
+ send({ type: "workerCrashed", workerId });
121
+ } });
122
+ workers.push({ id: workerId, running });
123
+ await running;
124
+ send({ type: "workerStarted", workerId });
125
+ } catch (e) {
126
+ logger.error(e, { message: "Worker failed to start" });
127
+ send({ type: "workerFailedToStart", workerId });
128
+ }
129
+ break;
130
+ case "stopAllWorkers":
131
+ send({ type: "message", message: "stopping" });
132
+ await stopAll();
133
+ send({ type: "message", message: "all stopped" });
134
+ break;
135
+ }
136
+ });
137
+ const pingHandle = setInterval(() => {
138
+ ws.ping();
139
+ }, 5e3);
140
+ ws.addEventListener("close", async () => {
141
+ ctx.abortSignal.removeEventListener("abort", abortListener);
142
+ clearInterval(pingHandle);
143
+ await stopAll();
144
+ });
145
+ };
146
+ }
147
+ }
148
+ exports.ActionsWebsocketControllerFactory = ActionsWebsocketControllerFactory;
149
+ //# sourceMappingURL=ActionsWebsocketControllerFactory.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ActionsWebsocketControllerFactory.cjs","sources":["../../../../../../packages/engine-actions/src/graphql/http/ActionsWebsocketControllerFactory.ts"],"sourcesContent":["import { HttpErrorResponse, WebSocketController } from '@contember/engine-http'\nimport { ActionsContextResolver } from './ActionsContextResolver'\nimport { DispatchWorkerSupervisorFactory } from '../../dispatch/DispatchWorkerSupervisor'\nimport * as Typesafe from '@contember/typesafe'\nimport { TenantRole } from '@contember/engine-tenant-api'\nimport { Running } from '@contember/engine-common'\n\nconst IncomingMessage = Typesafe.discriminatedUnion(\n\t'type',\n\t{\n\t\tstartWorker: Typesafe.object({}),\n\t\tstopAllWorkers: Typesafe.object({}),\n\t},\n)\ntype IncomingMessage = ReturnType<typeof IncomingMessage>\nconst OutgoingMessage = Typesafe.discriminatedUnion(\n\t'type',\n\t{\n\t\terror: Typesafe.object({\n\t\t\tmessage: Typesafe.string,\n\t\t}),\n\t\tmessage: Typesafe.object({\n\t\t\tmessage: Typesafe.string,\n\t\t}),\n\t\tready: Typesafe.object({}),\n\n\t\tworkerStarted: Typesafe.object({\n\t\t\tworkerId: Typesafe.string,\n\t\t}),\n\t\tworkedStopped: Typesafe.object({\n\t\t\tworkerId: Typesafe.string,\n\t\t}),\n\t\tworkerFailedToStart: Typesafe.object({\n\t\t\tworkerId: Typesafe.string,\n\t\t}),\n\t\tworkerCrashed: Typesafe.object({\n\t\t\tworkerId: Typesafe.string,\n\t\t}),\n\t},\n)\n\ntype OutgoingMessage = ReturnType<typeof OutgoingMessage>\n\nexport class ActionsWebsocketControllerFactory {\n\tconstructor(\n\t\tprivate readonly debug: boolean,\n\t\tprivate readonly actionsContextResolver: ActionsContextResolver,\n\t\tprivate readonly dispatchWorkerSupervisorFactory: DispatchWorkerSupervisorFactory,\n\t) {\n\t}\n\n\tcreate(): WebSocketController {\n\t\treturn async ctx => {\n\t\t\tconst { ws, logger, authResult, projectGroup } = ctx\n\t\t\tif (!authResult) {\n\t\t\t\tthrow new HttpErrorResponse(401, 'Authentication required')\n\t\t\t}\n\t\t\tif (!authResult.roles.some(it => it === TenantRole.SUPER_ADMIN || it === TenantRole.PROJECT_ADMIN)) {\n\t\t\t\tthrow new HttpErrorResponse(403, 'Not allowed to run actions worker')\n\t\t\t}\n\n\t\t\tconst send = (message: OutgoingMessage) => {\n\t\t\t\tif (this.debug) {\n\t\t\t\t\tOutgoingMessage(message)\n\t\t\t\t}\n\t\t\t\tws.send(JSON.stringify(message))\n\t\t\t}\n\n\t\t\tlet workers: { id: string; running: Promise<Running> }[] = []\n\t\t\tconst abortListener = async () => {\n\t\t\t\tsend({ type: 'message', message: 'shutting down' })\n\t\t\t\tawait stopAll()\n\t\t\t\tsend({ type: 'message', message: 'closing connection' })\n\t\t\t\tws.close(1012) // Service Restart\n\t\t\t}\n\t\t\tctx.abortSignal.addEventListener('abort', abortListener)\n\n\t\t\tconst stopAll = async () => {\n\t\t\t\tconst currentWorkers = workers.map(async it => {\n\t\t\t\t\tawait (await it.running).end()\n\t\t\t\t\tsend({\n\t\t\t\t\t\ttype: 'workedStopped',\n\t\t\t\t\t\tworkerId: it.id,\n\t\t\t\t\t})\n\t\t\t\t})\n\t\t\t\tworkers = []\n\t\t\t\tawait Promise.all(currentWorkers)\n\t\t\t}\n\t\t\tsend({ type: 'ready' })\n\n\t\t\tws.addEventListener('message', async message => {\n\t\t\t\tlet json\n\t\t\t\ttry {\n\t\t\t\t\tjson = JSON.parse(message.data.toString())\n\t\t\t\t} catch {\n\t\t\t\t\tsend({ type: 'error', message: 'Invalid JSON' })\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tlet data: IncomingMessage\n\t\t\t\ttry {\n\t\t\t\t\tdata = IncomingMessage(json)\n\t\t\t\t} catch (e) {\n\t\t\t\t\tif (e instanceof Typesafe.ParseError) {\n\t\t\t\t\t\tsend({ type: 'error', message: e.message })\n\t\t\t\t\t\treturn\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthrow e\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tswitch (data.type) {\n\t\t\t\t\tcase 'startWorker':\n\t\t\t\t\t\tconst workerId = Math.random().toString().substring(2)\n\t\t\t\t\t\tconst dispatchSupervisor = this.dispatchWorkerSupervisorFactory.create(projectGroup)\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tconst running = dispatchSupervisor.run({ logger, onError: () => {\n\t\t\t\t\t\t\t\tsend({ type: 'workerCrashed', workerId })\n\t\t\t\t\t\t\t} })\n\t\t\t\t\t\t\tworkers.push({ id: workerId, running })\n\t\t\t\t\t\t\tawait running\n\t\t\t\t\t\t\tsend({ type: 'workerStarted', workerId })\n\t\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\t\tlogger.error(e, { message: 'Worker failed to start' })\n\t\t\t\t\t\t\tsend({ type: 'workerFailedToStart', workerId })\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak\n\t\t\t\t\tcase 'stopAllWorkers':\n\t\t\t\t\t\tsend({ type: 'message', message: 'stopping' })\n\t\t\t\t\t\tawait stopAll()\n\t\t\t\t\t\tsend({ type: 'message', message: 'all stopped' })\n\t\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t})\n\n\t\t\tconst pingHandle = setInterval(() => {\n\t\t\t\tws.ping()\n\t\t\t}, 5000)\n\n\t\t\tws.addEventListener('close', async () => {\n\t\t\t\tctx.abortSignal.removeEventListener('abort', abortListener)\n\t\t\t\tclearInterval(pingHandle)\n\t\t\t\tawait stopAll()\n\t\t\t})\n\t\t}\n\t}\n}\n\n"],"names":["Typesafe","HttpErrorResponse","TenantRole"],"mappings":"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"}
@@ -0,0 +1,132 @@
1
+ import { HttpErrorResponse } from "@contember/engine-http";
2
+ import * as Typesafe from "@contember/typesafe";
3
+ import { TenantRole } from "@contember/engine-tenant-api";
4
+ const IncomingMessage = Typesafe.discriminatedUnion(
5
+ "type",
6
+ {
7
+ startWorker: Typesafe.object({}),
8
+ stopAllWorkers: Typesafe.object({})
9
+ }
10
+ );
11
+ const OutgoingMessage = Typesafe.discriminatedUnion(
12
+ "type",
13
+ {
14
+ error: Typesafe.object({
15
+ message: Typesafe.string
16
+ }),
17
+ message: Typesafe.object({
18
+ message: Typesafe.string
19
+ }),
20
+ ready: Typesafe.object({}),
21
+ workerStarted: Typesafe.object({
22
+ workerId: Typesafe.string
23
+ }),
24
+ workedStopped: Typesafe.object({
25
+ workerId: Typesafe.string
26
+ }),
27
+ workerFailedToStart: Typesafe.object({
28
+ workerId: Typesafe.string
29
+ }),
30
+ workerCrashed: Typesafe.object({
31
+ workerId: Typesafe.string
32
+ })
33
+ }
34
+ );
35
+ class ActionsWebsocketControllerFactory {
36
+ constructor(debug, actionsContextResolver, dispatchWorkerSupervisorFactory) {
37
+ this.debug = debug;
38
+ this.actionsContextResolver = actionsContextResolver;
39
+ this.dispatchWorkerSupervisorFactory = dispatchWorkerSupervisorFactory;
40
+ }
41
+ create() {
42
+ return async (ctx) => {
43
+ const { ws, logger, authResult, projectGroup } = ctx;
44
+ if (!authResult) {
45
+ throw new HttpErrorResponse(401, "Authentication required");
46
+ }
47
+ if (!authResult.roles.some((it) => it === TenantRole.SUPER_ADMIN || it === TenantRole.PROJECT_ADMIN)) {
48
+ throw new HttpErrorResponse(403, "Not allowed to run actions worker");
49
+ }
50
+ const send = (message) => {
51
+ if (this.debug) {
52
+ OutgoingMessage(message);
53
+ }
54
+ ws.send(JSON.stringify(message));
55
+ };
56
+ let workers = [];
57
+ const abortListener = async () => {
58
+ send({ type: "message", message: "shutting down" });
59
+ await stopAll();
60
+ send({ type: "message", message: "closing connection" });
61
+ ws.close(1012);
62
+ };
63
+ ctx.abortSignal.addEventListener("abort", abortListener);
64
+ const stopAll = async () => {
65
+ const currentWorkers = workers.map(async (it) => {
66
+ await (await it.running).end();
67
+ send({
68
+ type: "workedStopped",
69
+ workerId: it.id
70
+ });
71
+ });
72
+ workers = [];
73
+ await Promise.all(currentWorkers);
74
+ };
75
+ send({ type: "ready" });
76
+ ws.addEventListener("message", async (message) => {
77
+ let json;
78
+ try {
79
+ json = JSON.parse(message.data.toString());
80
+ } catch {
81
+ send({ type: "error", message: "Invalid JSON" });
82
+ return;
83
+ }
84
+ let data;
85
+ try {
86
+ data = IncomingMessage(json);
87
+ } catch (e) {
88
+ if (e instanceof Typesafe.ParseError) {
89
+ send({ type: "error", message: e.message });
90
+ return;
91
+ } else {
92
+ throw e;
93
+ }
94
+ }
95
+ switch (data.type) {
96
+ case "startWorker":
97
+ const workerId = Math.random().toString().substring(2);
98
+ const dispatchSupervisor = this.dispatchWorkerSupervisorFactory.create(projectGroup);
99
+ try {
100
+ const running = dispatchSupervisor.run({ logger, onError: () => {
101
+ send({ type: "workerCrashed", workerId });
102
+ } });
103
+ workers.push({ id: workerId, running });
104
+ await running;
105
+ send({ type: "workerStarted", workerId });
106
+ } catch (e) {
107
+ logger.error(e, { message: "Worker failed to start" });
108
+ send({ type: "workerFailedToStart", workerId });
109
+ }
110
+ break;
111
+ case "stopAllWorkers":
112
+ send({ type: "message", message: "stopping" });
113
+ await stopAll();
114
+ send({ type: "message", message: "all stopped" });
115
+ break;
116
+ }
117
+ });
118
+ const pingHandle = setInterval(() => {
119
+ ws.ping();
120
+ }, 5e3);
121
+ ws.addEventListener("close", async () => {
122
+ ctx.abortSignal.removeEventListener("abort", abortListener);
123
+ clearInterval(pingHandle);
124
+ await stopAll();
125
+ });
126
+ };
127
+ }
128
+ }
129
+ export {
130
+ ActionsWebsocketControllerFactory
131
+ };
132
+ //# sourceMappingURL=ActionsWebsocketControllerFactory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ActionsWebsocketControllerFactory.js","sources":["../../../../../../packages/engine-actions/src/graphql/http/ActionsWebsocketControllerFactory.ts"],"sourcesContent":["import { HttpErrorResponse, WebSocketController } from '@contember/engine-http'\nimport { ActionsContextResolver } from './ActionsContextResolver'\nimport { DispatchWorkerSupervisorFactory } from '../../dispatch/DispatchWorkerSupervisor'\nimport * as Typesafe from '@contember/typesafe'\nimport { TenantRole } from '@contember/engine-tenant-api'\nimport { Running } from '@contember/engine-common'\n\nconst IncomingMessage = Typesafe.discriminatedUnion(\n\t'type',\n\t{\n\t\tstartWorker: Typesafe.object({}),\n\t\tstopAllWorkers: Typesafe.object({}),\n\t},\n)\ntype IncomingMessage = ReturnType<typeof IncomingMessage>\nconst OutgoingMessage = Typesafe.discriminatedUnion(\n\t'type',\n\t{\n\t\terror: Typesafe.object({\n\t\t\tmessage: Typesafe.string,\n\t\t}),\n\t\tmessage: Typesafe.object({\n\t\t\tmessage: Typesafe.string,\n\t\t}),\n\t\tready: Typesafe.object({}),\n\n\t\tworkerStarted: Typesafe.object({\n\t\t\tworkerId: Typesafe.string,\n\t\t}),\n\t\tworkedStopped: Typesafe.object({\n\t\t\tworkerId: Typesafe.string,\n\t\t}),\n\t\tworkerFailedToStart: Typesafe.object({\n\t\t\tworkerId: Typesafe.string,\n\t\t}),\n\t\tworkerCrashed: Typesafe.object({\n\t\t\tworkerId: Typesafe.string,\n\t\t}),\n\t},\n)\n\ntype OutgoingMessage = ReturnType<typeof OutgoingMessage>\n\nexport class ActionsWebsocketControllerFactory {\n\tconstructor(\n\t\tprivate readonly debug: boolean,\n\t\tprivate readonly actionsContextResolver: ActionsContextResolver,\n\t\tprivate readonly dispatchWorkerSupervisorFactory: DispatchWorkerSupervisorFactory,\n\t) {\n\t}\n\n\tcreate(): WebSocketController {\n\t\treturn async ctx => {\n\t\t\tconst { ws, logger, authResult, projectGroup } = ctx\n\t\t\tif (!authResult) {\n\t\t\t\tthrow new HttpErrorResponse(401, 'Authentication required')\n\t\t\t}\n\t\t\tif (!authResult.roles.some(it => it === TenantRole.SUPER_ADMIN || it === TenantRole.PROJECT_ADMIN)) {\n\t\t\t\tthrow new HttpErrorResponse(403, 'Not allowed to run actions worker')\n\t\t\t}\n\n\t\t\tconst send = (message: OutgoingMessage) => {\n\t\t\t\tif (this.debug) {\n\t\t\t\t\tOutgoingMessage(message)\n\t\t\t\t}\n\t\t\t\tws.send(JSON.stringify(message))\n\t\t\t}\n\n\t\t\tlet workers: { id: string; running: Promise<Running> }[] = []\n\t\t\tconst abortListener = async () => {\n\t\t\t\tsend({ type: 'message', message: 'shutting down' })\n\t\t\t\tawait stopAll()\n\t\t\t\tsend({ type: 'message', message: 'closing connection' })\n\t\t\t\tws.close(1012) // Service Restart\n\t\t\t}\n\t\t\tctx.abortSignal.addEventListener('abort', abortListener)\n\n\t\t\tconst stopAll = async () => {\n\t\t\t\tconst currentWorkers = workers.map(async it => {\n\t\t\t\t\tawait (await it.running).end()\n\t\t\t\t\tsend({\n\t\t\t\t\t\ttype: 'workedStopped',\n\t\t\t\t\t\tworkerId: it.id,\n\t\t\t\t\t})\n\t\t\t\t})\n\t\t\t\tworkers = []\n\t\t\t\tawait Promise.all(currentWorkers)\n\t\t\t}\n\t\t\tsend({ type: 'ready' })\n\n\t\t\tws.addEventListener('message', async message => {\n\t\t\t\tlet json\n\t\t\t\ttry {\n\t\t\t\t\tjson = JSON.parse(message.data.toString())\n\t\t\t\t} catch {\n\t\t\t\t\tsend({ type: 'error', message: 'Invalid JSON' })\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tlet data: IncomingMessage\n\t\t\t\ttry {\n\t\t\t\t\tdata = IncomingMessage(json)\n\t\t\t\t} catch (e) {\n\t\t\t\t\tif (e instanceof Typesafe.ParseError) {\n\t\t\t\t\t\tsend({ type: 'error', message: e.message })\n\t\t\t\t\t\treturn\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthrow e\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tswitch (data.type) {\n\t\t\t\t\tcase 'startWorker':\n\t\t\t\t\t\tconst workerId = Math.random().toString().substring(2)\n\t\t\t\t\t\tconst dispatchSupervisor = this.dispatchWorkerSupervisorFactory.create(projectGroup)\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tconst running = dispatchSupervisor.run({ logger, onError: () => {\n\t\t\t\t\t\t\t\tsend({ type: 'workerCrashed', workerId })\n\t\t\t\t\t\t\t} })\n\t\t\t\t\t\t\tworkers.push({ id: workerId, running })\n\t\t\t\t\t\t\tawait running\n\t\t\t\t\t\t\tsend({ type: 'workerStarted', workerId })\n\t\t\t\t\t\t} catch (e) {\n\t\t\t\t\t\t\tlogger.error(e, { message: 'Worker failed to start' })\n\t\t\t\t\t\t\tsend({ type: 'workerFailedToStart', workerId })\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak\n\t\t\t\t\tcase 'stopAllWorkers':\n\t\t\t\t\t\tsend({ type: 'message', message: 'stopping' })\n\t\t\t\t\t\tawait stopAll()\n\t\t\t\t\t\tsend({ type: 'message', message: 'all stopped' })\n\t\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t})\n\n\t\t\tconst pingHandle = setInterval(() => {\n\t\t\t\tws.ping()\n\t\t\t}, 5000)\n\n\t\t\tws.addEventListener('close', async () => {\n\t\t\t\tctx.abortSignal.removeEventListener('abort', abortListener)\n\t\t\t\tclearInterval(pingHandle)\n\t\t\t\tawait stopAll()\n\t\t\t})\n\t\t}\n\t}\n}\n\n"],"names":[],"mappings":"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"}
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const graphqlUtils = require("@contember/graphql-utils");
4
+ class ResolversFactory {
5
+ constructor(eventsQueryResolver, processBatchMutationResolver, variablesQueryResolver, setVariablesMutationResolver) {
6
+ this.eventsQueryResolver = eventsQueryResolver;
7
+ this.processBatchMutationResolver = processBatchMutationResolver;
8
+ this.variablesQueryResolver = variablesQueryResolver;
9
+ this.setVariablesMutationResolver = setVariablesMutationResolver;
10
+ }
11
+ create() {
12
+ const resolvers = {
13
+ Json: graphqlUtils.JSONType,
14
+ DateTime: graphqlUtils.DateTimeType,
15
+ Uuid: graphqlUtils.UuidType,
16
+ Mutation: {
17
+ processBatch: this.processBatchMutationResolver.processBatch.bind(this.processBatchMutationResolver),
18
+ setVariables: this.setVariablesMutationResolver.setVariables.bind(this.setVariablesMutationResolver)
19
+ },
20
+ Query: {
21
+ eventsInProcessing: this.eventsQueryResolver.eventsInProcessing.bind(this.eventsQueryResolver),
22
+ eventsToProcess: this.eventsQueryResolver.eventsToProcess.bind(this.eventsQueryResolver),
23
+ failedEvents: this.eventsQueryResolver.failedEvents.bind(this.eventsQueryResolver),
24
+ variables: this.variablesQueryResolver.variables.bind(this.variablesQueryResolver)
25
+ }
26
+ };
27
+ return resolvers;
28
+ }
29
+ }
30
+ exports.ResolversFactory = ResolversFactory;
31
+ //# sourceMappingURL=ResolversFactory.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ResolversFactory.cjs","sources":["../../../../../../packages/engine-actions/src/graphql/resolvers/ResolversFactory.ts"],"sourcesContent":["import { DateTimeType, JSONType, UuidType } from '@contember/graphql-utils'\nimport { Resolvers } from '../schema'\nimport { EventsQueryResolver } from './query'\nimport { ProcessBatchMutationResolver, SetVariablesMutationResolver } from './mutation'\nimport { ActionsContext } from './ActionsContext'\nimport { VariablesQueryResolver } from './query/VariablesQueryResolver'\n\nexport class ResolversFactory {\n\tconstructor(\n\t\tprivate readonly eventsQueryResolver: EventsQueryResolver,\n\t\tprivate readonly processBatchMutationResolver: ProcessBatchMutationResolver,\n\t\tprivate readonly variablesQueryResolver: VariablesQueryResolver,\n\t\tprivate readonly setVariablesMutationResolver: SetVariablesMutationResolver,\n\t) {\n\t}\n\n\tcreate(): Resolvers {\n\t\tconst resolvers: Resolvers<ActionsContext> & { Mutation: Required<Resolvers<ActionsContext>['Mutation']> } & { Query: Required<Resolvers<ActionsContext>['Query']> } = {\n\t\t\tJson: JSONType,\n\t\t\tDateTime: DateTimeType,\n\t\t\tUuid: UuidType,\n\t\t\tMutation: {\n\t\t\t\tprocessBatch: this.processBatchMutationResolver.processBatch.bind(this.processBatchMutationResolver),\n\t\t\t\tsetVariables: this.setVariablesMutationResolver.setVariables.bind(this.setVariablesMutationResolver),\n\t\t\t},\n\t\t\tQuery: {\n\t\t\t\teventsInProcessing: this.eventsQueryResolver.eventsInProcessing.bind(this.eventsQueryResolver),\n\t\t\t\teventsToProcess: this.eventsQueryResolver.eventsToProcess.bind(this.eventsQueryResolver),\n\t\t\t\tfailedEvents: this.eventsQueryResolver.failedEvents.bind(this.eventsQueryResolver),\n\t\t\t\tvariables: this.variablesQueryResolver.variables.bind(this.variablesQueryResolver),\n\t\t\t},\n\t\t}\n\t\treturn resolvers\n\t}\n}\n"],"names":["JSONType","DateTimeType","UuidType"],"mappings":";;;AAOO,MAAM,iBAAiB;AAAA,EAC7B,YACkB,qBACA,8BACA,wBACA,8BAChB;AAJgB,SAAA,sBAAA;AACA,SAAA,+BAAA;AACA,SAAA,yBAAA;AACA,SAAA,+BAAA;AAAA,EAElB;AAAA,EAEA,SAAoB;AACnB,UAAM,YAAiK;AAAA,MACtK,MAAMA,aAAA;AAAA,MACN,UAAUC,aAAA;AAAA,MACV,MAAMC,aAAA;AAAA,MACN,UAAU;AAAA,QACT,cAAc,KAAK,6BAA6B,aAAa,KAAK,KAAK,4BAA4B;AAAA,QACnG,cAAc,KAAK,6BAA6B,aAAa,KAAK,KAAK,4BAA4B;AAAA,MACpG;AAAA,MACA,OAAO;AAAA,QACN,oBAAoB,KAAK,oBAAoB,mBAAmB,KAAK,KAAK,mBAAmB;AAAA,QAC7F,iBAAiB,KAAK,oBAAoB,gBAAgB,KAAK,KAAK,mBAAmB;AAAA,QACvF,cAAc,KAAK,oBAAoB,aAAa,KAAK,KAAK,mBAAmB;AAAA,QACjF,WAAW,KAAK,uBAAuB,UAAU,KAAK,KAAK,sBAAsB;AAAA,MAClF;AAAA,IAAA;AAEM,WAAA;AAAA,EACR;AACD;;"}
@@ -0,0 +1,31 @@
1
+ import { JSONType, DateTimeType, UuidType } from "@contember/graphql-utils";
2
+ class ResolversFactory {
3
+ constructor(eventsQueryResolver, processBatchMutationResolver, variablesQueryResolver, setVariablesMutationResolver) {
4
+ this.eventsQueryResolver = eventsQueryResolver;
5
+ this.processBatchMutationResolver = processBatchMutationResolver;
6
+ this.variablesQueryResolver = variablesQueryResolver;
7
+ this.setVariablesMutationResolver = setVariablesMutationResolver;
8
+ }
9
+ create() {
10
+ const resolvers = {
11
+ Json: JSONType,
12
+ DateTime: DateTimeType,
13
+ Uuid: UuidType,
14
+ Mutation: {
15
+ processBatch: this.processBatchMutationResolver.processBatch.bind(this.processBatchMutationResolver),
16
+ setVariables: this.setVariablesMutationResolver.setVariables.bind(this.setVariablesMutationResolver)
17
+ },
18
+ Query: {
19
+ eventsInProcessing: this.eventsQueryResolver.eventsInProcessing.bind(this.eventsQueryResolver),
20
+ eventsToProcess: this.eventsQueryResolver.eventsToProcess.bind(this.eventsQueryResolver),
21
+ failedEvents: this.eventsQueryResolver.failedEvents.bind(this.eventsQueryResolver),
22
+ variables: this.variablesQueryResolver.variables.bind(this.variablesQueryResolver)
23
+ }
24
+ };
25
+ return resolvers;
26
+ }
27
+ }
28
+ export {
29
+ ResolversFactory
30
+ };
31
+ //# sourceMappingURL=ResolversFactory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ResolversFactory.js","sources":["../../../../../../packages/engine-actions/src/graphql/resolvers/ResolversFactory.ts"],"sourcesContent":["import { DateTimeType, JSONType, UuidType } from '@contember/graphql-utils'\nimport { Resolvers } from '../schema'\nimport { EventsQueryResolver } from './query'\nimport { ProcessBatchMutationResolver, SetVariablesMutationResolver } from './mutation'\nimport { ActionsContext } from './ActionsContext'\nimport { VariablesQueryResolver } from './query/VariablesQueryResolver'\n\nexport class ResolversFactory {\n\tconstructor(\n\t\tprivate readonly eventsQueryResolver: EventsQueryResolver,\n\t\tprivate readonly processBatchMutationResolver: ProcessBatchMutationResolver,\n\t\tprivate readonly variablesQueryResolver: VariablesQueryResolver,\n\t\tprivate readonly setVariablesMutationResolver: SetVariablesMutationResolver,\n\t) {\n\t}\n\n\tcreate(): Resolvers {\n\t\tconst resolvers: Resolvers<ActionsContext> & { Mutation: Required<Resolvers<ActionsContext>['Mutation']> } & { Query: Required<Resolvers<ActionsContext>['Query']> } = {\n\t\t\tJson: JSONType,\n\t\t\tDateTime: DateTimeType,\n\t\t\tUuid: UuidType,\n\t\t\tMutation: {\n\t\t\t\tprocessBatch: this.processBatchMutationResolver.processBatch.bind(this.processBatchMutationResolver),\n\t\t\t\tsetVariables: this.setVariablesMutationResolver.setVariables.bind(this.setVariablesMutationResolver),\n\t\t\t},\n\t\t\tQuery: {\n\t\t\t\teventsInProcessing: this.eventsQueryResolver.eventsInProcessing.bind(this.eventsQueryResolver),\n\t\t\t\teventsToProcess: this.eventsQueryResolver.eventsToProcess.bind(this.eventsQueryResolver),\n\t\t\t\tfailedEvents: this.eventsQueryResolver.failedEvents.bind(this.eventsQueryResolver),\n\t\t\t\tvariables: this.variablesQueryResolver.variables.bind(this.variablesQueryResolver),\n\t\t\t},\n\t\t}\n\t\treturn resolvers\n\t}\n}\n"],"names":[],"mappings":";AAOO,MAAM,iBAAiB;AAAA,EAC7B,YACkB,qBACA,8BACA,wBACA,8BAChB;AAJgB,SAAA,sBAAA;AACA,SAAA,+BAAA;AACA,SAAA,yBAAA;AACA,SAAA,+BAAA;AAAA,EAElB;AAAA,EAEA,SAAoB;AACnB,UAAM,YAAiK;AAAA,MACtK,MAAM;AAAA,MACN,UAAU;AAAA,MACV,MAAM;AAAA,MACN,UAAU;AAAA,QACT,cAAc,KAAK,6BAA6B,aAAa,KAAK,KAAK,4BAA4B;AAAA,QACnG,cAAc,KAAK,6BAA6B,aAAa,KAAK,KAAK,4BAA4B;AAAA,MACpG;AAAA,MACA,OAAO;AAAA,QACN,oBAAoB,KAAK,oBAAoB,mBAAmB,KAAK,KAAK,mBAAmB;AAAA,QAC7F,iBAAiB,KAAK,oBAAoB,gBAAgB,KAAK,KAAK,mBAAmB;AAAA,QACvF,cAAc,KAAK,oBAAoB,aAAa,KAAK,KAAK,mBAAmB;AAAA,QACjF,WAAW,KAAK,uBAAuB,UAAU,KAAK,KAAK,sBAAsB;AAAA,MAClF;AAAA,IAAA;AAEM,WAAA;AAAA,EACR;AACD;"}
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const ActionsAuthorizationActions = require("../../../authorization/ActionsAuthorizationActions.cjs");
4
+ require("@contember/authorization");
5
+ require("@contember/schema");
6
+ class ProcessBatchMutationResolver {
7
+ constructor(eventDispatcher) {
8
+ this.eventDispatcher = eventDispatcher;
9
+ }
10
+ async processBatch(parent, args, ctx) {
11
+ await ctx.requireAccess(ActionsAuthorizationActions.ActionsAuthorizationActions.EVENTS_PROCESS);
12
+ await this.eventDispatcher.processBatch(ctx);
13
+ return {
14
+ ok: true
15
+ };
16
+ }
17
+ }
18
+ exports.ProcessBatchMutationResolver = ProcessBatchMutationResolver;
19
+ //# sourceMappingURL=ProcessBatchMutationResolver.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ProcessBatchMutationResolver.cjs","sources":["../../../../../../../packages/engine-actions/src/graphql/resolvers/mutation/ProcessBatchMutationResolver.ts"],"sourcesContent":["import { MutationResolvers } from '../../schema'\nimport { ActionsContext } from '../ActionsContext'\nimport { EventDispatcher } from '../../../dispatch/EventDispatcher'\nimport { ActionsAuthorizationActions } from '../../../authorization'\n\nexport class ProcessBatchMutationResolver implements MutationResolvers<ActionsContext> {\n\tconstructor(\n\t\tprivate eventDispatcher: EventDispatcher,\n\t) {\n\t}\n\tasync processBatch(parent: unknown, args: unknown, ctx: ActionsContext) {\n\t\tawait ctx.requireAccess(ActionsAuthorizationActions.EVENTS_PROCESS)\n\n\t\tawait this.eventDispatcher.processBatch(ctx)\n\t\treturn {\n\t\t\tok: true,\n\t\t}\n\t}\n}\n"],"names":["ActionsAuthorizationActions"],"mappings":";;;;;AAKO,MAAM,6BAA0E;AAAA,EACtF,YACS,iBACP;AADO,SAAA,kBAAA;AAAA,EAET;AAAA,EACA,MAAM,aAAa,QAAiB,MAAe,KAAqB;AACjE,UAAA,IAAI,cAAcA,4BAAA,4BAA4B,cAAc;AAE5D,UAAA,KAAK,gBAAgB,aAAa,GAAG;AACpC,WAAA;AAAA,MACN,IAAI;AAAA,IAAA;AAAA,EAEN;AACD;;"}