refactor(core): Move interrelated entities to @n8n/db (#15050)

This commit is contained in:
Iván Ovejero
2025-05-02 12:19:32 +02:00
committed by GitHub
parent 88afd66471
commit 20834abb56
270 changed files with 699 additions and 566 deletions

View File

@@ -23,11 +23,14 @@
"dependencies": { "dependencies": {
"@n8n/config": "workspace:^", "@n8n/config": "workspace:^",
"@n8n/di": "workspace:^", "@n8n/di": "workspace:^",
"@n8n/permissions": "workspace:^",
"@n8n/typeorm": "catalog:", "@n8n/typeorm": "catalog:",
"class-validator": "0.14.0",
"n8n-core": "workspace:^", "n8n-core": "workspace:^",
"n8n-workflow": "workspace:^", "n8n-workflow": "workspace:^",
"nanoid": "catalog:", "nanoid": "catalog:",
"reflect-metadata": "catalog:" "reflect-metadata": "catalog:",
"xss": "catalog:"
}, },
"devDependencies": { "devDependencies": {
"@n8n/typescript-config": "workspace:*" "@n8n/typescript-config": "workspace:*"

View File

@@ -1,7 +1,7 @@
import { JsonColumn, WithTimestampsAndStringId } from '@n8n/db';
import type { ApiKeyScope } from '@n8n/permissions'; import type { ApiKeyScope } from '@n8n/permissions';
import { Column, Entity, Index, ManyToOne, Unique } from '@n8n/typeorm'; import { Column, Entity, Index, ManyToOne, Unique } from '@n8n/typeorm';
import { JsonColumn, WithTimestampsAndStringId } from './abstract-entity';
import { User } from './user'; import { User } from './user';
@Entity('user_api_keys') @Entity('user_api_keys')

View File

@@ -1,10 +1,9 @@
import { WithTimestamps } from '@n8n/db';
import { Column, Entity, ManyToOne, PrimaryColumn, Unique } from '@n8n/typeorm'; import { Column, Entity, ManyToOne, PrimaryColumn, Unique } from '@n8n/typeorm';
import { WithTimestamps } from './abstract-entity';
import { AuthProviderType } from './types-db';
import { User } from './user'; import { User } from './user';
export type AuthProviderType = 'ldap' | 'email' | 'saml'; // | 'google';
@Entity() @Entity()
@Unique(['providerId', 'providerType']) @Unique(['providerId', 'providerType'])
export class AuthIdentity extends WithTimestamps { export class AuthIdentity extends WithTimestamps {

View File

@@ -1,10 +1,9 @@
import { WithTimestampsAndStringId } from '@n8n/db';
import { Column, Entity, Index, OneToMany } from '@n8n/typeorm'; import { Column, Entity, Index, OneToMany } from '@n8n/typeorm';
import { IsObject, IsString, Length } from 'class-validator'; import { IsObject, IsString, Length } from 'class-validator';
import type { ICredentialsDb } from '@/types-db'; import { WithTimestampsAndStringId } from './abstract-entity';
import type { SharedCredentials } from './shared-credentials'; import type { SharedCredentials } from './shared-credentials';
import type { ICredentialsDb } from './types-db';
@Entity() @Entity()
export class CredentialsEntity extends WithTimestampsAndStringId implements ICredentialsDb { export class CredentialsEntity extends WithTimestampsAndStringId implements ICredentialsDb {

View File

@@ -1,4 +1,3 @@
import { WithTimestampsAndStringId } from '@n8n/db';
import { import {
Column, Column,
Entity, Entity,
@@ -9,14 +8,10 @@ import {
OneToMany, OneToMany,
} from '@n8n/typeorm'; } from '@n8n/typeorm';
import { WithTimestampsAndStringId } from './abstract-entity';
import { Project } from './project'; import { Project } from './project';
import { TagEntity } from './tag-entity'; import { TagEntity } from './tag-entity';
import { type WorkflowEntity } from './workflow-entity'; import type { WorkflowEntity } from './workflow-entity';
export type FolderWithWorkflowAndSubFolderCount = Folder & {
workflowCount: boolean;
subFolderCount: number;
};
@Entity() @Entity()
export class Folder extends WithTimestampsAndStringId { export class Folder extends WithTimestampsAndStringId {

View File

@@ -1,11 +1,25 @@
import { ApiKey } from './api-key';
import { AuthIdentity } from './auth-identity';
import { CredentialsEntity } from './credentials-entity';
import { EventDestinations } from './event-destinations'; import { EventDestinations } from './event-destinations';
import { Folder } from './folder';
import { FolderTagMapping } from './folder-tag-mapping';
import { InstalledNodes } from './installed-nodes'; import { InstalledNodes } from './installed-nodes';
import { InstalledPackages } from './installed-packages'; import { InstalledPackages } from './installed-packages';
import { InvalidAuthToken } from './invalid-auth-token'; import { InvalidAuthToken } from './invalid-auth-token';
import { ProcessedData } from './processed-data'; import { ProcessedData } from './processed-data';
import { Project } from './project';
import { ProjectRelation } from './project-relation';
import { Settings } from './settings'; import { Settings } from './settings';
import { SharedCredentials } from './shared-credentials';
import { SharedWorkflow } from './shared-workflow';
import { TagEntity } from './tag-entity';
import { User } from './user';
import { Variables } from './variables'; import { Variables } from './variables';
import { WebhookEntity } from './webhook-entity'; import { WebhookEntity } from './webhook-entity';
import { WorkflowEntity } from './workflow-entity';
import { WorkflowStatistics } from './workflow-statistics';
import { WorkflowTagMapping } from './workflow-tag-mapping';
export { export {
EventDestinations, EventDestinations,
@@ -15,5 +29,19 @@ export {
ProcessedData, ProcessedData,
Settings, Settings,
Variables, Variables,
ApiKey,
WebhookEntity, WebhookEntity,
AuthIdentity,
CredentialsEntity,
Folder,
Project,
ProjectRelation,
SharedCredentials,
SharedWorkflow,
TagEntity,
User,
WorkflowEntity,
WorkflowStatistics,
WorkflowTagMapping,
FolderTagMapping,
}; };

View File

@@ -1,14 +1,13 @@
import { ProjectRole } from '@n8n/api-types';
import { WithTimestamps } from '@n8n/db';
import { Column, Entity, ManyToOne, PrimaryColumn } from '@n8n/typeorm'; import { Column, Entity, ManyToOne, PrimaryColumn } from '@n8n/typeorm';
import { WithTimestamps } from './abstract-entity';
import { Project } from './project'; import { Project } from './project';
import { User } from './user'; import { User } from './user';
@Entity() @Entity()
export class ProjectRelation extends WithTimestamps { export class ProjectRelation extends WithTimestamps {
@Column({ type: 'varchar' }) @Column({ type: 'varchar' })
role: ProjectRole; role: 'project:personalOwner' | 'project:admin' | 'project:editor' | 'project:viewer';
@ManyToOne('User', 'projectRelations') @ManyToOne('User', 'projectRelations')
user: User; user: User;

View File

@@ -1,7 +1,6 @@
import { ProjectIcon, ProjectType } from '@n8n/api-types';
import { WithTimestampsAndStringId } from '@n8n/db';
import { Column, Entity, OneToMany } from '@n8n/typeorm'; import { Column, Entity, OneToMany } from '@n8n/typeorm';
import { WithTimestampsAndStringId } from './abstract-entity';
import type { ProjectRelation } from './project-relation'; import type { ProjectRelation } from './project-relation';
import type { SharedCredentials } from './shared-credentials'; import type { SharedCredentials } from './shared-credentials';
import type { SharedWorkflow } from './shared-workflow'; import type { SharedWorkflow } from './shared-workflow';
@@ -12,10 +11,10 @@ export class Project extends WithTimestampsAndStringId {
name: string; name: string;
@Column({ type: 'varchar', length: 36 }) @Column({ type: 'varchar', length: 36 })
type: ProjectType; type: 'personal' | 'team';
@Column({ type: 'json', nullable: true }) @Column({ type: 'json', nullable: true })
icon: ProjectIcon; icon: { type: 'emoji' | 'icon'; value: string } | null;
@OneToMany('ProjectRelation', 'project') @OneToMany('ProjectRelation', 'project')
projectRelations: ProjectRelation[]; projectRelations: ProjectRelation[];

View File

@@ -1,10 +1,9 @@
import { WithTimestamps } from '@n8n/db';
import { Column, Entity, ManyToOne, PrimaryColumn } from '@n8n/typeorm'; import { Column, Entity, ManyToOne, PrimaryColumn } from '@n8n/typeorm';
import { WithTimestamps } from './abstract-entity';
import { CredentialsEntity } from './credentials-entity'; import { CredentialsEntity } from './credentials-entity';
import { Project } from './project'; import { Project } from './project';
import { CredentialSharingRole } from './types-db';
export type CredentialSharingRole = 'credential:owner' | 'credential:user';
@Entity() @Entity()
export class SharedCredentials extends WithTimestamps { export class SharedCredentials extends WithTimestamps {

View File

@@ -1,11 +1,10 @@
import { WithTimestamps } from '@n8n/db';
import { Column, Entity, ManyToOne, PrimaryColumn } from '@n8n/typeorm'; import { Column, Entity, ManyToOne, PrimaryColumn } from '@n8n/typeorm';
import { WithTimestamps } from './abstract-entity';
import { Project } from './project'; import { Project } from './project';
import { WorkflowSharingRole } from './types-db';
import { WorkflowEntity } from './workflow-entity'; import { WorkflowEntity } from './workflow-entity';
export type WorkflowSharingRole = 'workflow:owner' | 'workflow:editor';
@Entity() @Entity()
export class SharedWorkflow extends WithTimestamps { export class SharedWorkflow extends WithTimestamps {
@Column() @Column()

View File

@@ -1,7 +1,7 @@
import { WithTimestampsAndStringId } from '@n8n/db';
import { Column, Entity, Index, ManyToMany, OneToMany } from '@n8n/typeorm'; import { Column, Entity, Index, ManyToMany, OneToMany } from '@n8n/typeorm';
import { IsString, Length } from 'class-validator'; import { IsString, Length } from 'class-validator';
import { WithTimestampsAndStringId } from './abstract-entity';
import type { FolderTagMapping } from './folder-tag-mapping'; import type { FolderTagMapping } from './folder-tag-mapping';
import type { WorkflowEntity } from './workflow-entity'; import type { WorkflowEntity } from './workflow-entity';
import type { WorkflowTagMapping } from './workflow-tag-mapping'; import type { WorkflowTagMapping } from './workflow-tag-mapping';

View File

@@ -12,15 +12,14 @@ import type {
IUser, IUser,
} from 'n8n-workflow'; } from 'n8n-workflow';
import type { AuthProviderType } from '@/databases/entities/auth-identity'; import type { CredentialsEntity } from './credentials-entity';
import type { CredentialsEntity } from '@/databases/entities/credentials-entity'; import type { Folder } from './folder';
import type { Folder } from '@/databases/entities/folder'; import type { Project } from './project';
import type { Project } from '@/databases/entities/project'; import type { SharedCredentials } from './shared-credentials';
import type { SharedCredentials } from '@/databases/entities/shared-credentials'; import type { SharedWorkflow } from './shared-workflow';
import type { SharedWorkflow } from '@/databases/entities/shared-workflow'; import type { TagEntity } from './tag-entity';
import type { TagEntity } from '@/databases/entities/tag-entity'; import type { User } from './user';
import type { User } from '@/databases/entities/user'; import type { WorkflowEntity } from './workflow-entity';
import type { WorkflowEntity } from '@/databases/entities/workflow-entity';
export type UsageCount = { export type UsageCount = {
usageCount: number; usageCount: number;
@@ -260,3 +259,22 @@ export namespace ListQueryDb {
type SlimUser = Pick<IUser, 'id' | 'email' | 'firstName' | 'lastName'>; type SlimUser = Pick<IUser, 'id' | 'email' | 'firstName' | 'lastName'>;
export type ScopesField = { scopes: Scope[] }; export type ScopesField = { scopes: Scope[] };
export const enum StatisticsNames {
productionSuccess = 'production_success',
productionError = 'production_error',
manualSuccess = 'manual_success',
manualError = 'manual_error',
dataLoaded = 'data_loaded',
}
export type CredentialSharingRole = 'credential:owner' | 'credential:user';
export type WorkflowSharingRole = 'workflow:owner' | 'workflow:editor';
export type AuthProviderType = 'ldap' | 'email' | 'saml'; // | 'google';
export type FolderWithWorkflowAndSubFolderCount = Folder & {
workflowCount: boolean;
subFolderCount: number;
};

View File

@@ -1,5 +1,5 @@
import { JsonColumn, WithTimestamps, objectRetriever, lowerCaser } from '@n8n/db';
import { hasScope, type ScopeOptions, type Scope, GlobalRole } from '@n8n/permissions'; import { hasScope, type ScopeOptions, type Scope, GlobalRole } from '@n8n/permissions';
import { GLOBAL_OWNER_SCOPES, GLOBAL_MEMBER_SCOPES, GLOBAL_ADMIN_SCOPES } from '@n8n/permissions';
import { import {
AfterLoad, AfterLoad,
AfterUpdate, AfterUpdate,
@@ -14,20 +14,16 @@ import {
import { IsEmail, IsString, Length } from 'class-validator'; import { IsEmail, IsString, Length } from 'class-validator';
import type { IUser, IUserSettings } from 'n8n-workflow'; import type { IUser, IUserSettings } from 'n8n-workflow';
import { import { JsonColumn, WithTimestamps } from './abstract-entity';
GLOBAL_OWNER_SCOPES,
GLOBAL_MEMBER_SCOPES,
GLOBAL_ADMIN_SCOPES,
} from '@/permissions.ee/global-roles';
import type { IPersonalizationSurveyAnswers } from '@/types-db';
import { NoUrl } from '@/validators/no-url.validator';
import { NoXss } from '@/validators/no-xss.validator';
import type { ApiKey } from './api-key'; import type { ApiKey } from './api-key';
import type { AuthIdentity } from './auth-identity'; import type { AuthIdentity } from './auth-identity';
import type { ProjectRelation } from './project-relation'; import type { ProjectRelation } from './project-relation';
import type { SharedCredentials } from './shared-credentials'; import type { SharedCredentials } from './shared-credentials';
import type { SharedWorkflow } from './shared-workflow'; import type { SharedWorkflow } from './shared-workflow';
import type { IPersonalizationSurveyAnswers } from './types-db';
import { lowerCaser, objectRetriever } from '../utils/transformers';
import { NoUrl } from '../utils/validators/no-url.validator';
import { NoXss } from '../utils/validators/no-xss.validator';
const STATIC_SCOPE_MAP: Record<GlobalRole, Scope[]> = { const STATIC_SCOPE_MAP: Record<GlobalRole, Scope[]> = {
'global:owner': GLOBAL_OWNER_SCOPES, 'global:owner': GLOBAL_OWNER_SCOPES,

View File

@@ -1,4 +1,3 @@
import { JsonColumn, WithTimestampsAndStringId, dbType, objectRetriever, sqlite } from '@n8n/db';
import { import {
Column, Column,
Entity, Entity,
@@ -13,13 +12,14 @@ import { Length } from 'class-validator';
import { IConnections, IDataObject, IWorkflowSettings, WorkflowFEMeta } from 'n8n-workflow'; import { IConnections, IDataObject, IWorkflowSettings, WorkflowFEMeta } from 'n8n-workflow';
import type { IBinaryKeyData, INode, IPairedItemData } from 'n8n-workflow'; import type { IBinaryKeyData, INode, IPairedItemData } from 'n8n-workflow';
import type { IWorkflowDb } from '@/types-db'; import { JsonColumn, WithTimestampsAndStringId, dbType } from './abstract-entity';
import { type Folder } from './folder'; import { type Folder } from './folder';
import type { SharedWorkflow } from './shared-workflow'; import type { SharedWorkflow } from './shared-workflow';
import type { TagEntity } from './tag-entity'; import type { TagEntity } from './tag-entity';
import type { IWorkflowDb } from './types-db';
import type { WorkflowStatistics } from './workflow-statistics'; import type { WorkflowStatistics } from './workflow-statistics';
import type { WorkflowTagMapping } from './workflow-tag-mapping'; import type { WorkflowTagMapping } from './workflow-tag-mapping';
import { objectRetriever, sqlite } from '../utils/transformers';
@Entity() @Entity()
export class WorkflowEntity extends WithTimestampsAndStringId implements IWorkflowDb { export class WorkflowEntity extends WithTimestampsAndStringId implements IWorkflowDb {

View File

@@ -1,16 +1,9 @@
import { DateTimeColumn } from '@n8n/db';
import { Column, Entity, ManyToOne, PrimaryColumn } from '@n8n/typeorm'; import { Column, Entity, ManyToOne, PrimaryColumn } from '@n8n/typeorm';
import { DateTimeColumn } from './abstract-entity';
import { StatisticsNames } from './types-db';
import { WorkflowEntity } from './workflow-entity'; import { WorkflowEntity } from './workflow-entity';
export const enum StatisticsNames {
productionSuccess = 'production_success',
productionError = 'production_error',
manualSuccess = 'manual_success',
manualError = 'manual_error',
dataLoaded = 'data_loaded',
}
@Entity() @Entity()
export class WorkflowStatistics { export class WorkflowStatistics {
@Column() @Column()

View File

@@ -14,13 +14,5 @@ export { isStringArray } from './utils/is-string-array';
export { separate } from './utils/separate'; export { separate } from './utils/separate';
export { idStringifier, lowerCaser, objectRetriever, sqlite } from './utils/transformers'; export { idStringifier, lowerCaser, objectRetriever, sqlite } from './utils/transformers';
export { export * from './entities';
EventDestinations, export * from './entities/types-db';
InstalledNodes,
InstalledPackages,
InvalidAuthToken,
ProcessedData,
Settings,
Variables,
WebhookEntity,
} from './entities';

View File

@@ -0,0 +1,27 @@
import { validate } from 'class-validator';
import { NoUrl } from '../no-url.validator';
describe('NoUrl', () => {
class Entity {
@NoUrl()
name = '';
}
const entity = new Entity();
describe('URLs', () => {
const URLS = ['http://google.com', 'www.domain.tld', 'n8n.io'];
for (const str of URLS) {
test(`should block ${str}`, async () => {
entity.name = str;
const errors = await validate(entity);
expect(errors).toHaveLength(1);
const [error] = errors;
expect(error.property).toEqual('name');
expect(error.constraints).toEqual({ NoUrl: 'Potentially malicious string' });
});
}
});
});

View File

@@ -0,0 +1,118 @@
import { validate } from 'class-validator';
import { NoXss } from '../no-xss.validator';
describe('NoXss', () => {
class Entity {
@NoXss()
name = '';
@NoXss()
timestamp = '';
@NoXss()
version = '';
@NoXss({ each: true })
categories: string[] = [];
}
const entity = new Entity();
describe('Scripts', () => {
// eslint-disable-next-line n8n-local-rules/no-unneeded-backticks
const XSS_STRINGS = ['<script src/>', "<script>alert('xss')</script>", `<a href="#">Jack</a>`];
for (const str of XSS_STRINGS) {
test(`should block ${str}`, async () => {
entity.name = str;
const errors = await validate(entity);
expect(errors).toHaveLength(1);
const [error] = errors;
expect(error.property).toEqual('name');
expect(error.constraints).toEqual({ NoXss: 'Potentially malicious string' });
});
}
});
describe('Names', () => {
const VALID_NAMES = [
'Johann Strauß',
'Вагиф Сәмәдоғлу',
'René Magritte',
'সুকুমার রায়',
'མགོན་པོ་རྡོ་རྗེ།',
'عبدالحليم حافظ',
];
for (const name of VALID_NAMES) {
test(`should allow ${name}`, async () => {
entity.name = name;
await expect(validate(entity)).resolves.toHaveLength(0);
});
}
});
describe('ISO-8601 timestamps', () => {
const VALID_TIMESTAMPS = ['2022-01-01T00:00:00.000Z', '2022-01-01T00:00:00.000+02:00'];
for (const timestamp of VALID_TIMESTAMPS) {
test(`should allow ${timestamp}`, async () => {
entity.timestamp = timestamp;
await expect(validate(entity)).resolves.toHaveLength(0);
});
}
});
describe('Semver versions', () => {
const VALID_VERSIONS = ['1.0.0', '1.0.0-alpha.1'];
for (const version of VALID_VERSIONS) {
test(`should allow ${version}`, async () => {
entity.version = version;
await expect(validate(entity)).resolves.toHaveLength(0);
});
}
});
describe('Miscellaneous strings', () => {
const VALID_MISCELLANEOUS_STRINGS = ['CI/CD'];
for (const str of VALID_MISCELLANEOUS_STRINGS) {
test(`should allow ${str}`, async () => {
entity.name = str;
await expect(validate(entity)).resolves.toHaveLength(0);
});
}
});
describe('Array of strings', () => {
const VALID_STRING_ARRAYS = [
['cloud-infrastructure-orchestration', 'ci-cd', 'reporting'],
['automationGoalDevops', 'cloudComputing', 'containerization'],
];
for (const arr of VALID_STRING_ARRAYS) {
test(`should allow array: ${JSON.stringify(arr)}`, async () => {
entity.categories = arr;
await expect(validate(entity)).resolves.toHaveLength(0);
});
}
const INVALID_STRING_ARRAYS = [
['valid-string', '<script>alert("xss")</script>', 'another-valid-string'],
['<img src="x" onerror="alert(\'XSS\')">', 'valid-string'],
];
for (const arr of INVALID_STRING_ARRAYS) {
test(`should reject array containing invalid string: ${JSON.stringify(arr)}`, async () => {
entity.categories = arr;
const errors = await validate(entity);
expect(errors).toHaveLength(1);
const [error] = errors;
expect(error.property).toEqual('categories');
expect(error.constraints).toEqual({ NoXss: 'Potentially malicious string' });
});
}
});
});

View File

@@ -0,0 +1,27 @@
import type { ValidationOptions, ValidatorConstraintInterface } from 'class-validator';
import { registerDecorator, ValidatorConstraint } from 'class-validator';
const URL_REGEX = /^(https?:\/\/|www\.)|(\.[\p{L}\d-]+)/iu;
@ValidatorConstraint({ name: 'NoUrl', async: false })
class NoUrlConstraint implements ValidatorConstraintInterface {
validate(value: string) {
return !URL_REGEX.test(value);
}
defaultMessage() {
return 'Potentially malicious string';
}
}
export function NoUrl(options?: ValidationOptions) {
return function (object: object, propertyName: string) {
registerDecorator({
name: 'NoUrl',
target: object.constructor,
propertyName,
options,
validator: NoUrlConstraint,
});
};
}

View File

@@ -0,0 +1,33 @@
import type { ValidationOptions, ValidatorConstraintInterface } from 'class-validator';
import { registerDecorator, ValidatorConstraint } from 'class-validator';
import xss from 'xss';
@ValidatorConstraint({ name: 'NoXss', async: false })
class NoXssConstraint implements ValidatorConstraintInterface {
validate(value: unknown) {
if (typeof value !== 'string') return false;
return (
value ===
xss(value, {
whiteList: {}, // no tags are allowed
})
);
}
defaultMessage() {
return 'Potentially malicious string';
}
}
export function NoXss(options?: ValidationOptions) {
return function (object: object, propertyName: string) {
registerDecorator({
name: 'NoXss',
target: object.constructor,
propertyName,
options,
validator: NoXssConstraint,
});
};
}

View File

@@ -1,4 +1,4 @@
import type { Scope } from '@n8n/permissions'; import type { Scope } from './types.ee';
export const GLOBAL_OWNER_SCOPES: Scope[] = [ export const GLOBAL_OWNER_SCOPES: Scope[] = [
'annotationTag:create', 'annotationTag:create',

View File

@@ -2,3 +2,6 @@ export type * from './types.ee';
export * from './constants.ee'; export * from './constants.ee';
export * from './hasScope.ee'; export * from './hasScope.ee';
export * from './combineScopes.ee'; export * from './combineScopes.ee';
export * from './global-roles.ee';
export * from './project-roles.ee';
export * from './resource-roles.ee';

View File

@@ -1,4 +1,4 @@
import type { Scope } from '@n8n/permissions'; import type { Scope } from './types.ee';
/** /**
* Diff between admin in personal project and admin in other projects: * Diff between admin in personal project and admin in other projects:

View File

@@ -1,4 +1,4 @@
import type { Scope } from '@n8n/permissions'; import type { Scope } from './types.ee';
export const CREDENTIALS_SHARING_OWNER_SCOPES: Scope[] = [ export const CREDENTIALS_SHARING_OWNER_SCOPES: Scope[] = [
'credential:read', 'credential:read',

View File

@@ -1,3 +1,4 @@
import type { WorkflowEntity } from '@n8n/db';
import { mock } from 'jest-mock-extended'; import { mock } from 'jest-mock-extended';
import type { InstanceSettings } from 'n8n-core'; import type { InstanceSettings } from 'n8n-core';
import type { import type {
@@ -10,7 +11,6 @@ import type {
import { Workflow } from 'n8n-workflow'; import { Workflow } from 'n8n-workflow';
import { ActiveWorkflowManager } from '@/active-workflow-manager'; import { ActiveWorkflowManager } from '@/active-workflow-manager';
import type { WorkflowEntity } from '@/databases/entities/workflow-entity';
import type { WorkflowRepository } from '@/databases/repositories/workflow.repository'; import type { WorkflowRepository } from '@/databases/repositories/workflow.repository';
import type { NodeTypes } from '@/node-types'; import type { NodeTypes } from '@/node-types';

View File

@@ -1,8 +1,7 @@
import type { Project } from '@n8n/db';
import { nanoId, date, firstName, lastName, email } from 'minifaker'; import { nanoId, date, firstName, lastName, email } from 'minifaker';
import 'minifaker/locales/en'; import 'minifaker/locales/en';
import type { Project } from '@/databases/entities/project';
type RawProjectData = Pick<Project, 'name' | 'type' | 'createdAt' | 'updatedAt' | 'id'>; type RawProjectData = Pick<Project, 'name' | 'type' | 'createdAt' | 'updatedAt' | 'id'>;
const projectName = `${firstName()} ${lastName()} <${email}>`; const projectName = `${firstName()} ${lastName()} <${email}>`;

View File

@@ -1,14 +1,14 @@
import type { Project } from '@n8n/db';
import type { IExecutionResponse } from '@n8n/db';
import { mock } from 'jest-mock-extended'; import { mock } from 'jest-mock-extended';
import type { InstanceSettings } from 'n8n-core'; import type { InstanceSettings } from 'n8n-core';
import type { IRun, IWorkflowBase } from 'n8n-workflow'; import type { IRun, IWorkflowBase } from 'n8n-workflow';
import { createDeferredPromise } from 'n8n-workflow'; import { createDeferredPromise } from 'n8n-workflow';
import type { ActiveExecutions } from '@/active-executions'; import type { ActiveExecutions } from '@/active-executions';
import type { Project } from '@/databases/entities/project';
import type { ExecutionRepository } from '@/databases/repositories/execution.repository'; import type { ExecutionRepository } from '@/databases/repositories/execution.repository';
import type { MultiMainSetup } from '@/scaling/multi-main-setup.ee'; import type { MultiMainSetup } from '@/scaling/multi-main-setup.ee';
import type { OwnershipService } from '@/services/ownership.service'; import type { OwnershipService } from '@/services/ownership.service';
import type { IExecutionResponse } from '@/types-db';
import { WaitTracker } from '@/wait-tracker'; import { WaitTracker } from '@/wait-tracker';
import type { WorkflowRunner } from '@/workflow-runner'; import type { WorkflowRunner } from '@/workflow-runner';
import { mockLogger } from '@test/mocking'; import { mockLogger } from '@test/mocking';

View File

@@ -1,4 +1,5 @@
import { GlobalConfig } from '@n8n/config'; import { GlobalConfig } from '@n8n/config';
import type { WorkflowEntity } from '@n8n/db';
import { Container } from '@n8n/di'; import { Container } from '@n8n/di';
import { mock } from 'jest-mock-extended'; import { mock } from 'jest-mock-extended';
import type { IWorkflowBase } from 'n8n-workflow'; import type { IWorkflowBase } from 'n8n-workflow';
@@ -13,7 +14,6 @@ import type PCancelable from 'p-cancelable';
import { ActiveExecutions } from '@/active-executions'; import { ActiveExecutions } from '@/active-executions';
import { CredentialsHelper } from '@/credentials-helper'; import { CredentialsHelper } from '@/credentials-helper';
import type { WorkflowEntity } from '@/databases/entities/workflow-entity';
import { ExecutionRepository } from '@/databases/repositories/execution.repository'; import { ExecutionRepository } from '@/databases/repositories/execution.repository';
import { WorkflowRepository } from '@/databases/repositories/workflow.repository'; import { WorkflowRepository } from '@/databases/repositories/workflow.repository';
import { VariablesService } from '@/environments.ee/variables/variables.service.ee'; import { VariablesService } from '@/environments.ee/variables/variables.service.ee';

View File

@@ -1,3 +1,4 @@
import type { User } from '@n8n/db';
import { Container } from '@n8n/di'; import { Container } from '@n8n/di';
import { mock } from 'jest-mock-extended'; import { mock } from 'jest-mock-extended';
import { DirectedGraph, WorkflowExecute } from 'n8n-core'; import { DirectedGraph, WorkflowExecute } from 'n8n-core';
@@ -20,7 +21,6 @@ import PCancelable from 'p-cancelable';
import { ActiveExecutions } from '@/active-executions'; import { ActiveExecutions } from '@/active-executions';
import config from '@/config'; import config from '@/config';
import type { ExecutionEntity } from '@/databases/entities/execution-entity'; import type { ExecutionEntity } from '@/databases/entities/execution-entity';
import type { User } from '@/databases/entities/user';
import { ExecutionNotFoundError } from '@/errors/execution-not-found-error'; import { ExecutionNotFoundError } from '@/errors/execution-not-found-error';
import { CredentialsPermissionChecker } from '@/executions/pre-execution-checks'; import { CredentialsPermissionChecker } from '@/executions/pre-execution-checks';
import { ManualExecutionService } from '@/manual-execution.service'; import { ManualExecutionService } from '@/manual-execution.service';

View File

@@ -1,3 +1,4 @@
import type { CreateExecutionPayload, IExecutionDb } from '@n8n/db';
import { Service } from '@n8n/di'; import { Service } from '@n8n/di';
import { Logger } from 'n8n-core'; import { Logger } from 'n8n-core';
import type { import type {
@@ -18,7 +19,6 @@ import { isWorkflowIdValid } from '@/utils';
import { ConcurrencyControlService } from './concurrency/concurrency-control.service'; import { ConcurrencyControlService } from './concurrency/concurrency-control.service';
import config from './config'; import config from './config';
import type { CreateExecutionPayload, IExecutionDb } from './types-db';
@Service() @Service()
export class ActiveExecutions { export class ActiveExecutions {

View File

@@ -1,5 +1,6 @@
/* eslint-disable @typescript-eslint/no-unsafe-member-access */ /* eslint-disable @typescript-eslint/no-unsafe-member-access */
import { WorkflowsConfig } from '@n8n/config'; import { WorkflowsConfig } from '@n8n/config';
import type { WorkflowEntity, IWorkflowDb } from '@n8n/db';
import { OnLeaderStepdown, OnLeaderTakeover, OnShutdown } from '@n8n/decorators'; import { OnLeaderStepdown, OnLeaderTakeover, OnShutdown } from '@n8n/decorators';
import { Service } from '@n8n/di'; import { Service } from '@n8n/di';
import { chunk } from 'lodash'; import { chunk } from 'lodash';
@@ -41,7 +42,6 @@ import {
WORKFLOW_REACTIVATE_INITIAL_TIMEOUT, WORKFLOW_REACTIVATE_INITIAL_TIMEOUT,
WORKFLOW_REACTIVATE_MAX_TIMEOUT, WORKFLOW_REACTIVATE_MAX_TIMEOUT,
} from '@/constants'; } from '@/constants';
import type { WorkflowEntity } from '@/databases/entities/workflow-entity';
import { WorkflowRepository } from '@/databases/repositories/workflow.repository'; import { WorkflowRepository } from '@/databases/repositories/workflow.repository';
import { executeErrorWorkflow } from '@/execution-lifecycle/execute-error-workflow'; import { executeErrorWorkflow } from '@/execution-lifecycle/execute-error-workflow';
import { ExecutionService } from '@/executions/execution.service'; import { ExecutionService } from '@/executions/execution.service';
@@ -50,7 +50,6 @@ import { NodeTypes } from '@/node-types';
import { Publisher } from '@/scaling/pubsub/publisher.service'; import { Publisher } from '@/scaling/pubsub/publisher.service';
import { ActiveWorkflowsService } from '@/services/active-workflows.service'; import { ActiveWorkflowsService } from '@/services/active-workflows.service';
import { OrchestrationService } from '@/services/orchestration.service'; import { OrchestrationService } from '@/services/orchestration.service';
import type { IWorkflowDb } from '@/types-db';
import * as WebhookHelpers from '@/webhooks/webhook-helpers'; import * as WebhookHelpers from '@/webhooks/webhook-helpers';
import { WebhookService } from '@/webhooks/webhook.service'; import { WebhookService } from '@/webhooks/webhook.service';
import * as WorkflowExecuteAdditionalData from '@/workflow-execute-additional-data'; import * as WorkflowExecuteAdditionalData from '@/workflow-execute-additional-data';

View File

@@ -1,4 +1,5 @@
import type { GlobalConfig } from '@n8n/config'; import type { GlobalConfig } from '@n8n/config';
import type { User } from '@n8n/db';
import type { NextFunction, Response } from 'express'; import type { NextFunction, Response } from 'express';
import { mock } from 'jest-mock-extended'; import { mock } from 'jest-mock-extended';
import jwt from 'jsonwebtoken'; import jwt from 'jsonwebtoken';
@@ -6,7 +7,6 @@ import jwt from 'jsonwebtoken';
import { AuthService } from '@/auth/auth.service'; import { AuthService } from '@/auth/auth.service';
import config from '@/config'; import config from '@/config';
import { AUTH_COOKIE_NAME, Time } from '@/constants'; import { AUTH_COOKIE_NAME, Time } from '@/constants';
import type { User } from '@/databases/entities/user';
import type { InvalidAuthTokenRepository } from '@/databases/repositories/invalid-auth-token.repository'; import type { InvalidAuthTokenRepository } from '@/databases/repositories/invalid-auth-token.repository';
import type { UserRepository } from '@/databases/repositories/user.repository'; import type { UserRepository } from '@/databases/repositories/user.repository';
import type { AuthenticatedRequest } from '@/requests'; import type { AuthenticatedRequest } from '@/requests';

View File

@@ -1,4 +1,5 @@
import { GlobalConfig } from '@n8n/config'; import { GlobalConfig } from '@n8n/config';
import type { User } from '@n8n/db';
import { Service } from '@n8n/di'; import { Service } from '@n8n/di';
import { createHash } from 'crypto'; import { createHash } from 'crypto';
import type { NextFunction, Response } from 'express'; import type { NextFunction, Response } from 'express';
@@ -7,7 +8,6 @@ import { Logger } from 'n8n-core';
import config from '@/config'; import config from '@/config';
import { AUTH_COOKIE_NAME, RESPONSE_ERROR_MESSAGES, Time } from '@/constants'; import { AUTH_COOKIE_NAME, RESPONSE_ERROR_MESSAGES, Time } from '@/constants';
import type { User } from '@/databases/entities/user';
import { InvalidAuthTokenRepository } from '@/databases/repositories/invalid-auth-token.repository'; import { InvalidAuthTokenRepository } from '@/databases/repositories/invalid-auth-token.repository';
import { UserRepository } from '@/databases/repositories/user.repository'; import { UserRepository } from '@/databases/repositories/user.repository';
import { AuthError } from '@/errors/response-errors/auth.error'; import { AuthError } from '@/errors/response-errors/auth.error';

View File

@@ -1,8 +1,7 @@
import type { User } from '@n8n/db';
import { Container } from '@n8n/di'; import { Container } from '@n8n/di';
import type { Response } from 'express'; import type { Response } from 'express';
import type { User } from '@/databases/entities/user';
import { AuthService } from './auth.service'; import { AuthService } from './auth.service';
// This method is still used by cloud hooks. // This method is still used by cloud hooks.

View File

@@ -1,6 +1,6 @@
import type { User } from '@n8n/db';
import { Container } from '@n8n/di'; import { Container } from '@n8n/di';
import type { User } from '@/databases/entities/user';
import { UserRepository } from '@/databases/repositories/user.repository'; import { UserRepository } from '@/databases/repositories/user.repository';
import { AuthError } from '@/errors/response-errors/auth.error'; import { AuthError } from '@/errors/response-errors/auth.error';
import { EventService } from '@/events/event.service'; import { EventService } from '@/events/event.service';

View File

@@ -1,6 +1,6 @@
import type { User } from '@n8n/db';
import { Container } from '@n8n/di'; import { Container } from '@n8n/di';
import type { User } from '@/databases/entities/user';
import { EventService } from '@/events/event.service'; import { EventService } from '@/events/event.service';
import { import {
createLdapUserOnLocalDb, createLdapUserOnLocalDb,

View File

@@ -1,11 +1,11 @@
import type { PushPayload } from '@n8n/api-types'; import type { PushPayload } from '@n8n/api-types';
import type { User } from '@n8n/db';
import { Service } from '@n8n/di'; import { Service } from '@n8n/di';
import { ErrorReporter } from 'n8n-core'; import { ErrorReporter } from 'n8n-core';
import type { Workflow } from 'n8n-workflow'; import type { Workflow } from 'n8n-workflow';
import { UnexpectedError } from 'n8n-workflow'; import { UnexpectedError } from 'n8n-workflow';
import { CollaborationState } from '@/collaboration/collaboration.state'; import { CollaborationState } from '@/collaboration/collaboration.state';
import type { User } from '@/databases/entities/user';
import { UserRepository } from '@/databases/repositories/user.repository'; import { UserRepository } from '@/databases/repositories/user.repository';
import { Push } from '@/push'; import { Push } from '@/push';
import type { OnPushMessage } from '@/push/types'; import type { OnPushMessage } from '@/push/types';

View File

@@ -1,9 +1,9 @@
import type { Iso8601DateTimeString } from '@n8n/api-types'; import type { Iso8601DateTimeString } from '@n8n/api-types';
import type { User } from '@n8n/db';
import { Service } from '@n8n/di'; import { Service } from '@n8n/di';
import type { Workflow } from 'n8n-workflow'; import type { Workflow } from 'n8n-workflow';
import { Time } from '@/constants'; import { Time } from '@/constants';
import type { User } from '@/databases/entities/user';
import { CacheService } from '@/services/cache/cache.service'; import { CacheService } from '@/services/cache/cache.service';
type WorkflowCacheHash = Record<User['id'], Iso8601DateTimeString>; type WorkflowCacheHash = Record<User['id'], Iso8601DateTimeString>;

View File

@@ -1,10 +1,9 @@
import { type InstalledNodes } from '@n8n/db'; import { type InstalledNodes } from '@n8n/db';
import { type CredentialsEntity } from '@n8n/db';
import { type User } from '@n8n/db';
import { type Config } from '@oclif/core'; import { type Config } from '@oclif/core';
import { mock } from 'jest-mock-extended'; import { mock } from 'jest-mock-extended';
import { type CredentialsEntity } from '@/databases/entities/credentials-entity';
import { type User } from '@/databases/entities/user';
import { CommunityNode } from '../community-node'; import { CommunityNode } from '../community-node';
describe('uninstallCredential', () => { describe('uninstallCredential', () => {

View File

@@ -1,9 +1,8 @@
import { type InstalledNodes, type InstalledPackages } from '@n8n/db'; import { type InstalledNodes, type InstalledPackages, type User } from '@n8n/db';
import { Container } from '@n8n/di'; import { Container } from '@n8n/di';
import { Flags } from '@oclif/core'; import { Flags } from '@oclif/core';
import { CredentialsService } from '@/credentials/credentials.service'; import { CredentialsService } from '@/credentials/credentials.service';
import { type User } from '@/databases/entities/user';
import { CredentialsRepository } from '@/databases/repositories/credentials.repository'; import { CredentialsRepository } from '@/databases/repositories/credentials.repository';
import { InstalledNodesRepository } from '@/databases/repositories/installed-nodes.repository'; import { InstalledNodesRepository } from '@/databases/repositories/installed-nodes.repository';
import { UserRepository } from '@/databases/repositories/user.repository'; import { UserRepository } from '@/databases/repositories/user.repository';

View File

@@ -1,4 +1,5 @@
/* eslint-disable @typescript-eslint/no-loop-func */ /* eslint-disable @typescript-eslint/no-loop-func */
import type { User } from '@n8n/db';
import { Container } from '@n8n/di'; import { Container } from '@n8n/di';
import { Flags } from '@oclif/core'; import { Flags } from '@oclif/core';
import fs from 'fs'; import fs from 'fs';
@@ -10,7 +11,6 @@ import os from 'os';
import { sep } from 'path'; import { sep } from 'path';
import { ActiveExecutions } from '@/active-executions'; import { ActiveExecutions } from '@/active-executions';
import type { User } from '@/databases/entities/user';
import { WorkflowRepository } from '@/databases/repositories/workflow.repository'; import { WorkflowRepository } from '@/databases/repositories/workflow.repository';
import { OwnershipService } from '@/services/ownership.service'; import { OwnershipService } from '@/services/ownership.service';
import { findCliWorkflowStart } from '@/utils'; import { findCliWorkflowStart } from '@/utils';

View File

@@ -1,3 +1,4 @@
import type { ICredentialsDb } from '@n8n/db';
import { Container } from '@n8n/di'; import { Container } from '@n8n/di';
import { Flags } from '@oclif/core'; import { Flags } from '@oclif/core';
import fs from 'fs'; import fs from 'fs';
@@ -7,7 +8,6 @@ import path from 'path';
import { CredentialsRepository } from '@/databases/repositories/credentials.repository'; import { CredentialsRepository } from '@/databases/repositories/credentials.repository';
import type { ICredentialsDecryptedDb } from '@/interfaces'; import type { ICredentialsDecryptedDb } from '@/interfaces';
import type { ICredentialsDb } from '@/types-db';
import { BaseCommand } from '../base-command'; import { BaseCommand } from '../base-command';

View File

@@ -1,3 +1,4 @@
import { CredentialsEntity, Project, User, SharedCredentials } from '@n8n/db';
import { Container } from '@n8n/di'; import { Container } from '@n8n/di';
// eslint-disable-next-line n8n-local-rules/misplaced-n8n-typeorm-import // eslint-disable-next-line n8n-local-rules/misplaced-n8n-typeorm-import
import type { EntityManager } from '@n8n/typeorm'; import type { EntityManager } from '@n8n/typeorm';
@@ -9,10 +10,6 @@ import type { ICredentialsEncrypted } from 'n8n-workflow';
import { jsonParse, UserError } from 'n8n-workflow'; import { jsonParse, UserError } from 'n8n-workflow';
import { UM_FIX_INSTRUCTION } from '@/constants'; import { UM_FIX_INSTRUCTION } from '@/constants';
import { CredentialsEntity } from '@/databases/entities/credentials-entity';
import { Project } from '@/databases/entities/project';
import { SharedCredentials } from '@/databases/entities/shared-credentials';
import { User } from '@/databases/entities/user';
import { ProjectRepository } from '@/databases/repositories/project.repository'; import { ProjectRepository } from '@/databases/repositories/project.repository';
import * as Db from '@/db'; import * as Db from '@/db';

View File

@@ -1,4 +1,5 @@
import { generateNanoId } from '@n8n/db'; import { generateNanoId } from '@n8n/db';
import type { WorkflowEntity } from '@n8n/db';
import { Container } from '@n8n/di'; import { Container } from '@n8n/di';
import { Flags } from '@oclif/core'; import { Flags } from '@oclif/core';
import glob from 'fast-glob'; import glob from 'fast-glob';
@@ -7,7 +8,6 @@ import type { IWorkflowBase, WorkflowId } from 'n8n-workflow';
import { jsonParse, UserError } from 'n8n-workflow'; import { jsonParse, UserError } from 'n8n-workflow';
import { UM_FIX_INSTRUCTION } from '@/constants'; import { UM_FIX_INSTRUCTION } from '@/constants';
import type { WorkflowEntity } from '@/databases/entities/workflow-entity';
import { ProjectRepository } from '@/databases/repositories/project.repository'; import { ProjectRepository } from '@/databases/repositories/project.repository';
import { SharedWorkflowRepository } from '@/databases/repositories/shared-workflow.repository'; import { SharedWorkflowRepository } from '@/databases/repositories/shared-workflow.repository';
import { UserRepository } from '@/databases/repositories/user.repository'; import { UserRepository } from '@/databases/repositories/user.repository';

View File

@@ -1,7 +1,7 @@
import type { CredentialsEntity } from '@n8n/db';
import { User } from '@n8n/db';
import { Container } from '@n8n/di'; import { Container } from '@n8n/di';
import type { CredentialsEntity } from '@/databases/entities/credentials-entity';
import { User } from '@/databases/entities/user';
import { CredentialsRepository } from '@/databases/repositories/credentials.repository'; import { CredentialsRepository } from '@/databases/repositories/credentials.repository';
import { ProjectRepository } from '@/databases/repositories/project.repository'; import { ProjectRepository } from '@/databases/repositories/project.repository';
import { SettingsRepository } from '@/databases/repositories/settings.repository'; import { SettingsRepository } from '@/databases/repositories/settings.repository';

View File

@@ -1,8 +1,8 @@
import type { User } from '@n8n/db';
import type { ApiKey } from '@n8n/db';
import { Container } from '@n8n/di'; import { Container } from '@n8n/di';
import { mock } from 'jest-mock-extended'; import { mock } from 'jest-mock-extended';
import type { ApiKey } from '@/databases/entities/api-key';
import type { User } from '@/databases/entities/user';
import { EventService } from '@/events/event.service'; import { EventService } from '@/events/event.service';
import type { AuthenticatedRequest } from '@/requests'; import type { AuthenticatedRequest } from '@/requests';
import { PublicApiKeyService } from '@/services/public-api-key.service'; import { PublicApiKeyService } from '@/services/public-api-key.service';

View File

@@ -1,4 +1,5 @@
import type { LoginRequestDto } from '@n8n/api-types'; import type { LoginRequestDto } from '@n8n/api-types';
import type { User } from '@n8n/db';
import { Container } from '@n8n/di'; import { Container } from '@n8n/di';
import type { Response } from 'express'; import type { Response } from 'express';
import { mock } from 'jest-mock-extended'; import { mock } from 'jest-mock-extended';
@@ -7,7 +8,6 @@ import { Logger } from 'n8n-core';
import * as auth from '@/auth'; import * as auth from '@/auth';
import { AuthService } from '@/auth/auth.service'; import { AuthService } from '@/auth/auth.service';
import config from '@/config'; import config from '@/config';
import type { User } from '@/databases/entities/user';
import { UserRepository } from '@/databases/repositories/user.repository'; import { UserRepository } from '@/databases/repositories/user.repository';
import { EventService } from '@/events/event.service'; import { EventService } from '@/events/event.service';
import { License } from '@/license'; import { License } from '@/license';

View File

@@ -1,4 +1,6 @@
import { UserUpdateRequestDto } from '@n8n/api-types'; import { UserUpdateRequestDto } from '@n8n/api-types';
import type { User } from '@n8n/db';
import type { PublicUser } from '@n8n/db';
import { Container } from '@n8n/di'; import { Container } from '@n8n/di';
import type { Response } from 'express'; import type { Response } from 'express';
import { mock, anyObject } from 'jest-mock-extended'; import { mock, anyObject } from 'jest-mock-extended';
@@ -6,7 +8,6 @@ import jwt from 'jsonwebtoken';
import { AUTH_COOKIE_NAME } from '@/constants'; import { AUTH_COOKIE_NAME } from '@/constants';
import { MeController } from '@/controllers/me.controller'; import { MeController } from '@/controllers/me.controller';
import type { User } from '@/databases/entities/user';
import { AuthUserRepository } from '@/databases/repositories/auth-user.repository'; import { AuthUserRepository } from '@/databases/repositories/auth-user.repository';
import { InvalidAuthTokenRepository } from '@/databases/repositories/invalid-auth-token.repository'; import { InvalidAuthTokenRepository } from '@/databases/repositories/invalid-auth-token.repository';
import { UserRepository } from '@/databases/repositories/user.repository'; import { UserRepository } from '@/databases/repositories/user.repository';
@@ -18,7 +19,6 @@ import { License } from '@/license';
import { MfaService } from '@/mfa/mfa.service'; import { MfaService } from '@/mfa/mfa.service';
import type { AuthenticatedRequest, MeRequest } from '@/requests'; import type { AuthenticatedRequest, MeRequest } from '@/requests';
import { UserService } from '@/services/user.service'; import { UserService } from '@/services/user.service';
import type { PublicUser } from '@/types-db';
import { mockInstance } from '@test/mocking'; import { mockInstance } from '@test/mocking';
import { badPasswords } from '@test/test-data'; import { badPasswords } from '@test/test-data';

View File

@@ -1,4 +1,6 @@
import type { DismissBannerRequestDto, OwnerSetupRequestDto } from '@n8n/api-types'; import type { DismissBannerRequestDto, OwnerSetupRequestDto } from '@n8n/api-types';
import type { User } from '@n8n/db';
import type { PublicUser } from '@n8n/db';
import type { Response } from 'express'; import type { Response } from 'express';
import { mock } from 'jest-mock-extended'; import { mock } from 'jest-mock-extended';
import type { Logger } from 'n8n-core'; import type { Logger } from 'n8n-core';
@@ -6,7 +8,6 @@ import type { Logger } from 'n8n-core';
import type { AuthService } from '@/auth/auth.service'; import type { AuthService } from '@/auth/auth.service';
import config from '@/config'; import config from '@/config';
import { OwnerController } from '@/controllers/owner.controller'; import { OwnerController } from '@/controllers/owner.controller';
import type { User } from '@/databases/entities/user';
import type { SettingsRepository } from '@/databases/repositories/settings.repository'; import type { SettingsRepository } from '@/databases/repositories/settings.repository';
import type { UserRepository } from '@/databases/repositories/user.repository'; import type { UserRepository } from '@/databases/repositories/user.repository';
import { BadRequestError } from '@/errors/response-errors/bad-request.error'; import { BadRequestError } from '@/errors/response-errors/bad-request.error';
@@ -14,7 +15,6 @@ import type { EventService } from '@/events/event.service';
import type { AuthenticatedRequest } from '@/requests'; import type { AuthenticatedRequest } from '@/requests';
import type { PasswordUtility } from '@/services/password.utility'; import type { PasswordUtility } from '@/services/password.utility';
import type { UserService } from '@/services/user.service'; import type { UserService } from '@/services/user.service';
import type { PublicUser } from '@/types-db';
describe('OwnerController', () => { describe('OwnerController', () => {
const configGetSpy = jest.spyOn(config, 'getEnv'); const configGetSpy = jest.spyOn(config, 'getEnv');

View File

@@ -1,6 +1,6 @@
import type { User } from '@n8n/db';
import { mock } from 'jest-mock-extended'; import { mock } from 'jest-mock-extended';
import type { User } from '@/databases/entities/user';
import type { UserRepository } from '@/databases/repositories/user.repository'; import type { UserRepository } from '@/databases/repositories/user.repository';
import type { EventService } from '@/events/event.service'; import type { EventService } from '@/events/event.service';
import type { AuthenticatedRequest } from '@/requests'; import type { AuthenticatedRequest } from '@/requests';

View File

@@ -1,4 +1,5 @@
import { LoginRequestDto, ResolveSignupTokenQueryDto } from '@n8n/api-types'; import { LoginRequestDto, ResolveSignupTokenQueryDto } from '@n8n/api-types';
import type { User, PublicUser } from '@n8n/db';
import { Body, Get, Post, Query, RestController } from '@n8n/decorators'; import { Body, Get, Post, Query, RestController } from '@n8n/decorators';
import { isEmail } from 'class-validator'; import { isEmail } from 'class-validator';
import { Response } from 'express'; import { Response } from 'express';
@@ -7,7 +8,6 @@ import { Logger } from 'n8n-core';
import { handleEmailLogin, handleLdapLogin } from '@/auth'; import { handleEmailLogin, handleLdapLogin } from '@/auth';
import { AuthService } from '@/auth/auth.service'; import { AuthService } from '@/auth/auth.service';
import { RESPONSE_ERROR_MESSAGES } from '@/constants'; import { RESPONSE_ERROR_MESSAGES } from '@/constants';
import type { User } from '@/databases/entities/user';
import { UserRepository } from '@/databases/repositories/user.repository'; import { UserRepository } from '@/databases/repositories/user.repository';
import { AuthError } from '@/errors/response-errors/auth.error'; import { AuthError } from '@/errors/response-errors/auth.error';
import { BadRequestError } from '@/errors/response-errors/bad-request.error'; import { BadRequestError } from '@/errors/response-errors/bad-request.error';
@@ -23,7 +23,6 @@ import {
isLdapCurrentAuthenticationMethod, isLdapCurrentAuthenticationMethod,
isSamlCurrentAuthenticationMethod, isSamlCurrentAuthenticationMethod,
} from '@/sso.ee/sso-helpers'; } from '@/sso.ee/sso-helpers';
import type { PublicUser } from '@/types-db';
@RestController() @RestController()
export class AuthController { export class AuthController {

View File

@@ -1,4 +1,5 @@
import { AcceptInvitationRequestDto, InviteUsersRequestDto } from '@n8n/api-types'; import { AcceptInvitationRequestDto, InviteUsersRequestDto } from '@n8n/api-types';
import type { User } from '@n8n/db';
import { Post, GlobalScope, RestController, Body, Param } from '@n8n/decorators'; import { Post, GlobalScope, RestController, Body, Param } from '@n8n/decorators';
import { Response } from 'express'; import { Response } from 'express';
import { Logger } from 'n8n-core'; import { Logger } from 'n8n-core';
@@ -6,7 +7,6 @@ import { Logger } from 'n8n-core';
import { AuthService } from '@/auth/auth.service'; import { AuthService } from '@/auth/auth.service';
import config from '@/config'; import config from '@/config';
import { RESPONSE_ERROR_MESSAGES } from '@/constants'; import { RESPONSE_ERROR_MESSAGES } from '@/constants';
import type { User } from '@/databases/entities/user';
import { UserRepository } from '@/databases/repositories/user.repository'; import { UserRepository } from '@/databases/repositories/user.repository';
import { BadRequestError } from '@/errors/response-errors/bad-request.error'; import { BadRequestError } from '@/errors/response-errors/bad-request.error';
import { ForbiddenError } from '@/errors/response-errors/forbidden.error'; import { ForbiddenError } from '@/errors/response-errors/forbidden.error';

View File

@@ -4,13 +4,13 @@ import {
SettingsUpdateRequestDto, SettingsUpdateRequestDto,
UserUpdateRequestDto, UserUpdateRequestDto,
} from '@n8n/api-types'; } from '@n8n/api-types';
import type { User, PublicUser } from '@n8n/db';
import { Body, Patch, Post, RestController } from '@n8n/decorators'; import { Body, Patch, Post, RestController } from '@n8n/decorators';
import { plainToInstance } from 'class-transformer'; import { plainToInstance } from 'class-transformer';
import { Response } from 'express'; import { Response } from 'express';
import { Logger } from 'n8n-core'; import { Logger } from 'n8n-core';
import { AuthService } from '@/auth/auth.service'; import { AuthService } from '@/auth/auth.service';
import type { User } from '@/databases/entities/user';
import { UserRepository } from '@/databases/repositories/user.repository'; import { UserRepository } from '@/databases/repositories/user.repository';
import { BadRequestError } from '@/errors/response-errors/bad-request.error'; import { BadRequestError } from '@/errors/response-errors/bad-request.error';
import { InvalidMfaCodeError } from '@/errors/response-errors/invalid-mfa-code.error'; import { InvalidMfaCodeError } from '@/errors/response-errors/invalid-mfa-code.error';
@@ -22,7 +22,6 @@ import { AuthenticatedRequest, MeRequest } from '@/requests';
import { PasswordUtility } from '@/services/password.utility'; import { PasswordUtility } from '@/services/password.utility';
import { UserService } from '@/services/user.service'; import { UserService } from '@/services/user.service';
import { isSamlLicensedAndEnabled } from '@/sso.ee/saml/saml-helpers'; import { isSamlLicensedAndEnabled } from '@/sso.ee/saml/saml-helpers';
import type { PublicUser } from '@/types-db';
import { PersonalizationSurveyAnswersV4 } from './survey-answers.dto'; import { PersonalizationSurveyAnswersV4 } from './survey-answers.dto';
@RestController('/me') @RestController('/me')

View File

@@ -1,3 +1,5 @@
import type { CredentialsEntity } from '@n8n/db';
import type { User } from '@n8n/db';
import { Container } from '@n8n/di'; import { Container } from '@n8n/di';
import Csrf from 'csrf'; import Csrf from 'csrf';
import type { Response } from 'express'; import type { Response } from 'express';
@@ -10,8 +12,6 @@ import { Time } from '@/constants';
import { OAuth1CredentialController } from '@/controllers/oauth/oauth1-credential.controller'; import { OAuth1CredentialController } from '@/controllers/oauth/oauth1-credential.controller';
import { CredentialsFinderService } from '@/credentials/credentials-finder.service'; import { CredentialsFinderService } from '@/credentials/credentials-finder.service';
import { CredentialsHelper } from '@/credentials-helper'; import { CredentialsHelper } from '@/credentials-helper';
import type { CredentialsEntity } from '@/databases/entities/credentials-entity';
import type { User } from '@/databases/entities/user';
import { CredentialsRepository } from '@/databases/repositories/credentials.repository'; import { CredentialsRepository } from '@/databases/repositories/credentials.repository';
import { VariablesService } from '@/environments.ee/variables/variables.service.ee'; import { VariablesService } from '@/environments.ee/variables/variables.service.ee';
import { BadRequestError } from '@/errors/response-errors/bad-request.error'; import { BadRequestError } from '@/errors/response-errors/bad-request.error';

View File

@@ -1,3 +1,5 @@
import type { CredentialsEntity } from '@n8n/db';
import type { User } from '@n8n/db';
import { Container } from '@n8n/di'; import { Container } from '@n8n/di';
import Csrf from 'csrf'; import Csrf from 'csrf';
import { type Response } from 'express'; import { type Response } from 'express';
@@ -10,8 +12,6 @@ import { CREDENTIAL_BLANKING_VALUE, Time } from '@/constants';
import { OAuth2CredentialController } from '@/controllers/oauth/oauth2-credential.controller'; import { OAuth2CredentialController } from '@/controllers/oauth/oauth2-credential.controller';
import { CredentialsFinderService } from '@/credentials/credentials-finder.service'; import { CredentialsFinderService } from '@/credentials/credentials-finder.service';
import { CredentialsHelper } from '@/credentials-helper'; import { CredentialsHelper } from '@/credentials-helper';
import type { CredentialsEntity } from '@/databases/entities/credentials-entity';
import type { User } from '@/databases/entities/user';
import { CredentialsRepository } from '@/databases/repositories/credentials.repository'; import { CredentialsRepository } from '@/databases/repositories/credentials.repository';
import { VariablesService } from '@/environments.ee/variables/variables.service.ee'; import { VariablesService } from '@/environments.ee/variables/variables.service.ee';
import { BadRequestError } from '@/errors/response-errors/bad-request.error'; import { BadRequestError } from '@/errors/response-errors/bad-request.error';

View File

@@ -1,4 +1,5 @@
import { GlobalConfig } from '@n8n/config'; import { GlobalConfig } from '@n8n/config';
import type { CredentialsEntity, ICredentialsDb } from '@n8n/db';
import { Service } from '@n8n/di'; import { Service } from '@n8n/di';
import Csrf from 'csrf'; import Csrf from 'csrf';
import type { Response } from 'express'; import type { Response } from 'express';
@@ -9,7 +10,6 @@ import { jsonParse, UnexpectedError } from 'n8n-workflow';
import { RESPONSE_ERROR_MESSAGES, Time } from '@/constants'; import { RESPONSE_ERROR_MESSAGES, Time } from '@/constants';
import { CredentialsFinderService } from '@/credentials/credentials-finder.service'; import { CredentialsFinderService } from '@/credentials/credentials-finder.service';
import { CredentialsHelper } from '@/credentials-helper'; import { CredentialsHelper } from '@/credentials-helper';
import type { CredentialsEntity } from '@/databases/entities/credentials-entity';
import { CredentialsRepository } from '@/databases/repositories/credentials.repository'; import { CredentialsRepository } from '@/databases/repositories/credentials.repository';
import { AuthError } from '@/errors/response-errors/auth.error'; import { AuthError } from '@/errors/response-errors/auth.error';
import { BadRequestError } from '@/errors/response-errors/bad-request.error'; import { BadRequestError } from '@/errors/response-errors/bad-request.error';
@@ -17,7 +17,6 @@ import { NotFoundError } from '@/errors/response-errors/not-found.error';
import { ExternalHooks } from '@/external-hooks'; import { ExternalHooks } from '@/external-hooks';
import type { AuthenticatedRequest, OAuthRequest } from '@/requests'; import type { AuthenticatedRequest, OAuthRequest } from '@/requests';
import { UrlService } from '@/services/url.service'; import { UrlService } from '@/services/url.service';
import type { ICredentialsDb } from '@/types-db';
import * as WorkflowExecuteAdditionalData from '@/workflow-execute-additional-data'; import * as WorkflowExecuteAdditionalData from '@/workflow-execute-additional-data';
type CsrfStateParam = { type CsrfStateParam = {

View File

@@ -1,4 +1,5 @@
import { CreateProjectDto, DeleteProjectDto, UpdateProjectDto } from '@n8n/api-types'; import { CreateProjectDto, DeleteProjectDto, UpdateProjectDto } from '@n8n/api-types';
import type { Project } from '@n8n/db';
import { import {
Get, Get,
Post, Post,
@@ -18,7 +19,6 @@ import type { Scope } from '@n8n/permissions';
import { In, Not } from '@n8n/typeorm'; import { In, Not } from '@n8n/typeorm';
import { Response } from 'express'; import { Response } from 'express';
import type { Project } from '@/databases/entities/project';
import { ProjectRepository } from '@/databases/repositories/project.repository'; import { ProjectRepository } from '@/databases/repositories/project.repository';
import { BadRequestError } from '@/errors/response-errors/bad-request.error'; import { BadRequestError } from '@/errors/response-errors/bad-request.error';
import { NotFoundError } from '@/errors/response-errors/not-found.error'; import { NotFoundError } from '@/errors/response-errors/not-found.error';

View File

@@ -1,4 +1,6 @@
import { RoleChangeRequestDto, SettingsUpdateRequestDto } from '@n8n/api-types'; import { RoleChangeRequestDto, SettingsUpdateRequestDto } from '@n8n/api-types';
import type { PublicUser } from '@n8n/db';
import { Project, User, AuthIdentity } from '@n8n/db';
import { import {
GlobalScope, GlobalScope,
Delete, Delete,
@@ -14,9 +16,6 @@ import { Logger } from 'n8n-core';
import { AuthService } from '@/auth/auth.service'; import { AuthService } from '@/auth/auth.service';
import { CredentialsService } from '@/credentials/credentials.service'; import { CredentialsService } from '@/credentials/credentials.service';
import { AuthIdentity } from '@/databases/entities/auth-identity';
import { Project } from '@/databases/entities/project';
import { User } from '@/databases/entities/user';
import { ProjectRepository } from '@/databases/repositories/project.repository'; import { ProjectRepository } from '@/databases/repositories/project.repository';
import { SharedCredentialsRepository } from '@/databases/repositories/shared-credentials.repository'; import { SharedCredentialsRepository } from '@/databases/repositories/shared-credentials.repository';
import { SharedWorkflowRepository } from '@/databases/repositories/shared-workflow.repository'; import { SharedWorkflowRepository } from '@/databases/repositories/shared-workflow.repository';
@@ -31,7 +30,6 @@ import { ListQuery, AuthenticatedRequest, UserRequest } from '@/requests';
import { FolderService } from '@/services/folder.service'; import { FolderService } from '@/services/folder.service';
import { ProjectService } from '@/services/project.service.ee'; import { ProjectService } from '@/services/project.service.ee';
import { UserService } from '@/services/user.service'; import { UserService } from '@/services/user.service';
import type { PublicUser } from '@/types-db';
import { WorkflowService } from '@/workflows/workflow.service'; import { WorkflowService } from '@/workflows/workflow.service';
@RestController('/users') @RestController('/users')

View File

@@ -1,9 +1,9 @@
import type { WorkflowStatistics } from '@n8n/db';
import { StatisticsNames } from '@n8n/db';
import { Get, Middleware, RestController } from '@n8n/decorators'; import { Get, Middleware, RestController } from '@n8n/decorators';
import { Response, NextFunction } from 'express'; import { Response, NextFunction } from 'express';
import { Logger } from 'n8n-core'; import { Logger } from 'n8n-core';
import type { WorkflowStatistics } from '@/databases/entities/workflow-statistics';
import { StatisticsNames } from '@/databases/entities/workflow-statistics';
import { WorkflowStatisticsRepository } from '@/databases/repositories/workflow-statistics.repository'; import { WorkflowStatisticsRepository } from '@/databases/repositories/workflow-statistics.repository';
import { NotFoundError } from '@/errors/response-errors/not-found.error'; import { NotFoundError } from '@/errors/response-errors/not-found.error';
import type { IWorkflowStatisticsDataLoaded } from '@/interfaces'; import type { IWorkflowStatisticsDataLoaded } from '@/interfaces';

View File

@@ -2,6 +2,7 @@
/* eslint-disable @typescript-eslint/no-unsafe-member-access */ /* eslint-disable @typescript-eslint/no-unsafe-member-access */
/* eslint-disable @typescript-eslint/no-unsafe-assignment */ /* eslint-disable @typescript-eslint/no-unsafe-assignment */
/* eslint-disable @typescript-eslint/no-unsafe-return */ /* eslint-disable @typescript-eslint/no-unsafe-return */
import type { CredentialsEntity, ICredentialsDb } from '@n8n/db';
import { Service } from '@n8n/di'; import { Service } from '@n8n/di';
// eslint-disable-next-line n8n-local-rules/misplaced-n8n-typeorm-import // eslint-disable-next-line n8n-local-rules/misplaced-n8n-typeorm-import
import { In } from '@n8n/typeorm'; import { In } from '@n8n/typeorm';
@@ -30,10 +31,8 @@ import { ICredentialsHelper, NodeHelpers, Workflow, UnexpectedError } from 'n8n-
import { CredentialTypes } from '@/credential-types'; import { CredentialTypes } from '@/credential-types';
import { CredentialsOverwrites } from '@/credentials-overwrites'; import { CredentialsOverwrites } from '@/credentials-overwrites';
import type { CredentialsEntity } from '@/databases/entities/credentials-entity';
import { CredentialsRepository } from '@/databases/repositories/credentials.repository'; import { CredentialsRepository } from '@/databases/repositories/credentials.repository';
import { SharedCredentialsRepository } from '@/databases/repositories/shared-credentials.repository'; import { SharedCredentialsRepository } from '@/databases/repositories/shared-credentials.repository';
import type { ICredentialsDb } from '@/types-db';
import { RESPONSE_ERROR_MESSAGES } from './constants'; import { RESPONSE_ERROR_MESSAGES } from './constants';
import { CredentialNotFoundError } from './errors/credential-not-found.error'; import { CredentialNotFoundError } from './errors/credential-not-found.error';

View File

@@ -1,3 +1,4 @@
import type { CredentialsEntity } from '@n8n/db';
import { mock } from 'jest-mock-extended'; import { mock } from 'jest-mock-extended';
import { CREDENTIAL_ERRORS, CredentialDataError, Credentials, type ErrorReporter } from 'n8n-core'; import { CREDENTIAL_ERRORS, CredentialDataError, Credentials, type ErrorReporter } from 'n8n-core';
import { CREDENTIAL_EMPTY_VALUE, type ICredentialType } from 'n8n-workflow'; import { CREDENTIAL_EMPTY_VALUE, type ICredentialType } from 'n8n-workflow';
@@ -5,7 +6,6 @@ import { CREDENTIAL_EMPTY_VALUE, type ICredentialType } from 'n8n-workflow';
import { CREDENTIAL_BLANKING_VALUE } from '@/constants'; import { CREDENTIAL_BLANKING_VALUE } from '@/constants';
import type { CredentialTypes } from '@/credential-types'; import type { CredentialTypes } from '@/credential-types';
import { CredentialsService } from '@/credentials/credentials.service'; import { CredentialsService } from '@/credentials/credentials.service';
import type { CredentialsEntity } from '@/databases/entities/credentials-entity';
import type { CredentialsRepository } from '@/databases/repositories/credentials.repository'; import type { CredentialsRepository } from '@/databases/repositories/credentials.repository';
describe('CredentialsService', () => { describe('CredentialsService', () => {

View File

@@ -1,4 +1,5 @@
import type { ProjectRole } from '@n8n/api-types'; import type { ProjectRole } from '@n8n/api-types';
import type { CredentialsEntity, SharedCredentials, CredentialSharingRole, User } from '@n8n/db';
import { Service } from '@n8n/di'; import { Service } from '@n8n/di';
import type { Scope } from '@n8n/permissions'; import type { Scope } from '@n8n/permissions';
// eslint-disable-next-line n8n-local-rules/misplaced-n8n-typeorm-import // eslint-disable-next-line n8n-local-rules/misplaced-n8n-typeorm-import
@@ -6,12 +7,6 @@ import type { EntityManager, FindOptionsWhere } from '@n8n/typeorm';
// eslint-disable-next-line n8n-local-rules/misplaced-n8n-typeorm-import // eslint-disable-next-line n8n-local-rules/misplaced-n8n-typeorm-import
import { In } from '@n8n/typeorm'; import { In } from '@n8n/typeorm';
import type { CredentialsEntity } from '@/databases/entities/credentials-entity';
import type {
SharedCredentials,
CredentialSharingRole,
} from '@/databases/entities/shared-credentials';
import type { User } from '@/databases/entities/user';
import { CredentialsRepository } from '@/databases/repositories/credentials.repository'; import { CredentialsRepository } from '@/databases/repositories/credentials.repository';
import { SharedCredentialsRepository } from '@/databases/repositories/shared-credentials.repository'; import { SharedCredentialsRepository } from '@/databases/repositories/shared-credentials.repository';
import { RoleService } from '@/services/role.service'; import { RoleService } from '@/services/role.service';

View File

@@ -5,6 +5,7 @@ import {
GenerateCredentialNameRequestQuery, GenerateCredentialNameRequestQuery,
} from '@n8n/api-types'; } from '@n8n/api-types';
import { GlobalConfig } from '@n8n/config'; import { GlobalConfig } from '@n8n/config';
import { SharedCredentials } from '@n8n/db';
import { import {
Delete, Delete,
Get, Get,
@@ -25,7 +26,6 @@ import { deepCopy } from 'n8n-workflow';
import type { ICredentialDataDecryptedObject } from 'n8n-workflow'; import type { ICredentialDataDecryptedObject } from 'n8n-workflow';
import { z } from 'zod'; import { z } from 'zod';
import { SharedCredentials } from '@/databases/entities/shared-credentials';
import { ProjectRelationRepository } from '@/databases/repositories/project-relation.repository'; import { ProjectRelationRepository } from '@/databases/repositories/project-relation.repository';
import { SharedCredentialsRepository } from '@/databases/repositories/shared-credentials.repository'; import { SharedCredentialsRepository } from '@/databases/repositories/shared-credentials.repository';
import * as Db from '@/db'; import * as Db from '@/db';

View File

@@ -1,12 +1,10 @@
import { Project, SharedCredentials } from '@n8n/db';
import type { CredentialsEntity, User } from '@n8n/db';
import { Service } from '@n8n/di'; import { Service } from '@n8n/di';
// eslint-disable-next-line n8n-local-rules/misplaced-n8n-typeorm-import // eslint-disable-next-line n8n-local-rules/misplaced-n8n-typeorm-import
import { In, type EntityManager } from '@n8n/typeorm'; import { In, type EntityManager } from '@n8n/typeorm';
import type { ICredentialDataDecryptedObject } from 'n8n-workflow'; import type { ICredentialDataDecryptedObject } from 'n8n-workflow';
import type { CredentialsEntity } from '@/databases/entities/credentials-entity';
import { Project } from '@/databases/entities/project';
import { SharedCredentials } from '@/databases/entities/shared-credentials';
import type { User } from '@/databases/entities/user';
import { SharedCredentialsRepository } from '@/databases/repositories/shared-credentials.repository'; import { SharedCredentialsRepository } from '@/databases/repositories/shared-credentials.repository';
import { NotFoundError } from '@/errors/response-errors/not-found.error'; import { NotFoundError } from '@/errors/response-errors/not-found.error';
import { TransferCredentialError } from '@/errors/response-errors/transfer-credential.error'; import { TransferCredentialError } from '@/errors/response-errors/transfer-credential.error';

View File

@@ -1,4 +1,6 @@
import type { CreateCredentialDto } from '@n8n/api-types'; import type { CreateCredentialDto } from '@n8n/api-types';
import type { Project, User, ICredentialsDb, ScopesField } from '@n8n/db';
import { CredentialsEntity, SharedCredentials } from '@n8n/db';
import { Service } from '@n8n/di'; import { Service } from '@n8n/di';
import type { Scope } from '@n8n/permissions'; import type { Scope } from '@n8n/permissions';
// eslint-disable-next-line n8n-local-rules/misplaced-n8n-typeorm-import // eslint-disable-next-line n8n-local-rules/misplaced-n8n-typeorm-import
@@ -20,10 +22,6 @@ import { CREDENTIAL_EMPTY_VALUE, deepCopy, NodeHelpers, UnexpectedError } from '
import { CREDENTIAL_BLANKING_VALUE } from '@/constants'; import { CREDENTIAL_BLANKING_VALUE } from '@/constants';
import { CredentialTypes } from '@/credential-types'; import { CredentialTypes } from '@/credential-types';
import { createCredentialsFromCredentialsEntity } from '@/credentials-helper'; import { createCredentialsFromCredentialsEntity } from '@/credentials-helper';
import { CredentialsEntity } from '@/databases/entities/credentials-entity';
import type { Project } from '@/databases/entities/project';
import { SharedCredentials } from '@/databases/entities/shared-credentials';
import type { User } from '@/databases/entities/user';
import { CredentialsRepository } from '@/databases/repositories/credentials.repository'; import { CredentialsRepository } from '@/databases/repositories/credentials.repository';
import { ProjectRepository } from '@/databases/repositories/project.repository'; import { ProjectRepository } from '@/databases/repositories/project.repository';
import { SharedCredentialsRepository } from '@/databases/repositories/shared-credentials.repository'; import { SharedCredentialsRepository } from '@/databases/repositories/shared-credentials.repository';
@@ -39,7 +37,6 @@ import { CredentialsTester } from '@/services/credentials-tester.service';
import { OwnershipService } from '@/services/ownership.service'; import { OwnershipService } from '@/services/ownership.service';
import { ProjectService } from '@/services/project.service.ee'; import { ProjectService } from '@/services/project.service.ee';
import { RoleService } from '@/services/role.service'; import { RoleService } from '@/services/role.service';
import type { ICredentialsDb, ScopesField } from '@/types-db';
import { CredentialsFinderService } from './credentials-finder.service'; import { CredentialsFinderService } from './credentials-finder.service';

View File

@@ -1,4 +1,4 @@
import { User } from '@/databases/entities/user'; import { User } from '@n8n/db';
describe('User Entity', () => { describe('User Entity', () => {
describe('JSON.stringify', () => { describe('JSON.stringify', () => {

View File

@@ -1,8 +1,6 @@
import { DateTimeColumn } from '@n8n/db'; import { DateTimeColumn, AuthProviderType } from '@n8n/db';
import { Column, Entity, PrimaryGeneratedColumn } from '@n8n/typeorm'; import { Column, Entity, PrimaryGeneratedColumn } from '@n8n/typeorm';
import { AuthProviderType } from './auth-identity';
export type RunningMode = 'dry' | 'live'; export type RunningMode = 'dry' | 'live';
export type SyncStatus = 'success' | 'error'; export type SyncStatus = 'success' | 'error';

View File

@@ -1,7 +1,6 @@
import { User } from '@n8n/db';
import { Column, Entity } from '@n8n/typeorm'; import { Column, Entity } from '@n8n/typeorm';
import { User } from './user';
@Entity({ name: 'user' }) @Entity({ name: 'user' })
export class AuthUser extends User { export class AuthUser extends User {
@Column({ type: String, nullable: true }) @Column({ type: String, nullable: true })

View File

@@ -1,4 +1,4 @@
import { DateTimeColumn, datetimeColumnType, idStringifier } from '@n8n/db'; import { DateTimeColumn, datetimeColumnType, idStringifier, WorkflowEntity } from '@n8n/db';
import { import {
Column, Column,
Entity, Entity,
@@ -18,7 +18,6 @@ import type { ExecutionAnnotation } from '@/databases/entities/execution-annotat
import type { ExecutionData } from './execution-data'; import type { ExecutionData } from './execution-data';
import type { ExecutionMetadata } from './execution-metadata'; import type { ExecutionMetadata } from './execution-metadata';
import { WorkflowEntity } from './workflow-entity';
@Entity() @Entity()
@Index(['workflowId', 'id']) @Index(['workflowId', 'id'])

View File

@@ -7,35 +7,35 @@ import {
Settings, Settings,
Variables, Variables,
WebhookEntity, WebhookEntity,
AuthIdentity,
User,
WorkflowEntity,
CredentialsEntity,
ApiKey,
Folder,
FolderTagMapping,
Project,
ProjectRelation,
SharedCredentials,
SharedWorkflow,
TagEntity,
WorkflowStatistics,
WorkflowTagMapping,
} from '@n8n/db'; } from '@n8n/db';
import { AnnotationTagEntity } from './annotation-tag-entity.ee'; import { AnnotationTagEntity } from './annotation-tag-entity.ee';
import { AnnotationTagMapping } from './annotation-tag-mapping.ee'; import { AnnotationTagMapping } from './annotation-tag-mapping.ee';
import { ApiKey } from './api-key';
import { AuthIdentity } from './auth-identity';
import { AuthProviderSyncHistory } from './auth-provider-sync-history'; import { AuthProviderSyncHistory } from './auth-provider-sync-history';
import { AuthUser } from './auth-user'; import { AuthUser } from './auth-user';
import { CredentialsEntity } from './credentials-entity';
import { ExecutionAnnotation } from './execution-annotation.ee'; import { ExecutionAnnotation } from './execution-annotation.ee';
import { ExecutionData } from './execution-data'; import { ExecutionData } from './execution-data';
import { ExecutionEntity } from './execution-entity'; import { ExecutionEntity } from './execution-entity';
import { ExecutionMetadata } from './execution-metadata'; import { ExecutionMetadata } from './execution-metadata';
import { Folder } from './folder';
import { FolderTagMapping } from './folder-tag-mapping';
import { Project } from './project';
import { ProjectRelation } from './project-relation';
import { SharedCredentials } from './shared-credentials';
import { SharedWorkflow } from './shared-workflow';
import { TagEntity } from './tag-entity';
import { TestCaseExecution } from './test-case-execution.ee'; import { TestCaseExecution } from './test-case-execution.ee';
import { TestDefinition } from './test-definition.ee'; import { TestDefinition } from './test-definition.ee';
import { TestMetric } from './test-metric.ee'; import { TestMetric } from './test-metric.ee';
import { TestRun } from './test-run.ee'; import { TestRun } from './test-run.ee';
import { User } from './user';
import { WorkflowEntity } from './workflow-entity';
import { WorkflowHistory } from './workflow-history'; import { WorkflowHistory } from './workflow-history';
import { WorkflowStatistics } from './workflow-statistics';
import { WorkflowTagMapping } from './workflow-tag-mapping';
import { InsightsByPeriod } from '../../modules/insights/database/entities/insights-by-period'; import { InsightsByPeriod } from '../../modules/insights/database/entities/insights-by-period';
import { InsightsMetadata } from '../../modules/insights/database/entities/insights-metadata'; import { InsightsMetadata } from '../../modules/insights/database/entities/insights-metadata';
import { InsightsRaw } from '../../modules/insights/database/entities/insights-raw'; import { InsightsRaw } from '../../modules/insights/database/entities/insights-raw';

View File

@@ -1,10 +1,9 @@
import { JsonColumn, WithTimestampsAndStringId } from '@n8n/db'; import { JsonColumn, WithTimestampsAndStringId, WorkflowEntity } from '@n8n/db';
import { Column, Entity, Index, ManyToOne, OneToMany, RelationId } from '@n8n/typeorm'; import { Column, Entity, Index, ManyToOne, OneToMany, RelationId } from '@n8n/typeorm';
import { Length } from 'class-validator'; import { Length } from 'class-validator';
import { AnnotationTagEntity } from '@/databases/entities/annotation-tag-entity.ee'; import { AnnotationTagEntity } from '@/databases/entities/annotation-tag-entity.ee';
import type { TestMetric } from '@/databases/entities/test-metric.ee'; import type { TestMetric } from '@/databases/entities/test-metric.ee';
import { WorkflowEntity } from '@/databases/entities/workflow-entity';
// Entity representing a node in a workflow under test, for which data should be mocked during test execution // Entity representing a node in a workflow under test, for which data should be mocked during test execution
export type MockedNodeItem = { export type MockedNodeItem = {

View File

@@ -1,10 +1,8 @@
import { JsonColumn, WithTimestamps } from '@n8n/db'; import { JsonColumn, WithTimestamps, WorkflowEntity } from '@n8n/db';
import { Column, Entity, ManyToOne, PrimaryColumn } from '@n8n/typeorm'; import { Column, Entity, ManyToOne, PrimaryColumn } from '@n8n/typeorm';
import { IConnections } from 'n8n-workflow'; import { IConnections } from 'n8n-workflow';
import type { INode } from 'n8n-workflow'; import type { INode } from 'n8n-workflow';
import { WorkflowEntity } from './workflow-entity';
@Entity() @Entity()
export class WorkflowHistory extends WithTimestamps { export class WorkflowHistory extends WithTimestamps {
@PrimaryColumn() @PrimaryColumn()

View File

@@ -1,4 +1,5 @@
import type { WorkflowEntity } from '@/databases/entities/workflow-entity'; import type { WorkflowEntity } from '@n8n/db';
import type { MigrationContext, ReversibleMigration } from '@/databases/types'; import type { MigrationContext, ReversibleMigration } from '@/databases/types';
export class UniqueWorkflowNames1620821879465 implements ReversibleMigration { export class UniqueWorkflowNames1620821879465 implements ReversibleMigration {

View File

@@ -1,7 +1,6 @@
import type { CredentialsEntity, WorkflowEntity } from '@n8n/db';
import type { IWorkflowBase } from 'n8n-workflow'; import type { IWorkflowBase } from 'n8n-workflow';
import type { CredentialsEntity } from '@/databases/entities/credentials-entity';
import type { WorkflowEntity } from '@/databases/entities/workflow-entity';
import type { MigrationContext, ReversibleMigration } from '@/databases/types'; import type { MigrationContext, ReversibleMigration } from '@/databases/types';
type Credential = Pick<CredentialsEntity, 'id' | 'name' | 'type'>; type Credential = Pick<CredentialsEntity, 'id' | 'name' | 'type'>;

View File

@@ -1,7 +1,7 @@
import type { WorkflowEntity } from '@n8n/db';
import type { INode } from 'n8n-workflow'; import type { INode } from 'n8n-workflow';
import { v4 as uuid } from 'uuid'; import { v4 as uuid } from 'uuid';
import type { WorkflowEntity } from '@/databases/entities/workflow-entity';
import type { MigrationContext, ReversibleMigration } from '@/databases/types'; import type { MigrationContext, ReversibleMigration } from '@/databases/types';
type Workflow = Pick<WorkflowEntity, 'id'> & { nodes: string | INode[] }; type Workflow = Pick<WorkflowEntity, 'id'> & { nodes: string | INode[] };

View File

@@ -1,4 +1,5 @@
import { StatisticsNames } from '@/databases/entities/workflow-statistics'; import { StatisticsNames } from '@n8n/db';
import type { MigrationContext, ReversibleMigration } from '@/databases/types'; import type { MigrationContext, ReversibleMigration } from '@/databases/types';
export class RemoveWorkflowDataLoadedFlag1671726148419 implements ReversibleMigration { export class RemoveWorkflowDataLoadedFlag1671726148419 implements ReversibleMigration {

View File

@@ -1,6 +1,6 @@
import { WorkflowEntity } from '@n8n/db';
import { UserError } from 'n8n-workflow'; import { UserError } from 'n8n-workflow';
import { WorkflowEntity } from '@/databases/entities/workflow-entity';
import type { IrreversibleMigration, MigrationContext } from '@/databases/types'; import type { IrreversibleMigration, MigrationContext } from '@/databases/types';
export class PurgeInvalidWorkflowConnections1675940580449 implements IrreversibleMigration { export class PurgeInvalidWorkflowConnections1675940580449 implements IrreversibleMigration {

View File

@@ -1,9 +1,9 @@
import type { ProjectRole } from '@n8n/api-types'; import type { ProjectRole } from '@n8n/api-types';
import { generateNanoId } from '@n8n/db'; import { generateNanoId } from '@n8n/db';
import type { User } from '@n8n/db';
import { UserError } from 'n8n-workflow'; import { UserError } from 'n8n-workflow';
import { nanoid } from 'nanoid'; import { nanoid } from 'nanoid';
import type { User } from '@/databases/entities/user';
import type { MigrationContext, ReversibleMigration } from '@/databases/types'; import type { MigrationContext, ReversibleMigration } from '@/databases/types';
const projectAdminRole: ProjectRole = 'project:personalOwner'; const projectAdminRole: ProjectRole = 'project:personalOwner';

View File

@@ -1,6 +1,6 @@
import { generateNanoId } from '@n8n/db'; import { generateNanoId } from '@n8n/db';
import type { ApiKey } from '@n8n/db';
import type { ApiKey } from '@/databases/entities/api-key';
import type { MigrationContext, ReversibleMigration } from '@/databases/types'; import type { MigrationContext, ReversibleMigration } from '@/databases/types';
export class AddApiKeysTable1724951148974 implements ReversibleMigration { export class AddApiKeysTable1724951148974 implements ReversibleMigration {

View File

@@ -1,6 +1,6 @@
import { ApiKey } from '@n8n/db';
import type { GlobalRole } from '@n8n/permissions'; import type { GlobalRole } from '@n8n/permissions';
import { ApiKey } from '@/databases/entities/api-key';
import type { MigrationContext, ReversibleMigration } from '@/databases/types'; import type { MigrationContext, ReversibleMigration } from '@/databases/types';
import { getApiKeyScopesForRole } from '@/public-api/permissions.ee'; import { getApiKeyScopesForRole } from '@/public-api/permissions.ee';

View File

@@ -1,5 +1,6 @@
import type { UserSettings } from '@n8n/db';
import type { MigrationContext, ReversibleMigration } from '@/databases/types'; import type { MigrationContext, ReversibleMigration } from '@/databases/types';
import type { UserSettings } from '@/types-db';
export class AddUserActivatedProperty1681134145996 implements ReversibleMigration { export class AddUserActivatedProperty1681134145996 implements ReversibleMigration {
async up({ queryRunner, tablePrefix }: MigrationContext) { async up({ queryRunner, tablePrefix }: MigrationContext) {

View File

@@ -1,5 +1,6 @@
import type { UserSettings } from '@n8n/db';
import type { MigrationContext, ReversibleMigration } from '@/databases/types'; import type { MigrationContext, ReversibleMigration } from '@/databases/types';
import type { UserSettings } from '@/types-db';
export class AddUserActivatedProperty1681134145996 implements ReversibleMigration { export class AddUserActivatedProperty1681134145996 implements ReversibleMigration {
async up({ queryRunner, tablePrefix }: MigrationContext) { async up({ queryRunner, tablePrefix }: MigrationContext) {

View File

@@ -1,5 +1,6 @@
import type { UserSettings } from '@n8n/db';
import type { MigrationContext, ReversibleMigration } from '@/databases/types'; import type { MigrationContext, ReversibleMigration } from '@/databases/types';
import type { UserSettings } from '@/types-db';
export class AddUserActivatedProperty1681134145996 implements ReversibleMigration { export class AddUserActivatedProperty1681134145996 implements ReversibleMigration {
async up({ queryRunner, tablePrefix }: MigrationContext) { async up({ queryRunner, tablePrefix }: MigrationContext) {

View File

@@ -1,6 +1,6 @@
import { generateNanoId } from '@n8n/db'; import { generateNanoId } from '@n8n/db';
import type { ApiKey } from '@n8n/db';
import type { ApiKey } from '@/databases/entities/api-key';
import type { MigrationContext, ReversibleMigration } from '@/databases/types'; import type { MigrationContext, ReversibleMigration } from '@/databases/types';
export class AddApiKeysTable1724951148974 implements ReversibleMigration { export class AddApiKeysTable1724951148974 implements ReversibleMigration {

View File

@@ -1,7 +1,7 @@
import { CredentialsEntity } from '@n8n/db';
import { Container } from '@n8n/di'; import { Container } from '@n8n/di';
import { mock } from 'jest-mock-extended'; import { mock } from 'jest-mock-extended';
import { CredentialsEntity } from '@/databases/entities/credentials-entity';
import { mockEntityManager } from '@test/mocking'; import { mockEntityManager } from '@test/mocking';
import { CredentialsRepository } from '../credentials.repository'; import { CredentialsRepository } from '../credentials.repository';

View File

@@ -1,5 +1,6 @@
import { GlobalConfig } from '@n8n/config'; import { GlobalConfig } from '@n8n/config';
import type { SqliteConfig } from '@n8n/config/src/configs/database.config'; import type { SqliteConfig } from '@n8n/config/src/configs/database.config';
import type { IExecutionResponse } from '@n8n/db';
import { Container } from '@n8n/di'; import { Container } from '@n8n/di';
import type { SelectQueryBuilder } from '@n8n/typeorm'; import type { SelectQueryBuilder } from '@n8n/typeorm';
import { Not, LessThanOrEqual } from '@n8n/typeorm'; import { Not, LessThanOrEqual } from '@n8n/typeorm';
@@ -10,7 +11,6 @@ import { nanoid } from 'nanoid';
import { ExecutionEntity } from '@/databases/entities/execution-entity'; import { ExecutionEntity } from '@/databases/entities/execution-entity';
import { ExecutionRepository } from '@/databases/repositories/execution.repository'; import { ExecutionRepository } from '@/databases/repositories/execution.repository';
import type { IExecutionResponse } from '@/types-db';
import { mockInstance, mockEntityManager } from '@test/mocking'; import { mockInstance, mockEntityManager } from '@test/mocking';
describe('ExecutionRepository', () => { describe('ExecutionRepository', () => {

View File

@@ -1,9 +1,9 @@
import type { Project } from '@n8n/db';
import type { User } from '@n8n/db';
import type { Folder } from '@n8n/db';
import { Container } from '@n8n/di'; import { Container } from '@n8n/di';
import { DateTime } from 'luxon'; import { DateTime } from 'luxon';
import type { Folder } from '@/databases/entities/folder';
import type { Project } from '@/databases/entities/project';
import type { User } from '@/databases/entities/user';
import { createFolder } from '@test-integration/db/folders'; import { createFolder } from '@test-integration/db/folders';
import { getPersonalProject } from '@test-integration/db/projects'; import { getPersonalProject } from '@test-integration/db/projects';
import { createTag } from '@test-integration/db/tags'; import { createTag } from '@test-integration/db/tags';

View File

@@ -1,8 +1,8 @@
import { StatisticsNames, WorkflowStatistics } from '@n8n/db';
import { Container } from '@n8n/di'; import { Container } from '@n8n/di';
import { type InsertResult, QueryFailedError } from '@n8n/typeorm'; import { type InsertResult, QueryFailedError } from '@n8n/typeorm';
import { mock, mockClear } from 'jest-mock-extended'; import { mock, mockClear } from 'jest-mock-extended';
import { StatisticsNames, WorkflowStatistics } from '@/databases/entities/workflow-statistics';
import { WorkflowStatisticsRepository } from '@/databases/repositories/workflow-statistics.repository'; import { WorkflowStatisticsRepository } from '@/databases/repositories/workflow-statistics.repository';
import { mockEntityManager } from '@test/mocking'; import { mockEntityManager } from '@test/mocking';
import { createWorkflow } from '@test-integration/db/workflows'; import { createWorkflow } from '@test-integration/db/workflows';

View File

@@ -1,8 +1,7 @@
import { ApiKey } from '@n8n/db';
import { Service } from '@n8n/di'; import { Service } from '@n8n/di';
import { DataSource, Repository } from '@n8n/typeorm'; import { DataSource, Repository } from '@n8n/typeorm';
import { ApiKey } from '../entities/api-key';
@Service() @Service()
export class ApiKeyRepository extends Repository<ApiKey> { export class ApiKeyRepository extends Repository<ApiKey> {
constructor(dataSource: DataSource) { constructor(dataSource: DataSource) {

View File

@@ -1,8 +1,7 @@
import { AuthIdentity } from '@n8n/db';
import { Service } from '@n8n/di'; import { Service } from '@n8n/di';
import { DataSource, Repository } from '@n8n/typeorm'; import { DataSource, Repository } from '@n8n/typeorm';
import { AuthIdentity } from '../entities/auth-identity';
@Service() @Service()
export class AuthIdentityRepository extends Repository<AuthIdentity> { export class AuthIdentityRepository extends Repository<AuthIdentity> {
constructor(dataSource: DataSource) { constructor(dataSource: DataSource) {

View File

@@ -1,11 +1,10 @@
import { CredentialsEntity } from '@n8n/db';
import { Service } from '@n8n/di'; import { Service } from '@n8n/di';
import { DataSource, In, Repository, Like } from '@n8n/typeorm'; import { DataSource, In, Repository, Like } from '@n8n/typeorm';
import type { FindManyOptions } from '@n8n/typeorm'; import type { FindManyOptions } from '@n8n/typeorm';
import type { ListQuery } from '@/requests'; import type { ListQuery } from '@/requests';
import { CredentialsEntity } from '../entities/credentials-entity';
@Service() @Service()
export class CredentialsRepository extends Repository<CredentialsEntity> { export class CredentialsRepository extends Repository<CredentialsEntity> {
constructor(dataSource: DataSource) { constructor(dataSource: DataSource) {

View File

@@ -1,5 +1,12 @@
import { GlobalConfig } from '@n8n/config'; import { GlobalConfig } from '@n8n/config';
import { separate } from '@n8n/db'; import type {
CreateExecutionPayload,
IExecutionFlattedDb,
IExecutionBase,
IExecutionResponse,
ExecutionSummaries,
} from '@n8n/db';
import { separate, SharedWorkflow, WorkflowEntity } from '@n8n/db';
import { Service } from '@n8n/di'; import { Service } from '@n8n/di';
import type { import type {
FindManyOptions, FindManyOptions,
@@ -36,20 +43,11 @@ import { AnnotationTagEntity } from '@/databases/entities/annotation-tag-entity.
import { AnnotationTagMapping } from '@/databases/entities/annotation-tag-mapping.ee'; import { AnnotationTagMapping } from '@/databases/entities/annotation-tag-mapping.ee';
import { ExecutionAnnotation } from '@/databases/entities/execution-annotation.ee'; import { ExecutionAnnotation } from '@/databases/entities/execution-annotation.ee';
import { PostgresLiveRowsRetrievalError } from '@/errors/postgres-live-rows-retrieval.error'; import { PostgresLiveRowsRetrievalError } from '@/errors/postgres-live-rows-retrieval.error';
import type {
CreateExecutionPayload,
IExecutionFlattedDb,
IExecutionBase,
IExecutionResponse,
ExecutionSummaries,
} from '@/types-db';
import { ExecutionDataRepository } from './execution-data.repository'; import { ExecutionDataRepository } from './execution-data.repository';
import { ExecutionData } from '../entities/execution-data'; import { ExecutionData } from '../entities/execution-data';
import { ExecutionEntity } from '../entities/execution-entity'; import { ExecutionEntity } from '../entities/execution-entity';
import { ExecutionMetadata } from '../entities/execution-metadata'; import { ExecutionMetadata } from '../entities/execution-metadata';
import { SharedWorkflow } from '../entities/shared-workflow';
import { WorkflowEntity } from '../entities/workflow-entity';
export interface IGetExecutionsQueryFilter { export interface IGetExecutionsQueryFilter {
id?: FindOperator<string> | string; id?: FindOperator<string> | string;

View File

@@ -1,8 +1,7 @@
import { FolderTagMapping } from '@n8n/db';
import { Service } from '@n8n/di'; import { Service } from '@n8n/di';
import { DataSource, Repository } from '@n8n/typeorm'; import { DataSource, Repository } from '@n8n/typeorm';
import { FolderTagMapping } from '../entities/folder-tag-mapping';
@Service() @Service()
export class FolderTagMappingRepository extends Repository<FolderTagMapping> { export class FolderTagMappingRepository extends Repository<FolderTagMapping> {
constructor(dataSource: DataSource) { constructor(dataSource: DataSource) {

View File

@@ -1,3 +1,5 @@
import type { FolderWithWorkflowAndSubFolderCount } from '@n8n/db';
import { Folder, FolderTagMapping, TagEntity } from '@n8n/db';
import { Service } from '@n8n/di'; import { Service } from '@n8n/di';
import type { EntityManager, SelectQueryBuilder } from '@n8n/typeorm'; import type { EntityManager, SelectQueryBuilder } from '@n8n/typeorm';
import { DataSource, Repository } from '@n8n/typeorm'; import { DataSource, Repository } from '@n8n/typeorm';
@@ -5,11 +7,6 @@ import { PROJECT_ROOT } from 'n8n-workflow';
import type { ListQuery } from '@/requests'; import type { ListQuery } from '@/requests';
import type { FolderWithWorkflowAndSubFolderCount } from '../entities/folder';
import { Folder } from '../entities/folder';
import { FolderTagMapping } from '../entities/folder-tag-mapping';
import { TagEntity } from '../entities/tag-entity';
@Service() @Service()
export class FolderRepository extends Repository<FolderWithWorkflowAndSubFolderCount> { export class FolderRepository extends Repository<FolderWithWorkflowAndSubFolderCount> {
constructor(dataSource: DataSource) { constructor(dataSource: DataSource) {

View File

@@ -1,9 +1,8 @@
import type { ProjectRole } from '@n8n/api-types'; import type { ProjectRole } from '@n8n/api-types';
import { ProjectRelation } from '@n8n/db';
import { Service } from '@n8n/di'; import { Service } from '@n8n/di';
import { DataSource, In, Repository } from '@n8n/typeorm'; import { DataSource, In, Repository } from '@n8n/typeorm';
import { ProjectRelation } from '../entities/project-relation';
@Service() @Service()
export class ProjectRelationRepository extends Repository<ProjectRelation> { export class ProjectRelationRepository extends Repository<ProjectRelation> {
constructor(dataSource: DataSource) { constructor(dataSource: DataSource) {

View File

@@ -1,9 +1,8 @@
import { Project } from '@n8n/db';
import { Service } from '@n8n/di'; import { Service } from '@n8n/di';
import type { EntityManager } from '@n8n/typeorm'; import type { EntityManager } from '@n8n/typeorm';
import { DataSource, Repository } from '@n8n/typeorm'; import { DataSource, Repository } from '@n8n/typeorm';
import { Project } from '../entities/project';
@Service() @Service()
export class ProjectRepository extends Repository<Project> { export class ProjectRepository extends Repository<Project> {
constructor(dataSource: DataSource) { constructor(dataSource: DataSource) {

View File

@@ -1,11 +1,10 @@
import type { ProjectRole } from '@n8n/api-types'; import type { ProjectRole } from '@n8n/api-types';
import { SharedCredentials } from '@n8n/db';
import type { Project, CredentialSharingRole } from '@n8n/db';
import { Service } from '@n8n/di'; import { Service } from '@n8n/di';
import type { EntityManager, FindOptionsWhere } from '@n8n/typeorm'; import type { EntityManager, FindOptionsWhere } from '@n8n/typeorm';
import { DataSource, In, Not, Repository } from '@n8n/typeorm'; import { DataSource, In, Not, Repository } from '@n8n/typeorm';
import type { Project } from '../entities/project';
import { type CredentialSharingRole, SharedCredentials } from '../entities/shared-credentials';
@Service() @Service()
export class SharedCredentialsRepository extends Repository<SharedCredentials> { export class SharedCredentialsRepository extends Repository<SharedCredentials> {
constructor(dataSource: DataSource) { constructor(dataSource: DataSource) {

View File

@@ -1,10 +1,9 @@
import { SharedWorkflow } from '@n8n/db';
import type { Project, WorkflowSharingRole } from '@n8n/db';
import { Service } from '@n8n/di'; import { Service } from '@n8n/di';
import { DataSource, Repository, In, Not } from '@n8n/typeorm'; import { DataSource, Repository, In, Not } from '@n8n/typeorm';
import type { EntityManager, FindManyOptions, FindOptionsWhere } from '@n8n/typeorm'; import type { EntityManager, FindManyOptions, FindOptionsWhere } from '@n8n/typeorm';
import type { Project } from '../entities/project';
import { SharedWorkflow, type WorkflowSharingRole } from '../entities/shared-workflow';
@Service() @Service()
export class SharedWorkflowRepository extends Repository<SharedWorkflow> { export class SharedWorkflowRepository extends Repository<SharedWorkflow> {
constructor(dataSource: DataSource) { constructor(dataSource: DataSource) {

Some files were not shown because too many files have changed in this diff Show More