silgi 0.41.18 → 0.41.19
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 +15 -21
- package/dist/core/index.mjs +61 -50
- package/dist/index.mjs +1 -0
- package/dist/types/index.d.mts +29 -24
- package/package.json +2 -1
package/dist/cli/index.mjs
CHANGED
package/dist/core/index.d.mts
CHANGED
|
@@ -159,28 +159,22 @@ declare function deepMergeObjects<T extends readonly Record<string, any>[]>(sche
|
|
|
159
159
|
* Tip güvenliğini artırmak için ServiceSetup objesini doğrudan döndürür.
|
|
160
160
|
*/
|
|
161
161
|
type SlashCount<S extends string, Count extends any[] = []> = S extends `${infer _Prefix}/${infer Rest}` ? SlashCount<Rest, [any, ...Count]> : Count['length'];
|
|
162
|
-
type Max4Slashes<S extends keyof Routers> = SlashCount<S> extends 0 | 1 | 2 | 3
|
|
163
|
-
|
|
162
|
+
type Max4Slashes<S extends keyof Routers> = SlashCount<S> extends 0 | 1 | 2 | 3 ? S : never;
|
|
163
|
+
type ServiceSetupsForMethods<Parent extends StandardSchemaV1, Input extends StandardSchemaV1 = StandardSchemaV1, Output extends StandardSchemaV1 = StandardSchemaV1, PathParams extends StandardSchemaV1 | undefined | never = undefined, QueryParams extends StandardSchemaV1 | undefined | never = undefined, Resolved extends boolean = false, HiddenParameters extends boolean = false> = {
|
|
164
|
+
GET?: ServiceSetup<Parent, Input, Output, PathParams, QueryParams, Resolved, HiddenParameters>;
|
|
165
|
+
POST?: ServiceSetup<Parent, Input, Output, PathParams, QueryParams, Resolved, HiddenParameters>;
|
|
166
|
+
PUT?: ServiceSetup<Parent, Input, Output, PathParams, QueryParams, Resolved, HiddenParameters>;
|
|
167
|
+
PATCH?: ServiceSetup<Parent, Input, Output, PathParams, QueryParams, Resolved, HiddenParameters>;
|
|
168
|
+
DELETE?: ServiceSetup<Parent, Input, Output, PathParams, QueryParams, Resolved, HiddenParameters>;
|
|
169
|
+
OPTIONS?: ServiceSetup<Parent, Input, Output, PathParams, QueryParams, Resolved, HiddenParameters>;
|
|
170
|
+
HEAD?: ServiceSetup<Parent, Input, Output, PathParams, QueryParams, Resolved, HiddenParameters>;
|
|
171
|
+
CONNECT?: ServiceSetup<Parent, Input, Output, PathParams, QueryParams, Resolved, HiddenParameters>;
|
|
172
|
+
TRACE?: ServiceSetup<Parent, Input, Output, PathParams, QueryParams, Resolved, HiddenParameters>;
|
|
173
|
+
};
|
|
174
|
+
declare function createService<Parent extends StandardSchemaV1, Path extends keyof Routers = keyof Routers, Input extends StandardSchemaV1 = StandardSchemaV1, Output extends StandardSchemaV1 = StandardSchemaV1, PathParams extends StandardSchemaV1 | undefined | never = undefined, QueryParams extends StandardSchemaV1 | undefined | never = undefined, Resolved extends boolean = false, HiddenParameters extends boolean = false>(params: {
|
|
164
175
|
path: Max4Slashes<Path>;
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
output?: Output;
|
|
168
|
-
queryParams?: {
|
|
169
|
-
path?: PathParams;
|
|
170
|
-
query?: QueryParams;
|
|
171
|
-
};
|
|
172
|
-
setup: ServiceSetup<Input, Output, PathParams, QueryParams, Resolved, HiddenParameters>;
|
|
173
|
-
}): {
|
|
174
|
-
[K in Path]: {
|
|
175
|
-
setup: ServiceSetup<Input, Output, PathParams, QueryParams, Resolved, HiddenParameters>;
|
|
176
|
-
methods?: HTTPMethod[];
|
|
177
|
-
input?: Input;
|
|
178
|
-
output?: Output;
|
|
179
|
-
queryParams?: {
|
|
180
|
-
path?: PathParams;
|
|
181
|
-
query?: QueryParams;
|
|
182
|
-
};
|
|
183
|
-
};
|
|
176
|
+
} & ServiceSetupsForMethods<Parent, Input, Output, PathParams, QueryParams, Resolved, HiddenParameters>): {
|
|
177
|
+
[K in Path]: ServiceSetupsForMethods<Parent, Input, Output, PathParams, QueryParams, Resolved, HiddenParameters>;
|
|
184
178
|
};
|
|
185
179
|
|
|
186
180
|
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}`;
|
package/dist/core/index.mjs
CHANGED
|
@@ -8,6 +8,7 @@ import { Buffer } from 'node:buffer';
|
|
|
8
8
|
import { klona } from 'klona';
|
|
9
9
|
import { createStorage as createStorage$1, builtinDrivers, prefixStorage } from 'unstorage';
|
|
10
10
|
import { isDevelopment } from 'std-env';
|
|
11
|
+
import { toJsonSchema } from '@standard-community/standard-json';
|
|
11
12
|
import { FastURL, FastResponse } from 'srvx';
|
|
12
13
|
export { s as silgiCLICtx, t as tryUseSilgiCLI, u as useSilgiCLI } from '../_chunks/silgiApp.mjs';
|
|
13
14
|
import { AsyncLocalStorage } from 'node:async_hooks';
|
|
@@ -298,29 +299,37 @@ async function createSilgi(config) {
|
|
|
298
299
|
silgi.router = createRouter();
|
|
299
300
|
}
|
|
300
301
|
for (const [route, object] of Object.entries(silgi.services)) {
|
|
301
|
-
const
|
|
302
|
-
if (
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
service: object
|
|
307
|
-
});
|
|
308
|
-
continue;
|
|
309
|
-
} else {
|
|
310
|
-
const routeParts = route.split("/").filter(Boolean);
|
|
311
|
-
if (routeParts.length > 0) {
|
|
312
|
-
const prefix = `/${routeParts[0]}`;
|
|
313
|
-
if (!silgi.routerPrefixs.includes(prefix)) {
|
|
314
|
-
silgi.routerPrefixs.push(prefix);
|
|
315
|
-
}
|
|
302
|
+
const routeParts = route.split("/").filter(Boolean);
|
|
303
|
+
if (routeParts.length > 0) {
|
|
304
|
+
const prefix = `/${routeParts[0]}`;
|
|
305
|
+
if (!silgi.routerPrefixs.includes(prefix)) {
|
|
306
|
+
silgi.routerPrefixs.push(prefix);
|
|
316
307
|
}
|
|
317
308
|
}
|
|
318
|
-
for (const method of
|
|
319
|
-
|
|
320
|
-
|
|
309
|
+
for (const [method, routeObject] of Object.entries(object)) {
|
|
310
|
+
let routeWithParams = route;
|
|
311
|
+
if (routeObject.pathParams) {
|
|
312
|
+
const jsonSchema = await toJsonSchema(routeObject.pathParams);
|
|
313
|
+
if (jsonSchema && jsonSchema.properties) {
|
|
314
|
+
const paramNames = Object.keys(jsonSchema.properties);
|
|
315
|
+
if (paramNames.length > 0) {
|
|
316
|
+
const routeParts2 = routeWithParams.split("/");
|
|
317
|
+
const lastParts = routeParts2.slice(-paramNames.length);
|
|
318
|
+
const alreadyHasParams = paramNames.every((name, idx) => lastParts[idx] === `:${name}`);
|
|
319
|
+
if (!alreadyHasParams) {
|
|
320
|
+
routeWithParams = routeWithParams.replace(/\/+$/, "");
|
|
321
|
+
for (const param of paramNames) {
|
|
322
|
+
routeWithParams += `/:${param}`;
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
console.log("Route:", routeWithParams, method);
|
|
329
|
+
addRoute(silgi.router, method, routeWithParams, {
|
|
321
330
|
method,
|
|
322
|
-
route,
|
|
323
|
-
service:
|
|
331
|
+
route: routeWithParams,
|
|
332
|
+
service: routeObject
|
|
324
333
|
});
|
|
325
334
|
}
|
|
326
335
|
}
|
|
@@ -391,12 +400,16 @@ class _SilgiEvent {
|
|
|
391
400
|
req;
|
|
392
401
|
url;
|
|
393
402
|
context;
|
|
403
|
+
protocol;
|
|
404
|
+
// Added property
|
|
394
405
|
_res;
|
|
395
406
|
constructor(req, context) {
|
|
396
407
|
this.context = context || new EmptyObject();
|
|
397
408
|
this.req = req;
|
|
398
409
|
const _url = req._url;
|
|
399
410
|
this.url = _url && _url instanceof URL ? _url : new FastURL(req.url);
|
|
411
|
+
let proto = this.url.protocol.replace(":", "");
|
|
412
|
+
this.protocol = proto === "https" ? "http" : proto;
|
|
400
413
|
}
|
|
401
414
|
get res() {
|
|
402
415
|
if (!this._res) {
|
|
@@ -607,7 +620,7 @@ async function orchestrate(route, event, _input) {
|
|
|
607
620
|
pathParams: {},
|
|
608
621
|
queryParams: {}
|
|
609
622
|
};
|
|
610
|
-
const input = _input || (route.service?.
|
|
623
|
+
const input = _input || (route.service?.rules?.readBeforeBody === false || isGraphQL ? {} : await parseRequestInput(event.req));
|
|
611
624
|
const hookContext = { earlyReturnValue: false };
|
|
612
625
|
const routerParams = _input ? input.path : getRouterParams(event);
|
|
613
626
|
const queryParams = _input ? input.query : getQuery(event);
|
|
@@ -619,10 +632,8 @@ async function orchestrate(route, event, _input) {
|
|
|
619
632
|
}
|
|
620
633
|
const inputData = {
|
|
621
634
|
args: input,
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
path: routerParams
|
|
625
|
-
}
|
|
635
|
+
query: queryParams,
|
|
636
|
+
path: routerParams
|
|
626
637
|
};
|
|
627
638
|
try {
|
|
628
639
|
if (!route.service && route.method !== "GRAPHQL") {
|
|
@@ -660,10 +671,17 @@ async function orchestrate(route, event, _input) {
|
|
|
660
671
|
}
|
|
661
672
|
silgiCtx.shared.$fetch = silgiFetch;
|
|
662
673
|
silgiCtx.shared.silgi = silgiCtx;
|
|
663
|
-
const result = await route.service?.
|
|
674
|
+
const result = await route.service?.handler?.(
|
|
675
|
+
// input
|
|
664
676
|
inputData,
|
|
677
|
+
// shared
|
|
665
678
|
silgiCtx.shared,
|
|
666
|
-
event
|
|
679
|
+
// event
|
|
680
|
+
event,
|
|
681
|
+
// parent - graphql
|
|
682
|
+
{},
|
|
683
|
+
// info - graphql
|
|
684
|
+
{}
|
|
667
685
|
);
|
|
668
686
|
await silgiCtx.callHook("fetch:after", {
|
|
669
687
|
event,
|
|
@@ -674,12 +692,12 @@ async function orchestrate(route, event, _input) {
|
|
|
674
692
|
route,
|
|
675
693
|
hookContext
|
|
676
694
|
});
|
|
677
|
-
if (route.service?.
|
|
678
|
-
await useSilgiStorage(route.service.
|
|
695
|
+
if (route.service?.storage && cacheData?.cachedKey) {
|
|
696
|
+
await useSilgiStorage(route.service.storage.base).setItem(
|
|
679
697
|
cacheData.cachedKey,
|
|
680
698
|
result,
|
|
681
699
|
// Cast to StorageValue if needed
|
|
682
|
-
route.service.
|
|
700
|
+
route.service.storage.options
|
|
683
701
|
);
|
|
684
702
|
}
|
|
685
703
|
return result;
|
|
@@ -709,17 +727,17 @@ async function orchestrate(route, event, _input) {
|
|
|
709
727
|
}
|
|
710
728
|
}
|
|
711
729
|
async function cacheExecute(input, route, silgiURL, event) {
|
|
712
|
-
if (!route.service || !route.service.
|
|
730
|
+
if (!route.service || !route.service.storage)
|
|
713
731
|
return;
|
|
714
|
-
const cacheKey = route.service.
|
|
732
|
+
const cacheKey = route.service.storage ? await generateStorageKey({
|
|
715
733
|
url: silgiURL,
|
|
716
734
|
input,
|
|
717
|
-
keyGenerator: route.service.
|
|
718
|
-
storageOptions: route.service.
|
|
735
|
+
keyGenerator: route.service.storage.key,
|
|
736
|
+
storageOptions: route.service.storage,
|
|
719
737
|
requestId: event?.requestId
|
|
720
738
|
}) : null;
|
|
721
739
|
if (cacheKey) {
|
|
722
|
-
const cachedResult = await useSilgiStorage(route.service.
|
|
740
|
+
const cachedResult = await useSilgiStorage(route.service.storage.base).getItem(cacheKey);
|
|
723
741
|
if (cachedResult !== null) {
|
|
724
742
|
return {
|
|
725
743
|
success: true,
|
|
@@ -941,7 +959,7 @@ async function middleware(event, url) {
|
|
|
941
959
|
return _previous;
|
|
942
960
|
}
|
|
943
961
|
const allowedMethod = m.method ?? "";
|
|
944
|
-
const methodIsAllowed = allowedMethod ===
|
|
962
|
+
const methodIsAllowed = allowedMethod === event.req.method || event.protocol === "GRAPHQL";
|
|
945
963
|
if (!methodIsAllowed) {
|
|
946
964
|
return;
|
|
947
965
|
}
|
|
@@ -976,7 +994,7 @@ async function middleware(event, url) {
|
|
|
976
994
|
return _previous;
|
|
977
995
|
}
|
|
978
996
|
const allowedMethod = match.data.method ?? "";
|
|
979
|
-
const methodIsAllowed = allowedMethod ===
|
|
997
|
+
const methodIsAllowed = allowedMethod === event.req.method || event.protocol === "GRAPHQL";
|
|
980
998
|
if (!methodIsAllowed || !match.data.middleware) {
|
|
981
999
|
return;
|
|
982
1000
|
}
|
|
@@ -1016,10 +1034,7 @@ async function handler(event, url, input) {
|
|
|
1016
1034
|
data: {
|
|
1017
1035
|
method: url?.method || event.req.method,
|
|
1018
1036
|
route: url?.path,
|
|
1019
|
-
service: {
|
|
1020
|
-
setup: {},
|
|
1021
|
-
methods: ["GRAPHQL"]
|
|
1022
|
-
}
|
|
1037
|
+
service: {}
|
|
1023
1038
|
},
|
|
1024
1039
|
params: {}
|
|
1025
1040
|
};
|
|
@@ -1097,16 +1112,12 @@ function createService(params) {
|
|
|
1097
1112
|
`Path '${params.path}' is invalid: maximum 4 '/' allowed (found ${slashCount})`
|
|
1098
1113
|
);
|
|
1099
1114
|
}
|
|
1100
|
-
const
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
input,
|
|
1106
|
-
output,
|
|
1107
|
-
queryParams
|
|
1115
|
+
const { path, ...objects } = params;
|
|
1116
|
+
return {
|
|
1117
|
+
[path]: {
|
|
1118
|
+
...objects
|
|
1119
|
+
}
|
|
1108
1120
|
};
|
|
1109
|
-
return result;
|
|
1110
1121
|
}
|
|
1111
1122
|
|
|
1112
1123
|
function createMiddleware(params) {
|
package/dist/index.mjs
CHANGED
package/dist/types/index.d.mts
CHANGED
|
@@ -25,6 +25,7 @@ import { ServerRequest } from 'srvx';
|
|
|
25
25
|
import { Defu } from 'defu';
|
|
26
26
|
import { silgiFetch } from 'silgi';
|
|
27
27
|
import { useRuntimeConfig } from 'silgi/runtime';
|
|
28
|
+
import { GraphQLResolveInfo } from 'graphql';
|
|
28
29
|
import { Unimport } from 'unimport';
|
|
29
30
|
import { ProviderName } from 'std-env';
|
|
30
31
|
import { FetchOptions, FetchResponse } from 'ofetch';
|
|
@@ -99,10 +100,15 @@ interface SilgiRuntimeContext extends Record<string, any> {
|
|
|
99
100
|
runtimeConfig?: SilgiRuntimeConfig;
|
|
100
101
|
};
|
|
101
102
|
}
|
|
103
|
+
type EventProtocol = 'GRAPHQL' | 'HTTP' | 'WEBSOCKET';
|
|
102
104
|
/**
|
|
103
105
|
* Bu nitrojs, h3 event or request context.
|
|
104
106
|
*/
|
|
105
107
|
interface SilgiEvent extends Record<string, unknown> {
|
|
108
|
+
/**
|
|
109
|
+
* Protocol Type
|
|
110
|
+
*/
|
|
111
|
+
readonly protocol: EventProtocol;
|
|
106
112
|
/**
|
|
107
113
|
* Event context.
|
|
108
114
|
*/
|
|
@@ -243,20 +249,14 @@ type ServiceHandlerInput<Input extends StandardSchemaV1 = StandardSchemaV1, Path
|
|
|
243
249
|
args: InferInput<Input>;
|
|
244
250
|
} : HasPath<PathParams> extends true ? HasQuery<QueryParams> extends true ? {
|
|
245
251
|
args: InferInput<Input>;
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
query: Partial<InferInput<QueryParams>>;
|
|
249
|
-
};
|
|
252
|
+
path: InferInput<PathParams>;
|
|
253
|
+
query: Partial<InferInput<QueryParams>>;
|
|
250
254
|
} : {
|
|
251
255
|
args: InferInput<Input>;
|
|
252
|
-
|
|
253
|
-
path: InferInput<PathParams>;
|
|
254
|
-
};
|
|
256
|
+
path: InferInput<PathParams>;
|
|
255
257
|
} : HasQuery<QueryParams> extends true ? {
|
|
256
258
|
args: InferInput<Input>;
|
|
257
|
-
|
|
258
|
-
query: InferInput<QueryParams>;
|
|
259
|
-
};
|
|
259
|
+
query: InferInput<QueryParams>;
|
|
260
260
|
} : {
|
|
261
261
|
args: InferInput<Input>;
|
|
262
262
|
};
|
|
@@ -266,15 +266,19 @@ type ServiceHandlerInput<Input extends StandardSchemaV1 = StandardSchemaV1, Path
|
|
|
266
266
|
* Resolved = false -> handler(input, shared, event, source) // all required
|
|
267
267
|
* Resolved = true -> handler(input, shared?, event?, source?) // only input required
|
|
268
268
|
*/
|
|
269
|
-
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>;
|
|
269
|
+
type ServiceHandler<Parent extends StandardSchemaV1, 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, parent?: Parent, info?: GraphQLResolveInfo) => Promise<InferOutput<Output>> | InferOutput<Output> : (input: ServiceHandlerInput<Input, PathParams, QueryParams, HiddenParameters>, shared: SilgiRuntimeShareds, event: SilgiEvent, parent: Parent, info: GraphQLResolveInfo) => Promise<InferOutput<Output>> | InferOutput<Output>;
|
|
270
270
|
/**
|
|
271
271
|
* Servis setup tipi
|
|
272
272
|
*/
|
|
273
|
-
interface ServiceSetup<Input extends StandardSchemaV1 = StandardSchemaV1, Output extends StandardSchemaV1 = StandardSchemaV1, PathParams extends StandardSchemaV1 |
|
|
274
|
-
handler?: ServiceHandler<Input, Output, PathParams, QueryParams, Resolved, HiddenParameters>;
|
|
273
|
+
interface ServiceSetup<Parent extends StandardSchemaV1, Input extends StandardSchemaV1 = StandardSchemaV1, Output extends StandardSchemaV1 = StandardSchemaV1, PathParams extends StandardSchemaV1 | undefined | never = undefined, QueryParams extends StandardSchemaV1 | undefined | never = undefined, Resolved extends boolean = false, HiddenParameters extends boolean = false> {
|
|
274
|
+
handler?: ServiceHandler<Parent, Input, Output, PathParams, QueryParams, Resolved, HiddenParameters>;
|
|
275
275
|
rules?: MergeRouteRules;
|
|
276
276
|
modules?: Partial<SetupModuleOption>;
|
|
277
277
|
storage?: StorageConfig<ServiceHandlerInput<Input, PathParams, QueryParams, HiddenParameters>>;
|
|
278
|
+
input?: Input;
|
|
279
|
+
output?: Output;
|
|
280
|
+
pathParams?: PathParams;
|
|
281
|
+
queryParams?: QueryParams;
|
|
278
282
|
}
|
|
279
283
|
/**
|
|
280
284
|
* Represents a fully resolved service definition that maps route paths
|
|
@@ -287,14 +291,15 @@ interface ServiceSetup<Input extends StandardSchemaV1 = StandardSchemaV1, Output
|
|
|
287
291
|
*/
|
|
288
292
|
interface ResolvedServiceDefinition {
|
|
289
293
|
[routePath: string]: {
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
294
|
+
GET?: ServiceSetup<any, any, any, any, any, any>;
|
|
295
|
+
POST?: ServiceSetup<any, any, any, any, any, any>;
|
|
296
|
+
PUT?: ServiceSetup<any, any, any, any, any, any>;
|
|
297
|
+
PATCH?: ServiceSetup<any, any, any, any, any, any>;
|
|
298
|
+
DELETE?: ServiceSetup<any, any, any, any, any, any>;
|
|
299
|
+
OPTIONS?: ServiceSetup<any, any, any, any, any, any>;
|
|
300
|
+
HEAD?: ServiceSetup<any, any, any, any, any, any>;
|
|
301
|
+
CONNECT?: ServiceSetup<any, any, any, any, any, any>;
|
|
302
|
+
TRACE?: ServiceSetup<any, any, any, any, any, any>;
|
|
298
303
|
};
|
|
299
304
|
}
|
|
300
305
|
/**
|
|
@@ -693,14 +698,14 @@ interface ResolvedSchemaDefinition {
|
|
|
693
698
|
[methodAndRoutePath: string]: BaseMethodSchema;
|
|
694
699
|
}
|
|
695
700
|
|
|
696
|
-
type StandardHTTPMethod = 'GET' | 'HEAD' | 'PATCH' | 'POST' | 'PUT' | 'DELETE' | 'CONNECT' | 'OPTIONS' | 'TRACE'
|
|
701
|
+
type StandardHTTPMethod = 'GET' | 'HEAD' | 'PATCH' | 'POST' | 'PUT' | 'DELETE' | 'CONNECT' | 'OPTIONS' | 'TRACE';
|
|
697
702
|
type HTTPMethod = StandardHTTPMethod | (keyof SilgiRuntimeMethods extends string ? keyof SilgiRuntimeMethods : never);
|
|
698
703
|
interface MetaData extends Record<string, unknown> {
|
|
699
704
|
}
|
|
700
705
|
interface SilgiRoute {
|
|
701
706
|
route?: string;
|
|
702
707
|
method?: HTTPMethod;
|
|
703
|
-
service?: ResolvedServiceDefinition[string];
|
|
708
|
+
service?: ResolvedServiceDefinition[string][keyof ResolvedServiceDefinition[string]];
|
|
704
709
|
middleware?: MiddlewareSetup;
|
|
705
710
|
}
|
|
706
711
|
interface Silgi {
|
|
@@ -1224,4 +1229,4 @@ interface LoadConfigOptions {
|
|
|
1224
1229
|
consola?: ConsolaInstance;
|
|
1225
1230
|
}
|
|
1226
1231
|
|
|
1227
|
-
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, LoadConfigOptions, MergeAll, MergeRouteRules, MergedSilgiSchema, MetaData, MethodSchemas, MiddlewareHandler, MiddlewareSetup, ModuleDefinition, ModuleHookContext, ModuleMeta, ModuleOptionsCustom, ModuleSetupInstallResult, ModuleSetupReturn, NamespacesForPrefix, NitroBuildInfo, RequiredServiceType, ResolvedMiddlewareDefinition, ResolvedModuleMeta, ResolvedModuleOptions, ResolvedSchema, ResolvedSchemaDefinition, ResolvedServiceDefinition, ResolvedSilgiTemplate, Resolvers, RouteEntry, RouteRules, RouterParams, Routers, RoutesForPrefixAndNamespace, ScanFile, Schema, ServiceHandler, ServiceHandlerInput, ServiceSetup, ServicesObject, 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 };
|
|
1232
|
+
export type { AllPaths, AllPrefixes, AppConfig, Awaitable, BaseMethodSchema, BuildSilgi, CaptureError, CapturedErrorContext, CommandType, Commands, CustomRequestInit, DeepPartial, DeepRequired, DefaultHooks, DefineFrameworkOptions, DotenvOptions, EnvOptions, EventHandlerResponse, EventProtocol, ExtendContext, ExtendShared, ExtractNamespace, ExtractPathParamKeys, ExtractPathParams, ExtractPrefix, ExtractRoute, GenImport, GenerateAppOptions, HTTPMethod, HasPathParams, HookResult, LoadConfigOptions, MergeAll, MergeRouteRules, MergedSilgiSchema, MetaData, MethodSchemas, MiddlewareHandler, MiddlewareSetup, ModuleDefinition, ModuleHookContext, ModuleMeta, ModuleOptionsCustom, ModuleSetupInstallResult, ModuleSetupReturn, NamespacesForPrefix, NitroBuildInfo, RequiredServiceType, ResolvedMiddlewareDefinition, ResolvedModuleMeta, ResolvedModuleOptions, ResolvedSchema, ResolvedSchemaDefinition, ResolvedServiceDefinition, ResolvedSilgiTemplate, Resolvers, RouteEntry, RouteRules, RouterParams, Routers, RoutesForPrefixAndNamespace, ScanFile, Schema, ServiceHandler, ServiceHandlerInput, ServiceSetup, ServicesObject, 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.41.
|
|
4
|
+
"version": "0.41.19",
|
|
5
5
|
"private": false,
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"exports": {
|
|
@@ -114,6 +114,7 @@
|
|
|
114
114
|
"dotenv": "^16.5.0",
|
|
115
115
|
"escape-string-regexp": "^5.0.0",
|
|
116
116
|
"exsolve": "^1.0.5",
|
|
117
|
+
"graphql": "^16.11.0",
|
|
117
118
|
"hookable": "^5.5.3",
|
|
118
119
|
"ignore": "^7.0.4",
|
|
119
120
|
"klona": "^2.0.6",
|