Skip to content

Commit c1fd799

Browse files
author
Tsering Paljor
committed
Merge branch '3691-http-trigger-node' into 'develop'
Introduce HTTP Trigger Node Closes baserow#3691 See merge request baserow/baserow!3718
2 parents 3d4730e + 408c836 commit c1fd799

File tree

41 files changed

+1088
-8
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+1088
-8
lines changed

backend/src/baserow/api/urls.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
auth_provider_type_registry,
88
plugin_registry,
99
)
10+
from baserow.core.services.registries import service_type_registry
1011

1112
from .admin import urls as admin_urls
1213
from .applications import urls as application_urls
@@ -63,4 +64,5 @@
6364
+ application_type_registry.api_urls
6465
+ auth_provider_type_registry.api_urls
6566
+ plugin_registry.api_urls
67+
+ service_type_registry.api_urls
6668
)

backend/src/baserow/contrib/automation/application_types.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,7 @@ def import_serialized(
230230
files_zip,
231231
storage,
232232
progress.create_child_builder(represents_progress=workflow_progress),
233+
import_export_config=import_export_config,
233234
)
234235

235236
return automation

backend/src/baserow/contrib/automation/apps.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ def ready(self):
2222
)
2323
from baserow.contrib.automation.nodes.node_types import (
2424
CoreHttpRequestNodeType,
25+
CoreHTTPTriggerNodeType,
2526
CorePeriodicTriggerNodeType,
2627
CoreRouterActionNodeType,
2728
CoreSMTPEmailNodeType,
@@ -171,6 +172,7 @@ def ready(self):
171172
LocalBaserowRowsDeletedNodeTriggerType()
172173
)
173174
automation_node_type_registry.register(CorePeriodicTriggerNodeType())
175+
automation_node_type_registry.register(CoreHTTPTriggerNodeType())
174176

175177
from baserow.core.trash.registries import trash_operation_type_registry
176178

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Generated by Django 5.0.13 on 2025-09-08 13:05
2+
3+
import django.db.models.deletion
4+
from django.db import migrations, models
5+
6+
7+
class Migration(migrations.Migration):
8+
dependencies = [
9+
("automation", "0019_coreperiodictriggernode"),
10+
]
11+
12+
operations = [
13+
migrations.CreateModel(
14+
name="CoreHTTPTriggerNode",
15+
fields=[
16+
(
17+
"automationnode_ptr",
18+
models.OneToOneField(
19+
auto_created=True,
20+
on_delete=django.db.models.deletion.CASCADE,
21+
parent_link=True,
22+
primary_key=True,
23+
serialize=False,
24+
to="automation.automationnode",
25+
),
26+
),
27+
],
28+
options={
29+
"abstract": False,
30+
},
31+
bases=("automation.automationnode",),
32+
),
33+
]

backend/src/baserow/contrib/automation/nodes/handler.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
from baserow.core.cache import local_cache
2929
from baserow.core.db import specific_iterator
3030
from baserow.core.exceptions import IdDoesNotExist
31+
from baserow.core.registries import ImportExportConfig
3132
from baserow.core.services.exceptions import (
3233
ServiceImproperlyConfiguredDispatchException,
3334
)
@@ -374,10 +375,18 @@ def duplicate_node(self, source_node: AutomationNode) -> AutomationNodeDuplicati
374375
id_mapping = defaultdict(lambda: MirrorDict())
375376
id_mapping["automation_workflow_nodes"] = MirrorDict()
376377

378+
import_export_config = ImportExportConfig(
379+
include_permission_data=True,
380+
reduce_disk_space_usage=False,
381+
is_duplicate=True,
382+
exclude_sensitive_data=False,
383+
)
384+
377385
duplicated_node = self.import_node(
378386
source_node.workflow,
379387
exported_node,
380388
id_mapping=id_mapping,
389+
import_export_config=import_export_config,
381390
)
382391

383392
# Update the nodes that follow the original node to now follow the new clone.
@@ -602,6 +611,7 @@ def import_node_only(
602611
workflow: AutomationWorkflow,
603612
serialized_node: AutomationNodeDict,
604613
id_mapping: Dict[str, Dict[int, int]],
614+
import_export_config: Optional[ImportExportConfig] = None,
605615
*args: Any,
606616
**kwargs: Any,
607617
) -> AutomationNode:
@@ -611,6 +621,7 @@ def import_node_only(
611621
workflow,
612622
serialized_node,
613623
id_mapping,
624+
import_export_config=import_export_config,
614625
*args,
615626
**kwargs,
616627
)

backend/src/baserow/contrib/automation/nodes/models.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,10 @@ class CorePeriodicTriggerNode(AutomationTriggerNode):
231231
...
232232

233233

234+
class CoreHTTPTriggerNode(AutomationTriggerNode):
235+
...
236+
237+
234238
class LocalBaserowCreateRowActionNode(AutomationActionNode):
235239
...
236240

backend/src/baserow/contrib/automation/nodes/node_types.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
AutomationNode,
1818
AutomationTriggerNode,
1919
CoreHTTPRequestActionNode,
20+
CoreHTTPTriggerNode,
2021
CorePeriodicTriggerNode,
2122
CoreRouterActionNode,
2223
CoreSMTPEmailActionNode,
@@ -34,6 +35,7 @@
3435
from baserow.contrib.automation.workflows.constants import WorkflowState
3536
from baserow.contrib.integrations.core.service_types import (
3637
CoreHTTPRequestServiceType,
38+
CoreHTTPTriggerServiceType,
3739
CorePeriodicServiceType,
3840
CoreRouterServiceType,
3941
CoreSMTPEmailServiceType,
@@ -295,3 +297,9 @@ class CorePeriodicTriggerNodeType(
295297
type = "periodic"
296298
model_class = CorePeriodicTriggerNode
297299
service_type = CorePeriodicServiceType.type
300+
301+
302+
class CoreHTTPTriggerNodeType(AutomationNodeTriggerType):
303+
type = "http_trigger"
304+
model_class = CoreHTTPTriggerNode
305+
service_type = CoreHTTPTriggerServiceType.type

backend/src/baserow/contrib/automation/nodes/registries.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,7 @@ def deserialize_property(
219219
cache=cache,
220220
files_zip=files_zip,
221221
import_formula=import_formula,
222+
import_export_config=kwargs.get("import_export_config"),
222223
)
223224
return super().deserialize_property(
224225
prop_name,

backend/src/baserow/contrib/automation/workflows/handler.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
from baserow.contrib.automation.history.models import AutomationWorkflowHistory
2525
from baserow.contrib.automation.models import Automation
2626
from baserow.contrib.automation.nodes.models import AutomationNode
27+
from baserow.contrib.automation.nodes.signals import automation_node_updated
2728
from baserow.contrib.automation.nodes.types import AutomationNodeDict
2829
from baserow.contrib.automation.types import AutomationWorkflowDict
2930
from baserow.contrib.automation.workflows.constants import (
@@ -323,11 +324,19 @@ def duplicate_workflow(
323324
id_mapping = defaultdict(lambda: MirrorDict())
324325
id_mapping["automation_workflows"] = MirrorDict()
325326

327+
import_export_config = ImportExportConfig(
328+
include_permission_data=True,
329+
reduce_disk_space_usage=False,
330+
exclude_sensitive_data=False,
331+
is_duplicate=True,
332+
)
333+
326334
new_workflow_clone = self.import_workflow(
327335
automation,
328336
exported_workflow,
329337
progress=progress.create_child_builder(represents_progress=import_progress),
330338
id_mapping=id_mapping,
339+
import_export_config=import_export_config,
331340
)
332341

333342
return new_workflow_clone
@@ -418,6 +427,7 @@ def import_nodes(
418427
workflow: AutomationWorkflow,
419428
serialized_nodes: List[AutomationNodeDict],
420429
id_mapping: Dict[str, Dict[int, int]],
430+
import_export_config: Optional[ImportExportConfig] = None,
421431
files_zip: Optional[ZipFile] = None,
422432
storage: Optional[Storage] = None,
423433
progress: Optional[ChildProgressBuilder] = None,
@@ -429,6 +439,8 @@ def import_nodes(
429439
:param workflow: The AutomationWorkflow instance to import the nodes into.
430440
:param serialized_nodes: The serialized nodes to import.
431441
:param id_mapping: A map of old->new id per data type
442+
:param import_export_config: provides configuration options for the
443+
import/export process to customize how it works.
432444
:param files_zip: Contains files to import if any.
433445
:param storage: Storage to get the files from.
434446
:param progress: A progress object that can be used to report progress.
@@ -458,6 +470,7 @@ def import_nodes(
458470
workflow,
459471
serialized_node,
460472
id_mapping,
473+
import_export_config=import_export_config,
461474
files_zip=files_zip,
462475
storage=storage,
463476
cache=cache,
@@ -480,6 +493,7 @@ def import_workflows(
480493
storage: Optional[Storage] = None,
481494
progress: Optional[ChildProgressBuilder] = None,
482495
cache: Optional[Dict[str, any]] = None,
496+
import_export_config: Optional[ImportExportConfig] = None,
483497
) -> List[AutomationWorkflow]:
484498
"""
485499
Import multiple workflows at once.
@@ -522,6 +536,7 @@ def import_workflows(
522536
workflow_instance,
523537
serialized_workflow["nodes"],
524538
id_mapping,
539+
import_export_config=import_export_config,
525540
files_zip=files_zip,
526541
storage=storage,
527542
progress=progress,
@@ -535,6 +550,7 @@ def import_workflow(
535550
automation: Automation,
536551
serialized_workflow: AutomationWorkflowDict,
537552
id_mapping: Dict[str, Dict[int, int]],
553+
import_export_config: Optional[ImportExportConfig] = None,
538554
files_zip: Optional[ZipFile] = None,
539555
storage: Optional[Storage] = None,
540556
progress: Optional[ChildProgressBuilder] = None,
@@ -561,6 +577,7 @@ def import_workflow(
561577
automation,
562578
[serialized_workflow],
563579
id_mapping,
580+
import_export_config=import_export_config,
564581
files_zip=files_zip,
565582
storage=storage,
566583
progress=progress,
@@ -643,6 +660,7 @@ def publish(
643660
include_permission_data=True,
644661
reduce_disk_space_usage=False,
645662
exclude_sensitive_data=False,
663+
is_publishing=True,
646664
)
647665
default_storage = get_default_storage()
648666
application_type = workflow.automation.get_type()
@@ -794,6 +812,9 @@ def set_workflow_temporary_states(self, workflow, simulate_until_node=None):
794812
if simulate_until_node is not None:
795813
# Switch to simulate until the given node
796814
workflow.simulate_until_node = simulate_until_node
815+
816+
automation_node_updated.send(self, user=None, node=simulate_until_node)
817+
797818
fields_to_save.append("simulate_until_node")
798819

799820
else:

backend/src/baserow/contrib/integrations/apps.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,14 @@ def ready(self):
3939

4040
from baserow.contrib.integrations.core.service_types import (
4141
CoreHTTPRequestServiceType,
42+
CoreHTTPTriggerServiceType,
4243
CoreRouterServiceType,
4344
CoreSMTPEmailServiceType,
4445
)
4546

4647
service_type_registry.register(CoreHTTPRequestServiceType())
4748
service_type_registry.register(CoreSMTPEmailServiceType())
4849
service_type_registry.register(CoreRouterServiceType())
50+
service_type_registry.register(CoreHTTPTriggerServiceType())
4951

5052
import baserow.contrib.integrations.signals # noqa: F403, F401

0 commit comments

Comments
 (0)