silgi 0.41.7 → 0.41.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.mjs +18 -8
- package/dist/types/index.d.mts +1 -1
- package/package.json +1 -1
package/dist/cli/index.mjs
CHANGED
package/dist/core/index.mjs
CHANGED
|
@@ -605,7 +605,7 @@ async function orchestrate(route, event, _input) {
|
|
|
605
605
|
}
|
|
606
606
|
};
|
|
607
607
|
try {
|
|
608
|
-
if (!route.service) {
|
|
608
|
+
if (!route.service && !route.graphql) {
|
|
609
609
|
throw createError({
|
|
610
610
|
statusCode: 404,
|
|
611
611
|
statusMessage: "Service not found"
|
|
@@ -640,11 +640,14 @@ async function orchestrate(route, event, _input) {
|
|
|
640
640
|
}
|
|
641
641
|
silgiCtx.shared.$fetch = silgiFetch;
|
|
642
642
|
silgiCtx.shared.silgi = silgiCtx;
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
643
|
+
let result;
|
|
644
|
+
if (!route.graphql) {
|
|
645
|
+
result = await route.service?.setup.handler(
|
|
646
|
+
inputData,
|
|
647
|
+
silgiCtx.shared,
|
|
648
|
+
event
|
|
649
|
+
);
|
|
650
|
+
}
|
|
648
651
|
await silgiCtx.callHook("fetch:after", {
|
|
649
652
|
event,
|
|
650
653
|
url: silgiURL,
|
|
@@ -654,7 +657,7 @@ async function orchestrate(route, event, _input) {
|
|
|
654
657
|
route,
|
|
655
658
|
hookContext
|
|
656
659
|
});
|
|
657
|
-
if (route.service
|
|
660
|
+
if (route.service?.setup.storage && cacheData?.cachedKey) {
|
|
658
661
|
await useSilgiStorage(route.service.setup.storage.base).setItem(
|
|
659
662
|
cacheData.cachedKey,
|
|
660
663
|
result,
|
|
@@ -1000,7 +1003,14 @@ async function handler(event, url, input) {
|
|
|
1000
1003
|
data: {
|
|
1001
1004
|
graphql: true,
|
|
1002
1005
|
method: url?.method || event.req.method,
|
|
1003
|
-
route: url
|
|
1006
|
+
route: url?.path,
|
|
1007
|
+
service: {
|
|
1008
|
+
setup: {
|
|
1009
|
+
handler: () => {
|
|
1010
|
+
}
|
|
1011
|
+
},
|
|
1012
|
+
methods: []
|
|
1013
|
+
}
|
|
1004
1014
|
},
|
|
1005
1015
|
params: {}
|
|
1006
1016
|
};
|
package/dist/types/index.d.mts
CHANGED
|
@@ -261,7 +261,7 @@ type ServiceHandlerInput<Input extends StandardSchemaV1 = StandardSchemaV1, Path
|
|
|
261
261
|
* Resolved = false -> handler(input, shared, event, source) // all required
|
|
262
262
|
* Resolved = true -> handler(input, shared?, event?, source?) // only input required
|
|
263
263
|
*/
|
|
264
|
-
type ServiceHandler<Input extends StandardSchemaV1, Output extends StandardSchemaV1, PathParams extends StandardSchemaV1 | never | undefined = never, QueryParams extends StandardSchemaV1 | never | undefined = never, Resolved extends boolean = false, HiddenParameters extends boolean = false> = Resolved extends true ? (input: ServiceHandlerInput<Input, PathParams, QueryParams, HiddenParameters>, shared?: SilgiRuntimeShareds, event?: SilgiEvent) => Promise<InferOutput<Output>> : (input: ServiceHandlerInput<Input, PathParams, QueryParams, HiddenParameters>, shared: SilgiRuntimeShareds, event: SilgiEvent) => Promise<InferOutput<Output
|
|
264
|
+
type ServiceHandler<Input extends StandardSchemaV1, Output extends StandardSchemaV1, PathParams extends StandardSchemaV1 | never | undefined = never, QueryParams extends StandardSchemaV1 | never | undefined = never, Resolved extends boolean = false, HiddenParameters extends boolean = false> = Resolved extends true ? (input: ServiceHandlerInput<Input, PathParams, QueryParams, HiddenParameters>, shared?: SilgiRuntimeShareds, event?: SilgiEvent) => Promise<InferOutput<Output>> | InferOutput<Output> : (input: ServiceHandlerInput<Input, PathParams, QueryParams, HiddenParameters>, shared: SilgiRuntimeShareds, event: SilgiEvent) => Promise<InferOutput<Output>> | InferOutput<Output>;
|
|
265
265
|
/**
|
|
266
266
|
* Servis setup tipi
|
|
267
267
|
*/
|