@514labs/moose-lib 0.6.244-ci-1-g1f019cce → 0.6.244-ci-4-g8bb466b6

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.
@@ -2481,9 +2481,16 @@ var WebApp = class {
2481
2481
  if (typeof app.callback === "function") {
2482
2482
  return app.callback();
2483
2483
  }
2484
- if (typeof app.routing === "function") {
2485
- return (req, res) => {
2486
- app.routing(req, res);
2484
+ if (app.routing && typeof app.routing === "object") {
2485
+ return async (req, res) => {
2486
+ const fastifyApp = app;
2487
+ if (fastifyApp.routing && typeof fastifyApp.routing.handle === "function") {
2488
+ fastifyApp.routing.handle(req, res);
2489
+ } else {
2490
+ throw new Error(
2491
+ "Fastify app detected but not properly initialized. Ensure .ready() is called before passing to WebApp."
2492
+ );
2493
+ }
2487
2494
  };
2488
2495
  }
2489
2496
  throw new Error(
@@ -2491,12 +2498,11 @@ var WebApp = class {
2491
2498
  - A function (raw Node.js handler)
2492
2499
  - An object with .handle() method (Express, Connect)
2493
2500
  - An object with .callback() method (Koa)
2494
- - An object with .routing function (Fastify)
2501
+ - An object with .routing property (Fastify after .ready())
2495
2502
 
2496
2503
  Examples:
2497
2504
  Express: new WebApp("name", expressApp)
2498
2505
  Koa: new WebApp("name", koaApp)
2499
- Fastify: new WebApp("name", fastifyApp)
2500
2506
  Raw: new WebApp("name", (req, res) => { ... })
2501
2507
  `
2502
2508
  );