silgi 0.40.0 → 0.40.1

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.40.0";
4
+ const version = "0.40.1";
5
5
  const packageJson = {
6
6
  version: version};
7
7
 
@@ -19,12 +19,13 @@ declare function silgiFetch(_request: Request | URL, options?: RequestInit & {
19
19
  pathParams?: Record<string, any>;
20
20
  }, context?: SilgiRuntimeContext): Promise<Response | Promise<Response>>;
21
21
  declare function middleware(event: SilgiEvent, url?: {
22
- path: string;
23
- method: string;
22
+ path?: string;
23
+ method?: string;
24
24
  }): Promise<any>;
25
25
  declare function handler(event: SilgiEvent, url?: {
26
- path: string;
27
- method: string;
26
+ path?: string;
27
+ method?: string;
28
+ graphql?: boolean;
28
29
  }, input?: any): Promise<any>;
29
30
 
30
31
  /**
@@ -590,10 +590,10 @@ function getUrlPrefix(path, method) {
590
590
  };
591
591
  }
592
592
 
593
- async function orchestrate(route, event, _input) {
593
+ async function orchestrate(route, event, _input, graphql) {
594
594
  const silgiCtx = useSilgi();
595
595
  const silgiURL = getUrlPrefix(route.route || event.req.url, route.method);
596
- const input = _input || (route.service?.rules?.readBeforeBody === false ? {} : await parseRequestInput(event.req));
596
+ const input = _input || (route.service?.rules?.readBeforeBody === false || graphql ? {} : await parseRequestInput(event.req));
597
597
  const hookContext = { earlyReturnValue: false };
598
598
  const routerParams = _input ? input.path : getRouterParams(event);
599
599
  const queryParams = _input ? input.query : getQuery(event);
@@ -1001,12 +1001,12 @@ async function handler(event, url, input) {
1001
1001
  }
1002
1002
  event.context.params = match.params;
1003
1003
  event.context.matchedRoute = match.data;
1004
- return orchestrate(match.data, event, input);
1004
+ return orchestrate(match.data, event, input, url?.graphql);
1005
1005
  });
1006
1006
  } else {
1007
1007
  event.context.params = match.params;
1008
1008
  event.context.matchedRoute = match.data;
1009
- return orchestrate(match.data, event, input);
1009
+ return orchestrate(match.data, event, input, url?.graphql);
1010
1010
  }
1011
1011
  }
1012
1012
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "silgi",
3
3
  "type": "module",
4
- "version": "0.40.0",
4
+ "version": "0.40.1",
5
5
  "private": false,
6
6
  "sideEffects": false,
7
7
  "exports": {