UNPKG

nest-square

Version:

NestJS module for Square Node.js SDK

62 lines 2.44 kB
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 NestSquareModule_1; import { Global, Module } from "@nestjs/common"; import { ConfigModule, ConfigService } from "@nestjs/config"; import { NEST_SQUARE_CONFIG_INJECTION_KEY, NestSquareConfig, } from "./nest-square.config.js"; import { NestSquareService } from "./nest-square.service.js"; let NestSquareModule = NestSquareModule_1 = class NestSquareModule { static fromEnv() { return { module: NestSquareModule_1, imports: [ConfigModule.forFeature(NestSquareConfig)], providers: [ NestSquareService, { provide: NEST_SQUARE_CONFIG_INJECTION_KEY, useFactory: (config) => config.get("square"), inject: [ConfigService], }, ], exports: [NestSquareService], }; } static forRoot(options) { return { module: NestSquareModule_1, providers: [ NestSquareService, { provide: NEST_SQUARE_CONFIG_INJECTION_KEY, useValue: options, }, ], exports: [NestSquareService], }; } static forRootAsync(options) { return { module: NestSquareModule_1, imports: [...(options.imports || [])], providers: [ NestSquareService, { provide: NEST_SQUARE_CONFIG_INJECTION_KEY, useFactory: options.useFactory, inject: options.inject || [], }, ], exports: [NestSquareService], }; } }; NestSquareModule = NestSquareModule_1 = __decorate([ Global(), Module({}) ], NestSquareModule); export { NestSquareModule }; //# sourceMappingURL=nest-square.module.js.map