UNPKG

n8n

Version:

n8n Workflow Automation Tool

62 lines (61 loc) 4.46 kB
import type { Resolve } from '../../utlity.types'; import type { PubSubCommandMap, PubSubWorkerResponseMap } from './pubsub.event-map'; import type { COMMAND_PUBSUB_CHANNEL, WORKER_RESPONSE_PUBSUB_CHANNEL } from '../constants'; export declare namespace PubSub { export type Channel = typeof COMMAND_PUBSUB_CHANNEL | typeof WORKER_RESPONSE_PUBSUB_CHANNEL; export type HandlerFn = (msg: string) => void; type _ToCommand<CommandKey extends keyof PubSubCommandMap> = { command: CommandKey; senderId?: string; targets?: string[]; selfSend?: boolean; debounce?: boolean; } & (PubSubCommandMap[CommandKey] extends never ? { payload?: never; } : { payload: PubSubCommandMap[CommandKey]; }); type ToCommand<CommandKey extends keyof PubSubCommandMap> = Resolve<_ToCommand<CommandKey>>; namespace Commands { type ReloadLicense = ToCommand<'reload-license'>; type ReloadOIDCConfiguration = ToCommand<'reload-oidc-config'>; type ReloadSamlConfiguration = ToCommand<'reload-saml-config'>; type ReloadCredentialsOverwrites = ToCommand<'reload-overwrite-credentials'>; type RestartEventBus = ToCommand<'restart-event-bus'>; type ReloadExternalSecretsProviders = ToCommand<'reload-external-secrets-providers'>; type CommunityPackageInstall = ToCommand<'community-package-install'>; type CommunityPackageUpdate = ToCommand<'community-package-update'>; type CommunityPackageUninstall = ToCommand<'community-package-uninstall'>; type GetWorkerId = ToCommand<'get-worker-id'>; type GetWorkerStatus = ToCommand<'get-worker-status'>; type AddWebhooksTriggersAndPollers = ToCommand<'add-webhooks-triggers-and-pollers'>; type RemoveTriggersAndPollers = ToCommand<'remove-triggers-and-pollers'>; type DisplayWorkflowActivation = ToCommand<'display-workflow-activation'>; type DisplayWorkflowDeactivation = ToCommand<'display-workflow-deactivation'>; type DisplayWorkflowActivationError = ToCommand<'display-workflow-activation-error'>; type RelayExecutionLifecycleEvent = ToCommand<'relay-execution-lifecycle-event'>; type RelayChatStreamEvent = ToCommand<'relay-chat-stream-event'>; type RelayChatHumanMessage = ToCommand<'relay-chat-human-message'>; type RelayChatMessageEdit = ToCommand<'relay-chat-message-edit'>; type ClearTestWebhooks = ToCommand<'clear-test-webhooks'>; type ReloadSsoProvisioningConfiguration = ToCommand<'reload-sso-provisioning-configuration'>; type ReloadSourceControlConfiguration = ToCommand<'reload-source-control-config'>; type CancelTestRun = ToCommand<'cancel-test-run'>; type AgentChatIntegrationChanged = ToCommand<'agent-chat-integration-changed'>; type AgentConfigChanged = ToCommand<'agent-config-changed'>; } export type Command = Commands.ReloadLicense | Commands.RestartEventBus | Commands.ReloadExternalSecretsProviders | Commands.CommunityPackageInstall | Commands.CommunityPackageUpdate | Commands.CommunityPackageUninstall | Commands.GetWorkerId | Commands.GetWorkerStatus | Commands.AddWebhooksTriggersAndPollers | Commands.RemoveTriggersAndPollers | Commands.DisplayWorkflowActivation | Commands.DisplayWorkflowDeactivation | Commands.DisplayWorkflowActivationError | Commands.RelayExecutionLifecycleEvent | Commands.RelayChatStreamEvent | Commands.RelayChatHumanMessage | Commands.RelayChatMessageEdit | Commands.ClearTestWebhooks | Commands.ReloadOIDCConfiguration | Commands.ReloadSamlConfiguration | Commands.ReloadCredentialsOverwrites | Commands.ReloadSsoProvisioningConfiguration | Commands.ReloadSourceControlConfiguration | Commands.CancelTestRun | Commands.AgentChatIntegrationChanged | Commands.AgentConfigChanged; type _ToWorkerResponse<WorkerResponseKey extends keyof PubSubWorkerResponseMap> = { senderId: string; targets?: string[]; response: WorkerResponseKey; debounce?: boolean; } & (PubSubWorkerResponseMap[WorkerResponseKey] extends never ? { payload?: never; } : { payload: PubSubWorkerResponseMap[WorkerResponseKey]; }); type ToWorkerResponse<WorkerResponseKey extends keyof PubSubWorkerResponseMap> = Resolve<_ToWorkerResponse<WorkerResponseKey>>; export type WorkerResponse = ToWorkerResponse<'response-to-get-worker-status'>; export {}; }