Commit graph

52 commits

Author SHA1 Message Date
कारतोफ्फेलस्क्रिप्ट™ cef64329a9
refactor(core): Simplify createDeferredPromise, and add tests (no-changelog) (#10811)
Some checks failed
Test Master / install-and-build (push) Has been cancelled
Benchmark Docker Image CI / build (push) Has been cancelled
Test Master / Unit tests (18.x) (push) Has been cancelled
Test Master / Unit tests (20.x) (push) Has been cancelled
Test Master / Unit tests (22.4) (push) Has been cancelled
Test Master / Lint (push) Has been cancelled
Test Master / Notify Slack on failure (push) Has been cancelled
2024-09-13 15:53:03 +02:00
Jon e1e8a75763
fix(AWS SES Node): Fix issue with email aliases not working for sending from or sending to (#9811)
Co-authored-by: कारतोफ्फेलस्क्रिप्ट™ <aditya@netroy.in>
2024-06-20 15:42:52 +01:00
Iván Ovejero f94090b48c
ci: Fix typecheck for nodes-base (no-changelog) (#9630) 2024-06-05 12:33:02 +02:00
कारतोफ्फेलस्क्रिप्ट™ 2bdc459bb2
refactor(core): Fix type errors in workflow, core, nodes-langchain, and nodes-base (no-changelog) (#9450) 2024-05-22 17:40:52 +02:00
कारतोफ्फेलस्क्रिप्ट™ bf2ee51e36
ci: Delete unused code in some backend tests (no-changelog) (#9456) 2024-05-17 18:43:50 +02:00
Michael Kret 017ae6e102
fix(Airtable Node): Do not allow to use deprecated api keys in v1 (#9171) 2024-04-24 16:04:14 +03:00
Michael Kret 0a9f6b3de8
feat(JWT Node): New node (#9005)
Co-authored-by: Giulio Andreini <andreini@netseven.it>
2024-04-10 13:16:48 +03:00
Elias Meire 3b2078c3ca
fix(HTTP Request Node): Handle special characters in pagination expressions + improve hint text (#8576)
Co-authored-by: Michael Kret <michael.k@radency.com>
2024-02-12 17:32:27 +01:00
Tomi Turtiainen 9a1cc56806
fix: Set '@typescript-eslint/return-await' rule to 'always' for node code (no-changelog) (#8363)
Co-authored-by: कारतोफ्फेलस्क्रिप्ट™ <aditya@netroy.in>
2024-01-17 17:08:50 +02:00
कारतोफ्फेलस्क्रिप्ट™ 1d2666b37c
refactor(Peekalink Node): Stricter typing for Peekalink api call + Tests (no-changelog) (#8125)
This PR is an example for how we can
1. improve typing and remove boilerplate code in may of our nodes
2. use nock to write effective unit tests for nodes that make external
calls

## Review / Merge checklist
- [x] PR title and summary are descriptive
- [x] Add tests
2023-12-21 18:22:32 +01:00
Iván Ovejero e77fd5d286
refactor: Switch plain errors in nodes-base to ApplicationError (no-changelog) (#7914)
Ensure all errors in `nodes-base` are `ApplicationError` or children of
it and contain no variables in the message, to continue normalizing all
the backend errors we report to Sentry. Also, skip reporting to Sentry
errors from user input and from external APIs. In future we should
refine `ApplicationError` to more specific errors.

Follow-up to: [#7877](https://github.com/n8n-io/n8n/pull/7877)

- [x] Test workflows:
https://github.com/n8n-io/n8n/actions/runs/7084627970
- [x] e2e: https://github.com/n8n-io/n8n/actions/runs/7084936861

---------

Co-authored-by: Michael Kret <michael.k@radency.com>
2023-12-05 11:17:08 +01:00
Elias Meire 14035e1244
feat(editor): Add HTTP request nodes for credentials without a node (#7157)
Github issue / Community forum post (link here to close automatically):

---------

Co-authored-by: Giulio Andreini <g.andreini@gmail.com>
Co-authored-by: कारतोफ्फेलस्क्रिप्ट™ <aditya@netroy.in>
2023-11-13 12:11:16 +01:00
कारतोफ्फेलस्क्रिप्ट™ 35bb42c1b9
refactor(core): Avoid passing around static state like default timezone (no-changelog) (#7221) 2023-10-27 14:17:52 +02:00
Iván Ovejero 62c096710f
refactor: Run lintfix (no-changelog) (#7537)
- Fix autofixable violations
- Remove unused directives
- Allow for PascalCased variables - needed for dynamically imported or
assigned classes, decorators, routers, etc.
2023-10-27 14:15:02 +02:00
कारतोफ्फेलस्क्रिप्ट™ 05586a900d
refactor(core): Make Logger a service (no-changelog) (#7494) 2023-10-25 16:35:22 +02:00
कारतोफ्फेलस्क्रिप्ट™ b6de910cbe
refactor(core): Abstract away InstanceSettings and encryptionKey into injectable services (no-changelog) (#7471)
This change ensures that things like `encryptionKey` and `instanceId`
are always available directly where they are needed, instead of passing
them around throughout the code.
2023-10-23 13:39:35 +02:00
Iván Ovejero 1a661e6d00
feat(core): Integrate object store as binary data manager (#7253)
Depends on: #7225 | Story:
[PAY-848](https://linear.app/n8n/issue/PAY-848)

This PR integrates the object store service as a new binary data manager
for Enterprise.
2023-10-05 15:25:17 +02:00
Iván Ovejero 6d6e2488c6
refactor(core): Generalize binary data manager interface (no-changelog) (#7164)
Depends on: #7092 | Story:
[PAY-768](https://linear.app/n8n/issue/PAY-768)

This PR: 
- Generalizes the `IBinaryDataManager` interface.
- Adjusts `Filesystem.ts` to satisfy the interface.
- Sets up an S3 client stub to be filled in in the next PR.
- Turns `BinaryDataManager` into an injectable service.
- Adjusts the config schema and adds new validators.

Note that the PR looks large but all the main changes are in
`packages/core/src/binaryData`.

Out of scope:
- `BinaryDataManager` (now `BinaryDataService`) and `Filesystem.ts` (now
`fs.client.ts`) were slightly refactored for maintainability, but fully
overhauling them is **not** the focus of this PR, which is meant to
clear the way for the S3 implementation. Future improvements for these
two should include setting up a backwards-compatible dir structure that
makes it easier to locate binary data files to delete, removing
duplication, simplifying cloning methods, using integers for binary data
size instead of `prettyBytes()`, writing tests for existing binary data
logic, etc.

---------

Co-authored-by: कारतोफ्फेलस्क्रिप्ट™ <aditya@netroy.in>
2023-09-22 17:22:12 +02:00
Iván Ovejero cd08c8e4c6
refactor(core): Implement soft-deletions for executions (#7092)
Based on #7065 | Story: https://linear.app/n8n/issue/PAY-771

n8n on filesystem mode marks binary data to delete on manual execution
deletion, on unsaved execution completion, and on every execution
pruning cycle. We later prune binary data in a separate cycle via these
marker files, based on the configured TTL. In the context of introducing
an S3 client to manage binary data, the filesystem mode's mark-and-prune
setup is too tightly coupled to the general binary data management
client interface.

This PR...
- Ensures the deletion of an execution causes the deletion of any binary
data associated to it. This does away with the need for binary data TTL
and simplifies the filesystem mode's mark-and-prune setup.
- Refactors all execution deletions (including pruning) to cause soft
deletions, hard-deletes soft-deleted executions based on the existing
pruning config, and adjusts execution endpoints to filter out
soft-deleted executions. This reduces DB load, and keeps binary data
around long enough for users to access it when building workflows with
unsaved executions.
- Moves all execution pruning work from an execution lifecycle hook to
`execution.repository.ts`. This keeps related logic in a single place.
- Removes all marking logic from the binary data manager. This
simplifies the interface that the S3 client will meet.
- Adds basic sanity-check tests to pruning logic and execution deletion.

Out of scope:

- Improving existing pruning logic.
- Improving existing execution repository logic.
- Adjusting dir structure for filesystem mode.

---------

Co-authored-by: कारतोफ्फेलस्क्रिप्ट™ <aditya@netroy.in>
2023-09-20 15:21:42 +02:00
Iván Ovejero 8cd4db0ab7
refactor(core): Simplify marking logic in binary data manager (no-changelog) (#7046)
- For a saved execution, we write to disk binary data and metadata.
These two are only ever deleted via `POST /executions/delete`. No marker
file, so untouched by pruning.
- For an unsaved execution, we write to disk binary data, binary data
metadata, and a marker file at `/meta`. We later delete all three during
pruning.
- The third flow is legacy. Currently, if the execution is unsaved, we
actually store it in the DB while running the workflow and immediately
after the workflow is finished during the `onWorkflowPostExecute()` hook
we delete that execution, so the second flow applies. But formerly, we
did not store unsaved executions in the DB ("ephemeral executions") and
so we needed to write a marker file at `/persistMeta` so that, if the
ephemeral execution crashed after the step where binary data was stored,
we had a way to later delete its associated dangling binary data via a
second pruning cycle, and if the ephemeral execution succeeded, then we
immediately cleaned up the marker file at `/persistMeta` during the
`onWorkflowPostExecute()` hook.

This creation and cleanup at `/persistMeta` is still happening, but this
third flow no longer has a purpose, as we now store unsaved executions
in the DB and delete them immediately after. Hence the third flow can be
removed.
2023-08-31 16:02:20 +02:00
Alex Grozav ed927d34b2
feat: External Secrets storage for credentials (#6477)
Github issue / Community forum post (link here to close automatically):

---------

Co-authored-by: Romain Minaud <romain.minaud@gmail.com>
Co-authored-by: Valya Bullions <valya@n8n.io>
Co-authored-by: Csaba Tuncsik <csaba@n8n.io>
Co-authored-by: Giulio Andreini <g.andreini@gmail.com>
Co-authored-by: Omar Ajoue <krynble@gmail.com>
2023-08-25 10:33:46 +02:00
Iván Ovejero 7ce5d8fd90
refactor: Upgrade to Prettier 3 (no-changelog) (#6947)
Supersedes https://github.com/n8n-io/n8n/pull/6937

Excluding fixtures and test workflow JSONs to avoid having to update
tests.
2023-08-16 17:13:57 +02:00
कारतोफ्फेलस्क्रिप्ट™ 31d8f478ee
refactor(core): Parse Webhook request bodies on-demand (#6394)
Also,
1. Consistent CORS support ~on all three webhook types~ waiting webhooks never supported CORS. I'll fix that in another PR
2. [Fixes binary-data handling when request body is text, json, or xml](https://linear.app/n8n/issue/NODE-505/webhook-binary-data-handling-fails-for-textplain-files).
3. Reduced number of middleware that each request has to go through.
4. Removed the need to maintain webhook endpoints in the auth-exception list.
5. Skip all middlewares (apart from `compression`) on Webhook routes. 
6. move `multipart/form-data` support out of individual nodes
7. upgrade `formidable`
8. fix the filenames on binary-data in webhooks nodes
9. add unit tests and integration tests for webhook request handling, and increase test coverage
2023-08-01 17:32:30 +02:00
कारतोफ्फेलस्क्रिप्ट™ 0a31b8e2b4
feat(Read PDF Node): Replace pdf-parse with pdfjs, and add support for streaming and encrypted PDFs (#6640) 2023-07-18 20:07:29 +02:00
कारतोफ्फेलस्क्रिप्ट™ e33cc2c27c Merge remote-tracking branch 'origin/master' into release/1.0.1 2023-07-05 20:01:24 +02:00
कारतोफ्फेलस्क्रिप्ट™ d97edbcffa
fix(core): Make node execution order configurable, and backward-compatible (#6507)
* fix(core): Make node execution order configurable, and backward-compatible

*  Also add new Merge-Node behaviour

*  Fix typo

* Fix lint issue

* update labels

* rename legacy to v0

* remove the unnecessary log

* default all new workflows to use v1 execution-order

* remove the controller changes

* clone default settings to avoid it getting modified

---------

Co-authored-by: Jan Oberhauser <jan.oberhauser@gmail.com>
2023-07-05 18:47:34 +02:00
Giulio Andreini 42721dba80
feat(Twitter Node): Node overhaul (#4788)
* First node set up.

* Progress: all Resources and Operations updated

* Upsates to all resources.

* Updated tooltip for Tweet > Search > Tweet fields.

* Upodate to resource locator items in User > Search.

* Added e.g. to placeholders and minor copy tweaks.

* Fixed Operations sorting.

* Added a couple of operations back.

* Removed 'Authorized API Call'.

* Remove authorization header when empty

* Import pkce

* Add OAuth2 with new grant type to Twitter

* Add pkce logic auto assign authorization code if pkce not defined

* Add pkce to ui and interfaces

* Fix scopes for Oauth2 twitter

* Deubg + pass it through header

* Add debug console, add airtable cred

* Remove all console.logs, make PKCE in th body only when it exists

* Remove invalid character ~

* Remove more console.logs

* remove body inside query

* Remove useless grantype check

* Hide oauth2 twitter waiting for overhaul

* Remove redundant header removal

* Remove more console.logs

* Add V2 twitter

* Add V1

* Fix description V1, V2

* Fix description for V1

* Add Oauth2 request

* Add user lookup

* Add search username by ID

* Search tweet feat

* Wip create tweet

* Generic function for returning ID

* Add like and retweet feat

* Add delete tweet feat

* Fix Location tweets

* Fix type

* Feat List add members

* Add scopes for dm and list

* Add direct message feature

* Improve response data

* Fix regex

* Add unit test to Twitter v2

* Fix unit test

* Remove console.logs

* Remove more console.logs

* Handle @ in username

* Minor copy tweaks.

* Add return all logic

* Add error for api permission error

* Update message api error

* Add error for date error

* Add notice for TwitterOAuth2 api link

* Fix display names location

* fix List RLC

* Fix like endpoint

* Fix error message check

* fix(core): Fix OAuth2 callback for grantType=clientCredentials

* Improve fix for callback

* update pnpm

* Fix iso time for end time

* sync oauth2Credential

* remove unused codeVerifer in Server.ts

* Add location and attachments notice

* Add notice to oauth1

* Improve notice for twitter

* moved credentials notice to TwitterOAuth1Api.credentials.ts

---------

Co-authored-by: agobrech <ael.gobrecht@gmail.com>
Co-authored-by: कारतोफ्फेलस्क्रिप्ट™ <aditya@netroy.in>
Co-authored-by: Marcus <marcus@n8n.io>
2023-06-28 12:19:25 +02:00
Jan Oberhauser 4b0e0b7970
fix(core): Fix pairedItem for alwaysOutputData & multi identical resolve (#6405) 2023-06-21 10:38:28 +03:00
कारतोफ्फेलस्क्रिप्ट™ f3bc6f19b6
feat: Create NPM node (#6177) 2023-05-10 12:37:26 +02:00
agobrech 7d1d1f7872
feat(Date & Time Node): Overhaul of the node (#5904)
* Setup versionized node

* Fix node naming

* Set all possible actions

* Add Current Date operation

* Add timezone to current date

* feat add to date operator

* Change output field name to camel case

* Fix info box for luxons tip

* Feat subtract to date operation

* Feat format date operation

* Fix to node field for format date

* Feat rounding operation

* Feat get in between date operation

* Feat add extract date operation

* Add generic function for parsing date

* Remove moment methods from operations

* Change moment to luxon for the rest of the operations

* Fix Format date operation

* Fix format value

* Add timezone option for current date

* Add tests, improve workflow settings for testing, toString the results

* Change icon for V2

* Revert "Change icon for V2"

This reverts commit 46b59bea2e.

* Change workflow  test name

* Fix ui bug for custom format

* Fix default value for format operation

* Fix info box for rounding operation

* Change default for units for between time operation

* Inprove fields and resort time units

* Fix extract week number

* Resolve issue with formating and timezones

* Fix field name and unit order

*  restored removed test case, sync v1 with curent master

*  parseDate update to support timestamps, tests

* Keep same field for substract and add time

* Update unit test

* Improve visibility, add iso to string option

* Update option naming

---------

Co-authored-by: Michael Kret <michael.k@radency.com>
2023-05-08 17:34:14 +02:00
Marcus ee582cc3bd
test: Create custom jest error messages using jest-expect-message (no-changelog) (#5666)
* using jest-expect-message to add custom error message

* improve error message

* improvements after merge

---------

Co-authored-by: Michael Kret <michael.k@radency.com>
2023-05-05 17:50:10 +02:00
कारतोफ्फेलस्क्रिप्ट™ deb4c04f34
fix(AWS S3 Node): Fix File upload, and add node tests (#6153) 2023-05-02 17:29:07 +02:00
Michael Kret 5364a2dff3
feat(Microsoft Excel 365 Node): Overhaul 2023-05-02 12:44:25 +03:00
Iván Ovejero 06fa6f1fb3
ci: Expand ESLint to tests in BE packages (no-changelog) (#6147)
* 🔧 Adjust base ESLint config

* 🔧 Adjust `lint` and `lintfix` in `nodes-base`

* 🔧 Include `test` and `utils` in `nodes-base`

* 📘 Convert JS tests to TS

* 👕 Apply lintfixes
2023-05-02 10:37:19 +02:00
Val 1bb987140a
feat: Add variables feature (#5602)
* feat: add variables db models and migrations

* feat: variables api endpoints

* feat: add $variables to expressions

* test: fix ActiveWorkflowRunner tests failing

* test: a different fix for the tests broken by $variables

* feat: variables licensing

* fix: could create one extra variable than licensed for

* feat: Add Variables UI page and $vars global property (#5750)

* feat: add support for row slot to datatable

* feat: add variables create, read, update, delete

* feat: add vars autocomplete

* chore: remove alert

* feat: add variables autocomplete for code and expressions

* feat: add tests for variable components

* feat: add variables search and sort

* test: update tests for variables view

* chore: fix test and linting issue

* refactor: review changes

* feat: add variable creation telemetry

* fix: Improve variables listing and disabled case, fix resource sorting (no-changelog) (#5903)

* fix: Improve variables disabled experience and fix sorting

* fix: update action box margin

* test: update tests for variables row and datatable

* fix: Add ee controller to base controller

* fix: variables.ee routes not being added

* feat: add variables validation

* fix: fix vue-fragment bug that breaks everything

* chore: Update lock

* feat: Add variables input validation and permissions (no-changelog) (#5910)

* feat: add input validation

* feat: handle variables view for non-instance-owner users

* test: update variables tests

* fix: fix data-testid pattern

* feat: improve overflow styles

* test: fix variables row snapshot

* feat: update sorting to take newly created variables into account

* fix: fix list layout overflow

* fix: fix adding variables on page other than 1. fix validation

* feat: add docs link

* fix: fix default displayName function for resource-list-layout

* feat: improve vars expressions ux, cm-tooltip

* test: fix datatable test

* feat: add MATCH_REGEX validation rule

* fix: overhaul how datatable pagination selector works

* feat: update  completer description

* fix: conditionally update usage syntax based on key validation

* test: update datatable snapshot

* fix: fix variables-row button margins

* fix: fix pagination overflow

* test: Fix broken test

* test: Update snapshot

* fix: Remove duplicate declaration

* feat: add custom variables icon

---------

Co-authored-by: Alex Grozav <alex@grozav.com>
Co-authored-by: Omar Ajoue <krynble@gmail.com>
2023-04-18 12:41:55 +02:00
Michael Kret 0a53c957c4
feat(MySQL Node): Overhaul 2023-04-12 17:24:17 +03:00
Iván Ovejero 6cf74e412a
feat: Create TOTP node (#5901)
*  Create TOTP node

* ♻️ Apply feedback

* ♻️ Recreate `pnpm-lock.yaml`

* ♻️ Apply Giulio's feedback

* 🚧 WIP node tests

*  Finish node test setup

*  Restore test command

*  linter fixes, tweaks

* ♻️ Address Michael's feedback

---------

Co-authored-by: Michael Kret <michael.k@radency.com>
2023-04-11 11:58:47 +02:00
Michael Kret 07dc0e4b40
feat(Postgres Node): Overhaul node 2023-04-03 18:18:01 +03:00
कारतोफ्फेलस्क्रिप्ट™ 3831201aaf
ci: Setup code-coverage reporting (no-changelog) (#5669) 2023-03-10 16:53:05 +01:00
Marcus 5b1e3a3fd3
test(Write Binary File Node): Unit tests (no-changelog) (#5440)
*  add write binary file test

* 🎨 cleanup

---------

Co-authored-by: Michael Kret <michael.k@radency.com>
2023-02-10 09:53:20 +01:00
Michael Kret 2150ea0e79
test(HTTP Request Node): Unit tests (no-changelog) 2023-02-09 12:25:26 +02:00
Marcus 74fc1414d7
test(Spreadsheet File Node): Unit tests (no-changelog) (#5385)
* ️test setup

* ️fix  'testData' implicitly has an 'any' type.

*  test github action file binary data reading

*  checking for output binary equality

*  writing files to different formats

*  reading spreadsheet with different options

* ️improve workflow file path replacement

* 🐛 fixing string.at() not supported in node 14.

* 🐛 trying to fix github action test error

*  fix for empty binary

*  switch for binary test

* ️test helpers now return/compare json and binary (if not empty))

*  removed commented console log

---------

Co-authored-by: Michael Kret <michael.k@radency.com>
2023-02-09 09:00:29 +01:00
Marcus 1f924e3c3d
test(Set Node): Add tests for Set Node (no-changelog) (#5409)
* ️move test files

*  set node test workflow

---------

Co-authored-by: Michael Kret <michael.k@radency.com>
2023-02-08 18:04:11 +01:00
Marcus 269691aa1b
test(IF Node): Unit tests (no-changelog) (#5404)
* ️move test files

* ️IF boolean tests

* ️IF string tests

*  IF number tests

*  IF date-time tests

* 🎨 update Test name to make more sense
2023-02-08 15:20:17 +01:00
Jonathan Bennetts f44b4b1314
test(Split In Batches Node): Add test for Split in Batches node (no-changelog) (#5381) 2023-02-08 12:15:36 +00:00
Michael Kret 26b69b5ffc
test(Item Lists Node): Unit tests (no-changelog) 2023-02-07 11:27:37 +02:00
Valya 9a7f3da4a3
test: Automatically load workflow nodes in node tests (#5380)
test: automatically load workflow nodes in node tests
2023-02-06 15:14:57 +00:00
agobrech 5b9c650e55
test: Add unit testing to nodes (no-changelog) (#4890)
* 🧪 Add base for building unit testing within nodes

* Improve helper functions

* 🧪 If node test

* 🧪 Airtable node test

* 🧪 If node test improvements

* 🧪 Airtable node test improvements

* ♻️ cleanup node unit tests

* ♻️ refactor getting node result data to use helper method

*  removed unused variables

* ♻️ Helper to read json files

---------

Co-authored-by: Marcus <marcus@n8n.io>
Co-authored-by: Michael Kret <michael.k@radency.com>
2023-01-30 12:20:33 +01:00
Iván Ovejero 4dac848758
ci: Enable Prettier for /nodes-base (#3315)
*  Extend `.prettierignore` patterns

* 🎨 Apply Prettier to `/src` and `/test`

* 🎨 Update `.prettierignore`

* ✏️ Group dirs with same nesting level

* ✏️ Alphabetize credentials
2022-06-20 14:51:01 -07:00
Daniel Santamaría a5805fb80b
🐛 Fix Stripe node multiple metadata values (#2395) 2021-11-03 18:44:25 -06:00