UNPKG

@appotter/nestjs-s3

Version:

NestJS provider to integrates with AWS S3

48 lines 1.95 kB
"use strict"; var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); 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; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var S3Module_1; Object.defineProperty(exports, "__esModule", { value: true }); exports.S3Module = void 0; const common_1 = require("@nestjs/common"); const constants_1 = require("./constants"); const s3_service_1 = require("./s3.service"); let S3Module = S3Module_1 = class S3Module { static register(config) { return { module: S3Module_1, providers: [ { provide: constants_1.S3_CONFIGURATION, useValue: config, }, s3_service_1.S3Service, ], exports: [constants_1.S3_CONFIGURATION, s3_service_1.S3Service], }; } static async registerAsync(config) { return { module: S3Module_1, imports: config.imports || [], providers: [this.createAsyncProviders(config), s3_service_1.S3Service], exports: [constants_1.S3_CONFIGURATION, s3_service_1.S3Service], }; } static createAsyncProviders(options) { return { provide: constants_1.S3_CONFIGURATION, useFactory: options.useFactory, inject: options.inject || [], }; } }; exports.S3Module = S3Module; exports.S3Module = S3Module = S3Module_1 = __decorate([ (0, common_1.Module)({}) ], S3Module); //# sourceMappingURL=s3.module.js.map