@h4ad/serverless-adapter
Version:
Run REST APIs and other web applications using your existing Node.js application framework (NestJS, Express, Koa, Hapi, Fastify and many others), on top of AWS, Azure, Digital Ocean and many other clouds.
65 lines (62 loc) • 1.88 kB
text/typescript
/**
* Removes 'optional' attributes from a type's properties
*
* @breadcrumb Types
* @public
*/
type Concrete<Type> = {
[Property in keyof Type]-?: Type[Property];
};
/**
* Transform the path and a map of query params to a string with formatted query params
*
* @example
* ```typescript
* const path = '/pets/search';
* const queryParams = { batata: undefined, petType: [ 'dog', 'fish' ] };
* const result = getPathWithQueryStringParams(path, queryParams);
* console.log(result);
* // /pets/search?batata=&petType=dog&petType=fish
* ```
*
* @param path - The path
* @param queryParams - The query params
*
* @breadcrumb Core / Path
* @public
*/
declare function getPathWithQueryStringParams(path: string, queryParams: string | Record<string, string | string[] | undefined> | undefined | null): string;
/**
* Map query params to a string with formatted query params
*
* @example
* ```typescript
* const queryParams = { batata: undefined, petType: [ 'dog', 'fish' ] };
* const result = getQueryParamsStringFromRecord(queryParams);
* console.log(result);
* // batata=&petType=dog&petType=fish
* ```
*
* @param queryParamsRecord - The query params record
*
* @breadcrumb Core / Path
* @public
*/
declare function getQueryParamsStringFromRecord(queryParamsRecord: Record<string, string | string[] | undefined> | undefined | null): string;
/**
* Type of the function to strip base path
*
* @breadcrumb Core / Path
* @public
*/
type StripBasePathFn = (path: string) => string;
/**
* Get the strip base path function
*
* @param basePath - The base path
*
* @breadcrumb Core / Path
* @public
*/
declare function buildStripBasePath(basePath: string | undefined): StripBasePathFn;
export { type Concrete as C, type StripBasePathFn as S, getQueryParamsStringFromRecord as a, buildStripBasePath as b, getPathWithQueryStringParams as g };