botbuilder-dialogs
Version:
A dialog stack based conversation manager for Microsoft BotBuilder.
53 lines • 2.87 kB
JavaScript
;
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.DialogsBotComponent = void 0;
const z = __importStar(require("zod"));
const botbuilder_core_1 = require("botbuilder-core");
const scopes_1 = require("./memory/scopes");
const pathResolvers_1 = require("./memory/pathResolvers");
const InitialSettings = z.record(z.unknown());
/**
* Bot component for bot Dialogs.
*/
class DialogsBotComponent extends botbuilder_core_1.BotComponent {
/**
* @param services Services Collection to register.
* @param configuration Configuration for the bot component.
*/
configureServices(services, configuration) {
services.composeFactory('memoryScopes', (memoryScopes) => {
const rootConfiguration = configuration.get();
const rootConfigurationParse = InitialSettings.safeParse(rootConfiguration);
const initialSettings = rootConfigurationParse.success ? rootConfigurationParse.data : undefined;
return memoryScopes.concat(new scopes_1.TurnMemoryScope(), new scopes_1.SettingsMemoryScope(initialSettings), new scopes_1.DialogMemoryScope(), new scopes_1.DialogContextMemoryScope(), new scopes_1.DialogClassMemoryScope(), new scopes_1.ClassMemoryScope(), new scopes_1.ThisMemoryScope(), new scopes_1.ConversationMemoryScope(), new scopes_1.UserMemoryScope());
});
services.composeFactory('pathResolvers', (pathResolvers) => pathResolvers.concat(new pathResolvers_1.DollarPathResolver(), new pathResolvers_1.HashPathResolver(), new pathResolvers_1.AtAtPathResolver(), new pathResolvers_1.AtPathResolver(), new pathResolvers_1.PercentPathResolver()));
}
}
exports.DialogsBotComponent = DialogsBotComponent;
//# sourceMappingURL=dialogsBotComponent.js.map