n8n
Version:
n8n Workflow Automation Tool
43 lines (42 loc) • 1.41 kB
TypeScript
import type { TagEntity, ITagWithCountDb } from '@n8n/db';
import { TagRepository } from '@n8n/db';
import { ExternalHooks } from '../external-hooks';
type GetAllResult<T> = T extends {
withUsageCount: true;
} ? ITagWithCountDb[] : TagEntity[];
export declare class TagService {
private externalHooks;
private tagRepository;
constructor(externalHooks: ExternalHooks, tagRepository: TagRepository);
toEntity(attrs: {
name: string;
id?: string;
}): TagEntity;
save(tag: TagEntity, actionKind: 'create' | 'update'): Promise<TagEntity>;
delete(id: string): Promise<import("@n8n/typeorm").DeleteResult>;
getAll<T extends {
withUsageCount: boolean;
limit?: number;
orderByName?: boolean;
}>(options?: T): Promise<GetAllResult<T>>;
getPaginated({ offset, limit }: {
offset: number;
limit: number;
}): Promise<{
data: TagEntity[];
count: number;
}>;
getById(id: string): Promise<TagEntity>;
listWithUsageCount({ limit }: {
limit: number;
}): Promise<{
data: ITagWithCountDb[];
totalCount: number;
}>;
sortByRequestOrder(tags: TagEntity[], { requestOrder }: {
requestOrder: string[];
}): TagEntity[];
findByNames(names: string[]): Promise<TagEntity[]>;
findOrCreateByNames(names: string[]): Promise<TagEntity[]>;
}
export {};