MCPcopy
hub / github.com/di-sukharev/opencommit / _do

Method _do

out/cli.cjs:33911–33953  ·  view source on GitHub ↗
(request3, options)

Source from the content-addressed store, hash-verified

33909 return (0, fp_js_1.OK)(new Request(input.url, input.options));
33910 }
33911 async _do(request3, options) {
33912 const { context, errorCodes } = options;
33913 return (0, retries_js_1.retry)(async () => {
33914 const req = await __classPrivateFieldGet13(this, _ClientSDK_hooks, "f").beforeRequest(context, request3.clone());
33915 await logRequest(__classPrivateFieldGet13(this, _ClientSDK_logger, "f"), req).catch((e3) => {
33916 var _a5;
33917 return (_a5 = __classPrivateFieldGet13(this, _ClientSDK_logger, "f")) === null || _a5 === void 0 ? void 0 : _a5.log("Failed to log request:", e3);
33918 });
33919 let response = await __classPrivateFieldGet13(this, _ClientSDK_httpClient, "f").request(req);
33920 try {
33921 if ((0, http_js_1.matchStatusCode)(response, errorCodes)) {
33922 const result = await __classPrivateFieldGet13(this, _ClientSDK_hooks, "f").afterError(context, response, null);
33923 if (result.error) {
33924 throw result.error;
33925 }
33926 response = result.response || response;
33927 } else {
33928 response = await __classPrivateFieldGet13(this, _ClientSDK_hooks, "f").afterSuccess(context, response);
33929 }
33930 } finally {
33931 await logResponse(__classPrivateFieldGet13(this, _ClientSDK_logger, "f"), response, req).catch((e3) => {
33932 var _a5;
33933 return (_a5 = __classPrivateFieldGet13(this, _ClientSDK_logger, "f")) === null || _a5 === void 0 ? void 0 : _a5.log("Failed to log response:", e3);
33934 });
33935 }
33936 return response;
33937 }, { config: options.retryConfig, statusCodes: options.retryCodes }).then((r3) => (0, fp_js_1.OK)(r3), (err) => {
33938 switch (true) {
33939 case (0, http_js_1.isAbortError)(err):
33940 return (0, fp_js_1.ERR)(new httpclienterrors_js_1.RequestAbortedError("Request aborted by client", {
33941 cause: err
33942 }));
33943 case (0, http_js_1.isTimeoutError)(err):
33944 return (0, fp_js_1.ERR)(new httpclienterrors_js_1.RequestTimeoutError("Request timed out", { cause: err }));
33945 case (0, http_js_1.isConnectionError)(err):
33946 return (0, fp_js_1.ERR)(new httpclienterrors_js_1.ConnectionError("Unable to make request", { cause: err }));
33947 default:
33948 return (0, fp_js_1.ERR)(new httpclienterrors_js_1.UnexpectedClientError("Unexpected HTTP client error", {
33949 cause: err
33950 }));
33951 }
33952 });
33953 }
33954 };
33955 exports2.ClientSDK = ClientSDK;
33956 _ClientSDK_httpClient = /* @__PURE__ */ new WeakMap(), _ClientSDK_hooks = /* @__PURE__ */ new WeakMap(), _ClientSDK_logger = /* @__PURE__ */ new WeakMap();

Callers 15

agentsCompleteFunction · 0.80
agentsStreamFunction · 0.80
batchJobsCancelFunction · 0.80
batchJobsCreateFunction · 0.80
batchJobsGetFunction · 0.80
batchJobsListFunction · 0.80
chatCompleteFunction · 0.80
chatStreamFunction · 0.80
classifiersModerateFunction · 0.80
classifiersModerateChatFunction · 0.80
embeddingsCreateFunction · 0.80
filesDeleteFunction · 0.80

Calls 9

logRequestFunction · 0.85
logResponseFunction · 0.85
thenMethod · 0.80
beforeRequestMethod · 0.80
afterErrorMethod · 0.80
afterSuccessMethod · 0.80
cloneMethod · 0.45
catchMethod · 0.45
requestMethod · 0.45

Tested by

no test coverage detected