UNPKG

n8n-editor-ui

Version:

Workflow Editor UI for n8n

27 lines (26 loc) 939 B
import { Fi as useUIStore, Ho as useSettingsStore, a as useNDVStore, nr as useUsersStore, o as useWorkflowsStore, oc as STORES } from "./useTelemetry-C797TaYa.js"; import { k as defineStore, r as useRootStore } from "./_baseOrderBy-DL6Sy5xK.js"; const useWebhooksStore = defineStore(STORES.WEBHOOKS, () => { return { ...useRootStore(), ...useWorkflowsStore(), ...useUIStore(), ...useUsersStore(), ...useNDVStore(), ...useSettingsStore() }; }); async function runExternalHook(eventName, metadata) { if (!window.n8nExternalHooks) return; const store = useWebhooksStore(); const [resource, operator] = eventName.split("."); const context = window.n8nExternalHooks[resource]; if (context?.[operator]) { const hookMethods = context[operator]; for (const hookMethod of hookMethods) await hookMethod(store, metadata); } } function useExternalHooks() { return { run: runExternalHook }; } export { useExternalHooks as t };