@takentrade/takentrade-libs 1.0.6 → 1.0.7
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/dist/storage/cloudinary.storage.d.ts +9 -13
- package/dist/storage/cloudinary.storage.js +17 -21
- package/dist/storage/storage.module.d.ts +2 -0
- package/dist/storage/storage.module.js +14 -8
- package/dist/storage/storage.service.d.ts +3 -10
- package/dist/storage/storage.service.js +4 -12
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -1,14 +1,10 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Configuration utility for setting up the Cloudinary client in a NestJS application.
|
|
3
|
-
* This module provides a function to configure the Cloudinary SDK using environment variables.
|
|
4
|
-
* @module cloudinary.storage
|
|
5
|
-
*/
|
|
6
1
|
import { ConfigService } from '@nestjs/config';
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
2
|
+
export declare class CloudinaryConfig {
|
|
3
|
+
private readonly configService;
|
|
4
|
+
constructor(configService: ConfigService);
|
|
5
|
+
createSharedConfiguration(): {
|
|
6
|
+
cloud_name: string | undefined;
|
|
7
|
+
api_key: string | undefined;
|
|
8
|
+
api_secret: string | undefined;
|
|
9
|
+
};
|
|
10
|
+
}
|
|
@@ -1,24 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Configuration utility for setting up the Cloudinary client in a NestJS application.
|
|
4
|
-
* This module provides a function to configure the Cloudinary SDK using environment variables.
|
|
5
|
-
* @module cloudinary.storage
|
|
6
|
-
*/
|
|
7
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
-
exports.
|
|
3
|
+
exports.CloudinaryConfig = void 0;
|
|
9
4
|
const cloudinary_1 = require("cloudinary");
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
|
|
5
|
+
class CloudinaryConfig {
|
|
6
|
+
configService;
|
|
7
|
+
constructor(configService) {
|
|
8
|
+
this.configService = configService;
|
|
9
|
+
}
|
|
10
|
+
createSharedConfiguration() {
|
|
11
|
+
const config = {
|
|
12
|
+
cloud_name: this.configService.get('CLOUDINARY_CLOUD_NAME'),
|
|
13
|
+
api_key: this.configService.get('CLOUDINARY_API_KEY'),
|
|
14
|
+
api_secret: this.configService.get('CLOUDINARY_API_SECRET'),
|
|
15
|
+
};
|
|
16
|
+
cloudinary_1.v2.config(config);
|
|
17
|
+
return config;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
exports.CloudinaryConfig = CloudinaryConfig;
|
|
@@ -5,18 +5,24 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
5
5
|
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;
|
|
6
6
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
7
|
};
|
|
8
|
+
var StorageModule_1;
|
|
8
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
10
|
exports.StorageModule = void 0;
|
|
10
11
|
const common_1 = require("@nestjs/common");
|
|
11
|
-
const storage_service_1 = require("./storage.service");
|
|
12
12
|
const config_1 = require("@nestjs/config");
|
|
13
|
-
|
|
13
|
+
const storage_service_1 = require("./storage.service");
|
|
14
|
+
const cloudinary_storage_1 = require("./cloudinary.storage");
|
|
15
|
+
let StorageModule = StorageModule_1 = class StorageModule {
|
|
16
|
+
static register() {
|
|
17
|
+
return {
|
|
18
|
+
module: StorageModule_1,
|
|
19
|
+
imports: [config_1.ConfigModule],
|
|
20
|
+
providers: [storage_service_1.StorageService, cloudinary_storage_1.CloudinaryConfig],
|
|
21
|
+
exports: [storage_service_1.StorageService],
|
|
22
|
+
};
|
|
23
|
+
}
|
|
14
24
|
};
|
|
15
25
|
exports.StorageModule = StorageModule;
|
|
16
|
-
exports.StorageModule = StorageModule = __decorate([
|
|
17
|
-
(0, common_1.Module)({
|
|
18
|
-
imports: [config_1.ConfigModule],
|
|
19
|
-
providers: [storage_service_1.StorageService],
|
|
20
|
-
exports: [storage_service_1.StorageService],
|
|
21
|
-
})
|
|
26
|
+
exports.StorageModule = StorageModule = StorageModule_1 = __decorate([
|
|
27
|
+
(0, common_1.Module)({})
|
|
22
28
|
], StorageModule);
|
|
@@ -1,15 +1,8 @@
|
|
|
1
|
-
import { ConfigService } from '@nestjs/config';
|
|
2
1
|
import { IStorageService, UploadResponse, DeleteResponse } from './storage.interface';
|
|
3
|
-
|
|
4
|
-
* Service class for interacting with Cloudinary to manage file uploads and deletions.
|
|
5
|
-
*/
|
|
2
|
+
import { CloudinaryConfig } from './cloudinary.storage';
|
|
6
3
|
export declare class StorageService implements IStorageService {
|
|
7
|
-
private
|
|
8
|
-
|
|
9
|
-
* Initializes the service and configures Cloudinary with environment variables.
|
|
10
|
-
* @param configService - The NestJS ConfigService to access environment variables.
|
|
11
|
-
*/
|
|
12
|
-
constructor(configService: ConfigService);
|
|
4
|
+
private cloudinaryConfig;
|
|
5
|
+
constructor(cloudinaryConfig: CloudinaryConfig);
|
|
13
6
|
/**
|
|
14
7
|
* Uploads a file to Cloudinary using a stream.
|
|
15
8
|
* @param file - The file to upload, provided as an Express.Multer.File object.
|
|
@@ -9,19 +9,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
9
9
|
exports.StorageService = void 0;
|
|
10
10
|
const common_1 = require("@nestjs/common");
|
|
11
11
|
const cloudinary_1 = require("cloudinary");
|
|
12
|
-
const cloudinary_storage_1 = require("./cloudinary.storage");
|
|
13
|
-
/**
|
|
14
|
-
* Service class for interacting with Cloudinary to manage file uploads and deletions.
|
|
15
|
-
*/
|
|
16
12
|
let StorageService = class StorageService {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
*/
|
|
22
|
-
constructor(configService) {
|
|
23
|
-
this.configService = configService;
|
|
24
|
-
(0, cloudinary_storage_1.configureCloudinary)(configService);
|
|
13
|
+
cloudinaryConfig;
|
|
14
|
+
constructor(cloudinaryConfig) {
|
|
15
|
+
this.cloudinaryConfig = cloudinaryConfig;
|
|
16
|
+
this.cloudinaryConfig.createSharedConfiguration();
|
|
25
17
|
}
|
|
26
18
|
/**
|
|
27
19
|
* Uploads a file to Cloudinary using a stream.
|