emilsoftware-utilities 1.3.74 → 1.3.76

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,37 +1,4 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
2
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
36
3
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
37
4
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -41,30 +8,36 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
41
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
42
9
  });
43
10
  };
11
+ var __importDefault = (this && this.__importDefault) || function (mod) {
12
+ return (mod && mod.__esModule) ? mod : { "default": mod };
13
+ };
44
14
  Object.defineProperty(exports, "__esModule", { value: true });
45
15
  exports.AccessiModule = exports.StatoRegistrazione = void 0;
46
16
  exports.initializeAccessiModule = initializeAccessiModule;
47
17
  const AccessiModule_1 = require("./AccessiModule");
18
+ const express_1 = __importDefault(require("express"));
48
19
  const core_1 = require("@nestjs/core");
49
20
  const platform_express_1 = require("@nestjs/platform-express");
50
21
  const SwaggerConfig_1 = require("./swagger/SwaggerConfig");
51
- const express = __importStar(require("express"));
52
22
  var StatoRegistrazione_1 = require("./models/StatoRegistrazione");
53
23
  Object.defineProperty(exports, "StatoRegistrazione", { enumerable: true, get: function () { return StatoRegistrazione_1.StatoRegistrazione; } });
54
24
  var AccessiModule_2 = require("./AccessiModule");
55
25
  Object.defineProperty(exports, "AccessiModule", { enumerable: true, get: function () { return AccessiModule_2.AccessiModule; } });
56
26
  function initializeAccessiModule(app, options) {
57
27
  return __awaiter(this, void 0, void 0, function* () {
58
- // 1. Creiamo un'istanza di ExpressAdapter basata su `app`
59
- const expressAdapter = new platform_express_1.ExpressAdapter(app);
60
- // 2. Creiamo Nest con l'ExpressAdapter
61
- const nestApp = yield core_1.NestFactory.create(AccessiModule_1.AccessiModule.forRoot(options), expressAdapter);
62
- // 3. Abilitiamo i middleware di Express (es. body-parser)
63
- nestApp.use(express.json());
64
- nestApp.use(express.urlencoded({ extended: true }));
65
- // 4. Avviamo NestJS (senza avviare un server separato)
28
+ // Creiamo una nuova istanza di Express dedicata a NestJS per evitare cicli
29
+ const nestExpressInstance = (0, express_1.default)();
30
+ // Creiamo un ExpressAdapter basato sulla nuova istanza
31
+ const expressAdapter = new platform_express_1.ExpressAdapter(nestExpressInstance);
32
+ // Creiamo un'app NestJS con l'adapter Express
33
+ const nestApp = yield core_1.NestFactory.create(AccessiModule_1.AccessiModule.forRoot(options), expressAdapter, { bufferLogs: true });
34
+ // Abilitiamo CORS solo su questa istanza
35
+ nestApp.enableCors();
36
+ // Avviamo NestJS senza avviare un nuovo server
66
37
  yield nestApp.init();
67
- // 5. Serviamo automaticamente Swagger
38
+ // Montiamo NestJS SOLO su /api/accessi, evitando cicli
39
+ app.use('/api/accessi', nestExpressInstance);
40
+ // Serviamo Swagger
68
41
  (0, SwaggerConfig_1.serveSwaggerDocs)(nestApp);
69
42
  });
70
43
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "emilsoftware-utilities",
3
- "version": "1.3.74",
3
+ "version": "1.3.76",
4
4
  "description": "Utilities for EmilSoftware",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",