@armi-wave/common 1.23.7 → 1.23.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/build/index.d.ts CHANGED
@@ -17,4 +17,4 @@ export * from './middlewares/error-handler';
17
17
  export * from './middlewares/require-auth';
18
18
  export * from './middlewares/validate-request';
19
19
  export { minioClient, ensureBucketExists } from './utils/minioClient';
20
- export { upload } from './utils/multerConfig';
20
+ export { upload, MulterRequest } from './utils/multerConfig';
@@ -1,3 +1,7 @@
1
1
  import multer from 'multer';
2
+ import { Request } from 'express';
3
+ interface MulterRequest extends Request {
4
+ file?: Express.Multer.File;
5
+ }
2
6
  declare const upload: multer.Multer;
3
- export { upload };
7
+ export { upload, MulterRequest };
@@ -7,18 +7,19 @@ exports.upload = void 0;
7
7
  const multer_1 = __importDefault(require("multer"));
8
8
  // Use memory storage to avoid saving files locally
9
9
  const storage = multer_1.default.memoryStorage();
10
- // Set up multer with memory storage
10
+ // File filter function with proper TypeScript typing
11
+ const fileFilter = (req, file, cb) => {
12
+ if (file.mimetype.startsWith('image/')) {
13
+ cb(null, true); // Accept only image files
14
+ }
15
+ else {
16
+ cb(new Error('Invalid file type. Only images are allowed.'));
17
+ }
18
+ };
19
+ // Set up multer with memory storage and proper TypeScript typing
11
20
  const upload = (0, multer_1.default)({
12
- storage: storage,
21
+ storage,
13
22
  limits: { fileSize: 10 * 1024 * 1024 }, // Max file size: 10MB
14
- fileFilter: (req, file, cb) => {
15
- if (file.mimetype.startsWith('image/')) {
16
- // Accept only image files
17
- cb(null, true);
18
- }
19
- else {
20
- cb(new Error('Invalid file type. Only images are allowed.'));
21
- }
22
- },
23
+ fileFilter,
23
24
  });
24
25
  exports.upload = upload;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@armi-wave/common",
3
- "version": "1.23.7",
3
+ "version": "1.23.9",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",