import type { Knex } from '@nangohq/database'; import type { ConnectSessionInput, DBEndUser, DBEnvironment, DBTeam, EndUser, StoredConnection } from '@nangohq/types'; import type { Result } from '@nangohq/utils'; export declare const EndUserMapper: { to: (endUser: EndUser) => DBEndUser; from: (dbEndUser: DBEndUser) => EndUser; }; type EndUserErrorCode = 'not_found' | 'creation_failed' | 'update_failed'; export declare class EndUserError extends Error { code: EndUserErrorCode; payload?: Record; constructor({ code, message, payload }: { code: EndUserErrorCode; message: string; payload?: Record; }); } export declare function createEndUser(db: Knex, { endUserId, email, displayName, organization, accountId, environmentId }: Pick): Promise>; export declare function getEndUser(db: Knex, props: { endUserId: string; accountId: number; environmentId: number; } | { id: number; accountId: number; environmentId: number; }): Promise>; export declare function updateEndUser(db: Knex, { endUserId, accountId, environmentId, email, displayName, organization }: Pick): Promise>; export declare function deleteEndUser(db: Knex, { endUserId, accountId, environmentId }: { endUserId: string; accountId: number; environmentId: number; }): Promise>; export declare function linkConnection(db: Knex, { endUserId, connection }: { endUserId: number; connection: Pick; }): Promise; export declare function unlinkConnection(db: Knex, { connection }: { connection: Pick; }): Promise; export declare function getEndUserByConnectionId(db: Knex, props: { connectionId: number; }): Promise>; export declare function upsertEndUser(db: Knex, { account, environment, endUserPayload, organization }: { account: DBTeam; environment: DBEnvironment; endUserPayload: ConnectSessionInput['end_user']; organization?: ConnectSessionInput['organization']; }): Promise>; export {};