nestjs-slack-webhook
Advanced tools
Comparing version 0.0.2 to 0.0.3
@@ -15,3 +15,3 @@ import { IncomingWebhook } from "@slack/webhook"; | ||
url, | ||
username: "test_user" | ||
username: "test_user", | ||
}); | ||
@@ -18,0 +18,0 @@ |
@@ -21,3 +21,3 @@ import { Injectable } from "@nestjs/common"; | ||
imports: [SlackModule.forRoot({ url })], | ||
providers: [TestService] | ||
providers: [TestService], | ||
}).compile(); | ||
@@ -24,0 +24,0 @@ }); |
@@ -14,3 +14,3 @@ import { Module } from "@nestjs/common"; | ||
return { | ||
url | ||
url, | ||
}; | ||
@@ -22,3 +22,3 @@ } | ||
exports: [TestService], | ||
providers: [TestService] | ||
providers: [TestService], | ||
}) | ||
@@ -30,3 +30,3 @@ class TestModule {} | ||
const module = await Test.createTestingModule({ | ||
imports: [SlackModule.forRoot({ url })] | ||
imports: [SlackModule.forRoot({ url })], | ||
}).compile(); | ||
@@ -45,5 +45,5 @@ | ||
SlackModule.forRootAsync({ | ||
useFactory: () => ({ url }) | ||
}) | ||
] | ||
useFactory: () => ({ url }), | ||
}), | ||
], | ||
}).compile(); | ||
@@ -61,5 +61,5 @@ | ||
imports: [TestModule], | ||
useExisting: TestService | ||
}) | ||
] | ||
useExisting: TestService, | ||
}), | ||
], | ||
}).compile(); | ||
@@ -76,5 +76,5 @@ | ||
SlackModule.forRootAsync({ | ||
useClass: TestService | ||
}) | ||
] | ||
useClass: TestService, | ||
}), | ||
], | ||
}).compile(); | ||
@@ -81,0 +81,0 @@ |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.createSlackProvider = void 0; | ||
const slackConstants_1 = require("./slackConstants"); | ||
@@ -8,3 +9,3 @@ const getSlackClient_1 = require("./getSlackClient"); | ||
provide: slackConstants_1.SLACK_TOKEN, | ||
useValue: getSlackClient_1.getSlackClient(options) | ||
useValue: getSlackClient_1.getSlackClient(options), | ||
}; | ||
@@ -11,0 +12,0 @@ } |
@@ -14,2 +14,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getSlackClient = void 0; | ||
const webhook_1 = require("@slack/webhook"); | ||
@@ -16,0 +17,0 @@ function getSlackClient(_a) { |
"use strict"; | ||
function __export(m) { | ||
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __exportStar = (this && this.__exportStar) || function(m, exports) { | ||
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); | ||
} | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
__export(require("./slackModule")); | ||
__export(require("./injectSlack")); | ||
__exportStar(require("./slackModule"), exports); | ||
__exportStar(require("./slackOptions"), exports); | ||
__exportStar(require("./injectSlack"), exports); | ||
//# sourceMappingURL=index.js.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.InjectSlack = void 0; | ||
const common_1 = require("@nestjs/common"); | ||
@@ -4,0 +5,0 @@ const slackConstants_1 = require("./slackConstants"); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.SLACK_TOKEN = exports.SLACK_MODULE = void 0; | ||
exports.SLACK_MODULE = "SlackModule"; | ||
exports.SLACK_TOKEN = "SLACK_TOKEN"; | ||
//# sourceMappingURL=slackConstants.js.map |
@@ -8,4 +8,4 @@ "use strict"; | ||
}; | ||
var SlackCoreModule_1; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.SlackCoreModule = void 0; | ||
const common_1 = require("@nestjs/common"); | ||
@@ -15,63 +15,67 @@ const slackConstants_1 = require("./slackConstants"); | ||
const createSlackProvider_1 = require("./createSlackProvider"); | ||
let SlackCoreModule = SlackCoreModule_1 = class SlackCoreModule { | ||
static forRoot(options) { | ||
const provider = createSlackProvider_1.createSlackProvider(options); | ||
return { | ||
exports: [provider], | ||
module: SlackCoreModule_1, | ||
providers: [provider] | ||
}; | ||
} | ||
static forRootAsync(options) { | ||
const slackProvider = { | ||
inject: [slackConstants_1.SLACK_MODULE], | ||
provide: slackConstants_1.SLACK_TOKEN, | ||
useFactory: (slackOptions) => getSlackClient_1.getSlackClient(slackOptions) | ||
}; | ||
return { | ||
exports: [slackProvider], | ||
imports: options.imports, | ||
module: SlackCoreModule_1, | ||
providers: [...this.createAsyncProviders(options), slackProvider] | ||
}; | ||
} | ||
static createAsyncProviders(options) { | ||
var _a; | ||
if (options.useExisting || options.useFactory) { | ||
return [this.createAsyncOptionsProvider(options)]; | ||
let SlackCoreModule = (() => { | ||
var SlackCoreModule_1; | ||
let SlackCoreModule = SlackCoreModule_1 = class SlackCoreModule { | ||
static forRoot(options) { | ||
const provider = createSlackProvider_1.createSlackProvider(options); | ||
return { | ||
exports: [provider], | ||
module: SlackCoreModule_1, | ||
providers: [provider], | ||
}; | ||
} | ||
return [ | ||
this.createAsyncOptionsProvider(options), | ||
{ | ||
provide: options.useClass, | ||
useClass: options.useClass, | ||
inject: [(_a = options.inject) !== null && _a !== void 0 ? _a : []] | ||
static forRootAsync(options) { | ||
const slackProvider = { | ||
inject: [slackConstants_1.SLACK_MODULE], | ||
provide: slackConstants_1.SLACK_TOKEN, | ||
useFactory: (slackOptions) => getSlackClient_1.getSlackClient(slackOptions), | ||
}; | ||
return { | ||
exports: [slackProvider], | ||
imports: options.imports, | ||
module: SlackCoreModule_1, | ||
providers: [...this.createAsyncProviders(options), slackProvider], | ||
}; | ||
} | ||
static createAsyncProviders(options) { | ||
var _a; | ||
if (options.useExisting || options.useFactory) { | ||
return [this.createAsyncOptionsProvider(options)]; | ||
} | ||
]; | ||
} | ||
static createAsyncOptionsProvider(options) { | ||
var _a; | ||
if (options.useFactory) { | ||
return [ | ||
this.createAsyncOptionsProvider(options), | ||
{ | ||
provide: options.useClass, | ||
useClass: options.useClass, | ||
inject: [(_a = options.inject) !== null && _a !== void 0 ? _a : []], | ||
}, | ||
]; | ||
} | ||
static createAsyncOptionsProvider(options) { | ||
var _a; | ||
if (options.useFactory) { | ||
return { | ||
inject: (_a = options.inject) !== null && _a !== void 0 ? _a : [], | ||
provide: slackConstants_1.SLACK_MODULE, | ||
useFactory: options.useFactory, | ||
}; | ||
} | ||
return { | ||
inject: (_a = options.inject) !== null && _a !== void 0 ? _a : [], | ||
inject: options.useExisting | ||
? [options.useExisting] | ||
: options.useClass | ||
? [options.useClass] | ||
: [], | ||
provide: slackConstants_1.SLACK_MODULE, | ||
useFactory: options.useFactory | ||
useFactory: (optionsFactory) => optionsFactory.createSlackOptions(), | ||
}; | ||
} | ||
return { | ||
inject: options.useExisting | ||
? [options.useExisting] | ||
: options.useClass | ||
? [options.useClass] | ||
: [], | ||
provide: slackConstants_1.SLACK_MODULE, | ||
useFactory: (optionsFactory) => optionsFactory.createSlackOptions() | ||
}; | ||
} | ||
}; | ||
SlackCoreModule = SlackCoreModule_1 = __decorate([ | ||
common_1.Global(), | ||
common_1.Module({}) | ||
], SlackCoreModule); | ||
}; | ||
SlackCoreModule = SlackCoreModule_1 = __decorate([ | ||
common_1.Global(), | ||
common_1.Module({}) | ||
], SlackCoreModule); | ||
return SlackCoreModule; | ||
})(); | ||
exports.SlackCoreModule = SlackCoreModule; | ||
//# sourceMappingURL=slackCoreModule.js.map |
@@ -8,24 +8,28 @@ "use strict"; | ||
}; | ||
var SlackModule_1; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.SlackModule = void 0; | ||
const common_1 = require("@nestjs/common"); | ||
const slackCoreModule_1 = require("./slackCoreModule"); | ||
let SlackModule = SlackModule_1 = class SlackModule { | ||
static forRoot(options) { | ||
return { | ||
module: SlackModule_1, | ||
imports: [slackCoreModule_1.SlackCoreModule.forRoot(options)] | ||
}; | ||
} | ||
static forRootAsync(options) { | ||
return { | ||
module: SlackModule_1, | ||
imports: [slackCoreModule_1.SlackCoreModule.forRootAsync(options)] | ||
}; | ||
} | ||
}; | ||
SlackModule = SlackModule_1 = __decorate([ | ||
common_1.Module({}) | ||
], SlackModule); | ||
let SlackModule = (() => { | ||
var SlackModule_1; | ||
let SlackModule = SlackModule_1 = class SlackModule { | ||
static forRoot(options) { | ||
return { | ||
module: SlackModule_1, | ||
imports: [slackCoreModule_1.SlackCoreModule.forRoot(options)], | ||
}; | ||
} | ||
static forRootAsync(options) { | ||
return { | ||
module: SlackModule_1, | ||
imports: [slackCoreModule_1.SlackCoreModule.forRootAsync(options)], | ||
}; | ||
} | ||
}; | ||
SlackModule = SlackModule_1 = __decorate([ | ||
common_1.Module({}) | ||
], SlackModule); | ||
return SlackModule; | ||
})(); | ||
exports.SlackModule = SlackModule; | ||
//# sourceMappingURL=slackModule.js.map |
{ | ||
"name": "nestjs-slack-webhook", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"description": "Nest.js + slack-webhook", | ||
@@ -23,6 +23,10 @@ "repository": { | ||
"devDependencies": { | ||
"@nestjs/testing": "7.0.2", | ||
"@slack/webhook": "5.0.3" | ||
"@nestjs/common": "7.0.13", | ||
"@nestjs/core": "7.0.13", | ||
"@nestjs/testing": "7.0.13", | ||
"@slack/webhook": "5.0.3", | ||
"reflect-metadata": "0.1.13", | ||
"rxjs": "6.5.5" | ||
}, | ||
"types": "lib/index.d.ts" | ||
} |
@@ -12,4 +12,4 @@ import { Provider } from "@nestjs/common"; | ||
provide: SLACK_TOKEN, | ||
useValue: getSlackClient(options) | ||
useValue: getSlackClient(options), | ||
}; | ||
} |
@@ -10,3 +10,3 @@ import { DynamicModule, Global, Module, Provider } from "@nestjs/common"; | ||
SlackAsyncOptions, | ||
SlackOptionsFactory | ||
SlackOptionsFactory, | ||
} from "./slackOptions"; | ||
@@ -23,3 +23,3 @@ | ||
module: SlackCoreModule, | ||
providers: [provider] | ||
providers: [provider], | ||
}; | ||
@@ -32,3 +32,3 @@ } | ||
provide: SLACK_TOKEN, | ||
useFactory: (slackOptions: SlackOptions) => getSlackClient(slackOptions) | ||
useFactory: (slackOptions: SlackOptions) => getSlackClient(slackOptions), | ||
}; | ||
@@ -40,3 +40,3 @@ | ||
module: SlackCoreModule, | ||
providers: [...this.createAsyncProviders(options), slackProvider] | ||
providers: [...this.createAsyncProviders(options), slackProvider], | ||
}; | ||
@@ -54,4 +54,4 @@ } | ||
useClass: options.useClass, | ||
inject: [options.inject ?? []] | ||
} as ClassProvider | ||
inject: [options.inject ?? []], | ||
} as ClassProvider, | ||
]; | ||
@@ -67,3 +67,3 @@ } | ||
provide: SLACK_MODULE, | ||
useFactory: options.useFactory | ||
useFactory: options.useFactory, | ||
}; | ||
@@ -79,5 +79,5 @@ } | ||
useFactory: (optionsFactory: SlackOptionsFactory) => | ||
optionsFactory.createSlackOptions() | ||
optionsFactory.createSlackOptions(), | ||
}; | ||
} | ||
} |
@@ -10,3 +10,3 @@ import { DynamicModule, Module } from "@nestjs/common"; | ||
module: SlackModule, | ||
imports: [SlackCoreModule.forRoot(options)] | ||
imports: [SlackCoreModule.forRoot(options)], | ||
}; | ||
@@ -18,5 +18,5 @@ } | ||
module: SlackModule, | ||
imports: [SlackCoreModule.forRootAsync(options)] | ||
imports: [SlackCoreModule.forRootAsync(options)], | ||
}; | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
23915
492
6