@flusys/nestjs-storage 1.1.0-beta → 2.0.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 +148 -6
- package/cjs/config/index.js +0 -1
- package/cjs/config/storage.constants.js +0 -17
- package/cjs/controllers/file-manager.controller.js +44 -1
- package/cjs/controllers/folder.controller.js +44 -1
- package/cjs/controllers/storage-config.controller.js +44 -1
- package/cjs/controllers/upload.controller.js +18 -29
- package/cjs/docs/storage-swagger.config.js +24 -136
- package/cjs/dtos/file-manager.dto.js +70 -34
- package/cjs/dtos/folder.dto.js +15 -9
- package/cjs/dtos/storage-config.dto.js +4 -85
- package/cjs/dtos/upload.dto.js +24 -17
- package/cjs/entities/file-manager-with-company.entity.js +3 -4
- package/cjs/entities/file-manager.entity.js +71 -3
- package/cjs/entities/folder-with-company.entity.js +3 -4
- package/cjs/entities/folder.entity.js +19 -3
- package/cjs/entities/index.js +9 -10
- package/cjs/entities/storage-config-with-company.entity.js +3 -4
- package/cjs/entities/storage-config.entity.js +74 -3
- package/cjs/interfaces/index.js +0 -1
- package/cjs/middlewares/file-serve.middleware.js +113 -100
- package/cjs/modules/storage.module.js +82 -136
- package/cjs/providers/azure-provider.optional.js +10 -38
- package/cjs/providers/local-provider.js +38 -31
- package/cjs/providers/s3-provider.optional.js +19 -40
- package/cjs/providers/storage-factory.service.js +54 -99
- package/cjs/providers/storage-provider.registry.js +8 -18
- package/cjs/services/file-manager.service.js +238 -323
- package/cjs/services/folder.service.js +8 -11
- package/cjs/services/index.js +1 -0
- package/cjs/{config → services}/storage-config.service.js +32 -76
- package/cjs/services/storage-datasource.provider.js +16 -26
- package/cjs/services/storage-provider-config.service.js +15 -37
- package/cjs/services/upload.service.js +72 -88
- package/cjs/utils/file-validator.util.js +458 -0
- package/cjs/utils/image-compressor.util.js +3 -8
- package/config/index.d.ts +0 -1
- package/config/storage.constants.d.ts +0 -8
- package/controllers/upload.controller.d.ts +3 -6
- package/dtos/file-manager.dto.d.ts +12 -5
- package/dtos/folder.dto.d.ts +5 -5
- package/dtos/storage-config.dto.d.ts +7 -13
- package/entities/file-manager-with-company.entity.d.ts +2 -2
- package/entities/file-manager.entity.d.ts +12 -2
- package/entities/folder-with-company.entity.d.ts +2 -2
- package/entities/folder.entity.d.ts +4 -2
- package/entities/index.d.ts +3 -4
- package/entities/storage-config-with-company.entity.d.ts +2 -2
- package/entities/storage-config.entity.d.ts +8 -2
- package/fesm/config/index.js +0 -1
- package/fesm/config/storage.constants.js +0 -8
- package/fesm/controllers/file-manager.controller.js +45 -2
- package/fesm/controllers/folder.controller.js +45 -2
- package/fesm/controllers/storage-config.controller.js +45 -2
- package/fesm/controllers/upload.controller.js +19 -30
- package/fesm/docs/storage-swagger.config.js +27 -142
- package/fesm/dtos/file-manager.dto.js +71 -35
- package/fesm/dtos/folder.dto.js +16 -10
- package/fesm/dtos/storage-config.dto.js +8 -95
- package/fesm/dtos/upload.dto.js +25 -19
- package/fesm/entities/file-manager-with-company.entity.js +3 -4
- package/fesm/entities/file-manager.entity.js +72 -4
- package/fesm/entities/folder-with-company.entity.js +3 -4
- package/fesm/entities/folder.entity.js +20 -4
- package/fesm/entities/index.js +5 -13
- package/fesm/entities/storage-config-with-company.entity.js +3 -4
- package/fesm/entities/storage-config.entity.js +75 -4
- package/fesm/interfaces/index.js +0 -1
- package/fesm/interfaces/storage-config.interface.js +1 -3
- package/fesm/middlewares/file-serve.middleware.js +114 -101
- package/fesm/modules/storage.module.js +83 -136
- package/fesm/providers/azure-provider.optional.js +11 -42
- package/fesm/providers/local-provider.js +38 -31
- package/fesm/providers/s3-provider.optional.js +20 -44
- package/fesm/providers/storage-factory.service.js +52 -97
- package/fesm/providers/storage-provider.registry.js +10 -20
- package/fesm/services/file-manager.service.js +237 -322
- package/fesm/services/folder.service.js +6 -9
- package/fesm/services/index.js +1 -0
- package/fesm/{config → services}/storage-config.service.js +32 -76
- package/fesm/services/storage-datasource.provider.js +16 -26
- package/fesm/services/storage-provider-config.service.js +13 -35
- package/fesm/services/upload.service.js +71 -87
- package/fesm/utils/file-validator.util.js +451 -0
- package/fesm/utils/image-compressor.util.js +3 -8
- package/interfaces/file-manager.interface.d.ts +7 -4
- package/interfaces/index.d.ts +0 -1
- package/interfaces/storage-config.interface.d.ts +0 -20
- package/interfaces/storage-module-options.interface.d.ts +0 -5
- package/middlewares/file-serve.middleware.d.ts +9 -1
- package/modules/storage.module.d.ts +1 -2
- package/package.json +6 -6
- package/providers/azure-provider.optional.d.ts +8 -6
- package/providers/local-provider.d.ts +2 -7
- package/providers/s3-provider.optional.d.ts +9 -7
- package/providers/storage-factory.service.d.ts +8 -9
- package/providers/storage-provider.registry.d.ts +4 -4
- package/services/file-manager.service.d.ts +23 -16
- package/services/folder.service.d.ts +4 -4
- package/services/index.d.ts +1 -0
- package/services/storage-config.service.d.ts +24 -0
- package/services/storage-datasource.provider.d.ts +3 -4
- package/services/storage-provider-config.service.d.ts +4 -4
- package/services/upload.service.d.ts +3 -2
- package/utils/file-validator.util.d.ts +19 -0
- package/cjs/entities/file-manager-base.entity.js +0 -115
- package/cjs/entities/folder-base.entity.js +0 -55
- package/cjs/entities/storage-config-base.entity.js +0 -93
- package/cjs/interfaces/file-upload-response.interface.js +0 -4
- package/config/storage-config.service.d.ts +0 -22
- package/entities/file-manager-base.entity.d.ts +0 -13
- package/entities/folder-base.entity.d.ts +0 -5
- package/entities/storage-config-base.entity.d.ts +0 -9
- package/fesm/entities/file-manager-base.entity.js +0 -108
- package/fesm/entities/folder-base.entity.js +0 -48
- package/fesm/entities/storage-config-base.entity.js +0 -83
- package/fesm/interfaces/file-upload-response.interface.js +0 -1
- package/interfaces/file-upload-response.interface.d.ts +0 -6
|
@@ -8,7 +8,7 @@ Object.defineProperty(exports, "storageSwaggerConfig", {
|
|
|
8
8
|
return storageSwaggerConfig;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
-
|
|
11
|
+
const COMPANY_SCHEMA_EXCLUSIONS = [
|
|
12
12
|
{
|
|
13
13
|
schemaName: 'FileManagerResponseDto',
|
|
14
14
|
properties: [
|
|
@@ -28,120 +28,18 @@ Object.defineProperty(exports, "storageSwaggerConfig", {
|
|
|
28
28
|
]
|
|
29
29
|
}
|
|
30
30
|
];
|
|
31
|
-
function
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
description: enableCompanyFeature ? `
|
|
36
|
-
# Storage Management API
|
|
37
|
-
|
|
38
|
-
Complete file storage and management system with multi-tenant support.
|
|
39
|
-
|
|
40
|
-
## Features
|
|
41
|
-
|
|
42
|
-
### 📁 File Management
|
|
43
|
-
- Upload single or multiple files
|
|
44
|
-
- Download files with presigned URLs
|
|
45
|
-
- Delete files (single or batch)
|
|
46
|
-
- File metadata management
|
|
47
|
-
- Automatic compression and optimization
|
|
48
|
-
- **Company isolation**
|
|
49
|
-
|
|
50
|
-
### 🗂️ Folder Company
|
|
51
|
-
- Create folder hierarchies
|
|
52
|
-
- Organize files by folders
|
|
53
|
-
- **Company-level permissions**
|
|
54
|
-
- Automatic context filtering
|
|
55
|
-
|
|
56
|
-
### ⚙️ Storage Configuration
|
|
57
|
-
- Multiple storage providers (AWS S3, Azure, SFTP, Local)
|
|
58
|
-
- Provider-specific configurations
|
|
59
|
-
- Default storage settings
|
|
60
|
-
- Dynamic provider switching
|
|
61
|
-
|
|
62
|
-
### 🔒 Security
|
|
63
|
-
- JWT authentication required
|
|
64
|
-
- **Company isolation**
|
|
65
|
-
- File access control
|
|
66
|
-
- Presigned URL generation
|
|
67
|
-
|
|
68
|
-
## Storage Providers
|
|
69
|
-
|
|
70
|
-
### AWS S3
|
|
71
|
-
- Scalable cloud storage
|
|
72
|
-
- Automatic redundancy
|
|
73
|
-
- Global CDN integration
|
|
74
|
-
|
|
75
|
-
### Azure Blob Storage
|
|
76
|
-
- Microsoft Azure integration
|
|
77
|
-
- Geo-redundant storage
|
|
78
|
-
- Advanced security features
|
|
79
|
-
|
|
80
|
-
### SFTP
|
|
81
|
-
- Secure file transfer
|
|
82
|
-
- Legacy system integration
|
|
83
|
-
- Custom server support
|
|
84
|
-
|
|
85
|
-
### Local Storage
|
|
86
|
-
- Same-server storage
|
|
87
|
-
- Fast access
|
|
88
|
-
- No external dependencies
|
|
89
|
-
|
|
31
|
+
function buildDescription(enableCompanyFeature) {
|
|
32
|
+
const companyIsolation = enableCompanyFeature ? '\n- **Company isolation**' : '';
|
|
33
|
+
const companyPermissions = enableCompanyFeature ? '\n- **Company-level permissions**' : '';
|
|
34
|
+
const multiTenantSection = enableCompanyFeature ? `
|
|
90
35
|
## Multi-Tenant Support
|
|
91
36
|
|
|
92
37
|
Files are automatically isolated by:
|
|
93
38
|
- **Company ID**: Company-level storage
|
|
94
39
|
|
|
95
40
|
All queries automatically filter by current user's company context.
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
### Size Limits
|
|
100
|
-
Configure maximum file size per upload (default: 10MB)
|
|
101
|
-
|
|
102
|
-
### File Types
|
|
103
|
-
Restrict allowed file types (default: images, PDFs)
|
|
104
|
-
|
|
105
|
-
### Image Compression
|
|
106
|
-
- Automatic image optimization
|
|
107
|
-
- Format conversion (JPEG, PNG, WebP, AVIF)
|
|
108
|
-
- Resize to maximum dimensions
|
|
109
|
-
- Quality control
|
|
110
|
-
|
|
111
|
-
## Response Format
|
|
112
|
-
|
|
113
|
-
All endpoints return standardized responses with success status, data, message, and timestamp.
|
|
114
|
-
|
|
115
|
-
## Error Handling
|
|
116
|
-
|
|
117
|
-
Errors return structured responses with success false, error message, error code, and timestamp.
|
|
118
|
-
|
|
119
|
-
## Common Error Codes
|
|
120
|
-
|
|
121
|
-
- **400 Bad Request**: Invalid input data
|
|
122
|
-
- **401 Unauthorized**: Missing or invalid authentication
|
|
123
|
-
- **403 Forbidden**: Insufficient permissions
|
|
124
|
-
- **404 Not Found**: Resource not found
|
|
125
|
-
- **413 Payload Too Large**: File exceeds size limit
|
|
126
|
-
- **415 Unsupported Media Type**: File type not allowed
|
|
127
|
-
- **500 Internal Server Error**: Server error
|
|
128
|
-
|
|
129
|
-
## Getting Started
|
|
130
|
-
|
|
131
|
-
1. **Authenticate**: Obtain JWT token from /auth/login
|
|
132
|
-
2. **Configure Storage**: Create storage configuration via /storage/storage-config/insert
|
|
133
|
-
3. **Create Folders**: Organize files with /storage/folder/insert
|
|
134
|
-
4. **Upload Files**: Upload files via /storage/upload/single-file
|
|
135
|
-
5. **Manage Files**: Track uploads in /storage/file-manager
|
|
136
|
-
|
|
137
|
-
## API Endpoints
|
|
138
|
-
|
|
139
|
-
All storage endpoints are prefixed with \`/storage\`:
|
|
140
|
-
- \`/storage/file-manager/*\` - File metadata management
|
|
141
|
-
- \`/storage/folder/*\` - Folder organization
|
|
142
|
-
- \`/storage/storage-config/*\` - Storage configuration
|
|
143
|
-
- \`/storage/upload/*\` - File upload/download
|
|
144
|
-
|
|
41
|
+
` : '';
|
|
42
|
+
const examplesSection = enableCompanyFeature ? `
|
|
145
43
|
## Examples
|
|
146
44
|
|
|
147
45
|
### Upload a File
|
|
@@ -155,27 +53,11 @@ POST /storage/file-manager/get-all with JSON body containing page and pageSize p
|
|
|
155
53
|
### Create Folder
|
|
156
54
|
|
|
157
55
|
POST /storage/folder/insert with JSON body containing folder name
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
1. **Always authenticate**: Include JWT token in Authorization header
|
|
162
|
-
2. **Use folders**: Organize files hierarchically
|
|
163
|
-
3. **Check file size**: Validate before upload
|
|
164
|
-
4. **Handle errors**: Implement proper error handling
|
|
165
|
-
5. **Clean up**: Delete unused files regularly
|
|
166
|
-
6. **Use presigned URLs**: Generate temporary URLs for file access
|
|
167
|
-
7. **Compress images**: Enable compression for faster loading
|
|
168
|
-
|
|
169
|
-
## Rate Limiting
|
|
170
|
-
|
|
171
|
-
All endpoints are rate-limited to prevent abuse. Default limits:
|
|
172
|
-
- **Upload**: 100 requests per hour
|
|
173
|
-
- **Download**: 1000 requests per hour
|
|
174
|
-
- **Delete**: 50 requests per hour
|
|
175
|
-
` : `
|
|
56
|
+
` : '';
|
|
57
|
+
return `
|
|
176
58
|
# Storage Management API
|
|
177
59
|
|
|
178
|
-
Complete file storage and management system.
|
|
60
|
+
Complete file storage and management system${enableCompanyFeature ? ' with multi-tenant support' : ''}.
|
|
179
61
|
|
|
180
62
|
## Features
|
|
181
63
|
|
|
@@ -184,12 +66,12 @@ Complete file storage and management system.
|
|
|
184
66
|
- Download files with presigned URLs
|
|
185
67
|
- Delete files (single or batch)
|
|
186
68
|
- File metadata management
|
|
187
|
-
- Automatic compression and optimization
|
|
69
|
+
- Automatic compression and optimization${companyIsolation}
|
|
188
70
|
|
|
189
|
-
### 🗂️ Folder
|
|
71
|
+
### 🗂️ Folder Organization
|
|
190
72
|
- Create folder hierarchies
|
|
191
|
-
- Organize files by folders
|
|
192
|
-
-
|
|
73
|
+
- Organize files by folders${companyPermissions}
|
|
74
|
+
- Automatic context filtering
|
|
193
75
|
|
|
194
76
|
### ⚙️ Storage Configuration
|
|
195
77
|
- Multiple storage providers (AWS S3, Azure, SFTP, Local)
|
|
@@ -198,7 +80,7 @@ Complete file storage and management system.
|
|
|
198
80
|
- Dynamic provider switching
|
|
199
81
|
|
|
200
82
|
### 🔒 Security
|
|
201
|
-
- JWT authentication required
|
|
83
|
+
- JWT authentication required${companyIsolation}
|
|
202
84
|
- File access control
|
|
203
85
|
- Presigned URL generation
|
|
204
86
|
|
|
@@ -223,7 +105,7 @@ Complete file storage and management system.
|
|
|
223
105
|
- Same-server storage
|
|
224
106
|
- Fast access
|
|
225
107
|
- No external dependencies
|
|
226
|
-
|
|
108
|
+
${multiTenantSection}
|
|
227
109
|
## File Validation
|
|
228
110
|
|
|
229
111
|
### Size Limits
|
|
@@ -271,7 +153,7 @@ All storage endpoints are prefixed with \`/storage\`:
|
|
|
271
153
|
- \`/storage/folder/*\` - Folder organization
|
|
272
154
|
- \`/storage/storage-config/*\` - Storage configuration
|
|
273
155
|
- \`/storage/upload/*\` - File upload/download
|
|
274
|
-
|
|
156
|
+
${examplesSection}
|
|
275
157
|
## Best Practices
|
|
276
158
|
|
|
277
159
|
1. **Always authenticate**: Include JWT token in Authorization header
|
|
@@ -288,7 +170,13 @@ All endpoints are rate-limited to prevent abuse. Default limits:
|
|
|
288
170
|
- **Upload**: 100 requests per hour
|
|
289
171
|
- **Download**: 1000 requests per hour
|
|
290
172
|
- **Delete**: 50 requests per hour
|
|
291
|
-
|
|
173
|
+
`;
|
|
174
|
+
}
|
|
175
|
+
function storageSwaggerConfig(bootstrapConfig) {
|
|
176
|
+
const enableCompanyFeature = bootstrapConfig?.enableCompanyFeature ?? true;
|
|
177
|
+
return {
|
|
178
|
+
title: 'Storage API',
|
|
179
|
+
description: buildDescription(enableCompanyFeature),
|
|
292
180
|
version: '1.0',
|
|
293
181
|
path: 'api/docs/storage',
|
|
294
182
|
bearerAuth: true,
|
|
@@ -64,8 +64,8 @@ let CreateFileManagerDto = class CreateFileManagerDto {
|
|
|
64
64
|
};
|
|
65
65
|
_ts_decorate([
|
|
66
66
|
(0, _swagger.ApiProperty)({
|
|
67
|
-
description: '
|
|
68
|
-
example: '
|
|
67
|
+
description: 'Original file name',
|
|
68
|
+
example: 'vacation-photo.jpg'
|
|
69
69
|
}),
|
|
70
70
|
(0, _classvalidator.IsNotEmpty)(),
|
|
71
71
|
(0, _classvalidator.IsString)(),
|
|
@@ -73,8 +73,8 @@ _ts_decorate([
|
|
|
73
73
|
], CreateFileManagerDto.prototype, "name", void 0);
|
|
74
74
|
_ts_decorate([
|
|
75
75
|
(0, _swagger.ApiProperty)({
|
|
76
|
-
description: '
|
|
77
|
-
example: '
|
|
76
|
+
description: 'Storage key or path of the file',
|
|
77
|
+
example: 'uploads/abc123-vacation-photo.jpg'
|
|
78
78
|
}),
|
|
79
79
|
(0, _classvalidator.IsNotEmpty)(),
|
|
80
80
|
(0, _classvalidator.IsString)(),
|
|
@@ -82,7 +82,7 @@ _ts_decorate([
|
|
|
82
82
|
], CreateFileManagerDto.prototype, "key", void 0);
|
|
83
83
|
_ts_decorate([
|
|
84
84
|
(0, _swagger.ApiProperty)({
|
|
85
|
-
description: 'Size of the
|
|
85
|
+
description: 'Size of the file in bytes',
|
|
86
86
|
example: '1024'
|
|
87
87
|
}),
|
|
88
88
|
(0, _classvalidator.IsNotEmpty)(),
|
|
@@ -91,7 +91,7 @@ _ts_decorate([
|
|
|
91
91
|
], CreateFileManagerDto.prototype, "size", void 0);
|
|
92
92
|
_ts_decorate([
|
|
93
93
|
(0, _swagger.ApiProperty)({
|
|
94
|
-
description: '
|
|
94
|
+
description: 'MIME type of file',
|
|
95
95
|
example: 'image/jpeg'
|
|
96
96
|
}),
|
|
97
97
|
(0, _classvalidator.IsNotEmpty)(),
|
|
@@ -100,7 +100,7 @@ _ts_decorate([
|
|
|
100
100
|
], CreateFileManagerDto.prototype, "contentType", void 0);
|
|
101
101
|
_ts_decorate([
|
|
102
102
|
(0, _swagger.ApiProperty)({
|
|
103
|
-
description: 'Indicates if the
|
|
103
|
+
description: 'Indicates if the file is private',
|
|
104
104
|
example: true
|
|
105
105
|
}),
|
|
106
106
|
(0, _classvalidator.IsNotEmpty)(),
|
|
@@ -108,21 +108,21 @@ _ts_decorate([
|
|
|
108
108
|
_ts_metadata("design:type", Boolean)
|
|
109
109
|
], CreateFileManagerDto.prototype, "isPrivate", void 0);
|
|
110
110
|
_ts_decorate([
|
|
111
|
-
(0, _swagger.
|
|
111
|
+
(0, _swagger.ApiPropertyOptional)({
|
|
112
112
|
description: 'Folder ID (UUID)',
|
|
113
113
|
example: 'f2e9c8d0-7a2a-11eb-9439-0242ac130002'
|
|
114
114
|
}),
|
|
115
115
|
(0, _classvalidator.IsOptional)(),
|
|
116
|
-
(0, _classvalidator.
|
|
116
|
+
(0, _classvalidator.IsUUID)(),
|
|
117
117
|
_ts_metadata("design:type", String)
|
|
118
118
|
], CreateFileManagerDto.prototype, "folderId", void 0);
|
|
119
119
|
_ts_decorate([
|
|
120
120
|
(0, _swagger.ApiPropertyOptional)({
|
|
121
|
-
description: 'Storage configuration ID
|
|
121
|
+
description: 'Storage configuration ID',
|
|
122
122
|
example: '123e4567-e89b-12d3-a456-426614174000'
|
|
123
123
|
}),
|
|
124
124
|
(0, _classvalidator.IsOptional)(),
|
|
125
|
-
(0, _classvalidator.
|
|
125
|
+
(0, _classvalidator.IsUUID)(),
|
|
126
126
|
_ts_metadata("design:type", String)
|
|
127
127
|
], CreateFileManagerDto.prototype, "storageConfigId", void 0);
|
|
128
128
|
_ts_decorate([
|
|
@@ -142,21 +142,66 @@ let UpdateFileManagerDto = class UpdateFileManagerDto extends (0, _swagger.Parti
|
|
|
142
142
|
};
|
|
143
143
|
_ts_decorate([
|
|
144
144
|
(0, _swagger.ApiProperty)({
|
|
145
|
-
description: 'Unique identifier of the
|
|
145
|
+
description: 'Unique identifier of the file',
|
|
146
146
|
example: 'f2e9c8d0-7a2a-11eb-9439-0242ac130002'
|
|
147
147
|
}),
|
|
148
|
+
(0, _classvalidator.IsUUID)(),
|
|
148
149
|
(0, _classvalidator.IsNotEmpty)(),
|
|
149
150
|
_ts_metadata("design:type", String)
|
|
150
151
|
], UpdateFileManagerDto.prototype, "id", void 0);
|
|
151
|
-
let FileManagerResponseDto = class FileManagerResponseDto
|
|
152
|
-
constructor(
|
|
153
|
-
|
|
152
|
+
let FileManagerResponseDto = class FileManagerResponseDto {
|
|
153
|
+
constructor(){
|
|
154
|
+
_define_property(this, "id", void 0);
|
|
155
|
+
_define_property(this, "name", void 0);
|
|
156
|
+
_define_property(this, "key", void 0);
|
|
157
|
+
_define_property(this, "size", void 0);
|
|
158
|
+
_define_property(this, "contentType", void 0);
|
|
159
|
+
_define_property(this, "isPrivate", void 0);
|
|
160
|
+
_define_property(this, "folderId", void 0);
|
|
161
|
+
_define_property(this, "storageConfigId", void 0);
|
|
162
|
+
_define_property(this, "location", void 0);
|
|
163
|
+
_define_property(this, "providerName", void 0);
|
|
154
164
|
}
|
|
155
165
|
};
|
|
166
|
+
_ts_decorate([
|
|
167
|
+
(0, _swagger.ApiProperty)(),
|
|
168
|
+
_ts_metadata("design:type", String)
|
|
169
|
+
], FileManagerResponseDto.prototype, "id", void 0);
|
|
170
|
+
_ts_decorate([
|
|
171
|
+
(0, _swagger.ApiProperty)(),
|
|
172
|
+
_ts_metadata("design:type", String)
|
|
173
|
+
], FileManagerResponseDto.prototype, "name", void 0);
|
|
174
|
+
_ts_decorate([
|
|
175
|
+
(0, _swagger.ApiProperty)(),
|
|
176
|
+
_ts_metadata("design:type", String)
|
|
177
|
+
], FileManagerResponseDto.prototype, "key", void 0);
|
|
178
|
+
_ts_decorate([
|
|
179
|
+
(0, _swagger.ApiProperty)(),
|
|
180
|
+
_ts_metadata("design:type", String)
|
|
181
|
+
], FileManagerResponseDto.prototype, "size", void 0);
|
|
182
|
+
_ts_decorate([
|
|
183
|
+
(0, _swagger.ApiProperty)(),
|
|
184
|
+
_ts_metadata("design:type", String)
|
|
185
|
+
], FileManagerResponseDto.prototype, "contentType", void 0);
|
|
186
|
+
_ts_decorate([
|
|
187
|
+
(0, _swagger.ApiProperty)(),
|
|
188
|
+
_ts_metadata("design:type", Boolean)
|
|
189
|
+
], FileManagerResponseDto.prototype, "isPrivate", void 0);
|
|
190
|
+
_ts_decorate([
|
|
191
|
+
(0, _swagger.ApiPropertyOptional)(),
|
|
192
|
+
_ts_metadata("design:type", String)
|
|
193
|
+
], FileManagerResponseDto.prototype, "folderId", void 0);
|
|
194
|
+
_ts_decorate([
|
|
195
|
+
(0, _swagger.ApiPropertyOptional)(),
|
|
196
|
+
_ts_metadata("design:type", String)
|
|
197
|
+
], FileManagerResponseDto.prototype, "storageConfigId", void 0);
|
|
198
|
+
_ts_decorate([
|
|
199
|
+
(0, _swagger.ApiPropertyOptional)(),
|
|
200
|
+
_ts_metadata("design:type", typeof _enums.FileLocationEnum === "undefined" ? Object : _enums.FileLocationEnum)
|
|
201
|
+
], FileManagerResponseDto.prototype, "location", void 0);
|
|
156
202
|
_ts_decorate([
|
|
157
203
|
(0, _swagger.ApiPropertyOptional)({
|
|
158
|
-
|
|
159
|
-
description: 'Name of the storage configuration/provider'
|
|
204
|
+
description: 'Name of the storage provider'
|
|
160
205
|
}),
|
|
161
206
|
_ts_metadata("design:type", String)
|
|
162
207
|
], FileManagerResponseDto.prototype, "providerName", void 0);
|
|
@@ -169,6 +214,8 @@ _ts_decorate([
|
|
|
169
214
|
(0, _swagger.ApiProperty)({
|
|
170
215
|
example: 'f2e9c8d0-7a2a-11eb-9439-0242ac130002'
|
|
171
216
|
}),
|
|
217
|
+
(0, _classvalidator.IsUUID)(),
|
|
218
|
+
(0, _classvalidator.IsNotEmpty)(),
|
|
172
219
|
_ts_metadata("design:type", String)
|
|
173
220
|
], GetFilesRequestDto.prototype, "id", void 0);
|
|
174
221
|
let FilesResponseDto = class FilesResponseDto {
|
|
@@ -183,47 +230,36 @@ let FilesResponseDto = class FilesResponseDto {
|
|
|
183
230
|
}
|
|
184
231
|
};
|
|
185
232
|
_ts_decorate([
|
|
186
|
-
(0, _swagger.ApiProperty)(
|
|
187
|
-
example: 'file123.jpg'
|
|
188
|
-
}),
|
|
233
|
+
(0, _swagger.ApiProperty)(),
|
|
189
234
|
_ts_metadata("design:type", String)
|
|
190
235
|
], FilesResponseDto.prototype, "id", void 0);
|
|
191
236
|
_ts_decorate([
|
|
192
|
-
(0, _swagger.ApiProperty)(
|
|
193
|
-
example: 'file123.jpg'
|
|
194
|
-
}),
|
|
237
|
+
(0, _swagger.ApiProperty)(),
|
|
195
238
|
_ts_metadata("design:type", String)
|
|
196
239
|
], FilesResponseDto.prototype, "name", void 0);
|
|
197
240
|
_ts_decorate([
|
|
198
|
-
(0, _swagger.ApiProperty)(
|
|
199
|
-
example: 'image/jpeg'
|
|
200
|
-
}),
|
|
241
|
+
(0, _swagger.ApiProperty)(),
|
|
201
242
|
_ts_metadata("design:type", String)
|
|
202
243
|
], FilesResponseDto.prototype, "contentType", void 0);
|
|
203
244
|
_ts_decorate([
|
|
204
|
-
(0, _swagger.ApiProperty)(
|
|
205
|
-
example: 'https://example.com/file123.jpg'
|
|
206
|
-
}),
|
|
245
|
+
(0, _swagger.ApiProperty)(),
|
|
207
246
|
_ts_metadata("design:type", String)
|
|
208
247
|
], FilesResponseDto.prototype, "url", void 0);
|
|
209
248
|
_ts_decorate([
|
|
210
249
|
(0, _swagger.ApiPropertyOptional)({
|
|
211
|
-
|
|
212
|
-
description: 'Storage provider type (local, aws, azure, sftp)'
|
|
250
|
+
description: 'Storage provider type'
|
|
213
251
|
}),
|
|
214
252
|
_ts_metadata("design:type", String)
|
|
215
253
|
], FilesResponseDto.prototype, "location", void 0);
|
|
216
254
|
_ts_decorate([
|
|
217
255
|
(0, _swagger.ApiPropertyOptional)({
|
|
218
|
-
example: '123e4567-e89b-12d3-a456-426614174000',
|
|
219
256
|
description: 'Storage configuration ID'
|
|
220
257
|
}),
|
|
221
258
|
_ts_metadata("design:type", String)
|
|
222
259
|
], FilesResponseDto.prototype, "storageConfigId", void 0);
|
|
223
260
|
_ts_decorate([
|
|
224
261
|
(0, _swagger.ApiPropertyOptional)({
|
|
225
|
-
|
|
226
|
-
description: 'Name of the storage configuration/provider'
|
|
262
|
+
description: 'Name of the storage provider'
|
|
227
263
|
}),
|
|
228
264
|
_ts_metadata("design:type", String)
|
|
229
265
|
], FilesResponseDto.prototype, "providerName", void 0);
|
package/cjs/dtos/folder.dto.js
CHANGED
|
@@ -67,20 +67,26 @@ _ts_decorate([
|
|
|
67
67
|
description: 'Unique identifier of the folder',
|
|
68
68
|
example: 'f2e9c8d0-7a2a-11eb-9439-0242ac130002'
|
|
69
69
|
}),
|
|
70
|
+
(0, _classvalidator.IsUUID)(),
|
|
70
71
|
(0, _classvalidator.IsNotEmpty)(),
|
|
71
72
|
_ts_metadata("design:type", String)
|
|
72
73
|
], UpdateFolderDto.prototype, "id", void 0);
|
|
73
|
-
let FolderResponseDto = class FolderResponseDto
|
|
74
|
-
constructor(
|
|
75
|
-
|
|
74
|
+
let FolderResponseDto = class FolderResponseDto {
|
|
75
|
+
constructor(){
|
|
76
|
+
_define_property(this, "id", void 0);
|
|
77
|
+
_define_property(this, "name", void 0);
|
|
78
|
+
_define_property(this, "slug", void 0);
|
|
76
79
|
}
|
|
77
80
|
};
|
|
78
81
|
_ts_decorate([
|
|
79
|
-
(0, _swagger.ApiProperty)(
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
(0,
|
|
84
|
-
(
|
|
82
|
+
(0, _swagger.ApiProperty)(),
|
|
83
|
+
_ts_metadata("design:type", String)
|
|
84
|
+
], FolderResponseDto.prototype, "id", void 0);
|
|
85
|
+
_ts_decorate([
|
|
86
|
+
(0, _swagger.ApiProperty)(),
|
|
87
|
+
_ts_metadata("design:type", String)
|
|
88
|
+
], FolderResponseDto.prototype, "name", void 0);
|
|
89
|
+
_ts_decorate([
|
|
90
|
+
(0, _swagger.ApiProperty)(),
|
|
85
91
|
_ts_metadata("design:type", String)
|
|
86
92
|
], FolderResponseDto.prototype, "slug", void 0);
|
|
@@ -75,20 +75,6 @@ _ts_decorate([
|
|
|
75
75
|
], CreateStorageConfigDto.prototype, "storage", void 0);
|
|
76
76
|
_ts_decorate([
|
|
77
77
|
(0, _swagger.ApiProperty)({
|
|
78
|
-
type: 'object',
|
|
79
|
-
properties: {
|
|
80
|
-
region: {
|
|
81
|
-
type: 'string',
|
|
82
|
-
example: 'us-east-1',
|
|
83
|
-
description: 'Cloud region'
|
|
84
|
-
},
|
|
85
|
-
bucket: {
|
|
86
|
-
type: 'string',
|
|
87
|
-
example: 'my-bucket',
|
|
88
|
-
description: 'Bucket name'
|
|
89
|
-
}
|
|
90
|
-
},
|
|
91
|
-
additionalProperties: true,
|
|
92
78
|
description: 'Provider-specific configuration',
|
|
93
79
|
example: {
|
|
94
80
|
region: 'us-east-1',
|
|
@@ -117,86 +103,19 @@ _ts_decorate([
|
|
|
117
103
|
(0, _classvalidator.IsOptional)(),
|
|
118
104
|
_ts_metadata("design:type", Boolean)
|
|
119
105
|
], CreateStorageConfigDto.prototype, "isDefault", void 0);
|
|
120
|
-
let UpdateStorageConfigDto = class UpdateStorageConfigDto {
|
|
121
|
-
constructor(){
|
|
122
|
-
_define_property(this, "id", void 0);
|
|
123
|
-
_define_property(this, "name", void 0);
|
|
124
|
-
_define_property(this, "storage", void 0);
|
|
125
|
-
_define_property(this, "config", void 0);
|
|
126
|
-
_define_property(this, "isActive", void 0);
|
|
127
|
-
_define_property(this, "isDefault", void 0);
|
|
106
|
+
let UpdateStorageConfigDto = class UpdateStorageConfigDto extends (0, _swagger.PartialType)((0, _swagger.OmitType)(CreateStorageConfigDto, [])) {
|
|
107
|
+
constructor(...args){
|
|
108
|
+
super(...args), _define_property(this, "id", void 0);
|
|
128
109
|
}
|
|
129
110
|
};
|
|
130
111
|
_ts_decorate([
|
|
131
112
|
(0, _swagger.ApiProperty)({
|
|
132
113
|
example: '123e4567-e89b-12d3-a456-426614174000'
|
|
133
114
|
}),
|
|
134
|
-
(0, _classvalidator.
|
|
115
|
+
(0, _classvalidator.IsUUID)(),
|
|
135
116
|
(0, _classvalidator.IsNotEmpty)(),
|
|
136
117
|
_ts_metadata("design:type", String)
|
|
137
118
|
], UpdateStorageConfigDto.prototype, "id", void 0);
|
|
138
|
-
_ts_decorate([
|
|
139
|
-
(0, _swagger.ApiPropertyOptional)({
|
|
140
|
-
example: 'Production AWS S3'
|
|
141
|
-
}),
|
|
142
|
-
(0, _classvalidator.IsString)(),
|
|
143
|
-
(0, _classvalidator.IsOptional)(),
|
|
144
|
-
(0, _classvalidator.MaxLength)(255),
|
|
145
|
-
_ts_metadata("design:type", String)
|
|
146
|
-
], UpdateStorageConfigDto.prototype, "name", void 0);
|
|
147
|
-
_ts_decorate([
|
|
148
|
-
(0, _swagger.ApiPropertyOptional)({
|
|
149
|
-
enum: _enums.FileLocationEnum,
|
|
150
|
-
example: _enums.FileLocationEnum.AWS
|
|
151
|
-
}),
|
|
152
|
-
(0, _classvalidator.IsEnum)(_enums.FileLocationEnum),
|
|
153
|
-
(0, _classvalidator.IsOptional)(),
|
|
154
|
-
_ts_metadata("design:type", typeof _enums.FileLocationEnum === "undefined" ? Object : _enums.FileLocationEnum)
|
|
155
|
-
], UpdateStorageConfigDto.prototype, "storage", void 0);
|
|
156
|
-
_ts_decorate([
|
|
157
|
-
(0, _swagger.ApiPropertyOptional)({
|
|
158
|
-
type: 'object',
|
|
159
|
-
properties: {
|
|
160
|
-
region: {
|
|
161
|
-
type: 'string',
|
|
162
|
-
example: 'us-east-1',
|
|
163
|
-
description: 'Cloud region'
|
|
164
|
-
},
|
|
165
|
-
bucket: {
|
|
166
|
-
type: 'string',
|
|
167
|
-
example: 'my-bucket',
|
|
168
|
-
description: 'Bucket name'
|
|
169
|
-
}
|
|
170
|
-
},
|
|
171
|
-
additionalProperties: true,
|
|
172
|
-
description: 'Provider-specific configuration',
|
|
173
|
-
example: {
|
|
174
|
-
region: 'us-east-1',
|
|
175
|
-
bucket: 'my-bucket'
|
|
176
|
-
}
|
|
177
|
-
}),
|
|
178
|
-
(0, _classvalidator.IsObject)(),
|
|
179
|
-
(0, _classvalidator.IsOptional)(),
|
|
180
|
-
_ts_metadata("design:type", typeof Record === "undefined" ? Object : Record)
|
|
181
|
-
], UpdateStorageConfigDto.prototype, "config", void 0);
|
|
182
|
-
_ts_decorate([
|
|
183
|
-
(0, _swagger.ApiPropertyOptional)({
|
|
184
|
-
example: true,
|
|
185
|
-
description: 'Whether storage configuration is active'
|
|
186
|
-
}),
|
|
187
|
-
(0, _classvalidator.IsBoolean)(),
|
|
188
|
-
(0, _classvalidator.IsOptional)(),
|
|
189
|
-
_ts_metadata("design:type", Boolean)
|
|
190
|
-
], UpdateStorageConfigDto.prototype, "isActive", void 0);
|
|
191
|
-
_ts_decorate([
|
|
192
|
-
(0, _swagger.ApiPropertyOptional)({
|
|
193
|
-
example: false,
|
|
194
|
-
description: 'Set as default storage configuration'
|
|
195
|
-
}),
|
|
196
|
-
(0, _classvalidator.IsBoolean)(),
|
|
197
|
-
(0, _classvalidator.IsOptional)(),
|
|
198
|
-
_ts_metadata("design:type", Boolean)
|
|
199
|
-
], UpdateStorageConfigDto.prototype, "isDefault", void 0);
|
|
200
119
|
let StorageConfigResponseDto = class StorageConfigResponseDto extends _dtos.IdentityResponseDto {
|
|
201
120
|
constructor(...args){
|
|
202
121
|
super(...args), _define_property(this, "name", void 0), _define_property(this, "storage", void 0), _define_property(this, "config", void 0), _define_property(this, "isActive", void 0), _define_property(this, "isDefault", void 0);
|