@farm.js/core 0.1.0-beta.65 → 0.1.0-beta.67

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.
Files changed (56) hide show
  1. package/dist/api/route-manager.cjs +2 -1
  2. package/dist/api/route-manager.cjs.map +1 -1
  3. package/dist/api/route-manager.d.mts +6 -2
  4. package/dist/api/route-manager.d.ts +6 -2
  5. package/dist/api/route-manager.mjs +1 -1
  6. package/dist/api.cjs +2 -1
  7. package/dist/api.cjs.map +1 -1
  8. package/dist/api.d.mts +1 -1
  9. package/dist/api.d.ts +1 -1
  10. package/dist/api.mjs +2 -2
  11. package/dist/{chunk-R6UV2YLL.mjs → chunk-335JWE6F.mjs} +4 -4
  12. package/dist/{chunk-R6UV2YLL.mjs.map → chunk-335JWE6F.mjs.map} +1 -1
  13. package/dist/{chunk-VQYZ6JT6.mjs → chunk-3PO3UK5B.mjs} +2 -2
  14. package/dist/{chunk-VQYZ6JT6.mjs.map → chunk-3PO3UK5B.mjs.map} +1 -1
  15. package/dist/{chunk-BYBYZSQ4.mjs → chunk-6HZ23B26.mjs} +2 -2
  16. package/dist/{chunk-ITSBK56Q.mjs → chunk-BDDLX64F.mjs} +3 -2
  17. package/dist/chunk-BDDLX64F.mjs.map +1 -0
  18. package/dist/{chunk-ECLBGYGZ.mjs → chunk-GAPAL2TO.mjs} +2 -2
  19. package/dist/{chunk-H5D6FDSG.mjs → chunk-HLMU3U7K.mjs} +3 -3
  20. package/dist/client/lifecycle.mjs +2 -2
  21. package/dist/client-plugins.cjs +1 -1
  22. package/dist/client-plugins.cjs.map +1 -1
  23. package/dist/client-plugins.mjs +2 -2
  24. package/dist/client.cjs +1 -1
  25. package/dist/client.cjs.map +1 -1
  26. package/dist/client.mjs +2 -2
  27. package/dist/index.cjs +4 -3
  28. package/dist/index.cjs.map +1 -1
  29. package/dist/index.d.mts +1 -1
  30. package/dist/index.d.ts +1 -1
  31. package/dist/index.mjs +6 -6
  32. package/dist/internal/build-runtime.cjs +4 -3
  33. package/dist/internal/build-runtime.cjs.map +1 -1
  34. package/dist/internal/build-runtime.mjs +4 -4
  35. package/dist/internal/client-runtime.cjs +1 -1
  36. package/dist/internal/client-runtime.cjs.map +1 -1
  37. package/dist/internal/client-runtime.mjs +2 -2
  38. package/dist/plugin.cjs +4 -3
  39. package/dist/plugin.cjs.map +1 -1
  40. package/dist/plugin.mjs +3 -3
  41. package/dist/server.cjs +4 -3
  42. package/dist/server.cjs.map +1 -1
  43. package/dist/server.mjs +3 -3
  44. package/dist/testing.cjs.map +1 -1
  45. package/dist/testing.mjs +1 -1
  46. package/dist/version.cjs +1 -1
  47. package/dist/version.cjs.map +1 -1
  48. package/dist/version.mjs +1 -1
  49. package/dist/vite.cjs +4 -3
  50. package/dist/vite.cjs.map +1 -1
  51. package/dist/vite.mjs +3 -3
  52. package/package.json +1 -1
  53. package/dist/chunk-ITSBK56Q.mjs.map +0 -1
  54. /package/dist/{chunk-BYBYZSQ4.mjs.map → chunk-6HZ23B26.mjs.map} +0 -0
  55. /package/dist/{chunk-ECLBGYGZ.mjs.map → chunk-GAPAL2TO.mjs.map} +0 -0
  56. /package/dist/{chunk-H5D6FDSG.mjs.map → chunk-HLMU3U7K.mjs.map} +0 -0
@@ -19,6 +19,10 @@ interface APIRouteManagerOptions {
19
19
  i18n?: FarmI18nRuntime;
20
20
  bodySizeLimit?: number;
21
21
  }
22
+ interface APIRouteHandlerOptions {
23
+ /** Let a framework request boundary report the original endpoint error. */
24
+ throwOnError?: boolean;
25
+ }
22
26
  declare const API_ROUTE_METHODS: readonly ["GET", "HEAD", "QUERY", "POST", "PUT", "DELETE", "PATCH", "OPTIONS"];
23
27
  declare class APIRouteManager {
24
28
  private routes;
@@ -53,7 +57,7 @@ declare class APIRouteManager {
53
57
  /**
54
58
  * Get the handler that directly invokes endpoint handlers
55
59
  */
56
- getHandler(): ((req: Request) => Promise<Response>) | null;
60
+ getHandler(options?: APIRouteHandlerOptions): ((req: Request) => Promise<Response>) | null;
57
61
  /**
58
62
  * Check if a path is an API route
59
63
  */
@@ -65,4 +69,4 @@ declare class APIRouteManager {
65
69
  getRoutes(): Map<string, APIRoute>;
66
70
  }
67
71
 
68
- export { type APIRoute, APIRouteManager, type APIRouteManagerOptions, APIRouteMatch, API_ROUTE_METHODS };
72
+ export { type APIRoute, type APIRouteHandlerOptions, APIRouteManager, type APIRouteManagerOptions, APIRouteMatch, API_ROUTE_METHODS };
@@ -19,6 +19,10 @@ interface APIRouteManagerOptions {
19
19
  i18n?: FarmI18nRuntime;
20
20
  bodySizeLimit?: number;
21
21
  }
22
+ interface APIRouteHandlerOptions {
23
+ /** Let a framework request boundary report the original endpoint error. */
24
+ throwOnError?: boolean;
25
+ }
22
26
  declare const API_ROUTE_METHODS: readonly ["GET", "HEAD", "QUERY", "POST", "PUT", "DELETE", "PATCH", "OPTIONS"];
23
27
  declare class APIRouteManager {
24
28
  private routes;
@@ -53,7 +57,7 @@ declare class APIRouteManager {
53
57
  /**
54
58
  * Get the handler that directly invokes endpoint handlers
55
59
  */
56
- getHandler(): ((req: Request) => Promise<Response>) | null;
60
+ getHandler(options?: APIRouteHandlerOptions): ((req: Request) => Promise<Response>) | null;
57
61
  /**
58
62
  * Check if a path is an API route
59
63
  */
@@ -65,4 +69,4 @@ declare class APIRouteManager {
65
69
  getRoutes(): Map<string, APIRoute>;
66
70
  }
67
71
 
68
- export { type APIRoute, APIRouteManager, type APIRouteManagerOptions, APIRouteMatch, API_ROUTE_METHODS };
72
+ export { type APIRoute, type APIRouteHandlerOptions, APIRouteManager, type APIRouteManagerOptions, APIRouteMatch, API_ROUTE_METHODS };
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  APIRouteManager,
3
3
  API_ROUTE_METHODS
4
- } from "../chunk-ITSBK56Q.mjs";
4
+ } from "../chunk-BDDLX64F.mjs";
5
5
  import "../chunk-HO33MT4X.mjs";
6
6
  import "../chunk-FQYDHKKU.mjs";
7
7
  import "../chunk-SXWF4QRU.mjs";
package/dist/api.cjs CHANGED
@@ -3411,7 +3411,7 @@ var _APIRouteManager = class _APIRouteManager {
3411
3411
  /**
3412
3412
  * Get the handler that directly invokes endpoint handlers
3413
3413
  */
3414
- getHandler() {
3414
+ getHandler(options = {}) {
3415
3415
  if (this.routes.size === 0) {
3416
3416
  return null;
3417
3417
  }
@@ -3441,6 +3441,7 @@ var _APIRouteManager = class _APIRouteManager {
3441
3441
  try {
3442
3442
  return await invokeAPIRouteEndpoint(endpoint, request, params, this.bodySizeLimit);
3443
3443
  } catch (error) {
3444
+ if (options.throwOnError) throw error;
3444
3445
  console.error(`[API Error] ${pathname}:`, error);
3445
3446
  return new Response(JSON.stringify({ error: "Internal Server Error" }), {
3446
3447
  status: 500,