better-call 1.0.20 → 1.0.21
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/client.d.cts +1 -1
- package/dist/client.d.ts +1 -1
- package/dist/index.cjs +2 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -6
- package/dist/index.js.map +1 -1
- package/dist/node.d.cts +1 -1
- package/dist/node.d.ts +1 -1
- package/dist/{router-BDQGRZdc.d.cts → router-DCy0wnVr.d.cts} +0 -45
- package/dist/{router-BDQGRZdc.d.ts → router-DCy0wnVr.d.ts} +0 -45
- package/package.json +1 -1
package/dist/client.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BetterFetchOption, BetterFetchResponse } from '@better-fetch/fetch';
|
|
2
|
-
import { j as Router, Z as UnionToIntersection, b as Endpoint, W as HasRequiredKeys } from './router-
|
|
2
|
+
import { j as Router, Z as UnionToIntersection, b as Endpoint, W as HasRequiredKeys } from './router-DCy0wnVr.cjs';
|
|
3
3
|
|
|
4
4
|
type HasRequired<T extends {
|
|
5
5
|
body?: any;
|
package/dist/client.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BetterFetchOption, BetterFetchResponse } from '@better-fetch/fetch';
|
|
2
|
-
import { j as Router, Z as UnionToIntersection, b as Endpoint, W as HasRequiredKeys } from './router-
|
|
2
|
+
import { j as Router, Z as UnionToIntersection, b as Endpoint, W as HasRequiredKeys } from './router-DCy0wnVr.js';
|
|
3
3
|
|
|
4
4
|
type HasRequired<T extends {
|
|
5
5
|
body?: any;
|
package/dist/index.cjs
CHANGED
|
@@ -700,7 +700,6 @@ createMiddleware.create = (opts) => {
|
|
|
700
700
|
};
|
|
701
701
|
|
|
702
702
|
// src/endpoint.ts
|
|
703
|
-
var originalHandlerSymbol = Symbol("kOriginalHandler");
|
|
704
703
|
var createEndpoint2 = (path, options, handler) => {
|
|
705
704
|
const internalHandler = async (...inputCtx) => {
|
|
706
705
|
const context = inputCtx[0] || {};
|
|
@@ -708,9 +707,7 @@ var createEndpoint2 = (path, options, handler) => {
|
|
|
708
707
|
options,
|
|
709
708
|
path
|
|
710
709
|
});
|
|
711
|
-
const response = await
|
|
712
|
-
internalContext
|
|
713
|
-
).catch(async (e) => {
|
|
710
|
+
const response = await handler(internalContext).catch(async (e) => {
|
|
714
711
|
if (isAPIError(e)) {
|
|
715
712
|
const onAPIError = options.onAPIError;
|
|
716
713
|
if (onAPIError) {
|
|
@@ -730,10 +727,9 @@ var createEndpoint2 = (path, options, handler) => {
|
|
|
730
727
|
response
|
|
731
728
|
} : response;
|
|
732
729
|
};
|
|
733
|
-
internalHandler[originalHandlerSymbol] = handler;
|
|
734
730
|
internalHandler.wrap = (fn) => {
|
|
735
731
|
const wrappedFn = async (context) => {
|
|
736
|
-
return fn(context,
|
|
732
|
+
return fn(context, handler);
|
|
737
733
|
};
|
|
738
734
|
return createEndpoint2(path, options, wrappedFn);
|
|
739
735
|
};
|