botbuilder-dialogs-adaptive
Version:
Rule system for the Microsoft BotBuilder dialog system.
48 lines • 1.65 kB
JavaScript
;
/**
* @module botbuilder-dialogs-adaptive
*/
/**
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.DialogListConverter = void 0;
const botbuilder_dialogs_1 = require("botbuilder-dialogs");
/**
* Converter which allows json to be expression to object or static object.
*/
class DialogListConverter {
/**
* Initializes a new instance of the [DialogListConverter](xref:botbuilder-dialogs-adaptive.DialogListConverter) class.
*
* @param _resourceExplorer Resource explorer to use for resolving references.
*/
constructor(_resourceExplorer) {
this._resourceExplorer = _resourceExplorer;
}
/**
* @param value A list of strings representing dialogs, or a list of dialogs.
* @returns A new list of [Dialog](xref:botbuilder-dialogs.Dialog) instance.
*/
convert(value) {
const results = [];
value.forEach((item) => {
if (item instanceof botbuilder_dialogs_1.Dialog) {
results.push(item);
}
else {
let resource = this._resourceExplorer.getResource(item);
if (!resource) {
resource = this._resourceExplorer.getResource(`${item}.dialog`);
}
if (resource) {
results.push(this._resourceExplorer.loadType(resource));
}
}
});
return results;
}
}
exports.DialogListConverter = DialogListConverter;
//# sourceMappingURL=dialogListConverter.js.map