silgi 0.41.32 → 0.41.35

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.32";
4
+ const version = "0.41.35";
5
5
  const packageJson = {
6
6
  version: version};
7
7
 
@@ -780,7 +780,7 @@ function getUrlPrefix(path, method) {
780
780
  };
781
781
  }
782
782
 
783
- async function orchestrate(route, event, _input, parent, info, callBack) {
783
+ async function orchestrate(route, event, _input, parent, info) {
784
784
  const silgiCtx = useSilgi();
785
785
  const isGraphQL = event.context.protocol === "GRAPHQL";
786
786
  const silgiURL = getUrlPrefix(route.route || event.req.url, route.method);
@@ -835,7 +835,7 @@ async function orchestrate(route, event, _input, parent, info, callBack) {
835
835
  }
836
836
  silgiCtx.shared.$fetch = silgiFetch;
837
837
  silgiCtx.shared.silgi = silgiCtx;
838
- const result = callBack ? await callBack() : await route.service?.handler?.(
838
+ const result = await route.service?.handler?.(
839
839
  // input
840
840
  inputData,
841
841
  // shared
@@ -1048,17 +1048,15 @@ async function middleware(event) {
1048
1048
  }
1049
1049
  }
1050
1050
  event._chain = _chain;
1051
- }
1052
- async function handler(event, middlewareMode = false, input, parent, info, callBack) {
1053
- event._chain = middleware(event);
1054
- if (middlewareMode) {
1055
- if (event._chain) {
1056
- const data = await event._chain;
1057
- if (data !== void 0 && data !== kNotFound) {
1058
- return data;
1059
- }
1051
+ if (event._chain) {
1052
+ const data = await event._chain;
1053
+ if (data !== void 0 && data !== kNotFound) {
1054
+ return data;
1060
1055
  }
1061
1056
  }
1057
+ }
1058
+ async function handler(event, middlewareMode = false, input, parent, info, callBack) {
1059
+ await middleware(event);
1062
1060
  const silgiContext = useSilgi();
1063
1061
  if (silgiContext.router) {
1064
1062
  const match = findRoute(silgiContext.router, event.req.method, event.url.pathname);
@@ -1070,12 +1068,12 @@ async function handler(event, middlewareMode = false, input, parent, info, callB
1070
1068
  }
1071
1069
  event.context.params = match.params;
1072
1070
  event.context.matchedRoute = match.data;
1073
- return orchestrate(match.data, event, input, parent, info, callBack);
1071
+ return orchestrate(match.data, event, input, parent, info);
1074
1072
  });
1075
1073
  } else {
1076
1074
  event.context.params = match.params;
1077
1075
  event.context.matchedRoute = match.data;
1078
- return orchestrate(match.data, event, input, parent, info, callBack);
1076
+ return orchestrate(match.data, event, input, parent, info);
1079
1077
  }
1080
1078
  }
1081
1079
  }
@@ -469,7 +469,7 @@ interface ResolvedModuleMeta extends ModuleMeta {
469
469
  }
470
470
  type ModuleHookContext = Readonly<{
471
471
  event?: SilgiEvent;
472
- url: SilgiURL;
472
+ url?: SilgiURL;
473
473
  input?: unknown;
474
474
  result?: unknown;
475
475
  route?: SilgiRoute;
@@ -477,7 +477,7 @@ type ModuleHookContext = Readonly<{
477
477
  success?: boolean;
478
478
  cached?: boolean;
479
479
  }> & {
480
- hookContext: {
480
+ hookContext?: {
481
481
  earlyReturnValue: any | false;
482
482
  };
483
483
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "silgi",
3
3
  "type": "module",
4
- "version": "0.41.32",
4
+ "version": "0.41.35",
5
5
  "private": false,
6
6
  "sideEffects": false,
7
7
  "exports": {