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

feat: Version control mvp #6271

Merged
merged 156 commits into from
May 31, 2023
Merged
Show file tree
Hide file tree
Changes from 155 commits
Commits
Show all changes
156 commits
Select commit Hold shift + click to select a range
ed51de4
implement basic git service
flipswitchingmonkey Apr 25, 2023
9263d9e
cleanup connected prop
flipswitchingmonkey Apr 25, 2023
639cff4
add skeleton of git functions
flipswitchingmonkey Apr 26, 2023
ecbb337
initial import/export setup
flipswitchingmonkey Apr 26, 2023
5d6caed
split out export service
flipswitchingmonkey May 2, 2023
1644768
refactor and improve export
flipswitchingmonkey May 3, 2023
661aabd
begin import
flipswitchingmonkey May 3, 2023
f22ac0e
more commands and basic import
flipswitchingmonkey May 4, 2023
4ae82f7
Merge branch 'master' into pay-379-add-git-integration
flipswitchingmonkey May 8, 2023
5a13fe8
clean up imports with transactions
flipswitchingmonkey May 8, 2023
3f95994
work folder import functions
flipswitchingmonkey May 9, 2023
aa5a2f8
reintroduce versionid
flipswitchingmonkey May 9, 2023
3250f86
add missing import to pull workfolder
flipswitchingmonkey May 9, 2023
596d6a2
add get-status endpoint
flipswitchingmonkey May 10, 2023
861dade
add cleanup to disconnect
flipswitchingmonkey May 10, 2023
8fec7ea
add initRepo options
flipswitchingmonkey May 11, 2023
873c223
add more checks and cleanup
flipswitchingmonkey May 11, 2023
d63651e
minor cleanup
flipswitchingmonkey May 12, 2023
8892a97
Merge remote-tracking branch 'origin/pay-379-add-git-integration' int…
cstuncsik May 12, 2023
de90e85
refactor prefs
flipswitchingmonkey May 12, 2023
e554deb
fix server.ts
flipswitchingmonkey May 12, 2023
d6b9c50
fix sending deleted files
flipswitchingmonkey May 12, 2023
15698fb
Merge remote-tracking branch 'origin/master' into pay-436-connect-vc-…
cstuncsik May 12, 2023
1203a71
Merge remote-tracking branch 'origin/pay-379-add-git-integration' int…
cstuncsik May 12, 2023
cdd59c9
rename files to ee
flipswitchingmonkey May 12, 2023
94808ac
Merge branch 'master' into pay-379-add-git-integration
flipswitchingmonkey May 12, 2023
8729b89
Merge branch 'pay-436-connect-vc-backend' into pay-379-add-git-integr…
flipswitchingmonkey May 12, 2023
5bb92d2
add variable override and fix critical cred import bug
flipswitchingmonkey May 15, 2023
63e0cac
fix mkdir race condition
flipswitchingmonkey May 15, 2023
82e99bc
make initRepo default to true
flipswitchingmonkey May 15, 2023
6ce9911
fix front back integration
romainminaud May 15, 2023
30ebbee
improve connect flow
romainminaud May 16, 2023
3434570
Merge remote-tracking branch 'origin/master' into version-control-mvp
cstuncsik May 16, 2023
515924b
add comment to generated ssh key
flipswitchingmonkey May 16, 2023
fdb73d8
fix(editor): use useToast composable
cstuncsik May 16, 2023
151140d
Merge branch 'version-control-mvp' of github.com:n8n-io/n8n into vers…
cstuncsik May 16, 2023
cfb650d
fix buttons size
romainminaud May 16, 2023
9da5387
commenting out repo init for now
flipswitchingmonkey May 16, 2023
9ceff4f
Merge branch 'version-control-mvp' of github.com:n8n-io/n8n into vers…
flipswitchingmonkey May 16, 2023
9e77fab
fix(editor): update UI logic
cstuncsik May 16, 2023
74b2170
Merge branch 'version-control-mvp' of github.com:n8n-io/n8n into vers…
cstuncsik May 16, 2023
bd87855
fix(editor): remove console.log
cstuncsik May 16, 2023
95d72df
fix(editor): remove unused ref
cstuncsik May 16, 2023
4f86c3d
adjust endpoints for improved UI
flipswitchingmonkey May 16, 2023
08b453f
Merge branch 'version-control-mvp' of github.com:n8n-io/n8n into vers…
flipswitchingmonkey May 16, 2023
3142add
fix(editor): add push and pull buttons
cstuncsik May 16, 2023
f2796e6
Merge branch 'version-control-mvp' of github.com:n8n-io/n8n into vers…
cstuncsik May 16, 2023
71ec9d1
keep or not ssh key
romainminaud May 16, 2023
27e43d3
Merge branch 'version-control-mvp' of github.com:n8n-io/n8n into vers…
romainminaud May 16, 2023
f2c99b0
Merge remote-tracking branch 'origin/master' into version-control-mvp
cstuncsik May 16, 2023
51f97c2
switching file name to id
flipswitchingmonkey May 16, 2023
cb63aff
Merge branch 'version-control-mvp' of github.com:n8n-io/n8n into vers…
flipswitchingmonkey May 16, 2023
ba2db9a
fix(editor): add success messages, fix save button
cstuncsik May 16, 2023
9bb2c3b
Merge branch 'version-control-mvp' of github.com:n8n-io/n8n into vers…
cstuncsik May 16, 2023
93ba725
fixed faulty diff preventing pull
flipswitchingmonkey May 16, 2023
77475f4
Merge branch 'version-control-mvp' of github.com:n8n-io/n8n into vers…
flipswitchingmonkey May 16, 2023
32b6527
fix build
flipswitchingmonkey May 16, 2023
b571ae8
fix(editor): adding loader to VC components
cstuncsik May 17, 2023
c4aa7d8
Merge branch 'version-control-mvp' of github.com:n8n-io/n8n into vers…
cstuncsik May 17, 2023
9275c4d
removing duplicate exports
flipswitchingmonkey May 17, 2023
5193e66
Merge branch 'version-control-mvp' of github.com:n8n-io/n8n into vers…
flipswitchingmonkey May 17, 2023
f2e6e62
improve conflict finding on push pull
flipswitchingmonkey May 17, 2023
69cbbef
manage pull conflict
romainminaud May 17, 2023
9932d94
alternate push pull
romainminaud May 17, 2023
b0db51f
fix pull confirmation
romainminaud May 17, 2023
40c1312
fix rm and credential export/import
flipswitchingmonkey May 17, 2023
46c7ed6
Merge branch 'version-control-mvp' of github.com:n8n-io/n8n into vers…
flipswitchingmonkey May 17, 2023
c8c56e8
switch to alternative pull implementation
flipswitchingmonkey May 17, 2023
43fa99d
fix initial commit
flipswitchingmonkey May 17, 2023
7ca1a98
fix(editor): subscribing to VC store action to refresh lists
cstuncsik May 17, 2023
cdadad0
Merge branch 'version-control-mvp' of github.com:n8n-io/n8n into vers…
cstuncsik May 17, 2023
b5e7bdc
fix(editor): wrap VC store actions with try
cstuncsik May 17, 2023
62aaa31
feat: add fine-grained file selection for push action
alexgrozav May 18, 2023
22be9e5
chore: merge branch
alexgrozav May 18, 2023
b72b3ec
fix: close modal after successful push
alexgrozav May 18, 2023
eb77123
fix(editor): VC preferences validation
cstuncsik May 18, 2023
f427d55
fix confirm
romainminaud May 19, 2023
f54eb9c
fix: update endpoint to /get-status
alexgrozav May 19, 2023
0969d96
feat: update pull modal override changes message
alexgrozav May 19, 2023
d6329d2
Merge branch 'version-control-mvp' of github.com:n8n-io/n8n into vers…
alexgrozav May 19, 2023
df08b51
fix missing wf error
flipswitchingmonkey May 19, 2023
5fc3e34
undo
flipswitchingmonkey May 19, 2023
be26f02
Merge branch 'version-control-mvp' of github.com:n8n-io/n8n into vers…
flipswitchingmonkey May 19, 2023
c3a1d16
removing connect endpoint
flipswitchingmonkey May 19, 2023
9e8f32d
fix(editor): add button titles
cstuncsik May 19, 2023
6b37bb4
Merge branch 'version-control-mvp' of github.com:n8n-io/n8n into vers…
cstuncsik May 19, 2023
adab5c8
fix(editor): cleaning up store action
cstuncsik May 19, 2023
ff22d25
add version-control/set-read-only protection
flipswitchingmonkey May 19, 2023
e263d12
Merge branch 'version-control-mvp' of github.com:n8n-io/n8n into vers…
flipswitchingmonkey May 19, 2023
ad97825
fix(editor): adding set branch readonly
cstuncsik May 19, 2023
b144f5d
fix(editor): remove Push button if branch set to readonly
cstuncsik May 19, 2023
40da676
fix(editor): fix some styles
cstuncsik May 19, 2023
fcb88b9
fix(editor): remove duplicate and delete actions in WF list when bran…
cstuncsik May 22, 2023
8f0c7f4
fix: load status before opening selective push modal
alexgrozav May 22, 2023
e1fa7e8
fix(editor): extend readonly logic
cstuncsik May 22, 2023
7749f4e
Merge branch 'version-control-mvp' of github.com:n8n-io/n8n into vers…
cstuncsik May 22, 2023
0d6a8f6
Merge branch 'master' into version-control-mvp
flipswitchingmonkey May 23, 2023
04522dc
add cleanup after failed initRepo
flipswitchingmonkey May 23, 2023
b68b4cd
fix deleted files crashing get-status
flipswitchingmonkey May 23, 2023
c44b9c0
fix n8n-checkbox in staging dialog
flipswitchingmonkey May 23, 2023
116dd69
Merge remote-tracking branch 'origin/master' into version-control-mvp
cstuncsik May 24, 2023
c984959
fix(editor): fix loading
cstuncsik May 24, 2023
c8b5cf7
fix(editor): resize buttons
cstuncsik May 24, 2023
bdca087
fix(editor): fix translation
cstuncsik May 24, 2023
d5bbc86
fix(editor): fix copy text size
cstuncsik May 24, 2023
e233693
fix(editor): fix copy text size
cstuncsik May 24, 2023
a41f99f
fix(editor): add disconnection confirmation
cstuncsik May 24, 2023
d1898b1
fix(editor): add disconnection confirmation
cstuncsik May 24, 2023
1be8474
fix(editor): set large buttons
cstuncsik May 24, 2023
8c7d829
add public api Pull endpoint
flipswitchingmonkey May 24, 2023
205434c
Merge branch 'version-control-mvp' of github.com:n8n-io/n8n into vers…
flipswitchingmonkey May 24, 2023
f4e154e
feat: add refresh ssh key
alexgrozav May 24, 2023
2fbca4a
Merge branch 'version-control-mvp' of github.com:n8n-io/n8n into vers…
alexgrozav May 24, 2023
dcb6e3b
return prefs when new keys are generated
flipswitchingmonkey May 24, 2023
6a1c273
Merge branch 'version-control-mvp' of github.com:n8n-io/n8n into vers…
flipswitchingmonkey May 24, 2023
1952446
fix(editor): adding readOnly mode to main header
cstuncsik May 24, 2023
f721a8d
Merge branch 'version-control-mvp' of github.com:n8n-io/n8n into vers…
cstuncsik May 24, 2023
9938806
fix(editor): adding readOnly mode to workflow settings
cstuncsik May 24, 2023
9fd756c
improve credential owner import
flipswitchingmonkey May 25, 2023
72978e9
add middleware to endpoints
flipswitchingmonkey May 25, 2023
497808f
improve public api error/doc
flipswitchingmonkey May 25, 2023
5492644
do not create branch if one already exists
flipswitchingmonkey May 25, 2023
0dabf3a
update wordings for connect toasts
romainminaud May 25, 2023
64390e8
fix(editor): updating and separating readonly modes
cstuncsik May 25, 2023
451bf1d
Merge branch 'version-control-mvp' of github.com:n8n-io/n8n into vers…
cstuncsik May 25, 2023
ed3947d
fix(editor): fix readonly mode in WF list
cstuncsik May 25, 2023
635070c
fix(editor): disable elements dragging on canvas in readonly mode (WI…
cstuncsik May 25, 2023
7cb0f62
fix(editor): fix canvas draggables in readonly env
cstuncsik May 26, 2023
ed3f95a
fix(editor): remove unused variables
cstuncsik May 26, 2023
ce83e92
fix(editor): hide actions in node connections when readonly
cstuncsik May 26, 2023
9dca51c
fix(editor): hide actions in node connections when readonly
cstuncsik May 26, 2023
b413aa9
Merge remote-tracking branch 'origin/master' into version-control-mvp
cstuncsik May 26, 2023
e4d429b
fix(editor): disable Save button when readonly
cstuncsik May 26, 2023
bc11927
fix(editor): disable Save settings if no branch is selected
cstuncsik May 26, 2023
cfa0c3b
fix(editor): lint fix
cstuncsik May 26, 2023
0e8c831
fix(editor): update snapshots
cstuncsik May 26, 2023
fb33dca
fix(editor): replace Loading... text
cstuncsik May 26, 2023
0cbcd4f
fix(editor): reset Loading... text
cstuncsik May 26, 2023
7dcc175
reset branchname on disconnect
flipswitchingmonkey May 26, 2023
096401b
fix(editor): adding some translations
cstuncsik May 26, 2023
0b277a8
Merge branch 'version-control-mvp' of github.com:n8n-io/n8n into vers…
cstuncsik May 26, 2023
ede8640
fix(editor): fix unit test
cstuncsik May 26, 2023
634dec1
Merge remote-tracking branch 'origin/master' into version-control-mvp
cstuncsik May 29, 2023
bad0452
fix(editor): fix loading
cstuncsik May 29, 2023
76dac66
fix(editor): set settings saved message
cstuncsik May 29, 2023
6fd82e6
fix(editor): update connection flag
cstuncsik May 29, 2023
9bbb1d7
fix branchName not returning after connect
flipswitchingmonkey May 30, 2023
641fc21
temporary (but still breaking) fix for postgres
flipswitchingmonkey May 30, 2023
aec8913
fix(editor): adding tooltip to Push/Pull buttons when they're collapsed
cstuncsik May 30, 2023
0ce77b8
fix(editor): enabled activator in readonly mode
cstuncsik May 30, 2023
cab9c2e
fix test
flipswitchingmonkey May 30, 2023
d092990
fix(editor): disabling new item addition for workflows in readonly mode
cstuncsik May 30, 2023
5a4a526
Merge branch 'version-control-mvp' of github.com:n8n-io/n8n into vers…
cstuncsik May 30, 2023
718d629
fix(editor): modify Pull/Push button tooltips
cstuncsik May 30, 2023
812e919
Merge remote-tracking branch 'origin/master' into version-control-mvp
cstuncsik May 31, 2023
1c883d4
do not commit empty variables file
flipswitchingmonkey May 31, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@
"@types/jsonwebtoken": "^9.0.1",
"@types/localtunnel": "^1.9.0",
"@types/lodash.debounce": "^4.0.7",
"@types/lodash.difference": "^4",
"@types/lodash.get": "^4.4.6",
"@types/lodash.intersection": "^4.4.7",
"@types/lodash.iteratee": "^4.7.7",
Expand All @@ -91,6 +92,7 @@
"@types/lodash.uniq": "^4.5.7",
"@types/lodash.uniqby": "^4.7.7",
"@types/lodash.unset": "^4.5.7",
"@types/lodash.without": "^4.4.7",
"@types/parseurl": "^1.3.1",
"@types/passport-jwt": "^3.0.6",
"@types/psl": "^1.1.0",
Expand Down Expand Up @@ -159,6 +161,7 @@
"jwks-rsa": "^3.0.1",
"ldapts": "^4.2.6",
"localtunnel": "^2.0.0",
"lodash.difference": "^4",
"lodash.get": "^4.4.2",
"lodash.intersection": "^4.4.0",
"lodash.iteratee": "^4.7.0",
Expand All @@ -172,6 +175,7 @@
"lodash.uniq": "^4.5.0",
"lodash.uniqby": "^4.7.0",
"lodash.unset": "^4.5.2",
"lodash.without": "^4.4.0",
"luxon": "^3.3.0",
"mysql2": "~2.3.3",
"n8n-core": "workspace:*",
Expand All @@ -197,6 +201,7 @@
"samlify": "^2.8.9",
"semver": "^7.3.8",
"shelljs": "^0.8.5",
"simple-git": "^3.17.0",
"source-map-support": "^0.5.21",
"sqlite3": "^5.1.6",
"sse-channel": "^4.0.0",
Expand Down
10 changes: 10 additions & 0 deletions packages/cli/src/PublicApi/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,16 @@ export interface IJsonSchema {
required: string[];
}

export class VersionControlPull {
force?: boolean;

variables?: { [key: string]: string };
}

export declare namespace PublicVersionControlRequest {
type Pull = AuthenticatedRequest<{}, {}, VersionControlPull, {}>;
}

// ----------------------------------
// /audit
// ----------------------------------
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
post:
x-eov-operation-id: pull
x-eov-operation-handler: v1/handlers/versionControl/versionControl.handler
tags:
- VersionControl
summary: Pull changes from the remote repository
description: Requires the Version Control feature to be licensed and connected to a repository.
requestBody:
description: Pull options
required: true
content:
application/json:
schema:
$ref: "../schemas/pull.yml"
responses:
"200":
description: Import result
content:
application/json:
schema:
$ref: "../schemas/importResult.yml"
"400":
$ref: "../../../../shared/spec/responses/badRequest.yml"
"409":
$ref: "../../../../shared/spec/responses/conflict.yml"
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
type: object
additionalProperties: true
properties:
variables:
type: object
properties:
added:
type: array
items:
type: string
changed:
type: array
items:
type: string
credentials:
type: array
items:
type: object
properties:
id:
type: string
name:
type: string
type:
type: string
workflows:
type: array
items:
type: object
properties:
id:
type: string
name:
type: string
tags:
type: object
properties:
tags:
type: array
items:
type: object
properties:
id:
type: string
name:
type: string
mappings:
type: array
items:
type: object
properties:
workflowId:
type: string
tagId:
type: string
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
type: object
properties:
force:
type: boolean
example: true
variables:
type: object
example: { "foo": "bar" }
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import type express from 'express';
import type { StatusResult } from 'simple-git';
import type { PublicVersionControlRequest } from '../../../types';
import { authorize } from '../../shared/middlewares/global.middleware';
import type { ImportResult } from '@/environments/versionControl/types/importResult';
import Container from 'typedi';
import { VersionControlService } from '@/environments/versionControl/versionControl.service.ee';
import { VersionControlPreferencesService } from '@/environments/versionControl/versionControlPreferences.service.ee';
import { isVersionControlLicensed } from '@/environments/versionControl/versionControlHelper.ee';

export = {
pull: [
authorize(['owner', 'member']),
async (
req: PublicVersionControlRequest.Pull,
res: express.Response,
): Promise<ImportResult | StatusResult | Promise<express.Response>> => {
const versionControlPreferencesService = Container.get(VersionControlPreferencesService);
if (!isVersionControlLicensed()) {
return res
.status(401)
.json({ status: 'Error', message: 'Version Control feature is not licensed' });
}
if (!versionControlPreferencesService.isVersionControlConnected()) {
return res
.status(400)
.json({ status: 'Error', message: 'Version Control is not connected to a repository' });
}
try {
const versionControlService = Container.get(VersionControlService);
const result = await versionControlService.pullWorkfolder({
force: req.body.force,
variables: req.body.variables,
userId: req.user.id,
importAfterPull: true,
});
if ((result as ImportResult)?.workflows) {
return res.status(200).send(result as ImportResult);
} else {
return res.status(409).send(result);
}
} catch (error) {
return res.status(400).send((error as { message: string }).message);
}
},
],
};
32 changes: 18 additions & 14 deletions packages/cli/src/PublicApi/v1/openapi.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
openapi: 3.0.0
info:
title: n8n Public API
title: n8n Public API11
description: n8n Public API
termsOfService: https://n8n.io/legal/terms
contact:
Expand All @@ -24,35 +24,39 @@ tags:
description: Operations about workflows
- name: Credential
description: Operations about credentials
- name: VersionControl
description: Operations about version control

paths:
/audit:
$ref: './handlers/audit/spec/paths/audit.yml'
$ref: "./handlers/audit/spec/paths/audit.yml"
/credentials:
$ref: './handlers/credentials/spec/paths/credentials.yml'
$ref: "./handlers/credentials/spec/paths/credentials.yml"
/credentials/{id}:
$ref: './handlers/credentials/spec/paths/credentials.id.yml'
$ref: "./handlers/credentials/spec/paths/credentials.id.yml"
/credentials/schema/{credentialTypeName}:
$ref: './handlers/credentials/spec/paths/credentials.schema.id.yml'
$ref: "./handlers/credentials/spec/paths/credentials.schema.id.yml"
/executions:
$ref: './handlers/executions/spec/paths/executions.yml'
$ref: "./handlers/executions/spec/paths/executions.yml"
/executions/{id}:
$ref: './handlers/executions/spec/paths/executions.id.yml'
$ref: "./handlers/executions/spec/paths/executions.id.yml"
/workflows:
$ref: './handlers/workflows/spec/paths/workflows.yml'
$ref: "./handlers/workflows/spec/paths/workflows.yml"
/workflows/{id}:
$ref: './handlers/workflows/spec/paths/workflows.id.yml'
$ref: "./handlers/workflows/spec/paths/workflows.id.yml"
/workflows/{id}/activate:
$ref: './handlers/workflows/spec/paths/workflows.id.activate.yml'
$ref: "./handlers/workflows/spec/paths/workflows.id.activate.yml"
/workflows/{id}/deactivate:
$ref: './handlers/workflows/spec/paths/workflows.id.deactivate.yml'
$ref: "./handlers/workflows/spec/paths/workflows.id.deactivate.yml"
/version-control/pull:
$ref: "./handlers/versionControl/spec/paths/versionControl.yml"
components:
schemas:
$ref: './shared/spec/schemas/_index.yml'
$ref: "./shared/spec/schemas/_index.yml"
responses:
$ref: './shared/spec/responses/_index.yml'
$ref: "./shared/spec/responses/_index.yml"
parameters:
$ref: './shared/spec/parameters/_index.yml'
$ref: "./shared/spec/parameters/_index.yml"
securitySchemes:
ApiKeyAuth:
type: apiKey
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
NotFound:
$ref: './notFound.yml'
$ref: "./notFound.yml"
Unauthorized:
$ref: './unauthorized.yml'
$ref: "./unauthorized.yml"
BadRequest:
$ref: './badRequest.yml'
$ref: "./badRequest.yml"
Conflict:
$ref: "./conflict.yml"
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
description: Conflict
26 changes: 15 additions & 11 deletions packages/cli/src/PublicApi/v1/shared/spec/schemas/_index.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,26 @@
Error:
$ref: './error.yml'
$ref: "./error.yml"
Execution:
$ref: './../../../handlers/executions/spec/schemas/execution.yml'
$ref: "./../../../handlers/executions/spec/schemas/execution.yml"
Node:
$ref: './../../../handlers/workflows/spec/schemas/node.yml'
$ref: "./../../../handlers/workflows/spec/schemas/node.yml"
Tag:
$ref: './../../../handlers/workflows/spec/schemas/tag.yml'
$ref: "./../../../handlers/workflows/spec/schemas/tag.yml"
Workflow:
$ref: './../../../handlers/workflows/spec/schemas/workflow.yml'
$ref: "./../../../handlers/workflows/spec/schemas/workflow.yml"
WorkflowSettings:
$ref: './../../../handlers/workflows/spec/schemas/workflowSettings.yml'
$ref: "./../../../handlers/workflows/spec/schemas/workflowSettings.yml"
ExecutionList:
$ref: './../../../handlers/executions/spec/schemas/executionList.yml'
$ref: "./../../../handlers/executions/spec/schemas/executionList.yml"
WorkflowList:
$ref: './../../../handlers/workflows/spec/schemas/workflowList.yml'
$ref: "./../../../handlers/workflows/spec/schemas/workflowList.yml"
Credential:
$ref: './../../../handlers/credentials/spec/schemas/credential.yml'
$ref: "./../../../handlers/credentials/spec/schemas/credential.yml"
CredentialType:
$ref: './../../../handlers/credentials/spec/schemas/credentialType.yml'
$ref: "./../../../handlers/credentials/spec/schemas/credentialType.yml"
Audit:
$ref: './../../../handlers/audit/spec/schemas/audit.yml'
$ref: "./../../../handlers/audit/spec/schemas/audit.yml"
Pull:
$ref: "./../../../handlers/versionControl/spec/schemas/pull.yml"
ImportResult:
$ref: "./../../../handlers/versionControl/spec/schemas/importResult.yml"
6 changes: 4 additions & 2 deletions packages/cli/src/Server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,10 @@ import {
isLdapCurrentAuthenticationMethod,
isSamlCurrentAuthenticationMethod,
} from './sso/ssoHelpers';
import { isVersionControlLicensed } from '@/environments/versionControl/versionControlHelper';
import { isVersionControlLicensed } from '@/environments/versionControl/versionControlHelper.ee';
import { VersionControlService } from '@/environments/versionControl/versionControl.service.ee';
import { VersionControlController } from '@/environments/versionControl/versionControl.controller.ee';
import { VersionControlPreferencesService } from './environments/versionControl/versionControlPreferences.service.ee';

const exec = promisify(callbackExec);

Expand Down Expand Up @@ -465,6 +466,7 @@ export class Server extends AbstractServer {
const postHog = this.postHog;
const samlService = Container.get(SamlService);
const versionControlService = Container.get(VersionControlService);
const versionControlPreferencesService = Container.get(VersionControlPreferencesService);

const controllers: object[] = [
new EventBusController(),
Expand Down Expand Up @@ -493,7 +495,7 @@ export class Server extends AbstractServer {
postHog,
}),
new SamlController(samlService),
new VersionControlController(versionControlService),
new VersionControlController(versionControlService, versionControlPreferencesService),
];

if (isLdapEnabled()) {
Expand Down
14 changes: 14 additions & 0 deletions packages/cli/src/environments/versionControl/constants.ts
Original file line number Diff line number Diff line change
@@ -1 +1,15 @@
export const VERSION_CONTROL_PREFERENCES_DB_KEY = 'features.versionControl';
export const VERSION_CONTROL_GIT_FOLDER = 'git';
export const VERSION_CONTROL_GIT_KEY_COMMENT = 'n8n deploy key';
export const VERSION_CONTROL_WORKFLOW_EXPORT_FOLDER = 'workflows';
export const VERSION_CONTROL_CREDENTIAL_EXPORT_FOLDER = 'credentials';
export const VERSION_CONTROL_VARIABLES_EXPORT_FILE = 'variables.json';
export const VERSION_CONTROL_TAGS_EXPORT_FILE = 'tags.json';
export const VERSION_CONTROL_SSH_FOLDER = 'ssh';
export const VERSION_CONTROL_SSH_KEY_NAME = 'key';
export const VERSION_CONTROL_DEFAULT_BRANCH = 'main';
export const VERSION_CONTROL_ORIGIN = 'origin';
export const VERSION_CONTROL_API_ROOT = 'version-control';
export const VERSION_CONTROL_README = `
# n8n Version Control
`;
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import type { RequestHandler } from 'express';
import {
isVersionControlLicensed,
isVersionControlLicensedAndEnabled,
} from '../versionControlHelper';
import { isVersionControlLicensed } from '../versionControlHelper.ee';
import Container from 'typedi';
import { VersionControlPreferencesService } from '../versionControlPreferences.service.ee';

export const versionControlLicensedAndEnabledMiddleware: RequestHandler = (req, res, next) => {
if (isVersionControlLicensedAndEnabled()) {
const versionControlPreferencesService = Container.get(VersionControlPreferencesService);
if (versionControlPreferencesService.isVersionControlLicensedAndEnabled()) {
next();
} else {
res.status(401).json({ status: 'error', message: 'Unauthorized' });
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export interface ExportResult {
count: number;
folder: string;
files: Array<{
id: string;
name: string;
}>;
removedFiles?: string[];
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import type { ICredentialDataDecryptedObject } from 'n8n-workflow';

export interface ExportableCredential {
id: string;
name: string;
type: string;
data: ICredentialDataDecryptedObject;
}
Loading
Loading