@flusys/nestjs-storage 7.1.0 → 8.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/config/index.d.ts +3 -3
- package/controllers/file-manager.controller.d.ts +4 -4
- package/controllers/folder.controller.d.ts +2 -2
- package/controllers/index.d.ts +4 -4
- package/controllers/storage-config.controller.d.ts +2 -2
- package/controllers/upload.controller.d.ts +3 -3
- package/docs/index.d.ts +1 -1
- package/docs/storage-swagger.config.d.ts +2 -2
- package/dtos/index.d.ts +4 -4
- package/entities/file-manager-with-company.entity.d.ts +2 -2
- package/entities/file-manager.entity.d.ts +1 -1
- package/entities/folder-with-company.entity.d.ts +1 -1
- package/entities/index.d.ts +15 -15
- package/entities/storage-config-with-company.entity.d.ts +1 -1
- package/enums/index.d.ts +1 -1
- package/fesm/493.js +2768 -0
- package/fesm/537.js +1157 -0
- package/fesm/562.js +786 -0
- package/fesm/{providers/azure-provider.optional.js → chunks/190.js} +33 -30
- package/fesm/chunks/252.js +12 -0
- package/fesm/chunks/327.js +12 -0
- package/fesm/chunks/385.js +12 -0
- package/fesm/{providers/s3-provider.optional.js → chunks/591.js} +37 -34
- package/fesm/chunks/746.js +12 -0
- package/fesm/chunks/798.js +12 -0
- package/fesm/{providers/sftp-provider.optional.js → chunks/918.js} +35 -31
- package/fesm/config/index.js +119 -3
- package/fesm/controllers/index.js +16 -4
- package/fesm/docs/index.js +206 -1
- package/fesm/dtos/index.js +879 -4
- package/fesm/entities/index.js +463 -18
- package/fesm/enums/index.js +36 -1
- package/fesm/index.js +398 -12
- package/fesm/interfaces/index.js +19 -5
- package/fesm/modules/index.js +16 -1
- package/fesm/providers/index.js +364 -3
- package/fesm/runtime.js +252 -0
- package/fesm/services/index.js +16 -6
- package/fesm/utils/index.js +149 -1
- package/index.d.ts +11 -11
- package/interfaces/file-manager.interface.d.ts +1 -1
- package/interfaces/folder.interface.d.ts +1 -1
- package/interfaces/index.d.ts +5 -5
- package/interfaces/storage-config.interface.d.ts +1 -1
- package/interfaces/storage-module-options.interface.d.ts +3 -3
- package/interfaces/storage-provider.interface.d.ts +1 -1
- package/middlewares/file-serve.middleware.d.ts +4 -3
- package/middlewares/index.d.ts +1 -1
- package/modules/index.d.ts +1 -1
- package/modules/storage.module.d.ts +2 -2
- package/package.json +30 -41
- package/providers/azure-provider.optional.d.ts +2 -2
- package/providers/index.d.ts +3 -3
- package/providers/local-provider.d.ts +2 -2
- package/providers/s3-provider.optional.d.ts +2 -2
- package/providers/sftp-provider.optional.d.ts +2 -2
- package/providers/storage-factory.service.d.ts +3 -3
- package/providers/storage-provider.registry.d.ts +2 -2
- package/services/file-manager.service.d.ts +9 -8
- package/services/folder.service.d.ts +6 -6
- package/services/index.d.ts +6 -6
- package/services/storage-config.service.d.ts +3 -3
- package/services/storage-datasource.provider.d.ts +3 -3
- package/services/storage-provider-config.service.d.ts +7 -7
- package/services/upload.service.d.ts +6 -6
- package/utils/image-compressor.util.d.ts +1 -1
- package/utils/index.d.ts +1 -1
- package/cjs/config/event-actions.js +0 -34
- package/cjs/config/index.js +0 -20
- package/cjs/config/message-keys.js +0 -46
- package/cjs/config/storage.constants.js +0 -28
- package/cjs/controllers/file-manager.controller.js +0 -152
- package/cjs/controllers/file-manager.controller.spec.js +0 -135
- package/cjs/controllers/folder.controller.js +0 -102
- package/cjs/controllers/folder.controller.spec.js +0 -86
- package/cjs/controllers/index.js +0 -21
- package/cjs/controllers/storage-config.controller.js +0 -102
- package/cjs/controllers/storage-config.controller.spec.js +0 -85
- package/cjs/controllers/upload.controller.js +0 -234
- package/cjs/controllers/upload.controller.spec.js +0 -132
- package/cjs/docs/index.js +0 -11
- package/cjs/docs/storage-swagger.config.js +0 -188
- package/cjs/docs/storage-swagger.config.spec.js +0 -72
- package/cjs/dtos/file-manager.dto.js +0 -327
- package/cjs/dtos/folder.dto.js +0 -105
- package/cjs/dtos/index.js +0 -21
- package/cjs/dtos/storage-config.dto.js +0 -170
- package/cjs/dtos/upload.dto.js +0 -272
- package/cjs/entities/file-manager-with-company.entity.js +0 -61
- package/cjs/entities/file-manager.entity.js +0 -122
- package/cjs/entities/folder-with-company.entity.js +0 -55
- package/cjs/entities/folder.entity.js +0 -64
- package/cjs/entities/index.js +0 -63
- package/cjs/entities/index.spec.js +0 -18
- package/cjs/entities/storage-config-with-company.entity.js +0 -51
- package/cjs/entities/storage-config.entity.js +0 -96
- package/cjs/enums/file-location.enum.js +0 -17
- package/cjs/enums/index.js +0 -18
- package/cjs/index.js +0 -29
- package/cjs/interfaces/file-manager.interface.js +0 -4
- package/cjs/interfaces/folder.interface.js +0 -4
- package/cjs/interfaces/index.js +0 -22
- package/cjs/interfaces/storage-config.interface.js +0 -4
- package/cjs/interfaces/storage-module-options.interface.js +0 -4
- package/cjs/interfaces/storage-provider.interface.js +0 -4
- package/cjs/middlewares/file-serve.middleware.js +0 -241
- package/cjs/middlewares/file-serve.middleware.spec.js +0 -211
- package/cjs/middlewares/index.js +0 -18
- package/cjs/modules/index.js +0 -18
- package/cjs/modules/storage.module.js +0 -165
- package/cjs/modules/storage.module.spec.js +0 -184
- package/cjs/providers/azure-provider.optional.js +0 -155
- package/cjs/providers/azure-provider.optional.spec.js +0 -228
- package/cjs/providers/index.js +0 -26
- package/cjs/providers/local-provider.js +0 -230
- package/cjs/providers/local-provider.spec.js +0 -239
- package/cjs/providers/s3-provider.optional.js +0 -175
- package/cjs/providers/s3-provider.optional.spec.js +0 -243
- package/cjs/providers/sftp-provider.optional.js +0 -203
- package/cjs/providers/sftp-provider.optional.spec.js +0 -217
- package/cjs/providers/storage-factory.service.js +0 -175
- package/cjs/providers/storage-factory.service.spec.js +0 -253
- package/cjs/providers/storage-provider.registry.js +0 -41
- package/cjs/providers/storage-provider.registry.spec.js +0 -67
- package/cjs/services/file-manager.service.js +0 -387
- package/cjs/services/file-manager.service.spec.js +0 -580
- package/cjs/services/folder.service.js +0 -101
- package/cjs/services/folder.service.spec.js +0 -167
- package/cjs/services/index.js +0 -23
- package/cjs/services/storage-config.service.js +0 -129
- package/cjs/services/storage-config.service.spec.js +0 -257
- package/cjs/services/storage-datasource.provider.js +0 -137
- package/cjs/services/storage-datasource.provider.spec.js +0 -217
- package/cjs/services/storage-provider-config.service.js +0 -171
- package/cjs/services/storage-provider-config.service.spec.js +0 -265
- package/cjs/services/upload.service.js +0 -376
- package/cjs/services/upload.service.spec.js +0 -426
- package/cjs/utils/file-validator.util.js +0 -440
- package/cjs/utils/file-validator.util.spec.js +0 -259
- package/cjs/utils/image-compressor.util.js +0 -162
- package/cjs/utils/image-compressor.util.spec.js +0 -166
- package/cjs/utils/index.js +0 -18
- package/fesm/config/event-actions.js +0 -13
- package/fesm/config/message-keys.js +0 -22
- package/fesm/config/storage.constants.js +0 -7
- package/fesm/controllers/file-manager.controller.js +0 -142
- package/fesm/controllers/file-manager.controller.spec.js +0 -131
- package/fesm/controllers/folder.controller.js +0 -92
- package/fesm/controllers/folder.controller.spec.js +0 -82
- package/fesm/controllers/storage-config.controller.js +0 -92
- package/fesm/controllers/storage-config.controller.spec.js +0 -81
- package/fesm/controllers/upload.controller.js +0 -224
- package/fesm/controllers/upload.controller.spec.js +0 -128
- package/fesm/docs/storage-swagger.config.js +0 -181
- package/fesm/docs/storage-swagger.config.spec.js +0 -68
- package/fesm/dtos/file-manager.dto.js +0 -300
- package/fesm/dtos/folder.dto.js +0 -84
- package/fesm/dtos/storage-config.dto.js +0 -149
- package/fesm/dtos/upload.dto.js +0 -245
- package/fesm/entities/file-manager-with-company.entity.js +0 -51
- package/fesm/entities/file-manager.entity.js +0 -112
- package/fesm/entities/folder-with-company.entity.js +0 -45
- package/fesm/entities/folder.entity.js +0 -54
- package/fesm/entities/index.spec.js +0 -14
- package/fesm/entities/storage-config-with-company.entity.js +0 -41
- package/fesm/entities/storage-config.entity.js +0 -86
- package/fesm/enums/file-location.enum.js +0 -7
- package/fesm/interfaces/file-manager.interface.js +0 -1
- package/fesm/interfaces/folder.interface.js +0 -1
- package/fesm/interfaces/storage-config.interface.js +0 -1
- package/fesm/interfaces/storage-module-options.interface.js +0 -3
- package/fesm/interfaces/storage-provider.interface.js +0 -4
- package/fesm/middlewares/file-serve.middleware.js +0 -190
- package/fesm/middlewares/file-serve.middleware.spec.js +0 -207
- package/fesm/middlewares/index.js +0 -1
- package/fesm/modules/storage.module.js +0 -156
- package/fesm/modules/storage.module.spec.js +0 -180
- package/fesm/providers/azure-provider.optional.spec.js +0 -224
- package/fesm/providers/local-provider.js +0 -182
- package/fesm/providers/local-provider.spec.js +0 -194
- package/fesm/providers/s3-provider.optional.spec.js +0 -239
- package/fesm/providers/sftp-provider.optional.spec.js +0 -213
- package/fesm/providers/storage-factory.service.js +0 -124
- package/fesm/providers/storage-factory.service.spec.js +0 -249
- package/fesm/providers/storage-provider.registry.js +0 -34
- package/fesm/providers/storage-provider.registry.spec.js +0 -63
- package/fesm/services/file-manager.service.js +0 -336
- package/fesm/services/file-manager.service.spec.js +0 -576
- package/fesm/services/folder.service.js +0 -91
- package/fesm/services/folder.service.spec.js +0 -163
- package/fesm/services/storage-config.service.js +0 -119
- package/fesm/services/storage-config.service.spec.js +0 -253
- package/fesm/services/storage-datasource.provider.js +0 -86
- package/fesm/services/storage-datasource.provider.spec.js +0 -172
- package/fesm/services/storage-provider-config.service.js +0 -161
- package/fesm/services/storage-provider-config.service.spec.js +0 -261
- package/fesm/services/upload.service.js +0 -366
- package/fesm/services/upload.service.spec.js +0 -422
- package/fesm/utils/file-validator.util.js +0 -433
- package/fesm/utils/file-validator.util.spec.js +0 -255
- package/fesm/utils/image-compressor.util.js +0 -114
- package/fesm/utils/image-compressor.util.spec.js +0 -162
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
obj[key] = value;
|
|
11
|
-
}
|
|
12
|
-
return obj;
|
|
13
|
-
}
|
|
1
|
+
export const __rspack_esm_id = 190;
|
|
2
|
+
export const __rspack_esm_ids = [190];
|
|
3
|
+
export const __webpack_modules__ = {
|
|
4
|
+
269(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
5
|
+
__webpack_require__.r(__webpack_exports__);
|
|
6
|
+
/* import */ var _nestjs_common__rspack_import_0 = __webpack_require__(157);
|
|
7
|
+
/* import */ var _flusys_nestjs_shared_constants__rspack_import_1 = __webpack_require__(140);
|
|
8
|
+
/* import */ var uuid__rspack_import_2 = __webpack_require__(37);
|
|
9
|
+
/* import */ var _utils_image_compressor_util_js__rspack_import_3 = __webpack_require__(872);
|
|
14
10
|
/**
|
|
15
11
|
* Optional Azure Blob Storage Provider
|
|
16
12
|
* Requires: npm install @azure/storage-blob
|
|
17
|
-
*/
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class AzureProvider {
|
|
18
|
+
blobServiceClient;
|
|
19
|
+
containerClient;
|
|
20
|
+
containerName = '';
|
|
21
|
+
accountName = '';
|
|
22
22
|
async initialize(config) {
|
|
23
23
|
try {
|
|
24
|
-
const { BlobServiceClient, StorageSharedKeyCredential } = await import(
|
|
24
|
+
const { BlobServiceClient, StorageSharedKeyCredential } = await __webpack_require__.e(/* import() */ 746).then(__webpack_require__.bind(__webpack_require__, 737));
|
|
25
25
|
this.accountName = config.accountName;
|
|
26
26
|
this.containerName = config.containerName;
|
|
27
27
|
this.blobServiceClient = config.connectionString ? BlobServiceClient.fromConnectionString(config.connectionString) : new BlobServiceClient(`https://${config.accountName}.blob.core.windows.net`, new StorageSharedKeyCredential(config.accountName, config.accountKey));
|
|
28
28
|
this.containerClient = this.blobServiceClient.getContainerClient(config.containerName);
|
|
29
29
|
await this.containerClient.createIfNotExists();
|
|
30
30
|
} catch {
|
|
31
|
-
throw new InternalServerErrorException({
|
|
31
|
+
throw new _nestjs_common__rspack_import_0.InternalServerErrorException({
|
|
32
32
|
message: 'Azure Storage SDK not found',
|
|
33
|
-
messageKey: SYSTEM_MESSAGES.SDK_NOT_INSTALLED,
|
|
33
|
+
messageKey: _flusys_nestjs_shared_constants__rspack_import_1.SYSTEM_MESSAGES.SDK_NOT_INSTALLED,
|
|
34
34
|
messageVariables: {
|
|
35
35
|
sdk: '@azure/storage-blob'
|
|
36
36
|
}
|
|
@@ -40,9 +40,9 @@ export class AzureProvider {
|
|
|
40
40
|
async uploadFile(file, options) {
|
|
41
41
|
let processedBuffer = file.buffer;
|
|
42
42
|
let contentType = file.mimetype;
|
|
43
|
-
const fileName = `${
|
|
43
|
+
const fileName = `${(0,uuid__rspack_import_2.v4)()}-${file.originalname}`;
|
|
44
44
|
if (options.compress && file.mimetype.startsWith('image/')) {
|
|
45
|
-
const result = await ImageCompressor.compress(file.buffer, file.mimetype, {
|
|
45
|
+
const result = await _utils_image_compressor_util_js__rspack_import_3/* .ImageCompressor.compress */.J.compress(file.buffer, file.mimetype, {
|
|
46
46
|
maxWidth: options.maxWidth,
|
|
47
47
|
maxHeight: options.maxHeight,
|
|
48
48
|
quality: options.quality,
|
|
@@ -74,7 +74,7 @@ export class AzureProvider {
|
|
|
74
74
|
await Promise.all(keys.map((key)=>this.deleteFile(key)));
|
|
75
75
|
}
|
|
76
76
|
async generatePresignedUrl(key, expiresInSeconds = 3600) {
|
|
77
|
-
const { BlobSASPermissions, generateBlobSASQueryParameters } = await import(
|
|
77
|
+
const { BlobSASPermissions, generateBlobSASQueryParameters } = await __webpack_require__.e(/* import() */ 746).then(__webpack_require__.bind(__webpack_require__, 737));
|
|
78
78
|
const blockBlobClient = this.containerClient.getBlockBlobClient(key);
|
|
79
79
|
const startsOn = new Date();
|
|
80
80
|
const expiresOn = new Date(startsOn.getTime() + expiresInSeconds * 1000);
|
|
@@ -95,10 +95,13 @@ export class AzureProvider {
|
|
|
95
95
|
return false;
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
|
-
constructor(){
|
|
99
|
-
_define_property(this, "blobServiceClient", void 0);
|
|
100
|
-
_define_property(this, "containerClient", void 0);
|
|
101
|
-
_define_property(this, "containerName", '');
|
|
102
|
-
_define_property(this, "accountName", '');
|
|
103
|
-
}
|
|
104
98
|
}
|
|
99
|
+
|
|
100
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
101
|
+
AzureProvider: () => (AzureProvider)
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
},
|
|
106
|
+
|
|
107
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as __rspack_external__aws_sdk_s3_request_presigner_e09eabb8 from "@aws-sdk/s3-request-presigner";
|
|
2
|
+
export const __rspack_esm_id = 252;
|
|
3
|
+
export const __rspack_esm_ids = [252];
|
|
4
|
+
export const __webpack_modules__ = {
|
|
5
|
+
207(module) {
|
|
6
|
+
|
|
7
|
+
module.exports = __rspack_external__aws_sdk_s3_request_presigner_e09eabb8;
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
},
|
|
11
|
+
|
|
12
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as __rspack_external__aws_sdk_lib_storage_4348b131 from "@aws-sdk/lib-storage";
|
|
2
|
+
export const __rspack_esm_id = 327;
|
|
3
|
+
export const __rspack_esm_ids = [327];
|
|
4
|
+
export const __webpack_modules__ = {
|
|
5
|
+
354(module) {
|
|
6
|
+
|
|
7
|
+
module.exports = __rspack_external__aws_sdk_lib_storage_4348b131;
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
},
|
|
11
|
+
|
|
12
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as __rspack_external_ssh2_sftp_client_29ee4624 from "ssh2-sftp-client";
|
|
2
|
+
export const __rspack_esm_id = 385;
|
|
3
|
+
export const __rspack_esm_ids = [385];
|
|
4
|
+
export const __webpack_modules__ = {
|
|
5
|
+
240(module) {
|
|
6
|
+
|
|
7
|
+
module.exports = __rspack_external_ssh2_sftp_client_29ee4624;
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
},
|
|
11
|
+
|
|
12
|
+
};
|
|
@@ -1,27 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
obj[key] = value;
|
|
11
|
-
}
|
|
12
|
-
return obj;
|
|
13
|
-
}
|
|
1
|
+
export const __rspack_esm_id = 591;
|
|
2
|
+
export const __rspack_esm_ids = [591];
|
|
3
|
+
export const __webpack_modules__ = {
|
|
4
|
+
970(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
5
|
+
__webpack_require__.r(__webpack_exports__);
|
|
6
|
+
/* import */ var _nestjs_common__rspack_import_0 = __webpack_require__(157);
|
|
7
|
+
/* import */ var _flusys_nestjs_shared_constants__rspack_import_1 = __webpack_require__(140);
|
|
8
|
+
/* import */ var uuid__rspack_import_2 = __webpack_require__(37);
|
|
9
|
+
/* import */ var _utils_image_compressor_util_js__rspack_import_3 = __webpack_require__(872);
|
|
14
10
|
/**
|
|
15
11
|
* Optional AWS S3 Storage Provider
|
|
16
12
|
* Requires: npm install @aws-sdk/client-s3 @aws-sdk/lib-storage @aws-sdk/s3-request-presigner
|
|
17
|
-
*/
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class S3Provider {
|
|
18
|
+
s3;
|
|
19
|
+
bucketName = '';
|
|
20
|
+
region = '';
|
|
22
21
|
async initialize(config) {
|
|
23
22
|
try {
|
|
24
|
-
const { S3Client } = await import(
|
|
23
|
+
const { S3Client } = await __webpack_require__.e(/* import() */ 798).then(__webpack_require__.bind(__webpack_require__, 965));
|
|
25
24
|
this.region = config.region;
|
|
26
25
|
this.bucketName = config.bucket;
|
|
27
26
|
this.s3 = new S3Client({
|
|
@@ -33,9 +32,9 @@ export class S3Provider {
|
|
|
33
32
|
} : undefined
|
|
34
33
|
});
|
|
35
34
|
} catch {
|
|
36
|
-
throw new InternalServerErrorException({
|
|
35
|
+
throw new _nestjs_common__rspack_import_0.InternalServerErrorException({
|
|
37
36
|
message: 'AWS SDK not found',
|
|
38
|
-
messageKey: SYSTEM_MESSAGES.SDK_NOT_INSTALLED,
|
|
37
|
+
messageKey: _flusys_nestjs_shared_constants__rspack_import_1.SYSTEM_MESSAGES.SDK_NOT_INSTALLED,
|
|
39
38
|
messageVariables: {
|
|
40
39
|
sdk: '@aws-sdk/client-s3'
|
|
41
40
|
}
|
|
@@ -43,12 +42,12 @@ export class S3Provider {
|
|
|
43
42
|
}
|
|
44
43
|
}
|
|
45
44
|
async uploadFile(file, options) {
|
|
46
|
-
const { Upload } = await import(
|
|
45
|
+
const { Upload } = await __webpack_require__.e(/* import() */ 327).then(__webpack_require__.bind(__webpack_require__, 354));
|
|
47
46
|
let processedBuffer = file.buffer;
|
|
48
47
|
let contentType = file.mimetype;
|
|
49
|
-
const fileName = `${
|
|
48
|
+
const fileName = `${(0,uuid__rspack_import_2.v4)()}-${file.originalname}`;
|
|
50
49
|
if (options.compress && file.mimetype.startsWith('image/')) {
|
|
51
|
-
const result = await ImageCompressor.compress(file.buffer, file.mimetype, {
|
|
50
|
+
const result = await _utils_image_compressor_util_js__rspack_import_3/* .ImageCompressor.compress */.J.compress(file.buffer, file.mimetype, {
|
|
52
51
|
maxWidth: options.maxWidth,
|
|
53
52
|
maxHeight: options.maxHeight,
|
|
54
53
|
quality: options.quality,
|
|
@@ -78,14 +77,14 @@ export class S3Provider {
|
|
|
78
77
|
return Promise.all(files.map((file)=>this.uploadFile(file, options)));
|
|
79
78
|
}
|
|
80
79
|
async deleteFile(key) {
|
|
81
|
-
const { DeleteObjectCommand } = await import(
|
|
80
|
+
const { DeleteObjectCommand } = await __webpack_require__.e(/* import() */ 798).then(__webpack_require__.bind(__webpack_require__, 965));
|
|
82
81
|
await this.s3.send(new DeleteObjectCommand({
|
|
83
82
|
Bucket: this.bucketName,
|
|
84
83
|
Key: key
|
|
85
84
|
}));
|
|
86
85
|
}
|
|
87
86
|
async deleteMultipleFiles(keys) {
|
|
88
|
-
const { DeleteObjectsCommand } = await import(
|
|
87
|
+
const { DeleteObjectsCommand } = await __webpack_require__.e(/* import() */ 798).then(__webpack_require__.bind(__webpack_require__, 965));
|
|
89
88
|
await this.s3.send(new DeleteObjectsCommand({
|
|
90
89
|
Bucket: this.bucketName,
|
|
91
90
|
Delete: {
|
|
@@ -96,8 +95,8 @@ export class S3Provider {
|
|
|
96
95
|
}));
|
|
97
96
|
}
|
|
98
97
|
async generatePresignedUrl(key, expiresInSeconds = 3600) {
|
|
99
|
-
const { GetObjectCommand } = await import(
|
|
100
|
-
const { getSignedUrl } = await import(
|
|
98
|
+
const { GetObjectCommand } = await __webpack_require__.e(/* import() */ 798).then(__webpack_require__.bind(__webpack_require__, 965));
|
|
99
|
+
const { getSignedUrl } = await __webpack_require__.e(/* import() */ 252).then(__webpack_require__.bind(__webpack_require__, 207));
|
|
101
100
|
return getSignedUrl(this.s3, new GetObjectCommand({
|
|
102
101
|
Bucket: this.bucketName,
|
|
103
102
|
Key: key
|
|
@@ -107,7 +106,7 @@ export class S3Provider {
|
|
|
107
106
|
}
|
|
108
107
|
async healthCheck() {
|
|
109
108
|
try {
|
|
110
|
-
const { HeadBucketCommand } = await import(
|
|
109
|
+
const { HeadBucketCommand } = await __webpack_require__.e(/* import() */ 798).then(__webpack_require__.bind(__webpack_require__, 965));
|
|
111
110
|
await this.s3.send(new HeadBucketCommand({
|
|
112
111
|
Bucket: this.bucketName
|
|
113
112
|
}));
|
|
@@ -116,9 +115,13 @@ export class S3Provider {
|
|
|
116
115
|
return false;
|
|
117
116
|
}
|
|
118
117
|
}
|
|
119
|
-
constructor(){
|
|
120
|
-
_define_property(this, "s3", void 0);
|
|
121
|
-
_define_property(this, "bucketName", '');
|
|
122
|
-
_define_property(this, "region", '');
|
|
123
|
-
}
|
|
124
118
|
}
|
|
119
|
+
|
|
120
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
121
|
+
S3Provider: () => (S3Provider)
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
},
|
|
126
|
+
|
|
127
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as __rspack_external__azure_storage_blob_23d6f9ca from "@azure/storage-blob";
|
|
2
|
+
export const __rspack_esm_id = 746;
|
|
3
|
+
export const __rspack_esm_ids = [746];
|
|
4
|
+
export const __webpack_modules__ = {
|
|
5
|
+
737(module) {
|
|
6
|
+
|
|
7
|
+
module.exports = __rspack_external__azure_storage_blob_23d6f9ca;
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
},
|
|
11
|
+
|
|
12
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as __rspack_external__aws_sdk_client_s3_a2e3616c from "@aws-sdk/client-s3";
|
|
2
|
+
export const __rspack_esm_id = 798;
|
|
3
|
+
export const __rspack_esm_ids = [798];
|
|
4
|
+
export const __webpack_modules__ = {
|
|
5
|
+
965(module) {
|
|
6
|
+
|
|
7
|
+
module.exports = __rspack_external__aws_sdk_client_s3_a2e3616c;
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
},
|
|
11
|
+
|
|
12
|
+
};
|
|
@@ -1,16 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
12
|
-
return obj;
|
|
13
|
-
}
|
|
1
|
+
export const __rspack_esm_id = 918;
|
|
2
|
+
export const __rspack_esm_ids = [918];
|
|
3
|
+
export const __webpack_modules__ = {
|
|
4
|
+
5(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
5
|
+
__webpack_require__.r(__webpack_exports__);
|
|
6
|
+
/* import */ var _nestjs_common__rspack_import_0 = __webpack_require__(157);
|
|
7
|
+
/* import */ var _flusys_nestjs_shared_constants__rspack_import_1 = __webpack_require__(140);
|
|
8
|
+
/* import */ var _utils_image_compressor_util_js__rspack_import_2 = __webpack_require__(872);
|
|
9
|
+
/* import */ var path__rspack_import_3 = __webpack_require__(521);
|
|
10
|
+
/* import */ var uuid__rspack_import_4 = __webpack_require__(37);
|
|
14
11
|
/**
|
|
15
12
|
* OPTIONAL SFTP Provider
|
|
16
13
|
*
|
|
@@ -26,21 +23,24 @@ function _define_property(obj, key, value) {
|
|
|
26
23
|
* import { StorageProviderRegistry, FileLocationEnum } from '@flusys/nestjs-storage';
|
|
27
24
|
*
|
|
28
25
|
* StorageProviderRegistry.register(FileLocationEnum.SFTP, SftpProvider);
|
|
29
|
-
*/
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
34
31
|
/**
|
|
35
32
|
* SFTP Storage Provider
|
|
36
33
|
* Requires ssh2-sftp-client package to be installed
|
|
37
|
-
*/
|
|
34
|
+
*/ class SftpProvider {
|
|
35
|
+
sftp;
|
|
36
|
+
config;
|
|
37
|
+
connected = false;
|
|
38
38
|
/**
|
|
39
39
|
* Initialize SFTP provider with configuration
|
|
40
40
|
*/ async initialize(config) {
|
|
41
41
|
try {
|
|
42
42
|
// Dynamic import - only loads SFTP SDK if this provider is used
|
|
43
|
-
const sftp = await import(
|
|
43
|
+
const sftp = await __webpack_require__.e(/* import() */ 385).then(__webpack_require__.bind(__webpack_require__, 240));
|
|
44
44
|
const SftpClient = sftp.default || sftp;
|
|
45
45
|
this.sftp = new SftpClient();
|
|
46
46
|
this.config = {
|
|
@@ -56,9 +56,9 @@ import { v4 as uuidv4 } from 'uuid';
|
|
|
56
56
|
// Ensure base directory exists
|
|
57
57
|
await this.ensureDirectory(this.config.basePath);
|
|
58
58
|
} catch {
|
|
59
|
-
throw new InternalServerErrorException({
|
|
59
|
+
throw new _nestjs_common__rspack_import_0.InternalServerErrorException({
|
|
60
60
|
message: 'SFTP client not found',
|
|
61
|
-
messageKey: SYSTEM_MESSAGES.SDK_NOT_INSTALLED,
|
|
61
|
+
messageKey: _flusys_nestjs_shared_constants__rspack_import_1.SYSTEM_MESSAGES.SDK_NOT_INSTALLED,
|
|
62
62
|
messageVariables: {
|
|
63
63
|
sdk: 'ssh2-sftp-client'
|
|
64
64
|
}
|
|
@@ -88,10 +88,10 @@ import { v4 as uuidv4 } from 'uuid';
|
|
|
88
88
|
await this.connect();
|
|
89
89
|
let processedBuffer = file.buffer;
|
|
90
90
|
let contentType = file.mimetype;
|
|
91
|
-
const fileName = `${
|
|
91
|
+
const fileName = `${(0,uuid__rspack_import_4.v4)()}-${file.originalname}`;
|
|
92
92
|
// Compress image if needed
|
|
93
93
|
if (options.compress && file.mimetype.startsWith('image/')) {
|
|
94
|
-
const result = await ImageCompressor.compress(file.buffer, file.mimetype, {
|
|
94
|
+
const result = await _utils_image_compressor_util_js__rspack_import_2/* .ImageCompressor.compress */.J.compress(file.buffer, file.mimetype, {
|
|
95
95
|
maxWidth: options.maxWidth,
|
|
96
96
|
maxHeight: options.maxHeight,
|
|
97
97
|
quality: options.quality,
|
|
@@ -100,9 +100,9 @@ import { v4 as uuidv4 } from 'uuid';
|
|
|
100
100
|
processedBuffer = result.buffer;
|
|
101
101
|
contentType = result.format;
|
|
102
102
|
}
|
|
103
|
-
const remotePath = options.folderPath ?
|
|
103
|
+
const remotePath = options.folderPath ? path__rspack_import_3.join(this.config.basePath, options.folderPath, fileName) : path__rspack_import_3.join(this.config.basePath, fileName);
|
|
104
104
|
// Ensure parent directory exists
|
|
105
|
-
const remoteDir =
|
|
105
|
+
const remoteDir = path__rspack_import_3.dirname(remotePath);
|
|
106
106
|
await this.ensureDirectory(remoteDir);
|
|
107
107
|
// Upload file
|
|
108
108
|
await this.sftp.put(processedBuffer, remotePath);
|
|
@@ -147,9 +147,13 @@ import { v4 as uuidv4 } from 'uuid';
|
|
|
147
147
|
this.connected = false;
|
|
148
148
|
}
|
|
149
149
|
}
|
|
150
|
-
constructor(){
|
|
151
|
-
_define_property(this, "sftp", void 0); // SftpClient
|
|
152
|
-
_define_property(this, "config", void 0);
|
|
153
|
-
_define_property(this, "connected", false);
|
|
154
|
-
}
|
|
155
150
|
}
|
|
151
|
+
|
|
152
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
153
|
+
SftpProvider: () => (SftpProvider)
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
},
|
|
158
|
+
|
|
159
|
+
};
|
package/fesm/config/index.js
CHANGED
|
@@ -1,3 +1,119 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
1
|
+
export const __rspack_esm_id = 565;
|
|
2
|
+
export const __rspack_esm_ids = [565];
|
|
3
|
+
export const __webpack_modules__ = {
|
|
4
|
+
884(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
5
|
+
/**
|
|
6
|
+
* Domain event actions published by the storage module, alongside the CRUD
|
|
7
|
+
* lifecycle actions every ApiService emits.
|
|
8
|
+
*/ const STORAGE_EVENT_ACTIONS = {
|
|
9
|
+
UPLOADED: 'uploaded',
|
|
10
|
+
REMOVED: 'removed'
|
|
11
|
+
};
|
|
12
|
+
/** Every entity the storage module publishes under, ApiService backed or not */ const STORAGE_EVENT_ENTITIES = {
|
|
13
|
+
FILE: 'file_manager',
|
|
14
|
+
FOLDER: 'folder',
|
|
15
|
+
STORAGE_CONFIG: 'storageConfig'
|
|
16
|
+
};
|
|
17
|
+
const STORAGE_EVENT_MODULE = 'storage';
|
|
18
|
+
|
|
19
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
20
|
+
}, {
|
|
21
|
+
fR: STORAGE_EVENT_ENTITIES,
|
|
22
|
+
hw: STORAGE_EVENT_ACTIONS,
|
|
23
|
+
qh: STORAGE_EVENT_MODULE
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
},
|
|
28
|
+
34(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
29
|
+
/* import */ var _event_actions_js__rspack_import_0 = __webpack_require__(884);
|
|
30
|
+
/* import */ var _message_keys_js__rspack_import_1 = __webpack_require__(450);
|
|
31
|
+
/* import */ var _storage_constants_js__rspack_import_2 = __webpack_require__(188);
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
37
|
+
A_: () => (/* reexport safe */ _storage_constants_js__rspack_import_2.A_),
|
|
38
|
+
Ee: () => (/* reexport safe */ _message_keys_js__rspack_import_1.Ee),
|
|
39
|
+
Sj: () => (/* reexport safe */ _storage_constants_js__rspack_import_2.Sj),
|
|
40
|
+
Y8: () => (/* reexport safe */ _message_keys_js__rspack_import_1.Y8),
|
|
41
|
+
dS: () => (/* reexport safe */ _message_keys_js__rspack_import_1.dS),
|
|
42
|
+
fR: () => (/* reexport safe */ _event_actions_js__rspack_import_0.fR),
|
|
43
|
+
hw: () => (/* reexport safe */ _event_actions_js__rspack_import_0.hw),
|
|
44
|
+
k0: () => (/* reexport safe */ _storage_constants_js__rspack_import_2.k0),
|
|
45
|
+
qh: () => (/* reexport safe */ _event_actions_js__rspack_import_0.qh),
|
|
46
|
+
uA: () => (/* reexport safe */ _message_keys_js__rspack_import_1.uA)
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
},
|
|
51
|
+
450(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
52
|
+
// ==================== STORAGE MODULE MESSAGE KEYS ====================
|
|
53
|
+
const FILE_MESSAGES = {
|
|
54
|
+
GET_ALL_SUCCESS: 'file.get.all.success',
|
|
55
|
+
DELETE_SUCCESS: 'file.delete.success',
|
|
56
|
+
NOT_FOUND: 'file.not.found'
|
|
57
|
+
};
|
|
58
|
+
const STORAGE_CONFIG_MESSAGES = {
|
|
59
|
+
DEFAULT_DELETE_FORBIDDEN: 'storage.config.default.delete.forbidden'
|
|
60
|
+
};
|
|
61
|
+
const FOLDER_MESSAGES = {
|
|
62
|
+
NOT_FOUND: 'folder.not.found'
|
|
63
|
+
};
|
|
64
|
+
const UPLOAD_MESSAGES = {
|
|
65
|
+
SUCCESS: 'upload.success',
|
|
66
|
+
MANY_SUCCESS: 'upload.many.success',
|
|
67
|
+
FILE_TOO_LARGE: 'upload.file.too.large',
|
|
68
|
+
INVALID_TYPE: 'upload.invalid.type',
|
|
69
|
+
NO_FILES_PROVIDED: 'upload.no.files.provided',
|
|
70
|
+
NO_FILE_PATH: 'upload.no.file.path',
|
|
71
|
+
INVALID_FILE_PATH: 'upload.invalid.file.path',
|
|
72
|
+
CONFIG_NOT_FOUND: 'upload.config.not.found'
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
76
|
+
}, {
|
|
77
|
+
Ee: FOLDER_MESSAGES,
|
|
78
|
+
Y8: STORAGE_CONFIG_MESSAGES,
|
|
79
|
+
dS: UPLOAD_MESSAGES,
|
|
80
|
+
uA: FILE_MESSAGES
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
},
|
|
85
|
+
188(__unused_rspack_module, __webpack_exports__, __webpack_require__) {
|
|
86
|
+
/**
|
|
87
|
+
* Storage Module Constants
|
|
88
|
+
*/ const STORAGE_MODULE_OPTIONS = 'STORAGE_MODULE_OPTIONS';
|
|
89
|
+
const DEFAULT_MAX_FILE_SIZE = 100 * 1024 * 1024; // 100MB
|
|
90
|
+
const DEFAULT_ALLOWED_FILE_TYPES = [
|
|
91
|
+
'*/*'
|
|
92
|
+
]; // All file types
|
|
93
|
+
|
|
94
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
95
|
+
}, {
|
|
96
|
+
A_: DEFAULT_ALLOWED_FILE_TYPES,
|
|
97
|
+
Sj: DEFAULT_MAX_FILE_SIZE,
|
|
98
|
+
k0: STORAGE_MODULE_OPTIONS
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
},
|
|
103
|
+
|
|
104
|
+
};
|
|
105
|
+
import { __webpack_require__ } from '../runtime.js';
|
|
106
|
+
var __webpack_exec__ = function(moduleId) { return __webpack_require__(__webpack_require__.s = moduleId); }
|
|
107
|
+
import * as __rspack_chunk_1 from './index.js';
|
|
108
|
+
__webpack_require__.C(__rspack_chunk_1);
|
|
109
|
+
var __webpack_exports__ = __webpack_exec__(34);var __webpack_exports__DEFAULT_ALLOWED_FILE_TYPES = __webpack_exports__.A_;
|
|
110
|
+
var __webpack_exports__DEFAULT_MAX_FILE_SIZE = __webpack_exports__.Sj;
|
|
111
|
+
var __webpack_exports__FILE_MESSAGES = __webpack_exports__.uA;
|
|
112
|
+
var __webpack_exports__FOLDER_MESSAGES = __webpack_exports__.Ee;
|
|
113
|
+
var __webpack_exports__STORAGE_CONFIG_MESSAGES = __webpack_exports__.Y8;
|
|
114
|
+
var __webpack_exports__STORAGE_EVENT_ACTIONS = __webpack_exports__.hw;
|
|
115
|
+
var __webpack_exports__STORAGE_EVENT_ENTITIES = __webpack_exports__.fR;
|
|
116
|
+
var __webpack_exports__STORAGE_EVENT_MODULE = __webpack_exports__.qh;
|
|
117
|
+
var __webpack_exports__STORAGE_MODULE_OPTIONS = __webpack_exports__.k0;
|
|
118
|
+
var __webpack_exports__UPLOAD_MESSAGES = __webpack_exports__.dS;
|
|
119
|
+
export { __webpack_exports__DEFAULT_ALLOWED_FILE_TYPES as DEFAULT_ALLOWED_FILE_TYPES, __webpack_exports__DEFAULT_MAX_FILE_SIZE as DEFAULT_MAX_FILE_SIZE, __webpack_exports__FILE_MESSAGES as FILE_MESSAGES, __webpack_exports__FOLDER_MESSAGES as FOLDER_MESSAGES, __webpack_exports__STORAGE_CONFIG_MESSAGES as STORAGE_CONFIG_MESSAGES, __webpack_exports__STORAGE_EVENT_ACTIONS as STORAGE_EVENT_ACTIONS, __webpack_exports__STORAGE_EVENT_ENTITIES as STORAGE_EVENT_ENTITIES, __webpack_exports__STORAGE_EVENT_MODULE as STORAGE_EVENT_MODULE, __webpack_exports__STORAGE_MODULE_OPTIONS as STORAGE_MODULE_OPTIONS, __webpack_exports__UPLOAD_MESSAGES as UPLOAD_MESSAGES };
|
|
@@ -1,4 +1,16 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
|
|
1
|
+
export const __rspack_esm_id = 24;
|
|
2
|
+
export const __rspack_esm_ids = [24];
|
|
3
|
+
export const __webpack_modules__ = {};
|
|
4
|
+
import { __webpack_require__ } from '../runtime.js';
|
|
5
|
+
var __webpack_exec__ = function(moduleId) { return __webpack_require__(__webpack_require__.s = moduleId); }
|
|
6
|
+
import * as __rspack_chunk_1 from '../493.js';
|
|
7
|
+
__webpack_require__.C(__rspack_chunk_1);
|
|
8
|
+
import * as __rspack_chunk_2 from '../537.js';
|
|
9
|
+
__webpack_require__.C(__rspack_chunk_2);
|
|
10
|
+
import * as __rspack_chunk_3 from './index.js';
|
|
11
|
+
__webpack_require__.C(__rspack_chunk_3);
|
|
12
|
+
var __webpack_exports__ = __webpack_exec__(488);var __webpack_exports__FileManagerController = __webpack_exports__.AE;
|
|
13
|
+
var __webpack_exports__FolderController = __webpack_exports__.X$;
|
|
14
|
+
var __webpack_exports__StorageConfigController = __webpack_exports__.Iz;
|
|
15
|
+
var __webpack_exports__UploadController = __webpack_exports__.I7;
|
|
16
|
+
export { __webpack_exports__FileManagerController as FileManagerController, __webpack_exports__FolderController as FolderController, __webpack_exports__StorageConfigController as StorageConfigController, __webpack_exports__UploadController as UploadController };
|