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): Convert dynamic node-parameter routes to a decorated controller (no-changelog) #7284

Merged
merged 2 commits into from
Nov 17, 2023

Conversation

netroy
Copy link
Member

@netroy netroy commented Sep 27, 2023

  1. Reduce a lot of code duplication
  2. Move more endpoints out of Server.ts
  3. Move all query-param parsing and validation into a middleware to make the route handlers simpler.

@github-actions

This comment was marked as outdated.

@n8n-assistant n8n-assistant bot added core Enhancement outside /nodes-base and /editor-ui n8n team Authored by the n8n team ui Enhancement in /editor-ui or /design-system labels Sep 27, 2023
@codecov

This comment was marked as outdated.

@netroy netroy force-pushed the refactor-node-details-endpoints branch from c6c0af4 to eb9d0af Compare October 6, 2023 13:38
@netroy netroy requested a review from ivov October 6, 2023 14:45
@netroy netroy force-pushed the refactor-node-details-endpoints branch 2 times, most recently from 93db1ad to 380b6f8 Compare October 9, 2023 15:52
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.

I'll come back later to test.

packages/cli/src/controllers/nodeDetails.controller.ts Outdated Show resolved Hide resolved
packages/cli/src/controllers/nodeDetails.controller.ts Outdated Show resolved Hide resolved
packages/core/src/LoadNodeDetails.ts Outdated Show resolved Hide resolved
packages/cli/src/controllers/nodeDetails.controller.ts Outdated Show resolved Hide resolved
@netroy netroy force-pushed the refactor-node-details-endpoints branch from 380b6f8 to 39b865e Compare October 20, 2023 12:53
@netroy netroy requested a review from ivov October 20, 2023 12:53
@netroy netroy force-pushed the refactor-node-details-endpoints branch from 39b865e to 90f13f5 Compare October 20, 2023 13:50
@netroy netroy changed the title refactor(core): Refactor node-details endpoints (no-changelog) refactor(core): Refactor dynamic-node-parameters endpoints (no-changelog) Oct 20, 2023
@netroy netroy force-pushed the refactor-node-details-endpoints branch from 90f13f5 to 81ac215 Compare October 25, 2023 19:37
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.

Getting this using a valid Postgres credential. Same for Google Drive.

export class DynamicNodeParametersController {
constructor(private readonly service: DynamicNodeParametersService) {}

@Middleware()
Copy link
Contributor

Choose a reason for hiding this comment

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

Not to change now, just to consider - it might be more consistent to have @RestController('/dynamic-node-parameters', { middlewares: [fn] }) for controller-level middlewares, similar to endpoint-level middlewares.

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 think that's how we started with, but then the middleware functions could not use the injected dependencies, as the method being passed needed to exist before the class was instantiated.

@netroy netroy force-pushed the refactor-node-details-endpoints branch from 81ac215 to 029ea8d Compare October 27, 2023 14:16
@cypress
Copy link

cypress bot commented Oct 27, 2023

2 flaky tests on run #2938 ↗︎

0 276 5 0 Flakiness 2

Details:

🌳 🖥️ browsers:node18.12.0-chrome107 🤖 netroy 🗃️ e2e/*
Project: n8n Commit: 7554dffd59
Status: Passed Duration: 06:00 💡
Started: Nov 17, 2023 10:56 AM Ended: Nov 17, 2023 11:02 AM
Flakiness  cypress/e2e/28-resource-mapper.cy.ts • 2 flaky tests

View Output Video

Test Artifacts
Resource Mapper > should correctly delete single field Screenshots Video
Resource Mapper > should correctly delete all fields Screenshots Video

Review all test suite changes for PR #7284 ↗︎

@netroy netroy changed the title refactor(core): Refactor dynamic-node-parameters endpoints (no-changelog) refactor(core): Convert dynamic node-parameter routes to a decorated controller (no-changelog) Nov 3, 2023
@netroy netroy force-pushed the refactor-node-details-endpoints branch 2 times, most recently from de0f016 to 43632db Compare November 8, 2023 15:35
@netroy netroy requested a review from ivov November 8, 2023 16:13
@netroy netroy force-pushed the refactor-node-details-endpoints branch 2 times, most recently from 6bf0c40 to 6971d9e Compare November 10, 2023 15:55
@ivov
Copy link
Contributor

ivov commented Nov 17, 2023

Retested on GDrive and PG and confirmed working + code looks good. I'll approve after the conflict is resolved.

@netroy netroy force-pushed the refactor-node-details-endpoints branch from 6971d9e to 6070044 Compare November 17, 2023 10:02
@netroy
Copy link
Member Author

netroy commented Nov 17, 2023

rebased

ivov
ivov previously approved these changes Nov 17, 2023
Copy link
Contributor

⚠️ Some Cypress E2E specs are failing, please fix them before merging

@netroy
Copy link
Member Author

netroy commented Nov 17, 2023

This test was added after the PR was started, and I didn't catch it.
Fixed now.

@netroy netroy requested a review from ivov November 17, 2023 10:43
Copy link
Contributor

✅ All Cypress E2E specs passed

@netroy netroy merged commit fc60e9a into master Nov 17, 2023
58 of 59 checks passed
@netroy netroy deleted the refactor-node-details-endpoints branch November 17, 2023 11:03
MiloradFilipovic added a commit that referenced this pull request Nov 20, 2023
* master: (27 commits)
  fix: Include cypress TypeScript types in /cypress folder (no-changelog) (#7746)
  refactor(core): Stop reporting to Sentry `NodeApiError` outside 500 range (no-changelog) (#7753)
  fix(core): Guard against node not found on cancelling test webhook (#7750)
  fix(JotForm Trigger Node): Fix iteration on form loader (#7751)
  refactor(core): Stop reporting to Sentry unknown cred on mapping (no-changelog) (#7752)
  feat(core): Coordinate manual workflow activation and deactivation in multi-main scenario (#7643)
  ci: Fix "Release: Create Pull Request" workflow
  fix(editor): Fix Admin panel icon in the sidebar for cloud deployments (no-changelog) (#7738)
  fix(editor): Remove `n8nHooksNext` flag (no-changelog) (#7733)
  fix(editor): Show v1 banner dismiss button if owner (#7722)
  fix(GitHub Node): Fix issue preventing file edits on branches (#7734)
  fix(core): Fix all dependency versions for backend packages (no-changelog) (#7745)
  refactor(core): Convert dynamic node-parameter routes to a decorated controller (no-changelog) (#7284)
  refactor: Stop reporting to Sentry Facebook multi-webhook error (no-changelog) (#7743)
  refactor(core): Stop reporting to Sentry unrecognized node errors (no-changelog) (#7728)
  fix(core): Account for non-ASCII chars in filename on binary data download (#7742)
  ci: Fix DB tests and Workflow tests (no-changelog) (#7741)
  refactor: Extract Invitation routes to InvitationController (no-changelog) (#7726)
  fix(editor): Handle permission edge cases (empty scopes) (#7723)
  ci: Skip the regularly failing tests in 2-credentials.cy.ts (no-changelog) (#7736)
  ...
@janober
Copy link
Member

janober commented Nov 22, 2023

Got released with n8n@1.18.0

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 ui Enhancement in /editor-ui or /design-system
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants