silgi 0.16.3 → 0.16.5

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,4 +1,4 @@
1
- const version = "0.16.3";
1
+ const version = "0.16.5";
2
2
  const peerDependencies = {
3
3
  "@fastify/deepmerge": "^2.0.2",
4
4
  "@nuxt/kit": "^3.15.3",
@@ -206,8 +206,8 @@ const parseRouteRules = serviceParseModule(({
206
206
  const routeRules = node.routeRules;
207
207
  if (!routeRules)
208
208
  return;
209
- let removeMethod = basePath.split("/").slice(0, -1).join("/");
210
- removeMethod = withLeadingSlash(removeMethod);
209
+ let removeMethod = "";
210
+ removeMethod = withLeadingSlash(basePath);
211
211
  if (routeRules.splat)
212
212
  removeMethod = `${removeMethod}/*`;
213
213
  else if (routeRules.doubleSplat)
@@ -1,4 +1,4 @@
1
- const version = "0.16.3";
1
+ const version = "0.16.5";
2
2
  const peerDependencies = {
3
3
  "@fastify/deepmerge": "^2.0.2",
4
4
  "@nuxt/kit": "^3.15.3",
@@ -1,4 +1,4 @@
1
- const version = "0.16.3";
1
+ const version = "0.16.5";
2
2
  const peerDependencies = {
3
3
  "@fastify/deepmerge": "^2.0.2",
4
4
  "@nuxt/kit": "^3.15.3",
@@ -819,9 +819,6 @@ interface DefaultRouteRules extends SilgiRuntimeRouteRules {
819
819
  [key: string]: any;
820
820
  }
821
821
  type SilgiRouteRules = Record<DefaultRouteRules extends string ? DefaultRouteRules : string, DefaultRouteConfig>;
822
- type RouteConfig<T extends Record<string, any> = DefaultRouteConfig> = T;
823
- type RouteRulesConfig<T extends Record<string, any> = DefaultRouteConfig> = Record<string, T>;
824
- type MergedRulesCache<T extends Record<string, any> = DefaultRouteConfig> = Record<string, T>;
825
822
  interface SilgiRuntimeRouteRules {
826
823
  }
827
824
  interface SilgiRuntimeRouteRulesConfig {
@@ -830,29 +827,29 @@ interface SilgiRuntimeRouteRulesConfig {
830
827
  * Interface for the object returned by createRouteRules
831
828
  */
832
829
  interface RouteRules<T extends Record<string, any> = DefaultRouteRules> {
833
- readonly rules: RouteRulesConfig<T>;
834
- readonly mergedRules: MergedRulesCache<T>;
835
- importRules: (config: RouteRulesConfig<T>) => void;
836
- exportRules: () => RouteRulesConfig<T>;
837
- addRule: (pattern: string, config: RouteConfig<T>) => void;
838
- updateRule: (pattern: string, config: Partial<RouteConfig<T>>) => void;
830
+ readonly rules: Record<string, DefaultRouteConfig>;
831
+ readonly mergedRules: Record<string, DefaultRouteConfig>;
832
+ importRules: (config: Record<string, DefaultRouteConfig>) => void;
833
+ exportRules: () => Record<string, DefaultRouteConfig>;
834
+ addRule: (pattern: string, config: DefaultRouteConfig) => void;
835
+ updateRule: (pattern: string, config: Partial<DefaultRouteConfig>) => void;
839
836
  removeRule: (pattern: string) => void;
840
837
  matchesRule: (url: string, pattern: string) => boolean;
841
838
  getMatchingPatterns: (url: string) => string[];
842
- getConfig: (url: string) => RouteConfig<T> | null;
839
+ getConfig: (url: string) => DefaultRouteConfig | null;
843
840
  getParams: (url: string, pattern: string) => Record<string, string> | null;
844
841
  match: (url: string) => {
845
842
  pattern: string;
846
- config: RouteConfig<T>;
843
+ config: DefaultRouteConfig;
847
844
  params: Record<string, string> | null;
848
845
  } | null;
849
846
  clear: () => void;
850
847
  clearMergedRules: () => void;
851
848
  precomputeMergedRules: (urls: string[]) => void;
852
- setMergedRule: (url: string, config: RouteConfig<T>) => void;
853
- getMergedRules: () => MergedRulesCache<T>;
854
- configure: (config: RouteRulesConfig<T>) => void;
855
- updateMergeRules: () => MergedRulesCache<T>;
849
+ setMergedRule: (url: string, config: DefaultRouteConfig) => void;
850
+ getMergedRules: () => Record<string, DefaultRouteConfig>;
851
+ configure: (config: Record<string, DefaultRouteConfig>) => void;
852
+ updateMergeRules: () => Record<string, DefaultRouteConfig>;
856
853
  }
857
854
 
858
855
  type CustomDriverName = string & {
@@ -1132,4 +1129,4 @@ interface ServiceParseModule {
1132
1129
 
1133
1130
  declare const autoImportTypes: string[];
1134
1131
 
1135
- export { type AppConfig, type Awaitable, type BaseNamespaceType, type BaseSchemaType, type BaseSilgiMethodType, type CaptureError, type CapturedErrorContext, type CommandType, type CreateScope, type DeepPartial, type DefaultHooks, type DefaultNamespaces, type DefaultRouteConfig, type DefaultRouteRules, type DotenvOptions, type EnvOptions, type EventHandlerResponse, type ExtendContext, type ExtendShared, type ExtractInputFromURI, type ExtractOutputFromURI, type ExtractPathParamsFromURI, type ExtractQueryParamsFromURI, type ExtractSourceFromURI, type FrameworkContext, type GenerateAppOptions, type GraphQLJSON, type HookResult, type ImportItem, type LoadConfigOptions, type MergedRulesCache, type MergedSilgiSchema, type MethodHandlerType, type ModuleDefinition, type ModuleHookContext, type ModuleMeta, type ModuleOptionsCustom, type ModuleSetupInstallResult, type ModuleSetupReturn, type Namespaces, type NitroBuildInfo, type PrepareCore, type RequiredServiceType, type ResolvedMethodHandlerType, type ResolvedModuleMeta, type ResolvedModuleOptions, type ResolvedServiceType, type ResolvedSilgiTemplate, type RouteConfig, type RouteRules, type RouteRulesConfig, type ScanFile, type SchemaPreparationOptions, type ServiceParse, type ServiceParseModule, type ServiceType, type Silgi, type SilgiAppPlugin, type SilgiCLI, type SilgiCLIConfig, type SilgiCLIDynamicConfig, type SilgiCLIHooks, type SilgiCLIOptions, type SilgiCompatibility, type SilgiCompatibilityIssue, type SilgiCompatibilityIssues, type SilgiConfig, type SilgiEvents, type SilgiFrameworkInfo, type SilgiFunction, type SilgiHooks, type SilgiModule, type SilgiModuleInput, type SilgiModuleOptions, type SilgiNamespaces, type SilgiOperation, type SilgiOptions, type SilgiPreset, type SilgiPresetMeta, type SilgiRouteRules, type SilgiRouterTypes, type SilgiRuntimeActions, type SilgiRuntimeConfig, type SilgiRuntimeContext, type SilgiRuntimeHooks, type SilgiRuntimeMethods, type SilgiRuntimeOptions, type SilgiRuntimeRouteRules, type SilgiRuntimeRouteRulesConfig, type SilgiRuntimeSharedExtends, type SilgiRuntimeShareds, type SilgiSchema, type SilgiServiceInterface, type SilgiStorageBase, type SilgiTemplate, type SilgiURIs, type StorageConfig, type StorageKeyGenerator, type StorageKeyParams, type StorageMounts, type TSReference, type URIsTypes, autoImportTypes };
1132
+ export { type AppConfig, type Awaitable, type BaseNamespaceType, type BaseSchemaType, type BaseSilgiMethodType, type CaptureError, type CapturedErrorContext, type CommandType, type CreateScope, type DeepPartial, type DefaultHooks, type DefaultNamespaces, type DefaultRouteConfig, type DefaultRouteRules, type DotenvOptions, type EnvOptions, type EventHandlerResponse, type ExtendContext, type ExtendShared, type ExtractInputFromURI, type ExtractOutputFromURI, type ExtractPathParamsFromURI, type ExtractQueryParamsFromURI, type ExtractSourceFromURI, type FrameworkContext, type GenerateAppOptions, type GraphQLJSON, type HookResult, type ImportItem, type LoadConfigOptions, type MergedSilgiSchema, type MethodHandlerType, type ModuleDefinition, type ModuleHookContext, type ModuleMeta, type ModuleOptionsCustom, type ModuleSetupInstallResult, type ModuleSetupReturn, type Namespaces, type NitroBuildInfo, type PrepareCore, type RequiredServiceType, type ResolvedMethodHandlerType, type ResolvedModuleMeta, type ResolvedModuleOptions, type ResolvedServiceType, type ResolvedSilgiTemplate, type RouteRules, type ScanFile, type SchemaPreparationOptions, type ServiceParse, type ServiceParseModule, type ServiceType, type Silgi, type SilgiAppPlugin, type SilgiCLI, type SilgiCLIConfig, type SilgiCLIDynamicConfig, type SilgiCLIHooks, type SilgiCLIOptions, type SilgiCompatibility, type SilgiCompatibilityIssue, type SilgiCompatibilityIssues, type SilgiConfig, type SilgiEvents, type SilgiFrameworkInfo, type SilgiFunction, type SilgiHooks, type SilgiModule, type SilgiModuleInput, type SilgiModuleOptions, type SilgiNamespaces, type SilgiOperation, type SilgiOptions, type SilgiPreset, type SilgiPresetMeta, type SilgiRouteRules, type SilgiRouterTypes, type SilgiRuntimeActions, type SilgiRuntimeConfig, type SilgiRuntimeContext, type SilgiRuntimeHooks, type SilgiRuntimeMethods, type SilgiRuntimeOptions, type SilgiRuntimeRouteRules, type SilgiRuntimeRouteRulesConfig, type SilgiRuntimeSharedExtends, type SilgiRuntimeShareds, type SilgiSchema, type SilgiServiceInterface, type SilgiStorageBase, type SilgiTemplate, type SilgiURIs, type StorageConfig, type StorageKeyGenerator, type StorageKeyParams, type StorageMounts, type TSReference, type URIsTypes, autoImportTypes };
@@ -819,9 +819,6 @@ interface DefaultRouteRules extends SilgiRuntimeRouteRules {
819
819
  [key: string]: any;
820
820
  }
821
821
  type SilgiRouteRules = Record<DefaultRouteRules extends string ? DefaultRouteRules : string, DefaultRouteConfig>;
822
- type RouteConfig<T extends Record<string, any> = DefaultRouteConfig> = T;
823
- type RouteRulesConfig<T extends Record<string, any> = DefaultRouteConfig> = Record<string, T>;
824
- type MergedRulesCache<T extends Record<string, any> = DefaultRouteConfig> = Record<string, T>;
825
822
  interface SilgiRuntimeRouteRules {
826
823
  }
827
824
  interface SilgiRuntimeRouteRulesConfig {
@@ -830,29 +827,29 @@ interface SilgiRuntimeRouteRulesConfig {
830
827
  * Interface for the object returned by createRouteRules
831
828
  */
832
829
  interface RouteRules<T extends Record<string, any> = DefaultRouteRules> {
833
- readonly rules: RouteRulesConfig<T>;
834
- readonly mergedRules: MergedRulesCache<T>;
835
- importRules: (config: RouteRulesConfig<T>) => void;
836
- exportRules: () => RouteRulesConfig<T>;
837
- addRule: (pattern: string, config: RouteConfig<T>) => void;
838
- updateRule: (pattern: string, config: Partial<RouteConfig<T>>) => void;
830
+ readonly rules: Record<string, DefaultRouteConfig>;
831
+ readonly mergedRules: Record<string, DefaultRouteConfig>;
832
+ importRules: (config: Record<string, DefaultRouteConfig>) => void;
833
+ exportRules: () => Record<string, DefaultRouteConfig>;
834
+ addRule: (pattern: string, config: DefaultRouteConfig) => void;
835
+ updateRule: (pattern: string, config: Partial<DefaultRouteConfig>) => void;
839
836
  removeRule: (pattern: string) => void;
840
837
  matchesRule: (url: string, pattern: string) => boolean;
841
838
  getMatchingPatterns: (url: string) => string[];
842
- getConfig: (url: string) => RouteConfig<T> | null;
839
+ getConfig: (url: string) => DefaultRouteConfig | null;
843
840
  getParams: (url: string, pattern: string) => Record<string, string> | null;
844
841
  match: (url: string) => {
845
842
  pattern: string;
846
- config: RouteConfig<T>;
843
+ config: DefaultRouteConfig;
847
844
  params: Record<string, string> | null;
848
845
  } | null;
849
846
  clear: () => void;
850
847
  clearMergedRules: () => void;
851
848
  precomputeMergedRules: (urls: string[]) => void;
852
- setMergedRule: (url: string, config: RouteConfig<T>) => void;
853
- getMergedRules: () => MergedRulesCache<T>;
854
- configure: (config: RouteRulesConfig<T>) => void;
855
- updateMergeRules: () => MergedRulesCache<T>;
849
+ setMergedRule: (url: string, config: DefaultRouteConfig) => void;
850
+ getMergedRules: () => Record<string, DefaultRouteConfig>;
851
+ configure: (config: Record<string, DefaultRouteConfig>) => void;
852
+ updateMergeRules: () => Record<string, DefaultRouteConfig>;
856
853
  }
857
854
 
858
855
  type CustomDriverName = string & {
@@ -1132,4 +1129,4 @@ interface ServiceParseModule {
1132
1129
 
1133
1130
  declare const autoImportTypes: string[];
1134
1131
 
1135
- export { type AppConfig, type Awaitable, type BaseNamespaceType, type BaseSchemaType, type BaseSilgiMethodType, type CaptureError, type CapturedErrorContext, type CommandType, type CreateScope, type DeepPartial, type DefaultHooks, type DefaultNamespaces, type DefaultRouteConfig, type DefaultRouteRules, type DotenvOptions, type EnvOptions, type EventHandlerResponse, type ExtendContext, type ExtendShared, type ExtractInputFromURI, type ExtractOutputFromURI, type ExtractPathParamsFromURI, type ExtractQueryParamsFromURI, type ExtractSourceFromURI, type FrameworkContext, type GenerateAppOptions, type GraphQLJSON, type HookResult, type ImportItem, type LoadConfigOptions, type MergedRulesCache, type MergedSilgiSchema, type MethodHandlerType, type ModuleDefinition, type ModuleHookContext, type ModuleMeta, type ModuleOptionsCustom, type ModuleSetupInstallResult, type ModuleSetupReturn, type Namespaces, type NitroBuildInfo, type PrepareCore, type RequiredServiceType, type ResolvedMethodHandlerType, type ResolvedModuleMeta, type ResolvedModuleOptions, type ResolvedServiceType, type ResolvedSilgiTemplate, type RouteConfig, type RouteRules, type RouteRulesConfig, type ScanFile, type SchemaPreparationOptions, type ServiceParse, type ServiceParseModule, type ServiceType, type Silgi, type SilgiAppPlugin, type SilgiCLI, type SilgiCLIConfig, type SilgiCLIDynamicConfig, type SilgiCLIHooks, type SilgiCLIOptions, type SilgiCompatibility, type SilgiCompatibilityIssue, type SilgiCompatibilityIssues, type SilgiConfig, type SilgiEvents, type SilgiFrameworkInfo, type SilgiFunction, type SilgiHooks, type SilgiModule, type SilgiModuleInput, type SilgiModuleOptions, type SilgiNamespaces, type SilgiOperation, type SilgiOptions, type SilgiPreset, type SilgiPresetMeta, type SilgiRouteRules, type SilgiRouterTypes, type SilgiRuntimeActions, type SilgiRuntimeConfig, type SilgiRuntimeContext, type SilgiRuntimeHooks, type SilgiRuntimeMethods, type SilgiRuntimeOptions, type SilgiRuntimeRouteRules, type SilgiRuntimeRouteRulesConfig, type SilgiRuntimeSharedExtends, type SilgiRuntimeShareds, type SilgiSchema, type SilgiServiceInterface, type SilgiStorageBase, type SilgiTemplate, type SilgiURIs, type StorageConfig, type StorageKeyGenerator, type StorageKeyParams, type StorageMounts, type TSReference, type URIsTypes, autoImportTypes };
1132
+ export { type AppConfig, type Awaitable, type BaseNamespaceType, type BaseSchemaType, type BaseSilgiMethodType, type CaptureError, type CapturedErrorContext, type CommandType, type CreateScope, type DeepPartial, type DefaultHooks, type DefaultNamespaces, type DefaultRouteConfig, type DefaultRouteRules, type DotenvOptions, type EnvOptions, type EventHandlerResponse, type ExtendContext, type ExtendShared, type ExtractInputFromURI, type ExtractOutputFromURI, type ExtractPathParamsFromURI, type ExtractQueryParamsFromURI, type ExtractSourceFromURI, type FrameworkContext, type GenerateAppOptions, type GraphQLJSON, type HookResult, type ImportItem, type LoadConfigOptions, type MergedSilgiSchema, type MethodHandlerType, type ModuleDefinition, type ModuleHookContext, type ModuleMeta, type ModuleOptionsCustom, type ModuleSetupInstallResult, type ModuleSetupReturn, type Namespaces, type NitroBuildInfo, type PrepareCore, type RequiredServiceType, type ResolvedMethodHandlerType, type ResolvedModuleMeta, type ResolvedModuleOptions, type ResolvedServiceType, type ResolvedSilgiTemplate, type RouteRules, type ScanFile, type SchemaPreparationOptions, type ServiceParse, type ServiceParseModule, type ServiceType, type Silgi, type SilgiAppPlugin, type SilgiCLI, type SilgiCLIConfig, type SilgiCLIDynamicConfig, type SilgiCLIHooks, type SilgiCLIOptions, type SilgiCompatibility, type SilgiCompatibilityIssue, type SilgiCompatibilityIssues, type SilgiConfig, type SilgiEvents, type SilgiFrameworkInfo, type SilgiFunction, type SilgiHooks, type SilgiModule, type SilgiModuleInput, type SilgiModuleOptions, type SilgiNamespaces, type SilgiOperation, type SilgiOptions, type SilgiPreset, type SilgiPresetMeta, type SilgiRouteRules, type SilgiRouterTypes, type SilgiRuntimeActions, type SilgiRuntimeConfig, type SilgiRuntimeContext, type SilgiRuntimeHooks, type SilgiRuntimeMethods, type SilgiRuntimeOptions, type SilgiRuntimeRouteRules, type SilgiRuntimeRouteRulesConfig, type SilgiRuntimeSharedExtends, type SilgiRuntimeShareds, type SilgiSchema, type SilgiServiceInterface, type SilgiStorageBase, type SilgiTemplate, type SilgiURIs, type StorageConfig, type StorageKeyGenerator, type StorageKeyParams, type StorageMounts, type TSReference, type URIsTypes, autoImportTypes };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "silgi",
3
3
  "type": "module",
4
- "version": "0.16.3",
4
+ "version": "0.16.5",
5
5
  "private": false,
6
6
  "sideEffects": false,
7
7
  "exports": {
@@ -180,7 +180,7 @@
180
180
  "lint": "eslint .",
181
181
  "lint:fix": "eslint . --fix",
182
182
  "silgi": "tsx cli/index.ts",
183
- "release": "pnpm gen-presets && pnpm unbuild && pnpm publish --no-git-checks --access public",
183
+ "release": "pnpm vitest run && pnpm gen-presets && pnpm unbuild && pnpm publish --no-git-checks --access public",
184
184
  "generate": "pnpm --filter './examples/**' silgi:prepare",
185
185
  "gen-presets": "pnpm jiti scripts/gen-presets.ts",
186
186
  "all:delete": "find . -type d \\( -name \"node_modules\" -o -name \"dist\" \\) -prune -exec rm -rf {} +"