Skip to content

Commit

Permalink
feat: Add resolver for brains
Browse files Browse the repository at this point in the history
  • Loading branch information
Michel Blancard committed Mar 1, 2018
1 parent a92237f commit e81c4bb
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions packages/botfuel-dialog/src/brain-resolver.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/**
* Copyright (c) 2017 - present, Botfuel (https://www.botfuel.io).
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

const logger = require('logtown')('BrainResolver');
const Resolver = require('./resolver');

/**
* The adapter resolver resolves the adapter at startup.
*/
class BrainResolver extends Resolver {
/**
* @constructor
* @param {Object} bot - the bot
*/
constructor(bot) {
super(bot.config, 'brain');
this.bot = bot;
}

/** @inheritdoc */
getPaths(name) {
logger.debug('getPaths', name);
return [`${this.path}/${name}-${this.kind}.js`, `${this.kindSdkPath}/${name}-${this.kind}.js`];
}

/** @inheritdoc */
resolutionSucceeded(Resolved) {
return new Resolved(this.bot.config);
}
}

module.exports = BrainResolver;

0 comments on commit e81c4bb

Please sign in to comment.