@openapi-io-ts/runtime
Advanced tools
Comparing version 0.0.0-20220126230454 to 0.0.0-20220127113805
@@ -244,8 +244,6 @@ var __defProp = Object.defineProperty; | ||
// src/client/request.ts | ||
function request(operation, requestAdapter) { | ||
return (args) => { | ||
var _a; | ||
return pipe3(prepareRequest(operation, (_a = args.params) != null ? _a : {}, args.body), TE3.chain(({ url, init }) => performRequest(url, init, requestAdapter)), TE3.chain((response) => parseResponse(response, operation.responses))); | ||
}; | ||
} | ||
var requestFunctionBuilder = (operation, requestAdapter) => (args) => { | ||
var _a; | ||
return pipe3(prepareRequest(operation, (_a = args.params) != null ? _a : {}, args.body), TE3.chain(({ url, init }) => performRequest(url, init, requestAdapter)), TE3.chain((response) => parseResponse(response, operation.responses))); | ||
}; | ||
function performRequest(url, init, requestAdapter) { | ||
@@ -258,5 +256,5 @@ return TE3.tryCatch(() => requestAdapter(url, init), (e) => requestError(E2.toError(e))); | ||
httpError, | ||
request, | ||
requestError | ||
requestError, | ||
requestFunctionBuilder | ||
}; | ||
//# sourceMappingURL=index.js.map |
@@ -89,3 +89,4 @@ import * as t from 'io-ts'; | ||
declare type OperationArgsParams<RequestParameters> = RequestParameters extends undefined ? { | ||
declare type ParametersRecord = Record<string, unknown> | undefined; | ||
declare type OperationArgsParams<RequestParameters extends ParametersRecord> = RequestParameters extends undefined ? { | ||
params?: undefined; | ||
@@ -100,4 +101,4 @@ } : { | ||
}; | ||
declare type OperationArgs<RequestParameters, RequestBody> = OperationArgsParams<RequestParameters> & OperationArgsBody<RequestBody>; | ||
declare type OperationTypes<RequestParameters, RequestBody, ReturnType> = { | ||
declare type OperationArgs<RequestParameters extends ParametersRecord, RequestBody> = OperationArgsParams<RequestParameters> & OperationArgsBody<RequestBody>; | ||
declare type OperationTypes<RequestParameters extends ParametersRecord, RequestBody, ReturnType> = { | ||
args: OperationArgs<RequestParameters, RequestBody>; | ||
@@ -107,8 +108,11 @@ returnType: ReturnType; | ||
declare type RequestFunction<RequestParameters, RequestBody, ReturnType> = (args: OperationArgs<RequestParameters, RequestBody>) => TE.TaskEither<ApiError, ApiResponse<ReturnType>>; | ||
declare type MappedOperationRequestFunction<Operations, OperationsTypesMap> = OperationsTypesMap extends Record<keyof Operations, OperationTypes<infer _A, infer _B, infer _C>> ? { | ||
[Name in keyof Operations]: RequestFunction<OperationsTypesMap[Name]["args"]["params"], OperationsTypesMap[Name]["args"]["body"], OperationsTypesMap[Name]["returnType"]>; | ||
declare type RequestFunction<OpArgs, ReturnType> = (args: OpArgs extends OperationArgs<infer RequestParameters, infer RequestBody> ? OperationArgs<RequestParameters, RequestBody> : never) => TE.TaskEither<ApiError, ApiResponse<ReturnType>>; | ||
declare type RequestFunctionBuilder = <OpArgs, ReturnType>(operation: Operation, requestAdapter: HttpRequestAdapter) => RequestFunction<OpArgs, ReturnType>; | ||
declare type RequestFunctionsMap<OpTypesMap> = OpTypesMap extends { | ||
[OperationId in keyof OpTypesMap]: OperationTypes<infer _A, infer _B, infer _C>; | ||
} ? { | ||
[OperationId in keyof OpTypesMap]: RequestFunction<OpTypesMap[OperationId]["args"], OpTypesMap[OperationId]["returnType"]>; | ||
} : never; | ||
declare function request<RequestParameters, RequestBody, ReturnType>(operation: Operation, requestAdapter: HttpRequestAdapter): RequestFunction<RequestParameters, RequestBody, ReturnType>; | ||
declare const requestFunctionBuilder: RequestFunctionBuilder; | ||
export { ApiError, ApiResponse, BaseParameter, BinaryBody, ContentParseError, DecodeError, EmptyResponse, FileResponse, FormBody, FormParameter, HttpError, HttpRequestAdapter, JsonBody, JsonParameter, JsonResponse, MappedOperationRequestFunction, MultipartBody, Operation, OperationArgs, OperationBody, OperationParameter, OperationResponse, OperationResponseType, OperationResponses, OperationTypes, RequestError, RequestFunction, TextBody, contentParseError, decodeError, httpError, request, requestError }; | ||
export { ApiError, ApiResponse, BaseParameter, BinaryBody, ContentParseError, DecodeError, EmptyResponse, FileResponse, FormBody, FormParameter, HttpError, HttpRequestAdapter, JsonBody, JsonParameter, JsonResponse, MultipartBody, Operation, OperationArgs, OperationBody, OperationParameter, OperationResponse, OperationResponseType, OperationResponses, OperationTypes, ParametersRecord, RequestError, RequestFunction, RequestFunctionBuilder, RequestFunctionsMap, TextBody, contentParseError, decodeError, httpError, requestError, requestFunctionBuilder }; |
@@ -49,4 +49,4 @@ var __create = Object.create; | ||
httpError: () => httpError, | ||
request: () => request, | ||
requestError: () => requestError | ||
requestError: () => requestError, | ||
requestFunctionBuilder: () => requestFunctionBuilder | ||
}); | ||
@@ -280,8 +280,6 @@ | ||
// src/client/request.ts | ||
function request(operation, requestAdapter) { | ||
return (args) => { | ||
var _a; | ||
return (0, import_function3.pipe)(prepareRequest(operation, (_a = args.params) != null ? _a : {}, args.body), TE3.chain(({ url, init }) => performRequest(url, init, requestAdapter)), TE3.chain((response) => parseResponse(response, operation.responses))); | ||
}; | ||
} | ||
var requestFunctionBuilder = (operation, requestAdapter) => (args) => { | ||
var _a; | ||
return (0, import_function3.pipe)(prepareRequest(operation, (_a = args.params) != null ? _a : {}, args.body), TE3.chain(({ url, init }) => performRequest(url, init, requestAdapter)), TE3.chain((response) => parseResponse(response, operation.responses))); | ||
}; | ||
function performRequest(url, init, requestAdapter) { | ||
@@ -296,5 +294,5 @@ return TE3.tryCatch(() => requestAdapter(url, init), (e) => requestError(E2.toError(e))); | ||
httpError, | ||
request, | ||
requestError | ||
requestError, | ||
requestFunctionBuilder | ||
}); | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@openapi-io-ts/runtime", | ||
"version": "0.0.0-20220126230454", | ||
"version": "0.0.0-20220127113805", | ||
"description": "Runtime for openapi-io-ts", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
Sorry, the diff of this file is not supported yet
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
61141
649