emilsoftware-utilities 1.3.78 → 1.3.80

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,5 +1,5 @@
1
1
  import { Application } from "express";
2
- export { StatoRegistrazione } from "./models/StatoRegistrazione";
2
+ export declare function initializeAccessiModule(app: Application, options: any): Promise<void>;
3
3
  export { AccessiModule } from "./AccessiModule";
4
+ export { StatoRegistrazione } from "./models/StatoRegistrazione";
4
5
  export { ILoginResult } from "./Services/AuthService/IAuthService";
5
- export declare function initializeAccessiModule(app: Application, options: any): Promise<void>;
@@ -8,41 +8,36 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
9
  });
10
10
  };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
11
  Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.AccessiModule = exports.StatoRegistrazione = void 0;
12
+ exports.StatoRegistrazione = exports.AccessiModule = void 0;
16
13
  exports.initializeAccessiModule = initializeAccessiModule;
17
- const AccessiModule_1 = require("./AccessiModule");
18
- const express_1 = __importDefault(require("express"));
19
14
  const core_1 = require("@nestjs/core");
20
15
  const platform_express_1 = require("@nestjs/platform-express");
21
16
  const SwaggerConfig_1 = require("./swagger/SwaggerConfig");
22
- var StatoRegistrazione_1 = require("./models/StatoRegistrazione");
23
- Object.defineProperty(exports, "StatoRegistrazione", { enumerable: true, get: function () { return StatoRegistrazione_1.StatoRegistrazione; } });
24
- var AccessiModule_2 = require("./AccessiModule");
25
- Object.defineProperty(exports, "AccessiModule", { enumerable: true, get: function () { return AccessiModule_2.AccessiModule; } });
17
+ const AccessiModule_1 = require("./AccessiModule");
26
18
  function initializeAccessiModule(app, options) {
27
19
  return __awaiter(this, void 0, void 0, function* () {
28
20
  try {
29
- const nestExpressInstance = (0, express_1.default)(); // Istanza separata di Express
30
- const expressAdapter = new platform_express_1.ExpressAdapter(nestExpressInstance);
31
- const nestApp = yield core_1.NestFactory.create(AccessiModule_1.AccessiModule.forRoot(options), expressAdapter, { bufferLogs: true });
21
+ // ATTACCA NestJS DIRETTAMENTE ALLA TUA `app` EXPRESS ESISTENTE
22
+ const expressAdapter = new platform_express_1.ExpressAdapter(app);
23
+ // Crea un'istanza NestJS usando l'Express esistente
24
+ const nestApp = yield core_1.NestFactory.create(AccessiModule_1.AccessiModule.forRoot(options), expressAdapter, {
25
+ bufferLogs: true
26
+ });
32
27
  nestApp.enableCors();
33
- yield nestApp.init();
34
- // 🛠️ Montiamo NestJS su /api/accessi
35
- app.use('/api/accessi', nestExpressInstance);
36
- // Serviamo Swagger
28
+ nestApp.setGlobalPrefix('api/accessi'); // Assicura che tutte le API di NestJS vadano sotto `/api/accessi`
29
+ yield nestApp.init(); // ATTACCA NESTJS DIRETTAMENTE AD EXPRESS!
30
+ // Serviamo Swagger (ora sarà visibile su `/swagger/accessi`)
37
31
  (0, SwaggerConfig_1.serveSwaggerDocs)(nestApp);
38
- // Debug: Controlla se Nest sta registrando le rotte
39
- console.log('NestJS Routes:', nestApp.getHttpServer()._events.request._router.stack
40
- .map((r) => { var _a; return (_a = r.route) === null || _a === void 0 ? void 0 : _a.path; })
41
- .filter(Boolean));
32
+ console.log('NestJS AccessiModule inizializzato e attaccato a Express!');
42
33
  }
43
34
  catch (error) {
44
- console.error("Error occurred in initializeAccessiModule:", error);
45
- throw error; // Rilancia l'errore per vedere lo stack completo
35
+ console.error("Errore in initializeAccessiModule:", error);
36
+ throw error;
46
37
  }
47
38
  });
48
39
  }
40
+ var AccessiModule_2 = require("./AccessiModule");
41
+ Object.defineProperty(exports, "AccessiModule", { enumerable: true, get: function () { return AccessiModule_2.AccessiModule; } });
42
+ var StatoRegistrazione_1 = require("./models/StatoRegistrazione");
43
+ Object.defineProperty(exports, "StatoRegistrazione", { enumerable: true, get: function () { return StatoRegistrazione_1.StatoRegistrazione; } });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "emilsoftware-utilities",
3
- "version": "1.3.78",
3
+ "version": "1.3.80",
4
4
  "description": "Utilities for EmilSoftware",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",