mirror of
https://github.com/n8n-io/n8n.git
synced 2024-08-17 09:00:30 +03:00
refactor: Setup typescript project references across workflow, core, and cli (#4519)
* refactor: use consistent folder structure across workflow, core, and cli * setup typescript project references across workflow, core, and cli
This commit is contained in:
parent
de96def372
commit
698d96a617
@ -5,3 +5,4 @@ packages/*/node_modules
|
||||
packages/*/dist
|
||||
packages/*/.turbo
|
||||
.git
|
||||
*.tsbuildinfo
|
||||
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -15,6 +15,7 @@ _START_PACKAGE
|
||||
nodelinter.config.json
|
||||
packages/*/package-lock.json
|
||||
packages/*/.turbo
|
||||
*.tsbuildinfo
|
||||
cypress/videos/*
|
||||
cypress/screenshots/*
|
||||
*.swp
|
||||
|
@ -26,3 +26,4 @@ tsconfig.json
|
||||
tslint.json
|
||||
|
||||
.turbo
|
||||
*.tsbuildinfo
|
||||
|
@ -18,4 +18,7 @@ module.exports = {
|
||||
},
|
||||
},
|
||||
},
|
||||
moduleNameMapper: {
|
||||
'^@/(.*)$': '<rootDir>/src/$1',
|
||||
},
|
||||
};
|
||||
|
159
package-lock.json
generated
159
package-lock.json
generated
@ -25470,6 +25470,19 @@
|
||||
"resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.8.tgz",
|
||||
"integrity": "sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA=="
|
||||
},
|
||||
"node_modules/mylas": {
|
||||
"version": "2.1.13",
|
||||
"resolved": "https://registry.npmjs.org/mylas/-/mylas-2.1.13.tgz",
|
||||
"integrity": "sha512-+MrqnJRtxdF+xngFfUUkIMQrUUL0KsxbADUkn23Z/4ibGg192Q+z+CQyiYwvWTsYjJygmMR8+w3ZDa98Zh6ESg==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=12.0.0"
|
||||
},
|
||||
"funding": {
|
||||
"type": "github",
|
||||
"url": "https://github.com/sponsors/raouldeheer"
|
||||
}
|
||||
},
|
||||
"node_modules/mysql2": {
|
||||
"version": "2.3.3",
|
||||
"resolved": "https://registry.npmjs.org/mysql2/-/mysql2-2.3.3.tgz",
|
||||
@ -28112,6 +28125,15 @@
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/plimit-lit": {
|
||||
"version": "1.4.1",
|
||||
"resolved": "https://registry.npmjs.org/plimit-lit/-/plimit-lit-1.4.1.tgz",
|
||||
"integrity": "sha512-bK14ePAod0XWhXwjT6XvYfjcQ9PbCUkZXnDCAKRMZTJCaDIV9VFya1S/I+3WSbpdR8uBhCDh8TS4lQ/JQvhNFA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"queue-lit": "^1.4.0"
|
||||
}
|
||||
},
|
||||
"node_modules/pluralize": {
|
||||
"version": "8.0.0",
|
||||
"resolved": "https://registry.npmjs.org/pluralize/-/pluralize-8.0.0.tgz",
|
||||
@ -29467,6 +29489,12 @@
|
||||
"resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.2.0.tgz",
|
||||
"integrity": "sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ=="
|
||||
},
|
||||
"node_modules/queue-lit": {
|
||||
"version": "1.4.0",
|
||||
"resolved": "https://registry.npmjs.org/queue-lit/-/queue-lit-1.4.0.tgz",
|
||||
"integrity": "sha512-l1+4YHm4vHWpCnvTg8JMsnPETmPvLGWhqjvNOc8TSbqscGplHVSWXOxybA3vYeMNNIR9Z1PQt85U+S3wFJX2uQ==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/queue-microtask": {
|
||||
"version": "1.2.3",
|
||||
"resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz",
|
||||
@ -34822,6 +34850,59 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/tsc-alias": {
|
||||
"version": "1.7.0",
|
||||
"resolved": "https://registry.npmjs.org/tsc-alias/-/tsc-alias-1.7.0.tgz",
|
||||
"integrity": "sha512-n/K6g8S7Ec7Y/A2Z77Ikp2Uv1S1ERtT63ni69XV4W1YPT4rnNmz8ItgIiJYvKfFnKfqcZQ81UPjoKpMTxaC/rg==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"chokidar": "^3.5.3",
|
||||
"commander": "^9.0.0",
|
||||
"globby": "^11.0.4",
|
||||
"mylas": "^2.1.9",
|
||||
"normalize-path": "^3.0.0",
|
||||
"plimit-lit": "^1.2.6"
|
||||
},
|
||||
"bin": {
|
||||
"tsc-alias": "dist/bin/index.js"
|
||||
}
|
||||
},
|
||||
"node_modules/tsc-alias/node_modules/chokidar": {
|
||||
"version": "3.5.3",
|
||||
"resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz",
|
||||
"integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==",
|
||||
"dev": true,
|
||||
"funding": [
|
||||
{
|
||||
"type": "individual",
|
||||
"url": "https://paulmillr.com/funding/"
|
||||
}
|
||||
],
|
||||
"dependencies": {
|
||||
"anymatch": "~3.1.2",
|
||||
"braces": "~3.0.2",
|
||||
"glob-parent": "~5.1.2",
|
||||
"is-binary-path": "~2.1.0",
|
||||
"is-glob": "~4.0.1",
|
||||
"normalize-path": "~3.0.0",
|
||||
"readdirp": "~3.6.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 8.10.0"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"fsevents": "~2.3.2"
|
||||
}
|
||||
},
|
||||
"node_modules/tsc-alias/node_modules/commander": {
|
||||
"version": "9.4.1",
|
||||
"resolved": "https://registry.npmjs.org/commander/-/commander-9.4.1.tgz",
|
||||
"integrity": "sha512-5EEkTNyHNGFPD2H+c/dXXfQZYa/scCKasxWcXJaWnNJ99pnQN9Vnmqow+p+PlFPE63Q6mThaZws1T+HxfpgtPw==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": "^12.20.0 || >=14"
|
||||
}
|
||||
},
|
||||
"node_modules/tsconfig-paths": {
|
||||
"version": "3.14.1",
|
||||
"resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.14.1.tgz",
|
||||
@ -37299,14 +37380,6 @@
|
||||
"resolved": "https://registry.npmjs.org/vue2-touch-events/-/vue2-touch-events-3.2.2.tgz",
|
||||
"integrity": "sha512-rGV8jxgOQEJYkJCp7uOBe3hjvmG1arThrq1wGtJHwJTgi65+P2a+0l4CYcQO/U1ZFqTq2/TT2+oTE6H7Y+6Eog=="
|
||||
},
|
||||
"node_modules/vuex": {
|
||||
"version": "3.6.2",
|
||||
"resolved": "https://registry.npmjs.org/vuex/-/vuex-3.6.2.tgz",
|
||||
"integrity": "sha512-ETW44IqCgBpVomy520DT5jf8n0zoCac+sxWnn+hMe/CzaSejb/eVw2YToiXYX+Ex/AuHHia28vWTq4goAexFbw==",
|
||||
"peerDependencies": {
|
||||
"vue": "^2.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/w3c-hr-time": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/w3c-hr-time/-/w3c-hr-time-1.0.2.tgz",
|
||||
@ -39359,6 +39432,8 @@
|
||||
"run-script-os": "^1.0.7",
|
||||
"supertest": "^6.2.2",
|
||||
"ts-node": "^8.9.1",
|
||||
"tsc-alias": "^1.7.0",
|
||||
"tsconfig-paths": "^3.14.1",
|
||||
"typescript": "~4.8.0"
|
||||
},
|
||||
"engines": {
|
||||
@ -39740,7 +39815,6 @@
|
||||
"vue2-boring-avatars": "0.3.4",
|
||||
"vue2-teleport": "^1.0.1",
|
||||
"vue2-touch-events": "^3.2.1",
|
||||
"vuex": "^3.6.2",
|
||||
"xss": "^1.0.10"
|
||||
},
|
||||
"devDependencies": {
|
||||
@ -60468,6 +60542,12 @@
|
||||
"resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.8.tgz",
|
||||
"integrity": "sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA=="
|
||||
},
|
||||
"mylas": {
|
||||
"version": "2.1.13",
|
||||
"resolved": "https://registry.npmjs.org/mylas/-/mylas-2.1.13.tgz",
|
||||
"integrity": "sha512-+MrqnJRtxdF+xngFfUUkIMQrUUL0KsxbADUkn23Z/4ibGg192Q+z+CQyiYwvWTsYjJygmMR8+w3ZDa98Zh6ESg==",
|
||||
"dev": true
|
||||
},
|
||||
"mysql2": {
|
||||
"version": "2.3.3",
|
||||
"resolved": "https://registry.npmjs.org/mysql2/-/mysql2-2.3.3.tgz",
|
||||
@ -60615,6 +60695,8 @@
|
||||
"supertest": "^6.2.2",
|
||||
"swagger-ui-express": "^4.3.0",
|
||||
"ts-node": "^8.9.1",
|
||||
"tsc-alias": "^1.7.0",
|
||||
"tsconfig-paths": "^3.14.1",
|
||||
"tslib": "1.14.1",
|
||||
"typeorm": "0.2.45",
|
||||
"typescript": "~4.8.0",
|
||||
@ -60976,7 +61058,6 @@
|
||||
"vue2-boring-avatars": "0.3.4",
|
||||
"vue2-teleport": "^1.0.1",
|
||||
"vue2-touch-events": "^3.2.1",
|
||||
"vuex": "^3.6.2",
|
||||
"xss": "^1.0.10"
|
||||
},
|
||||
"dependencies": {
|
||||
@ -63192,6 +63273,15 @@
|
||||
"find-up": "^5.0.0"
|
||||
}
|
||||
},
|
||||
"plimit-lit": {
|
||||
"version": "1.4.1",
|
||||
"resolved": "https://registry.npmjs.org/plimit-lit/-/plimit-lit-1.4.1.tgz",
|
||||
"integrity": "sha512-bK14ePAod0XWhXwjT6XvYfjcQ9PbCUkZXnDCAKRMZTJCaDIV9VFya1S/I+3WSbpdR8uBhCDh8TS4lQ/JQvhNFA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"queue-lit": "^1.4.0"
|
||||
}
|
||||
},
|
||||
"pluralize": {
|
||||
"version": "8.0.0",
|
||||
"resolved": "https://registry.npmjs.org/pluralize/-/pluralize-8.0.0.tgz",
|
||||
@ -64266,6 +64356,12 @@
|
||||
"resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.2.0.tgz",
|
||||
"integrity": "sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ=="
|
||||
},
|
||||
"queue-lit": {
|
||||
"version": "1.4.0",
|
||||
"resolved": "https://registry.npmjs.org/queue-lit/-/queue-lit-1.4.0.tgz",
|
||||
"integrity": "sha512-l1+4YHm4vHWpCnvTg8JMsnPETmPvLGWhqjvNOc8TSbqscGplHVSWXOxybA3vYeMNNIR9Z1PQt85U+S3wFJX2uQ==",
|
||||
"dev": true
|
||||
},
|
||||
"queue-microtask": {
|
||||
"version": "1.2.3",
|
||||
"resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz",
|
||||
@ -68473,6 +68569,44 @@
|
||||
"integrity": "sha512-csd+vJOb/gkzvcCHgTGSChYpy5f1/XKNsmvBGO4JXS+z1v2HobugDz4s1IeFXM3wZB44uczs+eazB5Q/ccdhQw==",
|
||||
"dev": true
|
||||
},
|
||||
"tsc-alias": {
|
||||
"version": "1.7.0",
|
||||
"resolved": "https://registry.npmjs.org/tsc-alias/-/tsc-alias-1.7.0.tgz",
|
||||
"integrity": "sha512-n/K6g8S7Ec7Y/A2Z77Ikp2Uv1S1ERtT63ni69XV4W1YPT4rnNmz8ItgIiJYvKfFnKfqcZQ81UPjoKpMTxaC/rg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"chokidar": "^3.5.3",
|
||||
"commander": "^9.0.0",
|
||||
"globby": "^11.0.2",
|
||||
"mylas": "^2.1.9",
|
||||
"normalize-path": "^3.0.0",
|
||||
"plimit-lit": "^1.2.6"
|
||||
},
|
||||
"dependencies": {
|
||||
"chokidar": {
|
||||
"version": "3.5.3",
|
||||
"resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz",
|
||||
"integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"anymatch": "~3.1.2",
|
||||
"braces": "~3.0.2",
|
||||
"fsevents": "~2.3.2",
|
||||
"glob-parent": "~5.1.2",
|
||||
"is-binary-path": "~2.1.0",
|
||||
"is-glob": "~4.0.1",
|
||||
"normalize-path": "~3.0.0",
|
||||
"readdirp": "~3.6.0"
|
||||
}
|
||||
},
|
||||
"commander": {
|
||||
"version": "9.4.1",
|
||||
"resolved": "https://registry.npmjs.org/commander/-/commander-9.4.1.tgz",
|
||||
"integrity": "sha512-5EEkTNyHNGFPD2H+c/dXXfQZYa/scCKasxWcXJaWnNJ99pnQN9Vnmqow+p+PlFPE63Q6mThaZws1T+HxfpgtPw==",
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"tsconfig-paths": {
|
||||
"version": "3.14.1",
|
||||
"resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.14.1.tgz",
|
||||
@ -70267,11 +70401,6 @@
|
||||
"resolved": "https://registry.npmjs.org/vue2-touch-events/-/vue2-touch-events-3.2.2.tgz",
|
||||
"integrity": "sha512-rGV8jxgOQEJYkJCp7uOBe3hjvmG1arThrq1wGtJHwJTgi65+P2a+0l4CYcQO/U1ZFqTq2/TT2+oTE6H7Y+6Eog=="
|
||||
},
|
||||
"vuex": {
|
||||
"version": "3.6.2",
|
||||
"resolved": "https://registry.npmjs.org/vuex/-/vuex-3.6.2.tgz",
|
||||
"integrity": "sha512-ETW44IqCgBpVomy520DT5jf8n0zoCac+sxWnn+hMe/CzaSejb/eVw2YToiXYX+Ex/AuHHia28vWTq4goAexFbw=="
|
||||
},
|
||||
"w3c-hr-time": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/w3c-hr-time/-/w3c-hr-time-1.0.2.tgz",
|
||||
|
@ -3,6 +3,12 @@
|
||||
*/
|
||||
module.exports = {
|
||||
extends: ['@n8n_io/eslint-config/node'],
|
||||
|
||||
parserOptions: {
|
||||
project: ['./tsconfig.json'],
|
||||
tsconfigRootDir: __dirname,
|
||||
},
|
||||
|
||||
ignorePatterns: [
|
||||
'jest.config.js',
|
||||
// TODO: Remove these
|
||||
@ -12,6 +18,7 @@ module.exports = {
|
||||
rules: {
|
||||
// TODO: Remove this
|
||||
'import/order': 'off',
|
||||
'import/extensions': 'off',
|
||||
'@typescript-eslint/ban-ts-comment': ['warn', { 'ts-ignore': true }],
|
||||
},
|
||||
};
|
||||
|
@ -5,4 +5,8 @@ module.exports = {
|
||||
url: 'http://localhost/',
|
||||
},
|
||||
globalTeardown: '<rootDir>/test/teardown.ts',
|
||||
moduleNameMapper: {
|
||||
'^@/(.*)$': '<rootDir>/src/$1',
|
||||
'^@db/(.*)$': '<rootDir>/src/databases/$1',
|
||||
},
|
||||
};
|
||||
|
@ -13,13 +13,14 @@
|
||||
"url": "git+https://github.com/n8n-io/n8n.git"
|
||||
},
|
||||
"main": "dist/index",
|
||||
"types": "dist/src/index.d.ts",
|
||||
"types": "dist/index.d.ts",
|
||||
"oclif": {
|
||||
"commands": "./dist/commands",
|
||||
"bin": "n8n"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "node scripts/build.mjs",
|
||||
"typecheck": "tsc",
|
||||
"build": "tsc -p tsconfig.build.json && tsc-alias -p tsconfig.build.json && node scripts/build.mjs",
|
||||
"dev": "concurrently -k -n \"TypeScript,Node\" -c \"yellow.bold,cyan.bold\" \"npm run watch\" \"nodemon\"",
|
||||
"format": "cd ../.. && node_modules/prettier/bin-prettier.js packages/cli/**/**.ts --write",
|
||||
"lint": "eslint .",
|
||||
@ -29,12 +30,13 @@
|
||||
"start": "run-script-os",
|
||||
"start:default": "cd bin && ./n8n",
|
||||
"start:windows": "cd bin && n8n",
|
||||
"swagger": "swagger-cli",
|
||||
"test": "npm run test:sqlite",
|
||||
"test:sqlite": "N8N_LOG_LEVEL=silent DB_TYPE=sqlite jest",
|
||||
"test:postgres": "N8N_LOG_LEVEL=silent DB_TYPE=postgresdb jest",
|
||||
"test:postgres:alt-schema": "DB_POSTGRESDB_SCHEMA=alt_schema npm run test:postgres",
|
||||
"test:mysql": "N8N_LOG_LEVEL=silent DB_TYPE=mysqldb jest",
|
||||
"watch": "tsc --watch",
|
||||
"watch": "concurrently \"tsc -w -p tsconfig.build.json\" \"tsc-alias -w -p tsconfig.build.json\"",
|
||||
"typeorm": "ts-node -T ../../node_modules/typeorm/cli.js"
|
||||
},
|
||||
"bin": {
|
||||
@ -97,6 +99,8 @@
|
||||
"run-script-os": "^1.0.7",
|
||||
"supertest": "^6.2.2",
|
||||
"ts-node": "^8.9.1",
|
||||
"tsc-alias": "^1.7.0",
|
||||
"tsconfig-paths": "^3.14.1",
|
||||
"typescript": "~4.8.0"
|
||||
},
|
||||
"dependencies": {
|
||||
|
@ -12,15 +12,6 @@ const SPEC_THEME_FILENAME = 'swaggerTheme.css';
|
||||
const userManagementEnabled = process.env.N8N_USER_MANAGEMENT_DISABLED !== 'true';
|
||||
const publicApiEnabled = process.env.N8N_PUBLIC_API_DISABLED !== 'true';
|
||||
|
||||
shell.rm('-rf', path.resolve(ROOT_DIR, 'dist'));
|
||||
|
||||
const tscCompilation = shell.exec('tsc', { silent: true })
|
||||
if (tscCompilation.code !== 0) {
|
||||
shell.echo('Typescript Compilation failed:');
|
||||
shell.echo(tscCompilation.stdout);
|
||||
shell.exit(1);
|
||||
}
|
||||
|
||||
if (userManagementEnabled) {
|
||||
copyUserManagementEmailTemplates();
|
||||
}
|
||||
@ -33,7 +24,7 @@ if (publicApiEnabled) {
|
||||
function copyUserManagementEmailTemplates(rootDir = ROOT_DIR) {
|
||||
const templates = {
|
||||
source: path.resolve(rootDir, 'src', 'UserManagement', 'email', 'templates'),
|
||||
destination: path.resolve(rootDir, 'dist', 'src', 'UserManagement', 'email'),
|
||||
destination: path.resolve(rootDir, 'dist', 'UserManagement', 'email'),
|
||||
};
|
||||
|
||||
shell.cp('-r', templates.source, templates.destination);
|
||||
@ -42,7 +33,7 @@ function copyUserManagementEmailTemplates(rootDir = ROOT_DIR) {
|
||||
function copySwaggerTheme(rootDir = ROOT_DIR, themeFilename = SPEC_THEME_FILENAME) {
|
||||
const swaggerTheme = {
|
||||
source: path.resolve(rootDir, 'src', 'PublicApi', themeFilename),
|
||||
destination: path.resolve(rootDir, 'dist', 'src', 'PublicApi'),
|
||||
destination: path.resolve(rootDir, 'dist', 'PublicApi'),
|
||||
};
|
||||
|
||||
shell.cp('-r', swaggerTheme.source, swaggerTheme.destination);
|
||||
@ -54,11 +45,11 @@ function bundleOpenApiSpecs(rootDir = ROOT_DIR, specFileName = SPEC_FILENAME) {
|
||||
shell
|
||||
.find(publicApiDir)
|
||||
.reduce((acc, cur) => {
|
||||
return cur.endsWith(specFileName) ? [...acc, path.relative('.', cur)] : acc;
|
||||
return cur.endsWith(specFileName) ? [...acc, path.relative('./src', cur)] : acc;
|
||||
}, [])
|
||||
.forEach((specPath) => {
|
||||
const distSpecPath = path.resolve(rootDir, 'dist', specPath);
|
||||
const command = `swagger-cli bundle ${specPath} --type yaml --outfile ${distSpecPath}`;
|
||||
const command = `npm run swagger -- bundle src/${specPath} --type yaml --outfile ${distSpecPath}`;
|
||||
shell.exec(command, { silent: true });
|
||||
});
|
||||
}
|
||||
|
@ -16,17 +16,16 @@ import { ChildProcess } from 'child_process';
|
||||
import { stringify } from 'flatted';
|
||||
// eslint-disable-next-line import/no-extraneous-dependencies
|
||||
import PCancelable from 'p-cancelable';
|
||||
// eslint-disable-next-line import/no-cycle
|
||||
import * as Db from '@/Db';
|
||||
import {
|
||||
Db,
|
||||
IExecutingWorkflowData,
|
||||
IExecutionDb,
|
||||
IExecutionFlattedDb,
|
||||
IExecutionsCurrentSummary,
|
||||
IWorkflowExecutionDataProcess,
|
||||
ResponseHelper,
|
||||
WorkflowHelpers,
|
||||
} from '.';
|
||||
} from '@/Interfaces';
|
||||
import * as ResponseHelper from '@/ResponseHelper';
|
||||
import * as WorkflowHelpers from '@/WorkflowHelpers';
|
||||
|
||||
export class ActiveExecutions {
|
||||
private activeExecutions: {
|
||||
|
@ -1,4 +1,3 @@
|
||||
/* eslint-disable import/no-cycle */
|
||||
/* eslint-disable prefer-spread */
|
||||
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
||||
/* eslint-disable no-param-reassign */
|
||||
@ -37,32 +36,30 @@ import {
|
||||
|
||||
import express from 'express';
|
||||
|
||||
// eslint-disable-next-line import/no-cycle
|
||||
import * as Db from '@/Db';
|
||||
import {
|
||||
Db,
|
||||
IActivationError,
|
||||
IQueuedWorkflowActivations,
|
||||
IResponseCallbackData,
|
||||
IWebhookDb,
|
||||
IWorkflowDb,
|
||||
IWorkflowExecutionDataProcess,
|
||||
NodeTypes,
|
||||
ResponseHelper,
|
||||
WebhookHelpers,
|
||||
WorkflowExecuteAdditionalData,
|
||||
WorkflowHelpers,
|
||||
WorkflowRunner,
|
||||
ExternalHooks,
|
||||
} from '.';
|
||||
import config from '../config';
|
||||
import { User } from './databases/entities/User';
|
||||
import { whereClause } from './WorkflowHelpers';
|
||||
import { WorkflowEntity } from './databases/entities/WorkflowEntity';
|
||||
import * as ActiveExecutions from './ActiveExecutions';
|
||||
import { createErrorExecution } from './GenericHelpers';
|
||||
import { WORKFLOW_REACTIVATE_INITIAL_TIMEOUT, WORKFLOW_REACTIVATE_MAX_TIMEOUT } from './constants';
|
||||
} from '@/Interfaces';
|
||||
import * as ResponseHelper from '@/ResponseHelper';
|
||||
import * as WebhookHelpers from '@/WebhookHelpers';
|
||||
import * as WorkflowHelpers from '@/WorkflowHelpers';
|
||||
import * as WorkflowExecuteAdditionalData from '@/WorkflowExecuteAdditionalData';
|
||||
|
||||
const activeExecutions = ActiveExecutions.getInstance();
|
||||
import config from '@/config';
|
||||
import { User } from '@db/entities/User';
|
||||
import { whereClause } from '@/WorkflowHelpers';
|
||||
import { WorkflowEntity } from '@db/entities/WorkflowEntity';
|
||||
import * as ActiveExecutions from '@/ActiveExecutions';
|
||||
import { createErrorExecution } from '@/GenericHelpers';
|
||||
import { WORKFLOW_REACTIVATE_INITIAL_TIMEOUT, WORKFLOW_REACTIVATE_MAX_TIMEOUT } from '@/constants';
|
||||
import { NodeTypes } from '@/NodeTypes';
|
||||
import { WorkflowRunner } from '@/WorkflowRunner';
|
||||
import { ExternalHooks } from '@/ExternalHooks';
|
||||
|
||||
const WEBHOOK_PROD_UNREGISTERED_HINT = `The workflow must be active for a production URL to run successfully. You can activate the workflow using the toggle in the top-right of the editor. Note that unlike test URL calls, production URL calls aren't shown on the canvas (only in the executions list)`;
|
||||
|
||||
@ -649,7 +646,7 @@ export class ActiveWorkflowRunner {
|
||||
|
||||
if (donePromise) {
|
||||
executePromise.then((executionId) => {
|
||||
activeExecutions
|
||||
ActiveExecutions.getInstance()
|
||||
.getPostExecutePromise(executionId)
|
||||
.then(donePromise.resolve)
|
||||
.catch(donePromise.reject);
|
||||
@ -706,7 +703,7 @@ export class ActiveWorkflowRunner {
|
||||
|
||||
if (donePromise) {
|
||||
executePromise.then((executionId) => {
|
||||
activeExecutions
|
||||
ActiveExecutions.getInstance()
|
||||
.getPostExecutePromise(executionId)
|
||||
.then(donePromise.resolve)
|
||||
.catch(donePromise.reject);
|
||||
|
@ -1,5 +1,4 @@
|
||||
/* eslint-disable no-restricted-syntax */
|
||||
/* eslint-disable import/no-cycle */
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
import { promisify } from 'util';
|
||||
import { exec } from 'child_process';
|
||||
@ -15,11 +14,11 @@ import {
|
||||
NPM_PACKAGE_STATUS_GOOD,
|
||||
RESPONSE_ERROR_MESSAGES,
|
||||
UNKNOWN_FAILURE_REASON,
|
||||
} from '../constants';
|
||||
import { InstalledPackages } from '../databases/entities/InstalledPackages';
|
||||
import config from '../../config';
|
||||
} from '@/constants';
|
||||
import { InstalledPackages } from '@db/entities/InstalledPackages';
|
||||
import config from '@/config';
|
||||
|
||||
import type { CommunityPackages } from '../Interfaces';
|
||||
import type { CommunityPackages } from '@/Interfaces';
|
||||
|
||||
const {
|
||||
PACKAGE_NAME_NOT_PROVIDED,
|
||||
|
@ -1,8 +1,7 @@
|
||||
/* eslint-disable import/no-cycle */
|
||||
import { INodeTypeData, INodeTypeNameVersion, LoggerProxy } from 'n8n-workflow';
|
||||
import { Db } from '..';
|
||||
import { InstalledNodes } from '../databases/entities/InstalledNodes';
|
||||
import { InstalledPackages } from '../databases/entities/InstalledPackages';
|
||||
import * as Db from '@/Db';
|
||||
import { InstalledNodes } from '@db/entities/InstalledNodes';
|
||||
import { InstalledPackages } from '@db/entities/InstalledPackages';
|
||||
|
||||
export async function findInstalledPackage(
|
||||
packageName: string,
|
||||
|
@ -3,7 +3,7 @@ import {
|
||||
ICredentialTypeData,
|
||||
ICredentialTypes as ICredentialTypesInterface,
|
||||
} from 'n8n-workflow';
|
||||
import { RESPONSE_ERROR_MESSAGES } from './constants';
|
||||
import { RESPONSE_ERROR_MESSAGES } from '@/constants';
|
||||
|
||||
class CredentialTypesClass implements ICredentialTypesInterface {
|
||||
credentialTypes: ICredentialTypeData = {};
|
||||
|
@ -42,20 +42,14 @@ import {
|
||||
IHttpRequestHelper,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
// eslint-disable-next-line import/no-cycle
|
||||
import {
|
||||
CredentialsOverwrites,
|
||||
CredentialTypes,
|
||||
Db,
|
||||
ICredentialsDb,
|
||||
NodeTypes,
|
||||
WhereClause,
|
||||
WorkflowExecuteAdditionalData,
|
||||
} from '.';
|
||||
// eslint-disable-next-line import/no-cycle
|
||||
import { User } from './databases/entities/User';
|
||||
// eslint-disable-next-line import/no-cycle
|
||||
import { CredentialsEntity } from './databases/entities/CredentialsEntity';
|
||||
import * as Db from '@/Db';
|
||||
import { ICredentialsDb, WhereClause } from '@/Interfaces';
|
||||
import * as WorkflowExecuteAdditionalData from '@/WorkflowExecuteAdditionalData';
|
||||
import { User } from '@db/entities/User';
|
||||
import { CredentialsEntity } from '@db/entities/CredentialsEntity';
|
||||
import { NodeTypes } from '@/NodeTypes';
|
||||
import { CredentialsOverwrites } from '@/CredentialsOverwrites';
|
||||
import { CredentialTypes } from '@/CredentialTypes';
|
||||
|
||||
const mockNodeTypes: INodeTypes = {
|
||||
nodeTypes: {} as INodeTypeData,
|
||||
|
@ -1,9 +1,9 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
||||
/* eslint-disable no-underscore-dangle */
|
||||
import { deepCopy, ICredentialDataDecryptedObject } from 'n8n-workflow';
|
||||
|
||||
// eslint-disable-next-line import/no-cycle
|
||||
import { CredentialTypes, GenericHelpers, ICredentialsOverwrite } from '.';
|
||||
import { CredentialTypes } from '@/CredentialTypes';
|
||||
import type { ICredentialsOverwrite } from '@/Interfaces';
|
||||
import * as GenericHelpers from '@/GenericHelpers';
|
||||
|
||||
class CredentialsOverwritesClass {
|
||||
private credentialTypes = CredentialTypes();
|
||||
|
@ -1,5 +1,4 @@
|
||||
/* eslint-disable import/no-mutable-exports */
|
||||
/* eslint-disable import/no-cycle */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
/* eslint-disable no-case-declarations */
|
||||
@ -16,20 +15,19 @@ import {
|
||||
Repository,
|
||||
} from 'typeorm';
|
||||
import { TlsOptions } from 'tls';
|
||||
// eslint-disable-next-line import/no-cycle
|
||||
import { DatabaseType, GenericHelpers, IDatabaseCollections } from '.';
|
||||
import { DatabaseType, IDatabaseCollections } from '@/Interfaces';
|
||||
import * as GenericHelpers from '@/GenericHelpers';
|
||||
|
||||
import config from '../config';
|
||||
import config from '@/config';
|
||||
|
||||
// eslint-disable-next-line import/no-cycle
|
||||
import { entities } from './databases/entities';
|
||||
import { entities } from '@db/entities';
|
||||
import {
|
||||
getMariaDBConnectionOptions,
|
||||
getMysqlConnectionOptions,
|
||||
getOptionOverrides,
|
||||
getPostgresConnectionOptions,
|
||||
getSqliteConnectionOptions,
|
||||
} from './databases/config';
|
||||
} from '@db/config';
|
||||
|
||||
export let isInitialized = false;
|
||||
export const collections = {} as IDatabaseCollections;
|
||||
|
@ -1,7 +1,7 @@
|
||||
import * as Sentry from '@sentry/node';
|
||||
import { RewriteFrames } from '@sentry/integrations';
|
||||
import type { Application } from 'express';
|
||||
import config from '../config';
|
||||
import config from '@/config';
|
||||
import { ErrorReporterProxy } from 'n8n-workflow';
|
||||
|
||||
let initialized = false;
|
||||
|
@ -1,10 +1,10 @@
|
||||
/* eslint-disable @typescript-eslint/no-var-requires */
|
||||
/* eslint-disable import/no-dynamic-require */
|
||||
/* eslint-disable no-restricted-syntax */
|
||||
// eslint-disable-next-line import/no-cycle
|
||||
import { Db, IExternalHooksClass, IExternalHooksFileData, IExternalHooksFunctions } from '.';
|
||||
import * as Db from '@/Db';
|
||||
import { IExternalHooksClass, IExternalHooksFileData, IExternalHooksFunctions } from '@/Interfaces';
|
||||
|
||||
import config from '../config';
|
||||
import config from '@/config';
|
||||
|
||||
class ExternalHooksClass implements IExternalHooksClass {
|
||||
externalHooks: {
|
||||
|
@ -1,4 +1,3 @@
|
||||
/* eslint-disable import/no-cycle */
|
||||
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
||||
@ -18,26 +17,24 @@ import {
|
||||
WorkflowExecuteMode,
|
||||
} from 'n8n-workflow';
|
||||
import { validate } from 'class-validator';
|
||||
import config from '../config';
|
||||
|
||||
// eslint-disable-next-line import/no-cycle
|
||||
import config from '@/config';
|
||||
import * as Db from '@/Db';
|
||||
import {
|
||||
Db,
|
||||
ICredentialsDb,
|
||||
IExecutionDb,
|
||||
IExecutionFlattedDb,
|
||||
IPackageVersions,
|
||||
IWorkflowDb,
|
||||
ResponseHelper,
|
||||
IN8nNodePackageJson,
|
||||
} from '.';
|
||||
} from '@/Interfaces';
|
||||
import * as ResponseHelper from '@/ResponseHelper';
|
||||
// eslint-disable-next-line import/order
|
||||
import { Like } from 'typeorm';
|
||||
// eslint-disable-next-line import/no-cycle
|
||||
import { WorkflowEntity } from './databases/entities/WorkflowEntity';
|
||||
import { CredentialsEntity } from './databases/entities/CredentialsEntity';
|
||||
import { TagEntity } from './databases/entities/TagEntity';
|
||||
import { User } from './databases/entities/User';
|
||||
import { WorkflowEntity } from '@db/entities/WorkflowEntity';
|
||||
import { CredentialsEntity } from '@db/entities/CredentialsEntity';
|
||||
import { TagEntity } from '@db/entities/TagEntity';
|
||||
import { User } from '@db/entities/User';
|
||||
import { CLI_DIR } from '@/constants';
|
||||
|
||||
let versionCache: IPackageVersions | undefined;
|
||||
|
||||
@ -74,7 +71,7 @@ export async function getVersions(): Promise<IPackageVersions> {
|
||||
return versionCache;
|
||||
}
|
||||
|
||||
const packageFile = await fsReadFile(pathJoin(__dirname, '../../package.json'), 'utf8');
|
||||
const packageFile = await fsReadFile(pathJoin(CLI_DIR, 'package.json'), 'utf8');
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
||||
const packageData = jsonParse<IN8nNodePackageJson>(packageFile);
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
/* eslint-disable import/no-cycle */
|
||||
import {
|
||||
ExecutionError,
|
||||
ICredentialDataDecryptedObject,
|
||||
@ -31,15 +30,15 @@ import { ChildProcess } from 'child_process';
|
||||
import { Url } from 'url';
|
||||
|
||||
import type { Request } from 'express';
|
||||
import type { InstalledNodes } from './databases/entities/InstalledNodes';
|
||||
import type { InstalledPackages } from './databases/entities/InstalledPackages';
|
||||
import type { Role } from './databases/entities/Role';
|
||||
import type { Settings } from './databases/entities/Settings';
|
||||
import type { SharedCredentials } from './databases/entities/SharedCredentials';
|
||||
import type { SharedWorkflow } from './databases/entities/SharedWorkflow';
|
||||
import type { TagEntity } from './databases/entities/TagEntity';
|
||||
import type { User } from './databases/entities/User';
|
||||
import type { WorkflowEntity } from './databases/entities/WorkflowEntity';
|
||||
import type { InstalledNodes } from '@db/entities/InstalledNodes';
|
||||
import type { InstalledPackages } from '@db/entities/InstalledPackages';
|
||||
import type { Role } from '@db/entities/Role';
|
||||
import type { Settings } from '@db/entities/Settings';
|
||||
import type { SharedCredentials } from '@db/entities/SharedCredentials';
|
||||
import type { SharedWorkflow } from '@db/entities/SharedWorkflow';
|
||||
import type { TagEntity } from '@db/entities/TagEntity';
|
||||
import type { User } from '@db/entities/User';
|
||||
import type { WorkflowEntity } from '@db/entities/WorkflowEntity';
|
||||
|
||||
export interface IActivationError {
|
||||
time: number;
|
||||
@ -94,16 +93,6 @@ export interface IWebhookDb {
|
||||
pathLength?: number;
|
||||
}
|
||||
|
||||
// ----------------------------------
|
||||
// settings
|
||||
// ----------------------------------
|
||||
|
||||
export interface ISettingsDb {
|
||||
key: string;
|
||||
value: string | boolean | IDataObject | number;
|
||||
loadOnStartup: boolean;
|
||||
}
|
||||
|
||||
// ----------------------------------
|
||||
// tags
|
||||
// ----------------------------------
|
||||
|
@ -1,4 +1,3 @@
|
||||
/* eslint-disable import/no-cycle */
|
||||
import { snakeCase } from 'change-case';
|
||||
import { BinaryDataManager } from 'n8n-core';
|
||||
import {
|
||||
@ -15,9 +14,9 @@ import {
|
||||
ITelemetryUserDeletionData,
|
||||
IWorkflowBase,
|
||||
IWorkflowDb,
|
||||
} from '.';
|
||||
import { IExecutionTrackProperties } from './Interfaces';
|
||||
import { Telemetry } from './telemetry';
|
||||
IExecutionTrackProperties,
|
||||
} from '@/Interfaces';
|
||||
import { Telemetry } from '@/telemetry';
|
||||
|
||||
export class InternalHooksClass implements IInternalHooksClass {
|
||||
private versionCli: string;
|
||||
|
@ -1,7 +1,6 @@
|
||||
/* eslint-disable import/no-cycle */
|
||||
import { INodeTypes } from 'n8n-workflow';
|
||||
import { InternalHooksClass } from './InternalHooks';
|
||||
import { Telemetry } from './telemetry';
|
||||
import { InternalHooksClass } from '@/InternalHooks';
|
||||
import { Telemetry } from '@/telemetry';
|
||||
|
||||
export class InternalHooksManager {
|
||||
private static internalHooksInstance: InternalHooksClass;
|
||||
|
@ -1,4 +1,3 @@
|
||||
/* eslint-disable import/no-cycle */
|
||||
/* eslint-disable no-underscore-dangle */
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
/* eslint-disable no-prototype-builtins */
|
||||
@ -34,18 +33,18 @@ import {
|
||||
import glob from 'fast-glob';
|
||||
import path from 'path';
|
||||
import pick from 'lodash.pick';
|
||||
import { IN8nNodePackageJson } from './Interfaces';
|
||||
import { getLogger } from './Logger';
|
||||
import config from '../config';
|
||||
import { NodeTypes } from '.';
|
||||
import { InstalledPackages } from './databases/entities/InstalledPackages';
|
||||
import { InstalledNodes } from './databases/entities/InstalledNodes';
|
||||
import { executeCommand, loadClassInIsolation } from './CommunityNodes/helpers';
|
||||
import { RESPONSE_ERROR_MESSAGES } from './constants';
|
||||
import { IN8nNodePackageJson } from '@/Interfaces';
|
||||
import { getLogger } from '@/Logger';
|
||||
import config from '@/config';
|
||||
import { NodeTypes } from '@/NodeTypes';
|
||||
import { InstalledPackages } from '@db/entities/InstalledPackages';
|
||||
import { InstalledNodes } from '@db/entities/InstalledNodes';
|
||||
import { executeCommand, loadClassInIsolation } from '@/CommunityNodes/helpers';
|
||||
import { CLI_DIR, RESPONSE_ERROR_MESSAGES } from '@/constants';
|
||||
import {
|
||||
persistInstalledPackageData,
|
||||
removePackageFromDatabase,
|
||||
} from './CommunityNodes/packageModel';
|
||||
} from '@/CommunityNodes/packageModel';
|
||||
|
||||
const CUSTOM_NODES_CATEGORY = 'Custom Nodes';
|
||||
|
||||
@ -66,8 +65,6 @@ class LoadNodesAndCredentialsClass {
|
||||
|
||||
includeNodes: string | undefined = undefined;
|
||||
|
||||
nodeModulesPath = '';
|
||||
|
||||
logger: ILogger;
|
||||
|
||||
async init() {
|
||||
@ -80,13 +77,13 @@ class LoadNodesAndCredentialsClass {
|
||||
// @ts-ignore
|
||||
module.constructor._initPaths();
|
||||
|
||||
this.nodeModulesPath = await this.getNodeModulesFolderLocation();
|
||||
const nodeModulesPath = await this.getNodeModulesFolderLocation();
|
||||
|
||||
this.excludeNodes = config.getEnv('nodes.exclude');
|
||||
this.includeNodes = config.getEnv('nodes.include');
|
||||
|
||||
// Get all the installed packages which contain n8n nodes
|
||||
const nodePackages = await this.getN8nNodePackages(this.nodeModulesPath);
|
||||
const nodePackages = await this.getN8nNodePackages(nodeModulesPath);
|
||||
|
||||
for (const packagePath of nodePackages) {
|
||||
await this.loadDataFromPackage(packagePath);
|
||||
@ -102,13 +99,13 @@ class LoadNodesAndCredentialsClass {
|
||||
// to load the credentials and nodes
|
||||
const checkPaths = [
|
||||
// In case "n8n" package is in same node_modules folder.
|
||||
path.join(__dirname, '..', '..', '..', 'n8n-workflow'),
|
||||
path.join(CLI_DIR, '..', 'n8n-workflow'),
|
||||
// In case "n8n" package is the root and the packages are
|
||||
// in the "node_modules" folder underneath it.
|
||||
path.join(__dirname, '..', '..', 'node_modules', 'n8n-workflow'),
|
||||
path.join(CLI_DIR, 'node_modules', 'n8n-workflow'),
|
||||
// In case "n8n" package is installed using npm/yarn workspaces
|
||||
// the node_modules folder is in the root of the workspace.
|
||||
path.join(__dirname, '..', '..', '..', '..', 'node_modules', 'n8n-workflow'),
|
||||
path.join(CLI_DIR, '..', '..', 'node_modules', 'n8n-workflow'),
|
||||
];
|
||||
for (const checkPath of checkPaths) {
|
||||
try {
|
||||
|
@ -10,7 +10,7 @@ import { IDataObject, ILogger, LogTypes } from 'n8n-workflow';
|
||||
|
||||
import callsites from 'callsites';
|
||||
import { basename } from 'path';
|
||||
import config from '../config';
|
||||
import config from '@/config';
|
||||
|
||||
export class Logger implements ILogger {
|
||||
private logger: winston.Logger;
|
||||
|
@ -1,5 +1,4 @@
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
/* eslint-disable import/no-cycle */
|
||||
import express, { Router } from 'express';
|
||||
import fs from 'fs/promises';
|
||||
import path from 'path';
|
||||
@ -11,9 +10,10 @@ import swaggerUi from 'swagger-ui-express';
|
||||
import validator from 'validator';
|
||||
import YAML from 'yamljs';
|
||||
|
||||
import config from '../../config';
|
||||
import { Db, InternalHooksManager } from '..';
|
||||
import { getInstanceBaseUrl } from '../UserManagement/UserManagementHelper';
|
||||
import config from '@/config';
|
||||
import * as Db from '@/Db';
|
||||
import { InternalHooksManager } from '@/InternalHooksManager';
|
||||
import { getInstanceBaseUrl } from '@/UserManagement/UserManagementHelper';
|
||||
|
||||
function createApiRouter(
|
||||
version: string,
|
||||
|
9
packages/cli/src/PublicApi/types.d.ts
vendored
9
packages/cli/src/PublicApi/types.d.ts
vendored
@ -1,14 +1,13 @@
|
||||
/* eslint-disable import/no-cycle */
|
||||
import express from 'express';
|
||||
import { IDataObject } from 'n8n-workflow';
|
||||
|
||||
import type { User } from '../databases/entities/User';
|
||||
import type { User } from '@db/entities/User';
|
||||
|
||||
import type { Role } from '../databases/entities/Role';
|
||||
import type { Role } from '@db/entities/Role';
|
||||
|
||||
import type { WorkflowEntity } from '../databases/entities/WorkflowEntity';
|
||||
import type { WorkflowEntity } from '@db/entities/WorkflowEntity';
|
||||
|
||||
import * as UserManagementMailer from '../UserManagement/email/UserManagementMailer';
|
||||
import * as UserManagementMailer from '@/UserManagement/email/UserManagementMailer';
|
||||
|
||||
export type ExecutionStatus = 'error' | 'running' | 'success' | 'waiting' | null;
|
||||
|
||||
|
@ -1,10 +1,10 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
||||
import express from 'express';
|
||||
|
||||
import { CredentialsHelper } from '../../../../CredentialsHelper';
|
||||
import { CredentialTypes } from '../../../../CredentialTypes';
|
||||
import { CredentialsEntity } from '../../../../databases/entities/CredentialsEntity';
|
||||
import { CredentialRequest } from '../../../../requests';
|
||||
import { CredentialsHelper } from '@/CredentialsHelper';
|
||||
import { CredentialTypes } from '@/CredentialTypes';
|
||||
import { CredentialsEntity } from '@db/entities/CredentialsEntity';
|
||||
import { CredentialRequest } from '@/requests';
|
||||
import { CredentialTypeRequest } from '../../../types';
|
||||
import { authorize } from '../../shared/middlewares/global.middleware';
|
||||
import { validCredentialsProperties, validCredentialType } from './credentials.middleware';
|
||||
|
@ -3,7 +3,8 @@
|
||||
import express from 'express';
|
||||
import { validate } from 'jsonschema';
|
||||
|
||||
import { CredentialsHelper, CredentialTypes } from '../../../..';
|
||||
import { CredentialsHelper } from '@/CredentialsHelper';
|
||||
import { CredentialTypes } from '@/CredentialTypes';
|
||||
import { CredentialRequest } from '../../../types';
|
||||
import { toJsonSchema } from './credentials.service';
|
||||
|
||||
|
@ -5,13 +5,14 @@
|
||||
import { FindOneOptions } from 'typeorm';
|
||||
import { UserSettings, Credentials } from 'n8n-core';
|
||||
import { IDataObject, INodeProperties, INodePropertyOptions } from 'n8n-workflow';
|
||||
import { Db, ICredentialsDb } from '../../../..';
|
||||
import { CredentialsEntity } from '../../../../databases/entities/CredentialsEntity';
|
||||
import { SharedCredentials } from '../../../../databases/entities/SharedCredentials';
|
||||
import { User } from '../../../../databases/entities/User';
|
||||
import { externalHooks } from '../../../../Server';
|
||||
import * as Db from '@/Db';
|
||||
import type { ICredentialsDb } from '@/Interfaces';
|
||||
import { CredentialsEntity } from '@db/entities/CredentialsEntity';
|
||||
import { SharedCredentials } from '@db/entities/SharedCredentials';
|
||||
import { User } from '@db/entities/User';
|
||||
import { externalHooks } from '@/Server';
|
||||
import { IDependency, IJsonSchema } from '../../../types';
|
||||
import { CredentialRequest } from '../../../../requests';
|
||||
import { CredentialRequest } from '@/requests';
|
||||
|
||||
export async function getCredentials(
|
||||
credentialId: number | string,
|
||||
|
@ -8,12 +8,12 @@ import {
|
||||
deleteExecution,
|
||||
getExecutionsCount,
|
||||
} from './executions.service';
|
||||
import { ActiveExecutions } from '../../../..';
|
||||
import * as ActiveExecutions from '@/ActiveExecutions';
|
||||
import { authorize, validCursor } from '../../shared/middlewares/global.middleware';
|
||||
import { ExecutionRequest } from '../../../types';
|
||||
import { getSharedWorkflowIds } from '../workflows/workflows.service';
|
||||
import { encodeNextCursor } from '../../shared/services/pagination.service';
|
||||
import { InternalHooksManager } from '../../../../InternalHooksManager';
|
||||
import { InternalHooksManager } from '@/InternalHooksManager';
|
||||
|
||||
export = {
|
||||
deleteExecution: [
|
||||
|
@ -1,9 +1,10 @@
|
||||
import { parse } from 'flatted';
|
||||
import { In, Not, Raw, LessThan, IsNull, FindOperator } from 'typeorm';
|
||||
|
||||
import { Db, IExecutionFlattedDb, IExecutionResponseApi } from '../../../..';
|
||||
import { ExecutionEntity } from '../../../../databases/entities/ExecutionEntity';
|
||||
import { ExecutionStatus } from '../../../types';
|
||||
import * as Db from '@/Db';
|
||||
import type { IExecutionFlattedDb, IExecutionResponseApi } from '@/Interfaces';
|
||||
import { ExecutionEntity } from '@db/entities/ExecutionEntity';
|
||||
import { ExecutionStatus } from '@/PublicApi/types';
|
||||
|
||||
function prepareExecutionData(
|
||||
execution: IExecutionFlattedDb | undefined,
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { Db } from '../../../..';
|
||||
import { Role } from '../../../../databases/entities/Role';
|
||||
import { User } from '../../../../databases/entities/User';
|
||||
import * as Db from '@/Db';
|
||||
import { Role } from '@db/entities/Role';
|
||||
import { User } from '@db/entities/User';
|
||||
|
||||
export function isInstanceOwner(user: User): boolean {
|
||||
return user.globalRole.name === 'owner';
|
||||
|
@ -2,12 +2,13 @@ import express from 'express';
|
||||
|
||||
import { FindManyOptions, In, ObjectLiteral } from 'typeorm';
|
||||
|
||||
import { ActiveWorkflowRunner, Db } from '../../../..';
|
||||
import config = require('../../../../../config');
|
||||
import { WorkflowEntity } from '../../../../databases/entities/WorkflowEntity';
|
||||
import { InternalHooksManager } from '../../../../InternalHooksManager';
|
||||
import { externalHooks } from '../../../../Server';
|
||||
import { addNodeIds, replaceInvalidCredentials } from '../../../../WorkflowHelpers';
|
||||
import * as Db from '@/Db';
|
||||
import * as ActiveWorkflowRunner from '@/ActiveWorkflowRunner';
|
||||
import config from '@/config';
|
||||
import { WorkflowEntity } from '@db/entities/WorkflowEntity';
|
||||
import { InternalHooksManager } from '@/InternalHooksManager';
|
||||
import { externalHooks } from '@/Server';
|
||||
import { addNodeIds, replaceInvalidCredentials } from '@/WorkflowHelpers';
|
||||
import { WorkflowRequest } from '../../../types';
|
||||
import { authorize, validCursor } from '../../shared/middlewares/global.middleware';
|
||||
import { encodeNextCursor } from '../../shared/services/pagination.service';
|
||||
|
@ -3,13 +3,13 @@ import intersection from 'lodash.intersection';
|
||||
import type { INode } from 'n8n-workflow';
|
||||
import { v4 as uuid } from 'uuid';
|
||||
|
||||
import { Db } from '../../../..';
|
||||
import { User } from '../../../../databases/entities/User';
|
||||
import { WorkflowEntity } from '../../../../databases/entities/WorkflowEntity';
|
||||
import { SharedWorkflow } from '../../../../databases/entities/SharedWorkflow';
|
||||
import * as Db from '@/Db';
|
||||
import { User } from '@db/entities/User';
|
||||
import { WorkflowEntity } from '@db/entities/WorkflowEntity';
|
||||
import { SharedWorkflow } from '@db/entities/SharedWorkflow';
|
||||
import { isInstanceOwner } from '../users/users.service';
|
||||
import { Role } from '../../../../databases/entities/Role';
|
||||
import config from '../../../../../config';
|
||||
import { Role } from '@db/entities/Role';
|
||||
import config from '@/config';
|
||||
|
||||
function insertIf(condition: boolean, elements: string[]): string[] {
|
||||
return condition ? elements : [];
|
||||
|
@ -3,7 +3,7 @@ import sseChannel from 'sse-channel';
|
||||
import express from 'express';
|
||||
|
||||
import { LoggerProxy as Logger } from 'n8n-workflow';
|
||||
import { IPushData, IPushDataType } from '.';
|
||||
import type { IPushData, IPushDataType } from '@/Interfaces';
|
||||
|
||||
interface SSEChannelOptions {
|
||||
cors?: {
|
||||
|
@ -1,10 +1,8 @@
|
||||
import Bull from 'bull';
|
||||
import { IExecuteResponsePromiseData } from 'n8n-workflow';
|
||||
import config from '../config';
|
||||
// eslint-disable-next-line import/no-cycle
|
||||
import * as ActiveExecutions from './ActiveExecutions';
|
||||
// eslint-disable-next-line import/no-cycle
|
||||
import * as WebhookHelpers from './WebhookHelpers';
|
||||
import config from '@/config';
|
||||
import * as ActiveExecutions from '@/ActiveExecutions';
|
||||
import * as WebhookHelpers from '@/WebhookHelpers';
|
||||
|
||||
export type Job = Bull.Job<JobData>;
|
||||
export type JobQueue = Bull.Queue<JobData>;
|
||||
|
@ -1,4 +1,3 @@
|
||||
/* eslint-disable import/no-cycle */
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable no-console */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
@ -8,14 +7,13 @@ import { Request, Response } from 'express';
|
||||
import { parse, stringify } from 'flatted';
|
||||
import { ErrorReporterProxy as ErrorReporter } from 'n8n-workflow';
|
||||
|
||||
// eslint-disable-next-line import/no-cycle
|
||||
import {
|
||||
import type {
|
||||
IExecutionDb,
|
||||
IExecutionFlatted,
|
||||
IExecutionFlattedDb,
|
||||
IExecutionResponse,
|
||||
IWorkflowDb,
|
||||
} from '.';
|
||||
} from './Interfaces';
|
||||
|
||||
/**
|
||||
* Special Error which allows to return also an error code and http status code
|
||||
|
@ -9,7 +9,6 @@
|
||||
/* eslint-disable no-return-assign */
|
||||
/* eslint-disable no-param-reassign */
|
||||
/* eslint-disable consistent-return */
|
||||
/* eslint-disable import/no-cycle */
|
||||
/* eslint-disable import/no-extraneous-dependencies */
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
||||
@ -83,20 +82,25 @@ import parseUrl from 'parseurl';
|
||||
import promClient, { Registry } from 'prom-client';
|
||||
import history from 'connect-history-api-fallback';
|
||||
import bodyParser from 'body-parser';
|
||||
import glob from 'fast-glob';
|
||||
|
||||
import config from '../config';
|
||||
import * as Queue from './Queue';
|
||||
import config from '@/config';
|
||||
import * as Queue from '@/Queue';
|
||||
import { InternalHooksManager } from '@/InternalHooksManager';
|
||||
import { getCredentialTranslationPath } from '@/TranslationHelpers';
|
||||
import { WEBHOOK_METHODS } from '@/WebhookHelpers';
|
||||
import { getSharedWorkflowIds, whereClause } from '@/WorkflowHelpers';
|
||||
|
||||
import { InternalHooksManager } from './InternalHooksManager';
|
||||
import { getCredentialTranslationPath } from './TranslationHelpers';
|
||||
import { WEBHOOK_METHODS } from './WebhookHelpers';
|
||||
import { getSharedWorkflowIds, whereClause } from './WorkflowHelpers';
|
||||
|
||||
import { nodesController } from './api/nodes.api';
|
||||
import { workflowsController } from './workflows/workflows.controller';
|
||||
import { AUTH_COOKIE_NAME, RESPONSE_ERROR_MESSAGES } from './constants';
|
||||
import { credentialsController } from './credentials/credentials.controller';
|
||||
import { oauth2CredentialController } from './credentials/oauth2Credential.api';
|
||||
import { nodesController } from '@/api/nodes.api';
|
||||
import { workflowsController } from '@/workflows/workflows.controller';
|
||||
import {
|
||||
AUTH_COOKIE_NAME,
|
||||
NODES_BASE_DIR,
|
||||
RESPONSE_ERROR_MESSAGES,
|
||||
TEMPLATES_DIR,
|
||||
} from '@/constants';
|
||||
import { credentialsController } from '@/credentials/credentials.controller';
|
||||
import { oauth2CredentialController } from '@/credentials/oauth2Credential.api';
|
||||
import type {
|
||||
CurlHelper,
|
||||
ExecutionRequest,
|
||||
@ -104,33 +108,24 @@ import type {
|
||||
NodeParameterOptionsRequest,
|
||||
OAuthRequest,
|
||||
WorkflowRequest,
|
||||
} from './requests';
|
||||
import { userManagementRouter } from './UserManagement';
|
||||
import { resolveJwt } from './UserManagement/auth/jwt';
|
||||
} from '@/requests';
|
||||
import { userManagementRouter } from '@/UserManagement';
|
||||
import { resolveJwt } from '@/UserManagement/auth/jwt';
|
||||
|
||||
import { executionsController } from './api/executions.api';
|
||||
import { nodeTypesController } from './api/nodeTypes.api';
|
||||
import { tagsController } from './api/tags.api';
|
||||
import { loadPublicApiVersions } from './PublicApi';
|
||||
import * as telemetryScripts from './telemetry/scripts';
|
||||
import { executionsController } from '@/api/executions.api';
|
||||
import { nodeTypesController } from '@/api/nodeTypes.api';
|
||||
import { tagsController } from '@/api/tags.api';
|
||||
import { loadPublicApiVersions } from '@/PublicApi';
|
||||
import * as telemetryScripts from '@/telemetry/scripts';
|
||||
import {
|
||||
getInstanceBaseUrl,
|
||||
isEmailSetUp,
|
||||
isSharingEnabled,
|
||||
isUserManagementEnabled,
|
||||
} from './UserManagement/UserManagementHelper';
|
||||
} from '@/UserManagement/UserManagementHelper';
|
||||
import * as Db from '@/Db';
|
||||
import {
|
||||
ActiveExecutions,
|
||||
ActiveWorkflowRunner,
|
||||
CredentialsHelper,
|
||||
CredentialsOverwrites,
|
||||
CredentialTypes,
|
||||
DatabaseType,
|
||||
Db,
|
||||
ExternalHooks,
|
||||
GenericHelpers,
|
||||
getCredentialForUser,
|
||||
getCredentialWithoutUser,
|
||||
ICredentialsDb,
|
||||
ICredentialsOverwrite,
|
||||
ICustomRequest,
|
||||
@ -141,21 +136,29 @@ import {
|
||||
IExternalHooksClass,
|
||||
IN8nUISettings,
|
||||
IPackageVersions,
|
||||
NodeTypes,
|
||||
Push,
|
||||
ResponseHelper,
|
||||
TestWebhooks,
|
||||
WaitTracker,
|
||||
WaitTrackerClass,
|
||||
WebhookHelpers,
|
||||
WebhookServer,
|
||||
WorkflowExecuteAdditionalData,
|
||||
} from '.';
|
||||
import glob from 'fast-glob';
|
||||
import { ResponseError } from './ResponseHelper';
|
||||
|
||||
import { toHttpNodeParameters } from './CurlConverterHelper';
|
||||
import { setupErrorMiddleware } from './ErrorReporting';
|
||||
} from '@/Interfaces';
|
||||
import * as ActiveExecutions from '@/ActiveExecutions';
|
||||
import * as ActiveWorkflowRunner from '@/ActiveWorkflowRunner';
|
||||
import {
|
||||
CredentialsHelper,
|
||||
getCredentialForUser,
|
||||
getCredentialWithoutUser,
|
||||
} from '@/CredentialsHelper';
|
||||
import { CredentialsOverwrites } from '@/CredentialsOverwrites';
|
||||
import { CredentialTypes } from '@/CredentialTypes';
|
||||
import { ExternalHooks } from '@/ExternalHooks';
|
||||
import * as GenericHelpers from '@/GenericHelpers';
|
||||
import { NodeTypes } from '@/NodeTypes';
|
||||
import * as Push from '@/Push';
|
||||
import * as ResponseHelper from '@/ResponseHelper';
|
||||
import * as TestWebhooks from '@/TestWebhooks';
|
||||
import { WaitTracker, WaitTrackerClass } from '@/WaitTracker';
|
||||
import * as WebhookHelpers from '@/WebhookHelpers';
|
||||
import * as WebhookServer from '@/WebhookServer';
|
||||
import * as WorkflowExecuteAdditionalData from '@/WorkflowExecuteAdditionalData';
|
||||
import { ResponseError } from '@/ResponseHelper';
|
||||
import { toHttpNodeParameters } from '@/CurlConverterHelper';
|
||||
import { setupErrorMiddleware } from '@/ErrorReporting';
|
||||
|
||||
require('body-parser-xml')(bodyParser);
|
||||
|
||||
@ -955,13 +958,11 @@ class App {
|
||||
);
|
||||
|
||||
// Returns node information based on node names and versions
|
||||
const headersPath = pathJoin(NODES_BASE_DIR, 'dist', 'nodes', 'headers');
|
||||
this.app.get(
|
||||
`/${this.restEndpoint}/node-translation-headers`,
|
||||
ResponseHelper.send(
|
||||
async (req: express.Request, res: express.Response): Promise<object | void> => {
|
||||
const packagesPath = pathJoin(__dirname, '..', '..', '..');
|
||||
const headersPath = pathJoin(packagesPath, 'nodes-base', 'dist', 'nodes', 'headers');
|
||||
|
||||
try {
|
||||
await fsAccess(`${headersPath}.js`);
|
||||
} catch (_) {
|
||||
@ -1395,7 +1396,7 @@ class App {
|
||||
userId: req.user?.id,
|
||||
credentialId,
|
||||
});
|
||||
res.sendFile(pathResolve(__dirname, '../../templates/oauth-callback.html'));
|
||||
res.sendFile(pathResolve(TEMPLATES_DIR, 'oauth-callback.html'));
|
||||
} catch (error) {
|
||||
LoggerProxy.error('OAuth1 callback failed because of insufficient user permissions', {
|
||||
userId: req.user?.id,
|
||||
|
@ -1,11 +1,10 @@
|
||||
/* eslint-disable no-param-reassign */
|
||||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
||||
/* eslint-disable import/no-cycle */
|
||||
import { EntityManager, getConnection } from 'typeorm';
|
||||
|
||||
import { TagEntity } from './databases/entities/TagEntity';
|
||||
import { TagEntity } from '@db/entities/TagEntity';
|
||||
|
||||
import { ITagToImport, ITagWithCountDb, IWorkflowToImport } from './Interfaces';
|
||||
import { ITagToImport, ITagWithCountDb, IWorkflowToImport } from '@/Interfaces';
|
||||
|
||||
// ----------------------------------
|
||||
// utils
|
||||
|
@ -13,8 +13,10 @@ import {
|
||||
WorkflowActivateMode,
|
||||
WorkflowExecuteMode,
|
||||
} from 'n8n-workflow';
|
||||
// eslint-disable-next-line import/no-cycle
|
||||
import { IResponseCallbackData, IWorkflowDb, Push, ResponseHelper, WebhookHelpers } from '.';
|
||||
import { IResponseCallbackData, IWorkflowDb } from '@/Interfaces';
|
||||
import * as Push from '@/Push';
|
||||
import * as ResponseHelper from '@/ResponseHelper';
|
||||
import * as WebhookHelpers from '@/WebhookHelpers';
|
||||
|
||||
const WEBHOOK_TEST_UNREGISTERED_HINT = `Click the 'Execute workflow' button on the canvas, then try again. (In test mode, the webhook only works for one call after you click this button)`;
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
import { join, dirname } from 'path';
|
||||
import { readdir } from 'fs/promises';
|
||||
import { Dirent } from 'fs';
|
||||
import { NODES_BASE_DIR } from '@/constants';
|
||||
|
||||
const ALLOWED_VERSIONED_DIRNAME_LENGTH = [2, 3]; // e.g. v1, v10
|
||||
|
||||
@ -57,8 +58,7 @@ export function getCredentialTranslationPath({
|
||||
locale: string;
|
||||
credentialType: string;
|
||||
}): string {
|
||||
const packagesPath = join(__dirname, '..', '..', '..');
|
||||
const credsPath = join(packagesPath, 'nodes-base', 'dist', 'credentials');
|
||||
const credsPath = join(NODES_BASE_DIR, 'dist', 'credentials');
|
||||
|
||||
return join(credsPath, 'translations', locale, `${credentialType}.json`);
|
||||
}
|
||||
|
@ -1,8 +1,7 @@
|
||||
/* eslint-disable import/no-cycle */
|
||||
import { Application } from 'express';
|
||||
import { JwtFromRequestFunction } from 'passport-jwt';
|
||||
import { ActiveWorkflowRunner } from '..';
|
||||
import type { IExternalHooksClass, IPersonalizationSurveyAnswers } from '../Interfaces';
|
||||
import type { ActiveWorkflowRunner } from '@/ActiveWorkflowRunner';
|
||||
import type { IExternalHooksClass, IPersonalizationSurveyAnswers } from '@/Interfaces';
|
||||
|
||||
export interface JwtToken {
|
||||
token: string;
|
||||
@ -37,5 +36,5 @@ export interface N8nApp {
|
||||
restEndpoint: string;
|
||||
externalHooks: IExternalHooksClass;
|
||||
defaultCredentialsName: string;
|
||||
activeWorkflowRunner: ActiveWorkflowRunner.ActiveWorkflowRunner;
|
||||
activeWorkflowRunner: ActiveWorkflowRunner;
|
||||
}
|
||||
|
@ -1,17 +1,17 @@
|
||||
/* eslint-disable @typescript-eslint/no-unused-vars */
|
||||
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
||||
/* eslint-disable import/no-cycle */
|
||||
import { INode, NodeOperationError, Workflow } from 'n8n-workflow';
|
||||
import { In } from 'typeorm';
|
||||
import express from 'express';
|
||||
import { compare, genSaltSync, hash } from 'bcryptjs';
|
||||
|
||||
import * as Db from '@/Db';
|
||||
import * as ResponseHelper from '@/ResponseHelper';
|
||||
import { PublicUser } from './Interfaces';
|
||||
import { Db, ResponseHelper } from '..';
|
||||
import { MAX_PASSWORD_LENGTH, MIN_PASSWORD_LENGTH, User } from '../databases/entities/User';
|
||||
import { Role } from '../databases/entities/Role';
|
||||
import { AuthenticatedRequest } from '../requests';
|
||||
import * as config from '../../config';
|
||||
import { MAX_PASSWORD_LENGTH, MIN_PASSWORD_LENGTH, User } from '@db/entities/User';
|
||||
import { Role } from '@db/entities/Role';
|
||||
import { AuthenticatedRequest } from '@/requests';
|
||||
import config from '@/config';
|
||||
import { getWebhookBaseUrl } from '../WebhookHelpers';
|
||||
|
||||
export async function getWorkflowOwner(workflowId: string | number): Promise<User> {
|
||||
|
@ -1,14 +1,13 @@
|
||||
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
||||
/* eslint-disable import/no-cycle */
|
||||
|
||||
import jwt from 'jsonwebtoken';
|
||||
import { Response } from 'express';
|
||||
import { createHash } from 'crypto';
|
||||
import { Db } from '../..';
|
||||
import { AUTH_COOKIE_NAME } from '../../constants';
|
||||
import * as Db from '@/Db';
|
||||
import { AUTH_COOKIE_NAME } from '@/constants';
|
||||
import { JwtPayload, JwtToken } from '../Interfaces';
|
||||
import { User } from '../../databases/entities/User';
|
||||
import * as config from '../../../config';
|
||||
import { User } from '@db/entities/User';
|
||||
import config from '@/config';
|
||||
|
||||
export function issueJWT(user: User): JwtToken {
|
||||
const { id, email, password } = user;
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
import { createTransport, Transporter } from 'nodemailer';
|
||||
import { ErrorReporterProxy as ErrorReporter, LoggerProxy as Logger } from 'n8n-workflow';
|
||||
import * as config from '../../../config';
|
||||
import * as config from '@/config';
|
||||
import { MailData, SendEmailResult, UserManagementMailerImplementation } from './Interfaces';
|
||||
|
||||
export class NodeMailer implements UserManagementMailerImplementation {
|
||||
|
@ -2,9 +2,8 @@ import { existsSync } from 'fs';
|
||||
import { readFile } from 'fs/promises';
|
||||
import Handlebars from 'handlebars';
|
||||
import { join as pathJoin } from 'path';
|
||||
// eslint-disable-next-line import/no-cycle
|
||||
import { GenericHelpers } from '../..';
|
||||
import * as config from '../../../config';
|
||||
import * as GenericHelpers from '@/GenericHelpers';
|
||||
import config from '@/config';
|
||||
import {
|
||||
InviteEmailData,
|
||||
PasswordResetData,
|
||||
|
@ -1,4 +1,3 @@
|
||||
/* eslint-disable import/no-cycle */
|
||||
import { getInstance, UserManagementMailer } from './UserManagementMailer';
|
||||
|
||||
export { getInstance, UserManagementMailer };
|
||||
|
@ -1,4 +1,3 @@
|
||||
/* eslint-disable import/no-cycle */
|
||||
import { addRoutes } from './routes';
|
||||
|
||||
export const userManagementRouter = { addRoutes };
|
||||
|
@ -1,13 +1,12 @@
|
||||
/* eslint-disable import/no-cycle */
|
||||
import { Request, RequestHandler } from 'express';
|
||||
import jwt from 'jsonwebtoken';
|
||||
import passport from 'passport';
|
||||
import { Strategy } from 'passport-jwt';
|
||||
import { LoggerProxy as Logger } from 'n8n-workflow';
|
||||
import { JwtPayload } from '../Interfaces';
|
||||
import type { AuthenticatedRequest } from '../../requests';
|
||||
import * as config from '../../../config';
|
||||
import { AUTH_COOKIE_NAME } from '../../constants';
|
||||
import type { AuthenticatedRequest } from '@/requests';
|
||||
import config from '@/config';
|
||||
import { AUTH_COOKIE_NAME } from '@/constants';
|
||||
import { issueCookie, resolveJwtContent } from '../auth/jwt';
|
||||
|
||||
const jwtFromRequest = (req: Request) => {
|
||||
|
@ -1,2 +1 @@
|
||||
/* eslint-disable import/no-cycle */
|
||||
export * from './auth';
|
||||
|
@ -1,16 +1,16 @@
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
/* eslint-disable import/no-cycle */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
import { Request, Response } from 'express';
|
||||
import { IDataObject } from 'n8n-workflow';
|
||||
import { Db, ResponseHelper } from '../..';
|
||||
import { AUTH_COOKIE_NAME } from '../../constants';
|
||||
import * as Db from '@/Db';
|
||||
import * as ResponseHelper from '@/ResponseHelper';
|
||||
import { AUTH_COOKIE_NAME } from '@/constants';
|
||||
import { issueCookie, resolveJwt } from '../auth/jwt';
|
||||
import { N8nApp, PublicUser } from '../Interfaces';
|
||||
import { compareHash, sanitizeUser } from '../UserManagementHelper';
|
||||
import { User } from '../../databases/entities/User';
|
||||
import type { LoginRequest } from '../../requests';
|
||||
import config = require('../../../config');
|
||||
import { User } from '@db/entities/User';
|
||||
import type { LoginRequest } from '@/requests';
|
||||
import config from '@/config';
|
||||
|
||||
export function authenticationMethods(this: N8nApp): void {
|
||||
/**
|
||||
|
@ -1,20 +1,19 @@
|
||||
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
||||
/* eslint-disable import/no-cycle */
|
||||
import cookieParser from 'cookie-parser';
|
||||
import passport from 'passport';
|
||||
import { NextFunction, Request, Response } from 'express';
|
||||
import { LoggerProxy as Logger } from 'n8n-workflow';
|
||||
import { N8nApp } from '../Interfaces';
|
||||
import { AuthenticatedRequest } from '../../requests';
|
||||
import { AuthenticatedRequest } from '@/requests';
|
||||
import {
|
||||
isAuthExcluded,
|
||||
isPostUsersId,
|
||||
isAuthenticatedRequest,
|
||||
isUserManagementDisabled,
|
||||
} from '../UserManagementHelper';
|
||||
import { Db } from '../..';
|
||||
import * as Db from '@/Db';
|
||||
import { jwtAuth, refreshExpiringCookie } from '../middlewares';
|
||||
import { authenticationMethods } from './auth';
|
||||
import { meNamespace } from './me';
|
||||
|
@ -1,18 +1,19 @@
|
||||
/* eslint-disable @typescript-eslint/no-unused-vars */
|
||||
/* eslint-disable import/no-cycle */
|
||||
|
||||
import express from 'express';
|
||||
import validator from 'validator';
|
||||
import { randomBytes } from 'crypto';
|
||||
import { LoggerProxy as Logger } from 'n8n-workflow';
|
||||
|
||||
import { randomBytes } from 'crypto';
|
||||
import { Db, InternalHooksManager, ResponseHelper } from '../..';
|
||||
import * as Db from '@/Db';
|
||||
import * as ResponseHelper from '@/ResponseHelper';
|
||||
import { InternalHooksManager } from '@/InternalHooksManager';
|
||||
import { issueCookie } from '../auth/jwt';
|
||||
import { N8nApp, PublicUser } from '../Interfaces';
|
||||
import { validatePassword, sanitizeUser, compareHash, hashPassword } from '../UserManagementHelper';
|
||||
import type { AuthenticatedRequest, MeRequest } from '../../requests';
|
||||
import { validateEntity } from '../../GenericHelpers';
|
||||
import { User } from '../../databases/entities/User';
|
||||
import type { AuthenticatedRequest, MeRequest } from '@/requests';
|
||||
import { validateEntity } from '@/GenericHelpers';
|
||||
import { User } from '@db/entities/User';
|
||||
|
||||
export function meNamespace(this: N8nApp): void {
|
||||
/**
|
||||
|
@ -1,13 +1,14 @@
|
||||
/* eslint-disable import/no-cycle */
|
||||
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
||||
import express from 'express';
|
||||
import validator from 'validator';
|
||||
import { LoggerProxy as Logger } from 'n8n-workflow';
|
||||
|
||||
import { Db, InternalHooksManager, ResponseHelper } from '../..';
|
||||
import * as config from '../../../config';
|
||||
import { validateEntity } from '../../GenericHelpers';
|
||||
import { AuthenticatedRequest, OwnerRequest } from '../../requests';
|
||||
import * as Db from '@/Db';
|
||||
import * as ResponseHelper from '@/ResponseHelper';
|
||||
import { InternalHooksManager } from '@/InternalHooksManager';
|
||||
import config from '@/config';
|
||||
import { validateEntity } from '@/GenericHelpers';
|
||||
import { AuthenticatedRequest, OwnerRequest } from '@/requests';
|
||||
import { issueCookie } from '../auth/jwt';
|
||||
import { N8nApp } from '../Interfaces';
|
||||
import { hashPassword, sanitizeUser, validatePassword } from '../UserManagementHelper';
|
||||
|
@ -1,5 +1,4 @@
|
||||
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
||||
/* eslint-disable import/no-cycle */
|
||||
|
||||
import express from 'express';
|
||||
import { v4 as uuid } from 'uuid';
|
||||
@ -8,13 +7,15 @@ import validator from 'validator';
|
||||
import { IsNull, MoreThanOrEqual, Not } from 'typeorm';
|
||||
import { LoggerProxy as Logger } from 'n8n-workflow';
|
||||
|
||||
import { Db, InternalHooksManager, ResponseHelper } from '../..';
|
||||
import * as Db from '@/Db';
|
||||
import * as ResponseHelper from '@/ResponseHelper';
|
||||
import { InternalHooksManager } from '@/InternalHooksManager';
|
||||
import { N8nApp } from '../Interfaces';
|
||||
import { getInstanceBaseUrl, hashPassword, validatePassword } from '../UserManagementHelper';
|
||||
import * as UserManagementMailer from '../email';
|
||||
import type { PasswordResetRequest } from '../../requests';
|
||||
import { issueCookie } from '../auth/jwt';
|
||||
import * as config from '../../../config';
|
||||
import config from '@/config';
|
||||
|
||||
export function passwordResetNamespace(this: N8nApp): void {
|
||||
/**
|
||||
|
@ -1,15 +1,16 @@
|
||||
/* eslint-disable no-restricted-syntax */
|
||||
/* eslint-disable import/no-cycle */
|
||||
import { Response } from 'express';
|
||||
import { ErrorReporterProxy as ErrorReporter, LoggerProxy as Logger } from 'n8n-workflow';
|
||||
import { In } from 'typeorm';
|
||||
import validator from 'validator';
|
||||
|
||||
import { Db, InternalHooksManager, ITelemetryUserDeletionData, ResponseHelper } from '../..';
|
||||
import { SharedCredentials } from '../../databases/entities/SharedCredentials';
|
||||
import { SharedWorkflow } from '../../databases/entities/SharedWorkflow';
|
||||
import { User } from '../../databases/entities/User';
|
||||
import { UserRequest } from '../../requests';
|
||||
import * as Db from '@/Db';
|
||||
import * as ResponseHelper from '@/ResponseHelper';
|
||||
import { ITelemetryUserDeletionData } from '@/Interfaces';
|
||||
import { SharedCredentials } from '@db/entities/SharedCredentials';
|
||||
import { SharedWorkflow } from '@db/entities/SharedWorkflow';
|
||||
import { User } from '@db/entities/User';
|
||||
import { UserRequest } from '@/requests';
|
||||
import * as UserManagementMailer from '../email/UserManagementMailer';
|
||||
import { N8nApp, PublicUser } from '../Interfaces';
|
||||
import {
|
||||
@ -21,8 +22,9 @@ import {
|
||||
validatePassword,
|
||||
} from '../UserManagementHelper';
|
||||
|
||||
import * as config from '../../../config';
|
||||
import config from '@/config';
|
||||
import { issueCookie } from '../auth/jwt';
|
||||
import { InternalHooksManager } from '@/InternalHooksManager';
|
||||
|
||||
export function usersNamespace(this: N8nApp): void {
|
||||
/**
|
||||
|
@ -1,4 +1,3 @@
|
||||
/* eslint-disable import/no-cycle */
|
||||
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
||||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
@ -12,20 +11,20 @@ import {
|
||||
WorkflowOperationError,
|
||||
} from 'n8n-workflow';
|
||||
import { FindManyOptions, LessThanOrEqual, ObjectLiteral } from 'typeorm';
|
||||
|
||||
import { DateUtils } from 'typeorm/util/DateUtils';
|
||||
|
||||
import * as Db from '@/Db';
|
||||
import * as ResponseHelper from '@/ResponseHelper';
|
||||
import * as GenericHelpers from '@/GenericHelpers';
|
||||
import * as ActiveExecutions from '@/ActiveExecutions';
|
||||
import {
|
||||
ActiveExecutions,
|
||||
DatabaseType,
|
||||
Db,
|
||||
GenericHelpers,
|
||||
IExecutionFlattedDb,
|
||||
IExecutionsStopData,
|
||||
IWorkflowExecutionDataProcess,
|
||||
ResponseHelper,
|
||||
WorkflowRunner,
|
||||
} from '.';
|
||||
import { getWorkflowOwner } from './UserManagement/UserManagementHelper';
|
||||
} from '@/Interfaces';
|
||||
import { WorkflowRunner } from '@/WorkflowRunner';
|
||||
import { getWorkflowOwner } from '@/UserManagement/UserManagementHelper';
|
||||
|
||||
export class WaitTrackerClass {
|
||||
activeExecutionsInstance: ActiveExecutions.ActiveExecutions;
|
||||
|
@ -1,11 +1,8 @@
|
||||
/* eslint-disable import/no-cycle */
|
||||
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
/* eslint-disable no-param-reassign */
|
||||
import {
|
||||
INode,
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
IRunExecutionData,
|
||||
NodeHelpers,
|
||||
WebhookHttpMethod,
|
||||
Workflow,
|
||||
@ -14,19 +11,13 @@ import {
|
||||
|
||||
import express from 'express';
|
||||
|
||||
import {
|
||||
Db,
|
||||
IExecutionResponse,
|
||||
IResponseCallbackData,
|
||||
IWorkflowDb,
|
||||
NodeTypes,
|
||||
ResponseHelper,
|
||||
WebhookHelpers,
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
WorkflowCredentials,
|
||||
WorkflowExecuteAdditionalData,
|
||||
} from '.';
|
||||
import { getWorkflowOwner } from './UserManagement/UserManagementHelper';
|
||||
import * as Db from '@/Db';
|
||||
import * as ResponseHelper from '@/ResponseHelper';
|
||||
import * as WebhookHelpers from '@/WebhookHelpers';
|
||||
import { NodeTypes } from '@/NodeTypes';
|
||||
import { IExecutionResponse, IResponseCallbackData, IWorkflowDb } from '@/Interfaces';
|
||||
import * as WorkflowExecuteAdditionalData from '@/WorkflowExecuteAdditionalData';
|
||||
import { getWorkflowOwner } from '@/UserManagement/UserManagementHelper';
|
||||
|
||||
export class WaitingWebhooks {
|
||||
async executeWebhook(
|
||||
|
@ -1,5 +1,4 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
||||
/* eslint-disable import/no-cycle */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable no-param-reassign */
|
||||
/* eslint-disable @typescript-eslint/prefer-optional-chain */
|
||||
@ -41,26 +40,21 @@ import {
|
||||
WorkflowExecuteMode,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
// eslint-disable-next-line import/no-cycle
|
||||
import {
|
||||
GenericHelpers,
|
||||
IExecutionDb,
|
||||
IResponseCallbackData,
|
||||
IWorkflowDb,
|
||||
IWorkflowExecutionDataProcess,
|
||||
ResponseHelper,
|
||||
WorkflowExecuteAdditionalData,
|
||||
WorkflowHelpers,
|
||||
WorkflowRunner,
|
||||
} from '.';
|
||||
|
||||
// eslint-disable-next-line import/no-cycle
|
||||
import * as ActiveExecutions from './ActiveExecutions';
|
||||
import { User } from './databases/entities/User';
|
||||
import { WorkflowEntity } from './databases/entities/WorkflowEntity';
|
||||
import { getWorkflowOwner } from './UserManagement/UserManagementHelper';
|
||||
|
||||
const activeExecutions = ActiveExecutions.getInstance();
|
||||
} from '@/Interfaces';
|
||||
import * as GenericHelpers from '@/GenericHelpers';
|
||||
import * as ResponseHelper from '@/ResponseHelper';
|
||||
import * as WorkflowHelpers from '@/WorkflowHelpers';
|
||||
import { WorkflowRunner } from '@/WorkflowRunner';
|
||||
import * as WorkflowExecuteAdditionalData from '@/WorkflowExecuteAdditionalData';
|
||||
import * as ActiveExecutions from '@/ActiveExecutions';
|
||||
import { User } from '@db/entities/User';
|
||||
import { WorkflowEntity } from '@db/entities/WorkflowEntity';
|
||||
import { getWorkflowOwner } from '@/UserManagement/UserManagementHelper';
|
||||
|
||||
export const WEBHOOK_METHODS = ['DELETE', 'GET', 'HEAD', 'PATCH', 'POST', 'PUT'];
|
||||
|
||||
@ -459,9 +453,9 @@ export async function executeWebhook(
|
||||
);
|
||||
|
||||
// Get a promise which resolves when the workflow did execute and send then response
|
||||
const executePromise = activeExecutions.getPostExecutePromise(executionId) as Promise<
|
||||
IExecutionDb | undefined
|
||||
>;
|
||||
const executePromise = ActiveExecutions.getInstance().getPostExecutePromise(
|
||||
executionId,
|
||||
) as Promise<IExecutionDb | undefined>;
|
||||
executePromise
|
||||
.then(async (data) => {
|
||||
if (data === undefined) {
|
||||
|
@ -16,24 +16,18 @@ import compression from 'compression';
|
||||
// eslint-disable-next-line import/no-extraneous-dependencies
|
||||
import parseUrl from 'parseurl';
|
||||
import { WebhookHttpMethod } from 'n8n-workflow';
|
||||
// eslint-disable-next-line import/no-cycle
|
||||
import {
|
||||
ActiveExecutions,
|
||||
ActiveWorkflowRunner,
|
||||
Db,
|
||||
ExternalHooks,
|
||||
GenericHelpers,
|
||||
ICustomRequest,
|
||||
IExternalHooksClass,
|
||||
IPackageVersions,
|
||||
ResponseHelper,
|
||||
WaitingWebhooks,
|
||||
} from '.';
|
||||
|
||||
import config from '../config';
|
||||
// eslint-disable-next-line import/no-cycle
|
||||
import { WEBHOOK_METHODS } from './WebhookHelpers';
|
||||
import { setupErrorMiddleware } from './ErrorReporting';
|
||||
import * as Db from '@/Db';
|
||||
import * as ActiveExecutions from '@/ActiveExecutions';
|
||||
import * as ActiveWorkflowRunner from '@/ActiveWorkflowRunner';
|
||||
import { ExternalHooks } from '@/ExternalHooks';
|
||||
import * as GenericHelpers from '@/GenericHelpers';
|
||||
import * as ResponseHelper from '@/ResponseHelper';
|
||||
import { WaitingWebhooks } from '@/WaitingWebhooks';
|
||||
import type { ICustomRequest, IExternalHooksClass, IPackageVersions } from '@/Interfaces';
|
||||
import config from '@/config';
|
||||
import { WEBHOOK_METHODS } from '@/WebhookHelpers';
|
||||
import { setupErrorMiddleware } from '@/ErrorReporting';
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-var-requires, @typescript-eslint/no-unsafe-call
|
||||
require('body-parser-xml')(bodyParser);
|
||||
|
@ -1,7 +1,6 @@
|
||||
/* eslint-disable no-prototype-builtins */
|
||||
import { INode, IWorkflowCredentials } from 'n8n-workflow';
|
||||
// eslint-disable-next-line import/no-cycle
|
||||
import { Db } from '.';
|
||||
import * as Db from '@/Db';
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
export async function WorkflowCredentials(nodes: INode[]): Promise<IWorkflowCredentials> {
|
||||
|
@ -1,5 +1,4 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-argument */
|
||||
/* eslint-disable import/no-cycle */
|
||||
/* eslint-disable no-restricted-syntax */
|
||||
/* eslint-disable @typescript-eslint/restrict-plus-operands */
|
||||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
||||
@ -42,34 +41,33 @@ import {
|
||||
|
||||
import { LessThanOrEqual } from 'typeorm';
|
||||
import { DateUtils } from 'typeorm/util/DateUtils';
|
||||
import config from '../config';
|
||||
import config from '@/config';
|
||||
import * as Db from '@/Db';
|
||||
import * as ActiveExecutions from '@/ActiveExecutions';
|
||||
import { CredentialsHelper } from '@/CredentialsHelper';
|
||||
import { ExternalHooks } from '@/ExternalHooks';
|
||||
import {
|
||||
ActiveExecutions,
|
||||
CredentialsHelper,
|
||||
Db,
|
||||
ExternalHooks,
|
||||
IExecutionDb,
|
||||
IExecutionFlattedDb,
|
||||
IExecutionResponse,
|
||||
InternalHooksManager,
|
||||
IPushDataExecutionFinished,
|
||||
IWorkflowBase,
|
||||
IWorkflowExecuteProcess,
|
||||
IWorkflowExecutionDataProcess,
|
||||
NodeTypes,
|
||||
Push,
|
||||
ResponseHelper,
|
||||
WebhookHelpers,
|
||||
WorkflowHelpers,
|
||||
} from '.';
|
||||
IWorkflowErrorData,
|
||||
} from '@/Interfaces';
|
||||
import { InternalHooksManager } from '@/InternalHooksManager';
|
||||
import { NodeTypes } from '@/NodeTypes';
|
||||
import * as Push from '@/Push';
|
||||
import * as ResponseHelper from '@/ResponseHelper';
|
||||
import * as WebhookHelpers from '@/WebhookHelpers';
|
||||
import * as WorkflowHelpers from '@/WorkflowHelpers';
|
||||
import {
|
||||
checkPermissionsForExecution,
|
||||
getUserById,
|
||||
getWorkflowOwner,
|
||||
} from './UserManagement/UserManagementHelper';
|
||||
import { whereClause } from './WorkflowHelpers';
|
||||
import { IWorkflowErrorData } from './Interfaces';
|
||||
import { findSubworkflowStart } from './utils';
|
||||
} from '@/UserManagement/UserManagementHelper';
|
||||
import { findSubworkflowStart } from '@/utils';
|
||||
|
||||
const ERROR_TRIGGER_TYPE = config.getEnv('nodes.errorTriggerType');
|
||||
|
||||
@ -857,7 +855,7 @@ export async function getWorkflowData(
|
||||
|
||||
const shared = await Db.collections.SharedWorkflow.findOne({
|
||||
relations,
|
||||
where: whereClause({
|
||||
where: WorkflowHelpers.whereClause({
|
||||
user,
|
||||
entityType: 'workflow',
|
||||
entityId: workflowInfo.id,
|
||||
|
@ -1,4 +1,3 @@
|
||||
/* eslint-disable import/no-cycle */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-call */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
@ -26,25 +25,23 @@ import {
|
||||
WorkflowExecuteMode,
|
||||
} from 'n8n-workflow';
|
||||
import { v4 as uuid } from 'uuid';
|
||||
// eslint-disable-next-line import/no-cycle
|
||||
import { CredentialTypes } from '@/CredentialTypes';
|
||||
import * as Db from '@/Db';
|
||||
import {
|
||||
CredentialTypes,
|
||||
Db,
|
||||
ICredentialsDb,
|
||||
ICredentialsTypeData,
|
||||
ITransferNodeTypes,
|
||||
IWorkflowErrorData,
|
||||
IWorkflowExecutionDataProcess,
|
||||
NodeTypes,
|
||||
WhereClause,
|
||||
WorkflowRunner,
|
||||
} from '.';
|
||||
} from '@/Interfaces';
|
||||
import { NodeTypes } from '@/NodeTypes';
|
||||
import { WorkflowRunner } from '@/WorkflowRunner';
|
||||
|
||||
import config from '../config';
|
||||
// eslint-disable-next-line import/no-cycle
|
||||
import { WorkflowEntity } from './databases/entities/WorkflowEntity';
|
||||
import { User } from './databases/entities/User';
|
||||
import { getWorkflowOwner } from './UserManagement/UserManagementHelper';
|
||||
import config from '@/config';
|
||||
import { WorkflowEntity } from '@db/entities/WorkflowEntity';
|
||||
import { User } from '@db/entities/User';
|
||||
import { getWorkflowOwner } from '@/UserManagement/UserManagementHelper';
|
||||
|
||||
const ERROR_TRIGGER_TYPE = config.getEnv('nodes.errorTriggerType');
|
||||
|
||||
|
@ -10,7 +10,6 @@
|
||||
/* eslint-disable @typescript-eslint/prefer-optional-chain */
|
||||
/* eslint-disable no-param-reassign */
|
||||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
||||
/* eslint-disable import/no-cycle */
|
||||
/* eslint-disable @typescript-eslint/no-unused-vars */
|
||||
import { BinaryDataManager, IProcessMessage, WorkflowExecute } from 'n8n-core';
|
||||
|
||||
@ -32,13 +31,12 @@ import PCancelable from 'p-cancelable';
|
||||
import { join as pathJoin } from 'path';
|
||||
import { fork } from 'child_process';
|
||||
|
||||
import config from '../config';
|
||||
// eslint-disable-next-line import/no-cycle
|
||||
import * as ActiveExecutions from '@/ActiveExecutions';
|
||||
import config from '@/config';
|
||||
import { CredentialsOverwrites } from '@/CredentialsOverwrites';
|
||||
import * as Db from '@/Db';
|
||||
import { ExternalHooks } from '@/ExternalHooks';
|
||||
import {
|
||||
ActiveExecutions,
|
||||
CredentialsOverwrites,
|
||||
Db,
|
||||
ExternalHooks,
|
||||
ICredentialsOverwrite,
|
||||
ICredentialsTypeData,
|
||||
IExecutionFlattedDb,
|
||||
@ -46,18 +44,18 @@ import {
|
||||
ITransferNodeTypes,
|
||||
IWorkflowExecutionDataProcess,
|
||||
IWorkflowExecutionDataProcessWithExecution,
|
||||
NodeTypes,
|
||||
Push,
|
||||
ResponseHelper,
|
||||
WebhookHelpers,
|
||||
WorkflowExecuteAdditionalData,
|
||||
WorkflowHelpers,
|
||||
} from '.';
|
||||
import * as Queue from './Queue';
|
||||
import { InternalHooksManager } from './InternalHooksManager';
|
||||
import { checkPermissionsForExecution } from './UserManagement/UserManagementHelper';
|
||||
import { generateFailedExecutionFromError } from './WorkflowHelpers';
|
||||
import { initErrorHandling } from './ErrorReporting';
|
||||
} from '@/Interfaces';
|
||||
import { NodeTypes } from '@/NodeTypes';
|
||||
import * as Push from '@/Push';
|
||||
import * as Queue from '@/Queue';
|
||||
import * as ResponseHelper from '@/ResponseHelper';
|
||||
import * as WebhookHelpers from '@/WebhookHelpers';
|
||||
import * as WorkflowHelpers from '@/WorkflowHelpers';
|
||||
import * as WorkflowExecuteAdditionalData from '@/WorkflowExecuteAdditionalData';
|
||||
import { InternalHooksManager } from '@/InternalHooksManager';
|
||||
import { checkPermissionsForExecution } from '@/UserManagement/UserManagementHelper';
|
||||
import { generateFailedExecutionFromError } from '@/WorkflowHelpers';
|
||||
import { initErrorHandling } from '@/ErrorReporting';
|
||||
|
||||
export class WorkflowRunner {
|
||||
activeExecutions: ActiveExecutions.ActiveExecutions;
|
||||
|
@ -32,28 +32,24 @@ import {
|
||||
WorkflowHooks,
|
||||
WorkflowOperationError,
|
||||
} from 'n8n-workflow';
|
||||
import {
|
||||
CredentialsOverwrites,
|
||||
CredentialTypes,
|
||||
Db,
|
||||
ExternalHooks,
|
||||
GenericHelpers,
|
||||
IWorkflowExecuteProcess,
|
||||
IWorkflowExecutionDataProcessWithExecution,
|
||||
NodeTypes,
|
||||
WebhookHelpers,
|
||||
WorkflowExecuteAdditionalData,
|
||||
WorkflowHelpers,
|
||||
} from '.';
|
||||
import { CredentialTypes } from '@/CredentialTypes';
|
||||
import { CredentialsOverwrites } from '@/CredentialsOverwrites';
|
||||
import * as Db from '@/Db';
|
||||
import { ExternalHooks } from '@/ExternalHooks';
|
||||
import * as GenericHelpers from '@/GenericHelpers';
|
||||
import { IWorkflowExecuteProcess, IWorkflowExecutionDataProcessWithExecution } from '@/Interfaces';
|
||||
import { NodeTypes } from '@/NodeTypes';
|
||||
import * as WebhookHelpers from '@/WebhookHelpers';
|
||||
import * as WorkflowHelpers from '@/WorkflowHelpers';
|
||||
import * as WorkflowExecuteAdditionalData from '@/WorkflowExecuteAdditionalData';
|
||||
import { getLogger } from '@/Logger';
|
||||
|
||||
import { getLogger } from './Logger';
|
||||
|
||||
import config from '../config';
|
||||
import { InternalHooksManager } from './InternalHooksManager';
|
||||
import { checkPermissionsForExecution } from './UserManagement/UserManagementHelper';
|
||||
import { loadClassInIsolation } from './CommunityNodes/helpers';
|
||||
import { generateFailedExecutionFromError } from './WorkflowHelpers';
|
||||
import { initErrorHandling } from './ErrorReporting';
|
||||
import config from '@/config';
|
||||
import { InternalHooksManager } from '@/InternalHooksManager';
|
||||
import { checkPermissionsForExecution } from '@/UserManagement/UserManagementHelper';
|
||||
import { loadClassInIsolation } from '@/CommunityNodes/helpers';
|
||||
import { generateFailedExecutionFromError } from '@/WorkflowHelpers';
|
||||
import { initErrorHandling } from '@/ErrorReporting';
|
||||
|
||||
export class WorkflowRunnerProcess {
|
||||
data: IWorkflowExecutionDataProcessWithExecution | undefined;
|
||||
|
@ -1,6 +1,5 @@
|
||||
/* eslint-disable no-restricted-syntax */
|
||||
/* eslint-disable import/no-extraneous-dependencies */
|
||||
/* eslint-disable import/no-cycle */
|
||||
/* eslint-disable @typescript-eslint/restrict-template-expressions */
|
||||
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
@ -22,26 +21,26 @@ import {
|
||||
} from 'n8n-workflow';
|
||||
import { FindOperator, In, IsNull, LessThanOrEqual, Not, Raw } from 'typeorm';
|
||||
|
||||
import * as ActiveExecutions from '@/ActiveExecutions';
|
||||
import * as Db from '@/Db';
|
||||
import * as GenericHelpers from '@/GenericHelpers';
|
||||
import {
|
||||
ActiveExecutions,
|
||||
DatabaseType,
|
||||
Db,
|
||||
GenericHelpers,
|
||||
IExecutionFlattedResponse,
|
||||
IExecutionResponse,
|
||||
IExecutionsListResponse,
|
||||
IWorkflowExecutionDataProcess,
|
||||
NodeTypes,
|
||||
WorkflowRunner,
|
||||
ResponseHelper,
|
||||
} from '..';
|
||||
import * as config from '../../config';
|
||||
import { User } from '../databases/entities/User';
|
||||
import { DEFAULT_EXECUTIONS_GET_ALL_LIMIT } from '../GenericHelpers';
|
||||
import { getLogger } from '../Logger';
|
||||
import * as Queue from '../Queue';
|
||||
import type { ExecutionRequest } from '../requests';
|
||||
import { getSharedWorkflowIds } from '../WorkflowHelpers';
|
||||
} from '@/Interfaces';
|
||||
import { NodeTypes } from '@/NodeTypes';
|
||||
import * as ResponseHelper from '@/ResponseHelper';
|
||||
import { WorkflowRunner } from '@/WorkflowRunner';
|
||||
import config from '@/config';
|
||||
import { User } from '@db/entities/User';
|
||||
import { DEFAULT_EXECUTIONS_GET_ALL_LIMIT } from '@/GenericHelpers';
|
||||
import { getLogger } from '@/Logger';
|
||||
import * as Queue from '@/Queue';
|
||||
import type { ExecutionRequest } from '@/requests';
|
||||
import { getSharedWorkflowIds } from '@/WorkflowHelpers';
|
||||
|
||||
export const executionsController = express.Router();
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
/* eslint-disable import/no-extraneous-dependencies */
|
||||
/* eslint-disable import/no-cycle */
|
||||
import express from 'express';
|
||||
import { readFile } from 'fs/promises';
|
||||
import _ from 'lodash';
|
||||
@ -12,9 +11,11 @@ import {
|
||||
NodeHelpers,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
import { CredentialTypes, NodeTypes, ResponseHelper } from '..';
|
||||
import config from '../../config';
|
||||
import { getNodeTranslationPath } from '../TranslationHelpers';
|
||||
import { CredentialTypes } from '@/CredentialTypes';
|
||||
import config from '@/config';
|
||||
import { NodeTypes } from '@/NodeTypes';
|
||||
import * as ResponseHelper from '@/ResponseHelper';
|
||||
import { getNodeTranslationPath } from '@/TranslationHelpers';
|
||||
|
||||
function isOAuth(credType: ICredentialType) {
|
||||
return (
|
||||
|
@ -1,9 +1,11 @@
|
||||
/* eslint-disable import/no-cycle */
|
||||
import express from 'express';
|
||||
import { PublicInstalledPackage } from 'n8n-workflow';
|
||||
|
||||
import { InternalHooksManager, LoadNodesAndCredentials, Push, ResponseHelper } from '..';
|
||||
import config from '../../config';
|
||||
import config from '@/config';
|
||||
import { InternalHooksManager } from '@/InternalHooksManager';
|
||||
import { LoadNodesAndCredentials } from '@/LoadNodesAndCredentials';
|
||||
import * as Push from '@/Push';
|
||||
import * as ResponseHelper from '@/ResponseHelper';
|
||||
|
||||
import {
|
||||
checkNpmPackageStatus,
|
||||
@ -16,22 +18,22 @@ import {
|
||||
parseNpmPackageName,
|
||||
removePackageFromMissingList,
|
||||
sanitizeNpmPackageName,
|
||||
} from '../CommunityNodes/helpers';
|
||||
} from '@/CommunityNodes/helpers';
|
||||
import {
|
||||
findInstalledPackage,
|
||||
getAllInstalledPackages,
|
||||
isPackageInstalled,
|
||||
} from '../CommunityNodes/packageModel';
|
||||
} from '@/CommunityNodes/packageModel';
|
||||
import {
|
||||
RESPONSE_ERROR_MESSAGES,
|
||||
STARTER_TEMPLATE_NAME,
|
||||
UNKNOWN_FAILURE_REASON,
|
||||
} from '../constants';
|
||||
import { isAuthenticatedRequest } from '../UserManagement/UserManagementHelper';
|
||||
} from '@/constants';
|
||||
import { isAuthenticatedRequest } from '@/UserManagement/UserManagementHelper';
|
||||
|
||||
import { InstalledPackages } from '../databases/entities/InstalledPackages';
|
||||
import type { CommunityPackages } from '../Interfaces';
|
||||
import type { NodeRequest } from '../requests';
|
||||
import { InstalledPackages } from '@db/entities/InstalledPackages';
|
||||
import type { CommunityPackages } from '@/Interfaces';
|
||||
import type { NodeRequest } from '@/requests';
|
||||
|
||||
const { PACKAGE_NOT_INSTALLED, PACKAGE_NAME_NOT_PROVIDED } = RESPONSE_ERROR_MESSAGES;
|
||||
|
||||
|
@ -4,16 +4,18 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable no-param-reassign */
|
||||
/* eslint-disable import/no-cycle */
|
||||
|
||||
import express from 'express';
|
||||
|
||||
import { Db, ExternalHooks, IExternalHooksClass, ITagWithCountDb, ResponseHelper } from '..';
|
||||
import config from '../../config';
|
||||
import * as TagHelpers from '../TagHelpers';
|
||||
import { validateEntity } from '../GenericHelpers';
|
||||
import { TagEntity } from '../databases/entities/TagEntity';
|
||||
import { TagsRequest } from '../requests';
|
||||
import * as Db from '@/Db';
|
||||
import { ExternalHooks } from '@/ExternalHooks';
|
||||
import { IExternalHooksClass, ITagWithCountDb } from '@/Interfaces';
|
||||
import * as ResponseHelper from '@/ResponseHelper';
|
||||
import config from '@/config';
|
||||
import * as TagHelpers from '@/TagHelpers';
|
||||
import { validateEntity } from '@/GenericHelpers';
|
||||
import { TagEntity } from '@db/entities/TagEntity';
|
||||
import { TagsRequest } from '@/requests';
|
||||
|
||||
export const externalHooks: IExternalHooksClass = ExternalHooks();
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
import { Command } from '@oclif/core';
|
||||
import { LoggerProxy } from 'n8n-workflow';
|
||||
import { getLogger, Logger } from '../src/Logger';
|
||||
import { User } from '../src/databases/entities/User';
|
||||
import { Db } from '../src';
|
||||
import { getLogger, Logger } from '@/Logger';
|
||||
import { User } from '@db/entities/User';
|
||||
import * as Db from '@/Db';
|
||||
|
||||
export abstract class BaseCommand extends Command {
|
||||
logger: Logger;
|
@ -4,9 +4,9 @@ import { Command, flags } from '@oclif/command';
|
||||
import { Connection, ConnectionOptions, createConnection } from 'typeorm';
|
||||
import { LoggerProxy } from 'n8n-workflow';
|
||||
|
||||
import { getLogger } from '../../src/Logger';
|
||||
import { getLogger } from '@/Logger';
|
||||
|
||||
import { Db } from '../../src';
|
||||
import * as Db from '@/Db';
|
||||
|
||||
export class DbRevertMigrationCommand extends Command {
|
||||
static description = 'Revert last database migration';
|
@ -6,26 +6,22 @@ import { Command, flags } from '@oclif/command';
|
||||
import { BinaryDataManager, UserSettings, PLACEHOLDER_EMPTY_WORKFLOW_ID } from 'n8n-core';
|
||||
import { LoggerProxy } from 'n8n-workflow';
|
||||
|
||||
import {
|
||||
ActiveExecutions,
|
||||
CredentialsOverwrites,
|
||||
CredentialTypes,
|
||||
Db,
|
||||
ExternalHooks,
|
||||
GenericHelpers,
|
||||
InternalHooksManager,
|
||||
IWorkflowBase,
|
||||
IWorkflowExecutionDataProcess,
|
||||
LoadNodesAndCredentials,
|
||||
NodeTypes,
|
||||
WorkflowHelpers,
|
||||
WorkflowRunner,
|
||||
} from '../src';
|
||||
|
||||
import { getLogger } from '../src/Logger';
|
||||
import config from '../config';
|
||||
import { getInstanceOwner } from '../src/UserManagement/UserManagementHelper';
|
||||
import { findCliWorkflowStart } from '../src/utils';
|
||||
import * as ActiveExecutions from '@/ActiveExecutions';
|
||||
import { CredentialsOverwrites } from '@/CredentialsOverwrites';
|
||||
import { CredentialTypes } from '@/CredentialTypes';
|
||||
import * as Db from '@/Db';
|
||||
import { ExternalHooks } from '@/ExternalHooks';
|
||||
import * as GenericHelpers from '@/GenericHelpers';
|
||||
import { LoadNodesAndCredentials } from '@/LoadNodesAndCredentials';
|
||||
import { NodeTypes } from '@/NodeTypes';
|
||||
import { InternalHooksManager } from '@/InternalHooksManager';
|
||||
import * as WorkflowHelpers from '@/WorkflowHelpers';
|
||||
import { WorkflowRunner } from '@/WorkflowRunner';
|
||||
import { IWorkflowBase, IWorkflowExecutionDataProcess } from '@/Interfaces';
|
||||
import { getLogger } from '@/Logger';
|
||||
import config from '@/config';
|
||||
import { getInstanceOwner } from '@/UserManagement/UserManagementHelper';
|
||||
import { findCliWorkflowStart } from '@/utils';
|
||||
|
||||
export class Execute extends Command {
|
||||
static description = '\nExecutes a given workflow';
|
@ -19,26 +19,23 @@ import { diff } from 'json-diff';
|
||||
|
||||
// eslint-disable-next-line import/no-extraneous-dependencies
|
||||
import { pick } from 'lodash';
|
||||
import { getLogger } from '../src/Logger';
|
||||
import { getLogger } from '@/Logger';
|
||||
|
||||
import {
|
||||
ActiveExecutions,
|
||||
CredentialsOverwrites,
|
||||
CredentialTypes,
|
||||
Db,
|
||||
ExternalHooks,
|
||||
GenericHelpers,
|
||||
InternalHooksManager,
|
||||
IWorkflowDb,
|
||||
IWorkflowExecutionDataProcess,
|
||||
LoadNodesAndCredentials,
|
||||
NodeTypes,
|
||||
WorkflowRunner,
|
||||
} from '../src';
|
||||
import config from '../config';
|
||||
import { User } from '../src/databases/entities/User';
|
||||
import { getInstanceOwner } from '../src/UserManagement/UserManagementHelper';
|
||||
import { findCliWorkflowStart } from '../src/utils';
|
||||
import * as ActiveExecutions from '@/ActiveExecutions';
|
||||
import { CredentialsOverwrites } from '@/CredentialsOverwrites';
|
||||
import { CredentialTypes } from '@/CredentialTypes';
|
||||
import * as Db from '@/Db';
|
||||
import { ExternalHooks } from '@/ExternalHooks';
|
||||
import * as GenericHelpers from '@/GenericHelpers';
|
||||
import { LoadNodesAndCredentials } from '@/LoadNodesAndCredentials';
|
||||
import { NodeTypes } from '@/NodeTypes';
|
||||
import { InternalHooksManager } from '@/InternalHooksManager';
|
||||
import { WorkflowRunner } from '@/WorkflowRunner';
|
||||
import { IWorkflowDb, IWorkflowExecutionDataProcess } from '@/Interfaces';
|
||||
import config from '@/config';
|
||||
import { User } from '@db/entities/User';
|
||||
import { getInstanceOwner } from '@/UserManagement/UserManagementHelper';
|
||||
import { findCliWorkflowStart } from '@/utils';
|
||||
|
||||
export class ExecuteBatch extends Command {
|
||||
static description = '\nExecutes multiple workflows once';
|
@ -10,8 +10,9 @@ import { IDataObject, LoggerProxy } from 'n8n-workflow';
|
||||
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import { getLogger } from '../../src/Logger';
|
||||
import { Db, ICredentialsDecryptedDb } from '../../src';
|
||||
import { getLogger } from '@/Logger';
|
||||
import * as Db from '@/Db';
|
||||
import type { ICredentialsDecryptedDb } from '@/Interfaces';
|
||||
|
||||
export class ExportCredentialsCommand extends Command {
|
||||
static description = 'Export credentials';
|
@ -7,8 +7,8 @@ import { IDataObject, LoggerProxy } from 'n8n-workflow';
|
||||
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import { getLogger } from '../../src/Logger';
|
||||
import { Db } from '../../src';
|
||||
import { getLogger } from '@/Logger';
|
||||
import * as Db from '@/Db';
|
||||
|
||||
export class ExportWorkflowsCommand extends Command {
|
||||
static description = 'Export workflows';
|
@ -15,12 +15,12 @@ import { LoggerProxy } from 'n8n-workflow';
|
||||
import fs from 'fs';
|
||||
import glob from 'fast-glob';
|
||||
import { EntityManager, getConnection } from 'typeorm';
|
||||
import { getLogger } from '../../src/Logger';
|
||||
import { Db } from '../../src';
|
||||
import { User } from '../../src/databases/entities/User';
|
||||
import { SharedCredentials } from '../../src/databases/entities/SharedCredentials';
|
||||
import { Role } from '../../src/databases/entities/Role';
|
||||
import { CredentialsEntity } from '../../src/databases/entities/CredentialsEntity';
|
||||
import { getLogger } from '@/Logger';
|
||||
import * as Db from '@/Db';
|
||||
import { User } from '@db/entities/User';
|
||||
import { SharedCredentials } from '@db/entities/SharedCredentials';
|
||||
import { Role } from '@db/entities/Role';
|
||||
import { CredentialsEntity } from '@db/entities/CredentialsEntity';
|
||||
|
||||
const FIX_INSTRUCTION =
|
||||
'Please fix the database by running ./packages/cli/bin/n8n user-management:reset';
|
@ -18,13 +18,14 @@ import glob from 'fast-glob';
|
||||
import { UserSettings } from 'n8n-core';
|
||||
import { EntityManager, getConnection } from 'typeorm';
|
||||
import { v4 as uuid } from 'uuid';
|
||||
import { getLogger } from '../../src/Logger';
|
||||
import { Db, ICredentialsDb, IWorkflowToImport } from '../../src';
|
||||
import { SharedWorkflow } from '../../src/databases/entities/SharedWorkflow';
|
||||
import { WorkflowEntity } from '../../src/databases/entities/WorkflowEntity';
|
||||
import { Role } from '../../src/databases/entities/Role';
|
||||
import { User } from '../../src/databases/entities/User';
|
||||
import { setTagsForImport } from '../../src/TagHelpers';
|
||||
import { getLogger } from '@/Logger';
|
||||
import * as Db from '@/Db';
|
||||
import { SharedWorkflow } from '@db/entities/SharedWorkflow';
|
||||
import { WorkflowEntity } from '@db/entities/WorkflowEntity';
|
||||
import { Role } from '@db/entities/Role';
|
||||
import { User } from '@db/entities/User';
|
||||
import { setTagsForImport } from '@/TagHelpers';
|
||||
import type { ICredentialsDb, IWorkflowToImport } from '@/Interfaces';
|
||||
|
||||
const FIX_INSTRUCTION =
|
||||
'Please fix the database by running ./packages/cli/bin/n8n user-management:reset';
|
@ -4,7 +4,7 @@ import { Command, flags } from '@oclif/command';
|
||||
|
||||
import { IDataObject } from 'n8n-workflow';
|
||||
|
||||
import { Db } from '../../src';
|
||||
import * as Db from '@/Db';
|
||||
|
||||
export class ListWorkflowCommand extends Command {
|
||||
static description = '\nList workflows';
|
@ -14,28 +14,27 @@ import Redis from 'ioredis';
|
||||
|
||||
import { IDataObject, LoggerProxy, sleep } from 'n8n-workflow';
|
||||
import { createHash } from 'crypto';
|
||||
import config from '../config';
|
||||
import {
|
||||
ActiveExecutions,
|
||||
ActiveWorkflowRunner,
|
||||
CredentialsOverwrites,
|
||||
CredentialTypes,
|
||||
DatabaseType,
|
||||
Db,
|
||||
ExternalHooks,
|
||||
GenericHelpers,
|
||||
InternalHooksManager,
|
||||
LoadNodesAndCredentials,
|
||||
NodeTypes,
|
||||
Server,
|
||||
TestWebhooks,
|
||||
WaitTracker,
|
||||
} from '../src';
|
||||
import config from '@/config';
|
||||
|
||||
import { getLogger } from '../src/Logger';
|
||||
import { getAllInstalledPackages } from '../src/CommunityNodes/packageModel';
|
||||
import { initErrorHandling } from '../src/ErrorReporting';
|
||||
import * as CrashJournal from '../src/CrashJournal';
|
||||
import * as ActiveExecutions from '@/ActiveExecutions';
|
||||
import * as ActiveWorkflowRunner from '@/ActiveWorkflowRunner';
|
||||
import { CredentialsOverwrites } from '@/CredentialsOverwrites';
|
||||
import { CredentialTypes } from '@/CredentialTypes';
|
||||
import * as Db from '@/Db';
|
||||
import { ExternalHooks } from '@/ExternalHooks';
|
||||
import * as GenericHelpers from '@/GenericHelpers';
|
||||
import { LoadNodesAndCredentials } from '@/LoadNodesAndCredentials';
|
||||
import { NodeTypes } from '@/NodeTypes';
|
||||
import { InternalHooksManager } from '@/InternalHooksManager';
|
||||
import * as Server from '@/Server';
|
||||
import { DatabaseType } from '@/Interfaces';
|
||||
import * as TestWebhooks from '@/TestWebhooks';
|
||||
import { WaitTracker } from '@/WaitTracker';
|
||||
|
||||
import { getLogger } from '@/Logger';
|
||||
import { getAllInstalledPackages } from '@/CommunityNodes/packageModel';
|
||||
import { initErrorHandling } from '@/ErrorReporting';
|
||||
import * as CrashJournal from '@/CrashJournal';
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-var-requires
|
||||
const open = require('open');
|
@ -5,9 +5,9 @@ import { Command, flags } from '@oclif/command';
|
||||
|
||||
import { IDataObject, LoggerProxy } from 'n8n-workflow';
|
||||
|
||||
import { Db } from '../../src';
|
||||
import * as Db from '@/Db';
|
||||
|
||||
import { getLogger } from '../../src/Logger';
|
||||
import { getLogger } from '@/Logger';
|
||||
|
||||
export class UpdateWorkflowCommand extends Command {
|
||||
static description = 'Update workflows';
|
@ -1,6 +1,6 @@
|
||||
import { Not } from 'typeorm';
|
||||
import { Db } from '../../src';
|
||||
import { CredentialsEntity } from '../../src/databases/entities/CredentialsEntity';
|
||||
import * as Db from '@/Db';
|
||||
import { CredentialsEntity } from '@db/entities/CredentialsEntity';
|
||||
import { BaseCommand } from '../BaseCommand';
|
||||
|
||||
export class Reset extends BaseCommand {
|
@ -10,24 +10,21 @@ import { Command, flags } from '@oclif/command';
|
||||
import Redis from 'ioredis';
|
||||
|
||||
import { IDataObject, LoggerProxy, sleep } from 'n8n-workflow';
|
||||
import config from '../config';
|
||||
import {
|
||||
ActiveExecutions,
|
||||
ActiveWorkflowRunner,
|
||||
CredentialsOverwrites,
|
||||
CredentialTypes,
|
||||
Db,
|
||||
ExternalHooks,
|
||||
GenericHelpers,
|
||||
InternalHooksManager,
|
||||
LoadNodesAndCredentials,
|
||||
NodeTypes,
|
||||
WebhookServer,
|
||||
} from '../src';
|
||||
|
||||
import { getLogger } from '../src/Logger';
|
||||
import { initErrorHandling } from '../src/ErrorReporting';
|
||||
import * as CrashJournal from '../src/CrashJournal';
|
||||
import config from '@/config';
|
||||
import * as ActiveExecutions from '@/ActiveExecutions';
|
||||
import * as ActiveWorkflowRunner from '@/ActiveWorkflowRunner';
|
||||
import { CredentialsOverwrites } from '@/CredentialsOverwrites';
|
||||
import { CredentialTypes } from '@/CredentialTypes';
|
||||
import * as Db from '@/Db';
|
||||
import { ExternalHooks } from '@/ExternalHooks';
|
||||
import * as GenericHelpers from '@/GenericHelpers';
|
||||
import { LoadNodesAndCredentials } from '@/LoadNodesAndCredentials';
|
||||
import { NodeTypes } from '@/NodeTypes';
|
||||
import { InternalHooksManager } from '@/InternalHooksManager';
|
||||
import * as WebhookServer from '@/WebhookServer';
|
||||
import { getLogger } from '@/Logger';
|
||||
import { initErrorHandling } from '@/ErrorReporting';
|
||||
import * as CrashJournal from '@/CrashJournal';
|
||||
|
||||
let activeWorkflowRunner: ActiveWorkflowRunner.ActiveWorkflowRunner | undefined;
|
||||
let processExitCode = 0;
|
@ -26,29 +26,26 @@ import {
|
||||
|
||||
import { FindOneOptions, getConnectionManager } from 'typeorm';
|
||||
|
||||
import {
|
||||
CredentialsOverwrites,
|
||||
CredentialTypes,
|
||||
Db,
|
||||
ExternalHooks,
|
||||
GenericHelpers,
|
||||
InternalHooksManager,
|
||||
LoadNodesAndCredentials,
|
||||
NodeTypes,
|
||||
ResponseHelper,
|
||||
WebhookHelpers,
|
||||
WorkflowExecuteAdditionalData,
|
||||
} from '../src';
|
||||
import { CredentialsOverwrites } from '@/CredentialsOverwrites';
|
||||
import { CredentialTypes } from '@/CredentialTypes';
|
||||
import * as Db from '@/Db';
|
||||
import { ExternalHooks } from '@/ExternalHooks';
|
||||
import * as GenericHelpers from '@/GenericHelpers';
|
||||
import { NodeTypes } from '@/NodeTypes';
|
||||
import * as ResponseHelper from '@/ResponseHelper';
|
||||
import * as WebhookHelpers from '@/WebhookHelpers';
|
||||
import * as WorkflowExecuteAdditionalData from '@/WorkflowExecuteAdditionalData';
|
||||
import { InternalHooksManager } from '@/InternalHooksManager';
|
||||
import { LoadNodesAndCredentials } from '@/LoadNodesAndCredentials';
|
||||
import { getLogger } from '@/Logger';
|
||||
|
||||
import { getLogger } from '../src/Logger';
|
||||
|
||||
import config from '../config';
|
||||
import * as Queue from '../src/Queue';
|
||||
import config from '@/config';
|
||||
import * as Queue from '@/Queue';
|
||||
import {
|
||||
checkPermissionsForExecution,
|
||||
getWorkflowOwner,
|
||||
} from '../src/UserManagement/UserManagementHelper';
|
||||
import { generateFailedExecutionFromError } from '../src/WorkflowHelpers';
|
||||
} from '@/UserManagement/UserManagementHelper';
|
||||
import { generateFailedExecutionFromError } from '@/WorkflowHelpers';
|
||||
|
||||
export class Worker extends Command {
|
||||
static description = '\nStarts a n8n worker';
|
@ -1,7 +1,7 @@
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
/* eslint-disable @typescript-eslint/no-unused-vars */
|
||||
|
||||
import { IBinaryDataConfig } from '../../core/dist/src';
|
||||
import { IBinaryDataConfig } from 'n8n-core';
|
||||
import { schema } from './schema';
|
||||
|
||||
// -----------------------------------
|
@ -1,9 +1,13 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
|
||||
import { resolve, join } from 'path';
|
||||
import { RESPONSE_ERROR_MESSAGES as CORE_RESPONSE_ERROR_MESSAGES } from 'n8n-core';
|
||||
|
||||
export const CLI_DIR = resolve(__dirname, '..');
|
||||
export const TEMPLATES_DIR = join(CLI_DIR, 'templates');
|
||||
export const NODES_BASE_DIR = join(CLI_DIR, '..', 'nodes-base');
|
||||
|
||||
export const NODE_PACKAGE_PREFIX = 'n8n-nodes-';
|
||||
|
||||
export const STARTER_TEMPLATE_NAME = `${NODE_PACKAGE_PREFIX}starter`;
|
||||
|
@ -1,11 +1,12 @@
|
||||
/* eslint-disable import/no-cycle */
|
||||
import express from 'express';
|
||||
import { INodeCredentialTestResult, LoggerProxy } from 'n8n-workflow';
|
||||
import { Db, InternalHooksManager, ResponseHelper } from '..';
|
||||
import type { CredentialsEntity } from '../databases/entities/CredentialsEntity';
|
||||
import * as Db from '@/Db';
|
||||
import { InternalHooksManager } from '@/InternalHooksManager';
|
||||
import * as ResponseHelper from '@/ResponseHelper';
|
||||
import type { CredentialsEntity } from '@db/entities/CredentialsEntity';
|
||||
|
||||
import type { CredentialRequest } from '../requests';
|
||||
import { isSharingEnabled, rightDiff } from '../UserManagement/UserManagementHelper';
|
||||
import type { CredentialRequest } from '@/requests';
|
||||
import { isSharingEnabled, rightDiff } from '@/UserManagement/UserManagementHelper';
|
||||
import { EECredentialsService as EECredentials } from './credentials.service.ee';
|
||||
import type { CredentialWithSharings } from './credentials.types';
|
||||
|
||||
|
@ -1,17 +1,18 @@
|
||||
/* eslint-disable no-param-reassign */
|
||||
/* eslint-disable @typescript-eslint/no-unused-vars */
|
||||
/* eslint-disable import/no-cycle */
|
||||
import express from 'express';
|
||||
import { INodeCredentialTestResult, LoggerProxy } from 'n8n-workflow';
|
||||
|
||||
import { GenericHelpers, InternalHooksManager, ResponseHelper } from '..';
|
||||
import config from '../../config';
|
||||
import { getLogger } from '../Logger';
|
||||
import * as GenericHelpers from '@/GenericHelpers';
|
||||
import { InternalHooksManager } from '@/InternalHooksManager';
|
||||
import * as ResponseHelper from '@/ResponseHelper';
|
||||
import config from '@/config';
|
||||
import { getLogger } from '@/Logger';
|
||||
import { EECredentialsController } from './credentials.controller.ee';
|
||||
import { CredentialsService } from './credentials.service';
|
||||
|
||||
import type { ICredentialsResponse } from '..';
|
||||
import type { CredentialRequest } from '../requests';
|
||||
import type { ICredentialsResponse } from '@/Interfaces';
|
||||
import type { CredentialRequest } from '@/requests';
|
||||
|
||||
export const credentialsController = express.Router();
|
||||
|
||||
|
@ -1,14 +1,12 @@
|
||||
/* eslint-disable import/no-cycle */
|
||||
/* eslint-disable no-param-reassign */
|
||||
import { DeleteResult, EntityManager, In, Not } from 'typeorm';
|
||||
import { Db } from '..';
|
||||
import { RoleService } from '../role/role.service';
|
||||
import * as Db from '@/Db';
|
||||
import { RoleService } from '@/role/role.service';
|
||||
import { CredentialsEntity } from '@db/entities/CredentialsEntity';
|
||||
import { SharedCredentials } from '@db/entities/SharedCredentials';
|
||||
import { User } from '@db/entities/User';
|
||||
import { UserService } from '@/user/user.service';
|
||||
import { CredentialsService } from './credentials.service';
|
||||
|
||||
import { CredentialsEntity } from '../databases/entities/CredentialsEntity';
|
||||
import { SharedCredentials } from '../databases/entities/SharedCredentials';
|
||||
import { User } from '../databases/entities/User';
|
||||
import { UserService } from '../user/user.service';
|
||||
import type { CredentialWithSharings } from './credentials.types';
|
||||
|
||||
export class EECredentialsService extends CredentialsService {
|
||||
|
@ -1,5 +1,4 @@
|
||||
/* eslint-disable no-restricted-syntax */
|
||||
/* eslint-disable import/no-cycle */
|
||||
import { Credentials, UserSettings } from 'n8n-core';
|
||||
import {
|
||||
ICredentialDataDecryptedObject,
|
||||
@ -9,21 +8,18 @@ import {
|
||||
} from 'n8n-workflow';
|
||||
import { FindManyOptions, FindOneOptions, In } from 'typeorm';
|
||||
|
||||
import {
|
||||
createCredentialsFromCredentialsEntity,
|
||||
CredentialsHelper,
|
||||
Db,
|
||||
ICredentialsDb,
|
||||
ResponseHelper,
|
||||
} from '..';
|
||||
import { RESPONSE_ERROR_MESSAGES } from '../constants';
|
||||
import { CredentialsEntity } from '../databases/entities/CredentialsEntity';
|
||||
import { SharedCredentials } from '../databases/entities/SharedCredentials';
|
||||
import { validateEntity } from '../GenericHelpers';
|
||||
import * as Db from '@/Db';
|
||||
import * as ResponseHelper from '@/ResponseHelper';
|
||||
import { ICredentialsDb } from '@/Interfaces';
|
||||
import { CredentialsHelper, createCredentialsFromCredentialsEntity } from '@/CredentialsHelper';
|
||||
import { RESPONSE_ERROR_MESSAGES } from '@/constants';
|
||||
import { CredentialsEntity } from '@db/entities/CredentialsEntity';
|
||||
import { SharedCredentials } from '@db/entities/SharedCredentials';
|
||||
import { validateEntity } from '@/GenericHelpers';
|
||||
import { externalHooks } from '../Server';
|
||||
|
||||
import type { User } from '../databases/entities/User';
|
||||
import type { CredentialRequest } from '../requests';
|
||||
import type { User } from '@db/entities/User';
|
||||
import type { CredentialRequest } from '@/requests';
|
||||
|
||||
export class CredentialsService {
|
||||
static async get(
|
||||
|
@ -1,5 +1,5 @@
|
||||
import type { IUser } from 'n8n-workflow';
|
||||
import type { ICredentialsDb } from '../Interfaces';
|
||||
import type { ICredentialsDb } from '@/Interfaces';
|
||||
|
||||
export interface CredentialWithSharings extends ICredentialsDb {
|
||||
ownedBy?: IUser | null;
|
||||
|
@ -1,4 +1,3 @@
|
||||
/* eslint-disable import/no-cycle */
|
||||
import ClientOAuth2 from 'client-oauth2';
|
||||
import Csrf from 'csrf';
|
||||
import express from 'express';
|
||||
@ -17,18 +16,20 @@ import {
|
||||
} from 'n8n-workflow';
|
||||
import { resolve as pathResolve } from 'path';
|
||||
|
||||
import { Db, ICredentialsDb, ResponseHelper } from '..';
|
||||
import { RESPONSE_ERROR_MESSAGES } from '../constants';
|
||||
import * as Db from '@/Db';
|
||||
import * as ResponseHelper from '@/ResponseHelper';
|
||||
import { ICredentialsDb } from '@/Interfaces';
|
||||
import { RESPONSE_ERROR_MESSAGES, TEMPLATES_DIR } from '@/constants';
|
||||
import {
|
||||
CredentialsHelper,
|
||||
getCredentialForUser,
|
||||
getCredentialWithoutUser,
|
||||
} from '../CredentialsHelper';
|
||||
import { getLogger } from '../Logger';
|
||||
import { OAuthRequest } from '../requests';
|
||||
import { externalHooks } from '../Server';
|
||||
import config from '../../config';
|
||||
import { getInstanceBaseUrl } from '../UserManagement/UserManagementHelper';
|
||||
} from '@/CredentialsHelper';
|
||||
import { getLogger } from '@/Logger';
|
||||
import { OAuthRequest } from '@/requests';
|
||||
import { externalHooks } from '@/Server';
|
||||
import config from '@/config';
|
||||
import { getInstanceBaseUrl } from '@/UserManagement/UserManagementHelper';
|
||||
|
||||
export const oauth2CredentialController = express.Router();
|
||||
|
||||
@ -334,7 +335,7 @@ oauth2CredentialController.get(
|
||||
credentialId: state.cid,
|
||||
});
|
||||
|
||||
return res.sendFile(pathResolve(__dirname, '../../../templates/oauth-callback.html'));
|
||||
return res.sendFile(pathResolve(TEMPLATES_DIR, 'oauth-callback.html'));
|
||||
} catch (error) {
|
||||
// Error response
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
||||
|
@ -8,9 +8,9 @@ import { entities } from './entities';
|
||||
import { mysqlMigrations } from './migrations/mysqldb';
|
||||
import { postgresMigrations } from './migrations/postgresdb';
|
||||
import { sqliteMigrations } from './migrations/sqlite';
|
||||
import type { DatabaseType } from '../Interfaces';
|
||||
import config from '../../config';
|
||||
import { getConfigValue } from '../GenericHelpers';
|
||||
import type { DatabaseType } from '@/Interfaces';
|
||||
import config from '@/config';
|
||||
import { getConfigValue } from '@/GenericHelpers';
|
||||
|
||||
const entitiesDir = path.resolve(__dirname, 'entities');
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { BeforeUpdate, CreateDateColumn, UpdateDateColumn } from 'typeorm';
|
||||
import { IsDate, IsOptional } from 'class-validator';
|
||||
import config from '../../../config';
|
||||
import config from '@/config';
|
||||
|
||||
const dbType = config.getEnv('database.type');
|
||||
|
||||
|
@ -3,7 +3,7 @@ import { Column, Entity, Index, OneToMany, PrimaryGeneratedColumn } from 'typeor
|
||||
import { IsArray, IsObject, IsString, Length } from 'class-validator';
|
||||
import { SharedCredentials } from './SharedCredentials';
|
||||
import { AbstractEntity, jsonColumnType } from './AbstractEntity';
|
||||
import type { ICredentialsDb } from '../../Interfaces';
|
||||
import type { ICredentialsDb } from '@/Interfaces';
|
||||
|
||||
@Entity()
|
||||
export class CredentialsEntity extends AbstractEntity implements ICredentialsDb {
|
||||
|
@ -1,7 +1,7 @@
|
||||
import type { WorkflowExecuteMode } from 'n8n-workflow';
|
||||
import { Column, Entity, Index, PrimaryGeneratedColumn } from 'typeorm';
|
||||
import { datetimeColumnType, jsonColumnType } from './AbstractEntity';
|
||||
import type { IExecutionFlattedDb, IWorkflowDb } from '../../Interfaces';
|
||||
import type { IExecutionFlattedDb, IWorkflowDb } from '@/Interfaces';
|
||||
|
||||
@Entity()
|
||||
@Index(['workflowId', 'id'])
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user