n8n
Version:
n8n Workflow Automation Tool
39 lines (38 loc) • 1.66 kB
TypeScript
import { CreateRoleMappingRuleDto, type ListRoleMappingRuleQueryInput, type PatchRoleMappingRuleInput } from '@n8n/api-types';
import { ProjectRepository, RoleMappingRuleRepository, RoleRepository } from '@n8n/db';
import { type EntityManager } from '@n8n/typeorm';
import type { z } from 'zod';
type CreateRoleMappingRuleInput = z.infer<(typeof CreateRoleMappingRuleDto)['schema']>;
export type RoleMappingRuleResponse = {
id: string;
expression: string;
role: string;
type: 'instance' | 'project';
order: number;
projectIds: string[];
createdAt: string;
updatedAt: string;
};
export type RoleMappingRuleListResponse = {
count: number;
items: RoleMappingRuleResponse[];
};
export declare class RoleMappingRuleService {
private readonly roleMappingRuleRepository;
private readonly roleRepository;
private readonly projectRepository;
constructor(roleMappingRuleRepository: RoleMappingRuleRepository, roleRepository: RoleRepository, projectRepository: ProjectRepository);
list(query: ListRoleMappingRuleQueryInput): Promise<RoleMappingRuleListResponse>;
create(dto: CreateRoleMappingRuleInput): Promise<RoleMappingRuleResponse>;
patch(id: string, dto: PatchRoleMappingRuleInput): Promise<RoleMappingRuleResponse>;
delete(id: string): Promise<{
ruleType: 'instance' | 'project';
}>;
deleteAllOfType(type: 'instance' | 'project', tx?: EntityManager): Promise<number>;
move(id: string, targetIndex: number): Promise<RoleMappingRuleResponse>;
private applyOrder;
private normalizeOrderForType;
private assertOrderAvailable;
private toResponse;
}
export {};