@flusys/nestjs-storage 9.1.2 → 9.2.0
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/README.md +13 -0
- package/controllers/file-manager.controller.d.ts +1 -0
- package/controllers/folder.controller.d.ts +1 -0
- package/controllers/storage-config.controller.d.ts +1 -0
- package/fesm/493.js +416 -251
- package/fesm/537.js +25 -21
- package/fesm/562.js +184 -172
- package/fesm/chunks/190.js +6 -6
- package/fesm/chunks/252.js +1 -1
- package/fesm/chunks/327.js +1 -1
- package/fesm/chunks/385.js +1 -1
- package/fesm/chunks/591.js +11 -11
- package/fesm/chunks/746.js +1 -1
- package/fesm/chunks/798.js +1 -1
- package/fesm/chunks/918.js +19 -7
- package/fesm/config/index.js +8 -8
- package/fesm/controllers/index.js +1 -1
- package/fesm/docs/index.js +11 -15
- package/fesm/dtos/index.js +24 -20
- package/fesm/entities/index.js +6 -6
- package/fesm/enums/index.js +4 -4
- package/fesm/index.js +30 -34
- package/fesm/interfaces/index.js +2 -2
- package/fesm/modules/index.js +1 -1
- package/fesm/providers/index.js +123 -129
- package/fesm/services/index.js +1 -1
- package/fesm/utils/index.js +88 -84
- package/middlewares/file-serve.middleware.d.ts +3 -1
- package/package.json +3 -3
- package/providers/local-provider.d.ts +2 -0
- package/providers/sftp-provider.optional.d.ts +1 -0
- package/providers/storage-factory.service.d.ts +4 -2
- package/services/file-manager.service.d.ts +5 -6
- package/services/folder.service.d.ts +5 -5
- package/services/storage-provider-config.service.d.ts +5 -2
- package/services/upload.service.d.ts +3 -1
- package/utils/company-ownership.util.d.ts +3 -0
- package/utils/file-validator.util.d.ts +1 -0
package/fesm/chunks/746.js
CHANGED
|
@@ -2,7 +2,7 @@ import * as __rspack_external__azure_storage_blob_23d6f9ca from "@azure/storage-
|
|
|
2
2
|
export const __rspack_esm_id = 746;
|
|
3
3
|
export const __rspack_esm_ids = [746];
|
|
4
4
|
export const __webpack_modules__ = {
|
|
5
|
-
|
|
5
|
+
4737(module) {
|
|
6
6
|
|
|
7
7
|
module.exports = __rspack_external__azure_storage_blob_23d6f9ca;
|
|
8
8
|
|
package/fesm/chunks/798.js
CHANGED
|
@@ -2,7 +2,7 @@ import * as __rspack_external__aws_sdk_client_s3_a2e3616c from "@aws-sdk/client-
|
|
|
2
2
|
export const __rspack_esm_id = 798;
|
|
3
3
|
export const __rspack_esm_ids = [798];
|
|
4
4
|
export const __webpack_modules__ = {
|
|
5
|
-
|
|
5
|
+
2965(module) {
|
|
6
6
|
|
|
7
7
|
module.exports = __rspack_external__aws_sdk_client_s3_a2e3616c;
|
|
8
8
|
|
package/fesm/chunks/918.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
export const __rspack_esm_id = 918;
|
|
2
2
|
export const __rspack_esm_ids = [918];
|
|
3
3
|
export const __webpack_modules__ = {
|
|
4
|
-
|
|
4
|
+
1005(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
5
5
|
__webpack_require__.r(__webpack_exports__);
|
|
6
|
-
/* import */ var _nestjs_common__rspack_import_0 = __webpack_require__(
|
|
7
|
-
/* import */ var _flusys_nestjs_shared_constants__rspack_import_1 = __webpack_require__(
|
|
8
|
-
/* import */ var _utils_image_compressor_util_js__rspack_import_2 = __webpack_require__(
|
|
9
|
-
/* import */ var path__rspack_import_3 = __webpack_require__(
|
|
6
|
+
/* import */ var _nestjs_common__rspack_import_0 = __webpack_require__(6157);
|
|
7
|
+
/* import */ var _flusys_nestjs_shared_constants__rspack_import_1 = __webpack_require__(9140);
|
|
8
|
+
/* import */ var _utils_image_compressor_util_js__rspack_import_2 = __webpack_require__(1872);
|
|
9
|
+
/* import */ var path__rspack_import_3 = __webpack_require__(2521);
|
|
10
10
|
/* import */ var uuid__rspack_import_4 = __webpack_require__(37);
|
|
11
11
|
/**
|
|
12
12
|
* OPTIONAL SFTP Provider
|
|
@@ -40,7 +40,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
40
40
|
*/ async initialize(config) {
|
|
41
41
|
try {
|
|
42
42
|
// Dynamic import - only loads SFTP SDK if this provider is used
|
|
43
|
-
const sftp = await __webpack_require__.e(/* import() */ 385).then(__webpack_require__.bind(__webpack_require__,
|
|
43
|
+
const sftp = await __webpack_require__.e(/* import() */ 385).then(__webpack_require__.bind(__webpack_require__, 2240));
|
|
44
44
|
const SftpClient = sftp.default || sftp;
|
|
45
45
|
this.sftp = new SftpClient();
|
|
46
46
|
this.config = {
|
|
@@ -117,13 +117,25 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
117
117
|
return Promise.all(files.map((file)=>this.uploadFile(file, options)));
|
|
118
118
|
}
|
|
119
119
|
async deleteFile(key) {
|
|
120
|
+
const remotePath = this.resolveWithinBasePath(key);
|
|
120
121
|
await this.connect();
|
|
121
122
|
try {
|
|
122
|
-
await this.sftp.delete(
|
|
123
|
+
await this.sftp.delete(remotePath);
|
|
123
124
|
} catch {
|
|
124
125
|
// Silent failure
|
|
125
126
|
}
|
|
126
127
|
}
|
|
128
|
+
/** Keys are remote paths; one outside basePath could delete anything the SFTP account can reach */ resolveWithinBasePath(key) {
|
|
129
|
+
const base = path__rspack_import_3.posix.normalize(`${this.config.basePath}/`);
|
|
130
|
+
const target = typeof key === 'string' ? path__rspack_import_3.posix.normalize(key) : '';
|
|
131
|
+
if (!target || key.includes('\0') || !target.startsWith(base) || target === base) {
|
|
132
|
+
throw new _nestjs_common__rspack_import_0.BadRequestException({
|
|
133
|
+
message: 'Invalid path: Path traversal attempt detected',
|
|
134
|
+
messageKey: _flusys_nestjs_shared_constants__rspack_import_1.SYSTEM_MESSAGES.PATH_TRAVERSAL_DETECTED
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
return target;
|
|
138
|
+
}
|
|
127
139
|
async deleteMultipleFiles(keys) {
|
|
128
140
|
await Promise.all(keys.map((key)=>this.deleteFile(key)));
|
|
129
141
|
}
|
package/fesm/config/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export const __rspack_esm_id = 565;
|
|
2
2
|
export const __rspack_esm_ids = [565];
|
|
3
3
|
export const __webpack_modules__ = {
|
|
4
|
-
|
|
4
|
+
4884(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
5
5
|
/**
|
|
6
6
|
* Domain event actions published by the storage module, alongside the CRUD
|
|
7
7
|
* lifecycle actions every ApiService emits.
|
|
@@ -25,10 +25,10 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
25
25
|
|
|
26
26
|
|
|
27
27
|
},
|
|
28
|
-
|
|
29
|
-
/* import */ var _event_actions_js__rspack_import_0 = __webpack_require__(
|
|
30
|
-
/* import */ var _message_keys_js__rspack_import_1 = __webpack_require__(
|
|
31
|
-
/* import */ var _storage_constants_js__rspack_import_2 = __webpack_require__(
|
|
28
|
+
2034(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
29
|
+
/* import */ var _event_actions_js__rspack_import_0 = __webpack_require__(4884);
|
|
30
|
+
/* import */ var _message_keys_js__rspack_import_1 = __webpack_require__(5450);
|
|
31
|
+
/* import */ var _storage_constants_js__rspack_import_2 = __webpack_require__(9188);
|
|
32
32
|
|
|
33
33
|
|
|
34
34
|
|
|
@@ -48,7 +48,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
48
48
|
|
|
49
49
|
|
|
50
50
|
},
|
|
51
|
-
|
|
51
|
+
5450(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
52
52
|
// ==================== STORAGE MODULE MESSAGE KEYS ====================
|
|
53
53
|
const FILE_MESSAGES = {
|
|
54
54
|
GET_ALL_SUCCESS: 'file.get.all.success',
|
|
@@ -82,7 +82,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
82
82
|
|
|
83
83
|
|
|
84
84
|
},
|
|
85
|
-
|
|
85
|
+
9188(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
86
86
|
/**
|
|
87
87
|
* Storage Module Constants
|
|
88
88
|
*/ const STORAGE_MODULE_OPTIONS = 'STORAGE_MODULE_OPTIONS';
|
|
@@ -106,7 +106,7 @@ import { __webpack_require__ } from '../runtime.js';
|
|
|
106
106
|
var __webpack_exec__ = function(moduleId) { return __webpack_require__(__webpack_require__.s = moduleId); }
|
|
107
107
|
import * as __rspack_chunk_1 from './index.js';
|
|
108
108
|
__webpack_require__.C(__rspack_chunk_1);
|
|
109
|
-
var __webpack_exports__ = __webpack_exec__(
|
|
109
|
+
var __webpack_exports__ = __webpack_exec__(2034);var __webpack_exports__DEFAULT_ALLOWED_FILE_TYPES = __webpack_exports__.A_;
|
|
110
110
|
var __webpack_exports__DEFAULT_MAX_FILE_SIZE = __webpack_exports__.Sj;
|
|
111
111
|
var __webpack_exports__FILE_MESSAGES = __webpack_exports__.uA;
|
|
112
112
|
var __webpack_exports__FOLDER_MESSAGES = __webpack_exports__.Ee;
|
|
@@ -9,7 +9,7 @@ import * as __rspack_chunk_2 from '../537.js';
|
|
|
9
9
|
__webpack_require__.C(__rspack_chunk_2);
|
|
10
10
|
import * as __rspack_chunk_3 from './index.js';
|
|
11
11
|
__webpack_require__.C(__rspack_chunk_3);
|
|
12
|
-
var __webpack_exports__ = __webpack_exec__(
|
|
12
|
+
var __webpack_exports__ = __webpack_exec__(5488);var __webpack_exports__FileManagerController = __webpack_exports__.AE;
|
|
13
13
|
var __webpack_exports__FolderController = __webpack_exports__.X$;
|
|
14
14
|
var __webpack_exports__StorageConfigController = __webpack_exports__.Iz;
|
|
15
15
|
var __webpack_exports__UploadController = __webpack_exports__.I7;
|
package/fesm/docs/index.js
CHANGED
|
@@ -46,7 +46,7 @@ All queries automatically filter by current user's company context.
|
|
|
46
46
|
|
|
47
47
|
### Upload a File
|
|
48
48
|
|
|
49
|
-
POST /storage/upload/single-file with multipart/form-data containing file and optional
|
|
49
|
+
POST /storage/upload/single-file with multipart/form-data containing \`file\`, and an optional \`folderPath\` query parameter
|
|
50
50
|
|
|
51
51
|
### Get All Files
|
|
52
52
|
|
|
@@ -71,7 +71,7 @@ Complete file storage and management system${enableCompanyFeature ? ' with multi
|
|
|
71
71
|
- Automatic compression and optimization${companyIsolation}
|
|
72
72
|
|
|
73
73
|
### 🗂️ Folder Organization
|
|
74
|
-
- Create
|
|
74
|
+
- Create folders (flat, one level)
|
|
75
75
|
- Organize files by folders${companyPermissions}
|
|
76
76
|
- Automatic context filtering
|
|
77
77
|
|
|
@@ -85,6 +85,7 @@ Complete file storage and management system${enableCompanyFeature ? ' with multi
|
|
|
85
85
|
- JWT authentication required${companyIsolation}
|
|
86
86
|
- File access control
|
|
87
87
|
- Presigned URL generation
|
|
88
|
+
- Locally stored files are served without authentication (GET /storage/upload/file/...) so they work in <img> tags; only files inside the local storage base path are reachable
|
|
88
89
|
|
|
89
90
|
## Storage Providers
|
|
90
91
|
|
|
@@ -111,14 +112,14 @@ ${multiTenantSection}
|
|
|
111
112
|
## File Validation
|
|
112
113
|
|
|
113
114
|
### Size Limits
|
|
114
|
-
Configure maximum file size per upload (default:
|
|
115
|
+
Configure maximum file size per upload (default: 100MB)
|
|
115
116
|
|
|
116
117
|
### File Types
|
|
117
|
-
Restrict allowed file types (default:
|
|
118
|
+
Restrict allowed file types (default: all types). File content is checked against its declared type (magic bytes); HTML, JavaScript and SVG are refused unless listed by their exact type.
|
|
118
119
|
|
|
119
120
|
### Image Compression
|
|
120
121
|
- Automatic image optimization
|
|
121
|
-
- Format conversion (JPEG, PNG, WebP
|
|
122
|
+
- Format conversion (JPEG, PNG, WebP)
|
|
122
123
|
- Resize to maximum dimensions
|
|
123
124
|
- Quality control
|
|
124
125
|
|
|
@@ -132,13 +133,11 @@ Errors return structured responses with success false, error message, error code
|
|
|
132
133
|
|
|
133
134
|
## Common Error Codes
|
|
134
135
|
|
|
135
|
-
- **400 Bad Request**: Invalid input data
|
|
136
|
+
- **400 Bad Request**: Invalid input data, file too large, file type not allowed, or invalid file path
|
|
136
137
|
- **401 Unauthorized**: Missing or invalid authentication
|
|
137
|
-
- **403 Forbidden**: Insufficient permissions
|
|
138
|
-
- **404 Not Found**: Resource not found
|
|
139
|
-
- **
|
|
140
|
-
- **415 Unsupported Media Type**: File type not allowed
|
|
141
|
-
- **500 Internal Server Error**: Server error
|
|
138
|
+
- **403 Forbidden**: Insufficient permissions, or the record belongs to another company
|
|
139
|
+
- **404 Not Found**: Resource or storage configuration not found
|
|
140
|
+
- **500 Internal Server Error**: Server error, or a storage provider whose SDK is not installed
|
|
142
141
|
|
|
143
142
|
## Getting Started
|
|
144
143
|
|
|
@@ -168,10 +167,7 @@ ${examplesSection}
|
|
|
168
167
|
|
|
169
168
|
## Rate Limiting
|
|
170
169
|
|
|
171
|
-
|
|
172
|
-
- **Upload**: 100 requests per hour
|
|
173
|
-
- **Download**: 1000 requests per hour
|
|
174
|
-
- **Delete**: 50 requests per hour
|
|
170
|
+
Rate limits are set by the host application, not by this module.
|
|
175
171
|
`;
|
|
176
172
|
}
|
|
177
173
|
/**
|
package/fesm/dtos/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import * as __rspack_external_class_validator_7b99ef4d from "class-validator";
|
|
|
6
6
|
export const __rspack_esm_id = 685;
|
|
7
7
|
export const __rspack_esm_ids = [685];
|
|
8
8
|
export const __webpack_modules__ = {
|
|
9
|
-
|
|
9
|
+
9775(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
10
10
|
|
|
11
11
|
// EXPORTS
|
|
12
12
|
__webpack_require__.d(__webpack_exports__, {
|
|
@@ -29,11 +29,11 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
29
29
|
});
|
|
30
30
|
|
|
31
31
|
// EXTERNAL MODULE: external "@nestjs/swagger"
|
|
32
|
-
var swagger_ = __webpack_require__(
|
|
32
|
+
var swagger_ = __webpack_require__(6176);
|
|
33
33
|
// EXTERNAL MODULE: external "class-transformer"
|
|
34
|
-
var external_class_transformer_ = __webpack_require__(
|
|
34
|
+
var external_class_transformer_ = __webpack_require__(5812);
|
|
35
35
|
// EXTERNAL MODULE: external "class-validator"
|
|
36
|
-
var external_class_validator_ = __webpack_require__(
|
|
36
|
+
var external_class_validator_ = __webpack_require__(5421);
|
|
37
37
|
;// CONCATENATED MODULE: ./projects/nestjs-storage/src/dtos/folder.dto.ts
|
|
38
38
|
function _ts_decorate(decorators, target, key, desc) {
|
|
39
39
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -66,6 +66,7 @@ _ts_decorate([
|
|
|
66
66
|
}),
|
|
67
67
|
(0,external_class_validator_.IsNotEmpty)(),
|
|
68
68
|
(0,external_class_validator_.IsString)(),
|
|
69
|
+
(0,external_class_validator_.MaxLength)(255),
|
|
69
70
|
_ts_metadata("design:type", String)
|
|
70
71
|
], CreateFolderDto.prototype, "name", void 0);
|
|
71
72
|
class UpdateFolderDto extends (0,swagger_.PartialType)(CreateFolderDto) {
|
|
@@ -111,7 +112,7 @@ _ts_decorate([
|
|
|
111
112
|
], FolderResponseDto.prototype, "slug", void 0);
|
|
112
113
|
|
|
113
114
|
// EXTERNAL MODULE: ./projects/nestjs-storage/src/enums/file-location.enum.ts
|
|
114
|
-
var file_location_enum = __webpack_require__(
|
|
115
|
+
var file_location_enum = __webpack_require__(2733);
|
|
115
116
|
;// CONCATENATED MODULE: ./projects/nestjs-storage/src/dtos/file-manager.dto.ts
|
|
116
117
|
function file_manager_dto_ts_decorate(decorators, target, key, desc) {
|
|
117
118
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -152,6 +153,7 @@ file_manager_dto_ts_decorate([
|
|
|
152
153
|
}),
|
|
153
154
|
(0,external_class_validator_.IsNotEmpty)(),
|
|
154
155
|
(0,external_class_validator_.IsString)(),
|
|
156
|
+
(0,external_class_validator_.MaxLength)(255),
|
|
155
157
|
file_manager_dto_ts_metadata("design:type", String)
|
|
156
158
|
], CreateFileManagerDto.prototype, "name", void 0);
|
|
157
159
|
file_manager_dto_ts_decorate([
|
|
@@ -170,6 +172,7 @@ file_manager_dto_ts_decorate([
|
|
|
170
172
|
}),
|
|
171
173
|
(0,external_class_validator_.IsNotEmpty)(),
|
|
172
174
|
(0,external_class_validator_.IsString)(),
|
|
175
|
+
(0,external_class_validator_.MaxLength)(255),
|
|
173
176
|
file_manager_dto_ts_metadata("design:type", String)
|
|
174
177
|
], CreateFileManagerDto.prototype, "size", void 0);
|
|
175
178
|
file_manager_dto_ts_decorate([
|
|
@@ -179,6 +182,7 @@ file_manager_dto_ts_decorate([
|
|
|
179
182
|
}),
|
|
180
183
|
(0,external_class_validator_.IsNotEmpty)(),
|
|
181
184
|
(0,external_class_validator_.IsString)(),
|
|
185
|
+
(0,external_class_validator_.MaxLength)(255),
|
|
182
186
|
file_manager_dto_ts_metadata("design:type", String)
|
|
183
187
|
], CreateFileManagerDto.prototype, "contentType", void 0);
|
|
184
188
|
file_manager_dto_ts_decorate([
|
|
@@ -401,11 +405,11 @@ file_manager_dto_ts_decorate([
|
|
|
401
405
|
], FilesResponseDto.prototype, "providerName", void 0);
|
|
402
406
|
|
|
403
407
|
// EXTERNAL MODULE: ./projects/nestjs-storage/src/dtos/upload.dto.ts
|
|
404
|
-
var upload_dto = __webpack_require__(
|
|
408
|
+
var upload_dto = __webpack_require__(7322);
|
|
405
409
|
// EXTERNAL MODULE: external "@flusys/nestjs-shared/dtos"
|
|
406
|
-
var dtos_ = __webpack_require__(
|
|
410
|
+
var dtos_ = __webpack_require__(6873);
|
|
407
411
|
// EXTERNAL MODULE: external "@flusys/nestjs-shared/utils"
|
|
408
|
-
var utils_ = __webpack_require__(
|
|
412
|
+
var utils_ = __webpack_require__(9216);
|
|
409
413
|
;// CONCATENATED MODULE: ./projects/nestjs-storage/src/dtos/storage-config.dto.ts
|
|
410
414
|
function storage_config_dto_ts_decorate(decorators, target, key, desc) {
|
|
411
415
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -561,10 +565,10 @@ storage_config_dto_ts_decorate([
|
|
|
561
565
|
|
|
562
566
|
|
|
563
567
|
},
|
|
564
|
-
|
|
565
|
-
/* import */ var _nestjs_swagger__rspack_import_0 = __webpack_require__(
|
|
566
|
-
/* import */ var class_transformer__rspack_import_1 = __webpack_require__(
|
|
567
|
-
/* import */ var class_validator__rspack_import_2 = __webpack_require__(
|
|
568
|
+
7322(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
569
|
+
/* import */ var _nestjs_swagger__rspack_import_0 = __webpack_require__(6176);
|
|
570
|
+
/* import */ var class_transformer__rspack_import_1 = __webpack_require__(5812);
|
|
571
|
+
/* import */ var class_validator__rspack_import_2 = __webpack_require__(5421);
|
|
568
572
|
function _ts_decorate(decorators, target, key, desc) {
|
|
569
573
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
570
574
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
@@ -737,7 +741,7 @@ _ts_decorate([
|
|
|
737
741
|
default: true
|
|
738
742
|
}),
|
|
739
743
|
(0,class_validator__rspack_import_2.IsOptional)(),
|
|
740
|
-
(0,class_transformer__rspack_import_1.
|
|
744
|
+
(0,class_transformer__rspack_import_1.Transform)(({ value })=>value === 'true' ? true : value === 'false' ? false : value),
|
|
741
745
|
(0,class_validator__rspack_import_2.IsBoolean)(),
|
|
742
746
|
_ts_metadata("design:type", Boolean)
|
|
743
747
|
], UploadOptionsDto.prototype, "compress", void 0);
|
|
@@ -809,7 +813,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
809
813
|
|
|
810
814
|
|
|
811
815
|
},
|
|
812
|
-
|
|
816
|
+
2733(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
813
817
|
var FileLocationEnum = /*#__PURE__*/ function(FileLocationEnum) {
|
|
814
818
|
FileLocationEnum["AWS"] = "aws";
|
|
815
819
|
FileLocationEnum["AZURE"] = "azure";
|
|
@@ -824,31 +828,31 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
824
828
|
|
|
825
829
|
|
|
826
830
|
},
|
|
827
|
-
|
|
831
|
+
6873(module) {
|
|
828
832
|
|
|
829
833
|
module.exports = __rspack_external__flusys_nestjs_shared_dtos_c4585026;
|
|
830
834
|
|
|
831
835
|
|
|
832
836
|
},
|
|
833
|
-
|
|
837
|
+
9216(module) {
|
|
834
838
|
|
|
835
839
|
module.exports = __rspack_external__flusys_nestjs_shared_utils_9125c1f1;
|
|
836
840
|
|
|
837
841
|
|
|
838
842
|
},
|
|
839
|
-
|
|
843
|
+
6176(module) {
|
|
840
844
|
|
|
841
845
|
module.exports = __rspack_external__nestjs_swagger_7cd450b5;
|
|
842
846
|
|
|
843
847
|
|
|
844
848
|
},
|
|
845
|
-
|
|
849
|
+
5812(module) {
|
|
846
850
|
|
|
847
851
|
module.exports = __rspack_external_class_transformer_c5a479fb;
|
|
848
852
|
|
|
849
853
|
|
|
850
854
|
},
|
|
851
|
-
|
|
855
|
+
5421(module) {
|
|
852
856
|
|
|
853
857
|
module.exports = __rspack_external_class_validator_7b99ef4d;
|
|
854
858
|
|
|
@@ -860,7 +864,7 @@ import { __webpack_require__ } from '../runtime.js';
|
|
|
860
864
|
var __webpack_exec__ = function(moduleId) { return __webpack_require__(__webpack_require__.s = moduleId); }
|
|
861
865
|
import * as __rspack_chunk_1 from './index.js';
|
|
862
866
|
__webpack_require__.C(__rspack_chunk_1);
|
|
863
|
-
var __webpack_exports__ = __webpack_exec__(
|
|
867
|
+
var __webpack_exports__ = __webpack_exec__(9775);var __webpack_exports__CreateFileManagerDto = __webpack_exports__.rY;
|
|
864
868
|
var __webpack_exports__CreateFolderDto = __webpack_exports__._5;
|
|
865
869
|
var __webpack_exports__CreateStorageConfigDto = __webpack_exports__.rb;
|
|
866
870
|
var __webpack_exports__DeleteMultipleFileDto = __webpack_exports__.$V;
|
package/fesm/entities/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import * as __rspack_external_typeorm from "typeorm";
|
|
|
4
4
|
export const __rspack_esm_id = 604;
|
|
5
5
|
export const __rspack_esm_ids = [604];
|
|
6
6
|
export const __webpack_modules__ = {
|
|
7
|
-
|
|
7
|
+
1975(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
8
8
|
|
|
9
9
|
// EXPORTS
|
|
10
10
|
__webpack_require__.d(__webpack_exports__, {
|
|
@@ -25,7 +25,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
25
25
|
;// CONCATENATED MODULE: external "@flusys/nestjs-shared/entities"
|
|
26
26
|
|
|
27
27
|
// EXTERNAL MODULE: external "typeorm"
|
|
28
|
-
var external_typeorm_ = __webpack_require__(
|
|
28
|
+
var external_typeorm_ = __webpack_require__(7158);
|
|
29
29
|
;// CONCATENATED MODULE: ./projects/nestjs-storage/src/entities/file-manager.entity.ts
|
|
30
30
|
function _ts_decorate(decorators, target, key, desc) {
|
|
31
31
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -196,7 +196,7 @@ Folder = folder_entity_ts_decorate([
|
|
|
196
196
|
], Folder);
|
|
197
197
|
|
|
198
198
|
// EXTERNAL MODULE: external "@flusys/nestjs-shared"
|
|
199
|
-
var nestjs_shared_ = __webpack_require__(
|
|
199
|
+
var nestjs_shared_ = __webpack_require__(3422);
|
|
200
200
|
;// CONCATENATED MODULE: ./projects/nestjs-storage/src/entities/storage-config.entity.ts
|
|
201
201
|
function storage_config_entity_ts_decorate(decorators, target, key, desc) {
|
|
202
202
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -445,13 +445,13 @@ function getStorageEntitiesByConfig(enableCompanyFeature) {
|
|
|
445
445
|
|
|
446
446
|
|
|
447
447
|
},
|
|
448
|
-
|
|
448
|
+
3422(module) {
|
|
449
449
|
|
|
450
450
|
module.exports = __rspack_external__flusys_nestjs_shared_393d2cae;
|
|
451
451
|
|
|
452
452
|
|
|
453
453
|
},
|
|
454
|
-
|
|
454
|
+
7158(module) {
|
|
455
455
|
|
|
456
456
|
module.exports = __rspack_external_typeorm;
|
|
457
457
|
|
|
@@ -463,7 +463,7 @@ import { __webpack_require__ } from '../runtime.js';
|
|
|
463
463
|
var __webpack_exec__ = function(moduleId) { return __webpack_require__(__webpack_require__.s = moduleId); }
|
|
464
464
|
import * as __rspack_chunk_1 from './index.js';
|
|
465
465
|
__webpack_require__.C(__rspack_chunk_1);
|
|
466
|
-
var __webpack_exports__ = __webpack_exec__(
|
|
466
|
+
var __webpack_exports__ = __webpack_exec__(1975);var __webpack_exports__FileManager = __webpack_exports__.FileManager;
|
|
467
467
|
var __webpack_exports__FileManagerBase = __webpack_exports__.NP;
|
|
468
468
|
var __webpack_exports__FileManagerWithCompany = __webpack_exports__.FileManagerWithCompany;
|
|
469
469
|
var __webpack_exports__Folder = __webpack_exports__.Folder;
|
package/fesm/enums/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export const __rspack_esm_id = 743;
|
|
2
2
|
export const __rspack_esm_ids = [743];
|
|
3
3
|
export const __webpack_modules__ = {
|
|
4
|
-
|
|
4
|
+
2733(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
5
5
|
var FileLocationEnum = /*#__PURE__*/ function(FileLocationEnum) {
|
|
6
6
|
FileLocationEnum["AWS"] = "aws";
|
|
7
7
|
FileLocationEnum["AZURE"] = "azure";
|
|
@@ -16,8 +16,8 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
},
|
|
19
|
-
|
|
20
|
-
/* import */ var _file_location_enum_js__rspack_import_0 = __webpack_require__(
|
|
19
|
+
3406(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
20
|
+
/* import */ var _file_location_enum_js__rspack_import_0 = __webpack_require__(2733);
|
|
21
21
|
|
|
22
22
|
|
|
23
23
|
__webpack_require__.d(__webpack_exports__, {
|
|
@@ -32,5 +32,5 @@ import { __webpack_require__ } from '../runtime.js';
|
|
|
32
32
|
var __webpack_exec__ = function(moduleId) { return __webpack_require__(__webpack_require__.s = moduleId); }
|
|
33
33
|
import * as __rspack_chunk_1 from './index.js';
|
|
34
34
|
__webpack_require__.C(__rspack_chunk_1);
|
|
35
|
-
var __webpack_exports__ = __webpack_exec__(
|
|
35
|
+
var __webpack_exports__ = __webpack_exec__(3406);var __webpack_exports__FileLocationEnum = __webpack_exports__.N;
|
|
36
36
|
export { __webpack_exports__FileLocationEnum as FileLocationEnum };
|
package/fesm/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
export const __rspack_esm_id = 410;
|
|
2
2
|
export const __rspack_esm_ids = [410];
|
|
3
3
|
export const __webpack_modules__ = {
|
|
4
|
-
|
|
5
|
-
/* import */ var _event_actions_js__rspack_import_0 = __webpack_require__(
|
|
6
|
-
/* import */ var _message_keys_js__rspack_import_1 = __webpack_require__(
|
|
7
|
-
/* import */ var _storage_constants_js__rspack_import_2 = __webpack_require__(
|
|
4
|
+
2034(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
5
|
+
/* import */ var _event_actions_js__rspack_import_0 = __webpack_require__(4884);
|
|
6
|
+
/* import */ var _message_keys_js__rspack_import_1 = __webpack_require__(5450);
|
|
7
|
+
/* import */ var _storage_constants_js__rspack_import_2 = __webpack_require__(9188);
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
@@ -69,7 +69,7 @@ All queries automatically filter by current user's company context.
|
|
|
69
69
|
|
|
70
70
|
### Upload a File
|
|
71
71
|
|
|
72
|
-
POST /storage/upload/single-file with multipart/form-data containing file and optional
|
|
72
|
+
POST /storage/upload/single-file with multipart/form-data containing \`file\`, and an optional \`folderPath\` query parameter
|
|
73
73
|
|
|
74
74
|
### Get All Files
|
|
75
75
|
|
|
@@ -94,7 +94,7 @@ Complete file storage and management system${enableCompanyFeature ? ' with multi
|
|
|
94
94
|
- Automatic compression and optimization${companyIsolation}
|
|
95
95
|
|
|
96
96
|
### 🗂️ Folder Organization
|
|
97
|
-
- Create
|
|
97
|
+
- Create folders (flat, one level)
|
|
98
98
|
- Organize files by folders${companyPermissions}
|
|
99
99
|
- Automatic context filtering
|
|
100
100
|
|
|
@@ -108,6 +108,7 @@ Complete file storage and management system${enableCompanyFeature ? ' with multi
|
|
|
108
108
|
- JWT authentication required${companyIsolation}
|
|
109
109
|
- File access control
|
|
110
110
|
- Presigned URL generation
|
|
111
|
+
- Locally stored files are served without authentication (GET /storage/upload/file/...) so they work in <img> tags; only files inside the local storage base path are reachable
|
|
111
112
|
|
|
112
113
|
## Storage Providers
|
|
113
114
|
|
|
@@ -134,14 +135,14 @@ ${multiTenantSection}
|
|
|
134
135
|
## File Validation
|
|
135
136
|
|
|
136
137
|
### Size Limits
|
|
137
|
-
Configure maximum file size per upload (default:
|
|
138
|
+
Configure maximum file size per upload (default: 100MB)
|
|
138
139
|
|
|
139
140
|
### File Types
|
|
140
|
-
Restrict allowed file types (default:
|
|
141
|
+
Restrict allowed file types (default: all types). File content is checked against its declared type (magic bytes); HTML, JavaScript and SVG are refused unless listed by their exact type.
|
|
141
142
|
|
|
142
143
|
### Image Compression
|
|
143
144
|
- Automatic image optimization
|
|
144
|
-
- Format conversion (JPEG, PNG, WebP
|
|
145
|
+
- Format conversion (JPEG, PNG, WebP)
|
|
145
146
|
- Resize to maximum dimensions
|
|
146
147
|
- Quality control
|
|
147
148
|
|
|
@@ -155,13 +156,11 @@ Errors return structured responses with success false, error message, error code
|
|
|
155
156
|
|
|
156
157
|
## Common Error Codes
|
|
157
158
|
|
|
158
|
-
- **400 Bad Request**: Invalid input data
|
|
159
|
+
- **400 Bad Request**: Invalid input data, file too large, file type not allowed, or invalid file path
|
|
159
160
|
- **401 Unauthorized**: Missing or invalid authentication
|
|
160
|
-
- **403 Forbidden**: Insufficient permissions
|
|
161
|
-
- **404 Not Found**: Resource not found
|
|
162
|
-
- **
|
|
163
|
-
- **415 Unsupported Media Type**: File type not allowed
|
|
164
|
-
- **500 Internal Server Error**: Server error
|
|
161
|
+
- **403 Forbidden**: Insufficient permissions, or the record belongs to another company
|
|
162
|
+
- **404 Not Found**: Resource or storage configuration not found
|
|
163
|
+
- **500 Internal Server Error**: Server error, or a storage provider whose SDK is not installed
|
|
165
164
|
|
|
166
165
|
## Getting Started
|
|
167
166
|
|
|
@@ -191,10 +190,7 @@ ${examplesSection}
|
|
|
191
190
|
|
|
192
191
|
## Rate Limiting
|
|
193
192
|
|
|
194
|
-
|
|
195
|
-
- **Upload**: 100 requests per hour
|
|
196
|
-
- **Download**: 1000 requests per hour
|
|
197
|
-
- **Delete**: 50 requests per hour
|
|
193
|
+
Rate limits are set by the host application, not by this module.
|
|
198
194
|
`;
|
|
199
195
|
}
|
|
200
196
|
/**
|
|
@@ -219,8 +215,8 @@ All endpoints are rate-limited to prevent abuse. Default limits:
|
|
|
219
215
|
|
|
220
216
|
|
|
221
217
|
},
|
|
222
|
-
|
|
223
|
-
/* import */ var _file_location_enum_js__rspack_import_0 = __webpack_require__(
|
|
218
|
+
3406(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
219
|
+
/* import */ var _file_location_enum_js__rspack_import_0 = __webpack_require__(2733);
|
|
224
220
|
|
|
225
221
|
|
|
226
222
|
__webpack_require__.d(__webpack_exports__, {
|
|
@@ -229,18 +225,18 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
229
225
|
|
|
230
226
|
|
|
231
227
|
},
|
|
232
|
-
|
|
228
|
+
6395(module, __webpack_exports__, __webpack_require__) {
|
|
233
229
|
__webpack_require__.a(module, async function (__rspack_load_async_deps, __rspack_async_done) { try {
|
|
234
|
-
/* import */ var _controllers_index_js__rspack_import_0 = __webpack_require__(
|
|
235
|
-
/* import */ var _services_index_js__rspack_import_1 = __webpack_require__(
|
|
236
|
-
/* import */ var _entities_index_js__rspack_import_2 = __webpack_require__(
|
|
237
|
-
/* import */ var _modules_index_js__rspack_import_3 = __webpack_require__(
|
|
238
|
-
/* import */ var _config_index_js__rspack_import_4 = __webpack_require__(
|
|
230
|
+
/* import */ var _controllers_index_js__rspack_import_0 = __webpack_require__(5488);
|
|
231
|
+
/* import */ var _services_index_js__rspack_import_1 = __webpack_require__(4148);
|
|
232
|
+
/* import */ var _entities_index_js__rspack_import_2 = __webpack_require__(1975);
|
|
233
|
+
/* import */ var _modules_index_js__rspack_import_3 = __webpack_require__(2329);
|
|
234
|
+
/* import */ var _config_index_js__rspack_import_4 = __webpack_require__(2034);
|
|
239
235
|
/* import */ var _docs_index_js__rspack_import_5 = __webpack_require__(659);
|
|
240
|
-
/* import */ var _dtos_index_js__rspack_import_6 = __webpack_require__(
|
|
241
|
-
/* import */ var _enums_index_js__rspack_import_7 = __webpack_require__(
|
|
242
|
-
/* import */ var _providers_index_js__rspack_import_8 = __webpack_require__(
|
|
243
|
-
/* import */ var _utils_index_js__rspack_import_9 = __webpack_require__(
|
|
236
|
+
/* import */ var _dtos_index_js__rspack_import_6 = __webpack_require__(9775);
|
|
237
|
+
/* import */ var _enums_index_js__rspack_import_7 = __webpack_require__(3406);
|
|
238
|
+
/* import */ var _providers_index_js__rspack_import_8 = __webpack_require__(1922);
|
|
239
|
+
/* import */ var _utils_index_js__rspack_import_9 = __webpack_require__(8857);
|
|
244
240
|
var __rspack_async_deps = __rspack_load_async_deps([_modules_index_js__rspack_import_3]);
|
|
245
241
|
_modules_index_js__rspack_import_3 = (__rspack_async_deps.then ? (await __rspack_async_deps)() : __rspack_async_deps)[0];// Export all storage module components
|
|
246
242
|
|
|
@@ -317,8 +313,8 @@ __rspack_async_done();
|
|
|
317
313
|
} catch(e) { __rspack_async_done(e); } });
|
|
318
314
|
|
|
319
315
|
},
|
|
320
|
-
|
|
321
|
-
/* import */ var _image_compressor_util_js__rspack_import_0 = __webpack_require__(
|
|
316
|
+
8857(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
317
|
+
/* import */ var _image_compressor_util_js__rspack_import_0 = __webpack_require__(1872);
|
|
322
318
|
|
|
323
319
|
|
|
324
320
|
__webpack_require__.d(__webpack_exports__, {
|
|
@@ -339,7 +335,7 @@ import * as __rspack_chunk_3 from './562.js';
|
|
|
339
335
|
__webpack_require__.C(__rspack_chunk_3);
|
|
340
336
|
import * as __rspack_chunk_4 from './index.js';
|
|
341
337
|
__webpack_require__.C(__rspack_chunk_4);
|
|
342
|
-
var __webpack_exports__ = __webpack_exec__(
|
|
338
|
+
var __webpack_exports__ = __webpack_exec__(6395);__webpack_exports__ = await __webpack_exports__;
|
|
343
339
|
var __webpack_exports__CreateFileManagerDto = __webpack_exports__.rY;
|
|
344
340
|
var __webpack_exports__CreateFolderDto = __webpack_exports__._5;
|
|
345
341
|
var __webpack_exports__CreateStorageConfigDto = __webpack_exports__.rb;
|
package/fesm/interfaces/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export const __rspack_esm_id = 471;
|
|
2
2
|
export const __rspack_esm_ids = [471];
|
|
3
3
|
export const __webpack_modules__ = {
|
|
4
|
-
|
|
4
|
+
4820() {
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
@@ -16,4 +16,4 @@ import { __webpack_require__ } from '../runtime.js';
|
|
|
16
16
|
var __webpack_exec__ = function(moduleId) { return __webpack_require__(__webpack_require__.s = moduleId); }
|
|
17
17
|
import * as __rspack_chunk_1 from './index.js';
|
|
18
18
|
__webpack_require__.C(__rspack_chunk_1);
|
|
19
|
-
var __webpack_exports__ = __webpack_exec__(
|
|
19
|
+
var __webpack_exports__ = __webpack_exec__(4820);
|
package/fesm/modules/index.js
CHANGED
|
@@ -11,6 +11,6 @@ import * as __rspack_chunk_3 from '../562.js';
|
|
|
11
11
|
__webpack_require__.C(__rspack_chunk_3);
|
|
12
12
|
import * as __rspack_chunk_4 from './index.js';
|
|
13
13
|
__webpack_require__.C(__rspack_chunk_4);
|
|
14
|
-
var __webpack_exports__ = __webpack_exec__(
|
|
14
|
+
var __webpack_exports__ = __webpack_exec__(2329);__webpack_exports__ = await __webpack_exports__;
|
|
15
15
|
var __webpack_exports__StorageModule = __webpack_exports__.k;
|
|
16
16
|
export { __webpack_exports__StorageModule as StorageModule };
|