silgi 0.41.14 → 0.41.15

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.14";
4
+ const version = "0.41.15";
5
5
  const packageJson = {
6
6
  version: version};
7
7
 
@@ -298,13 +298,6 @@ async function createSilgi(config) {
298
298
  silgi.router = createRouter();
299
299
  }
300
300
  for (const [route, object] of Object.entries(silgi.services)) {
301
- const routeParts = route.split("/").filter(Boolean);
302
- if (routeParts.length > 0) {
303
- const prefix = `/${routeParts[0]}`;
304
- if (!silgi.routerPrefixs.includes(prefix)) {
305
- silgi.routerPrefixs.push(prefix);
306
- }
307
- }
308
301
  const methods = object.methods?.length ? object.methods : ["ALL"];
309
302
  if (methods.includes("GRAPHQL")) {
310
303
  addRoute(silgi.router, "GRAPHQL", route, {
@@ -313,6 +306,14 @@ async function createSilgi(config) {
313
306
  service: object
314
307
  });
315
308
  continue;
309
+ } else {
310
+ const routeParts = route.split("/").filter(Boolean);
311
+ if (routeParts.length > 0) {
312
+ const prefix = `/${routeParts[0]}`;
313
+ if (!silgi.routerPrefixs.includes(prefix)) {
314
+ silgi.routerPrefixs.push(prefix);
315
+ }
316
+ }
316
317
  }
317
318
  for (const method of methods) {
318
319
  const globalMethod = method === "ALL" ? "" : method.toUpperCase();
@@ -344,6 +345,14 @@ async function createSilgi(config) {
344
345
  continue;
345
346
  }
346
347
  const methods = routeObject.methods?.length ? routeObject.methods : ["ALL"];
348
+ if (methods.includes("GRAPHQL")) {
349
+ addRoute(silgi._middlewareRouter, "GRAPHQL", _route, {
350
+ method: "GRAPHQL",
351
+ route: _route,
352
+ middleware: routeObject.setup
353
+ });
354
+ continue;
355
+ }
347
356
  for (const method of methods) {
348
357
  const globalMethod = method === "ALL" ? "" : method.toUpperCase();
349
358
  addRoute(silgi._middlewareRouter, globalMethod, _route, {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "silgi",
3
3
  "type": "module",
4
- "version": "0.41.14",
4
+ "version": "0.41.15",
5
5
  "private": false,
6
6
  "sideEffects": false,
7
7
  "exports": {