emilsoftware-utilities 2.0.0-dev.1 → 2.0.0-dev.11
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/dist/DatabaseUpdater.d.ts +1 -1
- package/dist/DatabaseUpdater.js.map +1 -1
- package/dist/Orm.d.ts +5 -1
- package/dist/Orm.js +147 -78
- package/dist/Orm.js.map +1 -1
- package/dist/Utilities.d.ts +2 -2
- package/dist/Utilities.js +2 -0
- package/dist/Utilities.js.map +1 -1
- package/dist/accessi-module/AccessiModule.d.ts +1 -1
- package/dist/accessi-module/AccessiModule.js.map +1 -1
- package/dist/accessi-module/Controllers/AuthController.d.ts +4 -4
- package/dist/accessi-module/Controllers/AuthController.js +43 -33
- package/dist/accessi-module/Controllers/AuthController.js.map +1 -1
- package/dist/accessi-module/Controllers/ConfiguratorController.js +16 -14
- package/dist/accessi-module/Controllers/ConfiguratorController.js.map +1 -1
- package/dist/accessi-module/Controllers/EmailController.d.ts +2 -4
- package/dist/accessi-module/Controllers/EmailController.js +8 -12
- package/dist/accessi-module/Controllers/EmailController.js.map +1 -1
- package/dist/accessi-module/Controllers/FiltriController.js +29 -0
- package/dist/accessi-module/Controllers/FiltriController.js.map +1 -1
- package/dist/accessi-module/Controllers/PermissionController.js +27 -25
- package/dist/accessi-module/Controllers/PermissionController.js.map +1 -1
- package/dist/accessi-module/Controllers/UserController.d.ts +2 -2
- package/dist/accessi-module/Controllers/UserController.js +30 -12
- package/dist/accessi-module/Controllers/UserController.js.map +1 -1
- package/dist/accessi-module/Dtos/AuthenticatedUserPayloadDto.d.ts +10 -0
- package/dist/accessi-module/Dtos/AuthenticatedUserPayloadDto.js +52 -0
- package/dist/accessi-module/Dtos/AuthenticatedUserPayloadDto.js.map +1 -0
- package/dist/accessi-module/Dtos/BaseResponse.d.ts +20 -0
- package/dist/accessi-module/Dtos/BaseResponse.js +87 -1
- package/dist/accessi-module/Dtos/BaseResponse.js.map +1 -1
- package/dist/accessi-module/Dtos/ConfirmResetPasswordRequest.d.ts +3 -0
- package/dist/accessi-module/Dtos/ConfirmResetPasswordRequest.js +31 -0
- package/dist/accessi-module/Dtos/ConfirmResetPasswordRequest.js.map +1 -0
- package/dist/accessi-module/Dtos/GetUserByTokenRequest.d.ts +3 -0
- package/dist/accessi-module/Dtos/GetUserByTokenRequest.js +26 -0
- package/dist/accessi-module/Dtos/GetUserByTokenRequest.js.map +1 -0
- package/dist/accessi-module/Dtos/GetUserByTokenResponse.d.ts +5 -0
- package/dist/accessi-module/Dtos/GetUserByTokenResponse.js +27 -0
- package/dist/accessi-module/Dtos/GetUserByTokenResponse.js.map +1 -0
- package/dist/accessi-module/Dtos/PublicRegisterRequest.d.ts +5 -0
- package/dist/accessi-module/Dtos/PublicRegisterRequest.js +14 -0
- package/dist/accessi-module/Dtos/PublicRegisterRequest.js.map +1 -0
- package/dist/accessi-module/Dtos/RegisterRequest.js +4 -0
- package/dist/accessi-module/Dtos/RegisterRequest.js.map +1 -1
- package/dist/accessi-module/Dtos/RegisterResponse.d.ts +1 -1
- package/dist/accessi-module/Dtos/RegisterResponse.js +3 -3
- package/dist/accessi-module/Dtos/RegisterResponse.js.map +1 -1
- package/dist/accessi-module/Dtos/SendResetPasswordEmailRequest.d.ts +4 -0
- package/dist/accessi-module/Dtos/SendResetPasswordEmailRequest.js +36 -0
- package/dist/accessi-module/Dtos/SendResetPasswordEmailRequest.js.map +1 -0
- package/dist/accessi-module/Dtos/UserDto.js +5 -1
- package/dist/accessi-module/Dtos/UserDto.js.map +1 -1
- package/dist/accessi-module/Dtos/UserGrantsResponse.d.ts +5 -0
- package/dist/accessi-module/Dtos/UserGrantsResponse.js +27 -0
- package/dist/accessi-module/Dtos/UserGrantsResponse.js.map +1 -0
- package/dist/accessi-module/Dtos/index.d.ts +7 -0
- package/dist/accessi-module/Dtos/index.js +7 -0
- package/dist/accessi-module/Dtos/index.js.map +1 -1
- package/dist/accessi-module/Services/AuthService/AuthService.d.ts +1 -0
- package/dist/accessi-module/Services/AuthService/AuthService.js +12 -2
- package/dist/accessi-module/Services/AuthService/AuthService.js.map +1 -1
- package/dist/accessi-module/Services/FiltriService/FiltriService.js +0 -7
- package/dist/accessi-module/Services/FiltriService/FiltriService.js.map +1 -1
- package/dist/accessi-module/Services/UserService/UserService.js +2 -100
- package/dist/accessi-module/Services/UserService/UserService.js.map +1 -1
- package/dist/accessi-module/database-updates/AccessiDatabaseUpdater.js +9 -0
- package/dist/accessi-module/database-updates/AccessiDatabaseUpdater.js.map +1 -1
- package/dist/accessi-module/index.d.ts +1 -0
- package/dist/accessi-module/index.js +44 -6
- package/dist/accessi-module/index.js.map +1 -1
- package/dist/allegati-module/AllegatiModule.d.ts +1 -1
- package/dist/allegati-module/AllegatiModule.js.map +1 -1
- package/dist/emilsoftware-utilities-2.0.0-dev.11.tgz +0 -0
- package/dist/firebird-compat.d.ts +24 -0
- package/dist/firebird-compat.js +218 -0
- package/dist/firebird-compat.js.map +1 -0
- package/dist/index.d.ts +5 -2
- package/dist/index.js +28 -2
- package/dist/index.js.map +1 -1
- package/dist/swagger/SwaggerConfig.d.ts +7 -1
- package/dist/swagger/SwaggerConfig.js +18 -7
- package/dist/swagger/SwaggerConfig.js.map +1 -1
- package/package.json +2 -2
- package/dist/emilsoftware-utilities-2.0.0-dev.1.tgz +0 -0
|
@@ -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;AA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C5C,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 "
|
|
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("
|
|
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":"
|
|
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,8 @@
|
|
|
1
1
|
import { INestApplication } from "@nestjs/common";
|
|
2
|
-
export
|
|
2
|
+
export type SwaggerSetupOptions = {
|
|
3
|
+
swaggerPath?: string;
|
|
4
|
+
swaggerJsonPath?: string;
|
|
5
|
+
title?: string;
|
|
6
|
+
description?: string;
|
|
7
|
+
};
|
|
8
|
+
export declare function setupSwagger(app: INestApplication, options?: SwaggerSetupOptions): void;
|
|
@@ -3,14 +3,18 @@ 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, _f;
|
|
8
8
|
const logger = new Logger_1.Logger("SwaggerConfig");
|
|
9
|
-
const swaggerPath = "swagger";
|
|
10
|
-
const
|
|
9
|
+
const swaggerPath = (_a = options === null || options === void 0 ? void 0 : options.swaggerPath) !== null && _a !== void 0 ? _a : "swagger";
|
|
10
|
+
const defaultSwaggerJsonPath = swaggerPath.includes("/")
|
|
11
|
+
? `${swaggerPath.substring(0, swaggerPath.lastIndexOf("/") + 1)}swagger.json`
|
|
12
|
+
: "swagger.json";
|
|
13
|
+
const swaggerJsonPath = (_b = options === null || options === void 0 ? void 0 : options.swaggerJsonPath) !== null && _b !== void 0 ? _b : defaultSwaggerJsonPath;
|
|
14
|
+
const legacySwaggerJsonPath = `${swaggerPath}-json`;
|
|
11
15
|
const config = new swagger_1.DocumentBuilder()
|
|
12
|
-
.setTitle("API Documentation")
|
|
13
|
-
.setDescription("API per la gestione di accessi utenti e allegati")
|
|
16
|
+
.setTitle((_c = options === null || options === void 0 ? void 0 : options.title) !== null && _c !== void 0 ? _c : "API Documentation")
|
|
17
|
+
.setDescription((_d = options === null || options === void 0 ? void 0 : options.description) !== null && _d !== void 0 ? _d : "API per la gestione di accessi utenti e allegati")
|
|
14
18
|
.setVersion("1.0")
|
|
15
19
|
.addBearerAuth() // Per abilitare l'autenticazione JWT
|
|
16
20
|
.build();
|
|
@@ -20,7 +24,14 @@ function setupSwagger(app) {
|
|
|
20
24
|
res.setHeader("Content-Type", "application/json");
|
|
21
25
|
res.send(document);
|
|
22
26
|
});
|
|
23
|
-
|
|
27
|
+
if (legacySwaggerJsonPath !== swaggerJsonPath) {
|
|
28
|
+
app.use(`/${legacySwaggerJsonPath}`, (_, res) => {
|
|
29
|
+
res.setHeader("Content-Type", "application/json");
|
|
30
|
+
res.send(document);
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
let port = ((_f = (_e = app.getHttpServer()) === null || _e === void 0 ? void 0 : _e.address) === null || _f === void 0 ? void 0 : _f.port) || 3000;
|
|
24
34
|
logger.info(`Swagger documentation available at: http://localhost:${port}/${swaggerPath}`);
|
|
35
|
+
logger.info(`Swagger OpenAPI JSON available at: http://localhost:${port}/${swaggerJsonPath}`);
|
|
25
36
|
}
|
|
26
37
|
//# sourceMappingURL=SwaggerConfig.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SwaggerConfig.js","sourceRoot":"","sources":["../../src/swagger/SwaggerConfig.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"SwaggerConfig.js","sourceRoot":"","sources":["../../src/swagger/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Ac,EAAE,kBAAkB,CAAC,CAAC;QAClD,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACvB,CAAC,CAAC,CAAC;IAEH,IAAI,qBAAqB,KAAK,eAAe,EAAE,CAAC;QAC5C,GAAG,CAAC,GAAG,CAAC,IAAI,qBAAqB,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,EAAE;YAC5C,GAAG,CAAC,SAAS,CAAC,cAAc,EAAE,kBAAkB,CAAC,CAAC;YAClD,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACvB,CAAC,CAAC,CAAC;IACP,CAAC;IAED,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;IACF,MAAM,CAAC,IAAI,CACP,uDAAuD,IAAI,IAAI,eAAe,EAAE,CACnF,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 swaggerJsonPath?: 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 defaultSwaggerJsonPath = swaggerPath.includes(\"/\")\n ? `${swaggerPath.substring(0, swaggerPath.lastIndexOf(\"/\") + 1)}swagger.json`\n : \"swagger.json\";\n const swaggerJsonPath = options?.swaggerJsonPath ?? defaultSwaggerJsonPath;\n const legacySwaggerJsonPath = `${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 if (legacySwaggerJsonPath !== swaggerJsonPath) {\n app.use(`/${legacySwaggerJsonPath}`, (_, res) => {\n res.setHeader(\"Content-Type\", \"application/json\");\n res.send(document);\n });\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 logger.info(\n `Swagger OpenAPI JSON available at: http://localhost:${port}/${swaggerJsonPath}`\n );\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "emilsoftware-utilities",
|
|
3
|
-
"version": "2.0.0-dev.
|
|
3
|
+
"version": "2.0.0-dev.11",
|
|
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",
|
|
Binary file
|