silgi 0.41.58 → 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.
- package/dist/cli/index.mjs +1 -1
- package/dist/core/index.d.mts +1 -2
- package/dist/index.d.mts +0 -1
- package/dist/types/index.d.mts +75 -17
- package/package.json +1 -1
package/dist/cli/index.mjs
CHANGED
package/dist/core/index.d.mts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { SilgiRuntimeConfig, SilgiConfig, Silgi, SilgiEvent, SilgiRuntimeContext, WebSocketOptions, SilgiSchema, RouteEntry, CustomRequestInit, SilgiCLI, SilgiStorageBase, MergeAll, Resolvers, SilgiURL, BaseMethodSchema, HTTPMethod, ServiceSetupsForMethods, ServiceDefinitionByMethodAndPath, Routers, ServiceSetup, SilgiRuntimeShareds, StorageConfig } from 'silgi/types';
|
|
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
2
|
import { ServerRequest, ServerRuntimeContext } from 'srvx';
|
|
3
3
|
import { UseContext } from 'unctx';
|
|
4
4
|
import { Storage, StorageValue } from 'unstorage';
|
|
5
5
|
export { c as createMiddleware } from '../shared/silgi.DTwQEdSr.mjs';
|
|
6
|
-
import { StandardSchemaV1 } from '@standard-schema/spec';
|
|
7
6
|
|
|
8
7
|
declare function updateRuntimeStorage(runtime: any): void;
|
|
9
8
|
/**
|
package/dist/index.d.mts
CHANGED
package/dist/types/index.d.mts
CHANGED
|
@@ -17,7 +17,7 @@ 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';
|
|
@@ -245,8 +245,8 @@ type Max4Slashes<S extends keyof Routers> = SlashCount<S> extends 0 | 1 | 2 | 3
|
|
|
245
245
|
/**
|
|
246
246
|
* Yardımcı tipler
|
|
247
247
|
*/
|
|
248
|
-
type InferInput<T> = T extends StandardSchemaV1 ? StandardSchemaV1.InferInput<T> : unknown;
|
|
249
|
-
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;
|
|
250
250
|
/**
|
|
251
251
|
* Route ve method'a göre input, output, params çıkarımı
|
|
252
252
|
*
|
|
@@ -257,7 +257,7 @@ type IsNever<T> = [T] extends [never] ? true : false;
|
|
|
257
257
|
type IsUndefined<T> = [undefined] extends [T] ? true : false;
|
|
258
258
|
type HasPath<T> = IsNever<T> extends true ? false : IsUndefined<T> extends true ? false : true;
|
|
259
259
|
type HasQuery<T> = IsNever<T> extends true ? false : IsUndefined<T> extends true ? false : true;
|
|
260
|
-
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 ? {
|
|
261
261
|
args: InferInput<Input>;
|
|
262
262
|
} : HasPath<PathParams> extends true ? HasQuery<QueryParams> extends true ? {
|
|
263
263
|
args: InferInput<Input>;
|
|
@@ -272,11 +272,11 @@ type ServiceHandlerInput<Input extends StandardSchemaV1 = StandardSchemaV1, Path
|
|
|
272
272
|
} : {
|
|
273
273
|
args: InferInput<Input>;
|
|
274
274
|
};
|
|
275
|
-
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>>;
|
|
276
276
|
/**
|
|
277
277
|
* Servis setup tipi
|
|
278
278
|
*/
|
|
279
|
-
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> {
|
|
280
280
|
path: Path;
|
|
281
281
|
method?: Method;
|
|
282
282
|
handler?: ServiceHandler<Input, Output, PathParams, QueryParams, Resolved, HiddenParameters>;
|
|
@@ -313,7 +313,7 @@ interface SilgiURL {
|
|
|
313
313
|
pathParams?: Record<string, string | undefined>;
|
|
314
314
|
queryParams?: Record<string, string>;
|
|
315
315
|
}
|
|
316
|
-
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>;
|
|
317
317
|
/**
|
|
318
318
|
* Sadece belirtilen HTTP methodları için anahtar üretir.
|
|
319
319
|
* Varsayılan olarak tüm methodlar çıkar.
|
|
@@ -322,7 +322,7 @@ type ServiceSetupsForMethods<Method extends HTTPMethod = HTTPMethod, Path extend
|
|
|
322
322
|
* ServiceDefinitionByMethodAndPath<'/foo', ..., 'GET' | 'POST'>
|
|
323
323
|
* // Sadece "GET:/foo" ve "POST:/foo" anahtarları olur.
|
|
324
324
|
*/
|
|
325
|
-
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> = {
|
|
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
326
|
[M in Method as `${M}:${Path}`]: ServiceSetup<M, Path, Input, Output, PathParams, QueryParams, Resolved, HiddenParameters>;
|
|
327
327
|
};
|
|
328
328
|
|
|
@@ -666,20 +666,20 @@ type HasPathParams<S extends string> = ExtractPathParamKeys<S> extends never ? f
|
|
|
666
666
|
*/
|
|
667
667
|
interface BaseMethodSchema {
|
|
668
668
|
/** Schema for request body */
|
|
669
|
-
input?: StandardSchemaV1;
|
|
669
|
+
input?: StandardSchemaV1$1;
|
|
670
670
|
/** Schema for response body */
|
|
671
|
-
output?: StandardSchemaV1;
|
|
671
|
+
output?: StandardSchemaV1$1;
|
|
672
672
|
/** Schema for URL query parameters */
|
|
673
|
-
queryParams?: StandardSchemaV1;
|
|
673
|
+
queryParams?: StandardSchemaV1$1;
|
|
674
674
|
/** Schema for source data (contextual information) */
|
|
675
|
-
source?: StandardSchemaV1;
|
|
675
|
+
source?: StandardSchemaV1$1;
|
|
676
676
|
}
|
|
677
677
|
/**
|
|
678
678
|
* Interface for adding path parameters schema to method definitions.
|
|
679
679
|
*/
|
|
680
680
|
interface WithPathParams<PathParamsStr extends string> {
|
|
681
681
|
/** Schema for path parameters */
|
|
682
|
-
pathParams: StandardSchemaV1<PathParamsObject<PathParamsStr>>;
|
|
682
|
+
pathParams: StandardSchemaV1$1<PathParamsObject<PathParamsStr>>;
|
|
683
683
|
}
|
|
684
684
|
/**
|
|
685
685
|
* Defines the schema structure for HTTP methods, conditionally including
|
|
@@ -770,15 +770,15 @@ type CustomRequestInit<Schema extends SilgiSchema = SilgiSchema, Method extends
|
|
|
770
770
|
method: Method;
|
|
771
771
|
body?: `${Method}:${Path}` extends keyof Schema ? Schema[`${Method}:${Path}`] extends {
|
|
772
772
|
input?: infer I;
|
|
773
|
-
} ? I extends StandardSchemaV1 ? StandardSchemaV1.InferInput<I> : unknown : unknown : unknown;
|
|
773
|
+
} ? I extends StandardSchemaV1$1 ? StandardSchemaV1$1.InferInput<I> : unknown : unknown : unknown;
|
|
774
774
|
headers?: `${Method}:${Path}` extends keyof Schema ? Schema[`${Method}:${Path}`] extends {
|
|
775
775
|
headers?: infer H;
|
|
776
|
-
} ? H extends StandardSchemaV1 ? StandardSchemaV1.InferInput<H> : unknown : unknown : unknown;
|
|
776
|
+
} ? H extends StandardSchemaV1$1 ? StandardSchemaV1$1.InferInput<H> : unknown : unknown : unknown;
|
|
777
777
|
} & (`${Method}:${Path}` extends keyof Schema ? Schema[`${Method}:${Path}`] extends {
|
|
778
778
|
pathParams?: infer P;
|
|
779
|
-
} ? P extends StandardSchemaV1 ? {
|
|
779
|
+
} ? P extends StandardSchemaV1$1 ? {
|
|
780
780
|
pathParams: {
|
|
781
|
-
[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];
|
|
782
782
|
};
|
|
783
783
|
} : {
|
|
784
784
|
pathParams?: unknown;
|
|
@@ -1247,4 +1247,62 @@ interface LoadConfigOptions {
|
|
|
1247
1247
|
consola?: ConsolaInstance;
|
|
1248
1248
|
}
|
|
1249
1249
|
|
|
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 };
|
|
1250
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 };
|