@contember/engine-actions 2.1.0-alpha.3 → 2.1.0-alpha.35
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.
- package/graphql.codegen.yml +2 -2
- package/package.json +27 -22
- package/src/ActionsExecutionContainerHookFactory.ts +23 -11
- package/src/authorization/ActionsAuthorizationActions.ts +2 -0
- package/src/dispatch/DispatchWorkerSupervisor.ts +17 -16
- package/src/dispatch/EventDispatcher.ts +0 -2
- package/src/dispatch/EventsRepository.ts +63 -43
- package/src/dispatch/ProjectDispatcher.ts +6 -11
- package/src/dispatch/WebhookTargetHandler.ts +18 -9
- package/src/dispatch/types.ts +1 -2
- package/src/graphql/http/ActionsApiMiddlewareFactory.ts +7 -5
- package/src/graphql/http/ActionsContextResolver.ts +1 -2
- package/src/graphql/http/ActionsGraphQLHandlerFactory.ts +0 -1
- package/src/graphql/http/ActionsWebsocketControllerFactory.ts +7 -5
- package/src/graphql/resolvers/ActionsContext.ts +1 -0
- package/src/graphql/resolvers/ResolversFactory.ts +9 -2
- package/src/graphql/resolvers/mutation/RetryEventMutationResolver.ts +22 -0
- package/src/graphql/resolvers/mutation/SetVariablesMutationResolver.ts +0 -1
- package/src/graphql/resolvers/mutation/StopEventMutationResolver.ts +19 -0
- package/src/graphql/resolvers/mutation/index.ts +2 -0
- package/src/graphql/resolvers/query/EventsQueryResolver.ts +15 -8
- package/src/graphql/resolvers/query/VariablesQueryResolver.ts +0 -1
- package/src/graphql/schema/actions.graphql.ts +18 -4
- package/src/graphql/schema/index.ts +84 -30
- package/src/index.ts +55 -30
- package/src/migrations/2023-03-10-145000-actions-variables.ts +1 -1
- package/src/migrations/2025-05-28-160000-action-event-user.ts +16 -0
- package/src/migrations/index.ts +2 -0
- package/src/migrations/snapshot.ts +6 -3
- package/src/model/EventByIdQuery.ts +21 -0
- package/src/model/EventsToProcessSpecification.ts +9 -8
- package/src/model/SetVariableCommand.ts +0 -1
- package/src/model/types.ts +3 -0
- package/src/triggers/TriggerHandler.ts +16 -15
- package/src/triggers/TriggerIndirectChangesFetcher.ts +62 -3
- package/src/triggers/TriggerListeners.ts +1 -8
- package/src/triggers/TriggerListenersBuilder.ts +3 -6
- package/src/triggers/TriggerListenersStore.ts +2 -2
- package/src/triggers/TriggerPayloadBuilder.ts +43 -13
- package/src/triggers/TriggerPayloadManager.ts +2 -4
- package/src/triggers/TriggerPayloadPersister.ts +8 -3
- package/src/utils/notifyChannel.ts +6 -0
- package/tests/cases/unit/generator.test.ts +133 -136
- package/tests/cases/unit/webhookHandler.test.ts +47 -35
- package/dist/development/index.cjs +0 -94
- package/dist/development/index.cjs.map +0 -1
- package/dist/development/index.js +0 -94
- package/dist/development/index.js.map +0 -1
- package/dist/development/src/ActionsExecutionContainerHookFactory.cjs +0 -30
- package/dist/development/src/ActionsExecutionContainerHookFactory.cjs.map +0 -1
- package/dist/development/src/ActionsExecutionContainerHookFactory.js +0 -30
- package/dist/development/src/ActionsExecutionContainerHookFactory.js.map +0 -1
- package/dist/development/src/ImplementationException.cjs +0 -6
- package/dist/development/src/ImplementationException.cjs.map +0 -1
- package/dist/development/src/ImplementationException.js +0 -6
- package/dist/development/src/ImplementationException.js.map +0 -1
- package/dist/development/src/ListenerStoreProvider.cjs +0 -25
- package/dist/development/src/ListenerStoreProvider.cjs.map +0 -1
- package/dist/development/src/ListenerStoreProvider.js +0 -25
- package/dist/development/src/ListenerStoreProvider.js.map +0 -1
- package/dist/development/src/authorization/ActionsAuthorizationActions.cjs +0 -15
- package/dist/development/src/authorization/ActionsAuthorizationActions.cjs.map +0 -1
- package/dist/development/src/authorization/ActionsAuthorizationActions.js +0 -16
- package/dist/development/src/authorization/ActionsAuthorizationActions.js.map +0 -1
- package/dist/development/src/authorization/ActionsPermissionsFactory.cjs +0 -16
- package/dist/development/src/authorization/ActionsPermissionsFactory.cjs.map +0 -1
- package/dist/development/src/authorization/ActionsPermissionsFactory.js +0 -16
- package/dist/development/src/authorization/ActionsPermissionsFactory.js.map +0 -1
- package/dist/development/src/dispatch/DispatchWorkerSupervisor.cjs +0 -125
- package/dist/development/src/dispatch/DispatchWorkerSupervisor.cjs.map +0 -1
- package/dist/development/src/dispatch/DispatchWorkerSupervisor.js +0 -125
- package/dist/development/src/dispatch/DispatchWorkerSupervisor.js.map +0 -1
- package/dist/development/src/dispatch/EventDispatcher.cjs +0 -43
- package/dist/development/src/dispatch/EventDispatcher.cjs.map +0 -1
- package/dist/development/src/dispatch/EventDispatcher.js +0 -43
- package/dist/development/src/dispatch/EventDispatcher.js.map +0 -1
- package/dist/development/src/dispatch/EventsRepository.cjs +0 -104
- package/dist/development/src/dispatch/EventsRepository.cjs.map +0 -1
- package/dist/development/src/dispatch/EventsRepository.js +0 -104
- package/dist/development/src/dispatch/EventsRepository.js.map +0 -1
- package/dist/development/src/dispatch/ProjectDispatcher.cjs +0 -99
- package/dist/development/src/dispatch/ProjectDispatcher.cjs.map +0 -1
- package/dist/development/src/dispatch/ProjectDispatcher.js +0 -99
- package/dist/development/src/dispatch/ProjectDispatcher.js.map +0 -1
- package/dist/development/src/dispatch/TargetHandlerResolver.cjs +0 -16
- package/dist/development/src/dispatch/TargetHandlerResolver.cjs.map +0 -1
- package/dist/development/src/dispatch/TargetHandlerResolver.js +0 -16
- package/dist/development/src/dispatch/TargetHandlerResolver.js.map +0 -1
- package/dist/development/src/dispatch/WebhookFetcher.cjs +0 -16
- package/dist/development/src/dispatch/WebhookFetcher.cjs.map +0 -1
- package/dist/development/src/dispatch/WebhookFetcher.js +0 -16
- package/dist/development/src/dispatch/WebhookFetcher.js.map +0 -1
- package/dist/development/src/dispatch/WebhookTargetHandler.cjs +0 -193
- package/dist/development/src/dispatch/WebhookTargetHandler.cjs.map +0 -1
- package/dist/development/src/dispatch/WebhookTargetHandler.js +0 -176
- package/dist/development/src/dispatch/WebhookTargetHandler.js.map +0 -1
- package/dist/development/src/graphql/http/ActionsApiMiddlewareFactory.cjs +0 -38
- package/dist/development/src/graphql/http/ActionsApiMiddlewareFactory.cjs.map +0 -1
- package/dist/development/src/graphql/http/ActionsApiMiddlewareFactory.js +0 -38
- package/dist/development/src/graphql/http/ActionsApiMiddlewareFactory.js.map +0 -1
- package/dist/development/src/graphql/http/ActionsContextResolver.cjs +0 -39
- package/dist/development/src/graphql/http/ActionsContextResolver.cjs.map +0 -1
- package/dist/development/src/graphql/http/ActionsContextResolver.js +0 -39
- package/dist/development/src/graphql/http/ActionsContextResolver.js.map +0 -1
- package/dist/development/src/graphql/http/ActionsGraphQLHandlerFactory.cjs +0 -20
- package/dist/development/src/graphql/http/ActionsGraphQLHandlerFactory.cjs.map +0 -1
- package/dist/development/src/graphql/http/ActionsGraphQLHandlerFactory.js +0 -20
- package/dist/development/src/graphql/http/ActionsGraphQLHandlerFactory.js.map +0 -1
- package/dist/development/src/graphql/http/ActionsWebsocketControllerFactory.cjs +0 -149
- package/dist/development/src/graphql/http/ActionsWebsocketControllerFactory.cjs.map +0 -1
- package/dist/development/src/graphql/http/ActionsWebsocketControllerFactory.js +0 -132
- package/dist/development/src/graphql/http/ActionsWebsocketControllerFactory.js.map +0 -1
- package/dist/development/src/graphql/resolvers/ResolversFactory.cjs +0 -31
- package/dist/development/src/graphql/resolvers/ResolversFactory.cjs.map +0 -1
- package/dist/development/src/graphql/resolvers/ResolversFactory.js +0 -31
- package/dist/development/src/graphql/resolvers/ResolversFactory.js.map +0 -1
- package/dist/development/src/graphql/resolvers/mutation/ProcessBatchMutationResolver.cjs +0 -19
- package/dist/development/src/graphql/resolvers/mutation/ProcessBatchMutationResolver.cjs.map +0 -1
- package/dist/development/src/graphql/resolvers/mutation/ProcessBatchMutationResolver.js +0 -19
- package/dist/development/src/graphql/resolvers/mutation/ProcessBatchMutationResolver.js.map +0 -1
- package/dist/development/src/graphql/resolvers/mutation/SetVariablesMutationResolver.cjs +0 -19
- package/dist/development/src/graphql/resolvers/mutation/SetVariablesMutationResolver.cjs.map +0 -1
- package/dist/development/src/graphql/resolvers/mutation/SetVariablesMutationResolver.js +0 -19
- package/dist/development/src/graphql/resolvers/mutation/SetVariablesMutationResolver.js.map +0 -1
- package/dist/development/src/graphql/resolvers/query/EventsQueryResolver.cjs +0 -48
- package/dist/development/src/graphql/resolvers/query/EventsQueryResolver.cjs.map +0 -1
- package/dist/development/src/graphql/resolvers/query/EventsQueryResolver.js +0 -48
- package/dist/development/src/graphql/resolvers/query/EventsQueryResolver.js.map +0 -1
- package/dist/development/src/graphql/resolvers/query/VariablesQueryResolver.cjs +0 -19
- package/dist/development/src/graphql/resolvers/query/VariablesQueryResolver.cjs.map +0 -1
- package/dist/development/src/graphql/resolvers/query/VariablesQueryResolver.js +0 -19
- package/dist/development/src/graphql/resolvers/query/VariablesQueryResolver.js.map +0 -1
- package/dist/development/src/graphql/schema/actions.graphql.cjs +0 -93
- package/dist/development/src/graphql/schema/actions.graphql.cjs.map +0 -1
- package/dist/development/src/graphql/schema/actions.graphql.js +0 -93
- package/dist/development/src/graphql/schema/actions.graphql.js.map +0 -1
- package/dist/development/src/migrations/2023-03-10-145000-actions-variables.cjs +0 -16
- package/dist/development/src/migrations/2023-03-10-145000-actions-variables.cjs.map +0 -1
- package/dist/development/src/migrations/2023-03-10-145000-actions-variables.js +0 -17
- package/dist/development/src/migrations/2023-03-10-145000-actions-variables.js.map +0 -1
- package/dist/development/src/migrations/index.cjs +0 -10
- package/dist/development/src/migrations/index.cjs.map +0 -1
- package/dist/development/src/migrations/index.js +0 -10
- package/dist/development/src/migrations/index.js.map +0 -1
- package/dist/development/src/migrations/snapshot.cjs +0 -48
- package/dist/development/src/migrations/snapshot.cjs.map +0 -1
- package/dist/development/src/migrations/snapshot.js +0 -49
- package/dist/development/src/migrations/snapshot.js.map +0 -1
- package/dist/development/src/model/EventsInProcessingQuery.cjs +0 -14
- package/dist/development/src/model/EventsInProcessingQuery.cjs.map +0 -1
- package/dist/development/src/model/EventsInProcessingQuery.js +0 -14
- package/dist/development/src/model/EventsInProcessingQuery.js.map +0 -1
- package/dist/development/src/model/EventsToProcessQuery.cjs +0 -15
- package/dist/development/src/model/EventsToProcessQuery.cjs.map +0 -1
- package/dist/development/src/model/EventsToProcessQuery.js +0 -15
- package/dist/development/src/model/EventsToProcessQuery.js.map +0 -1
- package/dist/development/src/model/EventsToProcessSpecification.cjs +0 -8
- package/dist/development/src/model/EventsToProcessSpecification.cjs.map +0 -1
- package/dist/development/src/model/EventsToProcessSpecification.js +0 -8
- package/dist/development/src/model/EventsToProcessSpecification.js.map +0 -1
- package/dist/development/src/model/FailedEventsQuery.cjs +0 -14
- package/dist/development/src/model/FailedEventsQuery.cjs.map +0 -1
- package/dist/development/src/model/FailedEventsQuery.js +0 -14
- package/dist/development/src/model/FailedEventsQuery.js.map +0 -1
- package/dist/development/src/model/SetVariableCommand.cjs +0 -21
- package/dist/development/src/model/SetVariableCommand.cjs.map +0 -1
- package/dist/development/src/model/SetVariableCommand.js +0 -21
- package/dist/development/src/model/SetVariableCommand.js.map +0 -1
- package/dist/development/src/model/VariablesManager.cjs +0 -41
- package/dist/development/src/model/VariablesManager.cjs.map +0 -1
- package/dist/development/src/model/VariablesManager.js +0 -41
- package/dist/development/src/model/VariablesManager.js.map +0 -1
- package/dist/development/src/model/VariablesQuery.cjs +0 -10
- package/dist/development/src/model/VariablesQuery.cjs.map +0 -1
- package/dist/development/src/model/VariablesQuery.js +0 -10
- package/dist/development/src/model/VariablesQuery.js.map +0 -1
- package/dist/development/src/triggers/TriggerHandler.cjs +0 -126
- package/dist/development/src/triggers/TriggerHandler.cjs.map +0 -1
- package/dist/development/src/triggers/TriggerHandler.js +0 -126
- package/dist/development/src/triggers/TriggerHandler.js.map +0 -1
- package/dist/development/src/triggers/TriggerIndirectChangesFetcher.cjs +0 -21
- package/dist/development/src/triggers/TriggerIndirectChangesFetcher.cjs.map +0 -1
- package/dist/development/src/triggers/TriggerIndirectChangesFetcher.js +0 -21
- package/dist/development/src/triggers/TriggerIndirectChangesFetcher.js.map +0 -1
- package/dist/development/src/triggers/TriggerListenersBuilder.cjs +0 -169
- package/dist/development/src/triggers/TriggerListenersBuilder.cjs.map +0 -1
- package/dist/development/src/triggers/TriggerListenersBuilder.js +0 -169
- package/dist/development/src/triggers/TriggerListenersBuilder.js.map +0 -1
- package/dist/development/src/triggers/TriggerListenersFactory.cjs +0 -17
- package/dist/development/src/triggers/TriggerListenersFactory.cjs.map +0 -1
- package/dist/development/src/triggers/TriggerListenersFactory.js +0 -17
- package/dist/development/src/triggers/TriggerListenersFactory.js.map +0 -1
- package/dist/development/src/triggers/TriggerListenersStore.cjs +0 -24
- package/dist/development/src/triggers/TriggerListenersStore.cjs.map +0 -1
- package/dist/development/src/triggers/TriggerListenersStore.js +0 -24
- package/dist/development/src/triggers/TriggerListenersStore.js.map +0 -1
- package/dist/development/src/triggers/TriggerPayloadBuilder.cjs +0 -134
- package/dist/development/src/triggers/TriggerPayloadBuilder.cjs.map +0 -1
- package/dist/development/src/triggers/TriggerPayloadBuilder.js +0 -134
- package/dist/development/src/triggers/TriggerPayloadBuilder.js.map +0 -1
- package/dist/development/src/triggers/TriggerPayloadManager.cjs +0 -27
- package/dist/development/src/triggers/TriggerPayloadManager.cjs.map +0 -1
- package/dist/development/src/triggers/TriggerPayloadManager.js +0 -27
- package/dist/development/src/triggers/TriggerPayloadManager.js.map +0 -1
- package/dist/development/src/triggers/TriggerPayloadPersister.cjs +0 -43
- package/dist/development/src/triggers/TriggerPayloadPersister.cjs.map +0 -1
- package/dist/development/src/triggers/TriggerPayloadPersister.js +0 -43
- package/dist/development/src/triggers/TriggerPayloadPersister.js.map +0 -1
- package/dist/development/src/utils/assertNever.cjs +0 -7
- package/dist/development/src/utils/assertNever.cjs.map +0 -1
- package/dist/development/src/utils/assertNever.js +0 -7
- package/dist/development/src/utils/assertNever.js.map +0 -1
- package/dist/development/src/utils/map.cjs +0 -13
- package/dist/development/src/utils/map.cjs.map +0 -1
- package/dist/development/src/utils/map.js +0 -13
- package/dist/development/src/utils/map.js.map +0 -1
- package/dist/production/index.cjs +0 -94
- package/dist/production/index.cjs.map +0 -1
- package/dist/production/index.js +0 -94
- package/dist/production/index.js.map +0 -1
- package/dist/production/src/ActionsExecutionContainerHookFactory.cjs +0 -30
- package/dist/production/src/ActionsExecutionContainerHookFactory.cjs.map +0 -1
- package/dist/production/src/ActionsExecutionContainerHookFactory.js +0 -30
- package/dist/production/src/ActionsExecutionContainerHookFactory.js.map +0 -1
- package/dist/production/src/ImplementationException.cjs +0 -6
- package/dist/production/src/ImplementationException.cjs.map +0 -1
- package/dist/production/src/ImplementationException.js +0 -6
- package/dist/production/src/ImplementationException.js.map +0 -1
- package/dist/production/src/ListenerStoreProvider.cjs +0 -25
- package/dist/production/src/ListenerStoreProvider.cjs.map +0 -1
- package/dist/production/src/ListenerStoreProvider.js +0 -25
- package/dist/production/src/ListenerStoreProvider.js.map +0 -1
- package/dist/production/src/authorization/ActionsAuthorizationActions.cjs +0 -15
- package/dist/production/src/authorization/ActionsAuthorizationActions.cjs.map +0 -1
- package/dist/production/src/authorization/ActionsAuthorizationActions.js +0 -16
- package/dist/production/src/authorization/ActionsAuthorizationActions.js.map +0 -1
- package/dist/production/src/authorization/ActionsPermissionsFactory.cjs +0 -16
- package/dist/production/src/authorization/ActionsPermissionsFactory.cjs.map +0 -1
- package/dist/production/src/authorization/ActionsPermissionsFactory.js +0 -16
- package/dist/production/src/authorization/ActionsPermissionsFactory.js.map +0 -1
- package/dist/production/src/dispatch/DispatchWorkerSupervisor.cjs +0 -125
- package/dist/production/src/dispatch/DispatchWorkerSupervisor.cjs.map +0 -1
- package/dist/production/src/dispatch/DispatchWorkerSupervisor.js +0 -125
- package/dist/production/src/dispatch/DispatchWorkerSupervisor.js.map +0 -1
- package/dist/production/src/dispatch/EventDispatcher.cjs +0 -43
- package/dist/production/src/dispatch/EventDispatcher.cjs.map +0 -1
- package/dist/production/src/dispatch/EventDispatcher.js +0 -43
- package/dist/production/src/dispatch/EventDispatcher.js.map +0 -1
- package/dist/production/src/dispatch/EventsRepository.cjs +0 -104
- package/dist/production/src/dispatch/EventsRepository.cjs.map +0 -1
- package/dist/production/src/dispatch/EventsRepository.js +0 -104
- package/dist/production/src/dispatch/EventsRepository.js.map +0 -1
- package/dist/production/src/dispatch/ProjectDispatcher.cjs +0 -99
- package/dist/production/src/dispatch/ProjectDispatcher.cjs.map +0 -1
- package/dist/production/src/dispatch/ProjectDispatcher.js +0 -99
- package/dist/production/src/dispatch/ProjectDispatcher.js.map +0 -1
- package/dist/production/src/dispatch/TargetHandlerResolver.cjs +0 -16
- package/dist/production/src/dispatch/TargetHandlerResolver.cjs.map +0 -1
- package/dist/production/src/dispatch/TargetHandlerResolver.js +0 -16
- package/dist/production/src/dispatch/TargetHandlerResolver.js.map +0 -1
- package/dist/production/src/dispatch/WebhookFetcher.cjs +0 -16
- package/dist/production/src/dispatch/WebhookFetcher.cjs.map +0 -1
- package/dist/production/src/dispatch/WebhookFetcher.js +0 -16
- package/dist/production/src/dispatch/WebhookFetcher.js.map +0 -1
- package/dist/production/src/dispatch/WebhookTargetHandler.cjs +0 -193
- package/dist/production/src/dispatch/WebhookTargetHandler.cjs.map +0 -1
- package/dist/production/src/dispatch/WebhookTargetHandler.js +0 -176
- package/dist/production/src/dispatch/WebhookTargetHandler.js.map +0 -1
- package/dist/production/src/graphql/http/ActionsApiMiddlewareFactory.cjs +0 -38
- package/dist/production/src/graphql/http/ActionsApiMiddlewareFactory.cjs.map +0 -1
- package/dist/production/src/graphql/http/ActionsApiMiddlewareFactory.js +0 -38
- package/dist/production/src/graphql/http/ActionsApiMiddlewareFactory.js.map +0 -1
- package/dist/production/src/graphql/http/ActionsContextResolver.cjs +0 -39
- package/dist/production/src/graphql/http/ActionsContextResolver.cjs.map +0 -1
- package/dist/production/src/graphql/http/ActionsContextResolver.js +0 -39
- package/dist/production/src/graphql/http/ActionsContextResolver.js.map +0 -1
- package/dist/production/src/graphql/http/ActionsGraphQLHandlerFactory.cjs +0 -20
- package/dist/production/src/graphql/http/ActionsGraphQLHandlerFactory.cjs.map +0 -1
- package/dist/production/src/graphql/http/ActionsGraphQLHandlerFactory.js +0 -20
- package/dist/production/src/graphql/http/ActionsGraphQLHandlerFactory.js.map +0 -1
- package/dist/production/src/graphql/http/ActionsWebsocketControllerFactory.cjs +0 -149
- package/dist/production/src/graphql/http/ActionsWebsocketControllerFactory.cjs.map +0 -1
- package/dist/production/src/graphql/http/ActionsWebsocketControllerFactory.js +0 -132
- package/dist/production/src/graphql/http/ActionsWebsocketControllerFactory.js.map +0 -1
- package/dist/production/src/graphql/resolvers/ResolversFactory.cjs +0 -31
- package/dist/production/src/graphql/resolvers/ResolversFactory.cjs.map +0 -1
- package/dist/production/src/graphql/resolvers/ResolversFactory.js +0 -31
- package/dist/production/src/graphql/resolvers/ResolversFactory.js.map +0 -1
- package/dist/production/src/graphql/resolvers/mutation/ProcessBatchMutationResolver.cjs +0 -19
- package/dist/production/src/graphql/resolvers/mutation/ProcessBatchMutationResolver.cjs.map +0 -1
- package/dist/production/src/graphql/resolvers/mutation/ProcessBatchMutationResolver.js +0 -19
- package/dist/production/src/graphql/resolvers/mutation/ProcessBatchMutationResolver.js.map +0 -1
- package/dist/production/src/graphql/resolvers/mutation/SetVariablesMutationResolver.cjs +0 -19
- package/dist/production/src/graphql/resolvers/mutation/SetVariablesMutationResolver.cjs.map +0 -1
- package/dist/production/src/graphql/resolvers/mutation/SetVariablesMutationResolver.js +0 -19
- package/dist/production/src/graphql/resolvers/mutation/SetVariablesMutationResolver.js.map +0 -1
- package/dist/production/src/graphql/resolvers/query/EventsQueryResolver.cjs +0 -48
- package/dist/production/src/graphql/resolvers/query/EventsQueryResolver.cjs.map +0 -1
- package/dist/production/src/graphql/resolvers/query/EventsQueryResolver.js +0 -48
- package/dist/production/src/graphql/resolvers/query/EventsQueryResolver.js.map +0 -1
- package/dist/production/src/graphql/resolvers/query/VariablesQueryResolver.cjs +0 -19
- package/dist/production/src/graphql/resolvers/query/VariablesQueryResolver.cjs.map +0 -1
- package/dist/production/src/graphql/resolvers/query/VariablesQueryResolver.js +0 -19
- package/dist/production/src/graphql/resolvers/query/VariablesQueryResolver.js.map +0 -1
- package/dist/production/src/graphql/schema/actions.graphql.cjs +0 -93
- package/dist/production/src/graphql/schema/actions.graphql.cjs.map +0 -1
- package/dist/production/src/graphql/schema/actions.graphql.js +0 -93
- package/dist/production/src/graphql/schema/actions.graphql.js.map +0 -1
- package/dist/production/src/migrations/2023-03-10-145000-actions-variables.cjs +0 -16
- package/dist/production/src/migrations/2023-03-10-145000-actions-variables.cjs.map +0 -1
- package/dist/production/src/migrations/2023-03-10-145000-actions-variables.js +0 -17
- package/dist/production/src/migrations/2023-03-10-145000-actions-variables.js.map +0 -1
- package/dist/production/src/migrations/index.cjs +0 -10
- package/dist/production/src/migrations/index.cjs.map +0 -1
- package/dist/production/src/migrations/index.js +0 -10
- package/dist/production/src/migrations/index.js.map +0 -1
- package/dist/production/src/migrations/snapshot.cjs +0 -48
- package/dist/production/src/migrations/snapshot.cjs.map +0 -1
- package/dist/production/src/migrations/snapshot.js +0 -49
- package/dist/production/src/migrations/snapshot.js.map +0 -1
- package/dist/production/src/model/EventsInProcessingQuery.cjs +0 -14
- package/dist/production/src/model/EventsInProcessingQuery.cjs.map +0 -1
- package/dist/production/src/model/EventsInProcessingQuery.js +0 -14
- package/dist/production/src/model/EventsInProcessingQuery.js.map +0 -1
- package/dist/production/src/model/EventsToProcessQuery.cjs +0 -15
- package/dist/production/src/model/EventsToProcessQuery.cjs.map +0 -1
- package/dist/production/src/model/EventsToProcessQuery.js +0 -15
- package/dist/production/src/model/EventsToProcessQuery.js.map +0 -1
- package/dist/production/src/model/EventsToProcessSpecification.cjs +0 -8
- package/dist/production/src/model/EventsToProcessSpecification.cjs.map +0 -1
- package/dist/production/src/model/EventsToProcessSpecification.js +0 -8
- package/dist/production/src/model/EventsToProcessSpecification.js.map +0 -1
- package/dist/production/src/model/FailedEventsQuery.cjs +0 -14
- package/dist/production/src/model/FailedEventsQuery.cjs.map +0 -1
- package/dist/production/src/model/FailedEventsQuery.js +0 -14
- package/dist/production/src/model/FailedEventsQuery.js.map +0 -1
- package/dist/production/src/model/SetVariableCommand.cjs +0 -21
- package/dist/production/src/model/SetVariableCommand.cjs.map +0 -1
- package/dist/production/src/model/SetVariableCommand.js +0 -21
- package/dist/production/src/model/SetVariableCommand.js.map +0 -1
- package/dist/production/src/model/VariablesManager.cjs +0 -41
- package/dist/production/src/model/VariablesManager.cjs.map +0 -1
- package/dist/production/src/model/VariablesManager.js +0 -41
- package/dist/production/src/model/VariablesManager.js.map +0 -1
- package/dist/production/src/model/VariablesQuery.cjs +0 -10
- package/dist/production/src/model/VariablesQuery.cjs.map +0 -1
- package/dist/production/src/model/VariablesQuery.js +0 -10
- package/dist/production/src/model/VariablesQuery.js.map +0 -1
- package/dist/production/src/triggers/TriggerHandler.cjs +0 -126
- package/dist/production/src/triggers/TriggerHandler.cjs.map +0 -1
- package/dist/production/src/triggers/TriggerHandler.js +0 -126
- package/dist/production/src/triggers/TriggerHandler.js.map +0 -1
- package/dist/production/src/triggers/TriggerIndirectChangesFetcher.cjs +0 -21
- package/dist/production/src/triggers/TriggerIndirectChangesFetcher.cjs.map +0 -1
- package/dist/production/src/triggers/TriggerIndirectChangesFetcher.js +0 -21
- package/dist/production/src/triggers/TriggerIndirectChangesFetcher.js.map +0 -1
- package/dist/production/src/triggers/TriggerListenersBuilder.cjs +0 -169
- package/dist/production/src/triggers/TriggerListenersBuilder.cjs.map +0 -1
- package/dist/production/src/triggers/TriggerListenersBuilder.js +0 -169
- package/dist/production/src/triggers/TriggerListenersBuilder.js.map +0 -1
- package/dist/production/src/triggers/TriggerListenersFactory.cjs +0 -17
- package/dist/production/src/triggers/TriggerListenersFactory.cjs.map +0 -1
- package/dist/production/src/triggers/TriggerListenersFactory.js +0 -17
- package/dist/production/src/triggers/TriggerListenersFactory.js.map +0 -1
- package/dist/production/src/triggers/TriggerListenersStore.cjs +0 -24
- package/dist/production/src/triggers/TriggerListenersStore.cjs.map +0 -1
- package/dist/production/src/triggers/TriggerListenersStore.js +0 -24
- package/dist/production/src/triggers/TriggerListenersStore.js.map +0 -1
- package/dist/production/src/triggers/TriggerPayloadBuilder.cjs +0 -134
- package/dist/production/src/triggers/TriggerPayloadBuilder.cjs.map +0 -1
- package/dist/production/src/triggers/TriggerPayloadBuilder.js +0 -134
- package/dist/production/src/triggers/TriggerPayloadBuilder.js.map +0 -1
- package/dist/production/src/triggers/TriggerPayloadManager.cjs +0 -27
- package/dist/production/src/triggers/TriggerPayloadManager.cjs.map +0 -1
- package/dist/production/src/triggers/TriggerPayloadManager.js +0 -27
- package/dist/production/src/triggers/TriggerPayloadManager.js.map +0 -1
- package/dist/production/src/triggers/TriggerPayloadPersister.cjs +0 -43
- package/dist/production/src/triggers/TriggerPayloadPersister.cjs.map +0 -1
- package/dist/production/src/triggers/TriggerPayloadPersister.js +0 -43
- package/dist/production/src/triggers/TriggerPayloadPersister.js.map +0 -1
- package/dist/production/src/utils/assertNever.cjs +0 -7
- package/dist/production/src/utils/assertNever.cjs.map +0 -1
- package/dist/production/src/utils/assertNever.js +0 -7
- package/dist/production/src/utils/assertNever.js.map +0 -1
- package/dist/production/src/utils/map.cjs +0 -13
- package/dist/production/src/utils/map.cjs.map +0 -1
- package/dist/production/src/utils/map.js +0 -13
- package/dist/production/src/utils/map.js.map +0 -1
- package/dist/tests/cases/unit/generator.test.d.ts +0 -2
- package/dist/tests/cases/unit/generator.test.d.ts.map +0 -1
- package/dist/tests/cases/unit/webhookHandler.test.d.ts +0 -2
- package/dist/tests/cases/unit/webhookHandler.test.d.ts.map +0 -1
- package/dist/tests/src/gql.d.ts +0 -2
- package/dist/tests/src/gql.d.ts.map +0 -1
- package/dist/tests/src/uuid.d.ts +0 -3
- package/dist/tests/src/uuid.d.ts.map +0 -1
- package/dist/tests/tsconfig.tsbuildinfo +0 -1
- package/dist/types/ActionsExecutionContainerHookFactory.d.ts +0 -8
- package/dist/types/ActionsExecutionContainerHookFactory.d.ts.map +0 -1
- package/dist/types/ImplementationException.d.ts +0 -3
- package/dist/types/ImplementationException.d.ts.map +0 -1
- package/dist/types/ListenerStoreProvider.d.ts +0 -7
- package/dist/types/ListenerStoreProvider.d.ts.map +0 -1
- package/dist/types/authorization/ActionsAuthorizationActions.d.ts +0 -28
- package/dist/types/authorization/ActionsAuthorizationActions.d.ts.map +0 -1
- package/dist/types/authorization/ActionsPermissionsFactory.d.ts +0 -5
- package/dist/types/authorization/ActionsPermissionsFactory.d.ts.map +0 -1
- package/dist/types/authorization/Identity.d.ts +0 -5
- package/dist/types/authorization/Identity.d.ts.map +0 -1
- package/dist/types/authorization/index.d.ts +0 -4
- package/dist/types/authorization/index.d.ts.map +0 -1
- package/dist/types/dispatch/DispatchWorkerSupervisor.d.ts +0 -17
- package/dist/types/dispatch/DispatchWorkerSupervisor.d.ts.map +0 -1
- package/dist/types/dispatch/EventDispatcher.d.ts +0 -25
- package/dist/types/dispatch/EventDispatcher.d.ts.map +0 -1
- package/dist/types/dispatch/EventsRepository.d.ts +0 -22
- package/dist/types/dispatch/EventsRepository.d.ts.map +0 -1
- package/dist/types/dispatch/ProjectDispatcher.d.ts +0 -22
- package/dist/types/dispatch/ProjectDispatcher.d.ts.map +0 -1
- package/dist/types/dispatch/TargetHandlerResolver.d.ts +0 -9
- package/dist/types/dispatch/TargetHandlerResolver.d.ts.map +0 -1
- package/dist/types/dispatch/WebhookFetcher.d.ts +0 -14
- package/dist/types/dispatch/WebhookFetcher.d.ts.map +0 -1
- package/dist/types/dispatch/WebhookTargetHandler.d.ts +0 -16
- package/dist/types/dispatch/WebhookTargetHandler.d.ts.map +0 -1
- package/dist/types/dispatch/types.d.ts +0 -27
- package/dist/types/dispatch/types.d.ts.map +0 -1
- package/dist/types/graphql/http/ActionsApiMiddlewareFactory.d.ts +0 -13
- package/dist/types/graphql/http/ActionsApiMiddlewareFactory.d.ts.map +0 -1
- package/dist/types/graphql/http/ActionsContextResolver.d.ts +0 -14
- package/dist/types/graphql/http/ActionsContextResolver.d.ts.map +0 -1
- package/dist/types/graphql/http/ActionsGraphQLHandlerFactory.d.ts +0 -8
- package/dist/types/graphql/http/ActionsGraphQLHandlerFactory.d.ts.map +0 -1
- package/dist/types/graphql/http/ActionsWebsocketControllerFactory.d.ts +0 -11
- package/dist/types/graphql/http/ActionsWebsocketControllerFactory.d.ts.map +0 -1
- package/dist/types/graphql/resolvers/ActionsContext.d.ts +0 -11
- package/dist/types/graphql/resolvers/ActionsContext.d.ts.map +0 -1
- package/dist/types/graphql/resolvers/ResolversFactory.d.ts +0 -13
- package/dist/types/graphql/resolvers/ResolversFactory.d.ts.map +0 -1
- package/dist/types/graphql/resolvers/index.d.ts +0 -3
- package/dist/types/graphql/resolvers/index.d.ts.map +0 -1
- package/dist/types/graphql/resolvers/mutation/ProcessBatchMutationResolver.d.ts +0 -11
- package/dist/types/graphql/resolvers/mutation/ProcessBatchMutationResolver.d.ts.map +0 -1
- package/dist/types/graphql/resolvers/mutation/SetVariablesMutationResolver.d.ts +0 -11
- package/dist/types/graphql/resolvers/mutation/SetVariablesMutationResolver.d.ts.map +0 -1
- package/dist/types/graphql/resolvers/mutation/index.d.ts +0 -3
- package/dist/types/graphql/resolvers/mutation/index.d.ts.map +0 -1
- package/dist/types/graphql/resolvers/query/EventsQueryResolver.d.ts +0 -11
- package/dist/types/graphql/resolvers/query/EventsQueryResolver.d.ts.map +0 -1
- package/dist/types/graphql/resolvers/query/VariablesQueryResolver.d.ts +0 -12
- package/dist/types/graphql/resolvers/query/VariablesQueryResolver.d.ts.map +0 -1
- package/dist/types/graphql/resolvers/query/index.d.ts +0 -2
- package/dist/types/graphql/resolvers/query/index.d.ts.map +0 -1
- package/dist/types/graphql/schema/actions.graphql.d.ts +0 -3
- package/dist/types/graphql/schema/actions.graphql.d.ts.map +0 -1
- package/dist/types/graphql/schema/index.d.ts +0 -256
- package/dist/types/graphql/schema/index.d.ts.map +0 -1
- package/dist/types/index.d.ts +0 -13
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/migrations/2023-03-10-145000-actions-variables.d.ts +0 -3
- package/dist/types/migrations/2023-03-10-145000-actions-variables.d.ts.map +0 -1
- package/dist/types/migrations/index.d.ts +0 -3
- package/dist/types/migrations/index.d.ts.map +0 -1
- package/dist/types/migrations/snapshot.d.ts +0 -3
- package/dist/types/migrations/snapshot.d.ts.map +0 -1
- package/dist/types/model/EventsInProcessingQuery.d.ts +0 -9
- package/dist/types/model/EventsInProcessingQuery.d.ts.map +0 -1
- package/dist/types/model/EventsToProcessQuery.d.ts +0 -9
- package/dist/types/model/EventsToProcessQuery.d.ts.map +0 -1
- package/dist/types/model/EventsToProcessSpecification.d.ts +0 -4
- package/dist/types/model/EventsToProcessSpecification.d.ts.map +0 -1
- package/dist/types/model/FailedEventsQuery.d.ts +0 -9
- package/dist/types/model/FailedEventsQuery.d.ts.map +0 -1
- package/dist/types/model/SetVariableCommand.d.ts +0 -8
- package/dist/types/model/SetVariableCommand.d.ts.map +0 -1
- package/dist/types/model/VariablesManager.d.ts +0 -8
- package/dist/types/model/VariablesManager.d.ts.map +0 -1
- package/dist/types/model/VariablesQuery.d.ts +0 -12
- package/dist/types/model/VariablesQuery.d.ts.map +0 -1
- package/dist/types/model/types.d.ts +0 -19
- package/dist/types/model/types.d.ts.map +0 -1
- package/dist/types/triggers/TriggerHandler.d.ts +0 -26
- package/dist/types/triggers/TriggerHandler.d.ts.map +0 -1
- package/dist/types/triggers/TriggerIndirectChangesFetcher.d.ts +0 -11
- package/dist/types/triggers/TriggerIndirectChangesFetcher.d.ts.map +0 -1
- package/dist/types/triggers/TriggerListeners.d.ts +0 -9
- package/dist/types/triggers/TriggerListeners.d.ts.map +0 -1
- package/dist/types/triggers/TriggerListenersBuilder.d.ts +0 -15
- package/dist/types/triggers/TriggerListenersBuilder.d.ts.map +0 -1
- package/dist/types/triggers/TriggerListenersFactory.d.ts +0 -8
- package/dist/types/triggers/TriggerListenersFactory.d.ts.map +0 -1
- package/dist/types/triggers/TriggerListenersStore.d.ts +0 -48
- package/dist/types/triggers/TriggerListenersStore.d.ts.map +0 -1
- package/dist/types/triggers/TriggerPayloadBuilder.d.ts +0 -14
- package/dist/types/triggers/TriggerPayloadBuilder.d.ts.map +0 -1
- package/dist/types/triggers/TriggerPayloadManager.d.ts +0 -21
- package/dist/types/triggers/TriggerPayloadManager.d.ts.map +0 -1
- package/dist/types/triggers/TriggerPayloadPersister.d.ts +0 -17
- package/dist/types/triggers/TriggerPayloadPersister.d.ts.map +0 -1
- package/dist/types/triggers/index.d.ts +0 -8
- package/dist/types/triggers/index.d.ts.map +0 -1
- package/dist/types/tsconfig.tsbuildinfo +0 -1
- package/dist/types/utils/assertNever.d.ts +0 -2
- package/dist/types/utils/assertNever.d.ts.map +0 -1
- package/dist/types/utils/map.d.ts +0 -2
- package/dist/types/utils/map.d.ts.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
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,EAAA;AAAA,EAIlB,SAAyB;AACxB,WAAO,OAAM,QAAO;AACnB,YAAM,EAAE,OAAO,QAAQ,IAAQ,IAAA;AACzB,YAAA,EAAE,kBAAkB,SAAS,IAAI,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,aAAAA,eAAe,WAAW,WAAW;AAAA,UAAA;AAAA,QAChD;AAAA,MAEF;AACA,YAAM,UAAU,KAAK;AAEf,YAAA,MAAM,WAAW,MAAM,QAAQ;AAAA,QACpC,SAAS,IAAI;AAAA,QACb,UAAU,IAAI;AAAA,QACd,eAAe,MAAM;AAAA,MAAA,CACrB,CAAC;AACF,aAAO,MAAM,wBAAwB;AAAA,IACtC;AAAA,EAAA;AAEF;;"}
|
|
@@ -1,38 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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,EAAA;AAAA,EAIlB,SAAyB;AACxB,WAAO,OAAM,QAAO;AACnB,YAAM,EAAE,OAAO,QAAQ,IAAQ,IAAA;AACzB,YAAA,EAAE,kBAAkB,SAAS,IAAI,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,UAAA;AAAA,QAChD;AAAA,MAEF;AACA,YAAM,UAAU,KAAK;AAEf,YAAA,MAAM,WAAW,MAAM,QAAQ;AAAA,QACpC,SAAS,IAAI;AAAA,QACb,UAAU,IAAI;AAAA,QACd,eAAe,MAAM;AAAA,MAAA,CACrB,CAAC;AACF,aAAO,MAAM,wBAAwB;AAAA,IACtC;AAAA,EAAA;AAEF;"}
|
|
@@ -1,39 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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,EAAA;AAAA,EAIlB,MAAM,QAAQ,KAAkD;AACzD,UAAA,EAAE,OAAO,cAAc,EAAE,mBAAmB,QAAQ,eAAe;AACzE,UAAM,iBAAiB,MAAM,KAAK,uBAAuB,QAAQ,GAAG;AAC9D,UAAA,EAAE,YAAY;AACpB,QAAI,CAAC,YAAY;AACV,YAAA,IAAIA,WAAAA,kBAAkB,KAAK,yBAAyB;AAAA,IAAA;AAE3D,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,QAAA;AAAA,MACnB;AAAA,IAEF;AACA,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,WAAkB,kBAAA,KAAK,WAAW,QAAQ,IAAI,YAAY;AAAA,IAAA;AAElE,UAAM,QAAQ,YAAY,IAAI,CAAA,OAAM,GAAG,IAAI;AACpC,WAAA;AAAA,MACN,GAAG;AAAA,MACH,UAAU,EAAE,IAAI,WAAW,YAAY,MAAM;AAAA,IAC9C;AAAA,EAAA;AAEF;;"}
|
|
@@ -1,39 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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,EAAA;AAAA,EAIlB,MAAM,QAAQ,KAAkD;AACzD,UAAA,EAAE,OAAO,cAAc,EAAE,mBAAmB,QAAQ,eAAe;AACzE,UAAM,iBAAiB,MAAM,KAAK,uBAAuB,QAAQ,GAAG;AAC9D,UAAA,EAAE,YAAY;AACpB,QAAI,CAAC,YAAY;AACV,YAAA,IAAI,kBAAkB,KAAK,yBAAyB;AAAA,IAAA;AAE3D,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,QAAA;AAAA,MACnB;AAAA,IAEF;AACA,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,IAAA;AAElE,UAAM,QAAQ,YAAY,IAAI,CAAA,OAAM,GAAG,IAAI;AACpC,WAAA;AAAA,MACN,GAAG;AAAA,MACH,UAAU,EAAE,IAAI,WAAW,YAAY,MAAM;AAAA,IAC9C;AAAA,EAAA;AAEF;"}
|
|
@@ -1,20 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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,OAAO;AAC1C,UAAMA,WAASC,OAAAA,qBAAqB;AAAA,MACnC,UAAUC,gBAAA;AAAA,MACV;AAAA,IAAA,CACA;AAED,WAAOC,qCAA0C;AAAA,MAAA,QAChDH;AAAAA,MACA,WAAW,CAAA;AAAA,IAAC,CACZ;AAAA,EAAA;AAEH;;"}
|
|
@@ -1,20 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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,OAAO;AAC1C,UAAMA,WAAS,qBAAqB;AAAA,MACnC,UAAUC;AAAAA,MACV;AAAA,IAAA,CACA;AAED,WAAO,0BAA0C;AAAA,MAAA,QAChDD;AAAAA,MACA,WAAW,CAAA;AAAA,IAAC,CACZ;AAAA,EAAA;AAEH;"}
|
|
@@ -1,149 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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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"}
|
|
@@ -1,132 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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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"}
|
|
@@ -1,31 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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,EAAA;AAAA,EAIlB,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,MAAA;AAAA,IAEnF;AACO,WAAA;AAAA,EAAA;AAET;;"}
|
|
@@ -1,31 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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,EAAA;AAAA,EAIlB,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,MAAA;AAAA,IAEnF;AACO,WAAA;AAAA,EAAA;AAET;"}
|
|
@@ -1,19 +0,0 @@
|
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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,EAAA;AAAA,EAGT,MAAM,aAAa,QAAiB,MAAe,KAAqB;AACjE,UAAA,IAAI,cAAcA,4BAAA,4BAA4B,cAAc;AAE5D,UAAA,KAAK,gBAAgB,aAAa,GAAG;AACpC,WAAA;AAAA,MACN,IAAI;AAAA,IACL;AAAA,EAAA;AAEF;;"}
|