silgi 0.41.29 → 0.41.31

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.
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import { defineCommand, runMain } from 'citty';
3
3
 
4
- const version = "0.41.29";
4
+ const version = "0.41.31";
5
5
  const packageJson = {
6
6
  version: version};
7
7
 
@@ -1,4 +1,5 @@
1
1
  import { SilgiConfig, Silgi, SilgiEvent, HTTPMethod, SilgiSchema, RouteEntry, CustomRequestInit, SilgiRuntimeContext, BaseMethodSchema, MergeAll, ServiceSetupsForMethods, ServiceDefinitionByMethodAndPath, Routers, ServiceSetup, MiddlewareSetup, SilgiRuntimeShareds, Resolvers, SilgiURL, StorageConfig, SilgiCLI, SilgiStorageBase, SilgiRuntimeConfig } from 'silgi/types';
2
+ import { GraphQLResolveInfo } from 'graphql';
2
3
  import { StandardSchemaV1 } from '@standard-schema/spec';
3
4
  import { Storage, StorageValue } from 'unstorage';
4
5
  import { UseContext } from 'unctx';
@@ -26,7 +27,7 @@ declare function middleware(event: SilgiEvent, url?: {
26
27
  declare function handler(event: SilgiEvent, url?: {
27
28
  path?: string;
28
29
  method?: HTTPMethod | '';
29
- }, input?: any): Promise<any>;
30
+ }, input?: any, parent?: any, info?: GraphQLResolveInfo): Promise<any>;
30
31
 
31
32
  /**
32
33
  * LICENSE: MIT
@@ -643,7 +643,7 @@ function getUrlPrefix(path, method) {
643
643
  };
644
644
  }
645
645
 
646
- async function orchestrate(route, event, _input) {
646
+ async function orchestrate(route, event, _input, parent, info) {
647
647
  const silgiCtx = useSilgi();
648
648
  const isGraphQL = event.context.protocol === "GRAPHQL";
649
649
  const silgiURL = !isGraphQL ? getUrlPrefix(route.route || event.req.url, route.method) : {
@@ -714,9 +714,9 @@ async function orchestrate(route, event, _input) {
714
714
  // event
715
715
  event,
716
716
  // parent - graphql
717
- void 0,
717
+ parent,
718
718
  // info - graphql
719
- {}
719
+ info
720
720
  );
721
721
  await silgiCtx.callHook("fetch:after", {
722
722
  event,
@@ -1055,7 +1055,7 @@ async function middleware(event, url) {
1055
1055
  }
1056
1056
  return _chain;
1057
1057
  }
1058
- async function handler(event, url, input) {
1058
+ async function handler(event, url, input, parent, info) {
1059
1059
  url ??= {};
1060
1060
  url.method = event.context.protocol === "GRAPHQL" ? "" : url.method || event.req.method;
1061
1061
  const silgiCtx = useSilgi();
@@ -1104,12 +1104,12 @@ async function handler(event, url, input) {
1104
1104
  }
1105
1105
  event.context.params = match.params;
1106
1106
  event.context.matchedRoute = match.data;
1107
- return orchestrate(match.data, event, input);
1107
+ return orchestrate(match.data, event, input, parent, info);
1108
1108
  });
1109
1109
  } else {
1110
1110
  event.context.params = match.params;
1111
1111
  event.context.matchedRoute = match.data;
1112
- return orchestrate(match.data, event, input);
1112
+ return orchestrate(match.data, event, input, parent, info);
1113
1113
  }
1114
1114
  }
1115
1115
  }
package/dist/index.d.mts CHANGED
@@ -1,5 +1,6 @@
1
1
  export { SilgiError, autoImportTypes, createError, createMiddleware, createResolver, createSchema, createService, createShared, createSilgi, createStorage, deepMergeObjects, defineServiceSetup, getEvent, getEventContext, getUrlPrefix, handleResponse, handler, isError, kHandled, kNotFound, middleware, replaceRuntimeValues, silgiCLICtx, silgiCtx, silgiFetch, storageMount, tryUseSilgi, tryUseSilgiCLI, updateRuntimeStorage, useRuntime, useSilgi, useSilgiCLI, useSilgiStorage } from './core/index.mjs';
2
2
  import 'silgi/types';
3
+ import 'graphql';
3
4
  import '@standard-schema/spec';
4
5
  import 'unstorage';
5
6
  import 'unctx';
@@ -263,7 +263,7 @@ type ServiceHandlerInput<Input extends StandardSchemaV1 = StandardSchemaV1, Path
263
263
  * Resolved = false -> handler(input, shared, event, source) // all required
264
264
  * Resolved = true -> handler(input, shared?, event?, source?) // only input required
265
265
  */
266
- 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>;
266
+ 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>;
267
267
  /**
268
268
  * Servis setup tipi
269
269
  */
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "silgi",
3
3
  "type": "module",
4
- "version": "0.41.29",
4
+ "version": "0.41.31",
5
5
  "private": false,
6
6
  "sideEffects": false,
7
7
  "exports": {