bdf27f6218
* fix(fe2): better resiliency for when mp cant be loaded * WIP mixpanel track calls * more resiliency improvements * added all clientside tracking calls * run finished event * minor adjustment * feat(automate): revert automationRunTriggerinAssociation * feat(automate): track manual run triggers * feat(automate): backend track automation run created events * fix(automate): manual trigger type gql schema fix * feat(automate): add source based filter to run trigger tracking * fix(automate): fix trigger mock * various minor adjustments * remove comment --------- Co-authored-by: Gergő Jedlicska <gergo@jedlicska.com>
38 lines
1.1 KiB
TypeScript
38 lines
1.1 KiB
TypeScript
import {
|
|
AutomationFunctionRunRecord,
|
|
AutomationRunRecord,
|
|
AutomationTriggerType,
|
|
AutomationWithRevision,
|
|
BaseTriggerManifest,
|
|
RunTriggerSource
|
|
} from '@/modules/automate/helpers/types'
|
|
import { InsertableAutomationRun } from '@/modules/automate/repositories/automations'
|
|
import { initializeModuleEventEmitter } from '@/modules/shared/services/moduleEventEmitterSetup'
|
|
|
|
export enum AutomateRunsEvents {
|
|
Created = 'created',
|
|
StatusUpdated = 'status-updated'
|
|
}
|
|
|
|
export type AutomateEventsPayloads = {
|
|
[AutomateRunsEvents.Created]: {
|
|
automation: AutomationWithRevision
|
|
run: InsertableAutomationRun
|
|
manifests: BaseTriggerManifest[]
|
|
source: RunTriggerSource
|
|
triggerType: AutomationTriggerType
|
|
}
|
|
[AutomateRunsEvents.StatusUpdated]: {
|
|
run: AutomationRunRecord
|
|
functionRun: AutomationFunctionRunRecord
|
|
automationId: string
|
|
}
|
|
}
|
|
|
|
const { emit, listen } = initializeModuleEventEmitter<AutomateEventsPayloads>({
|
|
moduleName: 'automate',
|
|
namespace: 'runs'
|
|
})
|
|
|
|
export const AutomateRunsEmitter = { emit, listen, events: AutomateRunsEvents }
|