/// import { FastifyRequest } from 'fastify'; import { FastifyInstance } from 'fastify/types/instance'; import { ObjectId } from 'mongodb'; import { ApiResponse } from './ApiResponse'; import { ReplyData } from './http'; /** * Awaits and catches promises. Returns a tuple containing the error and result * @param p The promise to await */ export declare function tuple(p: Promise): Promise<[null, T] | [unknown, null]>; export declare function tryTo(p: () => T): [null, T] | [unknown, null]; export declare function tryJsonParse(value: string): [null, T] | [Error, null]; export declare function tryEJsonParse(value: string): [null, T] | [Error, null]; export declare function requireOptional(value: string): any; export declare function toTitleCase(str: string): string; export declare function assertAndThrow(condition: any, message: string): asserts condition; export declare function readPackageJson(): any; export declare const isFalsy: (x: any) => boolean; export declare function parseCookie(str: string, options?: {}): Record; export declare const getNonce: () => string; export declare const toUpdateFilter: (doc: object) => Record; declare type handlerFn = (req: any, reply: any) => MaybePromise; export declare const handlerWrapper: >(fn: handlerFn) => (this: FastifyInstance, req: any, reply: any) => Promise; export declare const mapOutDocument: ({ _id, ...rest }: Record) => { id: any; }; export declare const mapInDocument: ({ id, ...rest }: Record) => { _id: ObjectId; }; export declare const defaultRenamer: (key: string) => string; export declare function deepRename(obj: any, renamer?: (key: string) => string): T; export declare const removeIds: (obj: Record) => Record; export declare const coerceArray: (arr: string | string[]) => string[]; export declare type MaybePromise = Promise | T; export declare const onDeath: (cb: () => void) => void; export {};