elseware-nodejs 1.7.8 → 1.7.9
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/index.cjs +4 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -14
- package/dist/index.d.ts +5 -14
- package/dist/index.js +4 -13
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as express from 'express';
|
|
2
2
|
import { Request, Response, NextFunction } from 'express';
|
|
3
3
|
import { Model, PopulateOptions, Query } from 'mongoose';
|
|
4
|
-
import {
|
|
4
|
+
import { ZodSchema } from 'zod';
|
|
5
5
|
import { CorsOptions } from 'cors';
|
|
6
6
|
import { Schema } from 'joi';
|
|
7
7
|
import { SignOptions, JwtPayload } from 'jsonwebtoken';
|
|
@@ -76,19 +76,10 @@ interface DatabaseConfig {
|
|
|
76
76
|
}
|
|
77
77
|
declare function connectMongoDB(config: DatabaseConfig): Promise<void>;
|
|
78
78
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
schema: TSchema;
|
|
84
|
-
}): infer<TSchema>;
|
|
85
|
-
/**
|
|
86
|
-
* Overload 2: With transform → return transformed type
|
|
87
|
-
*/
|
|
88
|
-
declare function loadEnv<TSchema extends ZodTypeAny, TConfig>(options: {
|
|
89
|
-
schema: TSchema;
|
|
90
|
-
transform: (env: infer<TSchema>) => TConfig;
|
|
91
|
-
}): TConfig;
|
|
79
|
+
declare function loadEnv(options: {
|
|
80
|
+
schema: ZodSchema;
|
|
81
|
+
transform?: (env: any) => any;
|
|
82
|
+
}): any;
|
|
92
83
|
|
|
93
84
|
interface LoggerOptions {
|
|
94
85
|
timestamp?: boolean;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as express from 'express';
|
|
2
2
|
import { Request, Response, NextFunction } from 'express';
|
|
3
3
|
import { Model, PopulateOptions, Query } from 'mongoose';
|
|
4
|
-
import {
|
|
4
|
+
import { ZodSchema } from 'zod';
|
|
5
5
|
import { CorsOptions } from 'cors';
|
|
6
6
|
import { Schema } from 'joi';
|
|
7
7
|
import { SignOptions, JwtPayload } from 'jsonwebtoken';
|
|
@@ -76,19 +76,10 @@ interface DatabaseConfig {
|
|
|
76
76
|
}
|
|
77
77
|
declare function connectMongoDB(config: DatabaseConfig): Promise<void>;
|
|
78
78
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
schema: TSchema;
|
|
84
|
-
}): infer<TSchema>;
|
|
85
|
-
/**
|
|
86
|
-
* Overload 2: With transform → return transformed type
|
|
87
|
-
*/
|
|
88
|
-
declare function loadEnv<TSchema extends ZodTypeAny, TConfig>(options: {
|
|
89
|
-
schema: TSchema;
|
|
90
|
-
transform: (env: infer<TSchema>) => TConfig;
|
|
91
|
-
}): TConfig;
|
|
79
|
+
declare function loadEnv(options: {
|
|
80
|
+
schema: ZodSchema;
|
|
81
|
+
transform?: (env: any) => any;
|
|
82
|
+
}): any;
|
|
92
83
|
|
|
93
84
|
interface LoggerOptions {
|
|
94
85
|
timestamp?: boolean;
|
package/dist/index.js
CHANGED
|
@@ -332,29 +332,20 @@ function loadEnv(options) {
|
|
|
332
332
|
return options.transform ? options.transform(result.data) : result.data;
|
|
333
333
|
}
|
|
334
334
|
function handleError(error) {
|
|
335
|
-
logger.danger("
|
|
335
|
+
logger.danger("ENV VALIDATION FAILED");
|
|
336
336
|
const grouped = {};
|
|
337
337
|
error.issues.forEach((err) => {
|
|
338
338
|
const key = err.path.join(".") || "unknown";
|
|
339
|
-
const rawValue = key !== "unknown" ? process.env[key] : void 0;
|
|
340
|
-
const isSecret = key.toLowerCase().includes("secret");
|
|
341
|
-
const safeValue = isSecret ? "***" : rawValue;
|
|
342
|
-
const messageParts = [
|
|
343
|
-
`message: ${err.message}`,
|
|
344
|
-
`code: ${err.code}`,
|
|
345
|
-
rawValue !== void 0 ? `value: ${JSON.stringify(safeValue)}` : null
|
|
346
|
-
].filter(Boolean);
|
|
347
|
-
const fullMessage = messageParts.join(" | ");
|
|
348
339
|
if (!grouped[key]) grouped[key] = [];
|
|
349
|
-
grouped[key].push(
|
|
340
|
+
grouped[key].push(err.message);
|
|
350
341
|
});
|
|
351
342
|
Object.entries(grouped).forEach(([key, messages]) => {
|
|
352
343
|
logger.info(`${key}`);
|
|
353
344
|
messages.forEach((msg) => {
|
|
354
|
-
logger.log(
|
|
345
|
+
logger.log(`${msg}`);
|
|
355
346
|
});
|
|
356
347
|
});
|
|
357
|
-
logger.danger("Application startup aborted
|
|
348
|
+
logger.danger("Application startup aborted.\n");
|
|
358
349
|
process.exit(1);
|
|
359
350
|
}
|
|
360
351
|
|