silgi 0.41.5 → 0.41.7
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.
- package/dist/cli/index.mjs +1 -1
- package/dist/core/index.mjs +21 -6
- package/dist/types/index.d.mts +1 -0
- package/package.json +1 -1
package/dist/cli/index.mjs
CHANGED
package/dist/core/index.mjs
CHANGED
|
@@ -576,10 +576,18 @@ function getUrlPrefix(path, method) {
|
|
|
576
576
|
};
|
|
577
577
|
}
|
|
578
578
|
|
|
579
|
-
async function orchestrate(route, event, _input
|
|
579
|
+
async function orchestrate(route, event, _input) {
|
|
580
580
|
const silgiCtx = useSilgi();
|
|
581
|
-
const silgiURL = getUrlPrefix(route.route || event.req.url, route.method)
|
|
582
|
-
|
|
581
|
+
const silgiURL = !route.graphql ? getUrlPrefix(route.route || event.req.url, route.method) : {
|
|
582
|
+
methodName: route.method || "GET",
|
|
583
|
+
namespaceName: "graphql",
|
|
584
|
+
prefixName: "/api",
|
|
585
|
+
path: route.route || "",
|
|
586
|
+
raw: route.route || "",
|
|
587
|
+
pathParams: {},
|
|
588
|
+
queryParams: {}
|
|
589
|
+
};
|
|
590
|
+
const input = _input || (route.service?.setup.rules?.readBeforeBody === false || route.graphql ? {} : await parseRequestInput(event.req));
|
|
583
591
|
const hookContext = { earlyReturnValue: false };
|
|
584
592
|
const routerParams = _input ? input.path : getRouterParams(event);
|
|
585
593
|
const queryParams = _input ? input.query : getQuery(event);
|
|
@@ -988,7 +996,14 @@ async function handler(event, url, input) {
|
|
|
988
996
|
const data = middleware(event, url);
|
|
989
997
|
_chain = data;
|
|
990
998
|
if (silgiCtx.router) {
|
|
991
|
-
const match = findRoute(silgiCtx.router, url?.method || event.req.method, pathname)
|
|
999
|
+
const match = !url?.graphql ? findRoute(silgiCtx.router, url?.method || event.req.method, pathname) : {
|
|
1000
|
+
data: {
|
|
1001
|
+
graphql: true,
|
|
1002
|
+
method: url?.method || event.req.method,
|
|
1003
|
+
route: url.path
|
|
1004
|
+
},
|
|
1005
|
+
params: {}
|
|
1006
|
+
};
|
|
992
1007
|
if (match) {
|
|
993
1008
|
if (_chain) {
|
|
994
1009
|
return _chain.then(async (_previous) => {
|
|
@@ -997,12 +1012,12 @@ async function handler(event, url, input) {
|
|
|
997
1012
|
}
|
|
998
1013
|
event.context.params = match.params;
|
|
999
1014
|
event.context.matchedRoute = match.data;
|
|
1000
|
-
return orchestrate(match.data, event, input
|
|
1015
|
+
return orchestrate(match.data, event, input);
|
|
1001
1016
|
});
|
|
1002
1017
|
} else {
|
|
1003
1018
|
event.context.params = match.params;
|
|
1004
1019
|
event.context.matchedRoute = match.data;
|
|
1005
|
-
return orchestrate(match.data, event, input
|
|
1020
|
+
return orchestrate(match.data, event, input);
|
|
1006
1021
|
}
|
|
1007
1022
|
}
|
|
1008
1023
|
}
|
package/dist/types/index.d.mts
CHANGED