Skip to content

Commit

Permalink
⚡ Enable esModuleInterop compiler option and upgrade to TypeScript …
Browse files Browse the repository at this point in the history
…4.6 (#3106)

* ⚡ Enable `esModuleInterop` for /core

* ⚡ Adjust imports in /core

* ⚡ Enable `esModuleInterop` for /cli

* ⚡ Adjust imports in /cli

* ⚡ Enable `esModuleInterop` for /nodes-base

* ⚡ Adjust imports in /nodes-base

* ⚡ Make imports consistent

* ⬆️ Upgrade TypeScript to 4.6 (#3109)

* ⬆️ Upgrade TypeScript to 4.6

* 📦 Update package-lock.json

* 🔧 Avoid erroring on untyped errors

* 📘 Fix type error

Co-authored-by: Jan Oberhauser <jan.oberhauser@gmail.com>
  • Loading branch information
ivov and janober committed Apr 8, 2022
1 parent 37a6e32 commit 027dfb2
Show file tree
Hide file tree
Showing 198 changed files with 1,034 additions and 1,169 deletions.
1,433 changes: 575 additions & 858 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/cli/commands/execute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,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, 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, 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, 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 from 'p-cancelable';

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
5 changes: 2 additions & 3 deletions packages/cli/config/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
/* eslint-disable @typescript-eslint/unbound-method */
/* eslint-disable no-console */

import * as convict from 'convict';
import * as dotenv from 'dotenv';
import convict from 'convict';
import dotenv from 'dotenv';
import { schema } from './schema';

dotenv.config();
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/config/schema.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable no-restricted-syntax */
/* eslint-disable @typescript-eslint/no-unsafe-assignment */

import * as path from 'path';
import path from 'path';
import * as core from 'n8n-core';

export const schema = {
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/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
"ts-jest": "^27.1.3",
"ts-node": "^8.9.1",
"tslint": "^6.1.2",
"typescript": "~4.3.5"
"typescript": "~4.6.0"
},
"dependencies": {
"@oclif/command": "^1.5.18",
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 from 'p-cancelable';
// 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
4 changes: 2 additions & 2 deletions packages/cli/src/Db.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ 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 '.';

import * as config from '../config';
import config from '../config';

// eslint-disable-next-line import/no-cycle
import { entities } from './databases/entities';
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/ExternalHooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// eslint-disable-next-line import/no-cycle
import { Db, IExternalHooksClass, IExternalHooksFileData, IExternalHooksFunctions } from '.';

import * as config from '../config';
import config from '../config';

class ExternalHooksClass implements IExternalHooksClass {
externalHooks: {
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/src/GenericHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
/* 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';
import { validate } from 'class-validator';
import * as config from '../config';
import config from '../config';

// eslint-disable-next-line import/no-cycle
import { Db, ICredentialsDb, IPackageVersions, ResponseHelper } from '.';
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 from 'p-cancelable';
import { Repository } from 'typeorm';

import { ChildProcess } from 'child_process';
Expand Down
6 changes: 3 additions & 3 deletions packages/cli/src/LoadNodesAndCredentials.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ 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';
import config from '../config';

const CUSTOM_NODES_CATEGORY = 'Custom Nodes';

Expand Down
6 changes: 3 additions & 3 deletions packages/cli/src/Logger.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/* eslint-disable @typescript-eslint/no-shadow */
/* 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 config from '../config';

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
4 changes: 2 additions & 2 deletions packages/cli/src/Queue.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
import * as Bull from 'bull';
import * as config from '../config';
import Bull from 'bull';
import config from '../config';
// eslint-disable-next-line import/no-cycle
import { IBullJobData, IBullWebhookResponse } from './Interfaces';
// eslint-disable-next-line import/no-cycle
Expand Down
42 changes: 19 additions & 23 deletions packages/cli/src/Server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,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 @@ -47,22 +47,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, { OptionsWithUrl } from 'request-promise-native';
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 @@ -91,16 +88,15 @@ 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 { OptionsWithUrl } from 'request-promise-native';
import { Registry } from 'prom-client';
import timezones from 'google-timezones-json';
import parseUrl from 'parseurl';
import querystring from 'querystring';
import promClient, { Registry } from 'prom-client';
import * as Queue from './Queue';
import {
ActiveExecutions,
Expand Down Expand Up @@ -143,7 +139,7 @@ import {
getCredentialForUser,
} from '.';

import * as config from '../config';
import config from '../config';

import * as TagHelpers from './TagHelpers';

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
Loading

0 comments on commit 027dfb2

Please sign in to comment.