silgi 0.7.39 → 0.7.40

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.39";
1
+ const version = "0.7.40";
2
2
  const packageJson = {
3
3
  version: version};
4
4
 
@@ -608,18 +608,18 @@ function silgi(event) {
608
608
  }
609
609
  async function execute(uriString, input, event, source) {
610
610
  const silgiCtx = useSilgi();
611
- if (event) {
612
- await silgiCtx.callHook("event:before", event);
613
- }
614
- let success = false;
615
- let cached = false;
616
- let result;
617
611
  try {
618
612
  const operation = parseURI(uriString, silgiCtx.uris);
619
613
  if (!operation) {
620
614
  throw ErrorFactory.create({ message: "Invalid URI", httpStatus: HttpStatus.BAD_REQUEST });
621
615
  }
616
+ let success = false;
617
+ let cached = false;
618
+ let result;
622
619
  const handler = silgiCtx.scannedHandlers.get(operation.uri);
620
+ if (event) {
621
+ await silgiCtx.callHook("event:before", event, handler);
622
+ }
623
623
  if (!handler) {
624
624
  throw ErrorFactory.create({
625
625
  message: "Action not found",
@@ -1,3 +1,3 @@
1
- const version = "0.7.39";
1
+ const version = "0.7.40";
2
2
 
3
3
  export { version };
@@ -1,3 +1,3 @@
1
- const version = "0.7.39";
1
+ const version = "0.7.40";
2
2
 
3
3
  export { version };
@@ -742,31 +742,6 @@ interface LoadConfigOptions {
742
742
  compatibilityDate?: CompatibilityDateSpec;
743
743
  }
744
744
 
745
- /**
746
- * The listeners to Silgi
747
- */
748
- interface SilgiRuntimeHooks {
749
- /**
750
- * Called after Silgi initialization, when the Silgi instance is ready to work.
751
- * @param silgi The configured Silgi object
752
- * @returns Promise
753
- */
754
- 'ready': (silgi: Silgi) => HookResult;
755
- /**
756
- * Called when silgi instance is gracefully closing.
757
- * @param silgi The configured silgi object
758
- * @returns Promise
759
- */
760
- 'close': (silgi: Silgi) => HookResult;
761
- 'app:setup:start': (silgi: Silgi) => HookResult;
762
- 'action:before': (context: ModuleHookContext) => HookResult;
763
- 'action:after': (context: ModuleHookContext) => HookResult;
764
- 'action:error': (context: ModuleHookContext) => HookResult;
765
- 'action:finally': (context: ModuleHookContext) => HookResult;
766
- 'event:before': (event: SilgiEvents) => HookResult;
767
- 'error': CaptureError;
768
- }
769
-
770
745
  interface SilgiShareds extends ModuleRuntimeShared {
771
746
  storage: (...data: Parameters<typeof useSilgiStorage>) => ReturnType<typeof useSilgiStorage>;
772
747
  silgi: SilgiFunction;
@@ -826,6 +801,31 @@ interface ResolvedMethodHandlerType {
826
801
  execute: (input: StandardSchemaV1.InferInput<any>, shared: SilgiShareds, event: SilgiEvents, source: StandardSchemaV1.InferInput<any>) => Promise<StandardSchemaV1.InferInput<any>>;
827
802
  }
828
803
 
804
+ /**
805
+ * The listeners to Silgi
806
+ */
807
+ interface SilgiRuntimeHooks {
808
+ /**
809
+ * Called after Silgi initialization, when the Silgi instance is ready to work.
810
+ * @param silgi The configured Silgi object
811
+ * @returns Promise
812
+ */
813
+ 'ready': (silgi: Silgi) => HookResult;
814
+ /**
815
+ * Called when silgi instance is gracefully closing.
816
+ * @param silgi The configured silgi object
817
+ * @returns Promise
818
+ */
819
+ 'close': (silgi: Silgi) => HookResult;
820
+ 'app:setup:start': (silgi: Silgi) => HookResult;
821
+ 'action:before': (context: ModuleHookContext) => HookResult;
822
+ 'action:after': (context: ModuleHookContext) => HookResult;
823
+ 'action:error': (context: ModuleHookContext) => HookResult;
824
+ 'action:finally': (context: ModuleHookContext) => HookResult;
825
+ 'event:before': (event: SilgiEvents, handler: ResolvedMethodHandlerType | undefined) => HookResult;
826
+ 'error': CaptureError;
827
+ }
828
+
829
829
  type SilgiServiceInterface<T extends BaseSchemaType<StandardSchemaV1>> = {
830
830
  [Action in keyof T]: T[Action] extends Record<string, any> ? {
831
831
  [Method in keyof T[Action]]: {
@@ -742,31 +742,6 @@ interface LoadConfigOptions {
742
742
  compatibilityDate?: CompatibilityDateSpec;
743
743
  }
744
744
 
745
- /**
746
- * The listeners to Silgi
747
- */
748
- interface SilgiRuntimeHooks {
749
- /**
750
- * Called after Silgi initialization, when the Silgi instance is ready to work.
751
- * @param silgi The configured Silgi object
752
- * @returns Promise
753
- */
754
- 'ready': (silgi: Silgi) => HookResult;
755
- /**
756
- * Called when silgi instance is gracefully closing.
757
- * @param silgi The configured silgi object
758
- * @returns Promise
759
- */
760
- 'close': (silgi: Silgi) => HookResult;
761
- 'app:setup:start': (silgi: Silgi) => HookResult;
762
- 'action:before': (context: ModuleHookContext) => HookResult;
763
- 'action:after': (context: ModuleHookContext) => HookResult;
764
- 'action:error': (context: ModuleHookContext) => HookResult;
765
- 'action:finally': (context: ModuleHookContext) => HookResult;
766
- 'event:before': (event: SilgiEvents) => HookResult;
767
- 'error': CaptureError;
768
- }
769
-
770
745
  interface SilgiShareds extends ModuleRuntimeShared {
771
746
  storage: (...data: Parameters<typeof useSilgiStorage>) => ReturnType<typeof useSilgiStorage>;
772
747
  silgi: SilgiFunction;
@@ -826,6 +801,31 @@ interface ResolvedMethodHandlerType {
826
801
  execute: (input: StandardSchemaV1.InferInput<any>, shared: SilgiShareds, event: SilgiEvents, source: StandardSchemaV1.InferInput<any>) => Promise<StandardSchemaV1.InferInput<any>>;
827
802
  }
828
803
 
804
+ /**
805
+ * The listeners to Silgi
806
+ */
807
+ interface SilgiRuntimeHooks {
808
+ /**
809
+ * Called after Silgi initialization, when the Silgi instance is ready to work.
810
+ * @param silgi The configured Silgi object
811
+ * @returns Promise
812
+ */
813
+ 'ready': (silgi: Silgi) => HookResult;
814
+ /**
815
+ * Called when silgi instance is gracefully closing.
816
+ * @param silgi The configured silgi object
817
+ * @returns Promise
818
+ */
819
+ 'close': (silgi: Silgi) => HookResult;
820
+ 'app:setup:start': (silgi: Silgi) => HookResult;
821
+ 'action:before': (context: ModuleHookContext) => HookResult;
822
+ 'action:after': (context: ModuleHookContext) => HookResult;
823
+ 'action:error': (context: ModuleHookContext) => HookResult;
824
+ 'action:finally': (context: ModuleHookContext) => HookResult;
825
+ 'event:before': (event: SilgiEvents, handler: ResolvedMethodHandlerType | undefined) => HookResult;
826
+ 'error': CaptureError;
827
+ }
828
+
829
829
  type SilgiServiceInterface<T extends BaseSchemaType<StandardSchemaV1>> = {
830
830
  [Action in keyof T]: T[Action] extends Record<string, any> ? {
831
831
  [Method in keyof T[Action]]: {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "silgi",
3
3
  "type": "module",
4
- "version": "0.7.39",
4
+ "version": "0.7.40",
5
5
  "private": false,
6
6
  "sideEffects": false,
7
7
  "exports": {