Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
300 changes: 300 additions & 0 deletions echo/directus/sync/collections/operations.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,26 @@
"flow": "17703446-fef0-49e9-bdc4-385db1311137",
"_syncId": "5bea9e07-e6f0-41c6-821d-b426dec3427c"
},
{
"name": "Check Language",
"key": "check_language",
"type": "condition",
"position_x": 20,
"position_y": 1,
"options": {
"filter": {
"$trigger": {
"language": {
"_eq": "en"
}
}
}
},
"resolve": "9390ed2f-7dc6-4a6a-83da-2d87d478261d",
"reject": "4795cc24-3f3c-4be9-9844-24552da522fa",
"flow": "17703446-fef0-49e9-bdc4-385db1311137",
"_syncId": "af7a671d-78fa-4d07-adad-c3bfabc4617c"
},
Comment on lines +22 to +41
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Duplicate key will clobber the original operation at import-time.

Directus Flow requires key be unique per flow. A second "check_language" with the same key but a different _syncId means only one of them survives the sync, nuking the other branch and potentially breaking resolve9390ed2f-….
Rename the key or delete the clone before shipping.

🤖 Prompt for AI Agents
In echo/directus/sync/collections/operations.json around lines 22 to 41, there
are duplicate "key" values named "check_language" which will cause one to
overwrite the other during import. To fix this, ensure each operation has a
unique "key" by renaming one of the duplicate keys or removing the duplicate
operation entirely before syncing to prevent breaking the flow connections.

{
"name": "Check Report Language",
"key": "check_report_language",
Expand All @@ -45,6 +65,32 @@
"flow": "ec4e7ea5-72de-4365-b66f-d8f11b549495",
"_syncId": "d154ee34-0931-43f3-aaca-9168f88fa04b"
},
{
"name": "Check Report Language",
"key": "check_report_language",
"type": "item-read",
"position_x": 73,
"position_y": 1,
"options": {
"query": {
"filter": {
"project_id": {
"id": {
"_eq": "{{$trigger.payload.project_id.id}}"
}
}
},
"fields": [
"language"
]
},
"collection": "project_report"
},
"resolve": "ca1ffbc5-cfce-4fb4-8f15-c128ea407d41",
"reject": null,
"flow": "ec4e7ea5-72de-4365-b66f-d8f11b549495",
"_syncId": "c5d2aff3-1a1a-4ea2-8e39-5189409b7dc1"
},
Comment on lines +68 to +93
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Same collision for "check_report_language" – import chaos ahead.

Identical key, different _syncId. One wins, one dies. Fix like above.

🤖 Prompt for AI Agents
In echo/directus/sync/collections/operations.json between lines 68 and 93, the
"check_report_language" key is duplicated with different _syncId values, causing
a collision. To fix this, ensure each operation key is unique by renaming one of
the "check_report_language" keys to a distinct name or merging the operations if
appropriate, and update the corresponding _syncId to maintain uniqueness.

{
"name": "Dutch",
"key": "dutch",
Expand All @@ -65,6 +111,26 @@
"flow": "17703446-fef0-49e9-bdc4-385db1311137",
"_syncId": "eaeb2c39-32e0-428d-ad03-ff0e6052adcc"
},
{
"name": "Dutch",
"key": "dutch",
"type": "condition",
"position_x": 20,
"position_y": 20,
"options": {
"filter": {
"$trigger": {
"language": {
"_eq": "nl"
}
}
}
},
"resolve": "ea78ec02-364d-4f18-80f8-ea5ac4c787ed",
"reject": "eb6f8253-647f-4fb1-9010-e93594ba065e",
"flow": "17703446-fef0-49e9-bdc4-385db1311137",
"_syncId": "4795cc24-3f3c-4be9-9844-24552da522fa"
},
Comment on lines +114 to +133
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Ditto for "dutch" condition node.

Unique keys or bust – else the NL branch erases itself.

🤖 Prompt for AI Agents
In echo/directus/sync/collections/operations.json around lines 114 to 133, the
"dutch" condition node's "key" must be unique to prevent conflicts that cause
the NL branch to overwrite itself. Review the "key" value and ensure it is
unique within the file by changing it to a distinct identifier that does not
duplicate any other keys.

{
"name": "Email Send Operation Failed",
"key": "email_send_operation_failed",
Expand All @@ -79,6 +145,20 @@
"flow": "17703446-fef0-49e9-bdc4-385db1311137",
"_syncId": "920bd181-b2a2-4f0d-94dc-3b1a08c3f4ef"
},
{
"name": "Email Send Operation Failed",
"key": "email_send_operation_failed",
"type": "log",
"position_x": 58,
"position_y": 1,
"options": {
"message": "An email could not be sent due to some error: {{$last}}"
},
"resolve": null,
"reject": null,
"flow": "17703446-fef0-49e9-bdc4-385db1311137",
"_syncId": "2b24450b-6a2e-4452-aba1-9814d17fef42"
},
Comment on lines +148 to +161
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Two "email_send_operation_failed" log nodes = one actually synced.

You’ll lose one set of resolve/reject plumbing. Rename or merge.

🤖 Prompt for AI Agents
In echo/directus/sync/collections/operations.json around lines 148 to 161, there
are two log nodes with the key "email_send_operation_failed," which causes a
conflict and loss of resolve/reject plumbing. To fix this, rename one of the
duplicate keys to a unique name or merge the two nodes into a single one,
ensuring that resolve and reject handlers are preserved and correctly linked.

{
"name": "Email Send Operation Failed Dutch",
"key": "email_send_operation_failed_dutch",
Expand All @@ -93,6 +173,20 @@
"flow": "17703446-fef0-49e9-bdc4-385db1311137",
"_syncId": "84c38ea6-5d15-429f-8c24-9485d54ba7be"
},
{
"name": "Email Send Operation Failed Dutch",
"key": "email_send_operation_failed_dutch",
"type": "log",
"position_x": 58,
"position_y": 20,
"options": {
"message": "An email could not be sent due to some error: {{$last}}"
},
"resolve": null,
"reject": null,
"flow": "17703446-fef0-49e9-bdc4-385db1311137",
"_syncId": "615a54cd-a72e-41ad-9403-9577c80280d6"
},
{
"name": "failed",
"key": "failed",
Expand All @@ -107,6 +201,20 @@
"flow": "17703446-fef0-49e9-bdc4-385db1311137",
"_syncId": "8d8d787a-dbc4-44f9-9ab4-28e3f3d5f31c"
},
{
"name": "failed",
"key": "failed",
"type": "log",
"position_x": 20,
"position_y": 39,
"options": {
"message": "language detection failed"
},
"resolve": null,
"reject": null,
"flow": "17703446-fef0-49e9-bdc4-385db1311137",
"_syncId": "eb6f8253-647f-4fb1-9010-e93594ba065e"
},
Comment on lines +204 to +217
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Duplicate "failed" logger.

Same story – key collision, silent overwrite.

🤖 Prompt for AI Agents
In echo/directus/sync/collections/operations.json around lines 204 to 217, there
is a duplicate logger entry with the key "failed" causing a key collision and
silent overwrite. To fix this, rename one of the "failed" keys to a unique
identifier to avoid duplication and ensure each logger has a distinct key.

{
"name": "Filter Emails",
"key": "filter_emails",
Expand All @@ -121,6 +229,47 @@
"flow": "ec4e7ea5-72de-4365-b66f-d8f11b549495",
"_syncId": "efb3982e-5703-4c07-8982-a6e1b5218e4a"
},
{
"name": "Filter Emails",
"key": "filter_emails",
"type": "exec",
"position_x": 91,
"position_y": 1,
"options": {
"code": "module.exports = async function(data) {\n\n const submissions = data.get_all_participants;\n \n // Filter submissions to only include those where email_opt_in is true\n const filteredSubmissions = submissions.filter(sub => sub.email_opt_in === true);\n\n // Create an array with email, project_id and an email_opt_out token for each submission\n const result = filteredSubmissions.map(sub => ({\n project_name: data.project_data[0].name || '',\n\t\tdefault_conversation_title: data.project_data[0].default_conversation_title || '',\n\t\tconversation_name: sub.conversation_id.participant_name || '',\n email: sub.email,\n project_id: sub.project_id || '',\n token: sub.email_opt_out_token,\n language: data.check_report_language[0].language || 'empty',\n ADMIN_BASE_URL: \"{{ $env.ADMIN_BASE_URL }}\" || \"http://localhost:5173\",\n PARTICIPANT_BASE_URL: \"{{ $env.PARTICIPANT_BASE_URL }}\" || \"http://localhost:5174\", \n }));\n \n return result;\n};"
},
"resolve": "b8144cee-59f6-40d9-a849-dd0c639e4e31",
"reject": null,
"flow": "ec4e7ea5-72de-4365-b66f-d8f11b549495",
"_syncId": "ca1ffbc5-cfce-4fb4-8f15-c128ea407d41"
},
Comment on lines +232 to +245
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

filter_emails exec cloned – only one will be runnable.

Pick one, or give the clone a new key + updated downstream references.

🤖 Prompt for AI Agents
In echo/directus/sync/collections/operations.json around lines 232 to 245, there
are duplicate "filter_emails" exec entries which causes only one to be runnable.
To fix this, either remove the duplicate or rename the cloned exec by giving it
a unique "key" value and update all downstream references to use this new key to
avoid conflicts.

{
"name": "Get All Participants",
"key": "get_all_participants",
"type": "item-read",
"position_x": 55,
"position_y": 1,
"options": {
"query": {
"filter": {
"project_id": {
"id": {
"_eq": "{{$trigger.payload.project_id}}"
}
}
},
"fields": [
"*",
"conversation_id.participant_name"
]
},
"collection": "project_report_notification_participants"
},
"resolve": "c5d2aff3-1a1a-4ea2-8e39-5189409b7dc1",
"reject": null,
"flow": "ec4e7ea5-72de-4365-b66f-d8f11b549495",
"_syncId": "47f1463c-3cb6-4420-a50e-92938fed3197"
},
{
"name": "Get All Participants",
"key": "get_all_participants",
Expand Down Expand Up @@ -148,6 +297,20 @@
"flow": "ec4e7ea5-72de-4365-b66f-d8f11b549495",
"_syncId": "107ebc18-7d2d-4299-9d98-b7d1e7322b7c"
},
{
"name": "log environment vars",
"key": "log_environment_vars",
"type": "log",
"position_x": 127,
"position_y": 1,
"options": {
"message": "{{data['$env']}} {{data.$env}} {{process.env}} {{$env}} {{$env.PARTICIPANT_BASE_URL}}"
},
"resolve": null,
"reject": null,
"flow": "ec4e7ea5-72de-4365-b66f-d8f11b549495",
"_syncId": "7161e52e-b1cc-4c13-bedd-a9d64527026f"
},
Comment on lines +301 to +313
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Logging full $env and process.env leaks secrets.

Dumping every env var to Directus logs is a GDPR/ops nightmare.
Log only the specific var you need, or strip this node in prod.

-      "message": "{{data['$env']}}  {{data.$env}} {{process.env}} {{$env}} {{$env.PARTICIPANT_BASE_URL}}"
+      "message": "PARTICIPANT_BASE_URL: {{$env.PARTICIPANT_BASE_URL}}"
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"name": "log environment vars",
"key": "log_environment_vars",
"type": "log",
"position_x": 127,
"position_y": 1,
"options": {
"message": "{{data['$env']}} {{data.$env}} {{process.env}} {{$env}} {{$env.PARTICIPANT_BASE_URL}}"
},
"resolve": null,
"reject": null,
"flow": "ec4e7ea5-72de-4365-b66f-d8f11b549495",
"_syncId": "7161e52e-b1cc-4c13-bedd-a9d64527026f"
},
"name": "log environment vars",
"key": "log_environment_vars",
"type": "log",
"position_x": 127,
"position_y": 1,
"options": {
"message": "PARTICIPANT_BASE_URL: {{$env.PARTICIPANT_BASE_URL}}"
},
"resolve": null,
"reject": null,
"flow": "ec4e7ea5-72de-4365-b66f-d8f11b549495",
"_syncId": "7161e52e-b1cc-4c13-bedd-a9d64527026f"
},
🤖 Prompt for AI Agents
In echo/directus/sync/collections/operations.json around lines 301 to 313, the
current log action outputs the entire environment variables object, which risks
leaking sensitive information. Modify the "message" option to log only the
specific environment variable needed, such as "PARTICIPANT_BASE_URL", instead of
dumping all of process.env or $env. Alternatively, implement a condition to skip
or sanitize this log step in production environments to prevent sensitive data
exposure.

{
"name": "log environment vars",
"key": "log_environment_vars",
Expand Down Expand Up @@ -184,6 +347,28 @@
"flow": "ec4e7ea5-72de-4365-b66f-d8f11b549495",
"_syncId": "239c6fea-242d-4b7d-b854-c99d2fe43cf3"
},
{
"name": "PROCEED_ONLY_IF \"published\" in payload",
"key": "proceed_only_if_published_in_payload",
"type": "condition",
"position_x": 19,
"position_y": 1,
"options": {
"filter": {
"$trigger": {
"payload": {
"status": {
"_eq": "published"
}
}
}
}
},
"resolve": "d8554457-95b6-474f-ba67-dfd5f936d575",
"reject": "e8274ad4-5844-42cd-8a6b-d40d08cf83d3",
"flow": "ec4e7ea5-72de-4365-b66f-d8f11b549495",
"_syncId": "2784a141-2ae3-48d1-aedf-57c0be3bcc74"
},
Comment on lines +350 to +371
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Second "proceed_only_if_published_in_payload" – key clash again.

Resolve/reject IDs diverge; post-import you’ll only have one of them, breaking the other branch.

🤖 Prompt for AI Agents
In echo/directus/sync/collections/operations.json between lines 350 and 371,
there is a duplicate key "proceed_only_if_published_in_payload" causing a key
clash. This results in conflicting resolve and reject IDs that will break one of
the branches after import. To fix this, rename one of the duplicate keys to a
unique identifier and ensure its resolve and reject IDs correctly correspond to
the intended flow branches.

{
"name": "Project Data",
"key": "project_data",
Expand All @@ -207,6 +392,43 @@
"flow": "ec4e7ea5-72de-4365-b66f-d8f11b549495",
"_syncId": "ea051ae4-776f-490b-8b02-eaf4099243ef"
},
{
"name": "Project Data",
"key": "project_data",
"type": "item-read",
"position_x": 37,
"position_y": 1,
"options": {
"collection": "project",
"query": {
"filter": {
"id": {
"id": {
"_eq": "{{$trigger.payload.project_id}}"
}
}
}
}
},
"resolve": "47f1463c-3cb6-4420-a50e-92938fed3197",
"reject": null,
"flow": "ec4e7ea5-72de-4365-b66f-d8f11b549495",
"_syncId": "d8554457-95b6-474f-ba67-dfd5f936d575"
},
Comment on lines +395 to +417
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick (assertive)

Duplicate "project_data" item-read node.

Same collision pattern – rename or remove.

🤖 Prompt for AI Agents
In echo/directus/sync/collections/operations.json between lines 395 and 417,
there is a duplicate item-read node with the key "project_data" causing a
collision. To fix this, either rename one of the duplicate "project_data" keys
to a unique identifier or remove the redundant node to avoid conflicts in the
flow.

{
"name": "Report Not Published",
"key": "report_not_published",
"type": "log",
"position_x": 19,
"position_y": 19,
"options": {
"message": "The report is not yet published"
},
"resolve": null,
"reject": null,
"flow": "ec4e7ea5-72de-4365-b66f-d8f11b549495",
"_syncId": "e8274ad4-5844-42cd-8a6b-d40d08cf83d3"
},
Comment on lines +419 to +431
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick (assertive)

report_not_published logger duplicated.

Minor, but still a key collision; cleanup recommended.

🤖 Prompt for AI Agents
In echo/directus/sync/collections/operations.json around lines 419 to 431, there
is a duplicate logger entry with the key "report_not_published" causing a key
collision. Locate and remove or rename one of the duplicate entries to ensure
each logger key is unique and avoid conflicts.

{
"name": "Report Not Published",
"key": "report_not_published",
Expand All @@ -221,6 +443,37 @@
"flow": "ec4e7ea5-72de-4365-b66f-d8f11b549495",
"_syncId": "84852456-3f3a-4906-be94-8b750159883b"
},
{
"name": "Send Email Dutch",
"key": "send_email_dutch",
"type": "mail",
"position_x": 39,
"position_y": 20,
"options": {
"to": [
"{{$trigger.email}}"
],
"type": "template",
"subject": "Er is een rapport klaar met uw inbreng",
"body": null,
"data": {
"PARTICIPANT_BASE_URL": "{{$trigger.PARTICIPANT_BASE_URL}}",
"project_id": "{{$trigger.project_id}}",
"project_name": "{{$trigger.project_name}}",
"default_conversation_title": "{{$trigger.default_conversation_title}}",
"conversation_name": "{{$trigger.conversation_name}}",
"token": "{{$trigger.token}}"
},
"template": "report-notification-nl",
"replyTo": [
"info@dembrane.com"
]
},
"resolve": null,
"reject": "615a54cd-a72e-41ad-9403-9577c80280d6",
"flow": "17703446-fef0-49e9-bdc4-385db1311137",
"_syncId": "ea78ec02-364d-4f18-80f8-ea5ac4c787ed"
},
Comment on lines +447 to +476
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Two "send_email_dutch" mailers – one will disappear.

Avoid key overwrites, otherwise NL users may get ghosted.

🤖 Prompt for AI Agents
In echo/directus/sync/collections/operations.json around lines 447 to 476, there
are two mailer entries with the same key "send_email_dutch", which causes one to
overwrite the other and leads to issues for Dutch users. To fix this, ensure
each mailer has a unique "key" value by renaming one of the duplicate keys to a
distinct identifier to prevent overwriting and ensure both mailers function
correctly.

{
"name": "Send Email Dutch",
"key": "send_email_dutch",
Expand Down Expand Up @@ -252,6 +505,37 @@
"flow": "17703446-fef0-49e9-bdc4-385db1311137",
"_syncId": "34fb6ee5-2813-484a-a1cc-f97de097509b"
},
{
"name": "Send Email English",
"key": "send_email_english",
"type": "mail",
"position_x": 39,
"position_y": 1,
"options": {
"to": [
"{{$trigger.email}}"
],
"subject": "A Report Featuring Your Input is Ready",
"body": null,
"type": "template",
"template": "report-notification-en",
"data": {
"PARTICIPANT_BASE_URL": "{{$trigger.PARTICIPANT_BASE_URL}}",
"project_id": "{{$trigger.project_id}}",
"project_name": "{{$trigger.project_name}}",
"default_conversation_title": "{{$trigger.default_conversation_title}}",
"conversation_name": "{{$trigger.conversation_name}}",
"token": "{{$trigger.token}}"
},
"replyTo": [
"info@dembrane.com"
]
},
"resolve": null,
"reject": "2b24450b-6a2e-4452-aba1-9814d17fef42",
"flow": "17703446-fef0-49e9-bdc4-385db1311137",
"_syncId": "9390ed2f-7dc6-4a6a-83da-2d87d478261d"
},
Comment on lines +509 to +538
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Two "send_email_english" mailers – same fatal collision.

Unique keys or nothing works.

🤖 Prompt for AI Agents
In echo/directus/sync/collections/operations.json between lines 509 and 538,
there are two mailer entries with the identical key "send_email_english,"
causing a fatal collision. To fix this, ensure each mailer has a unique "key"
value by renaming one of the duplicate keys to a distinct identifier. This will
prevent conflicts and allow the system to differentiate between the mailers.

{
"name": "Send Email English",
"key": "send_email_english",
Expand Down Expand Up @@ -283,6 +567,22 @@
"flow": "17703446-fef0-49e9-bdc4-385db1311137",
"_syncId": "3dbf2ea1-17f8-4bde-aa89-43278fe9a00f"
},
{
"name": "Trigger Email Flow",
"key": "trigger_email_flow",
"type": "trigger",
"position_x": 109,
"position_y": 1,
"options": {
"flow": "17703446-fef0-49e9-bdc4-385db1311137",
"iterationMode": "serial",
"payload": "{{filter_emails}}"
},
"resolve": null,
"reject": null,
"flow": "ec4e7ea5-72de-4365-b66f-d8f11b549495",
"_syncId": "b8144cee-59f6-40d9-a849-dd0c639e4e31"
},
Comment on lines +570 to +585
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

trigger_email_flow duplicated – might orphan its resolve IDs.

Dedupe to keep the orchestration sane.

🤖 Prompt for AI Agents
In echo/directus/sync/collections/operations.json around lines 570 to 585, there
is a duplicated entry for "trigger_email_flow" which can cause orphaned resolve
IDs and disrupt orchestration. Remove the duplicate "trigger_email_flow" object
to ensure only one unique instance remains, maintaining proper flow references
and avoiding conflicts.

{
"name": "Trigger Email Flow",
"key": "trigger_email_flow",
Expand Down
Loading