silgi 0.41.36 → 0.41.38

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.36";
4
+ const version = "0.41.38";
5
5
  const packageJson = {
6
6
  version: version};
7
7
 
@@ -237,8 +237,8 @@ declare function createSchema<Key extends string, Schema extends BaseMethodSchem
237
237
  * ServiceSetup tipinden oluşan bir yardımcı fonksiyon.
238
238
  * Tip güvenliğini artırmak için ServiceSetup objesini doğrudan döndürür.
239
239
  */
240
- declare function defineServiceSetup<Parent extends StandardSchemaV1, Method extends HTTPMethod, Path extends keyof Routers, 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>(setup: Omit<ServiceSetup<Parent, Method, Path, Input, Output, PathParams, QueryParams, Resolved, HiddenParameters>, 'method' | 'path'>): Omit<ServiceSetup<Parent, Method, Path, Input, Output, PathParams, QueryParams, Resolved, HiddenParameters>, 'method' | 'path'>;
241
- declare function createService<Path extends string, Method extends HTTPMethod, Parent extends StandardSchemaV1 = StandardSchemaV1, 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>(params: ServiceSetupsForMethods<Parent, Method, Path, Input, Output, PathParams, QueryParams, Resolved, HiddenParameters>): ServiceDefinitionByMethodAndPath<Path, Method, Parent, Input, Output, PathParams, QueryParams, Resolved, HiddenParameters>;
240
+ declare function defineServiceSetup<Method extends HTTPMethod, Path extends keyof Routers, 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>(setup: Omit<ServiceSetup<Method, Path, Input, Output, PathParams, QueryParams, Resolved, HiddenParameters>, 'method' | 'path'>): Omit<ServiceSetup<Method, Path, Input, Output, PathParams, QueryParams, Resolved, HiddenParameters>, 'method' | 'path'>;
241
+ declare function createService<Path extends string, Method extends 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>(params: ServiceSetupsForMethods<Method, Path, Input, Output, PathParams, QueryParams, Resolved, HiddenParameters>): ServiceDefinitionByMethodAndPath<Path, Method, Input, Output, PathParams, QueryParams, Resolved, HiddenParameters>;
242
242
 
243
243
  declare function createShared(shared: Partial<SilgiRuntimeShareds>): SilgiRuntimeShareds;
244
244
 
@@ -1137,8 +1137,9 @@ function defineServiceSetup(setup) {
1137
1137
  return setup;
1138
1138
  }
1139
1139
  function createService(params) {
1140
+ const method = params.method || "ALL";
1140
1141
  return {
1141
- [`${params.method}:${params.path}`]: params
1142
+ [`${method}:${params.path}`]: params
1142
1143
  };
1143
1144
  }
1144
1145
 
@@ -81,7 +81,7 @@ function getServicePath(_route) {
81
81
  if (route.includes(":")) {
82
82
  const [methodPart, ...routeParts] = route.split(":");
83
83
  method = methodPart.toUpperCase();
84
- if (method === "GLOBAL") {
84
+ if (method === "GLOBAL" || method === "ALL") {
85
85
  method = "";
86
86
  }
87
87
  route = routeParts.join(":");
@@ -227,6 +227,8 @@ interface ExtendShared {
227
227
 
228
228
  interface ServicesObject {
229
229
  }
230
+ type SlashCount<S extends string, Count extends any[] = []> = S extends `${infer _Prefix}/${infer Rest}` ? SlashCount<Rest, [any, ...Count]> : Count['length'];
231
+ type Max4Slashes<S extends keyof Routers> = SlashCount<S> extends 0 | 1 | 2 | 3 ? S : never;
230
232
  /**
231
233
  * Yardımcı tipler
232
234
  */
@@ -269,7 +271,7 @@ type ServiceHandler<Input extends StandardSchemaV1, Output extends StandardSchem
269
271
  */
270
272
  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> {
271
273
  path: Path;
272
- method: Method;
274
+ method?: Method;
273
275
  handler?: ServiceHandler<Input, Output, PathParams, QueryParams, Resolved, HiddenParameters>;
274
276
  rules?: MergeRouteRules;
275
277
  modules?: Partial<SetupModuleOption>;
@@ -1232,4 +1234,4 @@ interface LoadConfigOptions {
1232
1234
  consola?: ConsolaInstance;
1233
1235
  }
1234
1236
 
1235
- 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, 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, WithPathParams };
1237
+ 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, WithPathParams };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "silgi",
3
3
  "type": "module",
4
- "version": "0.41.36",
4
+ "version": "0.41.38",
5
5
  "private": false,
6
6
  "sideEffects": false,
7
7
  "exports": {