silgi 0.39.6 → 0.39.8

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.39.6";
4
+ const version = "0.39.8";
5
5
  const packageJson = {
6
6
  version: version};
7
7
 
@@ -1,4 +1,4 @@
1
- import { SilgiConfig, Silgi, SilgiEvent, SilgiSchema, RouteEntry, CustomRequestInit, SilgiRuntimeContext, Routers, HTTPMethod, HasPathParams, BaseMethodSchema, WithPathParams, MergeAll, MiddlewareDefinition, HttpMethod, ServiceSetup, SilgiRuntimeShareds, RouterConfig, SilgiURL, StorageConfig, SilgiCLI, SilgiStorageBase, SilgiRuntimeConfig } from 'silgi/types';
1
+ import { SilgiConfig, Silgi, SilgiEvent, SilgiSchema, RouteEntry, CustomRequestInit, SilgiRuntimeContext, Routers, HTTPMethod, HasPathParams, BaseMethodSchema, WithPathParams, MergeAll, MiddlewareSetup, HttpMethod, ServiceSetup, SilgiRuntimeShareds, RouterConfig, SilgiURL, StorageConfig, SilgiCLI, SilgiStorageBase, SilgiRuntimeConfig } from 'silgi/types';
2
2
  import { Storage, StorageValue } from 'unstorage';
3
3
  import { UseContext } from 'unctx';
4
4
 
@@ -169,36 +169,36 @@ declare function createService<Schema extends SilgiSchema, Path extends keyof Sc
169
169
  [K in Path]: ServiceSetup<Schema, Path, Resolved, HiddenParameters>;
170
170
  };
171
171
  type WildcardVariants<Path extends string, Acc extends string = ''> = Path extends `${infer Head}/${infer Tail}` ? Tail extends '' ? `${Acc}${Head}` : `${Acc}${Head}/${Tail}` | `${Acc}${Head}/*` | `${Acc}${Head}/**` | WildcardVariants<Tail, `${Acc}${Head}/`> : `${Acc}${Path}`;
172
- declare function createMiddleware<Global extends string, Service extends MiddlewareDefinition>(params: {
172
+ declare function createMiddleware<Global extends string>(params: {
173
173
  global: Global;
174
- setup: Service;
174
+ setup: MiddlewareSetup;
175
175
  method?: undefined | readonly [];
176
176
  }): {
177
177
  [K in `GLOBAL:${Global}`]: {
178
- setup: Service;
178
+ setup: MiddlewareSetup;
179
179
  global: Global;
180
180
  method: false;
181
181
  };
182
182
  };
183
- declare function createMiddleware<Global extends string, Service extends MiddlewareDefinition, Method extends HttpMethod, UsedMethod extends readonly Method[]>(params: {
183
+ declare function createMiddleware<Global extends string, Method extends HttpMethod, UsedMethod extends readonly Method[]>(params: {
184
184
  global: Global;
185
- setup: Service;
185
+ setup: MiddlewareSetup;
186
186
  method: UsedMethod;
187
187
  }): {
188
188
  [K in `${UsedMethod[number]}:${Global}`]: {
189
- setup: Service;
189
+ setup: MiddlewareSetup;
190
190
  global: Global;
191
191
  method: UsedMethod[number];
192
192
  };
193
193
  };
194
- declare function createMiddleware<S extends WildcardVariants<keyof Routers>, Service extends MiddlewareDefinition, Method extends HttpMethod, UsedMethod extends readonly Method[]>(params: {
194
+ declare function createMiddleware<S extends WildcardVariants<keyof Routers>, Method extends HttpMethod, UsedMethod extends readonly Method[]>(params: {
195
195
  path: S;
196
196
  method: UsedMethod;
197
- setup: Service;
197
+ setup: MiddlewareSetup;
198
198
  global?: undefined;
199
199
  }): {
200
200
  [K in `${UsedMethod[number]}:${S}`]: {
201
- setup: Service;
201
+ setup: MiddlewareSetup;
202
202
  method: UsedMethod[number];
203
203
  global: undefined;
204
204
  };
@@ -1030,8 +1030,8 @@ function getEventContext(event) {
1030
1030
  function createSchema(params) {
1031
1031
  const { path, method, setup } = params;
1032
1032
  const result = {};
1033
- if (!method || method.length === 0) {
1034
- return {};
1033
+ if (!method) {
1034
+ throw new Error("Method is required createSchema " + path);
1035
1035
  }
1036
1036
  for (let i = 0; i < method.length; i++) {
1037
1037
  const methodName = method[i];
@@ -407,7 +407,6 @@ interface MiddlewareSetup {
407
407
  modules?: Partial<SetupModuleOption>;
408
408
  storage?: StorageConfig;
409
409
  }
410
- type MiddlewareDefinition = MiddlewareSetup;
411
410
  interface ResolvedMiddlewareDefinition {
412
411
  [methodAndPath: string]: {
413
412
  setup: MiddlewareSetup;
@@ -1228,4 +1227,4 @@ interface LoadConfigOptions {
1228
1227
  consola?: ConsolaInstance;
1229
1228
  }
1230
1229
 
1231
- export type { AllPaths, AllPrefixes, AppConfig, Awaitable, BaseMethodSchema, BuildSilgi, CaptureError, CapturedErrorContext, CommandType, Commands, CustomRequestInit, DeepPartial, DeepRequired, DefaultHooks, DefineFrameworkOptions, DotenvOptions, EnvOptions, EventHandlerResponse, ExtendContext, ExtendShared, ExtractNamespace, ExtractPathParamKeys, ExtractPathParams, ExtractPrefix, ExtractRoute, GenImport, GenerateAppOptions, HTTPMethod, HasPathParams, HookResult, HttpMethod, LoadConfigOptions, MergeAll, MergedSilgiSchema, MetaData, MethodSchemas, MiddlewareDefinition, MiddlewareHandler, MiddlewareSetup, ModuleDefinition, ModuleHookContext, ModuleMeta, ModuleOptionsCustom, ModuleSetupInstallResult, ModuleSetupReturn, NamespacesForPrefix, NitroBuildInfo, RequiredServiceType, ResolvedMiddlewareDefinition, ResolvedModuleMeta, ResolvedModuleOptions, ResolvedSchema, ResolvedSchemaDefinition, ResolvedServiceDefinition, ResolvedSilgiTemplate, RouteEntry, RouteRules, RouterConfig, RouterConfigService, RouterParams, Routers, RoutesForPrefixAndNamespace, ScanFile, Schema, ServiceHandler, ServiceHandlerInput, ServiceHandlerOutput, ServiceHandlerSource, ServiceSetup, 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 };
1230
+ export type { AllPaths, AllPrefixes, AppConfig, Awaitable, BaseMethodSchema, BuildSilgi, CaptureError, CapturedErrorContext, CommandType, Commands, CustomRequestInit, DeepPartial, DeepRequired, DefaultHooks, DefineFrameworkOptions, DotenvOptions, EnvOptions, EventHandlerResponse, ExtendContext, ExtendShared, ExtractNamespace, ExtractPathParamKeys, ExtractPathParams, ExtractPrefix, ExtractRoute, GenImport, GenerateAppOptions, HTTPMethod, HasPathParams, HookResult, HttpMethod, LoadConfigOptions, MergeAll, MergedSilgiSchema, MetaData, MethodSchemas, MiddlewareHandler, MiddlewareSetup, ModuleDefinition, ModuleHookContext, ModuleMeta, ModuleOptionsCustom, ModuleSetupInstallResult, ModuleSetupReturn, NamespacesForPrefix, NitroBuildInfo, RequiredServiceType, ResolvedMiddlewareDefinition, ResolvedModuleMeta, ResolvedModuleOptions, ResolvedSchema, ResolvedSchemaDefinition, ResolvedServiceDefinition, ResolvedSilgiTemplate, RouteEntry, RouteRules, RouterConfig, RouterConfigService, RouterParams, Routers, RoutesForPrefixAndNamespace, ScanFile, Schema, ServiceHandler, ServiceHandlerInput, ServiceHandlerOutput, ServiceHandlerSource, ServiceSetup, 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.39.6",
4
+ "version": "0.39.8",
5
5
  "private": false,
6
6
  "sideEffects": false,
7
7
  "exports": {