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.
- package/dist/cli/index.mjs +1 -1
- package/dist/core/index.d.mts +10 -10
- package/dist/core/index.mjs +2 -2
- package/dist/types/index.d.mts +1 -2
- package/package.json +1 -1
package/dist/cli/index.mjs
CHANGED
package/dist/core/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SilgiConfig, Silgi, SilgiEvent, SilgiSchema, RouteEntry, CustomRequestInit, SilgiRuntimeContext, Routers, HTTPMethod, HasPathParams, BaseMethodSchema, WithPathParams, MergeAll,
|
|
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
|
|
172
|
+
declare function createMiddleware<Global extends string>(params: {
|
|
173
173
|
global: Global;
|
|
174
|
-
setup:
|
|
174
|
+
setup: MiddlewareSetup;
|
|
175
175
|
method?: undefined | readonly [];
|
|
176
176
|
}): {
|
|
177
177
|
[K in `GLOBAL:${Global}`]: {
|
|
178
|
-
setup:
|
|
178
|
+
setup: MiddlewareSetup;
|
|
179
179
|
global: Global;
|
|
180
180
|
method: false;
|
|
181
181
|
};
|
|
182
182
|
};
|
|
183
|
-
declare function createMiddleware<Global extends string,
|
|
183
|
+
declare function createMiddleware<Global extends string, Method extends HttpMethod, UsedMethod extends readonly Method[]>(params: {
|
|
184
184
|
global: Global;
|
|
185
|
-
setup:
|
|
185
|
+
setup: MiddlewareSetup;
|
|
186
186
|
method: UsedMethod;
|
|
187
187
|
}): {
|
|
188
188
|
[K in `${UsedMethod[number]}:${Global}`]: {
|
|
189
|
-
setup:
|
|
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>,
|
|
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:
|
|
197
|
+
setup: MiddlewareSetup;
|
|
198
198
|
global?: undefined;
|
|
199
199
|
}): {
|
|
200
200
|
[K in `${UsedMethod[number]}:${S}`]: {
|
|
201
|
-
setup:
|
|
201
|
+
setup: MiddlewareSetup;
|
|
202
202
|
method: UsedMethod[number];
|
|
203
203
|
global: undefined;
|
|
204
204
|
};
|
package/dist/core/index.mjs
CHANGED
|
@@ -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
|
|
1034
|
-
|
|
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];
|
package/dist/types/index.d.mts
CHANGED
|
@@ -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,
|
|
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 };
|