silgi 0.37.15 → 0.37.17
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/cli/watch.mjs +9 -1
- package/dist/core/index.mjs +1 -1
- package/dist/types/index.d.mts +6 -3
- package/package.json +1 -1
package/dist/cli/index.mjs
CHANGED
package/dist/cli/watch.mjs
CHANGED
|
@@ -3,12 +3,12 @@ import consola from 'consola';
|
|
|
3
3
|
import { version } from 'silgi/meta';
|
|
4
4
|
import { w as watchDev } from './dev.mjs';
|
|
5
5
|
import { b as commonArgs, a as command$1 } from './prepare.mjs';
|
|
6
|
+
import { useSilgiCLI } from 'silgi';
|
|
6
7
|
import 'chokidar';
|
|
7
8
|
import 'pathe';
|
|
8
9
|
import 'perfect-debounce';
|
|
9
10
|
import '../_chunks/silgiApp.mjs';
|
|
10
11
|
import 'unctx';
|
|
11
|
-
import 'silgi';
|
|
12
12
|
import './build.mjs';
|
|
13
13
|
import 'hookable';
|
|
14
14
|
import 'silgi/kit';
|
|
@@ -69,6 +69,14 @@ const command = defineCommand({
|
|
|
69
69
|
rawArgs: ["--commandType", "dev", "--dev", "true"]
|
|
70
70
|
});
|
|
71
71
|
const watch = await watchDev();
|
|
72
|
+
const silgi = useSilgiCLI();
|
|
73
|
+
if (!silgi) {
|
|
74
|
+
throw new Error("Silgi is not initialized");
|
|
75
|
+
}
|
|
76
|
+
globalThis.__nitro__ = globalThis.__nitro__ || {};
|
|
77
|
+
globalThis.__nitro__.useRuntimeConfig = function() {
|
|
78
|
+
return silgi?.options?.runtimeConfig || {};
|
|
79
|
+
};
|
|
72
80
|
process.on("SIGINT", async () => {
|
|
73
81
|
consola.withTag("silgi").info("Shutting down...");
|
|
74
82
|
if (watch) {
|
package/dist/core/index.mjs
CHANGED
|
@@ -533,7 +533,7 @@ function getUrlPrefix(path, method) {
|
|
|
533
533
|
async function orchestrate(route, event) {
|
|
534
534
|
const silgiCtx = useSilgi();
|
|
535
535
|
const silgiURL = getUrlPrefix(route.route, event.req.method);
|
|
536
|
-
const input = await parseRequestInput(event.req);
|
|
536
|
+
const input = route.service.routerRule?.readBeforeBody === false ? {} : await parseRequestInput(event.req);
|
|
537
537
|
const hookContext = { earlyReturnValue: false };
|
|
538
538
|
try {
|
|
539
539
|
const routerParams = getRouterParams(event);
|
package/dist/types/index.d.mts
CHANGED
|
@@ -7,7 +7,7 @@ import { Hookable, NestedHooks } from 'hookable';
|
|
|
7
7
|
import { Ignore, Options } from 'ignore';
|
|
8
8
|
import { TSConfig } from 'pkg-types';
|
|
9
9
|
import { PresetName, PresetOptions, PresetNameInput } from 'silgi/presets';
|
|
10
|
-
import { ResolvedServiceDefinition as ResolvedServiceDefinition$1, SilgiRuntimeShareds as SilgiRuntimeShareds$1, ModuleMeta as ModuleMeta$1, SilgiModule as SilgiModule$1, BuildSilgi as BuildSilgi$1, SilgiSchema as SilgiSchema$1, SilgiEvent as SilgiEvent$1, SilgiRuntimeActions as SilgiRuntimeActions$1, StorageConfig as StorageConfig$1, Commands as Commands$1, DotenvOptions as DotenvOptions$1, EnvOptions as EnvOptions$1, SilgiRuntimeConfig as SilgiRuntimeConfig$1, SilgiCLIHooks as SilgiCLIHooks$1, StorageMounts as StorageMounts$1, SilgiTemplate as SilgiTemplate$1, SilgiFrameworkInfo as SilgiFrameworkInfo$1 } from 'silgi/types';
|
|
10
|
+
import { ResolvedServiceDefinition as ResolvedServiceDefinition$1, SilgiRuntimeShareds as SilgiRuntimeShareds$1, ModuleMeta as ModuleMeta$1, SilgiModule as SilgiModule$1, BuildSilgi as BuildSilgi$1, SilgiSchema as SilgiSchema$1, SilgiEvent as SilgiEvent$1, RouteConfigService as RouteConfigService$1, SilgiRuntimeActions as SilgiRuntimeActions$1, StorageConfig as StorageConfig$1, Commands as Commands$1, DotenvOptions as DotenvOptions$1, EnvOptions as EnvOptions$1, SilgiRuntimeConfig as SilgiRuntimeConfig$1, SilgiCLIHooks as SilgiCLIHooks$1, StorageMounts as StorageMounts$1, SilgiTemplate as SilgiTemplate$1, SilgiFrameworkInfo as SilgiFrameworkInfo$1 } from 'silgi/types';
|
|
11
11
|
import { Adapter, TablesSchema, InferModelTypes } from 'unadapter/types';
|
|
12
12
|
import { UnimportPluginOptions } from 'unimport/unplugin';
|
|
13
13
|
import * as h3 from 'h3';
|
|
@@ -425,6 +425,7 @@ type ServiceHandler<Schema extends SilgiSchema$1, Route extends keyof Schema, Me
|
|
|
425
425
|
*/
|
|
426
426
|
interface ServiceSetup<Schema extends SilgiSchema$1 = SilgiSchema$1, Route extends keyof Schema = keyof Schema, Method extends keyof Schema[Route] = keyof Schema[Route], Resolved extends boolean = false, HiddenParameters extends boolean = false> {
|
|
427
427
|
handler: ServiceHandler<Schema, Route, Method, Resolved, HiddenParameters>;
|
|
428
|
+
routerRule?: RouteConfigService$1;
|
|
428
429
|
modules?: Partial<SilgiRuntimeActions$1>;
|
|
429
430
|
storage?: StorageConfig$1<ServiceHandlerInput<Schema, Route, Method, HiddenParameters>>;
|
|
430
431
|
}
|
|
@@ -562,10 +563,12 @@ type ExtractPathParamKeys<S extends string> = S extends `${string}:${infer Param
|
|
|
562
563
|
/**
|
|
563
564
|
* Route configuration interface.
|
|
564
565
|
*/
|
|
565
|
-
interface RouteConfig<T> {
|
|
566
|
+
interface RouteConfig<T extends string = string> {
|
|
566
567
|
route: T;
|
|
567
568
|
setup?: any;
|
|
569
|
+
readBeforeBody?: boolean;
|
|
568
570
|
}
|
|
571
|
+
type RouteConfigService<T extends string = string> = Omit<RouteConfig<T>, 'route' | 'setup'>;
|
|
569
572
|
|
|
570
573
|
interface SilgiSchema {
|
|
571
574
|
}
|
|
@@ -1195,4 +1198,4 @@ interface GraphQLJSON {
|
|
|
1195
1198
|
references: any;
|
|
1196
1199
|
}
|
|
1197
1200
|
|
|
1198
|
-
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, GenImport, GenerateAppOptions, GraphQLJSON, HTTPMethod, HookResult, HttpMethod, LoadConfigOptions, MergeAll, MergedSilgiSchema, MethodSchemas, ModuleDefinition, ModuleHookContext, ModuleMeta, ModuleOptionsCustom, ModuleSetupInstallResult, ModuleSetupReturn, NamespacesForPrefix, NitroBuildInfo, RequiredServiceType, ResolvedModuleMeta, ResolvedModuleOptions, ResolvedSchema, ResolvedSchemaDefinition, 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 };
|
|
1201
|
+
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, GenImport, GenerateAppOptions, GraphQLJSON, HTTPMethod, HookResult, HttpMethod, LoadConfigOptions, MergeAll, MergedSilgiSchema, MethodSchemas, ModuleDefinition, ModuleHookContext, ModuleMeta, ModuleOptionsCustom, ModuleSetupInstallResult, ModuleSetupReturn, NamespacesForPrefix, NitroBuildInfo, RequiredServiceType, ResolvedModuleMeta, ResolvedModuleOptions, ResolvedSchema, ResolvedSchemaDefinition, ResolvedServiceDefinition, ResolvedSilgiTemplate, RouteConfig, RouteConfigService, 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 };
|