silgi 0.41.59 → 0.41.60
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/types/index.d.mts +73 -74
- package/package.json +1 -2
package/dist/cli/index.mjs
CHANGED
package/dist/types/index.d.mts
CHANGED
|
@@ -17,7 +17,6 @@ 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 as StandardSchemaV1$1 } from '@standard-schema/spec';
|
|
21
20
|
import { NitroApp } from 'nitropack';
|
|
22
21
|
import { RouterContext } from 'rou3';
|
|
23
22
|
import { TransactionOptions, BuiltinDriverName, StorageValue, Storage } from 'unstorage';
|
|
@@ -233,6 +232,63 @@ interface SilgiRuntimeSharedsExtend {
|
|
|
233
232
|
interface ExtendShared {
|
|
234
233
|
}
|
|
235
234
|
|
|
235
|
+
/** The Standard Schema interface. */
|
|
236
|
+
interface StandardSchemaV1<Input = unknown, Output = Input> {
|
|
237
|
+
/** The Standard Schema properties. */
|
|
238
|
+
readonly '~standard': StandardSchemaV1.Props<Input, Output>;
|
|
239
|
+
}
|
|
240
|
+
declare namespace StandardSchemaV1 {
|
|
241
|
+
/** The Standard Schema properties interface. */
|
|
242
|
+
export interface Props<Input = unknown, Output = Input> {
|
|
243
|
+
/** The version number of the standard. */
|
|
244
|
+
readonly version: 1;
|
|
245
|
+
/** The vendor name of the schema library. */
|
|
246
|
+
readonly vendor: string;
|
|
247
|
+
/** Validates unknown input values. */
|
|
248
|
+
readonly validate: (value: unknown) => Result<Output> | Promise<Result<Output>>;
|
|
249
|
+
/** Inferred types associated with the schema. */
|
|
250
|
+
readonly types?: Types<Input, Output> | undefined;
|
|
251
|
+
}
|
|
252
|
+
/** The result interface of the validate function. */
|
|
253
|
+
export type Result<Output> = SuccessResult<Output> | FailureResult;
|
|
254
|
+
/** The result interface if validation succeeds. */
|
|
255
|
+
export interface SuccessResult<Output> {
|
|
256
|
+
/** The typed output value. */
|
|
257
|
+
readonly value: Output;
|
|
258
|
+
/** The non-existent issues. */
|
|
259
|
+
readonly issues?: undefined;
|
|
260
|
+
}
|
|
261
|
+
/** The result interface if validation fails. */
|
|
262
|
+
export interface FailureResult {
|
|
263
|
+
/** The issues of failed validation. */
|
|
264
|
+
readonly issues: ReadonlyArray<Issue>;
|
|
265
|
+
}
|
|
266
|
+
/** The issue interface of the failure output. */
|
|
267
|
+
export interface Issue {
|
|
268
|
+
/** The error message of the issue. */
|
|
269
|
+
readonly message: string;
|
|
270
|
+
/** The path of the issue, if any. */
|
|
271
|
+
readonly path?: ReadonlyArray<PropertyKey | PathSegment> | undefined;
|
|
272
|
+
}
|
|
273
|
+
/** The path segment interface of the issue. */
|
|
274
|
+
export interface PathSegment {
|
|
275
|
+
/** The key representing a path segment. */
|
|
276
|
+
readonly key: PropertyKey;
|
|
277
|
+
}
|
|
278
|
+
/** The Standard Schema types interface. */
|
|
279
|
+
export interface Types<Input = unknown, Output = Input> {
|
|
280
|
+
/** The input type of the schema. */
|
|
281
|
+
readonly input: Input;
|
|
282
|
+
/** The output type of the schema. */
|
|
283
|
+
readonly output: Output;
|
|
284
|
+
}
|
|
285
|
+
/** Infers the input type of a Standard Schema. */
|
|
286
|
+
export type InferInput<Schema extends StandardSchemaV1> = NonNullable<Schema['~standard']['types']>['input'];
|
|
287
|
+
/** Infers the output type of a Standard Schema. */
|
|
288
|
+
export type InferOutput<Schema extends StandardSchemaV1> = NonNullable<Schema['~standard']['types']>['output'];
|
|
289
|
+
export {};
|
|
290
|
+
}
|
|
291
|
+
|
|
236
292
|
interface ServicesObject {
|
|
237
293
|
}
|
|
238
294
|
interface WebSocketOptions {
|
|
@@ -245,8 +301,8 @@ type Max4Slashes<S extends keyof Routers> = SlashCount<S> extends 0 | 1 | 2 | 3
|
|
|
245
301
|
/**
|
|
246
302
|
* Yardımcı tipler
|
|
247
303
|
*/
|
|
248
|
-
type InferInput<T> = T extends StandardSchemaV1
|
|
249
|
-
type InferOutput<T> = T extends StandardSchemaV1
|
|
304
|
+
type InferInput<T> = T extends StandardSchemaV1 ? StandardSchemaV1.InferInput<T> : unknown;
|
|
305
|
+
type InferOutput<T> = T extends StandardSchemaV1 ? StandardSchemaV1.InferOutput<T> : unknown;
|
|
250
306
|
/**
|
|
251
307
|
* Route ve method'a göre input, output, params çıkarımı
|
|
252
308
|
*
|
|
@@ -257,7 +313,7 @@ type IsNever<T> = [T] extends [never] ? true : false;
|
|
|
257
313
|
type IsUndefined<T> = [undefined] extends [T] ? true : false;
|
|
258
314
|
type HasPath<T> = IsNever<T> extends true ? false : IsUndefined<T> extends true ? false : true;
|
|
259
315
|
type HasQuery<T> = IsNever<T> extends true ? false : IsUndefined<T> extends true ? false : true;
|
|
260
|
-
type ServiceHandlerInput<Input extends StandardSchemaV1
|
|
316
|
+
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 ? {
|
|
261
317
|
args: InferInput<Input>;
|
|
262
318
|
} : HasPath<PathParams> extends true ? HasQuery<QueryParams> extends true ? {
|
|
263
319
|
args: InferInput<Input>;
|
|
@@ -272,11 +328,11 @@ type ServiceHandlerInput<Input extends StandardSchemaV1$1 = StandardSchemaV1$1,
|
|
|
272
328
|
} : {
|
|
273
329
|
args: InferInput<Input>;
|
|
274
330
|
};
|
|
275
|
-
type ServiceHandler<Input extends StandardSchemaV1
|
|
331
|
+
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>>;
|
|
276
332
|
/**
|
|
277
333
|
* Servis setup tipi
|
|
278
334
|
*/
|
|
279
|
-
interface ServiceSetup<Method extends HTTPMethod = HTTPMethod, Path extends string = string, Input extends StandardSchemaV1
|
|
335
|
+
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> {
|
|
280
336
|
path: Path;
|
|
281
337
|
method?: Method;
|
|
282
338
|
handler?: ServiceHandler<Input, Output, PathParams, QueryParams, Resolved, HiddenParameters>;
|
|
@@ -313,7 +369,7 @@ interface SilgiURL {
|
|
|
313
369
|
pathParams?: Record<string, string | undefined>;
|
|
314
370
|
queryParams?: Record<string, string>;
|
|
315
371
|
}
|
|
316
|
-
type ServiceSetupsForMethods<Method extends HTTPMethod = HTTPMethod, Path extends string = string, Input extends StandardSchemaV1
|
|
372
|
+
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>;
|
|
317
373
|
/**
|
|
318
374
|
* Sadece belirtilen HTTP methodları için anahtar üretir.
|
|
319
375
|
* Varsayılan olarak tüm methodlar çıkar.
|
|
@@ -322,7 +378,7 @@ type ServiceSetupsForMethods<Method extends HTTPMethod = HTTPMethod, Path extend
|
|
|
322
378
|
* ServiceDefinitionByMethodAndPath<'/foo', ..., 'GET' | 'POST'>
|
|
323
379
|
* // Sadece "GET:/foo" ve "POST:/foo" anahtarları olur.
|
|
324
380
|
*/
|
|
325
|
-
type ServiceDefinitionByMethodAndPath<Path extends string, Method extends HTTPMethod = HTTPMethod, Input extends StandardSchemaV1
|
|
381
|
+
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> = {
|
|
326
382
|
[M in Method as `${M}:${Path}`]: ServiceSetup<M, Path, Input, Output, PathParams, QueryParams, Resolved, HiddenParameters>;
|
|
327
383
|
};
|
|
328
384
|
|
|
@@ -666,20 +722,20 @@ type HasPathParams<S extends string> = ExtractPathParamKeys<S> extends never ? f
|
|
|
666
722
|
*/
|
|
667
723
|
interface BaseMethodSchema {
|
|
668
724
|
/** Schema for request body */
|
|
669
|
-
input?: StandardSchemaV1
|
|
725
|
+
input?: StandardSchemaV1;
|
|
670
726
|
/** Schema for response body */
|
|
671
|
-
output?: StandardSchemaV1
|
|
727
|
+
output?: StandardSchemaV1;
|
|
672
728
|
/** Schema for URL query parameters */
|
|
673
|
-
queryParams?: StandardSchemaV1
|
|
729
|
+
queryParams?: StandardSchemaV1;
|
|
674
730
|
/** Schema for source data (contextual information) */
|
|
675
|
-
source?: StandardSchemaV1
|
|
731
|
+
source?: StandardSchemaV1;
|
|
676
732
|
}
|
|
677
733
|
/**
|
|
678
734
|
* Interface for adding path parameters schema to method definitions.
|
|
679
735
|
*/
|
|
680
736
|
interface WithPathParams<PathParamsStr extends string> {
|
|
681
737
|
/** Schema for path parameters */
|
|
682
|
-
pathParams: StandardSchemaV1
|
|
738
|
+
pathParams: StandardSchemaV1<PathParamsObject<PathParamsStr>>;
|
|
683
739
|
}
|
|
684
740
|
/**
|
|
685
741
|
* Defines the schema structure for HTTP methods, conditionally including
|
|
@@ -770,15 +826,15 @@ type CustomRequestInit<Schema extends SilgiSchema = SilgiSchema, Method extends
|
|
|
770
826
|
method: Method;
|
|
771
827
|
body?: `${Method}:${Path}` extends keyof Schema ? Schema[`${Method}:${Path}`] extends {
|
|
772
828
|
input?: infer I;
|
|
773
|
-
} ? I extends StandardSchemaV1
|
|
829
|
+
} ? I extends StandardSchemaV1 ? StandardSchemaV1.InferInput<I> : unknown : unknown : unknown;
|
|
774
830
|
headers?: `${Method}:${Path}` extends keyof Schema ? Schema[`${Method}:${Path}`] extends {
|
|
775
831
|
headers?: infer H;
|
|
776
|
-
} ? H extends StandardSchemaV1
|
|
832
|
+
} ? H extends StandardSchemaV1 ? StandardSchemaV1.InferInput<H> : unknown : unknown : unknown;
|
|
777
833
|
} & (`${Method}:${Path}` extends keyof Schema ? Schema[`${Method}:${Path}`] extends {
|
|
778
834
|
pathParams?: infer P;
|
|
779
|
-
} ? P extends StandardSchemaV1
|
|
835
|
+
} ? P extends StandardSchemaV1 ? {
|
|
780
836
|
pathParams: {
|
|
781
|
-
[K in keyof StandardSchemaV1
|
|
837
|
+
[K in keyof StandardSchemaV1.InferInput<P>]: StandardSchemaV1.InferInput<P>[K] extends string ? string | number : StandardSchemaV1.InferInput<P>[K];
|
|
782
838
|
};
|
|
783
839
|
} : {
|
|
784
840
|
pathParams?: unknown;
|
|
@@ -1247,62 +1303,5 @@ interface LoadConfigOptions {
|
|
|
1247
1303
|
consola?: ConsolaInstance;
|
|
1248
1304
|
}
|
|
1249
1305
|
|
|
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
1306
|
export { StandardSchemaV1 };
|
|
1308
1307
|
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.
|
|
4
|
+
"version": "0.41.60",
|
|
5
5
|
"private": false,
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"exports": {
|
|
@@ -100,7 +100,6 @@
|
|
|
100
100
|
"@fastify/deepmerge": "^3.1.0",
|
|
101
101
|
"@graphql-tools/utils": "^10.8.6",
|
|
102
102
|
"@standard-community/standard-json": "^0.2.0",
|
|
103
|
-
"@standard-schema/spec": "^1.0.0",
|
|
104
103
|
"apiful": "^2.2.0",
|
|
105
104
|
"c12": "^3.0.3",
|
|
106
105
|
"chokidar": "^4.0.3",
|