Files
baserow/web-frontend/modules/automation/plugin.js
Tsering Paljor 6d729c3b1d feat: Add Wait node (#6575)
* Add suspect and presume primitives for wait service.

* Add the Wait service and node that pauses a workflow.

* Ensure resume_at is returned in node history serializer

* Add the frontend Wait node and show waiting nodes in the workflow history.

* Add migrations for wait service and node

* On cancellation request, ensure waiting node is cancelled immediately

* Tolerate a deleted run history when the dispatch chain ends

* Ensure that lost wake-up tasks are recoverable

* Add changelog

* Fix test

* Cancel run of deleted workflow

* Mark the node as error when hourly sweep finds stale waiting node that is in a loop

* Show the iteration of a waiting node in the run history

* Stop counting waiting runs toward the unfinished runs rate limit

* Add tests that waiting runs finish after the workflow is switched off

* Merge migrations

* Update comment

* Disable node error policy for types that don't need it

* Simplify error message

* Remove the skipped status, as it isn't really useful

* create index concurrently
2026-11-10 15:31:28 +04:00

205 lines
7.4 KiB
JavaScript

import { defineNuxtPlugin } from '#app'
import {
GeneralAutomationSettingsType,
IntegrationsAutomationSettingsType,
} from '@baserow/modules/automation/automationSettingTypes'
import { AutomationApplicationType } from '@baserow/modules/automation/applicationTypes'
import { AutomationWorkflowLastViewedItemType } from '@baserow/modules/automation/lastViewedItemTypes'
import automationApplicationStore from '@baserow/modules/automation/store/automationApplication'
import automationWorkflowStore from '@baserow/modules/automation/store/automationWorkflow'
import automationWorkflowNodeStore from '@baserow/modules/automation/store/automationWorkflowNode'
import automationHistoryStore from '@baserow/modules/automation/store/automationHistory'
import {
LocalBaserowCreateRowActionNodeType,
LocalBaserowCreateRowsActionNodeType,
LocalBaserowUpdateRowActionNodeType,
LocalBaserowUpdateRowsActionNodeType,
LocalBaserowDeleteRowActionNodeType,
LocalBaserowGetRowActionNodeType,
LocalBaserowListRowsActionNodeType,
LocalBaserowRowsCreatedTriggerNodeType,
LocalBaserowRowsUpdatedTriggerNodeType,
LocalBaserowRowsDeletedTriggerNodeType,
LocalBaserowFieldsUpdatedTriggerNodeType,
CoreHTTPTriggerNodeType,
CoreInboundEmailTriggerNodeType,
LocalBaserowAggregateRowsActionNodeType,
CoreCSVFileReaderActionNodeType,
CoreHTTPRequestActionNodeType,
CoreIteratorActionNodeType,
CoreSMTPEmailActionNodeType,
CoreRouterActionNodeType,
CoreGotoActionNodeType,
CoreWaitActionNodeType,
CorePeriodicTriggerNodeType,
CoreResponseActionNodeType,
CoreStartWorkflowActionNodeType,
CoreManualTriggerNodeType,
AIAgentActionNodeType,
SlackWriteMessageActionNodeType,
} from '@baserow/modules/automation/nodeTypes'
import {
ForLoopNodeRecipeType,
WhileLoopNodeRecipeType,
} from '@baserow/modules/automation/nodeRecipeTypes'
import {
DuplicateAutomationWorkflowJobType,
PublishAutomationWorkflowJobType,
} from '@baserow/modules/automation/jobTypes'
import { WorkflowDisabledNotificationType } from '@baserow/modules/automation/notificationTypes.jsx'
import {
HistoryEditorSidePanelType,
NodeEditorSidePanelType,
} from '@baserow/modules/automation/editorSidePanelTypes'
import { AutomationSearchType } from '@baserow/modules/automation/searchTypes'
import { searchTypeRegistry } from '@baserow/modules/core/search/types/registry'
import { AutomationGuidedTourType } from '@baserow/modules/automation/guidedTourTypes'
import {
PreviousNodeDataProviderType,
CurrentIterationDataProviderType,
CurrentNodeDataProviderType,
} from '@baserow/modules/automation/dataProviderTypes'
export default defineNuxtPlugin({
name: 'automation',
dependsOn: ['core', 'store'],
setup(nuxtApp) {
const { $registry, $store } = nuxtApp
const context = { app: nuxtApp }
// Register stores
$store.registerModuleNuxtSafe(
'automationApplication',
automationApplicationStore
)
$store.registerModuleNuxtSafe('automationWorkflow', automationWorkflowStore)
$store.registerModuleNuxtSafe(
'automationWorkflowNode',
automationWorkflowNodeStore
)
$store.registerModuleNuxtSafe('automationHistory', automationHistoryStore)
$store.registerModuleNuxtSafe(
'template/automationApplication',
automationApplicationStore
)
$registry.registerNamespace('automationDataProvider')
$registry.registerNamespace('node')
$registry.registerNamespace('automationNodeRecipe')
$registry.registerNamespace('editorSidePanel')
// Automation data providers
$registry.register('application', new AutomationApplicationType(context))
$registry.register(
'lastViewedItem',
new AutomationWorkflowLastViewedItemType(context)
)
$registry.register(
'automationDataProvider',
new PreviousNodeDataProviderType(context)
)
$registry.register(
'automationDataProvider',
new CurrentIterationDataProviderType(context)
)
$registry.register(
'automationDataProvider',
new CurrentNodeDataProviderType(context)
)
// Automation node types
$registry.register(
'node',
new LocalBaserowRowsCreatedTriggerNodeType(context)
)
$registry.register(
'node',
new LocalBaserowRowsUpdatedTriggerNodeType(context)
)
$registry.register(
'node',
new LocalBaserowRowsDeletedTriggerNodeType(context)
)
$registry.register(
'node',
new LocalBaserowFieldsUpdatedTriggerNodeType(context)
)
$registry.register('node', new CoreHTTPTriggerNodeType(context))
$registry.register('node', new CoreInboundEmailTriggerNodeType(context))
$registry.register('node', new LocalBaserowCreateRowActionNodeType(context))
$registry.register(
'node',
new LocalBaserowCreateRowsActionNodeType(context)
)
$registry.register('node', new LocalBaserowUpdateRowActionNodeType(context))
$registry.register(
'node',
new LocalBaserowUpdateRowsActionNodeType(context)
)
$registry.register('node', new CoreHTTPRequestActionNodeType(context))
$registry.register('node', new CoreSMTPEmailActionNodeType(context))
$registry.register('node', new CoreRouterActionNodeType(context))
$registry.register('node', new CoreGotoActionNodeType(context))
$registry.register('node', new CoreWaitActionNodeType(context))
$registry.register('node', new CoreResponseActionNodeType(context))
$registry.register('node', new CoreIteratorActionNodeType(context))
$registry.register('node', new CoreCSVFileReaderActionNodeType(context))
$registry.register('node', new CoreStartWorkflowActionNodeType(context))
$registry.register('node', new SlackWriteMessageActionNodeType(context))
$registry.register('node', new LocalBaserowDeleteRowActionNodeType(context))
$registry.register('node', new LocalBaserowGetRowActionNodeType(context))
$registry.register('node', new LocalBaserowListRowsActionNodeType(context))
$registry.register(
'node',
new LocalBaserowAggregateRowsActionNodeType(context)
)
$registry.register('node', new CorePeriodicTriggerNodeType(context))
$registry.register('node', new CoreManualTriggerNodeType(context))
$registry.register('node', new AIAgentActionNodeType(context))
// Automation node recipes: menu entries that insert pre-configured nodes
$registry.register(
'automationNodeRecipe',
new ForLoopNodeRecipeType(context)
)
$registry.register(
'automationNodeRecipe',
new WhileLoopNodeRecipeType(context)
)
// Automation job types
$registry.register('job', new DuplicateAutomationWorkflowJobType(context))
$registry.register('job', new PublishAutomationWorkflowJobType(context))
$registry.register(
'notification',
new WorkflowDisabledNotificationType(context)
)
// Automation settings
$registry.registerNamespace('automationSettings')
$registry.register(
'automationSettings',
new GeneralAutomationSettingsType(context)
)
$registry.register(
'automationSettings',
new IntegrationsAutomationSettingsType(context)
)
// Automation editor side panels
$registry.register('editorSidePanel', new NodeEditorSidePanelType(context))
$registry.register(
'editorSidePanel',
new HistoryEditorSidePanelType(context)
)
// Automation search type
searchTypeRegistry.register(new AutomationSearchType(context))
// Automation guided tour
$registry.register('guidedTour', new AutomationGuidedTourType(context))
},
})