import type { AxiosInstance } from "axios"; import { LRUMap } from "./foundation"; import { CDS, Definition, Event, Request, Service } from "./types"; export { mustBeArray } from "./assert"; /** * assume the obj is a cds Request, so that could use it safely * * @param obj * @returns */ export declare function isCDSRequest(obj: any): obj is Request; export declare function isCDSEvent(obj: any): obj is Event; /** * check object is a cds definition or not (from LinkedCSN) * @param obj * @returns */ export declare const isCDSDefinition: (obj: any) => obj is Definition; /** * check object is a cds service or not * @param obj * @returns */ export declare const isCDSService: (obj: any) => obj is Service; /** * return null if strings are `null`/`undefined` * * @param args * @returns */ export declare function defaultStringOrNull(...args: Array): null; export declare function defaultStringOrNull(...args: Array): string; /** * setup test and return an axios instance * * the instance will not throw error when status is not 2xx * * NOTICE: you need manually install `axios` as dep dependency * * @param path * @returns axios instance (without status check) */ export declare const setupTest: (...path: Array) => AxiosInstance; /** * require for current work directory * * @param parts module parts * @returns */ export declare function cwdRequire(...parts: Array): any; /** * require for current work directory * @param id module id */ export declare function cwdRequire(id: string): any; export declare function cwdRequire(def: Definition | Service, relId: string): any; /** * require `@sap/cds` from current work space * * @returns */ export declare const cwdRequireCDS: () => CDS; /** * require module based on CAP nodejs runtime project root. * it will be useful the relative path module which defined in cds configurations maybe * * @param mName module name * @returns */ export declare const cdsProjectRequire: (mName: string) => any; /** * `hyper` memorized function, make it support multi parameters function * * PLEASE only use it for **RESTRICTED** metadata instead of transaction data * * default the cache values will be stored into LRU maps and evicts old values * * @param func a function * @param parametersNumber the number of parameters, to restrict the callee arguments * @param lruMapSize cache size for each key default is 1024 * @returns memorized function */ export declare const memorized: ) => any>(func: T, parametersNumber?: number, lruMapSize?: number) => T & { clear: () => void; caches: LRUMap[0], ReturnType>; }; /** * very simple safe `get` function * * @param object * @param path * @returns */ export declare const get: (object: any, path: string | Array) => any; /** * utils for deep annotation * * @param obj * @param prefix * @returns */ export declare const groupByKeyPrefix: (obj: any, prefix: string) => any; /** * return last item of a list * * @param list * @returns */ export declare function last(list: Array): T | undefined; /** * get current (cds) project home dir * * @returns */ export declare function getCurrentProjectHome(): string; /** * get the absolutely path of specific CDS definition * * @param def definition or cds.Service instance */ export declare function getDefinitionPath(def: Definition | Service): string; /** * * @param def definition or cds.Service instance * @returns */ export declare function getDefinitionBaseDir(def: Definition | Service): string;