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

Enable esModuleInterop compiler option #3106

Merged
merged 9 commits into from
Apr 8, 2022
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
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
2 changes: 1 addition & 1 deletion packages/cli/commands/execute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import {
} from '../src';

import { getLogger } from '../src/Logger';
import config = require('../config');
import config from '../config';
import { getInstanceOwner } from '../src/UserManagement/UserManagementHelper';

export class Execute extends Command {
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/commands/executeBatch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/* eslint-disable no-param-reassign */
/* eslint-disable @typescript-eslint/unbound-method */
/* eslint-disable no-console */
import * as fs from 'fs';
import fs from 'fs';
import { Command, flags } from '@oclif/command';

import { BinaryDataManager, IBinaryDataConfig, UserSettings } from 'n8n-core';
Expand Down Expand Up @@ -36,7 +36,7 @@ import {
NodeTypes,
WorkflowRunner,
} from '../src';
import config = require('../config');
import config from '../config';
import { User } from '../src/databases/entities/User';
import { getInstanceOwner } from '../src/UserManagement/UserManagementHelper';

Expand Down
4 changes: 2 additions & 2 deletions packages/cli/commands/export/credentials.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import { Credentials, UserSettings } from 'n8n-core';

import { IDataObject, LoggerProxy } from 'n8n-workflow';

import * as fs from 'fs';
import * as path from 'path';
import fs from 'fs';
import path from 'path';
import { getLogger } from '../../src/Logger';
import { Db, ICredentialsDecryptedDb } from '../../src';

Expand Down
4 changes: 2 additions & 2 deletions packages/cli/commands/export/workflow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { Command, flags } from '@oclif/command';

import { IDataObject, LoggerProxy } from 'n8n-workflow';

import * as fs from 'fs';
import * as path from 'path';
import fs from 'fs';
import path from 'path';
import { getLogger } from '../../src/Logger';
import { Db } from '../../src';

Expand Down
6 changes: 3 additions & 3 deletions packages/cli/commands/import/credentials.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ import { Credentials, UserSettings } from 'n8n-core';

import { LoggerProxy } from 'n8n-workflow';

import * as fs from 'fs';
import * as glob from 'fast-glob';
import * as path from 'path';
import fs from 'fs';
import glob from 'fast-glob';
import path from 'path';
import { EntityManager, getConnection } from 'typeorm';
import { getLogger } from '../../src/Logger';
import { Db } from '../../src';
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/commands/import/workflow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import { Command, flags } from '@oclif/command';

import { INode, INodeCredentialsDetails, LoggerProxy } from 'n8n-workflow';

import * as fs from 'fs';
import * as glob from 'fast-glob';
import fs from 'fs';
import glob from 'fast-glob';
import { UserSettings } from 'n8n-core';
import { EntityManager, getConnection } from 'typeorm';
import { getLogger } from '../../src/Logger';
Expand Down
6 changes: 3 additions & 3 deletions packages/cli/commands/start.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
/* eslint-disable no-console */
/* eslint-disable @typescript-eslint/no-unsafe-call */
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
import * as localtunnel from 'localtunnel';
import localtunnel from 'localtunnel';
import { BinaryDataManager, IBinaryDataConfig, TUNNEL_SUBDOMAIN_ENV, UserSettings } from 'n8n-core';
import { Command, flags } from '@oclif/command';
// eslint-disable-next-line import/no-extraneous-dependencies
import * as Redis from 'ioredis';
import Redis from 'ioredis';

import { IDataObject, LoggerProxy } from 'n8n-workflow';
import { createHash } from 'crypto';
import * as config from '../config';
import config from '../config';
import {
ActiveExecutions,
ActiveWorkflowRunner,
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/commands/webhook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
import { BinaryDataManager, IBinaryDataConfig, UserSettings } from 'n8n-core';
import { Command, flags } from '@oclif/command';
// eslint-disable-next-line import/no-extraneous-dependencies
import * as Redis from 'ioredis';
import Redis from 'ioredis';

import { IDataObject, LoggerProxy } from 'n8n-workflow';
import * as config from '../config';
import config from '../config';
import {
ActiveExecutions,
ActiveWorkflowRunner,
Expand Down
10 changes: 5 additions & 5 deletions packages/cli/commands/worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
/* eslint-disable @typescript-eslint/restrict-template-expressions */
/* eslint-disable @typescript-eslint/no-unused-vars */
// eslint-disable-next-line import/no-extraneous-dependencies
import * as express from 'express';
import * as http from 'http';
import * as PCancelable from 'p-cancelable';
import express from 'express';
import http from 'http';
import PCancelable = require('p-cancelable');
ivov marked this conversation as resolved.
Show resolved Hide resolved

import { Command, flags } from '@oclif/command';
import { BinaryDataManager, IBinaryDataConfig, UserSettings, WorkflowExecute } from 'n8n-core';
Expand All @@ -18,7 +18,7 @@ import { IExecuteResponsePromiseData, INodeTypes, IRun, Workflow, LoggerProxy }

import { FindOneOptions, getConnectionManager } from 'typeorm';

import * as Bull from 'bull';
import Bull from 'bull';
import {
CredentialsOverwrites,
CredentialTypes,
Expand All @@ -39,7 +39,7 @@ import {

import { getLogger } from '../src/Logger';

import * as config from '../config';
import config from '../config';
import * as Queue from '../src/Queue';
import {
checkPermissionsForExecution,
Expand Down
10 changes: 5 additions & 5 deletions packages/cli/config/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/* eslint-disable no-console */
/* eslint-disable no-restricted-syntax */
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
import * as convict from 'convict';
import * as dotenv from 'dotenv';
import * as path from 'path';
import convict from 'convict';
import dotenv from 'dotenv';
import path from 'path';
import * as core from 'n8n-core';

dotenv.config();
Expand Down Expand Up @@ -674,7 +674,7 @@ const config = convict({
nodes: {
include: {
doc: 'Nodes to load',
format: function check(rawValue) {
format: function check(rawValue: string): void {
if (rawValue === '') {
return;
}
Expand All @@ -698,7 +698,7 @@ const config = convict({
},
exclude: {
doc: 'Nodes not to load',
format: function check(rawValue) {
format: function check(rawValue: string): void {
try {
const values = JSON.parse(rawValue);
if (!Array.isArray(values)) {
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/migrations/ormconfig.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as path from 'path';
import path from 'path';
import { UserSettings } from 'n8n-core';
import { entities } from '../src/databases/entities';

Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/ActiveExecutions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
import { ChildProcess } from 'child_process';
import { stringify } from 'flatted';
// eslint-disable-next-line import/no-extraneous-dependencies
import * as PCancelable from 'p-cancelable';
import PCancelable = require('p-cancelable');
ivov marked this conversation as resolved.
Show resolved Hide resolved
// eslint-disable-next-line import/no-cycle
import {
Db,
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/ActiveWorkflowRunner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import {
LoggerProxy as Logger,
} from 'n8n-workflow';

import * as express from 'express';
import express from 'express';

// eslint-disable-next-line import/no-cycle
import {
Expand All @@ -48,7 +48,7 @@ import {
WorkflowRunner,
ExternalHooks,
} from '.';
import config = require('../config');
import config from '../config';
import { User } from './databases/entities/User';
import { whereClause } from './WorkflowHelpers';
import { WorkflowEntity } from './databases/entities/WorkflowEntity';
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/Db.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
Repository,
} from 'typeorm';
import { TlsOptions } from 'tls';
import * as path from 'path';
import path from 'path';
// eslint-disable-next-line import/no-cycle
import { DatabaseType, GenericHelpers, IDatabaseCollections } from '.';

Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/GenericHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/* eslint-disable no-param-reassign */
/* eslint-disable no-underscore-dangle */
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
import * as express from 'express';
import express from 'express';
import { join as pathJoin } from 'path';
import { readFile as fsReadFile } from 'fs/promises';
import { IDataObject } from 'n8n-workflow';
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/Interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import {
import { WorkflowExecute } from 'n8n-core';

// eslint-disable-next-line import/no-extraneous-dependencies
import * as PCancelable from 'p-cancelable';
import PCancelable = require('p-cancelable');
import { Repository } from 'typeorm';

import { ChildProcess } from 'child_process';
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/LoadNodesAndCredentials.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ import {
readFile as fsReadFile,
stat as fsStat,
} from 'fs/promises';
import * as glob from 'fast-glob';
import * as path from 'path';
import glob from 'fast-glob';
import path from 'path';
import { getLogger } from './Logger';
import * as config from '../config';

Expand Down
6 changes: 3 additions & 3 deletions packages/cli/src/Logger.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
import * as winston from 'winston';
import winston from 'winston';

import { IDataObject, ILogger, LogTypes } from 'n8n-workflow';

import * as callsites from 'callsites';
import callsites from 'callsites';
import { basename } from 'path';
import config = require('../config');
import * as config from '../config';
ivov marked this conversation as resolved.
Show resolved Hide resolved

class Logger implements ILogger {
private logger: winston.Logger;
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/Push.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/* eslint-disable @typescript-eslint/no-unsafe-call */
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
// @ts-ignore
import * as sseChannel from 'sse-channel';
import * as express from 'express';
import sseChannel from 'sse-channel';
import express from 'express';

import { LoggerProxy as Logger } from 'n8n-workflow';
// eslint-disable-next-line import/no-cycle
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/Queue.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
import * as Bull from 'bull';
import Bull from 'bull';
import * as config from '../config';
// eslint-disable-next-line import/no-cycle
import { IBullJobData, IBullWebhookResponse } from './Interfaces';
Expand Down
39 changes: 18 additions & 21 deletions packages/cli/src/Server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@
/* eslint-disable import/no-dynamic-require */
/* eslint-disable no-await-in-loop */

import * as express from 'express';
import express from 'express';
import { readFileSync } from 'fs';
import { readFile } from 'fs/promises';
import { cloneDeep } from 'lodash';
import _, { cloneDeep } from 'lodash';
import { dirname as pathDirname, join as pathJoin, resolve as pathResolve } from 'path';
import {
FindConditions,
Expand All @@ -46,22 +46,19 @@ import {
Not,
Raw,
} from 'typeorm';
import * as bodyParser from 'body-parser';
import * as cookieParser from 'cookie-parser';
import * as history from 'connect-history-api-fallback';
import * as os from 'os';
import bodyParser from 'body-parser';
import cookieParser from 'cookie-parser';
import history from 'connect-history-api-fallback';
import os from 'os';
// eslint-disable-next-line import/no-extraneous-dependencies
import * as _ from 'lodash';
import * as clientOAuth2 from 'client-oauth2';
import * as clientOAuth1 from 'oauth-1.0a';
import { RequestOptions } from 'oauth-1.0a';
import * as csrf from 'csrf';
import * as requestPromise from 'request-promise-native';
import clientOAuth2 from 'client-oauth2';
import clientOAuth1, { RequestOptions } from 'oauth-1.0a';
import csrf from 'csrf';
import requestPromise = require('request-promise-native');
ivov marked this conversation as resolved.
Show resolved Hide resolved
import { createHmac } from 'crypto';
// IMPORTANT! Do not switch to anther bcrypt library unless really necessary and
// tested with all possible systems like Windows, Alpine on ARM, FreeBSD, ...
import { compare } from 'bcryptjs';
import * as promClient from 'prom-client';

import {
BinaryDataManager,
Expand Down Expand Up @@ -90,16 +87,16 @@ import {
WorkflowExecuteMode,
} from 'n8n-workflow';

import * as basicAuth from 'basic-auth';
import * as compression from 'compression';
import * as jwt from 'jsonwebtoken';
import * as jwks from 'jwks-rsa';
import basicAuth from 'basic-auth';
import compression from 'compression';
import jwt from 'jsonwebtoken';
import jwks from 'jwks-rsa';
// @ts-ignore
import * as timezones from 'google-timezones-json';
import * as parseUrl from 'parseurl';
import * as querystring from 'querystring';
import timezones from 'google-timezones-json';
import parseUrl from 'parseurl';
import querystring from 'querystring';
import { OptionsWithUrl } from 'request-promise-native';
import { Registry } from 'prom-client';
import promClient, { Registry } from 'prom-client';
import * as Queue from './Queue';
import {
ActiveExecutions,
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/TestWebhooks.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable consistent-return */
/* eslint-disable @typescript-eslint/no-non-null-assertion */
/* eslint-disable no-param-reassign */
import * as express from 'express';
import express from 'express';

import { ActiveWebhooks } from 'n8n-core';

Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/UserManagement/UserManagementHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
/* eslint-disable import/no-cycle */
import { Workflow } from 'n8n-workflow';
import { In, IsNull, Not } from 'typeorm';
import express = require('express');
import express from 'express';
import { compare } from 'bcryptjs';

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 config = require('../../config');
import * as config from '../../config';
import { getWebhookBaseUrl } from '../WebhookHelpers';

export async function getWorkflowOwner(workflowId: string | number): Promise<User> {
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/UserManagement/auth/jwt.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
/* eslint-disable @typescript-eslint/no-non-null-assertion */
/* eslint-disable import/no-cycle */

import * as jwt from 'jsonwebtoken';
import jwt from 'jsonwebtoken';
import { Response } from 'express';
import { createHash } from 'crypto';
import { Db } from '../..';
import { AUTH_COOKIE_NAME } from '../../constants';
import { JwtToken, JwtPayload } from '../Interfaces';
import { User } from '../../databases/entities/User';
import config = require('../../../config');
import * as config from '../../../config';

export function issueJWT(user: User): JwtToken {
const { id, email, password } = user;
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/UserManagement/email/NodeMailer.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
import { createTransport, Transporter } from 'nodemailer';
import { LoggerProxy as Logger } from 'n8n-workflow';
import config = require('../../../config');
import * as config from '../../../config';
import { MailData, SendEmailResult, UserManagementMailerImplementation } from './Interfaces';

export class NodeMailer implements UserManagementMailerImplementation {
Expand Down
Loading