Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(core): Move active workflows endpoints to a decorated controller class (no-changelog) #8101

Merged
merged 3 commits into from
Dec 22, 2023

Conversation

netroy
Copy link
Member

@netroy netroy commented Dec 19, 2023

Summary

This is a continuation of migrating all rest endpoints to decorated controller classes

Review / Merge checklist

  • PR title and summary are descriptive
  • Tests included

@n8n-assistant n8n-assistant bot added core Enhancement outside /nodes-base and /editor-ui n8n team Authored by the n8n team labels Dec 19, 2023
@netroy netroy force-pushed the refactor-active-workflows-endpoints branch from 4a5f232 to 88b92df Compare December 21, 2023 18:28
@netroy netroy marked this pull request as ready for review December 21, 2023 18:29
Copy link

cypress bot commented Dec 21, 2023

3 flaky tests on run #3470 ↗︎

0 320 5 0 Flakiness 3

Details:

🌳 🖥️ browsers:node18.12.0-chrome107 🤖 netroy 🗃️ e2e/*
Project: n8n Commit: a8512757a6
Status: Passed Duration: 06:44 💡
Started: Dec 22, 2023 10:16 AM Ended: Dec 22, 2023 10:23 AM
Flakiness  17-sharing.cy.ts • 1 flaky test

View Output Video

Test Artifacts
Sharing > should work for admin role on credentials created by others (also can share it with themselves) Screenshots Video
Flakiness  24-ndv-paired-item.cy.ts • 1 flaky test

View Output Video

Test Artifacts
NDV > resolves expression with default item when input node is not parent, while still pairing items Screenshots Video
Flakiness  27-two-factor-authentication.cy.ts • 1 flaky test

View Output Video

Test Artifacts
Two-factor authentication > Should be able to login with MFA token Screenshots Video

Review all test suite changes for PR #8101 ↗︎

Copy link
Contributor

@ivov ivov left a comment

Choose a reason for hiding this comment

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

Nice work! Only minor comments.

packages/cli/src/ActiveWorkflowRunner.ts Outdated Show resolved Hide resolved
packages/cli/src/ActiveWorkflowRunner.ts Outdated Show resolved Hide resolved
packages/cli/src/controllers/activeWorkflows.controller.ts Outdated Show resolved Hide resolved
cypress/e2e/30-editor-after-route-changes.cy.ts Outdated Show resolved Hide resolved
packages/cli/src/controllers/activeWorkflows.controller.ts Outdated Show resolved Hide resolved
userId: user.id,
});

throw new BadRequestError(`Workflow with ID "${workflowId}" could not be found.`);
Copy link
Contributor

Choose a reason for hiding this comment

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

For learning - I'd've used at BadRequestError and other response errors only at controller level. It's okay to use them at service level?

Copy link
Member Author

Choose a reason for hiding this comment

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

I have conflicting opinions about this. one one hand all communication layer details should be abstracted away in the controllers, on the other hand letting services throw these error makes the code a lot simpler and easier to maintain 🤷🏽.

packages/core/src/ActiveWorkflows.ts Outdated Show resolved Hide resolved
packages/editor-ui/src/api/workflows.ts Outdated Show resolved Hide resolved
packages/editor-ui/src/stores/workflows.store.ts Outdated Show resolved Hide resolved
@netroy netroy requested a review from ivov December 22, 2023 10:04
Copy link
Contributor

@ivov ivov left a comment

Choose a reason for hiding this comment

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

🏅

Copy link
Contributor

✅ All Cypress E2E specs passed

@netroy netroy merged commit 021add0 into master Dec 22, 2023
31 checks passed
@netroy netroy deleted the refactor-active-workflows-endpoints branch December 22, 2023 10:28
MiloradFilipovic added a commit that referenced this pull request Dec 22, 2023
* master:
  feat(core): Unify application components shutdown (#8097)
  refactor(core): Upgrade more dependencies to remove axios 0.x (no-changelog) (#8105)
  refactor(core): Move active workflows endpoints to a decorated controller class (no-changelog) (#8101)
  fix(editor): Prevent canvas undo/redo when NDV is open (#8118)
  fix(editor): Fix operation change failing in certain conditions (#8114)
  fix(Asana Node): Omit body from GET, HEAD, and DELETE requests (#8057)
  fix(Redis Trigger Node): Activating a workflow with a Redis trigger fails (#8129)
  refactor(Peekalink Node): Stricter typing for Peekalink api call + Tests (no-changelog) (#8125)
  fix(core): Remove circular dependency in WorkflowService and ActiveWorkflowRunner (#8128)
  fix: Show public API upgrade CTA when feature is not enabled (#8109)
  feat(Snowflake Node): Update snowflake-sdk (no-changelog) (#8087)
  fix(core): Handle empty executions table in pruning in migrations (#8121)
  feat(core): Add closeFunction support to Sub-Nodes (#7708)
  refactor(core): Move error execution creation to execution service (no-changelog) (#8006)
  ci: Add lint rule `no-dynamic-import-template` (no-changelog) (#8089)
  feat(core): Remove discontinued crypto-js  (#8104)
  🚀 Release 1.22.0 (#8115)
  fix(core): Prevent axios from force setting a form-urlencoded content-type (#8117)
  feat(Respond to Webhook Node): Overhaul with improvements like returning all items (#8093)
jamesfdavis added a commit to jamesfdavis/n8n that referenced this pull request Dec 24, 2023
* upstream/master: (32 commits)
  refactor(core): Move `typeorm` operators from `PruningService` to `ExecutionRepository` (no-changelog) (n8n-io#8145)
  refactor(core): Move more `typeorm` operators to repositories (no-changelog) (n8n-io#8143)
  refactor(core): Delete unused code, and fix typings in tests (no-changelog) (n8n-io#8142)
  docs: Improve documentation for the toTitleCase function (no-changelog) (n8n-io#8140)
  refactor(core): Move all base URLs to UrlService (no-changelog) (n8n-io#8141)
  feat(editor): Add template Id to workflow metadata (n8n-io#8088)
  fix(editor): Avoid sanitizing output to search node data (n8n-io#8126)
  fix(editor): Prevent browser zoom when scrolling inside sticky edit mode (n8n-io#8116)
  refactor(core): Move some `typeorm` operators to repositories (no-changelog) (n8n-io#8139)
  feat(editor): Add node execution status indicator to output panel (n8n-io#8124)
  feat(core): Unify application components shutdown (n8n-io#8097)
  refactor(core): Upgrade more dependencies to remove axios 0.x (no-changelog) (n8n-io#8105)
  refactor(core): Move active workflows endpoints to a decorated controller class (no-changelog) (n8n-io#8101)
  fix(editor): Prevent canvas undo/redo when NDV is open (n8n-io#8118)
  fix(editor): Fix operation change failing in certain conditions (n8n-io#8114)
  fix(Asana Node): Omit body from GET, HEAD, and DELETE requests (n8n-io#8057)
  fix(Redis Trigger Node): Activating a workflow with a Redis trigger fails (n8n-io#8129)
  refactor(Peekalink Node): Stricter typing for Peekalink api call + Tests (no-changelog) (n8n-io#8125)
  fix(core): Remove circular dependency in WorkflowService and ActiveWorkflowRunner (n8n-io#8128)
  fix: Show public API upgrade CTA when feature is not enabled (n8n-io#8109)
  ...
@Joffcom
Copy link
Member

Joffcom commented Jan 3, 2024

Got released with [email protected]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Enhancement outside /nodes-base and /editor-ui n8n team Authored by the n8n team Released
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants