From acfd60ac85898d6b6ca24a93effbb969c7f3d542 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20Ovejero?= Date: Wed, 28 Aug 2024 10:48:53 +0200 Subject: [PATCH] refactor(core): Map out pubsub messages (no-changelog) (#10566) --- .../pubsub/pubsub-message-map.ts | 104 ++++++++++++++++++ 1 file changed, 104 insertions(+) create mode 100644 packages/cli/src/services/orchestration/pubsub/pubsub-message-map.ts diff --git a/packages/cli/src/services/orchestration/pubsub/pubsub-message-map.ts b/packages/cli/src/services/orchestration/pubsub/pubsub-message-map.ts new file mode 100644 index 0000000000000..d379bc93c0bdd --- /dev/null +++ b/packages/cli/src/services/orchestration/pubsub/pubsub-message-map.ts @@ -0,0 +1,104 @@ +import type { IPushDataType, IWorkflowDb } from '@/Interfaces'; +import type { RunningJobSummary } from '@/scaling/scaling.types'; + +export type PubSubMessageMap = { + // #region Lifecycle + + 'reload-license': never; + + 'restart-event-bus': { + result: 'success' | 'error'; + error?: string; + }; + + 'reload-external-secrets-providers': { + result: 'success' | 'error'; + error?: string; + }; + + 'stop-worker': never; + + // #endregion + + // #region Community packages + + 'community-package-install': { + packageName: string; + packageVersion: string; + }; + + 'community-package-update': { + packageName: string; + packageVersion: string; + }; + + 'community-package-uninstall': { + packageName: string; + packageVersion: string; + }; + + // #endregion + + // #region Worker view + + 'get-worker-id': never; + + 'get-worker-status': { + workerId: string; + runningJobsSummary: RunningJobSummary[]; + freeMem: number; + totalMem: number; + uptime: number; + loadAvg: number[]; + cpus: string; + arch: string; + platform: NodeJS.Platform; + hostname: string; + interfaces: Array<{ + family: 'IPv4' | 'IPv6'; + address: string; + internal: boolean; + }>; + version: string; + }; + + // #endregion + + // #region Multi-main setup + + 'add-webhooks-triggers-and-pollers': { + workflowId: string; + }; + + 'remove-triggers-and-pollers': { + workflowId: string; + }; + + 'display-workflow-activation': { + workflowId: string; + }; + + 'display-workflow-deactivation': { + workflowId: string; + }; + + // currently 'workflow-failed-to-activate' + 'display-workflow-activation-error': { + workflowId: string; + errorMessage: string; + }; + + 'relay-execution-lifecycle-event': { + type: IPushDataType; + args: Record; + pushRef: string; + }; + + 'clear-test-webhooks': { + webhookKey: string; + workflowEntity: IWorkflowDb; + pushRef: string; + }; + + // #endregion +};