@flusys/nestjs-storage 1.0.0-rc → 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 +44 -1
- package/cjs/config/index.js +0 -1
- package/cjs/config/storage.constants.js +0 -9
- package/cjs/controllers/upload.controller.js +12 -17
- package/cjs/docs/storage-swagger.config.js +24 -136
- package/cjs/dtos/file-manager.dto.js +64 -31
- package/cjs/dtos/folder.dto.js +15 -9
- package/cjs/dtos/storage-config.dto.js +4 -85
- package/cjs/dtos/upload.dto.js +17 -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/middlewares/file-serve.middleware.js +107 -100
- package/cjs/modules/storage.module.js +82 -136
- package/cjs/providers/azure-provider.optional.js +10 -38
- package/cjs/providers/local-provider.js +0 -43
- 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 +239 -337
- package/cjs/services/folder.service.js +3 -3
- package/cjs/services/index.js +1 -0
- package/cjs/{config → services}/storage-config.service.js +30 -79
- package/cjs/services/storage-datasource.provider.js +16 -26
- package/cjs/services/storage-provider-config.service.js +3 -3
- package/cjs/services/upload.service.js +33 -61
- package/cjs/utils/file-validator.util.js +54 -66
- package/cjs/utils/image-compressor.util.js +2 -5
- package/config/index.d.ts +0 -1
- package/config/storage.constants.d.ts +0 -6
- package/controllers/upload.controller.d.ts +1 -0
- package/dtos/file-manager.dto.d.ts +10 -1
- package/dtos/folder.dto.d.ts +3 -1
- package/dtos/storage-config.dto.d.ts +5 -8
- 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 -6
- package/fesm/controllers/upload.controller.js +12 -17
- package/fesm/docs/storage-swagger.config.js +27 -142
- package/fesm/dtos/file-manager.dto.js +65 -32
- package/fesm/dtos/folder.dto.js +16 -10
- package/fesm/dtos/storage-config.dto.js +6 -87
- package/fesm/dtos/upload.dto.js +17 -18
- 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 +4 -8
- package/fesm/entities/storage-config-with-company.entity.js +3 -4
- package/fesm/entities/storage-config.entity.js +75 -4
- package/fesm/middlewares/file-serve.middleware.js +107 -100
- package/fesm/modules/storage.module.js +83 -136
- package/fesm/providers/azure-provider.optional.js +11 -42
- package/fesm/providers/local-provider.js +0 -43
- 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 -335
- package/fesm/services/folder.service.js +1 -1
- package/fesm/services/index.js +1 -0
- package/fesm/{config → services}/storage-config.service.js +30 -79
- package/fesm/services/storage-datasource.provider.js +16 -26
- package/fesm/services/storage-provider-config.service.js +1 -1
- package/fesm/services/upload.service.js +31 -59
- package/fesm/utils/file-validator.util.js +54 -66
- package/fesm/utils/image-compressor.util.js +2 -5
- 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 +3 -3
- package/providers/azure-provider.optional.d.ts +8 -6
- package/providers/local-provider.d.ts +0 -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 +21 -14
- package/services/folder.service.d.ts +4 -4
- package/services/index.d.ts +1 -0
- package/{config → services}/storage-config.service.d.ts +9 -10
- 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 +3 -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/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
|
@@ -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);
|
package/cjs/dtos/upload.dto.js
CHANGED
|
@@ -66,7 +66,7 @@ let DeleteSingleFileDto = class DeleteSingleFileDto {
|
|
|
66
66
|
_ts_decorate([
|
|
67
67
|
(0, _swagger.ApiProperty)({
|
|
68
68
|
description: 'Key of the file to delete',
|
|
69
|
-
example: '/uploads/some
|
|
69
|
+
example: '/uploads/some-path'
|
|
70
70
|
}),
|
|
71
71
|
(0, _classvalidator.IsNotEmpty)(),
|
|
72
72
|
(0, _classvalidator.IsString)(),
|
|
@@ -74,7 +74,7 @@ _ts_decorate([
|
|
|
74
74
|
], DeleteSingleFileDto.prototype, "key", void 0);
|
|
75
75
|
_ts_decorate([
|
|
76
76
|
(0, _swagger.ApiPropertyOptional)({
|
|
77
|
-
description: 'Storage configuration ID
|
|
77
|
+
description: 'Storage configuration ID',
|
|
78
78
|
example: '123e4567-e89b-12d3-a456-426614174000'
|
|
79
79
|
}),
|
|
80
80
|
(0, _classvalidator.IsOptional)(),
|
|
@@ -89,10 +89,10 @@ let DeleteMultipleFileDto = class DeleteMultipleFileDto {
|
|
|
89
89
|
};
|
|
90
90
|
_ts_decorate([
|
|
91
91
|
(0, _swagger.ApiProperty)({
|
|
92
|
-
description: 'Array of file
|
|
92
|
+
description: 'Array of file keys to delete',
|
|
93
93
|
example: [
|
|
94
|
-
'/uploads/
|
|
95
|
-
'
|
|
94
|
+
'/uploads/file1',
|
|
95
|
+
'/uploads/file2'
|
|
96
96
|
],
|
|
97
97
|
type: [
|
|
98
98
|
String
|
|
@@ -107,7 +107,7 @@ _ts_decorate([
|
|
|
107
107
|
], DeleteMultipleFileDto.prototype, "keys", void 0);
|
|
108
108
|
_ts_decorate([
|
|
109
109
|
(0, _swagger.ApiPropertyOptional)({
|
|
110
|
-
description: 'Storage configuration ID
|
|
110
|
+
description: 'Storage configuration ID',
|
|
111
111
|
example: '123e4567-e89b-12d3-a456-426614174000'
|
|
112
112
|
}),
|
|
113
113
|
(0, _classvalidator.IsOptional)(),
|
|
@@ -127,7 +127,7 @@ let UploadOptionsDto = class UploadOptionsDto {
|
|
|
127
127
|
};
|
|
128
128
|
_ts_decorate([
|
|
129
129
|
(0, _swagger.ApiPropertyOptional)({
|
|
130
|
-
description: 'Storage configuration ID
|
|
130
|
+
description: 'Storage configuration ID',
|
|
131
131
|
example: '123e4567-e89b-12d3-a456-426614174000'
|
|
132
132
|
}),
|
|
133
133
|
(0, _classvalidator.IsOptional)(),
|
|
@@ -136,7 +136,7 @@ _ts_decorate([
|
|
|
136
136
|
], UploadOptionsDto.prototype, "storageConfigId", void 0);
|
|
137
137
|
_ts_decorate([
|
|
138
138
|
(0, _swagger.ApiPropertyOptional)({
|
|
139
|
-
description: 'Folder path
|
|
139
|
+
description: 'Folder path for upload',
|
|
140
140
|
example: 'uploads/images'
|
|
141
141
|
}),
|
|
142
142
|
(0, _classvalidator.IsOptional)(),
|
|
@@ -147,7 +147,7 @@ _ts_decorate([
|
|
|
147
147
|
], UploadOptionsDto.prototype, "folderPath", void 0);
|
|
148
148
|
_ts_decorate([
|
|
149
149
|
(0, _swagger.ApiPropertyOptional)({
|
|
150
|
-
description: 'Maximum width
|
|
150
|
+
description: 'Maximum width in pixels',
|
|
151
151
|
example: 1280,
|
|
152
152
|
minimum: 100,
|
|
153
153
|
maximum: 10000,
|
|
@@ -162,7 +162,7 @@ _ts_decorate([
|
|
|
162
162
|
], UploadOptionsDto.prototype, "maxWidth", void 0);
|
|
163
163
|
_ts_decorate([
|
|
164
164
|
(0, _swagger.ApiPropertyOptional)({
|
|
165
|
-
description: 'Maximum height
|
|
165
|
+
description: 'Maximum height in pixels',
|
|
166
166
|
example: 1280,
|
|
167
167
|
minimum: 100,
|
|
168
168
|
maximum: 10000,
|
|
@@ -177,7 +177,7 @@ _ts_decorate([
|
|
|
177
177
|
], UploadOptionsDto.prototype, "maxHeight", void 0);
|
|
178
178
|
_ts_decorate([
|
|
179
179
|
(0, _swagger.ApiPropertyOptional)({
|
|
180
|
-
description: 'Compression quality (1
|
|
180
|
+
description: 'Compression quality (1-100)',
|
|
181
181
|
example: 85,
|
|
182
182
|
minimum: 1,
|
|
183
183
|
maximum: 100,
|
|
@@ -192,7 +192,7 @@ _ts_decorate([
|
|
|
192
192
|
], UploadOptionsDto.prototype, "quality", void 0);
|
|
193
193
|
_ts_decorate([
|
|
194
194
|
(0, _swagger.ApiPropertyOptional)({
|
|
195
|
-
description: 'Output
|
|
195
|
+
description: 'Output image format',
|
|
196
196
|
enum: ImageFormat,
|
|
197
197
|
default: "original"
|
|
198
198
|
}),
|
|
@@ -202,7 +202,7 @@ _ts_decorate([
|
|
|
202
202
|
], UploadOptionsDto.prototype, "format", void 0);
|
|
203
203
|
_ts_decorate([
|
|
204
204
|
(0, _swagger.ApiPropertyOptional)({
|
|
205
|
-
description: 'Whether to compress the image
|
|
205
|
+
description: 'Whether to compress the image',
|
|
206
206
|
example: true,
|
|
207
207
|
default: true
|
|
208
208
|
}),
|
|
@@ -229,7 +229,7 @@ _ts_decorate([
|
|
|
229
229
|
], FileUploadResponsePayloadDto.prototype, "name", void 0);
|
|
230
230
|
_ts_decorate([
|
|
231
231
|
(0, _swagger.ApiProperty)({
|
|
232
|
-
example: '
|
|
232
|
+
example: 'image/jpeg'
|
|
233
233
|
}),
|
|
234
234
|
_ts_metadata("design:type", String)
|
|
235
235
|
], FileUploadResponsePayloadDto.prototype, "contentType", void 0);
|
|
@@ -241,21 +241,21 @@ _ts_decorate([
|
|
|
241
241
|
], FileUploadResponsePayloadDto.prototype, "size", void 0);
|
|
242
242
|
_ts_decorate([
|
|
243
243
|
(0, _swagger.ApiProperty)({
|
|
244
|
-
example: '
|
|
244
|
+
example: 'uploads/file123.jpg'
|
|
245
245
|
}),
|
|
246
246
|
_ts_metadata("design:type", String)
|
|
247
247
|
], FileUploadResponsePayloadDto.prototype, "key", void 0);
|
|
248
248
|
_ts_decorate([
|
|
249
249
|
(0, _swagger.ApiProperty)({
|
|
250
250
|
example: 'local',
|
|
251
|
-
description: 'Storage provider type
|
|
251
|
+
description: 'Storage provider type'
|
|
252
252
|
}),
|
|
253
253
|
_ts_metadata("design:type", String)
|
|
254
254
|
], FileUploadResponsePayloadDto.prototype, "location", void 0);
|
|
255
255
|
_ts_decorate([
|
|
256
256
|
(0, _swagger.ApiProperty)({
|
|
257
257
|
example: '123e4567-e89b-12d3-a456-426614174000',
|
|
258
|
-
description: 'Storage configuration ID
|
|
258
|
+
description: 'Storage configuration ID'
|
|
259
259
|
}),
|
|
260
260
|
_ts_metadata("design:type", String)
|
|
261
261
|
], FileUploadResponsePayloadDto.prototype, "storageConfigId", void 0);
|
|
@@ -9,7 +9,7 @@ Object.defineProperty(exports, "FileManagerWithCompany", {
|
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
11
|
const _typeorm = require("typeorm");
|
|
12
|
-
const
|
|
12
|
+
const _filemanagerentity = require("./file-manager.entity");
|
|
13
13
|
function _define_property(obj, key, value) {
|
|
14
14
|
if (key in obj) {
|
|
15
15
|
Object.defineProperty(obj, key, {
|
|
@@ -32,10 +32,9 @@ function _ts_decorate(decorators, target, key, desc) {
|
|
|
32
32
|
function _ts_metadata(k, v) {
|
|
33
33
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
34
34
|
}
|
|
35
|
-
let FileManagerWithCompany = class FileManagerWithCompany extends
|
|
35
|
+
let FileManagerWithCompany = class FileManagerWithCompany extends _filemanagerentity.FileManager {
|
|
36
36
|
constructor(...args){
|
|
37
|
-
super(...args),
|
|
38
|
-
_define_property(this, "companyId", void 0), _define_property(this, "folder", void 0);
|
|
37
|
+
super(...args), _define_property(this, "companyId", void 0);
|
|
39
38
|
}
|
|
40
39
|
};
|
|
41
40
|
_ts_decorate([
|
|
@@ -8,8 +8,9 @@ Object.defineProperty(exports, "FileManager", {
|
|
|
8
8
|
return FileManager;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
+
const _entities = require("@flusys/nestjs-shared/entities");
|
|
12
|
+
const _enums = require("../enums");
|
|
11
13
|
const _typeorm = require("typeorm");
|
|
12
|
-
const _filemanagerbaseentity = require("./file-manager-base.entity");
|
|
13
14
|
function _define_property(obj, key, value) {
|
|
14
15
|
if (key in obj) {
|
|
15
16
|
Object.defineProperty(obj, key, {
|
|
@@ -32,11 +33,78 @@ function _ts_decorate(decorators, target, key, desc) {
|
|
|
32
33
|
function _ts_metadata(k, v) {
|
|
33
34
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
34
35
|
}
|
|
35
|
-
let FileManager = class FileManager extends
|
|
36
|
+
let FileManager = class FileManager extends _entities.Identity {
|
|
36
37
|
constructor(...args){
|
|
37
|
-
super(...args), _define_property(this, "folder", void 0);
|
|
38
|
+
super(...args), _define_property(this, "name", void 0), _define_property(this, "contentType", void 0), _define_property(this, "size", void 0), _define_property(this, "key", void 0), _define_property(this, "url", void 0), _define_property(this, "location", void 0), _define_property(this, "storageConfigId", void 0), _define_property(this, "expiresAt", null), _define_property(this, "isPrivate", void 0), _define_property(this, "folder", void 0);
|
|
38
39
|
}
|
|
39
40
|
};
|
|
41
|
+
_ts_decorate([
|
|
42
|
+
(0, _typeorm.Column)({
|
|
43
|
+
type: 'varchar',
|
|
44
|
+
length: 255,
|
|
45
|
+
nullable: false
|
|
46
|
+
}),
|
|
47
|
+
_ts_metadata("design:type", String)
|
|
48
|
+
], FileManager.prototype, "name", void 0);
|
|
49
|
+
_ts_decorate([
|
|
50
|
+
(0, _typeorm.Column)({
|
|
51
|
+
type: 'varchar',
|
|
52
|
+
length: 255,
|
|
53
|
+
nullable: false
|
|
54
|
+
}),
|
|
55
|
+
_ts_metadata("design:type", String)
|
|
56
|
+
], FileManager.prototype, "contentType", void 0);
|
|
57
|
+
_ts_decorate([
|
|
58
|
+
(0, _typeorm.Column)({
|
|
59
|
+
type: 'varchar',
|
|
60
|
+
length: 255,
|
|
61
|
+
nullable: false
|
|
62
|
+
}),
|
|
63
|
+
_ts_metadata("design:type", String)
|
|
64
|
+
], FileManager.prototype, "size", void 0);
|
|
65
|
+
_ts_decorate([
|
|
66
|
+
(0, _typeorm.Column)({
|
|
67
|
+
type: 'text',
|
|
68
|
+
nullable: false
|
|
69
|
+
}),
|
|
70
|
+
_ts_metadata("design:type", String)
|
|
71
|
+
], FileManager.prototype, "key", void 0);
|
|
72
|
+
_ts_decorate([
|
|
73
|
+
(0, _typeorm.Column)({
|
|
74
|
+
type: 'text',
|
|
75
|
+
nullable: true
|
|
76
|
+
}),
|
|
77
|
+
_ts_metadata("design:type", Object)
|
|
78
|
+
], FileManager.prototype, "url", void 0);
|
|
79
|
+
_ts_decorate([
|
|
80
|
+
(0, _typeorm.Column)({
|
|
81
|
+
type: 'text',
|
|
82
|
+
nullable: false
|
|
83
|
+
}),
|
|
84
|
+
_ts_metadata("design:type", typeof _enums.FileLocationEnum === "undefined" ? Object : _enums.FileLocationEnum)
|
|
85
|
+
], FileManager.prototype, "location", void 0);
|
|
86
|
+
_ts_decorate([
|
|
87
|
+
(0, _typeorm.Column)({
|
|
88
|
+
type: 'uuid',
|
|
89
|
+
nullable: true
|
|
90
|
+
}),
|
|
91
|
+
_ts_metadata("design:type", Object)
|
|
92
|
+
], FileManager.prototype, "storageConfigId", void 0);
|
|
93
|
+
_ts_decorate([
|
|
94
|
+
(0, _typeorm.Column)({
|
|
95
|
+
type: 'bigint',
|
|
96
|
+
nullable: true
|
|
97
|
+
}),
|
|
98
|
+
_ts_metadata("design:type", Object)
|
|
99
|
+
], FileManager.prototype, "expiresAt", void 0);
|
|
100
|
+
_ts_decorate([
|
|
101
|
+
(0, _typeorm.Column)({
|
|
102
|
+
type: 'boolean',
|
|
103
|
+
nullable: false,
|
|
104
|
+
default: false
|
|
105
|
+
}),
|
|
106
|
+
_ts_metadata("design:type", Boolean)
|
|
107
|
+
], FileManager.prototype, "isPrivate", void 0);
|
|
40
108
|
_ts_decorate([
|
|
41
109
|
(0, _typeorm.ManyToOne)('Folder', (folder)=>folder.fileManager, {
|
|
42
110
|
nullable: true,
|
|
@@ -9,7 +9,7 @@ Object.defineProperty(exports, "FolderWithCompany", {
|
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
11
|
const _typeorm = require("typeorm");
|
|
12
|
-
const
|
|
12
|
+
const _folderentity = require("./folder.entity");
|
|
13
13
|
function _define_property(obj, key, value) {
|
|
14
14
|
if (key in obj) {
|
|
15
15
|
Object.defineProperty(obj, key, {
|
|
@@ -32,10 +32,9 @@ function _ts_decorate(decorators, target, key, desc) {
|
|
|
32
32
|
function _ts_metadata(k, v) {
|
|
33
33
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
34
34
|
}
|
|
35
|
-
let FolderWithCompany = class FolderWithCompany extends
|
|
35
|
+
let FolderWithCompany = class FolderWithCompany extends _folderentity.Folder {
|
|
36
36
|
constructor(...args){
|
|
37
|
-
super(...args),
|
|
38
|
-
_define_property(this, "companyId", void 0), _define_property(this, "fileManager", void 0);
|
|
37
|
+
super(...args), _define_property(this, "companyId", void 0);
|
|
39
38
|
}
|
|
40
39
|
};
|
|
41
40
|
_ts_decorate([
|
|
@@ -8,8 +8,8 @@ Object.defineProperty(exports, "Folder", {
|
|
|
8
8
|
return Folder;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
+
const _entities = require("@flusys/nestjs-shared/entities");
|
|
11
12
|
const _typeorm = require("typeorm");
|
|
12
|
-
const _folderbaseentity = require("./folder-base.entity");
|
|
13
13
|
function _define_property(obj, key, value) {
|
|
14
14
|
if (key in obj) {
|
|
15
15
|
Object.defineProperty(obj, key, {
|
|
@@ -32,11 +32,27 @@ function _ts_decorate(decorators, target, key, desc) {
|
|
|
32
32
|
function _ts_metadata(k, v) {
|
|
33
33
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
34
34
|
}
|
|
35
|
-
let Folder = class Folder extends
|
|
35
|
+
let Folder = class Folder extends _entities.Identity {
|
|
36
36
|
constructor(...args){
|
|
37
|
-
super(...args), _define_property(this, "fileManager", void 0);
|
|
37
|
+
super(...args), _define_property(this, "name", void 0), _define_property(this, "slug", void 0), _define_property(this, "fileManager", void 0);
|
|
38
38
|
}
|
|
39
39
|
};
|
|
40
|
+
_ts_decorate([
|
|
41
|
+
(0, _typeorm.Column)({
|
|
42
|
+
type: 'varchar',
|
|
43
|
+
length: 255,
|
|
44
|
+
nullable: false
|
|
45
|
+
}),
|
|
46
|
+
_ts_metadata("design:type", String)
|
|
47
|
+
], Folder.prototype, "name", void 0);
|
|
48
|
+
_ts_decorate([
|
|
49
|
+
(0, _typeorm.Column)({
|
|
50
|
+
type: 'varchar',
|
|
51
|
+
length: 255,
|
|
52
|
+
nullable: false
|
|
53
|
+
}),
|
|
54
|
+
_ts_metadata("design:type", String)
|
|
55
|
+
], Folder.prototype, "slug", void 0);
|
|
40
56
|
_ts_decorate([
|
|
41
57
|
(0, _typeorm.OneToMany)('FileManager', (fileManager)=>fileManager.folder),
|
|
42
58
|
_ts_metadata("design:type", Array)
|
package/cjs/entities/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//
|
|
1
|
+
// Entities without company feature
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
@@ -10,12 +10,18 @@ function _export(target, all) {
|
|
|
10
10
|
});
|
|
11
11
|
}
|
|
12
12
|
_export(exports, {
|
|
13
|
-
get
|
|
14
|
-
return
|
|
13
|
+
get FileManagerBase () {
|
|
14
|
+
return _filemanagerentity.FileManager;
|
|
15
|
+
},
|
|
16
|
+
get FolderBase () {
|
|
17
|
+
return _folderentity.Folder;
|
|
15
18
|
},
|
|
16
19
|
get StorageCompanyEntities () {
|
|
17
20
|
return StorageCompanyEntities;
|
|
18
21
|
},
|
|
22
|
+
get StorageConfigBase () {
|
|
23
|
+
return _storageconfigentity.StorageConfig;
|
|
24
|
+
},
|
|
19
25
|
get StorageCoreEntities () {
|
|
20
26
|
return StorageCoreEntities;
|
|
21
27
|
},
|
|
@@ -23,9 +29,6 @@ _export(exports, {
|
|
|
23
29
|
return getStorageEntitiesByConfig;
|
|
24
30
|
}
|
|
25
31
|
});
|
|
26
|
-
_export_star(require("./file-manager-base.entity"), exports);
|
|
27
|
-
_export_star(require("./folder-base.entity"), exports);
|
|
28
|
-
_export_star(require("./storage-config-base.entity"), exports);
|
|
29
32
|
const _filemanagerentity = _export_star(require("./file-manager.entity"), exports);
|
|
30
33
|
const _folderentity = _export_star(require("./folder.entity"), exports);
|
|
31
34
|
const _storageconfigentity = _export_star(require("./storage-config.entity"), exports);
|
|
@@ -55,10 +58,6 @@ const StorageCompanyEntities = [
|
|
|
55
58
|
_folderwithcompanyentity.FolderWithCompany,
|
|
56
59
|
_storageconfigwithcompanyentity.StorageConfigWithCompany
|
|
57
60
|
];
|
|
58
|
-
const StorageAllEntities = [
|
|
59
|
-
...StorageCoreEntities,
|
|
60
|
-
...StorageCompanyEntities
|
|
61
|
-
];
|
|
62
61
|
function getStorageEntitiesByConfig(enableCompanyFeature) {
|
|
63
62
|
return enableCompanyFeature ? StorageCompanyEntities : StorageCoreEntities;
|
|
64
63
|
}
|
|
@@ -9,7 +9,7 @@ Object.defineProperty(exports, "StorageConfigWithCompany", {
|
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
11
|
const _typeorm = require("typeorm");
|
|
12
|
-
const
|
|
12
|
+
const _storageconfigentity = require("./storage-config.entity");
|
|
13
13
|
function _define_property(obj, key, value) {
|
|
14
14
|
if (key in obj) {
|
|
15
15
|
Object.defineProperty(obj, key, {
|
|
@@ -32,10 +32,9 @@ function _ts_decorate(decorators, target, key, desc) {
|
|
|
32
32
|
function _ts_metadata(k, v) {
|
|
33
33
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
34
34
|
}
|
|
35
|
-
let StorageConfigWithCompany = class StorageConfigWithCompany extends
|
|
35
|
+
let StorageConfigWithCompany = class StorageConfigWithCompany extends _storageconfigentity.StorageConfig {
|
|
36
36
|
constructor(...args){
|
|
37
|
-
super(...args),
|
|
38
|
-
_define_property(this, "companyId", void 0);
|
|
37
|
+
super(...args), _define_property(this, "companyId", void 0);
|
|
39
38
|
}
|
|
40
39
|
};
|
|
41
40
|
_ts_decorate([
|
|
@@ -8,18 +8,89 @@ Object.defineProperty(exports, "StorageConfig", {
|
|
|
8
8
|
return StorageConfig;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
+
const _entities = require("@flusys/nestjs-shared/entities");
|
|
12
|
+
const _enums = require("../enums");
|
|
11
13
|
const _typeorm = require("typeorm");
|
|
12
|
-
|
|
14
|
+
function _define_property(obj, key, value) {
|
|
15
|
+
if (key in obj) {
|
|
16
|
+
Object.defineProperty(obj, key, {
|
|
17
|
+
value: value,
|
|
18
|
+
enumerable: true,
|
|
19
|
+
configurable: true,
|
|
20
|
+
writable: true
|
|
21
|
+
});
|
|
22
|
+
} else {
|
|
23
|
+
obj[key] = value;
|
|
24
|
+
}
|
|
25
|
+
return obj;
|
|
26
|
+
}
|
|
13
27
|
function _ts_decorate(decorators, target, key, desc) {
|
|
14
28
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
15
29
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
16
30
|
else for(var i = decorators.length - 1; i >= 0; i--)if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
17
31
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
18
32
|
}
|
|
19
|
-
|
|
33
|
+
function _ts_metadata(k, v) {
|
|
34
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
35
|
+
}
|
|
36
|
+
let StorageConfig = class StorageConfig extends _entities.Identity {
|
|
37
|
+
constructor(...args){
|
|
38
|
+
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);
|
|
39
|
+
}
|
|
20
40
|
};
|
|
41
|
+
_ts_decorate([
|
|
42
|
+
(0, _typeorm.Column)({
|
|
43
|
+
type: 'varchar',
|
|
44
|
+
length: 255,
|
|
45
|
+
nullable: false
|
|
46
|
+
}),
|
|
47
|
+
_ts_metadata("design:type", String)
|
|
48
|
+
], StorageConfig.prototype, "name", void 0);
|
|
49
|
+
_ts_decorate([
|
|
50
|
+
(0, _typeorm.Column)({
|
|
51
|
+
type: 'enum',
|
|
52
|
+
enum: _enums.FileLocationEnum,
|
|
53
|
+
nullable: false
|
|
54
|
+
}),
|
|
55
|
+
_ts_metadata("design:type", typeof _enums.FileLocationEnum === "undefined" ? Object : _enums.FileLocationEnum)
|
|
56
|
+
], StorageConfig.prototype, "storage", void 0);
|
|
57
|
+
_ts_decorate([
|
|
58
|
+
(0, _typeorm.Column)({
|
|
59
|
+
type: 'json',
|
|
60
|
+
nullable: false
|
|
61
|
+
}),
|
|
62
|
+
_ts_metadata("design:type", typeof Record === "undefined" ? Object : Record)
|
|
63
|
+
], StorageConfig.prototype, "config", void 0);
|
|
64
|
+
_ts_decorate([
|
|
65
|
+
(0, _typeorm.Column)({
|
|
66
|
+
type: 'boolean',
|
|
67
|
+
default: true,
|
|
68
|
+
name: 'is_active'
|
|
69
|
+
}),
|
|
70
|
+
_ts_metadata("design:type", Boolean)
|
|
71
|
+
], StorageConfig.prototype, "isActive", void 0);
|
|
72
|
+
_ts_decorate([
|
|
73
|
+
(0, _typeorm.Column)({
|
|
74
|
+
type: 'boolean',
|
|
75
|
+
default: false,
|
|
76
|
+
name: 'is_default'
|
|
77
|
+
}),
|
|
78
|
+
_ts_metadata("design:type", Boolean)
|
|
79
|
+
], StorageConfig.prototype, "isDefault", void 0);
|
|
21
80
|
StorageConfig = _ts_decorate([
|
|
22
81
|
(0, _typeorm.Entity)({
|
|
23
82
|
name: 'storage_config'
|
|
24
|
-
})
|
|
83
|
+
}),
|
|
84
|
+
(0, _typeorm.Index)([
|
|
85
|
+
'name'
|
|
86
|
+
]),
|
|
87
|
+
(0, _typeorm.Index)([
|
|
88
|
+
'storage'
|
|
89
|
+
]),
|
|
90
|
+
(0, _typeorm.Index)([
|
|
91
|
+
'isActive'
|
|
92
|
+
]),
|
|
93
|
+
(0, _typeorm.Index)([
|
|
94
|
+
'isDefault'
|
|
95
|
+
])
|
|
25
96
|
], StorageConfig);
|