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 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-BDQGRZdc.cjs';
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-BDQGRZdc.js';
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 internalHandler[originalHandlerSymbol](
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, internalHandler[originalHandlerSymbol]);
732
+ return fn(context, handler);
737
733
  };
738
734
  return createEndpoint2(path, options, wrappedFn);
739
735
  };