silgi 0.7.13 → 0.7.16

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,4 +1,4 @@
1
- const version = "0.7.13";
1
+ const version = "0.7.16";
2
2
  const packageJson = {
3
3
  version: version};
4
4
 
@@ -1,5 +1,5 @@
1
1
  import { SilgiConfig, Silgi, SilgiOperation, MergedSilgiSchema, ServiceType, SilgiSchema, RequiredServiceType, ModuleRuntimeShared, SilgiEvents, DefaultNamespaces, BaseSchemaType, SilgiCLI } from 'silgi/types';
2
- export { c as createStorage, s as silgi, u as useSilgiStorage } from '../shared/silgi.BuspmWeq.mjs';
2
+ export { c as createStorage, s as silgi, u as useSilgiStorage } from '../shared/silgi.sABAerQU.mjs';
3
3
  import { StandardSchemaV1 } from '@standard-schema/spec';
4
4
  import * as unctx from 'unctx';
5
5
  import 'unstorage';
@@ -1,5 +1,5 @@
1
1
  import { SilgiConfig, Silgi, SilgiOperation, MergedSilgiSchema, ServiceType, SilgiSchema, RequiredServiceType, ModuleRuntimeShared, SilgiEvents, DefaultNamespaces, BaseSchemaType, SilgiCLI } from 'silgi/types';
2
- export { c as createStorage, s as silgi, u as useSilgiStorage } from '../shared/silgi.BuspmWeq.js';
2
+ export { c as createStorage, s as silgi, u as useSilgiStorage } from '../shared/silgi.sABAerQU.js';
3
3
  import { StandardSchemaV1 } from '@standard-schema/spec';
4
4
  import * as unctx from 'unctx';
5
5
  import 'unstorage';
@@ -601,12 +601,12 @@ async function createSilgi(config) {
601
601
 
602
602
  function silgi(event) {
603
603
  return {
604
- execute: (uriString, input) => {
605
- return execute(uriString, input, event);
604
+ execute: (uriString, input, source) => {
605
+ return execute(uriString, input, event, source);
606
606
  }
607
607
  };
608
608
  }
609
- async function execute(uriString, input, event) {
609
+ async function execute(uriString, input, event, source) {
610
610
  const silgiCtx = useSilgi();
611
611
  if (event) {
612
612
  await silgiCtx.callHook("event:before", event);
@@ -634,7 +634,8 @@ async function execute(uriString, input, event) {
634
634
  input,
635
635
  event,
636
636
  modules: handler.modules,
637
- result
637
+ result,
638
+ source
638
639
  });
639
640
  const cacheData = await cacheExecute(input, operation, handler, event);
640
641
  if (cacheData?.success) {
@@ -647,7 +648,13 @@ async function execute(uriString, input, event) {
647
648
  query: operation.query
648
649
  };
649
650
  silgiCtx.shared.silgi = (_event) => silgi(_event || event);
650
- result = await handler?.handler(router, input, silgiCtx.shared, event);
651
+ result = await handler?.handler(
652
+ router,
653
+ input,
654
+ silgiCtx.shared,
655
+ event,
656
+ source
657
+ );
651
658
  success = true;
652
659
  }
653
660
  await silgiCtx.callHook("action:after", {
@@ -656,6 +663,7 @@ async function execute(uriString, input, event) {
656
663
  event,
657
664
  result,
658
665
  success,
666
+ source,
659
667
  modules: handler.modules
660
668
  });
661
669
  if (!cached) {
@@ -668,6 +676,7 @@ async function execute(uriString, input, event) {
668
676
  await silgiCtx.callHook("action:error", {
669
677
  input,
670
678
  event,
679
+ source,
671
680
  error: err instanceof Error ? err : new Error(String(err)),
672
681
  timestamp: Date.now()
673
682
  });
@@ -1,3 +1,3 @@
1
- const version = "0.7.13";
1
+ const version = "0.7.16";
2
2
 
3
3
  export { version };
@@ -1,3 +1,3 @@
1
- const version = "0.7.13";
1
+ const version = "0.7.16";
2
2
 
3
3
  export { version };
@@ -1,8 +1,8 @@
1
- import { SilgiEvents, SilgiURIs, ExtractInputFromURI, ExtractOutputFromURI, Silgi, StorageConfig } from 'silgi/types';
1
+ import { SilgiEvents, SilgiURIs, ExtractInputFromURI, ExtractSourceFromURI, ExtractOutputFromURI, Silgi, StorageConfig } from 'silgi/types';
2
2
  import { Storage, StorageValue } from 'unstorage';
3
3
 
4
4
  declare function silgi(event?: SilgiEvents | Record<string, any>): {
5
- execute: <TURI extends keyof SilgiURIs>(uriString: TURI, input: ExtractInputFromURI<TURI>) => Promise<ExtractOutputFromURI<TURI>>;
5
+ execute: <TURI extends keyof SilgiURIs>(uriString: TURI, input: ExtractInputFromURI<TURI>, source?: ExtractSourceFromURI<TURI>) => Promise<ExtractOutputFromURI<TURI>>;
6
6
  };
7
7
 
8
8
  declare function createStorage(silgi: Silgi): Promise<Storage<StorageValue>>;
@@ -1,8 +1,8 @@
1
- import { SilgiEvents, SilgiURIs, ExtractInputFromURI, ExtractOutputFromURI, Silgi, StorageConfig } from 'silgi/types';
1
+ import { SilgiEvents, SilgiURIs, ExtractInputFromURI, ExtractSourceFromURI, ExtractOutputFromURI, Silgi, StorageConfig } from 'silgi/types';
2
2
  import { Storage, StorageValue } from 'unstorage';
3
3
 
4
4
  declare function silgi(event?: SilgiEvents | Record<string, any>): {
5
- execute: <TURI extends keyof SilgiURIs>(uriString: TURI, input: ExtractInputFromURI<TURI>) => Promise<ExtractOutputFromURI<TURI>>;
5
+ execute: <TURI extends keyof SilgiURIs>(uriString: TURI, input: ExtractInputFromURI<TURI>, source?: ExtractSourceFromURI<TURI>) => Promise<ExtractOutputFromURI<TURI>>;
6
6
  };
7
7
 
8
8
  declare function createStorage(silgi: Silgi): Promise<Storage<StorageValue>>;
@@ -6,14 +6,14 @@ import { Hookable, NestedHooks } from 'hookable';
6
6
  import { Ignore, Options } from 'ignore';
7
7
  import { TSConfig } from 'pkg-types';
8
8
  import { PresetName, PresetOptions, PresetNameInput } from 'silgi/presets';
9
- import { ResolvedServiceType as ResolvedServiceType$1, SilgiShareds as SilgiShareds$1, SilgiOptions as SilgiOptions$1, ModuleMeta as ModuleMeta$1, SilgiCLIHooks as SilgiCLIHooks$1, StorageMounts as StorageMounts$1, SilgiTemplate as SilgiTemplate$1, SilgiFrameworkInfo as SilgiFrameworkInfo$1 } from 'silgi/types';
9
+ import { ResolvedServiceType as ResolvedServiceType$1, SilgiShareds as SilgiShareds$1, SilgiRuntimeOptions as SilgiRuntimeOptions$1, ModuleMeta as ModuleMeta$1, SilgiCLIHooks as SilgiCLIHooks$1, StorageMounts as StorageMounts$1, SilgiTemplate as SilgiTemplate$1, SilgiFrameworkInfo as SilgiFrameworkInfo$1 } from 'silgi/types';
10
10
  import { UnimportPluginOptions } from 'unimport/unplugin';
11
11
  import { StandardSchemaV1 } from '@standard-schema/spec';
12
12
  import { Defu } from 'defu';
13
13
  import { Unimport } from 'unimport';
14
14
  import { Storage, BuiltinDriverName, TransactionOptions } from 'unstorage';
15
15
  import { ProviderName } from 'std-env';
16
- import { u as useSilgiStorage, s as silgi } from '../shared/silgi.BuspmWeq.mjs';
16
+ import { u as useSilgiStorage, s as silgi } from '../shared/silgi.sABAerQU.mjs';
17
17
 
18
18
  type HookResult = Promise<void> | void;
19
19
 
@@ -56,6 +56,14 @@ type GetOutput<T extends {
56
56
  }> = T['service'] extends keyof SilgiSchema ? T['entity'] extends keyof SilgiSchema[T['service']] ? T['method'] extends keyof SilgiSchema[T['service']][T['entity']] ? T['action'] extends keyof SilgiSchema[T['service']][T['entity']][T['method']] ? SilgiSchema[T['service']][T['entity']][T['method']][T['action']] extends {
57
57
  output: infer O;
58
58
  } ? O extends StandardSchemaV1 ? StandardSchemaV1.InferOutput<O> : never : never : never : never : never : never;
59
+ type GetSource<T extends {
60
+ service: string;
61
+ entity: string;
62
+ method: string;
63
+ action: string;
64
+ }> = T['service'] extends keyof SilgiSchema ? T['entity'] extends keyof SilgiSchema[T['service']] ? T['method'] extends keyof SilgiSchema[T['service']][T['entity']] ? T['action'] extends keyof SilgiSchema[T['service']][T['entity']][T['method']] ? SilgiSchema[T['service']][T['entity']][T['method']][T['action']] extends {
65
+ source: infer I;
66
+ } ? I : never : never : never : never : never;
59
67
  type GetRouterParams<T extends {
60
68
  service: string;
61
69
  entity: string;
@@ -65,6 +73,7 @@ type GetRouterParams<T extends {
65
73
  router: infer I;
66
74
  } ? I extends StandardSchemaV1 ? StandardSchemaV1.InferInput<I> : never : never : never : never : never : never;
67
75
  type ExtractInputFromURI<TURI extends keyof SilgiURIs> = GetInput<ExtractPath<TURI>>;
76
+ type ExtractSourceFromURI<TURI extends keyof SilgiURIs> = GetSource<ExtractPath<TURI>>;
68
77
  type ExtractOutputFromURI<TURI extends keyof SilgiURIs> = GetOutput<ExtractPath<TURI>>;
69
78
  type ExtractRouterParamsFromURI<TURI extends keyof SilgiURIs> = GetRouterParams<ExtractPath<TURI>>;
70
79
 
@@ -117,7 +126,7 @@ interface SilgiCLI {
117
126
  shareds: SilgiShareds$1;
118
127
  uris: Record<string, any>;
119
128
  schemas: Record<string, any>;
120
- modulesURIs: Partial<Record<keyof SilgiOptions$1, any>>;
129
+ modulesURIs: Partial<Record<keyof SilgiRuntimeOptions$1 | (string & {}), any>>;
121
130
  scannedURIs: Map<string, string>;
122
131
  templates: SilgiTemplate[];
123
132
  hooks: Hookable<SilgiCLIHooks>;
@@ -455,6 +464,7 @@ type ModuleHookContext = Readonly<{
455
464
  event?: SilgiEvents;
456
465
  operation?: SilgiOperation;
457
466
  input?: unknown;
467
+ source?: any;
458
468
  result?: unknown;
459
469
  modules?: SilgiRuntimeActions;
460
470
  timestamp?: number;
@@ -785,15 +795,6 @@ interface StorageKeyParams<TInput = unknown> {
785
795
  storageOptions?: Pick<StorageConfig<TInput>, 'base' | 'options' | 'scope'>;
786
796
  }
787
797
 
788
- interface MethodSchemaType<Input, Output> {
789
- default: {
790
- input?: Input;
791
- output: Output;
792
- };
793
- handler: (input: Input, shared: SilgiShareds, event: SilgiEvents) => Promise<Output>;
794
- modules?: Partial<SilgiRuntimeActions>;
795
- storage?: StorageConfig<Input>;
796
- }
797
798
  type EventHandlerResponse<T = undefined> = T extends undefined ? void : void | T | Promise<T>;
798
799
  type MethodHandlerType<T> = {
799
800
  [Action in keyof T]: T[Action] extends Record<string, any> ? {
@@ -801,8 +802,9 @@ type MethodHandlerType<T> = {
801
802
  default?: {
802
803
  input?: StandardSchemaV1.InferInput<T[Action][Method]['input']>;
803
804
  output?: StandardSchemaV1.InferInput<T[Action][Method]['output']>;
805
+ source?: StandardSchemaV1.InferInput<T[Action][Method]['source']>;
804
806
  };
805
- handler: (router: StandardSchemaV1.InferInput<T[Action][Method]['router']>, input: StandardSchemaV1.InferInput<T[Action][Method]['input']>, shared: SilgiShareds, event: SilgiEvents) => EventHandlerResponse<StandardSchemaV1.InferOutput<T[Action][Method]['output']>>;
807
+ handler: (router: StandardSchemaV1.InferInput<T[Action][Method]['router']>, input: StandardSchemaV1.InferInput<T[Action][Method]['input']>, shared: SilgiShareds, event: SilgiEvents, source: StandardSchemaV1.InferInput<T[Action][Method]['source']>) => EventHandlerResponse<StandardSchemaV1.InferOutput<T[Action][Method]['output']>>;
806
808
  modules?: Partial<SilgiRuntimeActions>;
807
809
  storage?: StorageConfig<T[Action][Method]['input']>;
808
810
  };
@@ -811,10 +813,10 @@ type MethodHandlerType<T> = {
811
813
  interface ResolvedMethodHandlerType {
812
814
  input?: Partial<BaseSchemaType<any>>;
813
815
  output: Partial<BaseSchemaType<any>>;
814
- handler: (router: StandardSchemaV1.InferInput<any>, input: StandardSchemaV1.InferInput<any>, shared: SilgiShareds, event: SilgiEvents) => Promise<StandardSchemaV1.InferInput<any>>;
816
+ handler: (router: StandardSchemaV1.InferInput<any>, input: StandardSchemaV1.InferInput<any>, shared: SilgiShareds, event: SilgiEvents, source: StandardSchemaV1.InferInput<any>) => Promise<StandardSchemaV1.InferInput<any>>;
815
817
  modules?: Partial<SilgiRuntimeActions>;
816
818
  storage?: StorageConfig<StandardSchemaV1.InferInput<any>>;
817
- execute: (input: StandardSchemaV1.InferInput<any>, shared: SilgiShareds, event: SilgiEvents) => Promise<StandardSchemaV1.InferInput<any>>;
819
+ execute: (input: StandardSchemaV1.InferInput<any>, shared: SilgiShareds, event: SilgiEvents, source: StandardSchemaV1.InferInput<any>) => Promise<StandardSchemaV1.InferInput<any>>;
818
820
  }
819
821
 
820
822
  type SilgiServiceInterface<T extends BaseSchemaType<StandardSchemaV1>> = {
@@ -828,7 +830,7 @@ type SilgiServiceInterface<T extends BaseSchemaType<StandardSchemaV1>> = {
828
830
  };
829
831
  type ServiceType<T> = Partial<{
830
832
  [Namespace in keyof T]: T[Namespace] extends Record<string, any> ? {
831
- [Service in keyof T[Namespace]]?: MethodHandlerType<T[Namespace][Service]>;
833
+ [Service in keyof T[Namespace]]?: Partial<MethodHandlerType<T[Namespace][Service]>>;
832
834
  } : never;
833
835
  }>;
834
836
  type RequiredServiceType<T> = {
@@ -866,7 +868,7 @@ interface Silgi {
866
868
  services: ResolvedServiceType;
867
869
  shared: SilgiShareds;
868
870
  uris: Record<string, any>;
869
- modulesURIs: Partial<Record<keyof SilgiOptions, any>>;
871
+ modulesURIs: Partial<Record<keyof SilgiRuntimeOptions | (string & {}), any>>;
870
872
  scannedHandlers: Map<string, ResolvedMethodHandlerType>;
871
873
  plugins: SilgiAppPlugin[];
872
874
  framework: FrameworkContext;
@@ -938,4 +940,4 @@ type Namespaces<T extends BaseNamespaceType> = {
938
940
 
939
941
  declare const autoImportTypes: string[];
940
942
 
941
- export { type AppConfig, type Awaitable, type BaseNamespaceType, type BaseSchemaType, type BaseSilgiMethodType, type BuildConfig, type CaptureError, type CapturedErrorContext, type CoreTs, type CreateScope, type DeepPartial, type DefaultHooks, type DefaultNamespaces, type EventHandlerResponse, type ExtendContext, type ExtendShared, type ExtractInputFromURI, type ExtractOutputFromURI, type ExtractRouterParamsFromURI, type FrameworkContext, type GenerateAppOptions, type GraphQLJSON, type HookResult, type ImportItem, type LoadConfigOptions, type MergedSilgiSchema, type MethodHandlerType, type MethodSchemaType, type ModuleDefinition, type ModuleHookContext, type ModuleMeta, type ModuleOptionsCustom, type ModuleRuntimeShared, type ModuleSetupInstallResult, type ModuleSetupReturn, type Namespaces, type NitroBuildInfo, type RequiredServiceType, type ResolvedMethodHandlerType, type ResolvedModuleMeta, type ResolvedModuleOptions, type ResolvedServiceType, type ResolvedSilgiTemplate, type SchemaPreparationOptions, type ServiceType, type Silgi, type SilgiAppPlugin, type SilgiCLI, type SilgiCLIConfig, type SilgiCLIDynamicConfig, type SilgiCLIHooks, type SilgiCLIOptions, type SilgiCompatibility, type SilgiCompatibilityIssue, type SilgiCompatibilityIssues, type SilgiConfig, type SilgiEvents, type SilgiFrameworkInfo, type SilgiFunction, type SilgiHooks, type SilgiModule, type SilgiModuleInput, type SilgiModuleOptions, type SilgiNamespaces, type SilgiOperation, type SilgiOptions, type SilgiPreset, type SilgiPresetMeta, type SilgiRouterTypes, type SilgiRuntimeActions, type SilgiRuntimeContext, type SilgiRuntimeHooks, type SilgiRuntimeMethods, type SilgiRuntimeOptions, type SilgiSchema, type SilgiServiceInterface, type SilgiShareds, type SilgiStorageBase, type SilgiTemplate, type SilgiURIs, type StorageConfig, type StorageKeyGenerator, type StorageKeyParams, type StorageMounts, type TSReference, type URIsTypes, autoImportTypes };
943
+ export { type AppConfig, type Awaitable, type BaseNamespaceType, type BaseSchemaType, type BaseSilgiMethodType, type BuildConfig, type CaptureError, type CapturedErrorContext, type CoreTs, type CreateScope, type DeepPartial, type DefaultHooks, type DefaultNamespaces, type EventHandlerResponse, type ExtendContext, type ExtendShared, type ExtractInputFromURI, type ExtractOutputFromURI, type ExtractRouterParamsFromURI, type ExtractSourceFromURI, type FrameworkContext, type GenerateAppOptions, type GraphQLJSON, type HookResult, type ImportItem, type LoadConfigOptions, type MergedSilgiSchema, type MethodHandlerType, type ModuleDefinition, type ModuleHookContext, type ModuleMeta, type ModuleOptionsCustom, type ModuleRuntimeShared, type ModuleSetupInstallResult, type ModuleSetupReturn, type Namespaces, type NitroBuildInfo, type RequiredServiceType, type ResolvedMethodHandlerType, type ResolvedModuleMeta, type ResolvedModuleOptions, type ResolvedServiceType, type ResolvedSilgiTemplate, type SchemaPreparationOptions, type ServiceType, type Silgi, type SilgiAppPlugin, type SilgiCLI, type SilgiCLIConfig, type SilgiCLIDynamicConfig, type SilgiCLIHooks, type SilgiCLIOptions, type SilgiCompatibility, type SilgiCompatibilityIssue, type SilgiCompatibilityIssues, type SilgiConfig, type SilgiEvents, type SilgiFrameworkInfo, type SilgiFunction, type SilgiHooks, type SilgiModule, type SilgiModuleInput, type SilgiModuleOptions, type SilgiNamespaces, type SilgiOperation, type SilgiOptions, type SilgiPreset, type SilgiPresetMeta, type SilgiRouterTypes, type SilgiRuntimeActions, type SilgiRuntimeContext, type SilgiRuntimeHooks, type SilgiRuntimeMethods, type SilgiRuntimeOptions, type SilgiSchema, type SilgiServiceInterface, type SilgiShareds, type SilgiStorageBase, type SilgiTemplate, type SilgiURIs, type StorageConfig, type StorageKeyGenerator, type StorageKeyParams, type StorageMounts, type TSReference, type URIsTypes, autoImportTypes };
@@ -6,14 +6,14 @@ import { Hookable, NestedHooks } from 'hookable';
6
6
  import { Ignore, Options } from 'ignore';
7
7
  import { TSConfig } from 'pkg-types';
8
8
  import { PresetName, PresetOptions, PresetNameInput } from 'silgi/presets';
9
- import { ResolvedServiceType as ResolvedServiceType$1, SilgiShareds as SilgiShareds$1, SilgiOptions as SilgiOptions$1, ModuleMeta as ModuleMeta$1, SilgiCLIHooks as SilgiCLIHooks$1, StorageMounts as StorageMounts$1, SilgiTemplate as SilgiTemplate$1, SilgiFrameworkInfo as SilgiFrameworkInfo$1 } from 'silgi/types';
9
+ import { ResolvedServiceType as ResolvedServiceType$1, SilgiShareds as SilgiShareds$1, SilgiRuntimeOptions as SilgiRuntimeOptions$1, ModuleMeta as ModuleMeta$1, SilgiCLIHooks as SilgiCLIHooks$1, StorageMounts as StorageMounts$1, SilgiTemplate as SilgiTemplate$1, SilgiFrameworkInfo as SilgiFrameworkInfo$1 } from 'silgi/types';
10
10
  import { UnimportPluginOptions } from 'unimport/unplugin';
11
11
  import { StandardSchemaV1 } from '@standard-schema/spec';
12
12
  import { Defu } from 'defu';
13
13
  import { Unimport } from 'unimport';
14
14
  import { Storage, BuiltinDriverName, TransactionOptions } from 'unstorage';
15
15
  import { ProviderName } from 'std-env';
16
- import { u as useSilgiStorage, s as silgi } from '../shared/silgi.BuspmWeq.js';
16
+ import { u as useSilgiStorage, s as silgi } from '../shared/silgi.sABAerQU.js';
17
17
 
18
18
  type HookResult = Promise<void> | void;
19
19
 
@@ -56,6 +56,14 @@ type GetOutput<T extends {
56
56
  }> = T['service'] extends keyof SilgiSchema ? T['entity'] extends keyof SilgiSchema[T['service']] ? T['method'] extends keyof SilgiSchema[T['service']][T['entity']] ? T['action'] extends keyof SilgiSchema[T['service']][T['entity']][T['method']] ? SilgiSchema[T['service']][T['entity']][T['method']][T['action']] extends {
57
57
  output: infer O;
58
58
  } ? O extends StandardSchemaV1 ? StandardSchemaV1.InferOutput<O> : never : never : never : never : never : never;
59
+ type GetSource<T extends {
60
+ service: string;
61
+ entity: string;
62
+ method: string;
63
+ action: string;
64
+ }> = T['service'] extends keyof SilgiSchema ? T['entity'] extends keyof SilgiSchema[T['service']] ? T['method'] extends keyof SilgiSchema[T['service']][T['entity']] ? T['action'] extends keyof SilgiSchema[T['service']][T['entity']][T['method']] ? SilgiSchema[T['service']][T['entity']][T['method']][T['action']] extends {
65
+ source: infer I;
66
+ } ? I : never : never : never : never : never;
59
67
  type GetRouterParams<T extends {
60
68
  service: string;
61
69
  entity: string;
@@ -65,6 +73,7 @@ type GetRouterParams<T extends {
65
73
  router: infer I;
66
74
  } ? I extends StandardSchemaV1 ? StandardSchemaV1.InferInput<I> : never : never : never : never : never : never;
67
75
  type ExtractInputFromURI<TURI extends keyof SilgiURIs> = GetInput<ExtractPath<TURI>>;
76
+ type ExtractSourceFromURI<TURI extends keyof SilgiURIs> = GetSource<ExtractPath<TURI>>;
68
77
  type ExtractOutputFromURI<TURI extends keyof SilgiURIs> = GetOutput<ExtractPath<TURI>>;
69
78
  type ExtractRouterParamsFromURI<TURI extends keyof SilgiURIs> = GetRouterParams<ExtractPath<TURI>>;
70
79
 
@@ -117,7 +126,7 @@ interface SilgiCLI {
117
126
  shareds: SilgiShareds$1;
118
127
  uris: Record<string, any>;
119
128
  schemas: Record<string, any>;
120
- modulesURIs: Partial<Record<keyof SilgiOptions$1, any>>;
129
+ modulesURIs: Partial<Record<keyof SilgiRuntimeOptions$1 | (string & {}), any>>;
121
130
  scannedURIs: Map<string, string>;
122
131
  templates: SilgiTemplate[];
123
132
  hooks: Hookable<SilgiCLIHooks>;
@@ -455,6 +464,7 @@ type ModuleHookContext = Readonly<{
455
464
  event?: SilgiEvents;
456
465
  operation?: SilgiOperation;
457
466
  input?: unknown;
467
+ source?: any;
458
468
  result?: unknown;
459
469
  modules?: SilgiRuntimeActions;
460
470
  timestamp?: number;
@@ -785,15 +795,6 @@ interface StorageKeyParams<TInput = unknown> {
785
795
  storageOptions?: Pick<StorageConfig<TInput>, 'base' | 'options' | 'scope'>;
786
796
  }
787
797
 
788
- interface MethodSchemaType<Input, Output> {
789
- default: {
790
- input?: Input;
791
- output: Output;
792
- };
793
- handler: (input: Input, shared: SilgiShareds, event: SilgiEvents) => Promise<Output>;
794
- modules?: Partial<SilgiRuntimeActions>;
795
- storage?: StorageConfig<Input>;
796
- }
797
798
  type EventHandlerResponse<T = undefined> = T extends undefined ? void : void | T | Promise<T>;
798
799
  type MethodHandlerType<T> = {
799
800
  [Action in keyof T]: T[Action] extends Record<string, any> ? {
@@ -801,8 +802,9 @@ type MethodHandlerType<T> = {
801
802
  default?: {
802
803
  input?: StandardSchemaV1.InferInput<T[Action][Method]['input']>;
803
804
  output?: StandardSchemaV1.InferInput<T[Action][Method]['output']>;
805
+ source?: StandardSchemaV1.InferInput<T[Action][Method]['source']>;
804
806
  };
805
- handler: (router: StandardSchemaV1.InferInput<T[Action][Method]['router']>, input: StandardSchemaV1.InferInput<T[Action][Method]['input']>, shared: SilgiShareds, event: SilgiEvents) => EventHandlerResponse<StandardSchemaV1.InferOutput<T[Action][Method]['output']>>;
807
+ handler: (router: StandardSchemaV1.InferInput<T[Action][Method]['router']>, input: StandardSchemaV1.InferInput<T[Action][Method]['input']>, shared: SilgiShareds, event: SilgiEvents, source: StandardSchemaV1.InferInput<T[Action][Method]['source']>) => EventHandlerResponse<StandardSchemaV1.InferOutput<T[Action][Method]['output']>>;
806
808
  modules?: Partial<SilgiRuntimeActions>;
807
809
  storage?: StorageConfig<T[Action][Method]['input']>;
808
810
  };
@@ -811,10 +813,10 @@ type MethodHandlerType<T> = {
811
813
  interface ResolvedMethodHandlerType {
812
814
  input?: Partial<BaseSchemaType<any>>;
813
815
  output: Partial<BaseSchemaType<any>>;
814
- handler: (router: StandardSchemaV1.InferInput<any>, input: StandardSchemaV1.InferInput<any>, shared: SilgiShareds, event: SilgiEvents) => Promise<StandardSchemaV1.InferInput<any>>;
816
+ handler: (router: StandardSchemaV1.InferInput<any>, input: StandardSchemaV1.InferInput<any>, shared: SilgiShareds, event: SilgiEvents, source: StandardSchemaV1.InferInput<any>) => Promise<StandardSchemaV1.InferInput<any>>;
815
817
  modules?: Partial<SilgiRuntimeActions>;
816
818
  storage?: StorageConfig<StandardSchemaV1.InferInput<any>>;
817
- execute: (input: StandardSchemaV1.InferInput<any>, shared: SilgiShareds, event: SilgiEvents) => Promise<StandardSchemaV1.InferInput<any>>;
819
+ execute: (input: StandardSchemaV1.InferInput<any>, shared: SilgiShareds, event: SilgiEvents, source: StandardSchemaV1.InferInput<any>) => Promise<StandardSchemaV1.InferInput<any>>;
818
820
  }
819
821
 
820
822
  type SilgiServiceInterface<T extends BaseSchemaType<StandardSchemaV1>> = {
@@ -828,7 +830,7 @@ type SilgiServiceInterface<T extends BaseSchemaType<StandardSchemaV1>> = {
828
830
  };
829
831
  type ServiceType<T> = Partial<{
830
832
  [Namespace in keyof T]: T[Namespace] extends Record<string, any> ? {
831
- [Service in keyof T[Namespace]]?: MethodHandlerType<T[Namespace][Service]>;
833
+ [Service in keyof T[Namespace]]?: Partial<MethodHandlerType<T[Namespace][Service]>>;
832
834
  } : never;
833
835
  }>;
834
836
  type RequiredServiceType<T> = {
@@ -866,7 +868,7 @@ interface Silgi {
866
868
  services: ResolvedServiceType;
867
869
  shared: SilgiShareds;
868
870
  uris: Record<string, any>;
869
- modulesURIs: Partial<Record<keyof SilgiOptions, any>>;
871
+ modulesURIs: Partial<Record<keyof SilgiRuntimeOptions | (string & {}), any>>;
870
872
  scannedHandlers: Map<string, ResolvedMethodHandlerType>;
871
873
  plugins: SilgiAppPlugin[];
872
874
  framework: FrameworkContext;
@@ -938,4 +940,4 @@ type Namespaces<T extends BaseNamespaceType> = {
938
940
 
939
941
  declare const autoImportTypes: string[];
940
942
 
941
- export { type AppConfig, type Awaitable, type BaseNamespaceType, type BaseSchemaType, type BaseSilgiMethodType, type BuildConfig, type CaptureError, type CapturedErrorContext, type CoreTs, type CreateScope, type DeepPartial, type DefaultHooks, type DefaultNamespaces, type EventHandlerResponse, type ExtendContext, type ExtendShared, type ExtractInputFromURI, type ExtractOutputFromURI, type ExtractRouterParamsFromURI, type FrameworkContext, type GenerateAppOptions, type GraphQLJSON, type HookResult, type ImportItem, type LoadConfigOptions, type MergedSilgiSchema, type MethodHandlerType, type MethodSchemaType, type ModuleDefinition, type ModuleHookContext, type ModuleMeta, type ModuleOptionsCustom, type ModuleRuntimeShared, type ModuleSetupInstallResult, type ModuleSetupReturn, type Namespaces, type NitroBuildInfo, type RequiredServiceType, type ResolvedMethodHandlerType, type ResolvedModuleMeta, type ResolvedModuleOptions, type ResolvedServiceType, type ResolvedSilgiTemplate, type SchemaPreparationOptions, type ServiceType, type Silgi, type SilgiAppPlugin, type SilgiCLI, type SilgiCLIConfig, type SilgiCLIDynamicConfig, type SilgiCLIHooks, type SilgiCLIOptions, type SilgiCompatibility, type SilgiCompatibilityIssue, type SilgiCompatibilityIssues, type SilgiConfig, type SilgiEvents, type SilgiFrameworkInfo, type SilgiFunction, type SilgiHooks, type SilgiModule, type SilgiModuleInput, type SilgiModuleOptions, type SilgiNamespaces, type SilgiOperation, type SilgiOptions, type SilgiPreset, type SilgiPresetMeta, type SilgiRouterTypes, type SilgiRuntimeActions, type SilgiRuntimeContext, type SilgiRuntimeHooks, type SilgiRuntimeMethods, type SilgiRuntimeOptions, type SilgiSchema, type SilgiServiceInterface, type SilgiShareds, type SilgiStorageBase, type SilgiTemplate, type SilgiURIs, type StorageConfig, type StorageKeyGenerator, type StorageKeyParams, type StorageMounts, type TSReference, type URIsTypes, autoImportTypes };
943
+ export { type AppConfig, type Awaitable, type BaseNamespaceType, type BaseSchemaType, type BaseSilgiMethodType, type BuildConfig, type CaptureError, type CapturedErrorContext, type CoreTs, type CreateScope, type DeepPartial, type DefaultHooks, type DefaultNamespaces, type EventHandlerResponse, type ExtendContext, type ExtendShared, type ExtractInputFromURI, type ExtractOutputFromURI, type ExtractRouterParamsFromURI, type ExtractSourceFromURI, type FrameworkContext, type GenerateAppOptions, type GraphQLJSON, type HookResult, type ImportItem, type LoadConfigOptions, type MergedSilgiSchema, type MethodHandlerType, type ModuleDefinition, type ModuleHookContext, type ModuleMeta, type ModuleOptionsCustom, type ModuleRuntimeShared, type ModuleSetupInstallResult, type ModuleSetupReturn, type Namespaces, type NitroBuildInfo, type RequiredServiceType, type ResolvedMethodHandlerType, type ResolvedModuleMeta, type ResolvedModuleOptions, type ResolvedServiceType, type ResolvedSilgiTemplate, type SchemaPreparationOptions, type ServiceType, type Silgi, type SilgiAppPlugin, type SilgiCLI, type SilgiCLIConfig, type SilgiCLIDynamicConfig, type SilgiCLIHooks, type SilgiCLIOptions, type SilgiCompatibility, type SilgiCompatibilityIssue, type SilgiCompatibilityIssues, type SilgiConfig, type SilgiEvents, type SilgiFrameworkInfo, type SilgiFunction, type SilgiHooks, type SilgiModule, type SilgiModuleInput, type SilgiModuleOptions, type SilgiNamespaces, type SilgiOperation, type SilgiOptions, type SilgiPreset, type SilgiPresetMeta, type SilgiRouterTypes, type SilgiRuntimeActions, type SilgiRuntimeContext, type SilgiRuntimeHooks, type SilgiRuntimeMethods, type SilgiRuntimeOptions, type SilgiSchema, type SilgiServiceInterface, type SilgiShareds, type SilgiStorageBase, type SilgiTemplate, type SilgiURIs, type StorageConfig, type StorageKeyGenerator, type StorageKeyParams, type StorageMounts, type TSReference, type URIsTypes, autoImportTypes };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "silgi",
3
3
  "type": "module",
4
- "version": "0.7.13",
4
+ "version": "0.7.16",
5
5
  "private": false,
6
6
  "sideEffects": false,
7
7
  "exports": {