@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.
@@ -2386,9 +2386,16 @@ var WebApp = class {
2386
2386
  if (typeof app.callback === "function") {
2387
2387
  return app.callback();
2388
2388
  }
2389
- if (typeof app.routing === "function") {
2390
- return (req, res) => {
2391
- app.routing(req, res);
2389
+ if (app.routing && typeof app.routing === "object") {
2390
+ return async (req, res) => {
2391
+ const fastifyApp = app;
2392
+ if (fastifyApp.routing && typeof fastifyApp.routing.handle === "function") {
2393
+ fastifyApp.routing.handle(req, res);
2394
+ } else {
2395
+ throw new Error(
2396
+ "Fastify app detected but not properly initialized. Ensure .ready() is called before passing to WebApp."
2397
+ );
2398
+ }
2392
2399
  };
2393
2400
  }
2394
2401
  throw new Error(
@@ -2396,12 +2403,11 @@ var WebApp = class {
2396
2403
  - A function (raw Node.js handler)
2397
2404
  - An object with .handle() method (Express, Connect)
2398
2405
  - An object with .callback() method (Koa)
2399
- - An object with .routing function (Fastify)
2406
+ - An object with .routing property (Fastify after .ready())
2400
2407
 
2401
2408
  Examples:
2402
2409
  Express: new WebApp("name", expressApp)
2403
2410
  Koa: new WebApp("name", koaApp)
2404
- Fastify: new WebApp("name", fastifyApp)
2405
2411
  Raw: new WebApp("name", (req, res) => { ... })
2406
2412
  `
2407
2413
  );