silgi 0.34.9 → 0.34.11

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.
@@ -592,6 +592,7 @@ function transformImportPath(path, packageName, relativeTo) {
592
592
  const distMatch = importPath.match(/.*?(\/dist\/.*)/);
593
593
  if (distMatch && distMatch[1]) {
594
594
  importPath = packageName + distMatch[1].substring("/dist".length);
595
+ importPath = removeExtension(importPath, true);
595
596
  }
596
597
  } else if (relativeTo) {
597
598
  importPath = removeExtension(relativeWithDot(relativeTo, path));
@@ -764,8 +765,10 @@ async function _resolveSilgiModule(silgiModule, silgi) {
764
765
  };
765
766
  }
766
767
  }
767
- const runtimeFolder = new URL("runtime", src);
768
- await scanSilgiExports(runtimeFolder.pathname, buildTimeModuleMeta._packageName);
768
+ if (!isPresents(["npm-package"])) {
769
+ const runtimeFolder = new URL("runtime", src);
770
+ await scanSilgiExports(runtimeFolder.pathname, buildTimeModuleMeta._packageName);
771
+ }
769
772
  } catch (error) {
770
773
  const code = error.code;
771
774
  if (code === "MODULE_NOT_FOUND" || code === "ERR_PACKAGE_PATH_NOT_EXPORTED" || code === "ERR_MODULE_NOT_FOUND" || code === "ERR_UNSUPPORTED_DIR_IMPORT" || code === "ENOTDIR") {
@@ -1056,33 +1059,21 @@ async function prepareScanFile(silgi) {
1056
1059
  }),
1057
1060
  ""
1058
1061
  ];
1062
+ const generateExport = (name, items, defaultEmpty = "{}") => {
1063
+ const hasItems = items.length > 0;
1064
+ return [
1065
+ `export const ${name} = ${hasItems ? "deepMergeObjects([" : defaultEmpty}`,
1066
+ ...items.map((item) => ` ${item},`),
1067
+ hasItems ? "])" : defaultEmpty === "{}" ? "}" : "",
1068
+ ""
1069
+ ];
1070
+ };
1059
1071
  const importData = [
1060
1072
  "",
1061
- scanned.schemas.length > 0 ? "export const schemas = deepMergeObjects([" : "export const schemas = {",
1062
- ...scanned.schemas.map((name) => {
1063
- return ` ${name},`;
1064
- }),
1065
- scanned.schemas.length > 0 ? "])" : "}",
1066
- "",
1067
- scanned.services.length > 0 ? "export const services = deepMergeObjects([" : "export const services = {",
1068
- ...scanned.services.map((name) => {
1069
- return ` ${name},`;
1070
- }),
1071
- scanned.services.length > 0 ? "])" : "}",
1072
- "",
1073
- scanned.shareds.length > 0 ? "export const shareds = deepMergeObjects([" : "export const shareds = {",
1074
- ...scanned.shareds.map((name) => {
1075
- return ` ${name},`;
1076
- }),
1077
- "",
1078
- scanned.shareds.length > 0 ? "])" : "}",
1079
- "",
1080
- scanned.routers.length > 0 ? "export const routers = deepMergeObjects([" : "export const routers = {",
1081
- ...scanned.routers.map((name) => {
1082
- return ` ${name},`;
1083
- }),
1084
- scanned.routers.length > 0 ? "])" : "}",
1085
- ""
1073
+ ...generateExport("schemas", scanned.schemas),
1074
+ ...generateExport("services", scanned.services),
1075
+ ...generateExport("shareds", scanned.shareds, "undefined"),
1076
+ ...generateExport("routers", scanned.routers)
1086
1077
  ];
1087
1078
  await silgi.callHook("after:scan.ts", importData);
1088
1079
  importData.unshift(...importsContent);
@@ -1788,20 +1779,6 @@ async function prepareSchema(silgi) {
1788
1779
  ""
1789
1780
  ];
1790
1781
  const importData = [
1791
- generateTypes(
1792
- await resolveSchema(
1793
- {
1794
- ...silgi.options.namespaces?.reduce((acc, key) => ({ ...acc, [key]: "" }), {}) || {}
1795
- }
1796
- ),
1797
- {
1798
- interfaceName: "InferredNamespaces",
1799
- addExport: false,
1800
- addDefaults: false,
1801
- allowExtraKeys: false,
1802
- indentation: 0
1803
- }
1804
- ),
1805
1782
  "",
1806
1783
  `type SchemaExtends = typeof import('${silgiScanTS}')['schemas']`,
1807
1784
  `type BaseServices = typeof import('${silgiScanTS}')['services']`,
@@ -1874,7 +1851,6 @@ async function prepareSchema(silgi) {
1874
1851
  FrameworkContext: [{}, { extends: ["FrameworkContextExtends"] }],
1875
1852
  SilgiSchema: [{}, { extends: ["SchemaExtends"] }],
1876
1853
  ServicesObject: [{}, { extends: ["BaseServices"] }],
1877
- SilgiNamespaces: [{}, { extends: ["InferredNamespaces"] }],
1878
1854
  SilgiStorageBase: [{}, { extends: ["SilgiStorageBaseExtends"] }],
1879
1855
  SilgiURIs: [{}, { extends: ["SilgiURIsMerge"] }],
1880
1856
  SilgiRuntimeContext: [{}, { extends: ["SilgiModuleContextExtends"] }],
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import { defineCommand, runMain } from 'citty';
3
3
 
4
- const version = "0.34.9";
4
+ const version = "0.34.11";
5
5
  const packageJson = {
6
6
  version: version};
7
7
 
package/dist/cli/init.mjs CHANGED
@@ -69,8 +69,6 @@ const command = defineCommand({
69
69
  "export default defineSilgiConfig({",
70
70
  ` preset: '${framework}',`,
71
71
  ` compatibilityDate: '${(/* @__PURE__ */ new Date()).toISOString().split("T")[0]}',`,
72
- " // Please create a namespace for your project",
73
- " namespaces: [],",
74
72
  "",
75
73
  "})",
76
74
  ""
@@ -1,4 +1,4 @@
1
- import { SilgiConfig, Silgi, SilgiEvent, SilgiSchema, ServiceSetup, CustomRequestInit, SilgiRuntimeContext, AllPrefixes, NamespacesForPrefix, RoutesForPrefixAndNamespace, HTTPMethod, ExtractPathParamKeys, MergeAll, SilgiRuntimeShareds, RouteConfig, SilgiURL, StorageConfig, SilgiCLI, SilgiStorageBase } from 'silgi/types';
1
+ import { SilgiConfig, Silgi, SilgiEvent, SilgiSchema, ServiceSetup, CustomRequestInit, SilgiRuntimeContext, AllPrefixes, NamespacesForPrefix, RoutesForPrefixAndNamespace, MethodSchemas, MergeAll, ServiceMethods, SilgiRuntimeShareds, RouteConfig, SilgiURL, StorageConfig, SilgiCLI, SilgiStorageBase } from 'silgi/types';
2
2
  import { StandardSchemaV1 } from '@standard-schema/spec';
3
3
  import { Storage, StorageValue } from 'unstorage';
4
4
  import { UseContext } from 'unctx';
@@ -106,62 +106,6 @@ declare function handleResponse(val: unknown, event: SilgiEvent, config: SilgiHa
106
106
  declare function getEvent<T extends SilgiEvent>(event?: SilgiEvent): T;
107
107
  declare function getEventContext<T extends SilgiRuntimeContext>(event?: SilgiEvent): T;
108
108
 
109
- /**
110
- * Creates an object type representing path parameters extracted from a URL pattern.
111
- *
112
- * @example
113
- * PathParamsObject<'/users/:id/posts/:postId'> // { id: string | number, postId: string | number }
114
- */
115
- type PathParamsObject<S extends string> = {
116
- [K in ExtractPathParamKeys<S>]: string | number;
117
- };
118
- /**
119
- * Determines if a URL pattern contains any path parameters.
120
- *
121
- * @example
122
- * HasPathParams<'/users/:id'> // true
123
- * HasPathParams<'/users'> // false
124
- */
125
- type HasPathParams<S extends string> = ExtractPathParamKeys<S> extends never ? false : true;
126
- /**
127
- * Base schema definition for API method handlers.
128
- * Defines the structure of input/output data.
129
- */
130
- interface BaseMethodSchema {
131
- /** Schema for request body */
132
- input?: StandardSchemaV1;
133
- /** Schema for response body */
134
- output?: StandardSchemaV1;
135
- /** Schema for URL query parameters */
136
- queryParams?: StandardSchemaV1;
137
- /** Schema for source data (contextual information) */
138
- source?: StandardSchemaV1;
139
- }
140
- /**
141
- * Interface for adding path parameters schema to method definitions.
142
- */
143
- interface WithPathParams<PathParamsStr extends string> {
144
- /** Schema for path parameters */
145
- pathParams: StandardSchemaV1<PathParamsObject<PathParamsStr>>;
146
- }
147
- /**
148
- * Defines the schema structure for HTTP methods, conditionally including
149
- * path parameters based on the URL pattern.
150
- *
151
- * @example
152
- * // For a route with path parameters:
153
- * type UserMethodSchema = MethodSchemas<'/:id'>
154
- * // Result includes required pathParams for each method
155
- *
156
- * // For a route without path parameters:
157
- * type ListMethodSchema = MethodSchemas<''>
158
- * // Result doesn't allow pathParams property
159
- */
160
- type MethodSchemas<PathParamsStr extends string = ''> = {
161
- [K in HTTPMethod]?: HasPathParams<PathParamsStr> extends true ? BaseMethodSchema & WithPathParams<PathParamsStr> : BaseMethodSchema & {
162
- pathParams?: never;
163
- };
164
- };
165
109
  /**
166
110
  * Creates a type-safe API route schema definition.
167
111
  *
@@ -288,9 +232,6 @@ declare function createSchema<P extends AllPrefixes, N extends NamespacesForPref
288
232
  */
289
233
  declare function deepMergeObjects<T extends readonly Record<string, any>[]>(schemas: [...T]): MergeAll<T>;
290
234
 
291
- type ServiceMethods<Schema extends SilgiSchema, Path extends keyof Schema, Resolved extends boolean = false, HiddenParameters extends boolean = false> = {
292
- [M in keyof Schema[Path]]?: ServiceSetup<Schema, Path, M, Resolved, HiddenParameters>;
293
- };
294
235
  declare function createService<Schema extends SilgiSchema, Path extends keyof Schema, Resolved extends boolean = false, Methods extends ServiceMethods<Schema, Path, Resolved> = ServiceMethods<Schema, Path, Resolved>>(params: {
295
236
  path: Path;
296
237
  methods: Methods;
@@ -309,7 +309,7 @@ declare const baseHeaderBannerComment: string[];
309
309
  declare function processFilePath(src: string): string;
310
310
  declare function isPresents(names: PresetName[]): boolean;
311
311
  declare function isRuntimePresents(names: PresetName[]): boolean;
312
- declare function removeExtension(filePath: string): string;
312
+ declare function removeExtension(filePath: string, force?: boolean): string;
313
313
 
314
314
  export { MODE_RE, MigrationStatus, addCommands, addCoreFile, addImports, addNPMPackage, addTemplate, baseHeaderBannerComment, createFunction, createFunctionConfigs, createResolver, defineFramework, defineSilgiModule, defineSilgiPreset, directoryToURL, filterInPlace, formatFunctions, genEnsureSafeVar, generateMigration, getAllEntries, getIpAddress, getMigration, hasError, hasInstalledModule, hasSilgiModule, hash, ipAddress, isDirectory, isH3, isNitro, isNuxt, isPresents, isRuntimePresents, listMigrations, migrationDown, migrationUp, normalizeTemplate, prettyPath, processFilePath, relativeWithDot, removeExtension, resolveAlias, resolvePath, resolveSilgiModule, resolveSilgiPath, toArray, tryResolveModule, useLogger, useRequest, useResponse, writeFile };
315
315
  export type { FunctionConfig, JsonPatch, MigrationData, MigrationInfo, MigrationOptions, MigrationResult };
@@ -67,9 +67,9 @@ function isRuntimePresents(names) {
67
67
  const silgi = useSilgi();
68
68
  return names.includes(silgi.options.present);
69
69
  }
70
- function removeExtension(filePath) {
70
+ function removeExtension(filePath, force = false) {
71
71
  const silgi = useSilgiCLI();
72
- if (silgi.options.typescript.removeFileExtension) {
72
+ if (silgi.options.typescript.removeFileExtension || force) {
73
73
  const ext = extname(filePath);
74
74
  return ext ? filePath.slice(0, -ext.length) : filePath;
75
75
  }
@@ -316,6 +316,9 @@ interface GenerateAppOptions {
316
316
  filter?: (template: ResolvedSilgiTemplate<any>) => boolean;
317
317
  }
318
318
 
319
+ type ServiceMethods<Schema extends SilgiSchema$1, Path extends keyof Schema, Resolved extends boolean = false, HiddenParameters extends boolean = false> = {
320
+ [M in keyof Schema[Path]]?: ServiceSetup<Schema, Path, M, Resolved, HiddenParameters>;
321
+ };
319
322
  /**
320
323
  * Yardımcı tipler
321
324
  */
@@ -368,24 +371,20 @@ interface ServiceSetup<Schema extends SilgiSchema$1 = SilgiSchema$1, Route exten
368
371
  storage?: StorageConfig$1<ServiceHandlerInput<Schema, Route, Method, HiddenParameters>>;
369
372
  }
370
373
  /**
371
- * Servis tanımı (tek bir route+method için)
374
+ * Represents a fully resolved service definition that maps route paths
375
+ * to their method handlers and configurations.
376
+ *
377
+ * This interface is designed to be compatible with the structure created
378
+ * by the createService function.
372
379
  */
373
- type ServiceDefinition<Schema extends SilgiSchema$1, Route extends keyof Schema, Method extends keyof Schema[Route], Resolved extends boolean = false> = {
374
- [R in Route]: {
375
- [M in Method]: ServiceSetup<Schema, R, M, Resolved>;
380
+ interface ResolvedServiceDefinition$1 {
381
+ [routePath: string]: {
382
+ [method: string]: {
383
+ handler: (...args: any[]) => Promise<any>;
384
+ modules?: Partial<SilgiRuntimeActions$1>;
385
+ storage?: StorageConfig$1<any>;
386
+ };
376
387
  };
377
- };
378
- /**
379
- * Çoklu servisleri birleştirmek için yardımcı tip
380
- */
381
- type MergeServiceDefinitions<T extends object[]> = T extends [infer F, ...infer R] ? F & MergeServiceDefinitions<R extends object[] ? R : []> : unknown;
382
- /**
383
- * Servis oluşturmak için parametreler
384
- */
385
- interface CreateServiceParams<Schema extends SilgiSchema$1, Route extends keyof Schema, Method extends keyof Schema[Route], Resolved extends boolean = false> {
386
- route: Route;
387
- method: Method;
388
- setup: ServiceSetup<Schema, Route, Method, Resolved>;
389
388
  }
390
389
  /**
391
390
  * SilgiURL tipi
@@ -497,14 +496,9 @@ interface SilgiModule<TOptions extends ModuleOptionsCustom = ModuleOptionsCustom
497
496
 
498
497
  interface SilgiRuntimeMethods {
499
498
  }
500
- interface SilgiNamespaces {
501
- }
502
499
  type CommandType = 'run' | 'prepare' | 'install' | 'dev' | 'init';
503
- interface DefaultNamespaces extends SilgiNamespaces {
504
- }
505
500
  interface SilgiRouterTypes {
506
501
  }
507
- type BaseSilgiMethodType = 'post' | 'delete' | 'put' | 'get' | keyof SilgiRuntimeMethods | (string & {});
508
502
  interface DefaultHooks {
509
503
  }
510
504
  type DeepPartial<T> = T extends (...args: any[]) => any ? T : T extends Record<string, any> ? {
@@ -563,7 +557,6 @@ interface SilgiCLIOptions extends PresetOptions {
563
557
  [key: string]: any;
564
558
  };
565
559
  storages: string[];
566
- namespaces: string[];
567
560
  hooks: NestedHooks<SilgiCLIHooks$1>;
568
561
  plugins: {
569
562
  path: string;
@@ -828,43 +821,140 @@ interface CapturedErrorContext {
828
821
  }
829
822
  type CaptureError = (silgi: Silgi, error: Error, context: CapturedErrorContext) => void;
830
823
 
824
+ /**
825
+ * Main interface containing all route definitions.
826
+ * Example:
827
+ * {
828
+ * "/api/blueSpace/basket/getBook": { ... }
829
+ * }
830
+ */
831
+ interface Routers {
832
+ }
833
+ /**
834
+ * Extracts the prefix (first segment) from a URL, including the leading slash.
835
+ * @example ExtractPrefix<'/api/blueSpace/basket'> // '/api'
836
+ */
837
+ type ExtractPrefix<URL extends string> = URL extends `/${infer Prefix}/${string}` ? `/${Prefix}` : never;
838
+ /**
839
+ * Extracts the namespace (second segment) from a URL, including the leading slash.
840
+ * @example ExtractNamespace<'/api/blueSpace/basket'> // '/blueSpace'
841
+ */
842
+ type ExtractNamespace<URL extends string> = URL extends `/${string}/${infer Namespace}/${string}` ? `/${Namespace}` : never;
843
+ /**
844
+ * Extracts the route (third and subsequent segments) from a URL, including the leading slash.
845
+ * @example ExtractRoute<'/api/blueSpace/basket/getBook'> // '/basket/getBook'
846
+ */
847
+ type ExtractRoute<URL extends string> = URL extends `/${string}/${string}/${infer Route}` ? `/${Route}` : never;
848
+ /**
849
+ * Gets all route keys from Routers as strings.
850
+ * All keys should start with a leading slash.
851
+ */
852
+ type RouterKeys = keyof Routers & string;
853
+ /**
854
+ * Extracts all prefixes (first segment) in the system, including the leading slash.
855
+ * @example AllPrefixes // '/api' | ...
856
+ */
857
+ type AllPrefixes = RouterKeys extends infer K ? K extends string ? ExtractPrefix<K> : never : never;
858
+ /**
859
+ * Extracts all namespaces (second segment) for a given prefix, including the leading slash.
860
+ * @example NamespacesForPrefix<'/api'> // '/blueSpace' | ...
861
+ */
862
+ type NamespacesForPrefix<P extends string> = RouterKeys extends infer K ? K extends string ? K extends `${P}/${infer N}/${string}` ? `/${N}` : never : never : never;
863
+ /**
864
+ * Extracts all routes (third and subsequent segments) for a given prefix and namespace, including the leading slash.
865
+ * @example RoutesForPrefixAndNamespace<'/api', '/blueSpace'> // '/basket/getBook' | ...
866
+ */
867
+ type RoutesForPrefixAndNamespace<P extends string, N extends string> = RouterKeys extends infer K ? K extends string ? K extends `${P}${N}${infer R}` ? `${R}` : never : never : never;
868
+ /**
869
+ * Extracts path parameter keys from a URL pattern string.
870
+ *
871
+ * @example
872
+ * ExtractPathParamKeys<'/users/:id/posts/:postId'> // 'id' | 'postId'
873
+ * ExtractPathParamKeys<'/users/:id?'> // 'id'
874
+ */
875
+ type ExtractPathParamKeys<S extends string> = S extends `${string}:${infer Param}/${infer Rest}` ? Param extends `${infer Key}?` ? Key | ExtractPathParamKeys<Rest> : Param | ExtractPathParamKeys<Rest> : S extends `${string}:${infer Param}` ? Param extends `${infer Key}?` ? Key : Param : never;
876
+ /**
877
+ * Route configuration interface.
878
+ */
879
+ interface RouteConfig<T> {
880
+ route: T;
881
+ setup?: any;
882
+ }
883
+
831
884
  interface SilgiSchema {
832
885
  }
833
886
  interface MergedSilgiSchema {
834
887
  }
835
888
  /**
836
- * Utility type for schema generics to avoid repetition
889
+ * Creates an object type representing path parameters extracted from a URL pattern.
890
+ *
891
+ * @example
892
+ * PathParamsObject<'/users/:id/posts/:postId'> // { id: string | number, postId: string | number }
837
893
  */
838
- interface SchemaParams<TInput extends StandardSchemaV1 | undefined = undefined, TOutput extends StandardSchemaV1 | undefined = undefined, TPathParams extends StandardSchemaV1 | undefined = undefined, TQueryParams extends StandardSchemaV1 | undefined = undefined, TSource extends StandardSchemaV1 | undefined = undefined> {
839
- input?: TInput;
840
- output?: TOutput;
841
- pathParams?: TPathParams;
842
- queryParams?: TQueryParams;
843
- source?: TSource;
894
+ type PathParamsObject<S extends string> = {
895
+ [K in ExtractPathParamKeys<S>]: string | number;
896
+ };
897
+ /**
898
+ * Determines if a URL pattern contains any path parameters.
899
+ *
900
+ * @example
901
+ * HasPathParams<'/users/:id'> // true
902
+ * HasPathParams<'/users'> // false
903
+ */
904
+ type HasPathParams<S extends string> = ExtractPathParamKeys<S> extends never ? false : true;
905
+ /**
906
+ * Base schema definition for API method handlers.
907
+ * Defines the structure of input/output data.
908
+ */
909
+ interface BaseMethodSchema {
910
+ /** Schema for request body */
911
+ input?: StandardSchemaV1;
912
+ /** Schema for response body */
913
+ output?: StandardSchemaV1;
914
+ /** Schema for URL query parameters */
915
+ queryParams?: StandardSchemaV1;
916
+ /** Schema for source data (contextual information) */
917
+ source?: StandardSchemaV1;
844
918
  }
845
919
  /**
846
- * Defines the structure for schema components within a service endpoint.
847
- * Allows specifying schemas for input, output, path parameters, query parameters, and source data.
848
- * @template TInput - The schema type for the request body/input.
849
- * @template TOutput - The schema type for the response body/output.
850
- * @template TPathParams - The schema type for URL path parameters.
851
- * @template TQueryParams - The schema type for URL query parameters.
852
- * @template TSource - The schema type for the source data or context.
920
+ * Interface for adding path parameters schema to method definitions.
853
921
  */
854
- type SchemaDefinition<TInput extends StandardSchemaV1 | undefined = undefined, TOutput extends StandardSchemaV1 | undefined = undefined, TPathParams extends StandardSchemaV1 | undefined = undefined, TQueryParams extends StandardSchemaV1 | undefined = undefined, TSource extends StandardSchemaV1 | undefined = undefined> = SchemaParams<TInput, TOutput, TPathParams, TQueryParams, TSource>;
922
+ interface WithPathParams<PathParamsStr extends string> {
923
+ /** Schema for path parameters */
924
+ pathParams: StandardSchemaV1<PathParamsObject<PathParamsStr>>;
925
+ }
855
926
  /**
856
- * ResolvedServiceDefinition: ServiceDefinition with generics resolved.
857
- * Represents the fully resolved service definition structure.
927
+ * Defines the schema structure for HTTP methods, conditionally including
928
+ * path parameters based on the URL pattern.
929
+ *
930
+ * @example
931
+ * // For a route with path parameters:
932
+ * type UserMethodSchema = MethodSchemas<'/:id'>
933
+ * // Result includes required pathParams for each method
934
+ *
935
+ * // For a route without path parameters:
936
+ * type ListMethodSchema = MethodSchemas<''>
937
+ * // Result doesn't allow pathParams property
938
+ */
939
+ type MethodSchemas<PathParamsStr extends string = ''> = {
940
+ [K in HTTPMethod$1]?: HasPathParams<PathParamsStr> extends true ? BaseMethodSchema & WithPathParams<PathParamsStr> : BaseMethodSchema & {
941
+ pathParams?: never;
942
+ };
943
+ };
944
+ /**
945
+ * Represents a fully resolved schema definition that maps API route paths
946
+ * to their method schemas.
947
+ */
948
+ interface ResolvedSchema {
949
+ [routePath: string]: MethodSchemas<string>;
950
+ }
951
+ /**
952
+ * Represents a schema definition that has been fully resolved,
953
+ * typically after processing and validating all schema components.
858
954
  */
859
955
  interface ResolvedSchemaDefinition {
860
- [route: string]: {
861
- [method in HTTPMethod$1]: {
862
- input?: StandardSchemaV1;
863
- output?: StandardSchemaV1;
864
- pathParams?: StandardSchemaV1;
865
- queryParams?: StandardSchemaV1;
866
- source?: StandardSchemaV1;
867
- };
956
+ [key: string]: {
957
+ [method: string]: BaseMethodSchema;
868
958
  };
869
959
  }
870
960
 
@@ -907,7 +997,8 @@ interface ExtendShared {
907
997
 
908
998
  interface FrameworkContext {
909
999
  }
910
- type HTTPMethod = 'GET' | 'HEAD' | 'PATCH' | 'POST' | 'PUT' | 'DELETE' | 'CONNECT' | 'OPTIONS' | 'TRACE';
1000
+ type StandardHTTPMethod = 'GET' | 'HEAD' | 'PATCH' | 'POST' | 'PUT' | 'DELETE' | 'CONNECT' | 'OPTIONS' | 'TRACE';
1001
+ type HTTPMethod = SilgiRuntimeMethods extends Record<string, any> ? keyof SilgiRuntimeMethods | StandardHTTPMethod : StandardHTTPMethod;
911
1002
  interface SilgiRoute {
912
1003
  route: string;
913
1004
  method?: HTTPMethod;
@@ -918,7 +1009,7 @@ interface Silgi {
918
1009
  router: RouterContext<SilgiRoute>;
919
1010
  routerPrefixs: string[];
920
1011
  schemas: ResolvedSchemaDefinition;
921
- services: ResolvedServiceDefinition;
1012
+ services: ResolvedServiceDefinition$1;
922
1013
  shared: SilgiRuntimeShareds;
923
1014
  plugins: SilgiAppPlugin[];
924
1015
  framework: FrameworkContext;
@@ -1093,64 +1184,4 @@ interface GraphQLJSON {
1093
1184
  references: any;
1094
1185
  }
1095
1186
 
1096
- /**
1097
- * Main interface containing all route definitions.
1098
- * Example:
1099
- * {
1100
- * "/api/blueSpace/basket/getBook": { ... }
1101
- * }
1102
- */
1103
- interface Routers {
1104
- }
1105
- /**
1106
- * Extracts the prefix (first segment) from a URL, including the leading slash.
1107
- * @example ExtractPrefix<'/api/blueSpace/basket'> // '/api'
1108
- */
1109
- type ExtractPrefix<URL extends string> = URL extends `/${infer Prefix}/${string}` ? `/${Prefix}` : never;
1110
- /**
1111
- * Extracts the namespace (second segment) from a URL, including the leading slash.
1112
- * @example ExtractNamespace<'/api/blueSpace/basket'> // '/blueSpace'
1113
- */
1114
- type ExtractNamespace<URL extends string> = URL extends `/${string}/${infer Namespace}/${string}` ? `/${Namespace}` : never;
1115
- /**
1116
- * Extracts the route (third and subsequent segments) from a URL, including the leading slash.
1117
- * @example ExtractRoute<'/api/blueSpace/basket/getBook'> // '/basket/getBook'
1118
- */
1119
- type ExtractRoute<URL extends string> = URL extends `/${string}/${string}/${infer Route}` ? `/${Route}` : never;
1120
- /**
1121
- * Gets all route keys from Routers as strings.
1122
- * All keys should start with a leading slash.
1123
- */
1124
- type RouterKeys = keyof Routers & string;
1125
- /**
1126
- * Extracts all prefixes (first segment) in the system, including the leading slash.
1127
- * @example AllPrefixes // '/api' | ...
1128
- */
1129
- type AllPrefixes = RouterKeys extends infer K ? K extends string ? ExtractPrefix<K> : never : never;
1130
- /**
1131
- * Extracts all namespaces (second segment) for a given prefix, including the leading slash.
1132
- * @example NamespacesForPrefix<'/api'> // '/blueSpace' | ...
1133
- */
1134
- type NamespacesForPrefix<P extends string> = RouterKeys extends infer K ? K extends string ? K extends `${P}/${infer N}/${string}` ? `/${N}` : never : never : never;
1135
- /**
1136
- * Extracts all routes (third and subsequent segments) for a given prefix and namespace, including the leading slash.
1137
- * @example RoutesForPrefixAndNamespace<'/api', '/blueSpace'> // '/basket/getBook' | ...
1138
- */
1139
- type RoutesForPrefixAndNamespace<P extends string, N extends string> = RouterKeys extends infer K ? K extends string ? K extends `${P}${N}${infer R}` ? `${R}` : never : never : never;
1140
- /**
1141
- * Extracts path parameter keys from a URL pattern string.
1142
- *
1143
- * @example
1144
- * ExtractPathParamKeys<'/users/:id/posts/:postId'> // 'id' | 'postId'
1145
- * ExtractPathParamKeys<'/users/:id?'> // 'id'
1146
- */
1147
- type ExtractPathParamKeys<S extends string> = S extends `${string}:${infer Param}/${infer Rest}` ? Param extends `${infer Key}?` ? Key | ExtractPathParamKeys<Rest> : Param | ExtractPathParamKeys<Rest> : S extends `${string}:${infer Param}` ? Param extends `${infer Key}?` ? Key : Param : never;
1148
- /**
1149
- * Route configuration interface.
1150
- */
1151
- interface RouteConfig<T> {
1152
- route: T;
1153
- setup?: any;
1154
- }
1155
-
1156
- export type { AllPaths, AllPrefixes, AppConfig, Awaitable, BaseSilgiMethodType, BuildSilgi, CaptureError, CapturedErrorContext, CommandType, Commands, CreateServiceParams, CustomRequestInit, DeepPartial, DeepRequired, DefaultHooks, DefaultNamespaces, DefineFrameworkOptions, DotenvOptions, EnvOptions, EventHandlerResponse, ExtendContext, ExtendShared, ExtractNamespace, ExtractPathParamKeys, ExtractPathParams, ExtractPrefix, ExtractRoute, FrameworkContext, GenImport, GenerateAppOptions, GraphQLJSON, HTTPMethod, HookResult, HttpMethod, LoadConfigOptions, MergeAll, MergeServiceDefinitions, MergedSilgiSchema, ModuleDefinition, ModuleHookContext, ModuleMeta, ModuleOptionsCustom, ModuleSetupInstallResult, ModuleSetupReturn, NamespacesForPrefix, NitroBuildInfo, RequiredServiceType, ResolvedModuleMeta, ResolvedModuleOptions, ResolvedSchemaDefinition, ResolvedSilgiTemplate, RouteConfig, RouterParams, Routers, RoutesForPrefixAndNamespace, ScanFile, Schema, SchemaDefinition, SchemaParams, ServiceDefinition, ServiceHandler, ServiceHandlerInput, ServiceHandlerOutput, ServiceHandlerSource, ServiceSetup, Silgi, SilgiAppPlugin, SilgiCLI, SilgiCLIConfig, SilgiCLIDynamicConfig, SilgiCLIHooks, SilgiCLIOptions, SilgiCommands, SilgiCompatibility, SilgiCompatibilityIssue, SilgiCompatibilityIssues, SilgiConfig, SilgiEvent, SilgiFetchClient, SilgiFetchOptions, SilgiFrameworkInfo, SilgiHooks, SilgiModule, SilgiModuleInput, SilgiModuleOptions, SilgiNamespaces, SilgiOptions, SilgiPreset, SilgiPresetMeta, SilgiRoute, SilgiRouterTypes, SilgiRuntimeActions, SilgiRuntimeConfig, SilgiRuntimeContext, SilgiRuntimeHooks, SilgiRuntimeMethods, SilgiRuntimeOptions, SilgiRuntimeShareds, SilgiRuntimeSharedsExtend, SilgiSchema, SilgiStorageBase, SilgiTemplate, SilgiURL, StorageConfig, StorageKeyGenerator, StorageKeyParams, StorageMounts, TSReference, TrimAfterFourSlashes };
1187
+ export type { AllPaths, AllPrefixes, AppConfig, Awaitable, BuildSilgi, CaptureError, CapturedErrorContext, CommandType, Commands, CustomRequestInit, DeepPartial, DeepRequired, DefaultHooks, DefineFrameworkOptions, DotenvOptions, EnvOptions, EventHandlerResponse, ExtendContext, ExtendShared, ExtractNamespace, ExtractPathParamKeys, ExtractPathParams, ExtractPrefix, ExtractRoute, FrameworkContext, GenImport, GenerateAppOptions, GraphQLJSON, HTTPMethod, HookResult, HttpMethod, LoadConfigOptions, MergeAll, MergedSilgiSchema, MethodSchemas, ModuleDefinition, ModuleHookContext, ModuleMeta, ModuleOptionsCustom, ModuleSetupInstallResult, ModuleSetupReturn, NamespacesForPrefix, NitroBuildInfo, RequiredServiceType, ResolvedModuleMeta, ResolvedModuleOptions, ResolvedSchema, ResolvedSchemaDefinition, ResolvedServiceDefinition$1 as ResolvedServiceDefinition, ResolvedSilgiTemplate, RouteConfig, RouterParams, Routers, RoutesForPrefixAndNamespace, ScanFile, Schema, ServiceHandler, ServiceHandlerInput, ServiceHandlerOutput, ServiceHandlerSource, ServiceMethods, ServiceSetup, Silgi, SilgiAppPlugin, SilgiCLI, SilgiCLIConfig, SilgiCLIDynamicConfig, SilgiCLIHooks, SilgiCLIOptions, SilgiCommands, SilgiCompatibility, SilgiCompatibilityIssue, SilgiCompatibilityIssues, SilgiConfig, SilgiEvent, SilgiFetchClient, SilgiFetchOptions, SilgiFrameworkInfo, SilgiHooks, SilgiModule, SilgiModuleInput, SilgiModuleOptions, SilgiOptions, SilgiPreset, SilgiPresetMeta, SilgiRoute, SilgiRouterTypes, SilgiRuntimeActions, SilgiRuntimeConfig, SilgiRuntimeContext, 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.34.9",
4
+ "version": "0.34.11",
5
5
  "private": false,
6
6
  "sideEffects": false,
7
7
  "exports": {