silgi 0.37.1 → 0.37.2
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.mjs +7 -7
- package/dist/types/index.d.mts +1 -2
- package/package.json +1 -1
package/dist/cli/index.mjs
CHANGED
package/dist/core/index.mjs
CHANGED
|
@@ -306,7 +306,7 @@ async function createSilgi(config) {
|
|
|
306
306
|
addRoute(silgi.router, _method, route, {
|
|
307
307
|
method: _method,
|
|
308
308
|
route,
|
|
309
|
-
|
|
309
|
+
service: methodObject,
|
|
310
310
|
schema: schemaWrapper
|
|
311
311
|
});
|
|
312
312
|
}
|
|
@@ -537,7 +537,7 @@ async function orchestrate(route, event) {
|
|
|
537
537
|
try {
|
|
538
538
|
const routerParams = getRouterParams(event);
|
|
539
539
|
const queryParams = getQuery(event);
|
|
540
|
-
const
|
|
540
|
+
const service = route.service;
|
|
541
541
|
const cachePromise = cacheExecute(input, route, silgiURL, event);
|
|
542
542
|
const beforeHookPromise = silgiCtx.callHook("fetch:before", {
|
|
543
543
|
url: silgiURL,
|
|
@@ -561,7 +561,7 @@ async function orchestrate(route, event) {
|
|
|
561
561
|
}
|
|
562
562
|
silgiCtx.shared.$fetch = silgiFetch;
|
|
563
563
|
silgiCtx.shared.silgi = silgiCtx;
|
|
564
|
-
const result = await
|
|
564
|
+
const result = await service?.handler(
|
|
565
565
|
{
|
|
566
566
|
args: input,
|
|
567
567
|
parameters: {
|
|
@@ -582,12 +582,12 @@ async function orchestrate(route, event) {
|
|
|
582
582
|
// modules: setup.modules,
|
|
583
583
|
route
|
|
584
584
|
});
|
|
585
|
-
if (
|
|
586
|
-
await useSilgiStorage(
|
|
585
|
+
if (service.storage && cacheData?.cachedKey) {
|
|
586
|
+
await useSilgiStorage(service.storage.base).setItem(
|
|
587
587
|
cacheData.cachedKey,
|
|
588
588
|
result,
|
|
589
589
|
// Cast to StorageValue if needed
|
|
590
|
-
|
|
590
|
+
service.storage.options
|
|
591
591
|
);
|
|
592
592
|
}
|
|
593
593
|
return result;
|
|
@@ -616,7 +616,7 @@ async function orchestrate(route, event) {
|
|
|
616
616
|
}
|
|
617
617
|
}
|
|
618
618
|
async function cacheExecute(input, route, silgiURL, event) {
|
|
619
|
-
const setup = route.
|
|
619
|
+
const setup = route.service;
|
|
620
620
|
if (!setup.storage)
|
|
621
621
|
return;
|
|
622
622
|
const cacheKey = setup.storage ? await generateStorageKey({
|
package/dist/types/index.d.mts
CHANGED
|
@@ -366,7 +366,6 @@ interface SilgiRuntimeHooks {
|
|
|
366
366
|
* @returns Promise
|
|
367
367
|
*/
|
|
368
368
|
'close': (silgi: Silgi) => HookResult;
|
|
369
|
-
'app:setup:start': (silgi: Silgi) => HookResult;
|
|
370
369
|
'request:on': (event: SilgiEvent) => HookResult;
|
|
371
370
|
'fetch:before': (context: ModuleHookContext) => HookResult;
|
|
372
371
|
'fetch:after': (context: ModuleHookContext) => HookResult;
|
|
@@ -661,7 +660,7 @@ type HTTPMethod = SilgiRuntimeMethods extends Record<string, any> ? keyof SilgiR
|
|
|
661
660
|
interface SilgiRoute {
|
|
662
661
|
route: string;
|
|
663
662
|
method?: HTTPMethod;
|
|
664
|
-
|
|
663
|
+
service: ServiceSetup;
|
|
665
664
|
schema: ResolvedSchemaDefinition;
|
|
666
665
|
}
|
|
667
666
|
interface Silgi {
|