silgi 0.41.5 → 0.41.6

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.
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import { defineCommand, runMain } from 'citty';
3
3
 
4
- const version = "0.41.5";
4
+ const version = "0.41.6";
5
5
  const packageJson = {
6
6
  version: version};
7
7
 
@@ -576,10 +576,10 @@ function getUrlPrefix(path, method) {
576
576
  };
577
577
  }
578
578
 
579
- async function orchestrate(route, event, _input, graphql) {
579
+ async function orchestrate(route, event, _input) {
580
580
  const silgiCtx = useSilgi();
581
581
  const silgiURL = getUrlPrefix(route.route || event.req.url, route.method);
582
- const input = _input || (route.service?.setup.rules?.readBeforeBody === false || graphql ? {} : await parseRequestInput(event.req));
582
+ const input = _input || (route.service?.setup.rules?.readBeforeBody === false || route.graphql ? {} : await parseRequestInput(event.req));
583
583
  const hookContext = { earlyReturnValue: false };
584
584
  const routerParams = _input ? input.path : getRouterParams(event);
585
585
  const queryParams = _input ? input.query : getQuery(event);
@@ -988,7 +988,14 @@ async function handler(event, url, input) {
988
988
  const data = middleware(event, url);
989
989
  _chain = data;
990
990
  if (silgiCtx.router) {
991
- const match = findRoute(silgiCtx.router, url?.method || event.req.method, pathname);
991
+ const match = !url?.graphql ? findRoute(silgiCtx.router, url?.method || event.req.method, pathname) : {
992
+ data: {
993
+ graphql: true,
994
+ method: url?.method || event.req.method,
995
+ route: url.path
996
+ },
997
+ params: {}
998
+ };
992
999
  if (match) {
993
1000
  if (_chain) {
994
1001
  return _chain.then(async (_previous) => {
@@ -997,12 +1004,12 @@ async function handler(event, url, input) {
997
1004
  }
998
1005
  event.context.params = match.params;
999
1006
  event.context.matchedRoute = match.data;
1000
- return orchestrate(match.data, event, input, url?.graphql);
1007
+ return orchestrate(match.data, event, input);
1001
1008
  });
1002
1009
  } else {
1003
1010
  event.context.params = match.params;
1004
1011
  event.context.matchedRoute = match.data;
1005
- return orchestrate(match.data, event, input, url?.graphql);
1012
+ return orchestrate(match.data, event, input);
1006
1013
  }
1007
1014
  }
1008
1015
  }
@@ -697,6 +697,7 @@ interface MetaData extends Record<string, unknown> {
697
697
  }
698
698
  interface SilgiRoute {
699
699
  route?: string;
700
+ graphql?: boolean;
700
701
  method?: HTTPMethod | HTTPMethod[];
701
702
  service?: ResolvedServiceDefinition[string];
702
703
  middleware?: MiddlewareSetup;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "silgi",
3
3
  "type": "module",
4
- "version": "0.41.5",
4
+ "version": "0.41.6",
5
5
  "private": false,
6
6
  "sideEffects": false,
7
7
  "exports": {