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: Use NodeConnectionType consistently across the code base (no-changelog) #10595

Merged
merged 12 commits into from
Aug 29, 2024

Conversation

RicardoE105
Copy link
Contributor

@RicardoE105 RicardoE105 commented Aug 28, 2024

Summary

I was moving the NodeSettings.vue file #10545 to use the composition API and trying to fix one small type issue snowball into a lot of type issues because we have two types in the FE that represent the same. One is an enum, and the other is a type union that we use in the editor-ui, workflow, and nodes-base, and they do not match (a known problem with enums). So, to avoid this, I deleted the ConnectionType type and used the NodeConnectionType enum everywhere.

  • Uses NodeConnectionType consistently across the code base.
  • Deletes ConnectionType type.

ALL unit, integration and e2e tests pass.

Review / Merge checklist

  • PR title and summary are descriptive. (conventions)
  • Docs updated or follow-up ticket created.
  • Tests included.
  • PR Labeled with release/backport (if the PR is an urgent fix that needs to be backported)

@RicardoE105 RicardoE105 changed the title Use NodeConnectionType consistently across code base refactor: Use NodeConnectionType consistently across code base (no-changelog) Aug 28, 2024
@RicardoE105 RicardoE105 changed the title refactor: Use NodeConnectionType consistently across code base (no-changelog) refactor: Use NodeConnectionType consistently across code base (no-changelog) Aug 28, 2024
@RicardoE105 RicardoE105 requested a review from tomi August 28, 2024 17:08
@n8n-assistant n8n-assistant bot added core Enhancement outside /nodes-base and /editor-ui n8n team Authored by the n8n team node/improvement New feature or request ui Enhancement in /editor-ui or /design-system labels Aug 28, 2024
Copy link

cypress bot commented Aug 28, 2024

n8n    Run #6665

Run Properties:  status check passed Passed #6665  •  git commit 93a6afacd5: 🌳 🖥️ browsers:node18.12.0-chrome107 🤖 RicardoE105 🗃️ e2e/*
Project n8n
Branch Review refactor-types-NodeConnectionType
Run status status check passed Passed #6665
Run duration 04m 48s
Commit git commit 93a6afacd5: 🌳 🖥️ browsers:node18.12.0-chrome107 🤖 RicardoE105 🗃️ e2e/*
Committer Ricardo Espinoza
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 0
Tests that did not run due to a developer annotating a test with .skip  Pending 0
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 421
View all changes introduced in this branch ↗︎

@RicardoE105 RicardoE105 changed the title refactor: Use NodeConnectionType consistently across code base (no-changelog) refactor: Use NodeConnectionType consistently the across code base (no-changelog) Aug 28, 2024
@@ -155,6 +155,7 @@ export class MemoryRedisChat implements INodeType {

const memory = new memClass({
memoryKey: 'chat_history',
//@ts-ignore
Copy link
Contributor Author

@RicardoE105 RicardoE105 Aug 28, 2024

Choose a reason for hiding this comment

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

Only ts-ignore I had to add. Very weird because I did not touch anything related to this. Wondering if @lanchain/core updated its types 🤔

Copy link
Contributor

Choose a reason for hiding this comment

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

Could this be related to the changes in pnpm-lock.yaml? I guess it shouldn't have changed since there are no package.json changes?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It seems like this was the case! Updated the pnpm-lock.yaml to have we have in master and it seems to have fixed the type issue 🙏

@RicardoE105 RicardoE105 force-pushed the refactor-types-NodeConnectionType branch from 6e9da19 to 045512d Compare August 28, 2024 18:17
@RicardoE105 RicardoE105 changed the title refactor: Use NodeConnectionType consistently the across code base (no-changelog) refactor: Use NodeConnectionType consistentlt across the code base (no-changelog) Aug 28, 2024
@RicardoE105 RicardoE105 changed the title refactor: Use NodeConnectionType consistentlt across the code base (no-changelog) refactor: Use NodeConnectionType consistently across the code base (no-changelog) Aug 28, 2024
Copy link
Contributor

@tomi tomi left a comment

Choose a reason for hiding this comment

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

Thank you for doing this improvement ❤️ Certainly wasn't a small feat. Mostly looking great 👌 Couple questions and also we shouldn't remove more specific types, or was there a reason for doing that?

@@ -155,6 +155,7 @@ export class MemoryRedisChat implements INodeType {

const memory = new memClass({
memoryKey: 'chat_history',
//@ts-ignore
Copy link
Contributor

Choose a reason for hiding this comment

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

Could this be related to the changes in pnpm-lock.yaml? I guess it shouldn't have changed since there are no package.json changes?

@@ -66,13 +66,13 @@ module.exports = {
'n8n-nodes-base/node-class-description-display-name-unsuffixed-trigger-node': 'error',
'n8n-nodes-base/node-class-description-empty-string': 'error',
'n8n-nodes-base/node-class-description-icon-not-svg': 'error',
'n8n-nodes-base/node-class-description-inputs-wrong-regular-node': 'error',
'n8n-nodes-base/node-class-description-inputs-wrong-regular-node': 'off',
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are these two turned off?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This rules check if the output or input properties are and array of string with valid values. With the enum they do not work, we need to update the rule or get rid of it altogether! Will double check with Ivan as he created this rules

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Synced with Ivan and suggested to leave them off until we update the rules validate the enums instead of an array of strings

Copy link
Contributor

Choose a reason for hiding this comment

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

Alright, can you create a follow-up for that so we don't forget 🙏

packages/nodes-base/nodes/Bubble/GenericFunctions.ts Outdated Show resolved Hide resolved
packages/nodes-base/nodes/Freshservice/GenericFunctions.ts Outdated Show resolved Hide resolved
packages/nodes-base/nodes/Grist/GenericFunctions.ts Outdated Show resolved Hide resolved
@RicardoE105 RicardoE105 requested a review from tomi August 29, 2024 13:20
Copy link
Contributor

@tomi tomi 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

@RicardoE105 RicardoE105 merged commit c4eb374 into master Aug 29, 2024
41 of 51 checks passed
@RicardoE105 RicardoE105 deleted the refactor-types-NodeConnectionType branch August 29, 2024 13:55
MiloradFilipovic added a commit that referenced this pull request Aug 30, 2024
* master: (21 commits)
  feat: Add queue mode setup to benchmarks (no-changelog) (#10608)
  feat: Add n8n postgres setup to benchmarks (no-changelog) (#10604)
  fix(API): Update express-openapi-validator to resolve AIKIDO-2024-10229 (#10612)
  fix: Fix edge case in log in (no-changelog) (#10610)
  feat: Add local orchestration of benchmarks (no-changelog) (#10589)
  ci: Run nightly benchmark against nightly n8n image (no-changelog) (#10588)
  fix: Reduce variability in benchmarks (no-changelog) (#10606)
  docs: Add missing changelog entry (#10609)
  refactor(editor): Convert ResourceLocator to composition API (no-changelog) (#10526)
  feat(editor): Update new canvas node handle label rendering mechanism and design (no-changelog) (#10611)
  refactor(editor): Convert credential related components to composition API (no-changelog) (#10530)
  fix(HTTP Request Node): Sanitize authorization headers (#10607)
  refactor: Use `NodeConnectionType` consistently across the code base (no-changelog) (#10595)
  fix(editor): Hide execution buttons in readonly mode in new canvas (no-changelog) (#10603)
  fix(editor): Prevent keyboard shortcuts when ndv is open in new canvas (no-changelog) (#10601)
  fix(editor): Add confirmation toast when changing user role (#10592)
  feat(editor): Add support for changing sticky notes color in new canvas (no-changelog) (#10593)
  ci: Fix `forceConsistentCasingInFileNames` for aliased paths (no-changelog) (#10598)
  feat(editor): Allow sticky notes alongside fallback nodes in new canvas (no-changelog) (#10583)
  ci: Push nightly images to ghcr (no-changelog) (#10580)
  ...
@janober
Copy link
Member

janober commented Sep 5, 2024

Got released with n8n@1.58.0

@anantanandgupta
Copy link

eslint-plugin-n8n-nodes-base is not happy with NodeConnectionType.Main

30:3 error Replace with "['main']" [autofixable] n8n-nodes-base/node-class-description-outputs-wrong

if I put ['main'] then INodeTypeDescription yells at me.

I am not sure how the community node developers are keeping up with you guys. :(

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 node/improvement New feature or request Released ui Enhancement in /editor-ui or /design-system
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants