@yieldbits/probot
Version:
a probot integration library for nestjs projects
60 lines • 2.64 kB
JavaScript
;
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 ProbotModule_1;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ProbotModule = void 0;
const common_1 = require("@nestjs/common");
const probot_types_1 = require("./probot.types");
const probot_discovery_1 = require("./probot.discovery");
const hook_controller_1 = require("./hook.controller");
const core_1 = require("@nestjs/core");
const hook_metadata_accessor_1 = require("./hook-metadata.accessor");
let ProbotModule = ProbotModule_1 = class ProbotModule {
static forRoot(options) {
const { path: hookPath } = options;
const HookController = (0, hook_controller_1.getControllerClass)({ path: hookPath });
return {
global: options.isGlobal || true,
module: ProbotModule_1,
controllers: [HookController],
providers: [
{
provide: probot_types_1.ModuleProviders.ProbotConfig,
useFactory: () => options.config,
},
hook_metadata_accessor_1.HookMetadataAccessor,
probot_discovery_1.ProbotDiscovery,
],
};
}
static forRootAsync(options) {
const { path: hookPath } = options;
const HookController = (0, hook_controller_1.getControllerClass)({ path: hookPath });
return {
module: ProbotModule_1,
global: options.isGlobal || true,
controllers: [HookController],
providers: [
{
provide: probot_types_1.ModuleProviders.ProbotConfig,
useFactory: options.useFactory,
inject: options.inject || [],
},
hook_metadata_accessor_1.HookMetadataAccessor,
probot_discovery_1.ProbotDiscovery,
],
};
}
};
ProbotModule = ProbotModule_1 = __decorate([
(0, common_1.Module)({
imports: [core_1.DiscoveryModule],
})
], ProbotModule);
exports.ProbotModule = ProbotModule;
//# sourceMappingURL=probot.module.js.map