Commit graph

224 commits

Author SHA1 Message Date
Iván Ovejero b716241b42
feat(core): Add filtering, selection and pagination to users (#6994)
https://linear.app/n8n/issue/PAY-646
2023-08-28 16:13:17 +02:00
कारतोफ्फेलस्क्रिप्ट™ 596b5695cd
fix(Webhook Node): Fix URL params for webhooks (#6986)
Fixes:

https://community.n8n.io/t/empty-params-variables-in-webhook-node-after-upgrading-to-n8n-1-3-1/29624
2023-08-25 13:28:32 +02:00
Iván Ovejero 87cf1d9c1b
refactor(core): Make controller constructors consistent (no-changelog) (#7015) 2023-08-25 13:23:22 +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
Ricardo Espinoza 2b7ba6fdf1
feat(core): Add MFA (#4767)
https://linear.app/n8n/issue/ADO-947/sync-branch-with-master-and-fix-fe-e2e-tets

---------

Co-authored-by: कारतोफ्फेलस्क्रिप्ट™ <aditya@netroy.in>
2023-08-23 22:59:16 -04:00
Iván Ovejero 96a9de68a0
refactor(core): Move all user DB access to UserRepository (#6910)
Prep for https://linear.app/n8n/issue/PAY-646
2023-08-22 15:58:05 +02:00
Iván Ovejero 2cfa6d344e
refactor: Consolidate WorkflowService.getMany() (no-changelog) (#6892)
In scope:

- Consolidate `WorkflowService.getMany()`.
- Support non-entity field `ownedBy` for `select`.
- Support `tags` for `filter`.
- Move `addOwnerId` to `OwnershipService`.
- Remove unneeded check for `filter.id`.
- Simplify DTO validation for `filter` and `select`.
- Expand tests for `GET /workflows`.

Workflow list query DTOs:

```
filter → name, active, tags
select → id, name, active, tags, createdAt, updatedAt, versionId, ownedBy
```

Out of scope:

- Migrate `shared_workflow.roleId` and `shared_credential.roleId` to
string IDs.
- Refactor `WorkflowHelpers.getSharedWorkflowIds()`.
2023-08-22 13:19:37 +02:00
Iván Ovejero dd233bdf7d
test: Fix license tests when tenantId is not default (no-changelog) (#6977)
License tests fail if the env has a non-default `tenantId`:

<details>
<summary>Stack trace</summary>

```
nt -- license

> n8n@1.3.0 test /Users/ivov/Development/n8n/packages/cli
> pnpm test:sqlite "--" "license"


> n8n@1.3.0 test:sqlite /Users/ivov/Development/n8n/packages/cli
> N8N_LOG_LEVEL=silent DB_TYPE=sqlite jest "--" "license"

 FAIL  test/unit/License.test.ts
  License
    ✕ initializes license manager (8 ms)
    ✓ attempts to activate license with provided key
    ✓ renews license (1 ms)
    ✓ check if feature is enabled (2 ms)
    ✓ check if sharing feature is enabled (1 ms)
    ✓ check fetching entitlements
    ✓ check fetching feature values (1 ms)
    ✓ check management jwt
    ✓ getMainPlan() returns the right entitlement (3 ms)
    ✓ getMainPlan() returns undefined if there is no main plan

  ● License › initializes license manager

    expect(jest.fn()).toHaveBeenCalledWith(...expected)

    - Expected
    + Received

      Object {
        "autoRenewEnabled": true,
        "autoRenewOffset": 259200,
    -   "deviceFingerprint": Any<Function>,
    -   "loadCertStr": Any<Function>,
    -   "logger": Anything,
    +   "deviceFingerprint": [Function deviceFingerprint],
    +   "loadCertStr": [Function loadCertStr],
    +   "logger": Logger {
    +     "logger": DerivedLogger {
    +       "_events": Object {
    +         "data": [Function ondata],
    +         "end": [Function bound onceWrapper],
    +         "prefinish": [Function prefinish],
    +       },
    +       "_eventsCount": 3,
    +       "_maxListeners": undefined,
    +       "_readableState": ReadableState {
    +         "autoDestroy": false,
    +         "awaitDrain": 0,
    +         "buffer": BufferList {
    +           "head": null,
    +           "length": 0,
    +           "tail": null,
    +         },
    +         "decoder": null,
    +         "defaultEncoding": "utf8",
    +         "destroyed": false,
    +         "emitClose": true,
    +         "emittedReadable": false,
    +         "encoding": null,
    +         "endEmitted": false,
    +         "ended": false,
    +         "flowing": true,
    +         "highWaterMark": 16,
    +         "length": 0,
    +         "needReadable": true,
    +         "objectMode": true,
    +         "paused": false,
    +         "pipes": Console {
    +           "__winstonerror": [Function bound transportEvent],
    +           "__winstonwarn": [Function bound transportEvent],
    +           "_events": Object {
    +             "close": [Function bound onceWrapper],
    +             "drain": [Function pipeOnDrainFunctionResult],
    +             "error": Array [
    +               [Function onerror],
    +               [Function bound transportEvent],
    +             ],
    +             "finish": [Function bound onceWrapper],
    +             "unpipe": Array [
    +               [Function bound onceWrapper],
    +               [Function onunpipe],
    +             ],
    +             "warn": [Function bound transportEvent],
    +           },
    +           "_eventsCount": 6,
    +           "_maxListeners": 30,
    +           "_writableState": WritableState {
    +             "autoDestroy": false,
    +             "bufferProcessing": false,
    +             "bufferedRequest": null,
    +             "bufferedRequestCount": 0,
    +             "corked": 0,
    +             "corkedRequestsFree": CorkedRequest {
    +               "entry": null,
    +               "finish": [Function anonymous],
    +               "next": null,
    +             },
    +             "decodeStrings": true,
    +             "defaultEncoding": "utf8",
    +             "destroyed": false,
    +             "emitClose": true,
    +             "ended": false,
    +             "ending": false,
    +             "errorEmitted": false,
    +             "finalCalled": false,
    +             "finished": false,
    +             "highWaterMark": 16,
    +             "lastBufferedRequest": null,
    +             "length": 0,
    +             "needDrain": false,
    +             "objectMode": true,
    +             "onwrite": [Function anonymous],
    +             "pendingcb": 0,
    +             "prefinished": false,
    +             "sync": true,
    +             "writecb": null,
    +             "writelen": 0,
    +             "writing": false,
    +           },
    +           "consoleWarnLevels": Object {},
    +           "eol": "
    + ",
    +           "format": Printf {
    +             "template": [Function anonymous],
    +           },
    +           "handleExceptions": undefined,
    +           "handleRejections": undefined,
    +           "level": undefined,
    +           "levels": Object {
    +             "debug": 5,
    +             "error": 0,
    +             "http": 3,
    +             "info": 2,
    +             "silly": 6,
    +             "verbose": 4,
    +             "warn": 1,
    +           },
    +           "name": "console",
    +           "parent": [Circular],
    +           "silent": undefined,
    +           "stderrLevels": Object {},
    +           "writable": true,
    +           Symbol(kCapture): false,
    +         },
    +         "pipesCount": 1,
    +         "readableListening": false,
    +         "reading": false,
    +         "readingMore": false,
    +         "resumeScheduled": true,
    +         "sync": false,
    +       },
    +       "_transformState": Object {
    +         "afterTransform": [Function bound afterTransform],
    +         "needTransform": false,
    +         "transforming": false,
    +         "writecb": null,
    +         "writechunk": null,
    +         "writeencoding": null,
    +       },
    +       "_writableState": WritableState {
    +         "autoDestroy": false,
    +         "bufferProcessing": false,
    +         "bufferedRequest": null,
    +         "bufferedRequestCount": 0,
    +         "corked": 0,
    +         "corkedRequestsFree": CorkedRequest {
    +           "entry": null,
    +           "finish": [Function anonymous],
    +           "next": null,
    +         },
    +         "decodeStrings": true,
    +         "defaultEncoding": "utf8",
    +         "destroyed": false,
    +         "emitClose": true,
    +         "ended": false,
    +         "ending": false,
    +         "errorEmitted": false,
    +         "finalCalled": false,
    +         "finished": false,
    +         "highWaterMark": 16,
    +         "lastBufferedRequest": null,
    +         "length": 0,
    +         "needDrain": false,
    +         "objectMode": true,
    +         "onwrite": [Function anonymous],
    +         "pendingcb": 0,
    +         "prefinished": false,
    +         "sync": true,
    +         "writecb": null,
    +         "writelen": 0,
    +         "writing": false,
    +       },
    +       "allowHalfOpen": true,
    +       "defaultMeta": null,
    +       "exceptions": ExceptionHandler {
    +         "handlers": Map {},
    +         "logger": [Circular],
    +       },
    +       "exitOnError": true,
    +       "format": Format {
    +         "options": Object {},
    +       },
    +       "level": "silent",
    +       "levels": Object {
    +         "debug": 5,
    +         "error": 0,
    +         "http": 3,
    +         "info": 2,
    +         "silly": 6,
    +         "verbose": 4,
    +         "warn": 1,
    +       },
    +       "profilers": Object {},
    +       "readable": true,
    +       "rejections": RejectionHandler {
    +         "handlers": Map {},
    +         "logger": [Circular],
    +       },
    +       "silent": true,
    +       "writable": true,
    +       Symbol(kCapture): false,
    +     },
    +   },
        "productIdentifier": "n8n-1.3.0",
    -   "saveCertStr": Any<Function>,
    +   "saveCertStr": [Function saveCertStr],
        "server": "https://server.com/v1",
    -   "tenantId": 1,
    +   "tenantId": 1001,
      },

    Number of calls: 1

      29 |
      30 | 	test('initializes license manager', async () => {
    > 31 | 		expect(LicenseManager).toHaveBeenCalledWith({
         | 		                       ^
      32 | 			autoRenewEnabled: true,
      33 | 			autoRenewOffset: MOCK_RENEW_OFFSET,
      34 | 			deviceFingerprint: expect.any(Function),

      at Object.<anonymous> (test/unit/License.test.ts:31:26)


 RUNS  test/integration/license.api.test.ts

Test Suites: 1 failed, 1 of 2 total
Tests:       1 failed, 9 passed, 10 total
Snapshots:   0 total
Time:        2 s, estimated 4 s
████████████████████████████████████████^C ELIFECYCLE  Command failed.
 ELIFECYCLE  Test failed. See above for more details.
```

</details>
2023-08-21 10:29:21 +02:00
कारतोफ्फेलस्क्रिप्ट™ 9455bcfef5
fix(Webhook Node): Backward compatible form-data parsing for non-array fields (#6967) 2023-08-18 12:34:42 +02:00
कारतोफ्फेलस्क्रिप्ट™ a82107fb05
fix(Respond to Webhook Node): Return headers in response (#6921) 2023-08-14 12:38:17 +02:00
कारतोफ्फेलस्क्रिप्ट™ 10c15874b2
fix(core): Restore body parsing for all content-types for non webhook routes (no-changelog)(#6911)
Changes in https://github.com/n8n-io/n8n/pull/6394 removed xml body parsing for all non-webhook routes. This broken SAML endpoints as they need the XML body parser to function correctly.
2023-08-11 09:18:33 +02:00
Michael Kret 7f0db60f15
refactor(core): Abstract away duplication when finding first pinned trigger (no-changelog) (#5927) 2023-08-10 15:06:16 +03:00
Iván Ovejero dceff675ec
perf(core): Add filtering and pagination to GET /workflows (#6845)
* Initial setup

* Specify max paginated items

* Simplify

* Add tests

* Add more tests

* Add migrations

* Add top-level property

* Add field selection

* Cleanup

* Rename `total` to `count`

* More cleanup

* Move query logic into `WorkflowRepository`

* Create `AbstractRepository`

* Cleanup

* Fix name

* Remove leftover comments

* Replace reference

* Add default for `rawSkip`

* Remove unneeded typing

* Switch to `class-validator`

* Simplify

* Simplify

* Type as optional

* Make typing more accurate

* Fix lint

* Use `getOwnPropertyNames`

* Use DSL

* Set schema at repo level

* Cleanup

* Remove comment

* Refactor repository methods to middleware

* Add middleware tests

* Remove old test files

* Remove generic experiment

* Reuse `reportError`

* Remove unused type

* Cleanup

* Improve wording

* Reduce diff

* Add missing mw

* Use `Container.get`

* Adjust lint rule

* Reorganize into subdir

* Remove unused directive

* Remove nodes

* Silly mistake

* Validate take

* refactor(core): Adjust index handling in new migrations DSL (no-changelog) (#6876)

* refactor(core): Adjust index handling in new migrations DSL (no-changelog)

* Account for custom index name

* Also for dropping

* Fix `select` issue with `relations`

* Tighten validation

* Ensure `ownerId` is not added when specifying `select`
2023-08-09 12:30:02 +02:00
Iván Ovejero 11440bfd3c
refactor(core): Move tag collection into repository (no-changelog) (#6860)
* refactor(core): Move tag collection into repository

* Fix tests

* Address feedback

* Fix missing spot
2023-08-08 14:08:56 +02:00
Michael Auerswald adcf5a96e8
feat(core): Add metrics option to cache (#6846)
* add metrics to cache

* use events for metrics

* pr comments / broken test

* lint fix

* update the test

* improve tests

* Update packages/cli/src/config/schema.ts

* disable flaky test

* lint fix

---------

Co-authored-by: कारतोफ्फेलस्क्रिप्ट™ <aditya@netroy.in>
Co-authored-by: कारतोफ्फेलस्क्रिप्ट™ <netroy@users.noreply.github.com>
2023-08-04 20:51:07 +02:00
Michael Auerswald fdfc6c5a92
fix(core): Handle empty keys in cache service (no-changelog) (#6854)
* fix handle empty keys in cache service

* add test

* add cache mock test

* add simpler mocking, and add tests for all the updated methods

* don't use RedisStore specifically in the mock

---------

Co-authored-by: कारतोफ्फेलस्क्रिप्ट™ <aditya@netroy.in>
2023-08-04 19:44:41 +02:00
Iván Ovejero 0511458d41
perf(core): Cache webhooks (#6825)
* refactor: Initial setup

* Refactor for clarity

* Comments to clarify

* More replacements

* Simplify with `fullPath`

* Fix tests

* Implement remaining methods

* chore: Fix misresolved conflicts

* Simplify syntax

* Reduce diff

* Minor cleanup

* Fix lint

* Inject dependency

* Improve typings

* Remove unused method

* Restore method

* Add comment

* Rename in test

* Restore comments

* Clean up dynamic webhook handling

* Clean up tests

* Remove redundant `cache` prefix

* fix: Correct `uniquePath` for dynamic webhooks
2023-08-04 11:52:45 +02:00
Val 371bfa0f48
fix: Auth.api user limit test expecting incorrect status (#6836)
fix: auth.api user limit test expecting incorrect status
2023-08-03 13:03:26 +01:00
Iván Ovejero e4f041815a
perf(core): Cache roles (#6803)
* refactor: Create `RoleService`

* refactor: Refactor to use service

* refactor: Move `getUserRoleForWorkflow`

* refactor: Clear out old `RoleService`

* refactor: Consolidate utils into service

* refactor: Remove unused methods

* test: Add tests

* refactor: Remove redundant return types

* refactor: Missing utility

* chore: Remove commented out bit

* refactor: Make `Db.collections.Repository` inaccessible

* chore: Cleanup

* feat: Prepopulate cache

* chore: Remove logging

* fix: Account for tests where roles are undefined

* fix: Restore `prettier.prettierPath`

* test: Account for cache enabled and disabled

* fix: Restore `Role` in `Db.collections`

* refactor: Simplify by removing `orFail`

* refactor: Rename for clarity

* refactor: Use `cacheKey` for readability

* refactor: Validate role before creation

* refacator: Remove redundant `cache` prefix

* ci: Lint fix

* test: Fix e2e
2023-08-03 08:58:36 +02:00
Michael Auerswald 659ca26fe7
fix(core): Change VariablesService to DI and use caching (#6827)
* support redis cluster

* cleanup, fix config schema

* set default prefix to bull

* initial commit

* improve logging

* improve types and refactor

* list support and refactor

* fix redis service and tests

* add comment

* add redis and cache prefix

* use injection

* lint fix

* clean schema comments

* improve naming, tests, cluster client

* merge master

* cache returns unknown instead of T

* update cache service, tests and doc

* remove console.log

* VariablesService as DI, add caching, fix tests

* do not cache null or undefined values

* import fix

* more DI and remove collections

* fix merge

* lint fix

* rename to ~Cached

* fix test for CI

* fix ActiveWorkflowRunner test
2023-08-02 14:51:09 +02:00
Michael Auerswald 3cad60e918
feat(core): Make Redis available for backend communication (#6719)
* support redis cluster

* cleanup, fix config schema

* set default prefix to bull

* initial commit

* improve logging

* improve types and refactor

* list support and refactor

* fix redis service and tests

* add comment

* add redis and cache prefix

* use injection

* lint fix

* clean schema comments

* improve naming, tests, cluster client

* merge master

* cache returns unknown instead of T

* update cache service, tests and doc

* remove console.log

* do not cache null or undefined values

* fix merge

* lint fix
2023-08-02 12:51:25 +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
Iván Ovejero ffae8edce3
refactor(core): Cache workflow ownership (#6738)
* refactor: Set up ownership service

* refactor: Specify cache keys and values

* refactor: Replace util with service calls

* test: Mock service in tests

* refactor: Use dependency injection

* test: Write tests

* refactor: Apply feedback from Omar and Micha

* test: Fix tests

* test: Fix missing spot

* refactor: Return user entity from cache

* refactor: More dependency injection!
2023-07-31 11:37:09 +02:00
Iván Ovejero 72523462ea
refactor: Clear unused ESLint directives from BE packages (no-changelog) (#6798) 2023-07-31 11:00:48 +02:00
कारतोफ्फेलस्क्रिप्ट™ 6fb8a9ee39
ci: Fix linting issues (no-changelog) (#6788)
* ci: Fix linting (no-changelog)

* lintfix for nodes-base as well
2023-07-28 18:28:17 +02:00
कारतोफ्फेलस्क्रिप्ट™ dc2ba743eb
refactor(core): Use mixins to delete redundant code between Entity classes (no-changelog) (#6616)
* db entities don't need an ID before they are inserted

* don't define constructors on entity classes, use repository.create instead

* use mixins to reduce duplicate code in db entity classes
2023-07-27 11:53:37 +02:00
कारतोफ्फेलस्क्रिप्ट™ e6903a87b5
refactor: Remove all references to the resetPasswordToken field (no-changelog) (#6751)
refactor: remove all references to the resetPasswordToken field (no-changelog)
2023-07-27 11:53:25 +02:00
Michael Auerswald fc7aa8bd66
feat: Environments release using source control (#6653)
* initial telemetry setup and adjusted pull return

* quicksave before merge

* feat: add conflicting workflow list to pull modal

* feat: update source control pull modal

* fix: fix linting issue

* feat: add Enter keydown event for submitting source control push modal (no-changelog)

feat: add Enter keydown event for submitting source control push modal

* quicksave

* user workflow table for export

* improve telemetry data

* pull api telemetry

* fix lint

* Copy tweaks.

* remove authorName and authorEmail and pick from user

* rename owners.json to workflow_owners.json

* ignore credential conflicts on pull

* feat: several push/pull flow changes and design update

* pull and push return same data format

* fix: add One last step toast for successful pull

* feat: add up to date pull toast

* fix: add proper Learn more link for push and pull modals

* do not await tracking being sent

* fix import

* fix await

* add more sourcecontrolfile status

* Minor copy tweak for "More info".

* Minor copy tweak for "More info".

* ignore variable_stub conflicts on pull

* ignore whitespace differences

* do not show remote workflows that are not yet created

* fix telemetry

* fix toast when pulling deleted wf

* lint fix

* refactor and make some imports dynamic

* fix variable edit validation

* fix telemetry response

* improve telemetry

* fix unintenional delete commit

* fix status unknown issue

* fix up to date toast

* do not export active state and reapply versionid

* use update instead of upsert

* fix: show all workflows when clicking push to git

* feat: update Up to date pull translation

* fix: update read only env checks

* do not update versionid of only active flag changes

* feat: prevent access to new workflow and templates import when read only env

* feat: send only active state and version if workflow state is not dirty

* fix: Detect when only active state has changed and prevent generation a new version ID

* feat: improve readonly env messages

* make getPreferences public

* fix telemetry issue

* fix: add partial workflow update based on dirty state when changing active state

* update unit tests

* fix: remove unsaved changes check in readOnlyEnv

* fix: disable push to git button when read onyl env

* fix: update readonly toast duration

* fix: fix pinning and title input in protected mode

* initial commit (NOT working)

* working push

* cleanup and implement pull

* fix getstatus

* update import to new method

* var and tag diffs are no conflicts

* only show pull conflict for workflows

* refactor and ignore faulty credentials

* add sanitycheck for missing git folder

* prefer fetch over pull and limit depth to 1

* back to pull...

* fix setting branch on initial connect

* fix test

* remove clean workfolder

* refactor: Remove some unnecessary code

* Fixed links to docs.

* fix getstatus query params

* lint fix

* dialog to show local and remote name on conflict

* only show remote name on conflict

* fix credential expression export

* fix: Broken test

* dont show toast on pull with empty var/tags and refactor

* apply frontend changes from old branch

* fix tag with same name import

* fix buttons shown for non instance owners

* prepare local storage key for removal

* refactor: Change wording on pushing and pulling

* refactor: Change menu item

* test: Fix broken test

* Update packages/cli/src/environments/sourceControl/types/sourceControlPushWorkFolder.ts

Co-authored-by: Iván Ovejero <ivov.src@gmail.com>

---------

Co-authored-by: Alex Grozav <alex@grozav.com>
Co-authored-by: Giulio Andreini <g.andreini@gmail.com>
Co-authored-by: Omar Ajoue <krynble@gmail.com>
Co-authored-by: Iván Ovejero <ivov.src@gmail.com>
2023-07-26 09:25:01 +02:00
Iván Ovejero bcfc5e717b
refactor(core): Move webhook DB access to repository (no-changelog) (#6706)
* refactor(core): Move webhook DB access to repository (no-changelog)

* make sure `DataSource` is initialized before it's dependencies

at some point I hope to replace `DataSource` with a custom `DatabaseConnection` service class that can then disconnect and reconnect from DB without having to update all repositories.

---------

Co-authored-by: कारतोफ्फेलस्क्रिप्ट™ <aditya@netroy.in>
2023-07-25 18:17:34 +02:00
Michael Auerswald c0d2bac94d
feat(core): Add cache service (#6729)
* add cache service

* PR adjustments

* switch to maxSize for memory cache
2023-07-25 11:56:38 +02:00
कारतोफ्फेलस्क्रिप्ट™ eeb49e9375 ci: Fix tests on postgres (no-changelog) 2023-07-25 00:11:33 +02:00
Ricardo Espinoza 89f44021b9
fix(core): Use JWT as reset password token (#6714)
* use jwt to reset password

* increase expiration time to 1d

* drop user id query string

* refactor

* use service instead of package in tests

* sqlite migration

* postgres migration

* mysql migration

* remove unused properties

* remove userId from FE

* fix test for users.api

* move migration to the common folder

* move type assertion to the jwt.service

* Add jwt secret as a readonly property

* use signData instead of sign in user.controller

* remove base class

* remove base class

* add tests
2023-07-24 17:40:17 -04:00
Val b1838f7fab
fix: Add missing indices on sqlite (#6673)
* fix: enforce tag name uniqueness on sqlite

* rename migration and add other missing indices

* add tags tests
2023-07-20 10:34:45 +01:00
Iván Ovejero 667c15d0df
fix(core): Filter out workflows that failed to activate on startup (#6676)
* fix(core): Deactivate on init workflow that should not be retried

* fix(core): Filter out workflows with activation errors
2023-07-18 15:57:14 +02:00
Iván Ovejero 92192fbd61
fix(API): Do not add starting node on workflow creation (#6686)
* fix(API): Do not add starting node on workflow creation

* chore: Remove comment
2023-07-18 14:03:19 +02:00
कारतोफ्फेलस्क्रिप्ट™ f4a18ba87d
refactor(core): Refactor WorkflowStatistics code (no-changelog) (#6617)
refactor(core): Refactor WorkflowStatistics code
2023-07-18 11:28:24 +02:00
कारतोफ्फेलस्क्रिप्ट™ b895ba438a
refactor(core): Reduce boilterplate code in between tests 🧹, and fix the tests in node.js 20 (no-changelog) (#6654)
refactor(core): Reduce boilterplate code in between tests

also cleaned up some imports, and fixed the tests in node.js 20
2023-07-13 10:14:48 +02:00
OlegIvaniv e5620ab1e4
feat(API): Implement users account quota guards (#6434)
* feat(cli): Implement users account quota guards

Signed-off-by: Oleg Ivaniv <me@olegivaniv.com>

* Remove comment

Signed-off-by: Oleg Ivaniv <me@olegivaniv.com>

* Address PR comments

- Getting `usersQuota` from `Settings` repo
- Revert `isUserManagementEnabled` helper
- Fix FE listing of users

Signed-off-by: Oleg Ivaniv <me@olegivaniv.com>

* Refactor isWithinUserQuota getter and fix tests

Signed-off-by: Oleg Ivaniv <me@olegivaniv.com>

* Revert testDb.ts changes

Signed-off-by: Oleg Ivaniv <me@olegivaniv.com>

* Cleanup & improve types

Signed-off-by: Oleg Ivaniv <me@olegivaniv.com>

* Fix duplicated method

* Fix failing test

* Remove `isUserManagementEnabled` completely

Signed-off-by: Oleg Ivaniv <me@olegivaniv.com>

* Check for globalRole.name to determine if user is owner

Signed-off-by: Oleg Ivaniv <me@olegivaniv.com>

* Fix unit tests

Signed-off-by: Oleg Ivaniv <me@olegivaniv.com>

* Set isInstanceOwnerSetUp in specs

* Fix SettingsUserView UM

Signed-off-by: Oleg Ivaniv <me@olegivaniv.com>

* refactor: License typings suggestions for users quota guards (#6636)

refactor: License typings suggestions

* Update packages/cli/src/Ldap/helpers.ts

Co-authored-by: Iván Ovejero <ivov.src@gmail.com>

* Update packages/cli/test/integration/shared/utils.ts

Co-authored-by: Iván Ovejero <ivov.src@gmail.com>

* Address PR comments

Signed-off-by: Oleg Ivaniv <me@olegivaniv.com>

* Use 403 for all user quota related errors

Signed-off-by: Oleg Ivaniv <me@olegivaniv.com>

---------

Signed-off-by: Oleg Ivaniv <me@olegivaniv.com>
Co-authored-by: Iván Ovejero <ivov.src@gmail.com>
2023-07-12 14:11:46 +02:00
Iván Ovejero d6b2ae0255
refactor: Stop using .d.ts files for type-collection files (no-changelog) (#6634)
refactor: Stop using `.d.ts` files for type-collection files
2023-07-10 19:35:34 +02:00
कारतोफ्फेलस्क्रिप्ट™ a76223307f
refactor(core): Load cookieParser middleware only once (no-changelog) (#6614)
[Server.ts already explicitly loads `cookieParser`](https://github.com/n8n-io/n8n/blob/master/packages/cli/src/Server.ts#L571)
2023-07-07 09:57:03 +02:00
कारतोफ्फेलस्क्रिप्ट™ c906e7391b fix(core): Route /rest/workflows/new correctly (no-changelog) (#6572) 2023-07-04 21:07:48 +02:00
Michael Auerswald 8f244df0f9 fix(core): Fix credentials test (#6569)
fix credentials test
2023-07-04 21:07:21 +02:00
कारतोफ्फेलस्क्रिप्ट™ abe7f71627 refactor: Remove pre-setup prompt on owner setup (#6495) 2023-06-22 21:11:38 +02:00
Iván Ovejero 8c008f5d22 refactor(core)!: Remove basic-auth, external-jwt-auth, and no-auth options (#6362)
Co-authored-by: कारतोफ्फेलस्क्रिप्ट™ <aditya@netroy.in>
2023-06-22 20:03:47 +02:00
कारतोफ्फेलस्क्रिप्ट™ 8dc828b704
fix(core): Fix the db:revert command (no-changelog) (#6506) 2023-06-22 09:06:31 +02:00
Ricardo Espinoza 6ab350209d
feat(core): Add GET /users endpoints to public API (#6360) 2023-06-21 13:22:00 +02:00
Michael Auerswald c3ba0123ad
feat: Migrate integer primary keys to nanoids (#6345)
* first commit for postgres migration

* (not working)

* sqlite migration

* quicksave

* fix tests

* fix pg test

* fix postgres

* fix variables import

* fix execution saving

* add user settings fix

* change migration to single lines

* patch preferences endpoint

* cleanup

* improve variable import

* cleanup unusued code

* Update packages/cli/src/PublicApi/v1/handlers/workflows/workflows.handler.ts

Co-authored-by: Omar Ajoue <krynble@gmail.com>

* address review notes

* fix var update/import

* refactor: Separate execution data to its own table (#6323)

* wip: Temporary migration process

* refactor: Create boilerplate repository methods for executions

* fix: Lint issues

* refactor: Added search endpoint to repository

* refactor: Make the execution list work again

* wip: Updating how we create and update executions everywhere

* fix: Lint issues and remove most of the direct access to execution model

* refactor: Remove includeWorkflowData flag and fix more tests

* fix: Lint issues

* fix: Fixed ordering of executions for FE, removed transaction when saving execution and removed unnecessary update

* refactor: Add comment about missing feature

* refactor: Refactor counting executions

* refactor: Add migration for other dbms and fix issues found

* refactor: Fix lint issues

* refactor: Remove unnecessary comment and auto inject repo to internal hooks

* refactor: remove type assertion

* fix: Fix broken tests

* fix: Remove unnecessary import

* Remove unnecessary toString() call

Co-authored-by: Iván Ovejero <ivov.src@gmail.com>

* fix: Address comments after review

* refactor: Remove unused import

* fix: Lint issues

* fix: Add correct migration files

---------

Co-authored-by: Iván Ovejero <ivov.src@gmail.com>

* remove null values from credential export

* fix: Fix an issue with queue mode where all running execution would be returned

* fix: Update n8n node to allow for workflow ids with letters

* set upstream on set branch

* remove typo

* add nodeAccess to credentials

* fix unsaved run check for undefined id

* fix(core): Rename version control feature to source control (#6480)

* rename versionControl to sourceControl

* fix source control tooltip wording

---------

Co-authored-by: Romain Minaud <romain.minaud@gmail.com>

* fix(editor): Pay 548 hide the set up version control button (#6485)

* feat(DebugHelper Node): Fix and include in main app (#6406)

* improve node a bit

* fixing continueOnFail() ton contain error in json

* improve pairedItem

* fix random data returning object results

* fix nanoId length typo

* update pnpm-lock file

---------

Co-authored-by: Marcus <marcus@n8n.io>

* fix(editor): Remove setup source control CTA button

* fix(editor): Remove setup source control CTA button

---------

Co-authored-by: Michael Auerswald <michael.auerswald@gmail.com>
Co-authored-by: Marcus <marcus@n8n.io>

* fix(editor): Update source control docs links (#6488)

* feat(DebugHelper Node): Fix and include in main app (#6406)

* improve node a bit

* fixing continueOnFail() ton contain error in json

* improve pairedItem

* fix random data returning object results

* fix nanoId length typo

* update pnpm-lock file

---------

Co-authored-by: Marcus <marcus@n8n.io>

* feat(editor): Replace root events with event bus events (no-changelog) (#6454)

* feat: replace root events with event bus events

* fix: prevent cypress from replacing global with globalThis in import path

* feat: remove emitter mixin

* fix: replace component events with event bus

* fix: fix linting issue

* fix: fix breaking expression switch

* chore: prettify ndv e2e suite code

* fix(editor): Update source control docs links

---------

Co-authored-by: Michael Auerswald <michael.auerswald@gmail.com>
Co-authored-by: Marcus <marcus@n8n.io>
Co-authored-by: Alex Grozav <alex@grozav.com>

* fix tag endpoint regex

---------

Co-authored-by: Omar Ajoue <krynble@gmail.com>
Co-authored-by: Iván Ovejero <ivov.src@gmail.com>
Co-authored-by: Romain Minaud <romain.minaud@gmail.com>
Co-authored-by: Csaba Tuncsik <csaba@n8n.io>
Co-authored-by: Marcus <marcus@n8n.io>
Co-authored-by: Alex Grozav <alex@grozav.com>
2023-06-20 19:13:18 +02:00
Chris Wu 1111c915f2
refactor(core): Replace lodash's "soft-deprecated" individual packages with lodash to resolve CVE (no-changelog) (#6450)
Co-authored-by: कारतोफ्फेलस्क्रिप्ट™ <aditya@netroy.in>
2023-06-16 16:26:35 +02:00
Csaba Tuncsik 1b321416c0
feat: Version control mvp (#6271)
* implement basic git service

* cleanup connected prop

* add skeleton of git functions

* initial import/export setup

* split out export service

* refactor and improve export

* begin import

* more commands and basic import

* clean up imports with transactions

* work folder import functions

* reintroduce versionid

* add missing import to pull workfolder

* add get-status endpoint

* add cleanup to disconnect

* add initRepo options

* add more checks and cleanup

* minor cleanup

* refactor prefs

* fix server.ts

* fix sending deleted files

* rename files to ee

* add variable override and fix critical cred import bug

* fix mkdir race condition

* make initRepo default to true

* fix front back integration

* improve connect flow

* add comment to generated ssh key

* fix(editor): use useToast composable

* fix buttons size

* commenting out repo init for now

* fix(editor): update UI logic

* fix(editor): remove console.log

* fix(editor): remove unused ref

* adjust endpoints for improved UI

* fix(editor): add push and pull buttons

* keep or not ssh key

* switching file name to id

* fix(editor): add success messages, fix save button

* fixed faulty diff preventing pull

* fix build

* fix(editor): adding loader to VC components

* removing duplicate exports

* improve conflict finding on push pull

* manage pull conflict

* alternate push pull

* fix pull confirmation

* fix rm and credential export/import

* switch to alternative pull implementation

* fix initial commit

* fix(editor): subscribing to VC store action to refresh lists

* fix(editor): wrap VC store actions with try

* feat: add fine-grained file selection for push action

* fix: close modal after successful push

* fix(editor): VC preferences validation

* fix confirm

* fix: update endpoint to /get-status

* feat: update pull modal override changes message

* fix missing wf error

* undo

* removing connect endpoint

* fix(editor): add button titles

* fix(editor): cleaning up store action

* add version-control/set-read-only protection

* fix(editor): adding set branch readonly

* fix(editor): remove Push button if branch set to readonly

* fix(editor): fix some styles

* fix(editor): remove duplicate and delete actions in WF list when branch is readonly

* fix: load status before opening selective push modal

* fix(editor): extend readonly logic

* add cleanup after failed initRepo

* fix deleted files crashing get-status

* fix n8n-checkbox in staging dialog

* fix(editor): fix loading

* fix(editor): resize buttons

* fix(editor): fix translation

* fix(editor): fix copy text size

* fix(editor): fix copy text size

* fix(editor): add disconnection confirmation

* fix(editor): add disconnection confirmation

* fix(editor): set large buttons

* add public api Pull endpoint

* feat: add refresh ssh key

* return prefs when new keys are generated

* fix(editor): adding readOnly mode to main header

* fix(editor): adding readOnly mode to workflow settings

* improve credential owner import

* add middleware to endpoints

* improve public api error/doc

* do not create branch if one already exists

* update wordings for connect toasts

* fix(editor): updating and separating readonly modes

* fix(editor): fix readonly mode in WF list

* fix(editor): disable elements dragging on canvas in readonly mode (WIP: not working when NodeView page is loaded first)

* fix(editor): fix canvas draggables in readonly env

* fix(editor): remove unused variables

* fix(editor): hide actions in node connections when readonly

* fix(editor): hide actions in node connections when readonly

* fix(editor): disable Save button when readonly

* fix(editor): disable Save settings if no branch is selected

* fix(editor): lint fix

* fix(editor): update snapshots

* fix(editor): replace Loading... text

* fix(editor): reset Loading... text

* reset branchname on disconnect

* fix(editor): adding some translations

* fix(editor): fix unit test

* fix(editor): fix loading

* fix(editor): set settings saved message

* fix(editor): update connection flag

* fix branchName not returning after connect

* temporary (but still breaking) fix for postgres

* fix(editor): adding tooltip to Push/Pull buttons when they're collapsed

* fix(editor): enabled activator in readonly mode

* fix test

* fix(editor): disabling new item addition for workflows in readonly mode

* fix(editor): modify Pull/Push button tooltips

* do not commit empty variables file

---------

Co-authored-by: Michael Auerswald <michael.auerswald@gmail.com>
Co-authored-by: Romain Minaud <romain.minaud@gmail.com>
Co-authored-by: Alex Grozav <alex@grozav.com>
2023-05-31 15:01:57 +02:00
Cornelius Suermann 0e4c615d0d
fix(core): Do not track errored workflow executions for automated executions (no-changelog) (#6322)
* fix(core): Do not track errored workflow executions for automated executions

* fix test

* fix test

* fix test

* do not track 'Workflow execution count' event when all counts are 0

* fix test

* fix test

* fix test

* fix test

* fix test

* fix test

* fix test

* fix test

* fix test
2023-05-28 12:08:46 +02:00