silgi 0.38.13 → 0.38.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.
- package/dist/cli/index.mjs +1 -1
- package/dist/core/index.d.mts +9 -8
- package/dist/core/index.mjs +4 -2
- package/package.json +1 -1
package/dist/cli/index.mjs
CHANGED
package/dist/core/index.d.mts
CHANGED
|
@@ -245,16 +245,17 @@ declare function createService<Schema extends SilgiSchema, Path extends keyof Sc
|
|
|
245
245
|
};
|
|
246
246
|
};
|
|
247
247
|
type WildcardVariants<Path extends string, Acc extends string = ''> = Path extends `${infer Head}/${infer Tail}` ? Tail extends '' ? `${Acc}${Head}` : `${Acc}${Head}/${Tail}` | `${Acc}${Head}/*` | `${Acc}${Head}/**` | WildcardVariants<Tail, `${Acc}${Head}/`> : `${Acc}${Path}`;
|
|
248
|
-
type MiddlewareParams<Schema extends SilgiSchema, Path extends keyof Schema & string, S extends string = WildcardVariants<Path>, Service extends MiddlewareDefinition = MiddlewareDefinition, Method extends string = HttpMethod, UsedMethod extends readonly Method[] = readonly never[]> =
|
|
249
|
-
|
|
250
|
-
|
|
248
|
+
type MiddlewareParams<Schema extends SilgiSchema, Path extends keyof Schema & string, S extends string = WildcardVariants<Path>, Service extends MiddlewareDefinition = MiddlewareDefinition, Method extends string = HttpMethod, UsedMethod extends readonly Method[] = readonly never[], Global extends boolean = false> = Global extends true ? {
|
|
249
|
+
global: Global;
|
|
250
|
+
key: string;
|
|
251
251
|
setup: Service;
|
|
252
|
-
}) | ({
|
|
253
|
-
global: true;
|
|
254
|
-
key: S;
|
|
255
252
|
method?: UsedMethod;
|
|
253
|
+
} : {
|
|
254
|
+
global?: Global;
|
|
255
|
+
path: S;
|
|
256
|
+
method: UsedMethod;
|
|
256
257
|
setup: Service;
|
|
257
|
-
}
|
|
258
|
+
};
|
|
258
259
|
type MiddlewareReturn<S extends string, Service extends MiddlewareDefinition, UsedMethod extends readonly string[]> = {
|
|
259
260
|
[K in S]: {
|
|
260
261
|
method: boolean;
|
|
@@ -264,7 +265,7 @@ type MiddlewareReturn<S extends string, Service extends MiddlewareDefinition, Us
|
|
|
264
265
|
};
|
|
265
266
|
};
|
|
266
267
|
};
|
|
267
|
-
declare function createMiddleware<Schema extends SilgiSchema, Path extends keyof Schema & string, S extends string = WildcardVariants<Path>, Service extends MiddlewareDefinition = MiddlewareDefinition, Method extends string = HttpMethod, UsedMethod extends readonly Method[] = readonly never[]>(params: MiddlewareParams<Schema, Path, S, Service, Method, UsedMethod>): MiddlewareReturn<S, Service, UsedMethod>;
|
|
268
|
+
declare function createMiddleware<Schema extends SilgiSchema, Path extends keyof Schema & string, S extends string = WildcardVariants<Path>, Service extends MiddlewareDefinition = MiddlewareDefinition, Method extends string = HttpMethod, UsedMethod extends readonly Method[] = readonly never[], Global extends boolean = false>(params: MiddlewareParams<Schema, Path, S, Service, Method, UsedMethod, Global>): MiddlewareReturn<S, Service, UsedMethod>;
|
|
268
269
|
|
|
269
270
|
declare function createShared(shared: Partial<SilgiRuntimeShareds>): SilgiRuntimeShareds;
|
|
270
271
|
|
package/dist/core/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createConsola } from 'consola';
|
|
1
|
+
import consola, { createConsola } from 'consola';
|
|
2
2
|
import { defu } from 'defu';
|
|
3
3
|
import { createHooks } from 'hookable';
|
|
4
4
|
import { createRouter, addRoute, findRoute, findAllRoutes } from 'rou3';
|
|
@@ -106,6 +106,7 @@ class SilgiError extends Error {
|
|
|
106
106
|
if (isDevelopment && opts.cause && opts.cause instanceof Error && opts.cause.stack && this.stack) {
|
|
107
107
|
this.stack += `
|
|
108
108
|
Caused by: ${opts.cause.stack}`;
|
|
109
|
+
consola.warn(opts.cause);
|
|
109
110
|
}
|
|
110
111
|
}
|
|
111
112
|
toJSON() {
|
|
@@ -1074,7 +1075,8 @@ function createMiddleware(params) {
|
|
|
1074
1075
|
[params.key]: {
|
|
1075
1076
|
method: false,
|
|
1076
1077
|
global: params.global,
|
|
1077
|
-
methods: {}
|
|
1078
|
+
methods: {},
|
|
1079
|
+
setup: params.setup
|
|
1078
1080
|
}
|
|
1079
1081
|
};
|
|
1080
1082
|
}
|