@vitrical/utils
Advanced tools
Comparing version 1.1.8 to 1.1.9
@@ -30,3 +30,3 @@ import { Response } from './superagent'; | ||
export declare const request: ({ method, url, body, query, headers, }: CustomRequestOptions) => Promise<CustomRequestResponse>; | ||
export declare const makeMicroserviceRequest: (baseURL: string, key: string) => (method: 'get' | 'post' | 'put' | 'delete', url: string, options?: { | ||
export declare function makeMicroserviceRequest<T = any>(baseURL: string, key: string): (method: 'get' | 'post' | 'put' | 'delete', url: string, options?: { | ||
body?: string | { | ||
@@ -41,2 +41,2 @@ [key: string]: any; | ||
} | undefined; | ||
} | undefined) => Promise<CustomRequestResponse>; | ||
} | undefined) => () => Promise<T>; |
25
api.js
@@ -89,13 +89,18 @@ "use strict"; | ||
exports.request = request; | ||
const makeMicroserviceRequest = (baseURL, key) => (method, url, options) => (0, exports.request)({ | ||
method, | ||
url: `${baseURL}${url}`, | ||
body: options?.body, | ||
query: options?.query, | ||
headers: { | ||
key, | ||
...options?.headers, | ||
}, | ||
}); | ||
function makeMicroserviceRequest(baseURL, key) { | ||
return (method, url, options) => async () => { | ||
const req = await (0, exports.request)({ | ||
method, | ||
url: `${baseURL}${url}`, | ||
body: options?.body, | ||
query: options?.query, | ||
headers: { | ||
key, | ||
...options?.headers, | ||
}, | ||
}); | ||
return req.body; | ||
}; | ||
} | ||
exports.makeMicroserviceRequest = makeMicroserviceRequest; | ||
//# sourceMappingURL=api.js.map |
{ | ||
"name": "@vitrical/utils", | ||
"version": "1.1.8", | ||
"version": "1.1.9", | ||
"description": "Collection of useful functions and typings", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
45221
768