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:
committed by
GitHub
parent
de96def372
commit
698d96a617
@@ -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 : [];
|
||||
|
||||
Reference in New Issue
Block a user