UNPKG

@squidcloud/client

Version:

A typescript implementation of the Squid client

20 lines (19 loc) 1.16 kB
import { HttpStatusCode } from '../public-types/http-status.public-types'; export declare class ValidationError extends Error { readonly statusCode: HttpStatusCode; readonly details?: any; constructor(error: string, statusCode: HttpStatusCode, details?: Record<string, unknown>); } export declare function isValidId(id: unknown, maxLength?: number): boolean; export declare function validateFieldSort(fieldSort: unknown): void; export declare function validateQueryLimit(limit: unknown): void; /** * All type names returned by 'typeof' supported by JavaScript: * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/typeof}. * and a few other supported types. */ export type JavascriptTypeName = 'undefined' | 'object' | 'boolean' | 'number' | 'bigint' | 'string' | 'symbol' | 'function'; /** Returns true if 'typeof' of the 'value' is 'type' or 'type[]'. */ export declare function isRightType(value: unknown, type: JavascriptTypeName): boolean; /** Returns true if 'obj' has only keys listed in the 'keys'. Object can't be an array. */ export declare function hasOnlyKeys(obj: object, keys: string[]): boolean;