hono-utils 0.3.3 → 0.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +12 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -2
- package/dist/index.d.ts +1 -2
- package/dist/index.js +12 -13
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -14241,19 +14241,19 @@ var onNotFound = async (c) => {
|
|
|
14241
14241
|
var _client = require('hono/client');
|
|
14242
14242
|
|
|
14243
14243
|
|
|
14244
|
-
var createTypedClient = (
|
|
14245
|
-
|
|
14246
|
-
|
|
14247
|
-
|
|
14248
|
-
|
|
14249
|
-
|
|
14250
|
-
_optionalChain([
|
|
14244
|
+
var createTypedClient = () => {
|
|
14245
|
+
return (options) => async (fn, callbacks) => {
|
|
14246
|
+
const client = _client.hc.call(void 0, options.url, {
|
|
14247
|
+
headers: options.headers,
|
|
14248
|
+
fetch: options.fetch
|
|
14249
|
+
});
|
|
14250
|
+
_optionalChain([callbacks, 'optionalAccess', _192 => _192.onStart, 'optionalCall', _193 => _193()]);
|
|
14251
14251
|
let responseHeaders = new Headers();
|
|
14252
14252
|
try {
|
|
14253
14253
|
const response2 = await fn(client);
|
|
14254
14254
|
responseHeaders = response2.headers;
|
|
14255
14255
|
const data = await _client.parseResponse.call(void 0, response2);
|
|
14256
|
-
_optionalChain([
|
|
14256
|
+
_optionalChain([callbacks, 'optionalAccess', _194 => _194.onSuccess, 'optionalCall', _195 => _195(data, responseHeaders)]);
|
|
14257
14257
|
return data;
|
|
14258
14258
|
} catch (err) {
|
|
14259
14259
|
const errorBody = { message: err.message };
|
|
@@ -14262,20 +14262,19 @@ var createTypedClient = (options) => {
|
|
|
14262
14262
|
const { detail, statusCode } = err;
|
|
14263
14263
|
status = _nullishCoalesce(statusCode, () => ( 500));
|
|
14264
14264
|
if (!detail) {
|
|
14265
|
-
_optionalChain([
|
|
14265
|
+
_optionalChain([callbacks, 'optionalAccess', _196 => _196.errorHandler, 'optionalCall', _197 => _197(500, {
|
|
14266
14266
|
message: "Fetch malformed"
|
|
14267
14267
|
})]);
|
|
14268
14268
|
throw new (0, _httpexception.HTTPException)(500, { message: "Fetch malformed" });
|
|
14269
14269
|
}
|
|
14270
14270
|
}
|
|
14271
|
-
_optionalChain([
|
|
14272
|
-
_optionalChain([
|
|
14271
|
+
_optionalChain([callbacks, 'optionalAccess', _198 => _198.onError, 'optionalCall', _199 => _199(errorBody, responseHeaders)]);
|
|
14272
|
+
_optionalChain([callbacks, 'optionalAccess', _200 => _200.errorHandler, 'optionalCall', _201 => _201(status, errorBody)]);
|
|
14273
14273
|
throw new (0, _httpexception.HTTPException)(status, errorBody);
|
|
14274
14274
|
} finally {
|
|
14275
|
-
_optionalChain([
|
|
14275
|
+
_optionalChain([callbacks, 'optionalAccess', _202 => _202.onEnd, 'optionalCall', _203 => _203()]);
|
|
14276
14276
|
}
|
|
14277
14277
|
};
|
|
14278
|
-
return rpcClient;
|
|
14279
14278
|
};
|
|
14280
14279
|
|
|
14281
14280
|
|