emilsoftware-utilities 2.0.0-dev.1 → 2.0.0-dev.10

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.
Files changed (32) hide show
  1. package/dist/DatabaseUpdater.d.ts +1 -1
  2. package/dist/DatabaseUpdater.js.map +1 -1
  3. package/dist/Orm.d.ts +5 -1
  4. package/dist/Orm.js +147 -78
  5. package/dist/Orm.js.map +1 -1
  6. package/dist/Utilities.d.ts +2 -2
  7. package/dist/Utilities.js +2 -0
  8. package/dist/Utilities.js.map +1 -1
  9. package/dist/accessi-module/AccessiModule.d.ts +1 -1
  10. package/dist/accessi-module/AccessiModule.js.map +1 -1
  11. package/dist/accessi-module/Services/AuthService/AuthService.d.ts +1 -0
  12. package/dist/accessi-module/Services/AuthService/AuthService.js +12 -2
  13. package/dist/accessi-module/Services/AuthService/AuthService.js.map +1 -1
  14. package/dist/accessi-module/database-updates/AccessiDatabaseUpdater.js +9 -0
  15. package/dist/accessi-module/database-updates/AccessiDatabaseUpdater.js.map +1 -1
  16. package/dist/accessi-module/index.d.ts +1 -0
  17. package/dist/accessi-module/index.js +42 -6
  18. package/dist/accessi-module/index.js.map +1 -1
  19. package/dist/allegati-module/AllegatiModule.d.ts +1 -1
  20. package/dist/allegati-module/AllegatiModule.js.map +1 -1
  21. package/dist/emilsoftware-utilities-2.0.0-dev.10.tgz +0 -0
  22. package/dist/firebird-compat.d.ts +24 -0
  23. package/dist/firebird-compat.js +218 -0
  24. package/dist/firebird-compat.js.map +1 -0
  25. package/dist/index.d.ts +5 -2
  26. package/dist/index.js +28 -2
  27. package/dist/index.js.map +1 -1
  28. package/dist/swagger/SwaggerConfig.d.ts +6 -1
  29. package/dist/swagger/SwaggerConfig.js +6 -6
  30. package/dist/swagger/SwaggerConfig.js.map +1 -1
  31. package/package.json +2 -2
  32. package/dist/emilsoftware-utilities-2.0.0-dev.1.tgz +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","source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B,EAAE,CAAC;YACrE,CAAC;YAED,MAAM,kBAAkB,GAAG,OAAO,CAAC,GAAG,CAAC,wCAAsB,CAAC,CAAC;YAC/D,GAAG,CAAC,MAAM,CAAC,kBAAkB,GAAG,kBAAkB,CAAC;YACnD,IAAA,uCAAqB,EAAC,kBAAkB,CAAC,CAAC;QAE9C,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACb,IAAA,+CAA6B,EAAC,KAAK,CAAC,CAAC;YACrC,MAAM,CAAC,KAAK,CAAC,qCAAqC,EAAE,KAAK,CAAC,CAAC;YAC3D,MAAM,KAAK,CAAC;QAChB,CAAC;IACL,CAAC;CAAA;AAED,iDAAgD;AAAvC,8GAAA,aAAa,OAAA;AACtB,oFAAmF;AAA1E,gIAAA,sBAAsB,OAAA;AAC/B,yCAAuB;AACvB,gEAGsC;AAFlC,mHAAA,gBAAgB,OAAA;AAChB,kHAAA,eAAe,OAAA;AAEnB,wEAAsE;AAA7D,yHAAA,kBAAkB,OAAA","sourcesContent":["import { Application } from \"express\";\nimport { ValidationPipe } from \"@nestjs/common\";\nimport { NestFactory } from \"@nestjs/core\";\nimport { ExpressAdapter } from \"@nestjs/platform-express\";\nimport { AccessiModule, AccessiOptions } from \"./AccessiModule\";\nimport { Logger } from \"../Logger\";\nimport { AuthService } from \"./Services/AuthService/AuthService\";\nimport {\n beginAccessiAuthInitialization,\n failAccessiAuthInitialization,\n AuthenticateGenService,\n setAccessiAuthService\n} from \"./middleware/authenticateGen\";\n\nexport async function initializeAccessiModule(app: Application, options: AccessiOptions) {\n const logger: Logger = new Logger(\"initializeAccessiModule\");\n beginAccessiAuthInitialization();\n\n console.log(\"Accessi initialized\");\n try {\n // Creiamo un'istanza Express separata per NestJS\n const nestExpressInstance = new ExpressAdapter(app);\n\n // Creiamo l'app NestJS attaccata a Express\n const nestApp = await NestFactory.create(AccessiModule.forRoot(options), nestExpressInstance, {\n bufferLogs: true\n });\n\n nestApp.enableCors();\n nestApp.useGlobalPipes(\n new ValidationPipe({\n whitelist: true,\n forbidNonWhitelisted: true,\n transform: true,\n transformOptions: {\n enableImplicitConversion: true,\n },\n }),\n );\n\n nestApp.setGlobalPrefix('api', {\n exclude: ['/swagger', '/swagger/(.*)']\n });\n\n // Note: Swagger setup is now handled by the unified module\n await nestApp.init();\n if (options.legacyPasswordMigrationOnStartup !== false) {\n const passwordMigrationService = nestApp.get(AuthService);\n await passwordMigrationService.migrateLegacyEncryptedPasswords();\n }\n\n const accessiAuthService = nestApp.get(AuthenticateGenService);\n app.locals.accessiAuthService = accessiAuthService;\n setAccessiAuthService(accessiAuthService);\n\n } catch (error) {\n failAccessiAuthInitialization(error);\n logger.error(\"Errore in initialize AccessiModule:\", error);\n throw error;\n }\n}\n\nexport { AccessiModule } from \"./AccessiModule\";\nexport { AccessiDatabaseUpdater } from \"./database-updates/AccessiDatabaseUpdater\";\nexport * from \"./Dtos\";\nexport {\n authorizeAccessi,\n authenticateGen\n} from \"./middleware/authenticateGen\";\nexport { accessiRequirement } from \"./middleware/accessiRequirements\";\nexport type {\n AccessiAuthorizationOptions,\n AccessiRequirementNode,\n AccessiCustomRequirementContext,\n AccessiCustomRequirementHandler\n} from \"./middleware/accessiRequirements\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/accessi-module/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0BA,0DAiFC;AA3GD,sDAAwD;AACxD,2CAAgD;AAChD,uCAA2C;AAC3C,+DAA0D;AAC1D,mDAAgE;AAChE,sCAAmC;AACnC,oEAAiE;AACjE,4DAAwD;AACxD,kEAKsC;AAEtC,SAAS,sBAAsB,CAAC,OAAuB;;IACnD,MAAM,SAAS,GAAG,OAAO,CAAC,eAKzB,CAAC;IAEF,OAAO,GAAG,MAAA,SAAS,CAAC,IAAI,mCAAI,GAAG,IAAI,MAAA,SAAS,CAAC,IAAI,mCAAI,GAAG,OAAO,MAAA,SAAS,CAAC,QAAQ,mCAAI,G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BAAkB,CAAC,CAAC;YAC1C,MAAM,SAAS,GAAG,WAAW,CAAC,GAAG,EAAE,GAAG,SAAS,CAAC;YAChD,MAAM,CAAC,IAAI,CAAC,gDAAgD,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;QAE3F,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACb,IAAA,+CAA6B,EAAC,KAAK,CAAC,CAAC;YACrC,MAAM,CAAC,KAAK,CACR,qCAAqC,EACrC,KAAK,YAAY,KAAK;gBAClB,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE;gBAClE,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,EAAE,CACjC,CAAC;YACF,MAAM,KAAK,CAAC;QAChB,CAAC;IACL,CAAC;CAAA;AAED,iDAAgD;AAAvC,8GAAA,aAAa,OAAA;AACtB,oFAAmF;AAA1E,gIAAA,sBAAsB,OAAA;AAE/B,yCAAuB;AACvB,gEAGsC;AAFlC,mHAAA,gBAAgB,OAAA;AAChB,kHAAA,eAAe,OAAA;AAEnB,wEAAsE;AAA7D,yHAAA,kBAAkB,OAAA","sourcesContent":["import express, { Application, Request } from \"express\";\nimport { ValidationPipe } from \"@nestjs/common\";\nimport { NestFactory } from \"@nestjs/core\";\nimport { ExpressAdapter } from \"@nestjs/platform-express\";\nimport { AccessiModule, AccessiOptions } from \"./AccessiModule\";\nimport { Logger } from \"../Logger\";\nimport { AuthService } from \"./Services/AuthService/AuthService\";\nimport { setupSwagger } from \"../swagger/SwaggerConfig\";\nimport {\n beginAccessiAuthInitialization,\n failAccessiAuthInitialization,\n AuthenticateGenService,\n setAccessiAuthService\n} from \"./middleware/authenticateGen\";\n\nfunction describeDatabaseTarget(options: AccessiOptions): string {\n const dbOptions = options.databaseOptions as {\n host?: string;\n port?: number;\n database?: string;\n user?: string;\n };\n\n return `${dbOptions.host ?? \"?\"}:${dbOptions.port ?? \"?\"} -> ${dbOptions.database ?? \"?\"} as ${dbOptions.user ?? \"?\"}`;\n}\n\nexport async function initializeAccessiModule(app: Application, options: AccessiOptions) {\n const logger: Logger = new Logger(\"initializeAccessiModule\");\n beginAccessiAuthInitialization();\n const startedAt = performance.now();\n\n try {\n logger.info(\"Inizializzazione modulo accessi avviata.\");\n logger.info(`Target database accessi: ${describeDatabaseTarget(options)}`);\n logger.info(\n `Configurazione accessi: autoUpdateDatabase=${options.autoUpdateDatabase !== false}, legacyPasswordMigrationOnStartup=${options.legacyPasswordMigrationOnStartup !== false}`\n );\n const nestHostApp = express();\n const isNestRoute = (path: string) =>\n path === \"/api/accessi\" ||\n path.startsWith(\"/api/accessi/\") ||\n path === \"/accessi/swagger\" ||\n path.startsWith(\"/accessi/swagger/\") ||\n path === \"/accessi/swagger-json\";\n\n app.use((req: Request, res, next) => {\n if (!isNestRoute(req.path)) {\n return next();\n }\n\n return nestHostApp(req, res, next);\n });\n\n const nestExpressInstance = new ExpressAdapter(nestHostApp);\n\n const nestApp = await NestFactory.create(AccessiModule.forRoot(options), nestExpressInstance, {\n bufferLogs: true\n });\n logger.info(\"Applicazione Nest accessi creata.\");\n\n nestApp.enableCors();\n nestApp.useGlobalPipes(\n new ValidationPipe({\n whitelist: true,\n forbidNonWhitelisted: true,\n transform: true,\n transformOptions: {\n enableImplicitConversion: true,\n },\n }),\n );\n\n nestApp.setGlobalPrefix('api', {\n exclude: ['/swagger', '/swagger/(.*)']\n });\n\n setupSwagger(nestApp, {\n swaggerPath: \"accessi/swagger\",\n title: \"Accessi API Documentation\",\n description: \"API del modulo accessi\",\n });\n logger.info(\"Avvio init del modulo accessi.\");\n await nestApp.init();\n logger.info(\"Init del modulo accessi completata.\");\n if (options.legacyPasswordMigrationOnStartup !== false) {\n logger.info(\"Avvio migrazione password legacy accessi.\");\n const passwordMigrationService = nestApp.get(AuthService);\n await passwordMigrationService.migrateLegacyEncryptedPasswords();\n logger.info(\"Migrazione password legacy accessi completata.\");\n }\n\n const accessiAuthService = nestApp.get(AuthenticateGenService);\n app.locals.accessiAuthService = accessiAuthService;\n setAccessiAuthService(accessiAuthService);\n const elapsedMs = performance.now() - startedAt;\n logger.info(`Accessi initialized. Tempo totale bootstrap: ${elapsedMs.toFixed(2)} ms`);\n\n } catch (error) {\n failAccessiAuthInitialization(error);\n logger.error(\n \"Errore in initialize AccessiModule:\",\n error instanceof Error\n ? { name: error.name, message: error.message, stack: error.stack }\n : { error: String(error) }\n );\n throw error;\n }\n}\n\nexport { AccessiModule } from \"./AccessiModule\";\nexport { AccessiDatabaseUpdater } from \"./database-updates/AccessiDatabaseUpdater\";\nexport type { AccessiOptions, EmailOptions, JwtOptions, ExtensionFieldsOptions, PublicAuthRateLimitOptions, PublicAuthRateLimitRuleOptions } from \"./AccessiModule\";\nexport * from \"./Dtos\";\nexport {\n authorizeAccessi,\n authenticateGen\n} from \"./middleware/authenticateGen\";\nexport { accessiRequirement } from \"./middleware/accessiRequirements\";\nexport type {\n AccessiAuthorizationOptions,\n AccessiRequirementNode,\n AccessiCustomRequirementContext,\n AccessiCustomRequirementHandler\n} from \"./middleware/accessiRequirements\";\n"]}
@@ -1,5 +1,5 @@
1
1
  import { DynamicModule } from "@nestjs/common";
2
- import { Options } from "es-node-firebird";
2
+ import { Options } from "node-firebird";
3
3
  export interface AllegatiOptions {
4
4
  databaseOptions: Options;
5
5
  }
@@ -1 +1 @@
1
- {"version":3,"file":"AllegatiModule.js","sourceRoot":"","sources":["../../src/allegati-module/AllegatiModule.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,2CAA+D;AAC/D,gFAA6E;AAC7E,yEAAsE;AAc/D,IAAM,cAAc,sBAApB,MAAM,cAAc;IAEvB,MAAM,CAAC,OAAO,CAAC,OAAwB;QACnC,OAAO;YACH,MAAM,EAAE,gBAAc;YACtB,SAAS,EAAE;gBACP;oBACI,OAAO,EAAE,kBAAkB;oBAC3B,QAAQ,EAAE,OAAO;iBACpB;gBACD,iCAAe;aAClB;YACD,OAAO,EAAE,CAAC,kBAAkB,EAAE,iCAAe,CAAC;SACjD,CAAC;IACN,CAAC;CACJ,CAAA;AAfY,wCAAc;yBAAd,cAAc;IAN1B,IAAA,eAAM,GAAE;IACR,IAAA,eAAM,EAAC;QACJ,WAAW,EAAE,CAAC,uCAAkB,CAAC;QACjC,SAAS,EAAE,CAAC,iCAAe,CAAC;QAC5B,OAAO,EAAE,CAAC,iCAAe,CAAC;KAC7B,CAAC;GACW,cAAc,CAe1B","sourcesContent":["import { DynamicModule, Global, Module } from \"@nestjs/common\";\nimport { AllegatiService } from \"./Services/AllegatiService/AllegatiService\";\nimport { AllegatiController } from \"./Controllers/AllegatiController\";\nimport { Options } from \"es-node-firebird\";\nimport { Logger } from \"../Logger\";\n\nexport interface AllegatiOptions {\n databaseOptions: Options;\n}\n\n@Global()\n@Module({\n controllers: [AllegatiController],\n providers: [AllegatiService],\n exports: [AllegatiService],\n})\nexport class AllegatiModule {\n\n static forRoot(options: AllegatiOptions): DynamicModule {\n return {\n module: AllegatiModule,\n providers: [\n {\n provide: 'ALLEGATI_OPTIONS',\n useValue: options,\n },\n AllegatiService,\n ],\n exports: ['ALLEGATI_OPTIONS', AllegatiService],\n };\n }\n}"]}
1
+ {"version":3,"file":"AllegatiModule.js","sourceRoot":"","sources":["../../src/allegati-module/AllegatiModule.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,2CAA+D;AAC/D,gFAA6E;AAC7E,yEAAsE;AAc/D,IAAM,cAAc,sBAApB,MAAM,cAAc;IAEvB,MAAM,CAAC,OAAO,CAAC,OAAwB;QACnC,OAAO;YACH,MAAM,EAAE,gBAAc;YACtB,SAAS,EAAE;gBACP;oBACI,OAAO,EAAE,kBAAkB;oBAC3B,QAAQ,EAAE,OAAO;iBACpB;gBACD,iCAAe;aAClB;YACD,OAAO,EAAE,CAAC,kBAAkB,EAAE,iCAAe,CAAC;SACjD,CAAC;IACN,CAAC;CACJ,CAAA;AAfY,wCAAc;yBAAd,cAAc;IAN1B,IAAA,eAAM,GAAE;IACR,IAAA,eAAM,EAAC;QACJ,WAAW,EAAE,CAAC,uCAAkB,CAAC;QACjC,SAAS,EAAE,CAAC,iCAAe,CAAC;QAC5B,OAAO,EAAE,CAAC,iCAAe,CAAC;KAC7B,CAAC;GACW,cAAc,CAe1B","sourcesContent":["import { DynamicModule, Global, Module } from \"@nestjs/common\";\nimport { AllegatiService } from \"./Services/AllegatiService/AllegatiService\";\nimport { AllegatiController } from \"./Controllers/AllegatiController\";\nimport { Options } from \"node-firebird\";\nimport { Logger } from \"../Logger\";\n\nexport interface AllegatiOptions {\n databaseOptions: Options;\n}\n\n@Global()\n@Module({\n controllers: [AllegatiController],\n providers: [AllegatiService],\n exports: [AllegatiService],\n})\nexport class AllegatiModule {\n\n static forRoot(options: AllegatiOptions): DynamicModule {\n return {\n module: AllegatiModule,\n providers: [\n {\n provide: 'ALLEGATI_OPTIONS',\n useValue: options,\n },\n AllegatiService,\n ],\n exports: ['ALLEGATI_OPTIONS', AllegatiService],\n };\n }\n}\n"]}
@@ -0,0 +1,24 @@
1
+ import type { Options } from "node-firebird";
2
+ export type FirebirdWireCryptMode = "disabled" | "enabled" | "required";
3
+ export type FirebirdAuthPlugin = "Legacy_Auth" | "Srp" | "Srp256" | "Srp384" | "Srp512";
4
+ export type FirebirdDriverStrategy = "modern";
5
+ export type FirebirdOptions = Options & {
6
+ wireCrypt?: FirebirdWireCryptMode | number;
7
+ pluginName?: FirebirdAuthPlugin;
8
+ authPlugins?: FirebirdAuthPlugin[];
9
+ connectTimeoutMs?: number;
10
+ compatibilityProbeTimeoutMs?: number;
11
+ compatibilityTotalTimeoutMs?: number;
12
+ firebirdDriver?: FirebirdDriverStrategy;
13
+ };
14
+ type FirebirdErrorContext = {
15
+ stage: "attach" | "query" | "execute" | "transaction";
16
+ sql?: string;
17
+ };
18
+ export declare function normalizeFirebirdOptions(options: Options): FirebirdOptions;
19
+ export declare function describeFirebirdCompatibilityOptions(options: Options): string;
20
+ export declare function enhanceFirebirdError(error: unknown, options: Options, context: FirebirdErrorContext): Error;
21
+ export declare function buildFirebirdCompatibilityCandidates(options: Options): FirebirdOptions[];
22
+ export declare function shouldRetryFirebirdCompatibility(): boolean;
23
+ export declare function ensureEsNodeFirebirdCompatibilityPatch(): void;
24
+ export {};
@@ -0,0 +1,218 @@
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
+ var __rest = (this && this.__rest) || function (s, e) {
36
+ var t = {};
37
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
38
+ t[p] = s[p];
39
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
40
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
41
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
42
+ t[p[i]] = s[p[i]];
43
+ }
44
+ return t;
45
+ };
46
+ Object.defineProperty(exports, "__esModule", { value: true });
47
+ exports.normalizeFirebirdOptions = normalizeFirebirdOptions;
48
+ exports.describeFirebirdCompatibilityOptions = describeFirebirdCompatibilityOptions;
49
+ exports.enhanceFirebirdError = enhanceFirebirdError;
50
+ exports.buildFirebirdCompatibilityCandidates = buildFirebirdCompatibilityCandidates;
51
+ exports.shouldRetryFirebirdCompatibility = shouldRetryFirebirdCompatibility;
52
+ exports.ensureEsNodeFirebirdCompatibilityPatch = ensureEsNodeFirebirdCompatibilityPatch;
53
+ const Firebird = __importStar(require("node-firebird"));
54
+ function isBlank(value) {
55
+ return value === undefined || value === null || (typeof value === "string" && value.trim() === "");
56
+ }
57
+ function normalizeWireCryptMode(value) {
58
+ if (isBlank(value)) {
59
+ return undefined;
60
+ }
61
+ if (typeof value === "number") {
62
+ return value;
63
+ }
64
+ const normalized = String(value).trim().toLowerCase();
65
+ if (normalized === "disabled") {
66
+ return Firebird.WIRE_CRYPT_DISABLE;
67
+ }
68
+ return Firebird.WIRE_CRYPT_ENABLE;
69
+ }
70
+ function normalizeAuthPlugin(value) {
71
+ if (isBlank(value)) {
72
+ return undefined;
73
+ }
74
+ const normalized = String(value).trim().toLowerCase();
75
+ if (normalized === "legacy" || normalized === "legacy_auth") {
76
+ return "Legacy_Auth";
77
+ }
78
+ if (normalized === "srp256") {
79
+ return "Srp256";
80
+ }
81
+ if (normalized === "srp384") {
82
+ return "Srp384";
83
+ }
84
+ if (normalized === "srp512") {
85
+ return "Srp512";
86
+ }
87
+ return "Srp";
88
+ }
89
+ function formatWireCryptValue(value) {
90
+ if (isBlank(value)) {
91
+ return "auto";
92
+ }
93
+ if (typeof value === "number") {
94
+ if (value === Firebird.WIRE_CRYPT_DISABLE) {
95
+ return "disabled";
96
+ }
97
+ if (value === Firebird.WIRE_CRYPT_ENABLE) {
98
+ return "enabled";
99
+ }
100
+ return String(value);
101
+ }
102
+ return String(value);
103
+ }
104
+ function formatTarget(options) {
105
+ var _a, _b, _c;
106
+ return `${(_a = options.host) !== null && _a !== void 0 ? _a : "?"}:${(_b = options.port) !== null && _b !== void 0 ? _b : "?"} -> ${(_c = options.database) !== null && _c !== void 0 ? _c : "?"}`;
107
+ }
108
+ function uniqueDiagnostics(values) {
109
+ return values.filter((value, index) => values.indexOf(value) === index);
110
+ }
111
+ function buildDiagnostics(message, options) {
112
+ const diagnostics = [];
113
+ const pluginMismatch = message.match(/Server don't accept plugin\s*:\s*([^,]+),\s*but support\s*:\s*(.+)$/i);
114
+ if (pluginMismatch) {
115
+ const supportedPlugins = pluginMismatch[2]
116
+ .split(",")
117
+ .map((plugin) => plugin.trim())
118
+ .filter((plugin) => plugin.length > 0);
119
+ const supportedMessage = supportedPlugins.length === 1
120
+ ? `The server explicitly reported that only the "${supportedPlugins[0]}" authentication plugin is supported.`
121
+ : `The server explicitly reported the supported authentication plugins: ${supportedPlugins.join(", ")}.`;
122
+ diagnostics.push(supportedMessage);
123
+ }
124
+ if (/Incompatible wire encryption levels requested on client and server/i.test(message)) {
125
+ diagnostics.push("The server rejected the requested wire encryption mode. Keep wire encryption auto-enabled unless the server is known to allow disabled encryption.");
126
+ }
127
+ if (/No matching plugins on server/i.test(message)) {
128
+ diagnostics.push("The server did not find a common authentication plugin with the client configuration.");
129
+ }
130
+ if (/Connection timeout after \d+ms/i.test(message) || /Timeout during Firebird attach after \d+ ms/i.test(message)) {
131
+ diagnostics.push("The TCP connection was accepted but the Firebird wire-protocol attach did not complete in time.");
132
+ }
133
+ if (options.pluginName) {
134
+ diagnostics.push(`Client authentication plugin was forced to "${options.pluginName}". Leave pluginName empty to let the driver auto-negotiate when possible.`);
135
+ }
136
+ if (!isBlank(options.wireCrypt)) {
137
+ diagnostics.push(`Client wire encryption was forced to "${formatWireCryptValue(options.wireCrypt)}".`);
138
+ }
139
+ return uniqueDiagnostics(diagnostics);
140
+ }
141
+ function copyFirebirdMetadata(target, source) {
142
+ if (!source || typeof source !== "object") {
143
+ return;
144
+ }
145
+ const firebirdSource = source;
146
+ if ("gdscode" in firebirdSource) {
147
+ target.gdscode = firebirdSource.gdscode;
148
+ }
149
+ if ("gdsparams" in firebirdSource) {
150
+ target.gdsparams = firebirdSource.gdsparams;
151
+ }
152
+ }
153
+ function formatFirebirdMetadata(source) {
154
+ if (!source || typeof source !== "object") {
155
+ return "";
156
+ }
157
+ const firebirdSource = source;
158
+ const metadata = [];
159
+ if (typeof firebirdSource.gdscode === "number") {
160
+ metadata.push(`gdscode=${firebirdSource.gdscode}`);
161
+ }
162
+ if (firebirdSource.gdsparams !== undefined) {
163
+ try {
164
+ metadata.push(`gdsparams=${JSON.stringify(firebirdSource.gdsparams)}`);
165
+ }
166
+ catch (_a) {
167
+ metadata.push(`gdsparams=${String(firebirdSource.gdsparams)}`);
168
+ }
169
+ }
170
+ return metadata.length > 0 ? ` Metadata: ${metadata.join(", ")}.` : "";
171
+ }
172
+ function normalizeFirebirdOptions(options) {
173
+ var _a, _b;
174
+ const compatibilityOptions = options;
175
+ const { authPlugins: _authPlugins, compatibilityProbeTimeoutMs: _compatibilityProbeTimeoutMs, compatibilityTotalTimeoutMs, connectTimeoutMs, firebirdDriver: _firebirdDriver } = compatibilityOptions, baseOptions = __rest(compatibilityOptions, ["authPlugins", "compatibilityProbeTimeoutMs", "compatibilityTotalTimeoutMs", "connectTimeoutMs", "firebirdDriver"]);
176
+ const normalizedOptions = Object.assign(Object.assign({}, baseOptions), { pluginName: normalizeAuthPlugin(compatibilityOptions.pluginName), wireCrypt: normalizeWireCryptMode(compatibilityOptions.wireCrypt) });
177
+ const timeoutCandidate = (_b = (_a = compatibilityOptions.connectTimeout) !== null && _a !== void 0 ? _a : connectTimeoutMs) !== null && _b !== void 0 ? _b : compatibilityTotalTimeoutMs;
178
+ if (Number.isFinite(timeoutCandidate) && Number(timeoutCandidate) > 0) {
179
+ normalizedOptions.connectTimeout = Math.trunc(Number(timeoutCandidate));
180
+ }
181
+ return normalizedOptions;
182
+ }
183
+ function describeFirebirdCompatibilityOptions(options) {
184
+ var _a, _b;
185
+ const normalized = normalizeFirebirdOptions(options);
186
+ return `plugin=${(_a = normalized.pluginName) !== null && _a !== void 0 ? _a : "auto"}, wireCrypt=${formatWireCryptValue(normalized.wireCrypt)}, connectTimeout=${(_b = normalized.connectTimeout) !== null && _b !== void 0 ? _b : "default"}`;
187
+ }
188
+ function enhanceFirebirdError(error, options, context) {
189
+ var _a;
190
+ if (error instanceof Error && error.__emilsoftwareFirebirdEnhanced) {
191
+ return error;
192
+ }
193
+ const normalizedOptions = normalizeFirebirdOptions(options);
194
+ const target = formatTarget(normalizedOptions);
195
+ const original = error instanceof Error ? error : new Error(String(error));
196
+ const diagnostics = buildDiagnostics(original.message, normalizedOptions);
197
+ const sqlSuffix = context.sql ? ` SQL: ${context.sql.replace(/\s+/g, " ").trim()}` : "";
198
+ const diagnosticsSuffix = diagnostics.length > 0 ? ` Diagnostics: ${diagnostics.join(" ")}` : "";
199
+ const metadataSuffix = formatFirebirdMetadata(original);
200
+ const enhanced = new Error(`Firebird ${context.stage} failed on ${target}: ${original.message}.${diagnosticsSuffix}${metadataSuffix}${sqlSuffix}`);
201
+ enhanced.cause = original;
202
+ enhanced.__emilsoftwareFirebirdEnhanced = true;
203
+ copyFirebirdMetadata(enhanced, original);
204
+ enhanced.stack = `${enhanced.name}: ${enhanced.message}\nCaused by: ${(_a = original.stack) !== null && _a !== void 0 ? _a : original.message}`;
205
+ return enhanced;
206
+ }
207
+ function buildFirebirdCompatibilityCandidates(options) {
208
+ return [normalizeFirebirdOptions(options)];
209
+ }
210
+ function shouldRetryFirebirdCompatibility() {
211
+ return false;
212
+ }
213
+ function ensureEsNodeFirebirdCompatibilityPatch() {
214
+ // No-op kept for backward compatibility. The library now relies on the
215
+ // official node-firebird driver, which handles Firebird 2.5+ protocol
216
+ // negotiation natively.
217
+ }
218
+ //# sourceMappingURL=firebird-compat.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"firebird-compat.js","sourceRoot":"","sources":["../src/firebird-compat.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmLA,4DA0BC;AAED,oFAGC;AAED,oDAqBC;AAED,oFAEC;AAED,4EAEC;AAED,wFAIC;AAvPD,wDAA0C;AA6B1C,SAAS,OAAO,CAAC,KAAc;IAC3B,OAAO,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;AACvG,CAAC;AAED,SAAS,sBAAsB,CAAC,KAAmC;IAC/D,IAAI,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACjB,OAAO,SAAS,CAAC;IACrB,CAAC;IAED,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC5B,OAAO,KAAK,CAAC;IACjB,CAAC;IAED,MAAM,UAAU,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IACtD,IAAI,UAAU,KAAK,UAAU,EAAE,CAAC;QAC5B,OAAO,QAAQ,CAAC,kBAAkB,CAAC;IACvC,CAAC;IAED,OAAO,QAAQ,CAAC,iBAAiB,CAAC;AACtC,CAAC;AAED,SAAS,mBAAmB,CAAC,KAAc;IACvC,IAAI,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACjB,OAAO,SAAS,CAAC;IACrB,CAAC;IAED,MAAM,UAAU,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IACtD,IAAI,UAAU,KAAK,QAAQ,IAAI,UAAU,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AAG,GAAG,QAAQ,CAAC,IAAI,KAAK,QAAQ,CAAC,OAAO,gBAAgB,MAAA,QAAQ,CAAC,KAAK,mCAAI,QAAQ,CAAC,OAAO,EAAE,CAAC;IAC3G,OAAO,QAAQ,CAAC;AACpB,CAAC;AAED,SAAgB,oCAAoC,CAAC,OAAgB;IACjE,OAAO,CAAC,wBAAwB,CAAC,OAAO,CAAC,CAAC,CAAC;AAC/C,CAAC;AAED,SAAgB,gCAAgC;IAC5C,OAAO,KAAK,CAAC;AACjB,CAAC;AAED,SAAgB,sCAAsC;IAClD,uEAAuE;IACvE,sEAAsE;IACtE,wBAAwB;AAC5B,CAAC","sourcesContent":["import * as Firebird from \"node-firebird\";\nimport type { Options } from \"node-firebird\";\n\nexport type FirebirdWireCryptMode = \"disabled\" | \"enabled\" | \"required\";\nexport type FirebirdAuthPlugin = \"Legacy_Auth\" | \"Srp\" | \"Srp256\" | \"Srp384\" | \"Srp512\";\nexport type FirebirdDriverStrategy = \"modern\";\n\nexport type FirebirdOptions = Options & {\n wireCrypt?: FirebirdWireCryptMode | number;\n pluginName?: FirebirdAuthPlugin;\n authPlugins?: FirebirdAuthPlugin[];\n connectTimeoutMs?: number;\n compatibilityProbeTimeoutMs?: number;\n compatibilityTotalTimeoutMs?: number;\n firebirdDriver?: FirebirdDriverStrategy;\n};\n\ntype FirebirdErrorContext = {\n stage: \"attach\" | \"query\" | \"execute\" | \"transaction\";\n sql?: string;\n};\n\ntype EnhancedFirebirdError = Error & {\n cause?: unknown;\n gdscode?: number;\n gdsparams?: unknown;\n __emilsoftwareFirebirdEnhanced?: boolean;\n};\n\nfunction isBlank(value: unknown): boolean {\n return value === undefined || value === null || (typeof value === \"string\" && value.trim() === \"\");\n}\n\nfunction normalizeWireCryptMode(value: FirebirdOptions[\"wireCrypt\"]): number | undefined {\n if (isBlank(value)) {\n return undefined;\n }\n\n if (typeof value === \"number\") {\n return value;\n }\n\n const normalized = String(value).trim().toLowerCase();\n if (normalized === \"disabled\") {\n return Firebird.WIRE_CRYPT_DISABLE;\n }\n\n return Firebird.WIRE_CRYPT_ENABLE;\n}\n\nfunction normalizeAuthPlugin(value: unknown): FirebirdAuthPlugin | undefined {\n if (isBlank(value)) {\n return undefined;\n }\n\n const normalized = String(value).trim().toLowerCase();\n if (normalized === \"legacy\" || normalized === \"legacy_auth\") {\n return \"Legacy_Auth\";\n }\n\n if (normalized === \"srp256\") {\n return \"Srp256\";\n }\n\n if (normalized === \"srp384\") {\n return \"Srp384\";\n }\n\n if (normalized === \"srp512\") {\n return \"Srp512\";\n }\n\n return \"Srp\";\n}\n\nfunction formatWireCryptValue(value: FirebirdOptions[\"wireCrypt\"]): string {\n if (isBlank(value)) {\n return \"auto\";\n }\n\n if (typeof value === \"number\") {\n if (value === Firebird.WIRE_CRYPT_DISABLE) {\n return \"disabled\";\n }\n\n if (value === Firebird.WIRE_CRYPT_ENABLE) {\n return \"enabled\";\n }\n\n return String(value);\n }\n\n return String(value);\n}\n\nfunction formatTarget(options: Options): string {\n return `${options.host ?? \"?\"}:${options.port ?? \"?\"} -> ${options.database ?? \"?\"}`;\n}\n\nfunction uniqueDiagnostics(values: string[]): string[] {\n return values.filter((value, index) => values.indexOf(value) === index);\n}\n\nfunction buildDiagnostics(message: string, options: FirebirdOptions): string[] {\n const diagnostics: string[] = [];\n const pluginMismatch = message.match(/Server don't accept plugin\\s*:\\s*([^,]+),\\s*but support\\s*:\\s*(.+)$/i);\n\n if (pluginMismatch) {\n const supportedPlugins = pluginMismatch[2]\n .split(\",\")\n .map((plugin) => plugin.trim())\n .filter((plugin) => plugin.length > 0);\n const supportedMessage = supportedPlugins.length === 1\n ? `The server explicitly reported that only the \"${supportedPlugins[0]}\" authentication plugin is supported.`\n : `The server explicitly reported the supported authentication plugins: ${supportedPlugins.join(\", \")}.`;\n diagnostics.push(supportedMessage);\n }\n\n if (/Incompatible wire encryption levels requested on client and server/i.test(message)) {\n diagnostics.push(\"The server rejected the requested wire encryption mode. Keep wire encryption auto-enabled unless the server is known to allow disabled encryption.\");\n }\n\n if (/No matching plugins on server/i.test(message)) {\n diagnostics.push(\"The server did not find a common authentication plugin with the client configuration.\");\n }\n\n if (/Connection timeout after \\d+ms/i.test(message) || /Timeout during Firebird attach after \\d+ ms/i.test(message)) {\n diagnostics.push(\"The TCP connection was accepted but the Firebird wire-protocol attach did not complete in time.\");\n }\n\n if (options.pluginName) {\n diagnostics.push(`Client authentication plugin was forced to \"${options.pluginName}\". Leave pluginName empty to let the driver auto-negotiate when possible.`);\n }\n\n if (!isBlank(options.wireCrypt)) {\n diagnostics.push(`Client wire encryption was forced to \"${formatWireCryptValue(options.wireCrypt)}\".`);\n }\n\n return uniqueDiagnostics(diagnostics);\n}\n\nfunction copyFirebirdMetadata(target: EnhancedFirebirdError, source: unknown): void {\n if (!source || typeof source !== \"object\") {\n return;\n }\n\n const firebirdSource = source as Record<string, unknown>;\n if (\"gdscode\" in firebirdSource) {\n target.gdscode = firebirdSource.gdscode as number;\n }\n\n if (\"gdsparams\" in firebirdSource) {\n target.gdsparams = firebirdSource.gdsparams;\n }\n}\n\nfunction formatFirebirdMetadata(source: unknown): string {\n if (!source || typeof source !== \"object\") {\n return \"\";\n }\n\n const firebirdSource = source as Record<string, unknown>;\n const metadata: string[] = [];\n\n if (typeof firebirdSource.gdscode === \"number\") {\n metadata.push(`gdscode=${firebirdSource.gdscode}`);\n }\n\n if (firebirdSource.gdsparams !== undefined) {\n try {\n metadata.push(`gdsparams=${JSON.stringify(firebirdSource.gdsparams)}`);\n } catch {\n metadata.push(`gdsparams=${String(firebirdSource.gdsparams)}`);\n }\n }\n\n return metadata.length > 0 ? ` Metadata: ${metadata.join(\", \")}.` : \"\";\n}\n\nexport function normalizeFirebirdOptions(options: Options): FirebirdOptions {\n const compatibilityOptions = options as FirebirdOptions;\n const {\n authPlugins: _authPlugins,\n compatibilityProbeTimeoutMs: _compatibilityProbeTimeoutMs,\n compatibilityTotalTimeoutMs,\n connectTimeoutMs,\n firebirdDriver: _firebirdDriver,\n ...baseOptions\n } = compatibilityOptions;\n\n const normalizedOptions: FirebirdOptions = {\n ...baseOptions,\n pluginName: normalizeAuthPlugin(compatibilityOptions.pluginName),\n wireCrypt: normalizeWireCryptMode(compatibilityOptions.wireCrypt),\n };\n\n const timeoutCandidate = compatibilityOptions.connectTimeout\n ?? connectTimeoutMs\n ?? compatibilityTotalTimeoutMs;\n\n if (Number.isFinite(timeoutCandidate) && Number(timeoutCandidate) > 0) {\n normalizedOptions.connectTimeout = Math.trunc(Number(timeoutCandidate));\n }\n\n return normalizedOptions;\n}\n\nexport function describeFirebirdCompatibilityOptions(options: Options): string {\n const normalized = normalizeFirebirdOptions(options);\n return `plugin=${normalized.pluginName ?? \"auto\"}, wireCrypt=${formatWireCryptValue(normalized.wireCrypt)}, connectTimeout=${normalized.connectTimeout ?? \"default\"}`;\n}\n\nexport function enhanceFirebirdError(error: unknown, options: Options, context: FirebirdErrorContext): Error {\n if (error instanceof Error && (error as EnhancedFirebirdError).__emilsoftwareFirebirdEnhanced) {\n return error;\n }\n\n const normalizedOptions = normalizeFirebirdOptions(options);\n const target = formatTarget(normalizedOptions);\n const original = error instanceof Error ? error : new Error(String(error));\n const diagnostics = buildDiagnostics(original.message, normalizedOptions);\n const sqlSuffix = context.sql ? ` SQL: ${context.sql.replace(/\\s+/g, \" \").trim()}` : \"\";\n const diagnosticsSuffix = diagnostics.length > 0 ? ` Diagnostics: ${diagnostics.join(\" \")}` : \"\";\n const metadataSuffix = formatFirebirdMetadata(original);\n const enhanced = new Error(\n `Firebird ${context.stage} failed on ${target}: ${original.message}.${diagnosticsSuffix}${metadataSuffix}${sqlSuffix}`\n ) as EnhancedFirebirdError;\n\n enhanced.cause = original;\n enhanced.__emilsoftwareFirebirdEnhanced = true;\n copyFirebirdMetadata(enhanced, original);\n enhanced.stack = `${enhanced.name}: ${enhanced.message}\\nCaused by: ${original.stack ?? original.message}`;\n return enhanced;\n}\n\nexport function buildFirebirdCompatibilityCandidates(options: Options): FirebirdOptions[] {\n return [normalizeFirebirdOptions(options)];\n}\n\nexport function shouldRetryFirebirdCompatibility(): boolean {\n return false;\n}\n\nexport function ensureEsNodeFirebirdCompatibilityPatch(): void {\n // No-op kept for backward compatibility. The library now relies on the\n // official node-firebird driver, which handles Firebird 2.5+ protocol\n // negotiation natively.\n}\n"]}
package/dist/index.d.ts CHANGED
@@ -1,10 +1,12 @@
1
1
  import { DatabaseUpdater } from "./DatabaseUpdater";
2
2
  import { ExecutionTimeLogger } from "./ExecutionTimeLogger";
3
+ import * as Firebird from "node-firebird";
3
4
  import { LogLevels, Logger } from "./Logger";
4
5
  import { Orm } from "./Orm";
5
6
  import { DateUtilities, RestUtilities, DatabaseUtilities, StatusCode } from "./Utilities";
6
7
  import { autobind } from "./autobind";
7
8
  import { DocumentGenerator } from "./ContractGenerator";
9
+ import "./firebird-compat";
8
10
  export * from "./Orm";
9
11
  export * from "./Utilities";
10
12
  export * from "./Logger";
@@ -13,9 +15,10 @@ export * from "./ExecutionTimeLogger";
13
15
  export * from "./RoutesLoggerMiddleware";
14
16
  export * from "./ContractGenerator";
15
17
  export * from "./DatabaseUpdater";
18
+ export * from "./firebird-compat";
16
19
  export * from "./accessi-module";
17
20
  export * from "./allegati-module";
18
- export * from "es-node-firebird";
19
- export { autobind, ExecutionTimeLogger, Logger, LogLevels, Orm, DateUtilities, RestUtilities, DatabaseUtilities, DatabaseUpdater, StatusCode, DocumentGenerator };
21
+ export * from "node-firebird";
22
+ export { autobind, ExecutionTimeLogger, Logger, LogLevels, Orm, DateUtilities, RestUtilities, DatabaseUtilities, DatabaseUpdater, StatusCode, DocumentGenerator, Firebird };
20
23
  export * from "./swagger/SwaggerConfig";
21
24
  export * from "./initEmilsoftwareModule";
package/dist/index.js CHANGED
@@ -10,15 +10,39 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
10
10
  if (k2 === undefined) k2 = k;
11
11
  o[k2] = m[k];
12
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
+ })();
13
35
  var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
36
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
37
  };
16
38
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.DocumentGenerator = exports.StatusCode = exports.DatabaseUpdater = exports.DatabaseUtilities = exports.RestUtilities = exports.DateUtilities = exports.Orm = exports.LogLevels = exports.Logger = exports.ExecutionTimeLogger = exports.autobind = void 0;
39
+ exports.Firebird = exports.DocumentGenerator = exports.StatusCode = exports.DatabaseUpdater = exports.DatabaseUtilities = exports.RestUtilities = exports.DateUtilities = exports.Orm = exports.LogLevels = exports.Logger = exports.ExecutionTimeLogger = exports.autobind = void 0;
18
40
  const DatabaseUpdater_1 = require("./DatabaseUpdater");
19
41
  Object.defineProperty(exports, "DatabaseUpdater", { enumerable: true, get: function () { return DatabaseUpdater_1.DatabaseUpdater; } });
20
42
  const ExecutionTimeLogger_1 = require("./ExecutionTimeLogger");
21
43
  Object.defineProperty(exports, "ExecutionTimeLogger", { enumerable: true, get: function () { return ExecutionTimeLogger_1.ExecutionTimeLogger; } });
44
+ const Firebird = __importStar(require("node-firebird"));
45
+ exports.Firebird = Firebird;
22
46
  const Logger_1 = require("./Logger");
23
47
  Object.defineProperty(exports, "LogLevels", { enumerable: true, get: function () { return Logger_1.LogLevels; } });
24
48
  Object.defineProperty(exports, "Logger", { enumerable: true, get: function () { return Logger_1.Logger; } });
@@ -33,6 +57,7 @@ const autobind_1 = require("./autobind");
33
57
  Object.defineProperty(exports, "autobind", { enumerable: true, get: function () { return autobind_1.autobind; } });
34
58
  const ContractGenerator_1 = require("./ContractGenerator");
35
59
  Object.defineProperty(exports, "DocumentGenerator", { enumerable: true, get: function () { return ContractGenerator_1.DocumentGenerator; } });
60
+ require("./firebird-compat");
36
61
  __exportStar(require("./Orm"), exports);
37
62
  __exportStar(require("./Utilities"), exports);
38
63
  __exportStar(require("./Logger"), exports);
@@ -41,9 +66,10 @@ __exportStar(require("./ExecutionTimeLogger"), exports);
41
66
  __exportStar(require("./RoutesLoggerMiddleware"), exports);
42
67
  __exportStar(require("./ContractGenerator"), exports);
43
68
  __exportStar(require("./DatabaseUpdater"), exports);
69
+ __exportStar(require("./firebird-compat"), exports);
44
70
  __exportStar(require("./accessi-module"), exports);
45
71
  __exportStar(require("./allegati-module"), exports);
46
- __exportStar(require("es-node-firebird"), exports);
72
+ __exportStar(require("node-firebird"), exports);
47
73
  // Unified module exports
48
74
  __exportStar(require("./swagger/SwaggerConfig"), exports);
49
75
  __exportStar(require("./initEmilsoftwareModule"), exports);
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,uDAAoD;AAoB6D,gGApBxG,iCAAe,OAoBwG;AAnBhI,+DAA2D;AAmBxC,oGAnBV,yCAAmB,OAmBU;AAlBtC,qCAA6C;AAkBG,0FAlBvC,kBAAS,OAkBuC;AAAjB,uFAlBpB,eAAM,OAkBoB;AAjB9C,+BAA4B;AAiB+B,oFAjBlD,SAAG,OAiBkD;AAhB9D,2CAA0F;AAgB1B,8FAhBvD,yBAAa,OAgBuD;AAAE,8FAhBvD,yBAAa,OAgBuD;AAAE,kGAhBvD,6BAAiB,OAgBuD;AAAmB,2FAhBxE,sBAAU,OAgBwE;AAf5I,yCAAsC;AAe7B,yFAfA,mBAAQ,OAeA;AAdjB,2DAAwD;AAcsF,kGAdrI,qCAAiB,OAcqI;AAZ/J,wCAAsB;AACtB,8CAA4B;AAC5B,2CAAyB;AACzB,6CAA2B;AAC3B,wDAAsC;AACtC,2DAAyC;AACzC,sDAAoC;AACpC,oDAAkC;AAElC,mDAAiC;AACjC,oDAAkC;AAClC,mDAAiC;AAEjC,yBAAyB;AACzB,0DAAwC;AACxC,2DAAyC","sourcesContent":["import { DatabaseUpdater } from \"./DatabaseUpdater\";\nimport { ExecutionTimeLogger } from \"./ExecutionTimeLogger\"\nimport { LogLevels, Logger } from \"./Logger\";\nimport { Orm } from \"./Orm\";\nimport { DateUtilities, RestUtilities, DatabaseUtilities, StatusCode } from \"./Utilities\";\nimport { autobind } from \"./autobind\";\nimport { DocumentGenerator } from \"./ContractGenerator\";\n\nexport * from \"./Orm\";\nexport * from \"./Utilities\";\nexport * from \"./Logger\";\nexport * from \"./autobind\";\nexport * from \"./ExecutionTimeLogger\";\nexport * from \"./RoutesLoggerMiddleware\";\nexport * from \"./ContractGenerator\";\nexport * from \"./DatabaseUpdater\";\n\nexport * from \"./accessi-module\";\nexport * from \"./allegati-module\";\nexport * from \"es-node-firebird\";\nexport { autobind, ExecutionTimeLogger, Logger, LogLevels, Orm, DateUtilities, RestUtilities, DatabaseUtilities, DatabaseUpdater, StatusCode, DocumentGenerator };\n// Unified module exports\nexport * from \"./swagger/SwaggerConfig\";\nexport * from \"./initEmilsoftwareModule\";"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uDAAoD;AAuB6D,gGAvBxG,iCAAe,OAuBwG;AAtBhI,+DAA2D;AAsBxC,oGAtBV,yCAAmB,OAsBU;AArBtC,wDAA0C;AAqBuH,4BAAQ;AApBzK,qCAA6C;AAoBG,0FApBvC,kBAAS,OAoBuC;AAAjB,uFApBpB,eAAM,OAoBoB;AAnB9C,+BAA4B;AAmB+B,oFAnBlD,SAAG,OAmBkD;AAlB9D,2CAA0F;AAkB1B,8FAlBvD,yBAAa,OAkBuD;AAAE,8FAlBvD,yBAAa,OAkBuD;AAAE,kGAlBvD,6BAAiB,OAkBuD;AAAmB,2FAlBxE,sBAAU,OAkBwE;AAjB5I,yCAAsC;AAiB7B,yFAjBA,mBAAQ,OAiBA;AAhBjB,2DAAwD;AAgBsF,kGAhBrI,qCAAiB,OAgBqI;AAf/J,6BAA2B;AAE3B,wCAAsB;AACtB,8CAA4B;AAC5B,2CAAyB;AACzB,6CAA2B;AAC3B,wDAAsC;AACtC,2DAAyC;AACzC,sDAAoC;AACpC,oDAAkC;AAClC,oDAAkC;AAElC,mDAAiC;AACjC,oDAAkC;AAClC,gDAA8B;AAE9B,yBAAyB;AACzB,0DAAwC;AACxC,2DAAyC","sourcesContent":["import { DatabaseUpdater } from \"./DatabaseUpdater\";\nimport { ExecutionTimeLogger } from \"./ExecutionTimeLogger\"\nimport * as Firebird from \"node-firebird\";\nimport { LogLevels, Logger } from \"./Logger\";\nimport { Orm } from \"./Orm\";\nimport { DateUtilities, RestUtilities, DatabaseUtilities, StatusCode } from \"./Utilities\";\nimport { autobind } from \"./autobind\";\nimport { DocumentGenerator } from \"./ContractGenerator\";\nimport \"./firebird-compat\";\n\nexport * from \"./Orm\";\nexport * from \"./Utilities\";\nexport * from \"./Logger\";\nexport * from \"./autobind\";\nexport * from \"./ExecutionTimeLogger\";\nexport * from \"./RoutesLoggerMiddleware\";\nexport * from \"./ContractGenerator\";\nexport * from \"./DatabaseUpdater\";\nexport * from \"./firebird-compat\";\n\nexport * from \"./accessi-module\";\nexport * from \"./allegati-module\";\nexport * from \"node-firebird\";\nexport { autobind, ExecutionTimeLogger, Logger, LogLevels, Orm, DateUtilities, RestUtilities, DatabaseUtilities, DatabaseUpdater, StatusCode, DocumentGenerator, Firebird };\n// Unified module exports\nexport * from \"./swagger/SwaggerConfig\";\nexport * from \"./initEmilsoftwareModule\";\n"]}
@@ -1,2 +1,7 @@
1
1
  import { INestApplication } from "@nestjs/common";
2
- export declare function setupSwagger(app: INestApplication): void;
2
+ export type SwaggerSetupOptions = {
3
+ swaggerPath?: string;
4
+ title?: string;
5
+ description?: string;
6
+ };
7
+ export declare function setupSwagger(app: INestApplication, options?: SwaggerSetupOptions): void;
@@ -3,14 +3,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.setupSwagger = setupSwagger;
4
4
  const swagger_1 = require("@nestjs/swagger");
5
5
  const Logger_1 = require("../Logger");
6
- function setupSwagger(app) {
7
- var _a, _b;
6
+ function setupSwagger(app, options) {
7
+ var _a, _b, _c, _d, _e;
8
8
  const logger = new Logger_1.Logger("SwaggerConfig");
9
- const swaggerPath = "swagger";
9
+ const swaggerPath = (_a = options === null || options === void 0 ? void 0 : options.swaggerPath) !== null && _a !== void 0 ? _a : "swagger";
10
10
  const swaggerJsonPath = `${swaggerPath}-json`;
11
11
  const config = new swagger_1.DocumentBuilder()
12
- .setTitle("API Documentation")
13
- .setDescription("API per la gestione di accessi utenti e allegati")
12
+ .setTitle((_b = options === null || options === void 0 ? void 0 : options.title) !== null && _b !== void 0 ? _b : "API Documentation")
13
+ .setDescription((_c = options === null || options === void 0 ? void 0 : options.description) !== null && _c !== void 0 ? _c : "API per la gestione di accessi utenti e allegati")
14
14
  .setVersion("1.0")
15
15
  .addBearerAuth() // Per abilitare l'autenticazione JWT
16
16
  .build();
@@ -20,7 +20,7 @@ function setupSwagger(app) {
20
20
  res.setHeader("Content-Type", "application/json");
21
21
  res.send(document);
22
22
  });
23
- let port = ((_b = (_a = app.getHttpServer()) === null || _a === void 0 ? void 0 : _a.address) === null || _b === void 0 ? void 0 : _b.port) || 3000;
23
+ let port = ((_e = (_d = app.getHttpServer()) === null || _d === void 0 ? void 0 : _d.address) === null || _e === void 0 ? void 0 : _e.port) || 3000;
24
24
  logger.info(`Swagger documentation available at: http://localhost:${port}/${swaggerPath}`);
25
25
  }
26
26
  //# sourceMappingURL=SwaggerConfig.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SwaggerConfig.js","sourceRoot":"","sources":["../../src/swagger/SwaggerConfig.ts"],"names":[],"mappings":";;AAIA,oCAyBC;AA5BD,6CAAiE;AACjE,sCAAmC;AAEnC,SAAgB,YAAY,CAAC,GAAqB;;IAC9C,MAAM,MAAM,GAAW,IAAI,eAAM,CAAC,eAAe,CAAC,CAAC;IACnD,MAAM,WAAW,GAAG,SAAS,CAAC;IAC9B,MAAM,eAAe,GAAG,GAAG,WAAW,OAAO,CAAC;IAE9C,MAAM,MAAM,GAAG,IAAI,yBAAe,EAAE;SAC/B,QAAQ,CAAC,mBAAmB,CAAC;SAC7B,cAAc,CAAC,kDAAkD,CAAC;SAClE,UAAU,CAAC,KAAK,CAAC;SACjB,aAAa,EAAE,CAAC,qCAAqC;SACrD,KAAK,EAAE,CAAC;IAEb,MAAM,QAAQ,GAAG,uBAAa,CAAC,cAAc,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;IAC3D,uBAAa,CAAC,KAAK,CAAC,WAAW,EAAE,GAAG,EAAE,QAAQ,CAAC,CAAC;IAEhD,GAAG,CAAC,GAAG,CAAC,IAAI,eAAe,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,EAAE;QACtC,GAAG,CAAC,SAAS,CAAC,cAAc,EAAE,kBAAkB,CAAC,CAAC;QAClD,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACvB,CAAC,CAAC,CAAC;IAEH,IAAI,IAAI,GAAG,CAAA,MAAA,MAAA,GAAG,CAAC,aAAa,EAAE,0CAAE,OAAO,0CAAE,IAAI,KAAI,IAAI,CAAC;IAEtD,MAAM,CAAC,IAAI,CACP,wDAAwD,IAAI,IAAI,WAAW,EAAE,CAChF,CAAC;AACN,CAAC","sourcesContent":["import { INestApplication } from \"@nestjs/common\";\nimport { DocumentBuilder, SwaggerModule } from \"@nestjs/swagger\";\nimport { Logger } from \"../Logger\";\n\nexport function setupSwagger(app: INestApplication) {\n const logger: Logger = new Logger(\"SwaggerConfig\");\n const swaggerPath = \"swagger\";\n const swaggerJsonPath = `${swaggerPath}-json`;\n\n const config = new DocumentBuilder()\n .setTitle(\"API Documentation\")\n .setDescription(\"API per la gestione di accessi utenti e allegati\")\n .setVersion(\"1.0\")\n .addBearerAuth() // Per abilitare l'autenticazione JWT\n .build();\n\n const document = SwaggerModule.createDocument(app, config);\n SwaggerModule.setup(swaggerPath, app, document);\n\n app.use(`/${swaggerJsonPath}`, (_, res) => {\n res.setHeader(\"Content-Type\", \"application/json\");\n res.send(document);\n });\n\n let port = app.getHttpServer()?.address?.port || 3000;\n\n logger.info(\n `Swagger documentation available at: http://localhost:${port}/${swaggerPath}`\n );\n} "]}
1
+ {"version":3,"file":"SwaggerConfig.js","sourceRoot":"","sources":["../../src/swagger/SwaggerConfig.ts"],"names":[],"mappings":";;AAUA,oCAyBC;AAlCD,6CAAiE;AACjE,sCAAmC;AAQnC,SAAgB,YAAY,CAAC,GAAqB,EAAE,OAA6B;;IAC7E,MAAM,MAAM,GAAW,IAAI,eAAM,CAAC,eAAe,CAAC,CAAC;IACnD,MAAM,WAAW,GAAG,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,WAAW,mCAAI,SAAS,CAAC;IACtD,MAAM,eAAe,GAAG,GAAG,WAAW,OAAO,CAAC;IAE9C,MAAM,MAAM,GAAG,IAAI,yBAAe,EAAE;SAC/B,QAAQ,CAAC,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,KAAK,mCAAI,mBAAmB,CAAC;SAC/C,cAAc,CAAC,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,WAAW,mCAAI,kDAAkD,CAAC;SAC1F,UAAU,CAAC,KAAK,CAAC;SACjB,aAAa,EAAE,CAAC,qCAAqC;SACrD,KAAK,EAAE,CAAC;IAEb,MAAM,QAAQ,GAAG,uBAAa,CAAC,cAAc,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;IAC3D,uBAAa,CAAC,KAAK,CAAC,WAAW,EAAE,GAAG,EAAE,QAAQ,CAAC,CAAC;IAEhD,GAAG,CAAC,GAAG,CAAC,IAAI,eAAe,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,EAAE;QACtC,GAAG,CAAC,SAAS,CAAC,cAAc,EAAE,kBAAkB,CAAC,CAAC;QAClD,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACvB,CAAC,CAAC,CAAC;IAEH,IAAI,IAAI,GAAG,CAAA,MAAA,MAAA,GAAG,CAAC,aAAa,EAAE,0CAAE,OAAO,0CAAE,IAAI,KAAI,IAAI,CAAC;IAEtD,MAAM,CAAC,IAAI,CACP,wDAAwD,IAAI,IAAI,WAAW,EAAE,CAChF,CAAC;AACN,CAAC","sourcesContent":["import { INestApplication } from \"@nestjs/common\";\nimport { DocumentBuilder, SwaggerModule } from \"@nestjs/swagger\";\nimport { Logger } from \"../Logger\";\n\nexport type SwaggerSetupOptions = {\n swaggerPath?: string;\n title?: string;\n description?: string;\n};\n\nexport function setupSwagger(app: INestApplication, options?: SwaggerSetupOptions) {\n const logger: Logger = new Logger(\"SwaggerConfig\");\n const swaggerPath = options?.swaggerPath ?? \"swagger\";\n const swaggerJsonPath = `${swaggerPath}-json`;\n\n const config = new DocumentBuilder()\n .setTitle(options?.title ?? \"API Documentation\")\n .setDescription(options?.description ?? \"API per la gestione di accessi utenti e allegati\")\n .setVersion(\"1.0\")\n .addBearerAuth() // Per abilitare l'autenticazione JWT\n .build();\n\n const document = SwaggerModule.createDocument(app, config);\n SwaggerModule.setup(swaggerPath, app, document);\n\n app.use(`/${swaggerJsonPath}`, (_, res) => {\n res.setHeader(\"Content-Type\", \"application/json\");\n res.send(document);\n });\n\n let port = app.getHttpServer()?.address?.port || 3000;\n\n logger.info(\n `Swagger documentation available at: http://localhost:${port}/${swaggerPath}`\n );\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "emilsoftware-utilities",
3
- "version": "2.0.0-dev.1",
3
+ "version": "2.0.0-dev.10",
4
4
  "description": "Utilities for EmilSoftware",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
@@ -37,12 +37,12 @@
37
37
  "class-transformer": "^0.5.1",
38
38
  "class-validator": "^0.14.1",
39
39
  "colorette": "^2.0.20",
40
- "es-node-firebird": "^1.2.9",
41
40
  "jsonwebtoken": "^9.0.2",
42
41
  "jspdf": "^3.0.0",
43
42
  "jspdf-autotable": "^5.0.2",
44
43
  "multer": "^1.4.5-lts.2",
45
44
  "node-fetch": "^3.3.2",
45
+ "node-firebird": "^2.15.0",
46
46
  "nodemailer": "^6.10.0",
47
47
  "reflect-metadata": "^0.2.2",
48
48
  "swagger-jsdoc": "^6.2.8",