silgi 0.38.14 → 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.
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import { defineCommand, runMain } from 'citty';
3
3
 
4
- const version = "0.38.14";
4
+ const version = "0.38.15";
5
5
  const packageJson = {
6
6
  version: version};
7
7
 
@@ -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
- path: S;
250
- method: UsedMethod;
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
 
@@ -1075,7 +1075,8 @@ function createMiddleware(params) {
1075
1075
  [params.key]: {
1076
1076
  method: false,
1077
1077
  global: params.global,
1078
- methods: {}
1078
+ methods: {},
1079
+ setup: params.setup
1079
1080
  }
1080
1081
  };
1081
1082
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "silgi",
3
3
  "type": "module",
4
- "version": "0.38.14",
4
+ "version": "0.38.15",
5
5
  "private": false,
6
6
  "sideEffects": false,
7
7
  "exports": {