@flusys/nestjs-storage 5.1.1 → 5.1.2
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/cjs/dtos/file-manager.dto.js +79 -17
- package/cjs/dtos/folder.dto.js +16 -3
- package/cjs/dtos/storage-config.dto.js +48 -1
- package/cjs/dtos/upload.dto.js +19 -8
- package/fesm/dtos/file-manager.dto.js +79 -17
- package/fesm/dtos/folder.dto.js +16 -3
- package/fesm/dtos/storage-config.dto.js +48 -1
- package/fesm/dtos/upload.dto.js +19 -8
- package/package.json +3 -3
|
@@ -26,6 +26,7 @@ _export(exports, {
|
|
|
26
26
|
}
|
|
27
27
|
});
|
|
28
28
|
const _swagger = require("@nestjs/swagger");
|
|
29
|
+
const _classtransformer = require("class-transformer");
|
|
29
30
|
const _classvalidator = require("class-validator");
|
|
30
31
|
const _enums = require("../enums");
|
|
31
32
|
function _define_property(obj, key, value) {
|
|
@@ -164,44 +165,82 @@ let FileManagerResponseDto = class FileManagerResponseDto {
|
|
|
164
165
|
}
|
|
165
166
|
};
|
|
166
167
|
_ts_decorate([
|
|
167
|
-
(0,
|
|
168
|
+
(0, _classtransformer.Expose)(),
|
|
169
|
+
(0, _swagger.ApiProperty)({
|
|
170
|
+
description: 'Unique identifier of the file',
|
|
171
|
+
example: 'f2e9c8d0-7a2a-11eb-9439-0242ac130002'
|
|
172
|
+
}),
|
|
168
173
|
_ts_metadata("design:type", String)
|
|
169
174
|
], FileManagerResponseDto.prototype, "id", void 0);
|
|
170
175
|
_ts_decorate([
|
|
171
|
-
(0,
|
|
176
|
+
(0, _classtransformer.Expose)(),
|
|
177
|
+
(0, _swagger.ApiProperty)({
|
|
178
|
+
description: 'Original filename as uploaded',
|
|
179
|
+
example: 'profile-photo.png'
|
|
180
|
+
}),
|
|
172
181
|
_ts_metadata("design:type", String)
|
|
173
182
|
], FileManagerResponseDto.prototype, "name", void 0);
|
|
174
183
|
_ts_decorate([
|
|
175
|
-
(0,
|
|
184
|
+
(0, _classtransformer.Expose)(),
|
|
185
|
+
(0, _swagger.ApiProperty)({
|
|
186
|
+
description: 'Storage key / path used to retrieve the file from the provider',
|
|
187
|
+
example: 'uploads/users/abc123/profile-photo.png'
|
|
188
|
+
}),
|
|
176
189
|
_ts_metadata("design:type", String)
|
|
177
190
|
], FileManagerResponseDto.prototype, "key", void 0);
|
|
178
191
|
_ts_decorate([
|
|
179
|
-
(0,
|
|
192
|
+
(0, _classtransformer.Expose)(),
|
|
193
|
+
(0, _swagger.ApiProperty)({
|
|
194
|
+
description: 'File size in bytes',
|
|
195
|
+
example: '204800'
|
|
196
|
+
}),
|
|
180
197
|
_ts_metadata("design:type", String)
|
|
181
198
|
], FileManagerResponseDto.prototype, "size", void 0);
|
|
182
199
|
_ts_decorate([
|
|
183
|
-
(0,
|
|
200
|
+
(0, _classtransformer.Expose)(),
|
|
201
|
+
(0, _swagger.ApiProperty)({
|
|
202
|
+
description: 'MIME type of the file',
|
|
203
|
+
example: 'image/png'
|
|
204
|
+
}),
|
|
184
205
|
_ts_metadata("design:type", String)
|
|
185
206
|
], FileManagerResponseDto.prototype, "contentType", void 0);
|
|
186
207
|
_ts_decorate([
|
|
187
|
-
(0,
|
|
208
|
+
(0, _classtransformer.Expose)(),
|
|
209
|
+
(0, _swagger.ApiProperty)({
|
|
210
|
+
description: 'Whether the file is private and requires signed URL access',
|
|
211
|
+
example: false
|
|
212
|
+
}),
|
|
188
213
|
_ts_metadata("design:type", Boolean)
|
|
189
214
|
], FileManagerResponseDto.prototype, "isPrivate", void 0);
|
|
190
215
|
_ts_decorate([
|
|
191
|
-
(0,
|
|
216
|
+
(0, _classtransformer.Expose)(),
|
|
217
|
+
(0, _swagger.ApiPropertyOptional)({
|
|
218
|
+
description: 'ID of the folder this file belongs to; absent if in root',
|
|
219
|
+
example: 'a1b2c3d4-0000-0000-0000-000000000001'
|
|
220
|
+
}),
|
|
192
221
|
_ts_metadata("design:type", String)
|
|
193
222
|
], FileManagerResponseDto.prototype, "folderId", void 0);
|
|
194
223
|
_ts_decorate([
|
|
195
|
-
(0,
|
|
224
|
+
(0, _classtransformer.Expose)(),
|
|
225
|
+
(0, _swagger.ApiPropertyOptional)({
|
|
226
|
+
description: 'ID of the storage configuration used to store this file',
|
|
227
|
+
example: 'a1b2c3d4-0000-0000-0000-000000000002'
|
|
228
|
+
}),
|
|
196
229
|
_ts_metadata("design:type", String)
|
|
197
230
|
], FileManagerResponseDto.prototype, "storageConfigId", void 0);
|
|
198
231
|
_ts_decorate([
|
|
199
|
-
(0,
|
|
232
|
+
(0, _classtransformer.Expose)(),
|
|
233
|
+
(0, _swagger.ApiPropertyOptional)({
|
|
234
|
+
description: 'Storage provider type (e.g. s3, gcs, local)',
|
|
235
|
+
example: 's3'
|
|
236
|
+
}),
|
|
200
237
|
_ts_metadata("design:type", String)
|
|
201
238
|
], FileManagerResponseDto.prototype, "location", void 0);
|
|
202
239
|
_ts_decorate([
|
|
240
|
+
(0, _classtransformer.Expose)(),
|
|
203
241
|
(0, _swagger.ApiPropertyOptional)({
|
|
204
|
-
description: '
|
|
242
|
+
description: 'Human-readable name of the storage provider',
|
|
243
|
+
example: 'AWS S3 — Production Bucket'
|
|
205
244
|
}),
|
|
206
245
|
_ts_metadata("design:type", String)
|
|
207
246
|
], FileManagerResponseDto.prototype, "providerName", void 0);
|
|
@@ -212,6 +251,7 @@ let GetFilesRequestDto = class GetFilesRequestDto {
|
|
|
212
251
|
};
|
|
213
252
|
_ts_decorate([
|
|
214
253
|
(0, _swagger.ApiProperty)({
|
|
254
|
+
description: 'Unique identifier of the file to retrieve',
|
|
215
255
|
example: 'f2e9c8d0-7a2a-11eb-9439-0242ac130002'
|
|
216
256
|
}),
|
|
217
257
|
(0, _classvalidator.IsUUID)(),
|
|
@@ -230,36 +270,58 @@ let FilesResponseDto = class FilesResponseDto {
|
|
|
230
270
|
}
|
|
231
271
|
};
|
|
232
272
|
_ts_decorate([
|
|
233
|
-
(0,
|
|
273
|
+
(0, _classtransformer.Expose)(),
|
|
274
|
+
(0, _swagger.ApiProperty)({
|
|
275
|
+
description: 'Unique identifier of the file',
|
|
276
|
+
example: 'f2e9c8d0-7a2a-11eb-9439-0242ac130002'
|
|
277
|
+
}),
|
|
234
278
|
_ts_metadata("design:type", String)
|
|
235
279
|
], FilesResponseDto.prototype, "id", void 0);
|
|
236
280
|
_ts_decorate([
|
|
237
|
-
(0,
|
|
281
|
+
(0, _classtransformer.Expose)(),
|
|
282
|
+
(0, _swagger.ApiProperty)({
|
|
283
|
+
description: 'Original filename as uploaded',
|
|
284
|
+
example: 'quarterly-report.pdf'
|
|
285
|
+
}),
|
|
238
286
|
_ts_metadata("design:type", String)
|
|
239
287
|
], FilesResponseDto.prototype, "name", void 0);
|
|
240
288
|
_ts_decorate([
|
|
241
|
-
(0,
|
|
289
|
+
(0, _classtransformer.Expose)(),
|
|
290
|
+
(0, _swagger.ApiProperty)({
|
|
291
|
+
description: 'MIME type of the file',
|
|
292
|
+
example: 'application/pdf'
|
|
293
|
+
}),
|
|
242
294
|
_ts_metadata("design:type", String)
|
|
243
295
|
], FilesResponseDto.prototype, "contentType", void 0);
|
|
244
296
|
_ts_decorate([
|
|
245
|
-
(0,
|
|
297
|
+
(0, _classtransformer.Expose)(),
|
|
298
|
+
(0, _swagger.ApiProperty)({
|
|
299
|
+
description: 'Publicly accessible or pre-signed URL to download the file',
|
|
300
|
+
example: 'https://cdn.example.com/uploads/quarterly-report.pdf'
|
|
301
|
+
}),
|
|
246
302
|
_ts_metadata("design:type", String)
|
|
247
303
|
], FilesResponseDto.prototype, "url", void 0);
|
|
248
304
|
_ts_decorate([
|
|
305
|
+
(0, _classtransformer.Expose)(),
|
|
249
306
|
(0, _swagger.ApiPropertyOptional)({
|
|
250
|
-
description: 'Storage provider type'
|
|
307
|
+
description: 'Storage provider type (e.g. s3, gcs, local)',
|
|
308
|
+
example: 'gcs'
|
|
251
309
|
}),
|
|
252
310
|
_ts_metadata("design:type", String)
|
|
253
311
|
], FilesResponseDto.prototype, "location", void 0);
|
|
254
312
|
_ts_decorate([
|
|
313
|
+
(0, _classtransformer.Expose)(),
|
|
255
314
|
(0, _swagger.ApiPropertyOptional)({
|
|
256
|
-
description: '
|
|
315
|
+
description: 'ID of the storage configuration used to store this file',
|
|
316
|
+
example: 'a1b2c3d4-0000-0000-0000-000000000002'
|
|
257
317
|
}),
|
|
258
318
|
_ts_metadata("design:type", String)
|
|
259
319
|
], FilesResponseDto.prototype, "storageConfigId", void 0);
|
|
260
320
|
_ts_decorate([
|
|
321
|
+
(0, _classtransformer.Expose)(),
|
|
261
322
|
(0, _swagger.ApiPropertyOptional)({
|
|
262
|
-
description: '
|
|
323
|
+
description: 'Human-readable name of the storage provider',
|
|
324
|
+
example: 'Google Cloud Storage — EU'
|
|
263
325
|
}),
|
|
264
326
|
_ts_metadata("design:type", String)
|
|
265
327
|
], FilesResponseDto.prototype, "providerName", void 0);
|
package/cjs/dtos/folder.dto.js
CHANGED
|
@@ -20,6 +20,7 @@ _export(exports, {
|
|
|
20
20
|
}
|
|
21
21
|
});
|
|
22
22
|
const _swagger = require("@nestjs/swagger");
|
|
23
|
+
const _classtransformer = require("class-transformer");
|
|
23
24
|
const _classvalidator = require("class-validator");
|
|
24
25
|
function _define_property(obj, key, value) {
|
|
25
26
|
if (key in obj) {
|
|
@@ -79,14 +80,26 @@ let FolderResponseDto = class FolderResponseDto {
|
|
|
79
80
|
}
|
|
80
81
|
};
|
|
81
82
|
_ts_decorate([
|
|
82
|
-
(0,
|
|
83
|
+
(0, _classtransformer.Expose)(),
|
|
84
|
+
(0, _swagger.ApiProperty)({
|
|
85
|
+
description: 'Unique identifier of the folder',
|
|
86
|
+
example: 'f2e9c8d0-7a2a-11eb-9439-0242ac130002'
|
|
87
|
+
}),
|
|
83
88
|
_ts_metadata("design:type", String)
|
|
84
89
|
], FolderResponseDto.prototype, "id", void 0);
|
|
85
90
|
_ts_decorate([
|
|
86
|
-
(0,
|
|
91
|
+
(0, _classtransformer.Expose)(),
|
|
92
|
+
(0, _swagger.ApiProperty)({
|
|
93
|
+
description: 'Human-readable name of the folder',
|
|
94
|
+
example: 'Profile Photos'
|
|
95
|
+
}),
|
|
87
96
|
_ts_metadata("design:type", String)
|
|
88
97
|
], FolderResponseDto.prototype, "name", void 0);
|
|
89
98
|
_ts_decorate([
|
|
90
|
-
(0,
|
|
99
|
+
(0, _classtransformer.Expose)(),
|
|
100
|
+
(0, _swagger.ApiProperty)({
|
|
101
|
+
description: 'URL-friendly unique identifier derived from the folder name',
|
|
102
|
+
example: 'profile-photos'
|
|
103
|
+
}),
|
|
91
104
|
_ts_metadata("design:type", String)
|
|
92
105
|
], FolderResponseDto.prototype, "slug", void 0);
|
|
@@ -20,9 +20,10 @@ _export(exports, {
|
|
|
20
20
|
}
|
|
21
21
|
});
|
|
22
22
|
const _dtos = require("@flusys/nestjs-shared/dtos");
|
|
23
|
-
const _enums = require("../enums");
|
|
24
23
|
const _swagger = require("@nestjs/swagger");
|
|
24
|
+
const _classtransformer = require("class-transformer");
|
|
25
25
|
const _classvalidator = require("class-validator");
|
|
26
|
+
const _enums = require("../enums");
|
|
26
27
|
function _define_property(obj, key, value) {
|
|
27
28
|
if (key in obj) {
|
|
28
29
|
Object.defineProperty(obj, key, {
|
|
@@ -121,3 +122,49 @@ let StorageConfigResponseDto = class StorageConfigResponseDto extends _dtos.Iden
|
|
|
121
122
|
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);
|
|
122
123
|
}
|
|
123
124
|
};
|
|
125
|
+
_ts_decorate([
|
|
126
|
+
(0, _classtransformer.Expose)(),
|
|
127
|
+
(0, _swagger.ApiProperty)({
|
|
128
|
+
description: 'Human-readable name for this storage configuration',
|
|
129
|
+
example: 'AWS S3 — Production Bucket'
|
|
130
|
+
}),
|
|
131
|
+
_ts_metadata("design:type", String)
|
|
132
|
+
], StorageConfigResponseDto.prototype, "name", void 0);
|
|
133
|
+
_ts_decorate([
|
|
134
|
+
(0, _classtransformer.Expose)(),
|
|
135
|
+
(0, _swagger.ApiProperty)({
|
|
136
|
+
description: 'Storage provider type',
|
|
137
|
+
example: 's3'
|
|
138
|
+
}),
|
|
139
|
+
_ts_metadata("design:type", String)
|
|
140
|
+
], StorageConfigResponseDto.prototype, "storage", void 0);
|
|
141
|
+
_ts_decorate([
|
|
142
|
+
(0, _classtransformer.Expose)(),
|
|
143
|
+
(0, _swagger.ApiProperty)({
|
|
144
|
+
description: 'Provider-specific configuration key-value pairs',
|
|
145
|
+
type: 'object',
|
|
146
|
+
additionalProperties: true,
|
|
147
|
+
example: {
|
|
148
|
+
bucket: 'my-production-bucket',
|
|
149
|
+
region: 'us-east-1',
|
|
150
|
+
endpoint: 'https://s3.amazonaws.com'
|
|
151
|
+
}
|
|
152
|
+
}),
|
|
153
|
+
_ts_metadata("design:type", typeof Record === "undefined" ? Object : Record)
|
|
154
|
+
], StorageConfigResponseDto.prototype, "config", void 0);
|
|
155
|
+
_ts_decorate([
|
|
156
|
+
(0, _classtransformer.Expose)(),
|
|
157
|
+
(0, _swagger.ApiProperty)({
|
|
158
|
+
description: 'Whether this storage configuration is currently active',
|
|
159
|
+
example: true
|
|
160
|
+
}),
|
|
161
|
+
_ts_metadata("design:type", Boolean)
|
|
162
|
+
], StorageConfigResponseDto.prototype, "isActive", void 0);
|
|
163
|
+
_ts_decorate([
|
|
164
|
+
(0, _classtransformer.Expose)(),
|
|
165
|
+
(0, _swagger.ApiProperty)({
|
|
166
|
+
description: 'Whether this is the default storage configuration',
|
|
167
|
+
example: false
|
|
168
|
+
}),
|
|
169
|
+
_ts_metadata("design:type", Boolean)
|
|
170
|
+
], StorageConfigResponseDto.prototype, "isDefault", void 0);
|
package/cjs/dtos/upload.dto.js
CHANGED
|
@@ -26,8 +26,8 @@ _export(exports, {
|
|
|
26
26
|
}
|
|
27
27
|
});
|
|
28
28
|
const _swagger = require("@nestjs/swagger");
|
|
29
|
-
const _classvalidator = require("class-validator");
|
|
30
29
|
const _classtransformer = require("class-transformer");
|
|
30
|
+
const _classvalidator = require("class-validator");
|
|
31
31
|
function _define_property(obj, key, value) {
|
|
32
32
|
if (key in obj) {
|
|
33
33
|
Object.defineProperty(obj, key, {
|
|
@@ -222,40 +222,51 @@ let FileUploadResponsePayloadDto = class FileUploadResponsePayloadDto {
|
|
|
222
222
|
}
|
|
223
223
|
};
|
|
224
224
|
_ts_decorate([
|
|
225
|
+
(0, _classtransformer.Expose)(),
|
|
225
226
|
(0, _swagger.ApiProperty)({
|
|
226
|
-
|
|
227
|
+
description: 'Original filename of the uploaded file',
|
|
228
|
+
example: 'profile-photo.jpg'
|
|
227
229
|
}),
|
|
228
230
|
_ts_metadata("design:type", String)
|
|
229
231
|
], FileUploadResponsePayloadDto.prototype, "name", void 0);
|
|
230
232
|
_ts_decorate([
|
|
233
|
+
(0, _classtransformer.Expose)(),
|
|
231
234
|
(0, _swagger.ApiProperty)({
|
|
235
|
+
description: 'MIME type of the uploaded file',
|
|
232
236
|
example: 'image/jpeg'
|
|
233
237
|
}),
|
|
234
238
|
_ts_metadata("design:type", String)
|
|
235
239
|
], FileUploadResponsePayloadDto.prototype, "contentType", void 0);
|
|
236
240
|
_ts_decorate([
|
|
241
|
+
(0, _classtransformer.Expose)(),
|
|
237
242
|
(0, _swagger.ApiProperty)({
|
|
238
|
-
|
|
243
|
+
description: 'File size in bytes',
|
|
244
|
+
example: 204800,
|
|
245
|
+
minimum: 0
|
|
239
246
|
}),
|
|
240
247
|
_ts_metadata("design:type", Number)
|
|
241
248
|
], FileUploadResponsePayloadDto.prototype, "size", void 0);
|
|
242
249
|
_ts_decorate([
|
|
250
|
+
(0, _classtransformer.Expose)(),
|
|
243
251
|
(0, _swagger.ApiProperty)({
|
|
244
|
-
|
|
252
|
+
description: 'Storage key / path used to retrieve the file from the provider',
|
|
253
|
+
example: 'uploads/users/abc123/profile-photo.jpg'
|
|
245
254
|
}),
|
|
246
255
|
_ts_metadata("design:type", String)
|
|
247
256
|
], FileUploadResponsePayloadDto.prototype, "key", void 0);
|
|
248
257
|
_ts_decorate([
|
|
258
|
+
(0, _classtransformer.Expose)(),
|
|
249
259
|
(0, _swagger.ApiProperty)({
|
|
250
|
-
|
|
251
|
-
|
|
260
|
+
description: 'Storage provider type (e.g. s3, gcs, local)',
|
|
261
|
+
example: 's3'
|
|
252
262
|
}),
|
|
253
263
|
_ts_metadata("design:type", String)
|
|
254
264
|
], FileUploadResponsePayloadDto.prototype, "location", void 0);
|
|
255
265
|
_ts_decorate([
|
|
266
|
+
(0, _classtransformer.Expose)(),
|
|
256
267
|
(0, _swagger.ApiProperty)({
|
|
257
|
-
|
|
258
|
-
|
|
268
|
+
description: 'ID of the storage configuration used to store this file',
|
|
269
|
+
example: '123e4567-e89b-12d3-a456-426614174000'
|
|
259
270
|
}),
|
|
260
271
|
_ts_metadata("design:type", String)
|
|
261
272
|
], FileUploadResponsePayloadDto.prototype, "storageConfigId", void 0);
|
|
@@ -21,6 +21,7 @@ function _ts_metadata(k, v) {
|
|
|
21
21
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
22
22
|
}
|
|
23
23
|
import { ApiProperty, ApiPropertyOptional, PartialType } from '@nestjs/swagger';
|
|
24
|
+
import { Expose } from 'class-transformer';
|
|
24
25
|
import { IsBoolean, IsEnum, IsNotEmpty, IsOptional, IsString, IsUUID } from 'class-validator';
|
|
25
26
|
import { FileLocationEnum } from '../enums';
|
|
26
27
|
export class CreateFileManagerDto {
|
|
@@ -137,44 +138,82 @@ export class FileManagerResponseDto {
|
|
|
137
138
|
}
|
|
138
139
|
}
|
|
139
140
|
_ts_decorate([
|
|
140
|
-
|
|
141
|
+
Expose(),
|
|
142
|
+
ApiProperty({
|
|
143
|
+
description: 'Unique identifier of the file',
|
|
144
|
+
example: 'f2e9c8d0-7a2a-11eb-9439-0242ac130002'
|
|
145
|
+
}),
|
|
141
146
|
_ts_metadata("design:type", String)
|
|
142
147
|
], FileManagerResponseDto.prototype, "id", void 0);
|
|
143
148
|
_ts_decorate([
|
|
144
|
-
|
|
149
|
+
Expose(),
|
|
150
|
+
ApiProperty({
|
|
151
|
+
description: 'Original filename as uploaded',
|
|
152
|
+
example: 'profile-photo.png'
|
|
153
|
+
}),
|
|
145
154
|
_ts_metadata("design:type", String)
|
|
146
155
|
], FileManagerResponseDto.prototype, "name", void 0);
|
|
147
156
|
_ts_decorate([
|
|
148
|
-
|
|
157
|
+
Expose(),
|
|
158
|
+
ApiProperty({
|
|
159
|
+
description: 'Storage key / path used to retrieve the file from the provider',
|
|
160
|
+
example: 'uploads/users/abc123/profile-photo.png'
|
|
161
|
+
}),
|
|
149
162
|
_ts_metadata("design:type", String)
|
|
150
163
|
], FileManagerResponseDto.prototype, "key", void 0);
|
|
151
164
|
_ts_decorate([
|
|
152
|
-
|
|
165
|
+
Expose(),
|
|
166
|
+
ApiProperty({
|
|
167
|
+
description: 'File size in bytes',
|
|
168
|
+
example: '204800'
|
|
169
|
+
}),
|
|
153
170
|
_ts_metadata("design:type", String)
|
|
154
171
|
], FileManagerResponseDto.prototype, "size", void 0);
|
|
155
172
|
_ts_decorate([
|
|
156
|
-
|
|
173
|
+
Expose(),
|
|
174
|
+
ApiProperty({
|
|
175
|
+
description: 'MIME type of the file',
|
|
176
|
+
example: 'image/png'
|
|
177
|
+
}),
|
|
157
178
|
_ts_metadata("design:type", String)
|
|
158
179
|
], FileManagerResponseDto.prototype, "contentType", void 0);
|
|
159
180
|
_ts_decorate([
|
|
160
|
-
|
|
181
|
+
Expose(),
|
|
182
|
+
ApiProperty({
|
|
183
|
+
description: 'Whether the file is private and requires signed URL access',
|
|
184
|
+
example: false
|
|
185
|
+
}),
|
|
161
186
|
_ts_metadata("design:type", Boolean)
|
|
162
187
|
], FileManagerResponseDto.prototype, "isPrivate", void 0);
|
|
163
188
|
_ts_decorate([
|
|
164
|
-
|
|
189
|
+
Expose(),
|
|
190
|
+
ApiPropertyOptional({
|
|
191
|
+
description: 'ID of the folder this file belongs to; absent if in root',
|
|
192
|
+
example: 'a1b2c3d4-0000-0000-0000-000000000001'
|
|
193
|
+
}),
|
|
165
194
|
_ts_metadata("design:type", String)
|
|
166
195
|
], FileManagerResponseDto.prototype, "folderId", void 0);
|
|
167
196
|
_ts_decorate([
|
|
168
|
-
|
|
197
|
+
Expose(),
|
|
198
|
+
ApiPropertyOptional({
|
|
199
|
+
description: 'ID of the storage configuration used to store this file',
|
|
200
|
+
example: 'a1b2c3d4-0000-0000-0000-000000000002'
|
|
201
|
+
}),
|
|
169
202
|
_ts_metadata("design:type", String)
|
|
170
203
|
], FileManagerResponseDto.prototype, "storageConfigId", void 0);
|
|
171
204
|
_ts_decorate([
|
|
172
|
-
|
|
205
|
+
Expose(),
|
|
206
|
+
ApiPropertyOptional({
|
|
207
|
+
description: 'Storage provider type (e.g. s3, gcs, local)',
|
|
208
|
+
example: 's3'
|
|
209
|
+
}),
|
|
173
210
|
_ts_metadata("design:type", String)
|
|
174
211
|
], FileManagerResponseDto.prototype, "location", void 0);
|
|
175
212
|
_ts_decorate([
|
|
213
|
+
Expose(),
|
|
176
214
|
ApiPropertyOptional({
|
|
177
|
-
description: '
|
|
215
|
+
description: 'Human-readable name of the storage provider',
|
|
216
|
+
example: 'AWS S3 — Production Bucket'
|
|
178
217
|
}),
|
|
179
218
|
_ts_metadata("design:type", String)
|
|
180
219
|
], FileManagerResponseDto.prototype, "providerName", void 0);
|
|
@@ -185,6 +224,7 @@ export class GetFilesRequestDto {
|
|
|
185
224
|
}
|
|
186
225
|
_ts_decorate([
|
|
187
226
|
ApiProperty({
|
|
227
|
+
description: 'Unique identifier of the file to retrieve',
|
|
188
228
|
example: 'f2e9c8d0-7a2a-11eb-9439-0242ac130002'
|
|
189
229
|
}),
|
|
190
230
|
IsUUID(),
|
|
@@ -203,36 +243,58 @@ export class FilesResponseDto {
|
|
|
203
243
|
}
|
|
204
244
|
}
|
|
205
245
|
_ts_decorate([
|
|
206
|
-
|
|
246
|
+
Expose(),
|
|
247
|
+
ApiProperty({
|
|
248
|
+
description: 'Unique identifier of the file',
|
|
249
|
+
example: 'f2e9c8d0-7a2a-11eb-9439-0242ac130002'
|
|
250
|
+
}),
|
|
207
251
|
_ts_metadata("design:type", String)
|
|
208
252
|
], FilesResponseDto.prototype, "id", void 0);
|
|
209
253
|
_ts_decorate([
|
|
210
|
-
|
|
254
|
+
Expose(),
|
|
255
|
+
ApiProperty({
|
|
256
|
+
description: 'Original filename as uploaded',
|
|
257
|
+
example: 'quarterly-report.pdf'
|
|
258
|
+
}),
|
|
211
259
|
_ts_metadata("design:type", String)
|
|
212
260
|
], FilesResponseDto.prototype, "name", void 0);
|
|
213
261
|
_ts_decorate([
|
|
214
|
-
|
|
262
|
+
Expose(),
|
|
263
|
+
ApiProperty({
|
|
264
|
+
description: 'MIME type of the file',
|
|
265
|
+
example: 'application/pdf'
|
|
266
|
+
}),
|
|
215
267
|
_ts_metadata("design:type", String)
|
|
216
268
|
], FilesResponseDto.prototype, "contentType", void 0);
|
|
217
269
|
_ts_decorate([
|
|
218
|
-
|
|
270
|
+
Expose(),
|
|
271
|
+
ApiProperty({
|
|
272
|
+
description: 'Publicly accessible or pre-signed URL to download the file',
|
|
273
|
+
example: 'https://cdn.example.com/uploads/quarterly-report.pdf'
|
|
274
|
+
}),
|
|
219
275
|
_ts_metadata("design:type", String)
|
|
220
276
|
], FilesResponseDto.prototype, "url", void 0);
|
|
221
277
|
_ts_decorate([
|
|
278
|
+
Expose(),
|
|
222
279
|
ApiPropertyOptional({
|
|
223
|
-
description: 'Storage provider type'
|
|
280
|
+
description: 'Storage provider type (e.g. s3, gcs, local)',
|
|
281
|
+
example: 'gcs'
|
|
224
282
|
}),
|
|
225
283
|
_ts_metadata("design:type", String)
|
|
226
284
|
], FilesResponseDto.prototype, "location", void 0);
|
|
227
285
|
_ts_decorate([
|
|
286
|
+
Expose(),
|
|
228
287
|
ApiPropertyOptional({
|
|
229
|
-
description: '
|
|
288
|
+
description: 'ID of the storage configuration used to store this file',
|
|
289
|
+
example: 'a1b2c3d4-0000-0000-0000-000000000002'
|
|
230
290
|
}),
|
|
231
291
|
_ts_metadata("design:type", String)
|
|
232
292
|
], FilesResponseDto.prototype, "storageConfigId", void 0);
|
|
233
293
|
_ts_decorate([
|
|
294
|
+
Expose(),
|
|
234
295
|
ApiPropertyOptional({
|
|
235
|
-
description: '
|
|
296
|
+
description: 'Human-readable name of the storage provider',
|
|
297
|
+
example: 'Google Cloud Storage — EU'
|
|
236
298
|
}),
|
|
237
299
|
_ts_metadata("design:type", String)
|
|
238
300
|
], FilesResponseDto.prototype, "providerName", void 0);
|
package/fesm/dtos/folder.dto.js
CHANGED
|
@@ -21,6 +21,7 @@ function _ts_metadata(k, v) {
|
|
|
21
21
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
22
22
|
}
|
|
23
23
|
import { ApiProperty, PartialType } from '@nestjs/swagger';
|
|
24
|
+
import { Expose } from 'class-transformer';
|
|
24
25
|
import { IsNotEmpty, IsString, IsUUID } from 'class-validator';
|
|
25
26
|
export class CreateFolderDto {
|
|
26
27
|
constructor(){
|
|
@@ -58,14 +59,26 @@ export class FolderResponseDto {
|
|
|
58
59
|
}
|
|
59
60
|
}
|
|
60
61
|
_ts_decorate([
|
|
61
|
-
|
|
62
|
+
Expose(),
|
|
63
|
+
ApiProperty({
|
|
64
|
+
description: 'Unique identifier of the folder',
|
|
65
|
+
example: 'f2e9c8d0-7a2a-11eb-9439-0242ac130002'
|
|
66
|
+
}),
|
|
62
67
|
_ts_metadata("design:type", String)
|
|
63
68
|
], FolderResponseDto.prototype, "id", void 0);
|
|
64
69
|
_ts_decorate([
|
|
65
|
-
|
|
70
|
+
Expose(),
|
|
71
|
+
ApiProperty({
|
|
72
|
+
description: 'Human-readable name of the folder',
|
|
73
|
+
example: 'Profile Photos'
|
|
74
|
+
}),
|
|
66
75
|
_ts_metadata("design:type", String)
|
|
67
76
|
], FolderResponseDto.prototype, "name", void 0);
|
|
68
77
|
_ts_decorate([
|
|
69
|
-
|
|
78
|
+
Expose(),
|
|
79
|
+
ApiProperty({
|
|
80
|
+
description: 'URL-friendly unique identifier derived from the folder name',
|
|
81
|
+
example: 'profile-photos'
|
|
82
|
+
}),
|
|
70
83
|
_ts_metadata("design:type", String)
|
|
71
84
|
], FolderResponseDto.prototype, "slug", void 0);
|
|
@@ -21,9 +21,10 @@ function _ts_metadata(k, v) {
|
|
|
21
21
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
22
22
|
}
|
|
23
23
|
import { IdentityResponseDto } from '@flusys/nestjs-shared/dtos';
|
|
24
|
-
import { FileLocationEnum } from '../enums';
|
|
25
24
|
import { ApiProperty, ApiPropertyOptional, OmitType, PartialType } from '@nestjs/swagger';
|
|
25
|
+
import { Expose } from 'class-transformer';
|
|
26
26
|
import { IsBoolean, IsEnum, IsNotEmpty, IsObject, IsOptional, IsString, IsUUID, MaxLength } from 'class-validator';
|
|
27
|
+
import { FileLocationEnum } from '../enums';
|
|
27
28
|
export class CreateStorageConfigDto {
|
|
28
29
|
constructor(){
|
|
29
30
|
_define_property(this, "name", void 0);
|
|
@@ -100,3 +101,49 @@ export class StorageConfigResponseDto extends IdentityResponseDto {
|
|
|
100
101
|
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);
|
|
101
102
|
}
|
|
102
103
|
}
|
|
104
|
+
_ts_decorate([
|
|
105
|
+
Expose(),
|
|
106
|
+
ApiProperty({
|
|
107
|
+
description: 'Human-readable name for this storage configuration',
|
|
108
|
+
example: 'AWS S3 — Production Bucket'
|
|
109
|
+
}),
|
|
110
|
+
_ts_metadata("design:type", String)
|
|
111
|
+
], StorageConfigResponseDto.prototype, "name", void 0);
|
|
112
|
+
_ts_decorate([
|
|
113
|
+
Expose(),
|
|
114
|
+
ApiProperty({
|
|
115
|
+
description: 'Storage provider type',
|
|
116
|
+
example: 's3'
|
|
117
|
+
}),
|
|
118
|
+
_ts_metadata("design:type", String)
|
|
119
|
+
], StorageConfigResponseDto.prototype, "storage", void 0);
|
|
120
|
+
_ts_decorate([
|
|
121
|
+
Expose(),
|
|
122
|
+
ApiProperty({
|
|
123
|
+
description: 'Provider-specific configuration key-value pairs',
|
|
124
|
+
type: 'object',
|
|
125
|
+
additionalProperties: true,
|
|
126
|
+
example: {
|
|
127
|
+
bucket: 'my-production-bucket',
|
|
128
|
+
region: 'us-east-1',
|
|
129
|
+
endpoint: 'https://s3.amazonaws.com'
|
|
130
|
+
}
|
|
131
|
+
}),
|
|
132
|
+
_ts_metadata("design:type", typeof Record === "undefined" ? Object : Record)
|
|
133
|
+
], StorageConfigResponseDto.prototype, "config", void 0);
|
|
134
|
+
_ts_decorate([
|
|
135
|
+
Expose(),
|
|
136
|
+
ApiProperty({
|
|
137
|
+
description: 'Whether this storage configuration is currently active',
|
|
138
|
+
example: true
|
|
139
|
+
}),
|
|
140
|
+
_ts_metadata("design:type", Boolean)
|
|
141
|
+
], StorageConfigResponseDto.prototype, "isActive", void 0);
|
|
142
|
+
_ts_decorate([
|
|
143
|
+
Expose(),
|
|
144
|
+
ApiProperty({
|
|
145
|
+
description: 'Whether this is the default storage configuration',
|
|
146
|
+
example: false
|
|
147
|
+
}),
|
|
148
|
+
_ts_metadata("design:type", Boolean)
|
|
149
|
+
], StorageConfigResponseDto.prototype, "isDefault", void 0);
|
package/fesm/dtos/upload.dto.js
CHANGED
|
@@ -21,8 +21,8 @@ function _ts_metadata(k, v) {
|
|
|
21
21
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
22
22
|
}
|
|
23
23
|
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
|
24
|
+
import { Expose, Type } from 'class-transformer';
|
|
24
25
|
import { IsArray, IsBoolean, IsEnum, IsInt, IsNotEmpty, IsOptional, IsString, IsUUID, Matches, Max, Min } from 'class-validator';
|
|
25
|
-
import { Type } from 'class-transformer';
|
|
26
26
|
export var ImageFormat = /*#__PURE__*/ function(ImageFormat) {
|
|
27
27
|
ImageFormat["ORIGINAL"] = "original";
|
|
28
28
|
ImageFormat["JPEG"] = "jpeg";
|
|
@@ -195,40 +195,51 @@ export class FileUploadResponsePayloadDto {
|
|
|
195
195
|
}
|
|
196
196
|
}
|
|
197
197
|
_ts_decorate([
|
|
198
|
+
Expose(),
|
|
198
199
|
ApiProperty({
|
|
199
|
-
|
|
200
|
+
description: 'Original filename of the uploaded file',
|
|
201
|
+
example: 'profile-photo.jpg'
|
|
200
202
|
}),
|
|
201
203
|
_ts_metadata("design:type", String)
|
|
202
204
|
], FileUploadResponsePayloadDto.prototype, "name", void 0);
|
|
203
205
|
_ts_decorate([
|
|
206
|
+
Expose(),
|
|
204
207
|
ApiProperty({
|
|
208
|
+
description: 'MIME type of the uploaded file',
|
|
205
209
|
example: 'image/jpeg'
|
|
206
210
|
}),
|
|
207
211
|
_ts_metadata("design:type", String)
|
|
208
212
|
], FileUploadResponsePayloadDto.prototype, "contentType", void 0);
|
|
209
213
|
_ts_decorate([
|
|
214
|
+
Expose(),
|
|
210
215
|
ApiProperty({
|
|
211
|
-
|
|
216
|
+
description: 'File size in bytes',
|
|
217
|
+
example: 204800,
|
|
218
|
+
minimum: 0
|
|
212
219
|
}),
|
|
213
220
|
_ts_metadata("design:type", Number)
|
|
214
221
|
], FileUploadResponsePayloadDto.prototype, "size", void 0);
|
|
215
222
|
_ts_decorate([
|
|
223
|
+
Expose(),
|
|
216
224
|
ApiProperty({
|
|
217
|
-
|
|
225
|
+
description: 'Storage key / path used to retrieve the file from the provider',
|
|
226
|
+
example: 'uploads/users/abc123/profile-photo.jpg'
|
|
218
227
|
}),
|
|
219
228
|
_ts_metadata("design:type", String)
|
|
220
229
|
], FileUploadResponsePayloadDto.prototype, "key", void 0);
|
|
221
230
|
_ts_decorate([
|
|
231
|
+
Expose(),
|
|
222
232
|
ApiProperty({
|
|
223
|
-
|
|
224
|
-
|
|
233
|
+
description: 'Storage provider type (e.g. s3, gcs, local)',
|
|
234
|
+
example: 's3'
|
|
225
235
|
}),
|
|
226
236
|
_ts_metadata("design:type", String)
|
|
227
237
|
], FileUploadResponsePayloadDto.prototype, "location", void 0);
|
|
228
238
|
_ts_decorate([
|
|
239
|
+
Expose(),
|
|
229
240
|
ApiProperty({
|
|
230
|
-
|
|
231
|
-
|
|
241
|
+
description: 'ID of the storage configuration used to store this file',
|
|
242
|
+
example: '123e4567-e89b-12d3-a456-426614174000'
|
|
232
243
|
}),
|
|
233
244
|
_ts_metadata("design:type", String)
|
|
234
245
|
], FileUploadResponsePayloadDto.prototype, "storageConfigId", void 0);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flusys/nestjs-storage",
|
|
3
|
-
"version": "5.1.
|
|
3
|
+
"version": "5.1.2",
|
|
4
4
|
"description": "Modular storage package with optional AWS S3, Azure Blob, and SFTP providers",
|
|
5
5
|
"main": "cjs/index.js",
|
|
6
6
|
"module": "fesm/index.js",
|
|
@@ -129,7 +129,7 @@
|
|
|
129
129
|
}
|
|
130
130
|
},
|
|
131
131
|
"dependencies": {
|
|
132
|
-
"@flusys/nestjs-core": "5.1.
|
|
133
|
-
"@flusys/nestjs-shared": "5.1.
|
|
132
|
+
"@flusys/nestjs-core": "5.1.2",
|
|
133
|
+
"@flusys/nestjs-shared": "5.1.2"
|
|
134
134
|
}
|
|
135
135
|
}
|