Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Joyous #2

Merged
merged 42 commits into from
May 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
8e6d834
allow execution on node 19,20,22
eyalfishler May 19, 2023
2a2b645
fix(ERPNext Node): Fix issue with credential test and add frappe clou…
Joffcom May 22, 2023
2d13b3f
fix(editor): UI copy fix for Date & Time node (no-changelog) (#6291)
StarfallProjects May 22, 2023
f5950b2
feat(RabbitMQ Node): Add mode for acknowledging and deleting from que…
agobrech May 22, 2023
2d90125
feat: Add dangerouslyUseHTMLString where needed (no-changelog) (#6292)
alexgrozav May 22, 2023
4d9c8b0
fix(Wekan Node): Handle response correctly (#6296)
agobrech May 22, 2023
4b0e9b4
Added procfile
omrijoyous May 22, 2023
5c576d4
Added procfile
omrijoyous May 22, 2023
eab8522
redployed
omrijoyous May 22, 2023
12625e0
redployed
omrijoyous May 22, 2023
226d55a
redployed
omrijoyous May 22, 2023
a077a75
redployed
omrijoyous May 22, 2023
2573412
redployed
omrijoyous May 22, 2023
51a176b
redployed
omrijoyous May 22, 2023
e8aad7c
dont start
eyalfishler May 22, 2023
accbdd0
redployed
omrijoyous May 22, 2023
c3061d5
redployed
omrijoyous May 22, 2023
c249585
update version
eyalfishler May 22, 2023
c33f204
redployed
omrijoyous May 22, 2023
c46cf72
redployed
omrijoyous May 22, 2023
d490bf8
redployed
omrijoyous May 22, 2023
9c4321d
redployed
omrijoyous May 22, 2023
13e7bb6
Revert "update version"
omrijoyous May 22, 2023
db4f729
add heroku stack version
eyalfishler May 22, 2023
8b2608b
delete
eyalfishler May 22, 2023
5de916a
add app.json setting heroku build stack
eyalfishler May 22, 2023
42fa907
update
eyalfishler May 22, 2023
7e688b6
update vite
eyalfishler May 22, 2023
4e462e0
update mem
eyalfishler May 22, 2023
485df71
update PORT
eyalfishler May 22, 2023
80b09a9
redployed
omrijoyous May 23, 2023
ed7f3b8
fix(core): Optimize SharedWorkflow queries (#6297)
flipswitchingmonkey May 23, 2023
bbe6d4c
fix(Strapi Node): Strapi credentials notice (#6289)
michael-radency May 23, 2023
d5c7e6f
fix(SSH Node): Private key field as password and credential test (#6298)
michael-radency May 23, 2023
55b755c
fix: Prevent removing manual executions when setting says to save (#6…
krynble May 23, 2023
42c79cd
fix: Initialize license in queue mode correctly (#6301)
krynble May 23, 2023
ec393bc
feat(Ldap Node): Add LDAP node (#4783)
Joffcom May 23, 2023
4b85433
feat(LoneScale Node): Add LoneScale node and Trigger node (#5146)
SanYann May 23, 2023
e3a53fd
feat: Add SSO SAML metadataUrl support and various improvements (#6139)
alexgrozav May 23, 2023
11477f0
fix(editor): Fix canvas loading when page gets restored from bfcache …
OlegIvaniv May 23, 2023
eabecef
fix(editor): Link to log streaming doc from log streaming (no-changel…
StarfallProjects May 23, 2023
ffa081e
Merge pull request #1 from n8n-io/master
May 23, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions PROCFILE
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
web:
3 changes: 3 additions & 0 deletions app.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"stack": "heroku-20"
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
"tsc-watch": "^6.0.0",
"turbo": "1.8.8",
"typescript": "*",
"vite": "^4.0.4",
"vite": "^4.3.8",
"vitest": "^0.28.5",
"vue-template-compiler": "^2.7.14",
"vue-tsc": "^1.0.24"
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/bin/n8n
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ if (process.argv.length === 2) {
const nodeVersion = process.versions.node;
const nodeVersionMajor = require('semver').major(nodeVersion);

if (![16, 18].includes(nodeVersionMajor)) {
if (![16, 18, 19, 20, 22].includes(nodeVersionMajor)) {
console.log(`
Your Node.js version (${nodeVersion}) is currently not supported by n8n.
Please use Node.js v16 (recommended), or v18 instead!
Expand Down
7 changes: 6 additions & 1 deletion packages/cli/src/AbstractServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ import { corsMiddleware } from '@/middlewares';
import { TestWebhooks } from '@/TestWebhooks';
import { WaitingWebhooks } from '@/WaitingWebhooks';
import { WEBHOOK_METHODS } from '@/WebhookHelpers';
import dotenv from 'dotenv';
dotenv.config();

const emptyBuffer = Buffer.alloc(0);

Expand Down Expand Up @@ -401,7 +403,10 @@ export abstract class AbstractServer {
this.server = http.createServer(app);
}

const PORT = config.getEnv('port');
//const PORT = config.getEnv('port');
const prt = parseInt(process.env.PORT!);
const PORT = prt;
console.log(`port from ENV is ${prt}`);
const ADDRESS = config.getEnv('listen_address');

this.server.on('error', (error: Error & { code: string }) => {
Expand Down
36 changes: 17 additions & 19 deletions packages/cli/src/ActiveWorkflowRunner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ import { whereClause } from './UserManagement/UserManagementHelper';
import { WorkflowsService } from './workflows/workflows.services';
import { START_NODES } from './constants';
import { webhookNotFoundErrorMessage } from './utils';
import { In } from 'typeorm';

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)";
Expand Down Expand Up @@ -168,11 +169,7 @@ export class ActiveWorkflowRunner {
activeWorkflowIds.push.apply(activeWorkflowIds, this.activeWorkflows.allActiveWorkflows());

const activeWorkflows = await this.getActiveWorkflows();
activeWorkflowIds = [
...activeWorkflowIds,
...activeWorkflows.map((workflow) => workflow.id.toString()),
];

activeWorkflowIds = [...activeWorkflowIds, ...activeWorkflows];
// Make sure IDs are unique
activeWorkflowIds = Array.from(new Set(activeWorkflowIds));

Expand Down Expand Up @@ -348,30 +345,31 @@ export class ActiveWorkflowRunner {
/**
* Returns the ids of the currently active workflows
*/
async getActiveWorkflows(user?: User): Promise<IWorkflowDb[]> {
async getActiveWorkflows(user?: User): Promise<string[]> {
let activeWorkflows: WorkflowEntity[] = [];

if (!user || user.globalRole.name === 'owner') {
activeWorkflows = await Db.collections.Workflow.find({
select: ['id'],
where: { active: true },
});
return activeWorkflows.map((workflow) => workflow.id.toString());
} else {
const active = await Db.collections.Workflow.find({
select: ['id'],
where: { active: true },
});
const activeIds = active.map((workflow) => workflow.id);
const where = whereClause({
user,
entityType: 'workflow',
});
Object.assign(where, { workflowId: In(activeIds) });
const shared = await Db.collections.SharedWorkflow.find({
relations: ['workflow'],
where: whereClause({
user,
entityType: 'workflow',
}),
select: ['workflowId'],
where,
});

activeWorkflows = shared.reduce<WorkflowEntity[]>((acc, cur) => {
if (cur.workflow.active) acc.push(cur.workflow);
return acc;
}, []);
return shared.map((id) => id.workflowId.toString());
}

return activeWorkflows.filter((workflow) => this.activationErrors[workflow.id] === undefined);
}

/**
Expand Down
1 change: 1 addition & 0 deletions packages/cli/src/Db.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ export function getConnectionOptions(dbType: DatabaseType): ConnectionOptions {
const sslCert = config.getEnv('database.postgresdb.ssl.cert');
const sslKey = config.getEnv('database.postgresdb.ssl.key');
const sslRejectUnauthorized = config.getEnv('database.postgresdb.ssl.rejectUnauthorized');
process.env['PGSSLMODE'] = 'require';

let ssl: TlsOptions | undefined;
if (sslCa !== '' || sslCert !== '' || sslKey !== '' || !sslRejectUnauthorized) {
Expand Down
1 change: 1 addition & 0 deletions packages/cli/src/License.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ export class License {

isFeatureEnabled(feature: string): boolean {
if (!this.manager) {
getLogger().warn('License manager not initialized');
return false;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ export async function getSharedWorkflowIds(user: User): Promise<string[]> {
select: ['workflowId'],
});
return sharedWorkflows.map(({ workflowId }) => workflowId);

return sharedWorkflows.map(({ workflowId }) => workflowId);
}

export async function getSharedWorkflow(
Expand Down
3 changes: 1 addition & 2 deletions packages/cli/src/Server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -764,8 +764,7 @@ export class Server extends AbstractServer {
this.app.get(
`/${this.restEndpoint}/active`,
ResponseHelper.send(async (req: WorkflowRequest.GetAllActive) => {
const activeWorkflows = await this.activeWorkflowRunner.getActiveWorkflows(req.user);
return activeWorkflows.map(({ id }) => id);
return this.activeWorkflowRunner.getActiveWorkflows(req.user);
}),
);

Expand Down
1 change: 1 addition & 0 deletions packages/cli/src/UserManagement/PermissionChecker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export class PermissionChecker {
const workflowSharings = await Db.collections.SharedWorkflow.find({
relations: ['workflow'],
where: { workflowId: workflow.id },
select: ['userId'],
});
workflowUserIds = workflowSharings.map((s) => s.userId);
}
Expand Down
18 changes: 8 additions & 10 deletions packages/cli/src/WorkflowExecuteAdditionalData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -610,16 +610,14 @@ function hookFunctionsSave(parentProcessMode?: string): IWorkflowExecuteHooks {
(workflowDidSucceed && saveDataSuccessExecution === 'none') ||
(!workflowDidSucceed && saveDataErrorExecution === 'none')
) {
if (!fullRunData.waitTill) {
if (!isManualMode) {
executeErrorWorkflow(
this.workflowData,
fullRunData,
this.mode,
this.executionId,
this.retryOf,
);
}
if (!fullRunData.waitTill && !isManualMode) {
executeErrorWorkflow(
this.workflowData,
fullRunData,
this.mode,
this.executionId,
this.retryOf,
);
// Data is always saved, so we remove from database
await Db.collections.Execution.delete(this.executionId);
await BinaryDataManager.getInstance().markDataForDeletionByExecutionId(
Expand Down
23 changes: 23 additions & 0 deletions packages/cli/src/commands/BaseCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { LoadNodesAndCredentials } from '@/LoadNodesAndCredentials';
import type { IExternalHooksClass } from '@/Interfaces';
import { InternalHooks } from '@/InternalHooks';
import { PostHogClient } from '@/posthog';
import { License } from '@/License';

export const UM_FIX_INSTRUCTION =
'Please fix the database by running ./packages/cli/bin/n8n user-management:reset';
Expand Down Expand Up @@ -119,6 +120,28 @@ export abstract class BaseCommand extends Command {
await this.externalHooks.init();
}

async initLicense(): Promise<void> {
const license = Container.get(License);
await license.init(this.instanceId);

const activationKey = config.getEnv('license.activationKey');

if (activationKey) {
const hasCert = (await license.loadCertStr()).length > 0;

if (hasCert) {
return LoggerProxy.debug('Skipping license activation');
}

try {
LoggerProxy.debug('Attempting license activation');
await license.activate(activationKey);
} catch (e) {
LoggerProxy.error('Could not activate license', e as Error);
}
}
}

async finally(error: Error | undefined) {
if (inTest || this.id === 'start') return;
if (Db.connectionState.connected) {
Expand Down
23 changes: 0 additions & 23 deletions packages/cli/src/commands/start.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ import { EDITOR_UI_DIST_DIR, GENERATED_STATIC_DIR } from '@/constants';
import { eventBus } from '@/eventbus';
import { BaseCommand } from './BaseCommand';
import { InternalHooks } from '@/InternalHooks';
import { License } from '@/License';

// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-var-requires
const open = require('open');
Expand Down Expand Up @@ -186,28 +185,6 @@ export class Start extends BaseCommand {
await Promise.all(files.map(compileFile));
}

async initLicense(): Promise<void> {
const license = Container.get(License);
await license.init(this.instanceId);

const activationKey = config.getEnv('license.activationKey');

if (activationKey) {
const hasCert = (await license.loadCertStr()).length > 0;

if (hasCert) {
return LoggerProxy.debug('Skipping license activation');
}

try {
LoggerProxy.debug('Attempting license activation');
await license.activate(activationKey);
} catch (e) {
LoggerProxy.error('Could not activate license', e as Error);
}
}
}

async init() {
await this.initCrashJournal();

Expand Down
1 change: 1 addition & 0 deletions packages/cli/src/commands/webhook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ export class Webhook extends BaseCommand {
await this.initCrashJournal();
await super.init();

await this.initLicense();
await this.initBinaryManager();
await this.initExternalHooks();
}
Expand Down
1 change: 1 addition & 0 deletions packages/cli/src/commands/worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ export class Worker extends BaseCommand {
await super.init();
this.logger.debug('Starting n8n worker...');

await this.initLicense();
await this.initBinaryManager();
await this.initExternalHooks();
}
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/controllers/auth.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export class AuthController {
user = preliminaryUser;
usedAuthenticationMethod = 'email';
} else {
throw new AuthError('SAML is enabled, please log in with SAML');
throw new AuthError('SSO is enabled, please log in with SSO');
}
} else if (isLdapCurrentAuthenticationMethod()) {
user = await handleLdapLogin(email, password);
Expand Down
2 changes: 1 addition & 1 deletion packages/editor-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
},
"scripts": {
"clean": "rimraf dist .turbo",
"build": "cross-env VUE_APP_PUBLIC_PATH=\"/{{BASE_PATH}}/\" NODE_OPTIONS=\"--max-old-space-size=8192\" vite build",
"build": "cross-env VUE_APP_PUBLIC_PATH=\"/{{BASE_PATH}}/\" NODE_OPTIONS=\"--max-old-space-size=12288\" vite build",
"typecheck": "vue-tsc --emitDeclarationOnly",
"dev": "pnpm serve",
"lint": "eslint --quiet --ext .js,.ts,.vue src",
Expand Down
1 change: 1 addition & 0 deletions packages/editor-ui/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ export default defineComponent({
message: this.$locale.baseText('startupError.message'),
type: 'error',
duration: 0,
dangerouslyUseHTMLString: true,
});

throw e;
Expand Down
2 changes: 2 additions & 0 deletions packages/editor-ui/src/__tests__/server/endpoints/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@ import { routesForCredentials } from './credential';
import { routesForCredentialTypes } from './credentialType';
import { routesForVariables } from './variable';
import { routesForSettings } from './settings';
import { routesForSSO } from './sso';

const endpoints: Array<(server: Server) => void> = [
routesForCredentials,
routesForCredentialTypes,
routesForUsers,
routesForVariables,
routesForSettings,
routesForSSO,
];

export { endpoints };
36 changes: 36 additions & 0 deletions packages/editor-ui/src/__tests__/server/endpoints/sso.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import type { Server, Request } from 'miragejs';
import { Response } from 'miragejs';
import type { SamlPreferences, SamlPreferencesExtractedData } from '@/Interface';
import { faker } from '@faker-js/faker';
import type { AppSchema } from '@/__tests__/server/types';
import { jsonParse } from 'n8n-workflow';

let samlConfig: SamlPreferences & SamlPreferencesExtractedData = {
metadata: '<?xml version="1.0"?>',
metadataUrl: '',
entityID: faker.internet.url(),
returnUrl: faker.internet.url(),
};

export function routesForSSO(server: Server) {
server.get('/rest/sso/saml/config', () => {
return new Response(200, {}, { data: samlConfig });
});

server.post('/rest/sso/saml/config', (schema: AppSchema, request: Request) => {
const requestBody = jsonParse(request.requestBody) as Partial<
SamlPreferences & SamlPreferencesExtractedData
>;

samlConfig = {
...samlConfig,
...requestBody,
};

return new Response(200, {}, { data: samlConfig });
});

server.get('/rest/sso/saml/config/test', () => {
return new Response(200, {}, { data: '<?xml version="1.0"?>' });
});
}
2 changes: 1 addition & 1 deletion packages/editor-ui/src/__tests__/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { UserManagementAuthenticationMethod } from '@/Interface';
import { render } from '@testing-library/vue';
import { PiniaVuePlugin } from 'pinia';

export const retry = async (assertion: () => any, { interval = 20, timeout = 200 } = {}) => {
export const retry = async (assertion: () => any, { interval = 20, timeout = 1000 } = {}) => {
return new Promise((resolve, reject) => {
const startTime = Date.now();

Expand Down
1 change: 1 addition & 0 deletions packages/editor-ui/src/components/ParameterInputFull.vue
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@ export default defineComponent({
title: this.$locale.baseText('dataMapping.success.title'),
message: this.$locale.baseText('dataMapping.success.moreInfo'),
type: 'success',
dangerouslyUseHTMLString: true,
});

this.ndvStore.disableMappingHint();
Expand Down
1 change: 1 addition & 0 deletions packages/editor-ui/src/components/WorkflowActivator.vue
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ export default defineComponent({
message: errorMessage,
type: 'warning',
duration: 0,
dangerouslyUseHTMLString: true,
});
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,7 @@ export default defineComponent({
cancelButtonText: this.$locale.baseText(
'workflows.shareModal.list.delete.confirm.cancelButtonText',
),
dangerouslyUseHTMLString: true,
},
);

Expand Down
2 changes: 2 additions & 0 deletions packages/editor-ui/src/composables/useToast.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ export function useToast() {
customClass?: string;
closeOnClick?: boolean;
type?: MessageType;
dangerouslyUseHTMLString?: boolean;
}) {
// eslint-disable-next-line prefer-const
let notification: ElNotificationComponent;
Expand All @@ -80,6 +81,7 @@ export function useToast() {
duration: config.duration,
customClass: config.customClass,
type: config.type,
dangerouslyUseHTMLString: config.dangerouslyUseHTMLString ?? true,
});

return notification;
Expand Down
Loading