import { Injectable } from '@nestjs/common'; import { InjectKysely } from 'nestjs-kysely'; import { KyselyDB, KyselyTransaction } from '../../types/kysely.types'; import { Label } from '@docmost/db/types/entity.types'; import { dbOrTx } from '@docmost/db/utils'; import { SpaceMemberRepo } from '@docmost/db/repos/space/space-member.repo'; import { PaginationOptions } from '@docmost/db/pagination/pagination-options'; import { executeWithCursorPagination } from '@docmost/db/pagination/cursor-pagination'; import { jsonArrayFrom, jsonObjectFrom } from 'kysely/helpers/postgres'; import { normalizeLabelName } from '../../../core/label/utils'; export const LabelType = { PAGE: 'page', SPACE: 'space', } as const; export type LabelType = (typeof LabelType)[keyof typeof LabelType]; @Injectable() export class LabelRepo { constructor( @InjectKysely() private readonly db: KyselyDB, private readonly spaceMemberRepo: SpaceMemberRepo, ) {} async findById( labelId: string, trx?: KyselyTransaction, ): Promise