silgi 0.37.7 → 0.37.9

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.
@@ -700,7 +700,7 @@ async function verifyDirectoryCaseSensitivity(directoryPath, rootDirectory) {
700
700
  } catch {
701
701
  }
702
702
  }
703
- async function extractExportEntitiesFromFile(absoluteFilePath, functionExportNames = ["createSchema", "createService", "createRoute"], interfaceExtendsNames = ["ExtendShared", "ExtendContext"]) {
703
+ async function extractExportEntitiesFromFile(absoluteFilePath, functionExportNames = ["createSchema", "createService", "createRoute", "createShared"], interfaceExtendsNames = ["ExtendShared", "ExtendContext"]) {
704
704
  const exportEntities = [];
705
705
  const fileContent = await readFile(absoluteFilePath, "utf-8");
706
706
  const parsed = await parseAsync(absoluteFilePath, fileContent);
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import { defineCommand, runMain } from 'citty';
3
3
 
4
- const version = "0.37.7";
4
+ const version = "0.37.9";
5
5
  const packageJson = {
6
6
  version: version};
7
7
 
@@ -534,22 +534,24 @@ async function orchestrate(route, event) {
534
534
  const silgiCtx = useSilgi();
535
535
  const silgiURL = getUrlPrefix(route.route, event.req.method);
536
536
  const input = await parseRequestInput(event.req);
537
+ const hookContext = { earlyReturnValue: false };
537
538
  try {
538
539
  const routerParams = getRouterParams(event);
539
540
  const queryParams = getQuery(event);
540
541
  const service = route.service;
541
- const earlyReturnValue = false;
542
542
  const cachePromise = cacheExecute(input, route, silgiURL, event);
543
543
  const beforeHookPromise = silgiCtx.callHook("fetch:before", {
544
544
  url: silgiURL,
545
545
  input,
546
546
  event,
547
547
  route,
548
- earlyReturnValue
548
+ hookContext
549
549
  });
550
550
  const cacheData = await cachePromise;
551
551
  await beforeHookPromise;
552
- if (earlyReturnValue !== false) ;
552
+ if (hookContext.earlyReturnValue !== false) {
553
+ return hookContext.earlyReturnValue;
554
+ }
553
555
  if (cacheData?.success) {
554
556
  await silgiCtx.callHook("fetch:after", {
555
557
  event,
@@ -559,7 +561,8 @@ async function orchestrate(route, event) {
559
561
  success: true,
560
562
  cached: true,
561
563
  // modules: setup.modules,
562
- route
564
+ route,
565
+ hookContext
563
566
  });
564
567
  return cacheData.data;
565
568
  }
@@ -583,8 +586,8 @@ async function orchestrate(route, event) {
583
586
  input,
584
587
  result,
585
588
  success: true,
586
- // modules: setup.modules,
587
- route
589
+ route,
590
+ hookContext
588
591
  });
589
592
  if (service.storage && cacheData?.cachedKey) {
590
593
  await useSilgiStorage(service.storage.base).setItem(
@@ -601,7 +604,8 @@ async function orchestrate(route, event) {
601
604
  input,
602
605
  error: err instanceof Error ? err : new Error(String(err)),
603
606
  url: silgiURL,
604
- route
607
+ route,
608
+ hookContext
605
609
  });
606
610
  silgiCtx.captureError(
607
611
  silgiCtx,
@@ -826,7 +826,9 @@ type ModuleHookContext = Readonly<{
826
826
  success?: boolean;
827
827
  cached?: boolean;
828
828
  }> & {
829
- earlyReturnValue?: any | false;
829
+ hookContext: {
830
+ earlyReturnValue: any | false;
831
+ };
830
832
  };
831
833
  /** The options received. */
832
834
  type ModuleOptionsCustom = Record<string, any>;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "silgi",
3
3
  "type": "module",
4
- "version": "0.37.7",
4
+ "version": "0.37.9",
5
5
  "private": false,
6
6
  "sideEffects": false,
7
7
  "exports": {