exguard-backend 1.0.25 → 1.0.27

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "exguard-backend",
3
- "version": "1.0.25",
3
+ "version": "1.0.27",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -598,35 +598,36 @@ function updateAppModule() {
598
598
  return;
599
599
  }
600
600
 
601
- // Add at the very top
602
- appModuleContent = `import { ExGuardModule } from './exguard/exguard.module';\n${appModuleContent}`;
601
+ // Add import at the top
602
+ const importStatement = "import { ExGuardModule } from './exguard/exguard.module';\n";
603
+ appModuleContent = importStatement + appModuleContent;
604
+
605
+ // Check if ThrottlerModule.forRootAsync exists and add ExGuardModule to its imports
606
+ const throttlerAsyncMatch = appModuleContent.match(/ThrottlerModule\.forRootAsync\(\{[\s\S]*?imports:\s*\[([^\]]*)\]/);
607
+ if (throttlerAsyncMatch) {
608
+ const throttlerImports = throttlerAsyncMatch[1];
609
+ const newThrottlerImports = throttlerImports.trim() + ',\n ExGuardModule';
610
+ appModuleContent = appModuleContent.replace(
611
+ throttlerAsyncMatch[0],
612
+ throttlerAsyncMatch[0].replace(throttlerImports, newThrottlerImports)
613
+ );
614
+ logSuccess('Added ExGuardModule to ThrottlerModule.forRootAsync imports');
615
+ }
603
616
 
604
- // Find and update the @Module decorator
617
+ // Find and update the main @Module decorator imports array
605
618
  const moduleDecoratorMatch = appModuleContent.match(/@Module\s*\(\s*\{([^}]*)\}/s);
606
619
  if (moduleDecoratorMatch) {
607
620
  const moduleContent = moduleDecoratorMatch[1];
608
621
 
609
- // Check if imports array exists
622
+ // Check if main imports array exists
610
623
  const importsArrayMatch = moduleContent.match(/imports:\s*\[([^\]]*)\]/s);
611
624
  if (importsArrayMatch) {
612
- // Add to existing imports array
613
625
  const importsContent = importsArrayMatch[1];
614
626
  const newImportsContent = importsContent.trim() + ',\n ExGuardModule';
615
627
  appModuleContent = appModuleContent.replace(
616
628
  importsArrayMatch[0],
617
629
  `imports: [${newImportsContent}]`
618
630
  );
619
- } else {
620
- // Add imports array after @Module({
621
- const moduleStartMatch = appModuleContent.match(/@Module\s*\(\s*\{/);
622
- if (moduleStartMatch) {
623
- const moduleStartIndex = appModuleContent.indexOf(moduleStartMatch[0]);
624
- const afterModuleStart = appModuleContent.substring(moduleStartIndex + moduleStartMatch[0].length);
625
-
626
- appModuleContent = appModuleContent.substring(0, moduleStartIndex + moduleStartMatch[0].length) +
627
- `\n imports: [ExGuardModule],` +
628
- afterModuleStart;
629
- }
630
631
  }
631
632
  }
632
633