silgi 0.41.57 → 0.41.59

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.57";
4
+ const version = "0.41.59";
5
5
  const packageJson = {
6
6
  version: version};
7
7
 
@@ -1,8 +1,8 @@
1
- import { SilgiRuntimeConfig, SilgiConfig, Silgi, SilgiEvent, SilgiRuntimeContext, SilgiSchema, RouteEntry, CustomRequestInit, WebSocketOptions, SilgiCLI, SilgiStorageBase, MergeAll, Routers, HTTPMethod, MiddlewareSetup, Resolvers, SilgiURL, BaseMethodSchema, ServiceSetupsForMethods, ServiceDefinitionByMethodAndPath, ServiceSetup, SilgiRuntimeShareds, StorageConfig } from 'silgi/types';
2
- import { ServerRequest } from 'srvx';
1
+ import { SilgiRuntimeConfig, SilgiConfig, Silgi, SilgiEvent, SilgiRuntimeContext, WebSocketOptions, SilgiSchema, RouteEntry, CustomRequestInit, SilgiCLI, SilgiStorageBase, MergeAll, Resolvers, SilgiURL, BaseMethodSchema, HTTPMethod, StandardSchemaV1, ServiceSetupsForMethods, ServiceDefinitionByMethodAndPath, Routers, ServiceSetup, SilgiRuntimeShareds, StorageConfig } from 'silgi/types';
2
+ import { ServerRequest, ServerRuntimeContext } from 'srvx';
3
3
  import { UseContext } from 'unctx';
4
4
  import { Storage, StorageValue } from 'unstorage';
5
- import { StandardSchemaV1 } from '@standard-schema/spec';
5
+ export { c as createMiddleware } from '../shared/silgi.DTwQEdSr.mjs';
6
6
 
7
7
  declare function updateRuntimeStorage(runtime: any): void;
8
8
  /**
@@ -93,11 +93,12 @@ declare class SilgiHttpEvent implements SilgiEvent {
93
93
  context: SilgiRuntimeContext;
94
94
  _res?: SilgiEventResponse;
95
95
  constructor(req: ServerRequest, context?: SilgiRuntimeContext);
96
- _chain: Promise<unknown> | undefined;
97
- [x: string]: unknown;
96
+ get _chain(): Promise<unknown> | undefined;
98
97
  get res(): SilgiEventResponse;
98
+ get runtime(): ServerRuntimeContext | undefined;
99
99
  toString(): string;
100
100
  toJSON(): string;
101
+ [x: string]: unknown;
101
102
  }
102
103
  declare class SilgiEventResponse {
103
104
  status?: number;
@@ -259,26 +260,6 @@ declare function getEventContext<T extends SilgiRuntimeContext>(event?: SilgiEve
259
260
  */
260
261
  declare function deepMergeObjects<T extends readonly Record<string, any>[]>(schemas: [...T]): MergeAll<T>;
261
262
 
262
- 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}`;
263
- type MiddlewarePath<S extends WildcardVariants<keyof Routers>> = S | 'global';
264
- interface CreateMiddlewareParams<S extends WildcardVariants<keyof Routers>, UsedMethod extends readonly HTTPMethod[] = readonly HTTPMethod[], Key extends string = string> {
265
- path: MiddlewarePath<S>;
266
- methods?: UsedMethod;
267
- setup: MiddlewareSetup;
268
- key: Key;
269
- }
270
- type CreateMiddlewareResult<Path extends string, UsedMethod extends readonly HTTPMethod[] = readonly HTTPMethod[], Key extends string = string> = {
271
- [K in `${Key}:${Path}`]: {
272
- setup: MiddlewareSetup;
273
- methods?: UsedMethod;
274
- key: Key;
275
- path: Path;
276
- };
277
- };
278
- declare function createMiddleware<S extends WildcardVariants<keyof Routers>, UsedMethod extends readonly HTTPMethod[] = readonly HTTPMethod[], Path extends MiddlewarePath<S> = MiddlewarePath<S>, Key extends string = string>(params: CreateMiddlewareParams<S, UsedMethod, Key> & {
279
- path: Path;
280
- }): CreateMiddlewareResult<Path, UsedMethod, Key>;
281
-
282
263
  declare function createResolver(resolver: Resolvers): Resolvers;
283
264
  declare function getUrlPrefix(path: string, method?: string): SilgiURL;
284
265
 
@@ -293,20 +274,18 @@ declare function replaceRuntimeValues(obj: any, runtime: any): any;
293
274
  * This utility function helps you define API schemas with proper typing for
294
275
  * input, output, path parameters, and query parameters.
295
276
  *
296
- * @template Path - API path from Routers type
297
- * @template Method - HTTP method
277
+ * @template Key - API key
278
+ * @template Schema - Schema definition type
298
279
  *
299
280
  * @param params - Schema configuration parameters
300
- * @param params.path - Complete API path
301
- * @param params.method - HTTP method(s) as an array (optional)
281
+ * @param params.key - Unique key for the schema
302
282
  * @param params.setup - Schema definition for the specified methods
303
283
  * @returns Route schema object with complete type information
304
284
  *
305
285
  * @example
306
- * // Define a user API schema with GET and POST methods sharing the same schema
286
+ * // Define a user API schema
307
287
  * const userSchema = createSchema({
308
- * path: '/api/v1/users',
309
- * method: ['GET', 'POST'],
288
+ * key: '/api/v1/users',
310
289
  * setup: {
311
290
  * output: z.object({
312
291
  * users: z.array(z.object({ id: z.string(), name: z.string() }))
@@ -335,4 +314,4 @@ declare function useSilgiStorage<T extends StorageValue = StorageValue>(base?: S
335
314
 
336
315
  declare const autoImportTypes: string[];
337
316
 
338
- export { SilgiError, SilgiHttpEvent, autoImportTypes, createError, createEventStream, createMiddleware, createResolver, createSchema, createService, createShared, createSilgi, createStorage, deepMergeObjects, defineServiceSetup, getEvent, getEventContext, getUrlPrefix, getWebsocket, handleResponse, handler, isError, kHandled, kNotFound, middleware, replaceRuntimeValues, silgiCLICtx, silgiCtx, silgiFetch, storageMount, tryUseSilgi, tryUseSilgiCLI, updateRuntimeStorage, useRuntime, useSilgi, useSilgiCLI, useSilgiStorage };
317
+ export { SilgiError, SilgiHttpEvent, autoImportTypes, createError, createEventStream, createResolver, createSchema, createService, createShared, createSilgi, createStorage, deepMergeObjects, defineServiceSetup, getEvent, getEventContext, getUrlPrefix, getWebsocket, handleResponse, handler, isError, kHandled, kNotFound, middleware, replaceRuntimeValues, silgiCLICtx, silgiCtx, silgiFetch, storageMount, tryUseSilgi, tryUseSilgiCLI, updateRuntimeStorage, useRuntime, useSilgi, useSilgiCLI, useSilgiStorage };
@@ -450,13 +450,18 @@ class SilgiHttpEvent {
450
450
  const _url = req._url;
451
451
  this.url = _url && _url instanceof URL ? _url : new FastURL(req.url);
452
452
  }
453
- _chain;
453
+ get _chain() {
454
+ return this._chain;
455
+ }
454
456
  get res() {
455
457
  if (!this._res) {
456
458
  this._res = new SilgiEventResponse();
457
459
  }
458
460
  return this._res;
459
461
  }
462
+ get runtime() {
463
+ return this.req.runtime;
464
+ }
460
465
  toString() {
461
466
  return `[${this.req.method}] ${this.req.url}`;
462
467
  }
@@ -1070,13 +1075,11 @@ function getWebsocket(silgi = useSilgi()) {
1070
1075
  return {
1071
1076
  ...silgi.options.websocket,
1072
1077
  resolve: async (request) => {
1073
- console.log("WebSocket resolve");
1074
- getPathname(request.url || "/");
1075
1078
  request.method || "GET";
1076
1079
  const event = new SilgiHttpEvent(request, {});
1077
1080
  const silgiContext = useSilgi();
1078
1081
  const handler2 = silgiContext.router && findRoute(silgiContext.router, event.req.method, event.url.pathname);
1079
- return handler2?.data.service?.websocket?.hooks || {};
1082
+ return handler2?.data.service?.websocket || {};
1080
1083
  }
1081
1084
  };
1082
1085
  }
package/dist/index.d.mts CHANGED
@@ -1,6 +1,6 @@
1
- export { SilgiError, SilgiHttpEvent, autoImportTypes, createError, createEventStream, createMiddleware, createResolver, createSchema, createService, createShared, createSilgi, createStorage, deepMergeObjects, defineServiceSetup, getEvent, getEventContext, getUrlPrefix, getWebsocket, handleResponse, handler, isError, kHandled, kNotFound, middleware, replaceRuntimeValues, silgiCLICtx, silgiCtx, silgiFetch, storageMount, tryUseSilgi, tryUseSilgiCLI, updateRuntimeStorage, useRuntime, useSilgi, useSilgiCLI, useSilgiStorage } from './core/index.mjs';
1
+ export { SilgiError, SilgiHttpEvent, autoImportTypes, createError, createEventStream, createResolver, createSchema, createService, createShared, createSilgi, createStorage, deepMergeObjects, defineServiceSetup, getEvent, getEventContext, getUrlPrefix, getWebsocket, handleResponse, handler, isError, kHandled, kNotFound, middleware, replaceRuntimeValues, silgiCLICtx, silgiCtx, silgiFetch, storageMount, tryUseSilgi, tryUseSilgiCLI, updateRuntimeStorage, useRuntime, useSilgi, useSilgiCLI, useSilgiStorage } from './core/index.mjs';
2
+ export { c as createMiddleware } from './shared/silgi.DTwQEdSr.mjs';
2
3
  import 'silgi/types';
3
4
  import 'srvx';
4
5
  import 'unctx';
5
6
  import 'unstorage';
6
- import '@standard-schema/spec';
@@ -0,0 +1,16 @@
1
+ import { WildcardVariants, Routers, HTTPMethod, MiddlewarePath, CreateMiddlewareParams, MiddlewareSetup } from 'silgi/types';
2
+
3
+ type CreateMiddlewareResult<Path extends string, UsedMethod extends readonly HTTPMethod[] = readonly HTTPMethod[], Key extends string = string> = {
4
+ [K in `${Key}:${Path}`]: {
5
+ setup: MiddlewareSetup;
6
+ methods?: UsedMethod;
7
+ key: Key;
8
+ path: Path;
9
+ };
10
+ };
11
+ declare function createMiddleware<S extends WildcardVariants<keyof Routers>, UsedMethod extends readonly HTTPMethod[] = readonly HTTPMethod[], Path extends MiddlewarePath<S> = MiddlewarePath<S>, Key extends string = string>(params: CreateMiddlewareParams<S, UsedMethod, Key> & {
12
+ path: Path;
13
+ }): CreateMiddlewareResult<Path, UsedMethod, Key>;
14
+
15
+ export { createMiddleware as c };
16
+ export type { CreateMiddlewareResult as C };
@@ -17,11 +17,12 @@ import { Session } from 'h3';
17
17
  import * as nitropack_types from 'nitropack/types';
18
18
  import { ESMImport, ESMCodeGenOptions } from 'knitwork';
19
19
  import { IResolvers } from '@graphql-tools/utils';
20
- import { StandardSchemaV1 } from '@standard-schema/spec';
20
+ import { StandardSchemaV1 as StandardSchemaV1$1 } from '@standard-schema/spec';
21
21
  import { NitroApp } from 'nitropack';
22
22
  import { RouterContext } from 'rou3';
23
23
  import { TransactionOptions, BuiltinDriverName, StorageValue, Storage } from 'unstorage';
24
24
  import { ServerRequest } from 'srvx';
25
+ import { C as CreateMiddlewareResult } from '../shared/silgi.DTwQEdSr.mjs';
25
26
  import { Defu } from 'defu';
26
27
  import * as crossws from 'crossws';
27
28
  import { silgiFetch } from 'silgi';
@@ -29,6 +30,7 @@ import { useRuntimeConfig } from 'silgi/runtime';
29
30
  import { Unimport } from 'unimport';
30
31
  import { ProviderName } from 'std-env';
31
32
  import { FetchOptions, FetchResponse } from 'ofetch';
33
+ import 'silgi/types';
32
34
 
33
35
  interface SilgiCompatibilityIssue {
34
36
  name: string;
@@ -121,7 +123,7 @@ interface SilgiEvent extends Record<string, unknown> {
121
123
  * Access to runtime specific additional context.
122
124
  *
123
125
  */
124
- runtime: ServerRequest["runtime"];
126
+ runtime: ServerRequest['runtime'];
125
127
  /**
126
128
  * Access to the parsed request URL.
127
129
  *
@@ -243,8 +245,8 @@ type Max4Slashes<S extends keyof Routers> = SlashCount<S> extends 0 | 1 | 2 | 3
243
245
  /**
244
246
  * Yardımcı tipler
245
247
  */
246
- type InferInput<T> = T extends StandardSchemaV1 ? StandardSchemaV1.InferInput<T> : unknown;
247
- type InferOutput<T> = T extends StandardSchemaV1 ? StandardSchemaV1.InferOutput<T> : unknown;
248
+ type InferInput<T> = T extends StandardSchemaV1$1 ? StandardSchemaV1$1.InferInput<T> : unknown;
249
+ type InferOutput<T> = T extends StandardSchemaV1$1 ? StandardSchemaV1$1.InferOutput<T> : unknown;
248
250
  /**
249
251
  * Route ve method'a göre input, output, params çıkarımı
250
252
  *
@@ -255,7 +257,7 @@ type IsNever<T> = [T] extends [never] ? true : false;
255
257
  type IsUndefined<T> = [undefined] extends [T] ? true : false;
256
258
  type HasPath<T> = IsNever<T> extends true ? false : IsUndefined<T> extends true ? false : true;
257
259
  type HasQuery<T> = IsNever<T> extends true ? false : IsUndefined<T> extends true ? false : true;
258
- type ServiceHandlerInput<Input extends StandardSchemaV1 = StandardSchemaV1, PathParams extends StandardSchemaV1 | never | undefined = never, QueryParams extends StandardSchemaV1 | never | undefined = never, HiddenParameters extends boolean = false> = HiddenParameters extends true ? {
260
+ type ServiceHandlerInput<Input extends StandardSchemaV1$1 = StandardSchemaV1$1, PathParams extends StandardSchemaV1$1 | never | undefined = never, QueryParams extends StandardSchemaV1$1 | never | undefined = never, HiddenParameters extends boolean = false> = HiddenParameters extends true ? {
259
261
  args: InferInput<Input>;
260
262
  } : HasPath<PathParams> extends true ? HasQuery<QueryParams> extends true ? {
261
263
  args: InferInput<Input>;
@@ -270,11 +272,11 @@ type ServiceHandlerInput<Input extends StandardSchemaV1 = StandardSchemaV1, Path
270
272
  } : {
271
273
  args: InferInput<Input>;
272
274
  };
273
- type ServiceHandler<Input extends StandardSchemaV1, Output extends StandardSchemaV1, PathParams extends StandardSchemaV1 | never | undefined = never, QueryParams extends StandardSchemaV1 | never | undefined = never, Resolved extends boolean = false, HiddenParameters extends boolean = false> = Resolved extends true ? (input: ServiceHandlerInput<Input, PathParams, QueryParams, HiddenParameters>, shared?: SilgiRuntimeShareds, event?: SilgiEvent) => Promise<InferOutput<Output>> | InferOutput<Output> | AsyncGenerator<InferOutput<Output>> | Generator<InferOutput<Output>> | Iterator<InferOutput<Output>> | AsyncIterator<InferOutput<Output>> | ReadableStream<InferOutput<Output>> : (input: ServiceHandlerInput<Input, PathParams, QueryParams, HiddenParameters>, shared: SilgiRuntimeShareds, event: SilgiEvent) => Promise<InferOutput<Output>> | InferOutput<Output> | AsyncGenerator<InferOutput<Output>> | Generator<InferOutput<Output>> | Iterator<InferOutput<Output>> | AsyncIterator<InferOutput<Output>> | ReadableStream<InferOutput<Output>>;
275
+ type ServiceHandler<Input extends StandardSchemaV1$1, Output extends StandardSchemaV1$1, PathParams extends StandardSchemaV1$1 | never | undefined = never, QueryParams extends StandardSchemaV1$1 | never | undefined = never, Resolved extends boolean = false, HiddenParameters extends boolean = false> = Resolved extends true ? (input: ServiceHandlerInput<Input, PathParams, QueryParams, HiddenParameters>, shared?: SilgiRuntimeShareds, event?: SilgiEvent) => Promise<InferOutput<Output>> | InferOutput<Output> | AsyncGenerator<InferOutput<Output>> | Generator<InferOutput<Output>> | Iterator<InferOutput<Output>> | AsyncIterator<InferOutput<Output>> | ReadableStream<InferOutput<Output>> : (input: ServiceHandlerInput<Input, PathParams, QueryParams, HiddenParameters>, shared: SilgiRuntimeShareds, event: SilgiEvent) => Promise<InferOutput<Output>> | InferOutput<Output> | AsyncGenerator<InferOutput<Output>> | Generator<InferOutput<Output>> | Iterator<InferOutput<Output>> | AsyncIterator<InferOutput<Output>> | ReadableStream<InferOutput<Output>>;
274
276
  /**
275
277
  * Servis setup tipi
276
278
  */
277
- interface ServiceSetup<Method extends HTTPMethod = HTTPMethod, Path extends string = string, Input extends StandardSchemaV1 = StandardSchemaV1, Output extends StandardSchemaV1 = StandardSchemaV1, PathParams extends StandardSchemaV1 | undefined | never = undefined, QueryParams extends StandardSchemaV1 | undefined | never = undefined, Resolved extends boolean = false, HiddenParameters extends boolean = false> {
279
+ interface ServiceSetup<Method extends HTTPMethod = HTTPMethod, Path extends string = string, Input extends StandardSchemaV1$1 = StandardSchemaV1$1, Output extends StandardSchemaV1$1 = StandardSchemaV1$1, PathParams extends StandardSchemaV1$1 | undefined | never = undefined, QueryParams extends StandardSchemaV1$1 | undefined | never = undefined, Resolved extends boolean = false, HiddenParameters extends boolean = false> {
278
280
  path: Path;
279
281
  method?: Method;
280
282
  handler?: ServiceHandler<Input, Output, PathParams, QueryParams, Resolved, HiddenParameters>;
@@ -297,7 +299,7 @@ interface ServiceSetup<Method extends HTTPMethod = HTTPMethod, Path extends stri
297
299
  * Format: "routePath" => setup + methods + input + output + queryParams
298
300
  */
299
301
  interface ResolvedServiceDefinition {
300
- [key: string]: ServiceSetup;
302
+ [key: string]: ServiceSetup<any, any, any, any, any, any, any, any>;
301
303
  }
302
304
  /**
303
305
  * SilgiURL tipi
@@ -311,7 +313,7 @@ interface SilgiURL {
311
313
  pathParams?: Record<string, string | undefined>;
312
314
  queryParams?: Record<string, string>;
313
315
  }
314
- type ServiceSetupsForMethods<Method extends HTTPMethod = HTTPMethod, Path extends string = string, Input extends StandardSchemaV1 = StandardSchemaV1, Output extends StandardSchemaV1 = StandardSchemaV1, PathParams extends StandardSchemaV1 | undefined | never = undefined, QueryParams extends StandardSchemaV1 | undefined | never = undefined, Resolved extends boolean = false, HiddenParameters extends boolean = false> = ServiceSetup<Method, Path, Input, Output, PathParams, QueryParams, Resolved, HiddenParameters>;
316
+ type ServiceSetupsForMethods<Method extends HTTPMethod = HTTPMethod, Path extends string = string, Input extends StandardSchemaV1$1 = StandardSchemaV1$1, Output extends StandardSchemaV1$1 = StandardSchemaV1$1, PathParams extends StandardSchemaV1$1 | undefined | never = undefined, QueryParams extends StandardSchemaV1$1 | undefined | never = undefined, Resolved extends boolean = false, HiddenParameters extends boolean = false> = ServiceSetup<Method, Path, Input, Output, PathParams, QueryParams, Resolved, HiddenParameters>;
315
317
  /**
316
318
  * Sadece belirtilen HTTP methodları için anahtar üretir.
317
319
  * Varsayılan olarak tüm methodlar çıkar.
@@ -320,8 +322,8 @@ type ServiceSetupsForMethods<Method extends HTTPMethod = HTTPMethod, Path extend
320
322
  * ServiceDefinitionByMethodAndPath<'/foo', ..., 'GET' | 'POST'>
321
323
  * // Sadece "GET:/foo" ve "POST:/foo" anahtarları olur.
322
324
  */
323
- type ServiceDefinitionByMethodAndPath<Path extends string, Method extends HTTPMethod = HTTPMethod, Input extends StandardSchemaV1 = StandardSchemaV1, Output extends StandardSchemaV1 = StandardSchemaV1, PathParams extends StandardSchemaV1 | undefined | never = undefined, QueryParams extends StandardSchemaV1 | undefined | never = undefined, Resolved extends boolean = false, HiddenParameters extends boolean = false> = {
324
- [M in Method as `${M}:${Path}`]?: ServiceSetup<M, Path, Input, Output, PathParams, QueryParams, Resolved, HiddenParameters>;
325
+ type ServiceDefinitionByMethodAndPath<Path extends string, Method extends HTTPMethod = HTTPMethod, Input extends StandardSchemaV1$1 = StandardSchemaV1$1, Output extends StandardSchemaV1$1 = StandardSchemaV1$1, PathParams extends StandardSchemaV1$1 | undefined | never = undefined, QueryParams extends StandardSchemaV1$1 | undefined | never = undefined, Resolved extends boolean = false, HiddenParameters extends boolean = false> = {
326
+ [M in Method as `${M}:${Path}`]: ServiceSetup<M, Path, Input, Output, PathParams, QueryParams, Resolved, HiddenParameters>;
325
327
  };
326
328
 
327
329
  interface SilgiCLI {
@@ -521,6 +523,14 @@ interface SilgiModule<TOptions extends ModuleOptionsCustom = ModuleOptionsCustom
521
523
  getMeta?: () => Promise<ModuleMeta>;
522
524
  }
523
525
 
526
+ 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}`;
527
+ type MiddlewarePath<S extends WildcardVariants<keyof Routers>> = S | 'global';
528
+ interface CreateMiddlewareParams<S extends WildcardVariants<keyof Routers>, UsedMethod extends readonly HTTPMethod[] = readonly HTTPMethod[], Key extends string = string> {
529
+ path: MiddlewarePath<S>;
530
+ methods?: UsedMethod;
531
+ setup: MiddlewareSetup;
532
+ key: Key;
533
+ }
524
534
  type MiddlewareHandler<Response extends EventHandlerResponse = EventHandlerResponse> = (event: SilgiEvent, silgi: Silgi) => Response;
525
535
  /**
526
536
  * Middleware Setup tipi
@@ -531,12 +541,7 @@ interface MiddlewareSetup {
531
541
  modules?: Partial<SetupModuleOption>;
532
542
  storage?: StorageConfig;
533
543
  }
534
- interface ResolvedMiddlewareDefinition {
535
- [methodAndPath: string]: {
536
- setup: MiddlewareSetup;
537
- methods?: HTTPMethod[];
538
- };
539
- }
544
+ type ResolvedMiddlewareDefinition = CreateMiddlewareResult<string, readonly HTTPMethod[], string>;
540
545
 
541
546
  type TrimAfterFourSlashes<T extends string> = T extends `/${infer S1}/${infer S2}/${infer S3}/${infer S4}/${infer _}` ? `/${S1}/${S2}/${S3}/${S4}` : T;
542
547
  type AllPaths = SilgiRouterTypes extends {
@@ -661,20 +666,20 @@ type HasPathParams<S extends string> = ExtractPathParamKeys<S> extends never ? f
661
666
  */
662
667
  interface BaseMethodSchema {
663
668
  /** Schema for request body */
664
- input?: StandardSchemaV1;
669
+ input?: StandardSchemaV1$1;
665
670
  /** Schema for response body */
666
- output?: StandardSchemaV1;
671
+ output?: StandardSchemaV1$1;
667
672
  /** Schema for URL query parameters */
668
- queryParams?: StandardSchemaV1;
673
+ queryParams?: StandardSchemaV1$1;
669
674
  /** Schema for source data (contextual information) */
670
- source?: StandardSchemaV1;
675
+ source?: StandardSchemaV1$1;
671
676
  }
672
677
  /**
673
678
  * Interface for adding path parameters schema to method definitions.
674
679
  */
675
680
  interface WithPathParams<PathParamsStr extends string> {
676
681
  /** Schema for path parameters */
677
- pathParams: StandardSchemaV1<PathParamsObject<PathParamsStr>>;
682
+ pathParams: StandardSchemaV1$1<PathParamsObject<PathParamsStr>>;
678
683
  }
679
684
  /**
680
685
  * Defines the schema structure for HTTP methods, conditionally including
@@ -765,15 +770,15 @@ type CustomRequestInit<Schema extends SilgiSchema = SilgiSchema, Method extends
765
770
  method: Method;
766
771
  body?: `${Method}:${Path}` extends keyof Schema ? Schema[`${Method}:${Path}`] extends {
767
772
  input?: infer I;
768
- } ? I extends StandardSchemaV1 ? StandardSchemaV1.InferInput<I> : unknown : unknown : unknown;
773
+ } ? I extends StandardSchemaV1$1 ? StandardSchemaV1$1.InferInput<I> : unknown : unknown : unknown;
769
774
  headers?: `${Method}:${Path}` extends keyof Schema ? Schema[`${Method}:${Path}`] extends {
770
775
  headers?: infer H;
771
- } ? H extends StandardSchemaV1 ? StandardSchemaV1.InferInput<H> : unknown : unknown : unknown;
776
+ } ? H extends StandardSchemaV1$1 ? StandardSchemaV1$1.InferInput<H> : unknown : unknown : unknown;
772
777
  } & (`${Method}:${Path}` extends keyof Schema ? Schema[`${Method}:${Path}`] extends {
773
778
  pathParams?: infer P;
774
- } ? P extends StandardSchemaV1 ? {
779
+ } ? P extends StandardSchemaV1$1 ? {
775
780
  pathParams: {
776
- [K in keyof StandardSchemaV1.InferInput<P>]: StandardSchemaV1.InferInput<P>[K] extends string ? string | number : StandardSchemaV1.InferInput<P>[K];
781
+ [K in keyof StandardSchemaV1$1.InferInput<P>]: StandardSchemaV1$1.InferInput<P>[K] extends string ? string | number : StandardSchemaV1$1.InferInput<P>[K];
777
782
  };
778
783
  } : {
779
784
  pathParams?: unknown;
@@ -1242,4 +1247,62 @@ interface LoadConfigOptions {
1242
1247
  consola?: ConsolaInstance;
1243
1248
  }
1244
1249
 
1245
- export type { AllPaths, AllPrefixes, AppConfig, Awaitable, BaseMethodSchema, BuildSilgi, CaptureError, CapturedErrorContext, CommandType, Commands, CustomRequestInit, DeepPartial, DeepRequired, DefaultHooks, DefineFrameworkOptions, DotenvOptions, EnvOptions, EventHandlerResponse, EventProtocol, ExtendContext, ExtendShared, ExtractNamespace, ExtractPathParamKeys, ExtractPathParams, ExtractPrefix, ExtractRoute, GenImport, GenerateAppOptions, HTTPMethod, HasPathParams, HookResult, LoadConfigOptions, Max4Slashes, MergeAll, MergeRouteRules, MergedSilgiSchema, MetaData, MethodSchemas, MiddlewareHandler, MiddlewareSetup, ModuleDefinition, ModuleHookContext, ModuleMeta, ModuleOptionsCustom, ModuleSetupInstallResult, ModuleSetupReturn, NamespacesForPrefix, NitroBuildInfo, RequiredServiceType, ResolvedMiddlewareDefinition, ResolvedModuleMeta, ResolvedModuleOptions, ResolvedSchema, ResolvedSchemaDefinition, ResolvedServiceDefinition, ResolvedSilgiTemplate, Resolvers, RouteEntry, RouteRules, RouterParams, Routers, RoutesForPrefixAndNamespace, ScanFile, Schema, ServiceDefinitionByMethodAndPath, ServiceHandler, ServiceHandlerInput, ServiceSetup, ServiceSetupsForMethods, ServicesObject, SetupModuleOption, Silgi, SilgiAppPlugin, SilgiCLI, SilgiCLIConfig, SilgiCLIHooks, SilgiCLIOptions, SilgiCommands, SilgiCompatibility, SilgiCompatibilityIssue, SilgiCompatibilityIssues, SilgiConfig, SilgiEvent, SilgiFetchClient, SilgiFetchOptions, SilgiFrameworkInfo, SilgiHooks, SilgiModule, SilgiModuleInput, SilgiModuleOptions, SilgiOptions, SilgiPreset, SilgiPresetMeta, SilgiRoute, SilgiRouterTypes, SilgiRuntimeConfig, SilgiRuntimeContext, SilgiRuntimeDefaultConfig, SilgiRuntimeHooks, SilgiRuntimeMethods, SilgiRuntimeOptions, SilgiRuntimeShareds, SilgiRuntimeSharedsExtend, SilgiSchema, SilgiStorageBase, SilgiTemplate, SilgiURL, StandardHTTPMethod, StorageConfig, StorageKeyGenerator, StorageKeyParams, StorageMounts, TSReference, TrimAfterFourSlashes, WebSocketOptions, WithPathParams };
1250
+ /** The Standard Schema interface. */
1251
+ interface StandardSchemaV1<Input = unknown, Output = Input> {
1252
+ /** The Standard Schema properties. */
1253
+ readonly '~standard': StandardSchemaV1.Props<Input, Output>;
1254
+ }
1255
+ declare namespace StandardSchemaV1 {
1256
+ /** The Standard Schema properties interface. */
1257
+ export interface Props<Input = unknown, Output = Input> {
1258
+ /** The version number of the standard. */
1259
+ readonly version: 1;
1260
+ /** The vendor name of the schema library. */
1261
+ readonly vendor: string;
1262
+ /** Validates unknown input values. */
1263
+ readonly validate: (value: unknown) => Result<Output> | Promise<Result<Output>>;
1264
+ /** Inferred types associated with the schema. */
1265
+ readonly types?: Types<Input, Output> | undefined;
1266
+ }
1267
+ /** The result interface of the validate function. */
1268
+ export type Result<Output> = SuccessResult<Output> | FailureResult;
1269
+ /** The result interface if validation succeeds. */
1270
+ export interface SuccessResult<Output> {
1271
+ /** The typed output value. */
1272
+ readonly value: Output;
1273
+ /** The non-existent issues. */
1274
+ readonly issues?: undefined;
1275
+ }
1276
+ /** The result interface if validation fails. */
1277
+ export interface FailureResult {
1278
+ /** The issues of failed validation. */
1279
+ readonly issues: ReadonlyArray<Issue>;
1280
+ }
1281
+ /** The issue interface of the failure output. */
1282
+ export interface Issue {
1283
+ /** The error message of the issue. */
1284
+ readonly message: string;
1285
+ /** The path of the issue, if any. */
1286
+ readonly path?: ReadonlyArray<PropertyKey | PathSegment> | undefined;
1287
+ }
1288
+ /** The path segment interface of the issue. */
1289
+ export interface PathSegment {
1290
+ /** The key representing a path segment. */
1291
+ readonly key: PropertyKey;
1292
+ }
1293
+ /** The Standard Schema types interface. */
1294
+ export interface Types<Input = unknown, Output = Input> {
1295
+ /** The input type of the schema. */
1296
+ readonly input: Input;
1297
+ /** The output type of the schema. */
1298
+ readonly output: Output;
1299
+ }
1300
+ /** Infers the input type of a Standard Schema. */
1301
+ export type InferInput<Schema extends StandardSchemaV1> = NonNullable<Schema['~standard']['types']>['input'];
1302
+ /** Infers the output type of a Standard Schema. */
1303
+ export type InferOutput<Schema extends StandardSchemaV1> = NonNullable<Schema['~standard']['types']>['output'];
1304
+ export {};
1305
+ }
1306
+
1307
+ export { StandardSchemaV1 };
1308
+ export type { AllPaths, AllPrefixes, AppConfig, Awaitable, BaseMethodSchema, BuildSilgi, CaptureError, CapturedErrorContext, CommandType, Commands, CreateMiddlewareParams, CustomRequestInit, DeepPartial, DeepRequired, DefaultHooks, DefineFrameworkOptions, DotenvOptions, EnvOptions, EventHandlerResponse, EventProtocol, ExtendContext, ExtendShared, ExtractNamespace, ExtractPathParamKeys, ExtractPathParams, ExtractPrefix, ExtractRoute, GenImport, GenerateAppOptions, HTTPMethod, HasPathParams, HookResult, LoadConfigOptions, Max4Slashes, MergeAll, MergeRouteRules, MergedSilgiSchema, MetaData, MethodSchemas, MiddlewareHandler, MiddlewarePath, MiddlewareSetup, ModuleDefinition, ModuleHookContext, ModuleMeta, ModuleOptionsCustom, ModuleSetupInstallResult, ModuleSetupReturn, NamespacesForPrefix, NitroBuildInfo, RequiredServiceType, ResolvedMiddlewareDefinition, ResolvedModuleMeta, ResolvedModuleOptions, ResolvedSchema, ResolvedSchemaDefinition, ResolvedServiceDefinition, ResolvedSilgiTemplate, Resolvers, RouteEntry, RouteRules, RouterParams, Routers, RoutesForPrefixAndNamespace, ScanFile, Schema, ServiceDefinitionByMethodAndPath, ServiceHandler, ServiceHandlerInput, ServiceSetup, ServiceSetupsForMethods, ServicesObject, SetupModuleOption, Silgi, SilgiAppPlugin, SilgiCLI, SilgiCLIConfig, SilgiCLIHooks, SilgiCLIOptions, SilgiCommands, SilgiCompatibility, SilgiCompatibilityIssue, SilgiCompatibilityIssues, SilgiConfig, SilgiEvent, SilgiFetchClient, SilgiFetchOptions, SilgiFrameworkInfo, SilgiHooks, SilgiModule, SilgiModuleInput, SilgiModuleOptions, SilgiOptions, SilgiPreset, SilgiPresetMeta, SilgiRoute, SilgiRouterTypes, SilgiRuntimeConfig, SilgiRuntimeContext, SilgiRuntimeDefaultConfig, SilgiRuntimeHooks, SilgiRuntimeMethods, SilgiRuntimeOptions, SilgiRuntimeShareds, SilgiRuntimeSharedsExtend, SilgiSchema, SilgiStorageBase, SilgiTemplate, SilgiURL, StandardHTTPMethod, StorageConfig, StorageKeyGenerator, StorageKeyParams, StorageMounts, TSReference, TrimAfterFourSlashes, WebSocketOptions, WildcardVariants, WithPathParams };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "silgi",
3
3
  "type": "module",
4
- "version": "0.41.57",
4
+ "version": "0.41.59",
5
5
  "private": false,
6
6
  "sideEffects": false,
7
7
  "exports": {
@@ -107,6 +107,7 @@
107
107
  "citty": "^0.1.6",
108
108
  "compatx": "^0.2.0",
109
109
  "consola": "^3.4.2",
110
+ "crossws": "^0.4.1",
110
111
  "defu": "^6.1.4",
111
112
  "destr": "^2.0.5",
112
113
  "dev-jiti": "^2.4.2",