silgi 0.39.9 → 0.39.10
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 +17 -8
- package/dist/types/index.d.mts +1 -1
- package/package.json +1 -1
package/dist/cli/index.mjs
CHANGED
package/dist/core/index.mjs
CHANGED
|
@@ -332,7 +332,6 @@ async function createSilgi(config) {
|
|
|
332
332
|
}
|
|
333
333
|
for (const routeKey in silgi.middlewares) {
|
|
334
334
|
const routeObject = silgi.middlewares[routeKey];
|
|
335
|
-
const global = routeObject.global ?? false;
|
|
336
335
|
let method = "ALL";
|
|
337
336
|
let route = routeKey;
|
|
338
337
|
if (routeKey.includes(":")) {
|
|
@@ -340,12 +339,22 @@ async function createSilgi(config) {
|
|
|
340
339
|
method = methodPart.toUpperCase();
|
|
341
340
|
route = routeParts.join(":");
|
|
342
341
|
}
|
|
343
|
-
if (global) {
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
342
|
+
if (routeObject.global) {
|
|
343
|
+
if (routeObject.method) {
|
|
344
|
+
for (const method2 of routeObject.method) {
|
|
345
|
+
silgi.globalMiddlewares.push({
|
|
346
|
+
middleware: routeObject.setup,
|
|
347
|
+
method: method2,
|
|
348
|
+
route
|
|
349
|
+
});
|
|
350
|
+
}
|
|
351
|
+
} else {
|
|
352
|
+
silgi.globalMiddlewares.push({
|
|
353
|
+
middleware: routeObject.setup,
|
|
354
|
+
method,
|
|
355
|
+
route
|
|
356
|
+
});
|
|
357
|
+
}
|
|
349
358
|
} else {
|
|
350
359
|
addRoute(silgi._middlewareRouter, method, route, {
|
|
351
360
|
middleware: routeObject.setup,
|
|
@@ -1031,7 +1040,7 @@ function createSchema(params) {
|
|
|
1031
1040
|
const { path, method, setup } = params;
|
|
1032
1041
|
const result = {};
|
|
1033
1042
|
if (!method) {
|
|
1034
|
-
throw new Error(
|
|
1043
|
+
throw new Error(`Method is required createSchema ${path}`);
|
|
1035
1044
|
}
|
|
1036
1045
|
for (let i = 0; i < method.length; i++) {
|
|
1037
1046
|
const methodName = method[i];
|
package/dist/types/index.d.mts
CHANGED