6f8d655ec3d08de3b16dd65b3f715c46e9939a5a7cfb16a4ec2140baabb1e48c.json 20 KB

1
  1. {"ast":null,"code":"\"use strict\";\n\n// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT license.\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.BotFrameworkConfig = void 0;\nconst Contracts_js_1 = require(\"./Contracts.js\");\nconst DialogServiceConfig_js_1 = require(\"./DialogServiceConfig.js\");\nconst Exports_js_1 = require(\"./Exports.js\");\n/**\n * Class that defines configurations for the dialog service connector object for using a Bot Framework backend.\n * @class BotFrameworkConfig\n */\nclass BotFrameworkConfig extends DialogServiceConfig_js_1.DialogServiceConfigImpl {\n /**\n * Creates an instance of BotFrameworkConfig.\n */\n constructor() {\n super();\n }\n /**\n * Creates a bot framework configuration instance with the provided subscription information.\n * @member BotFrameworkConfig.fromSubscription\n * @function\n * @public\n * @param subscription Subscription key associated with the bot\n * @param region The region name (see the <a href=\"https://aka.ms/csspeech/region\">region page</a>).\n * @param botId Optional. Identifier for using a specific bot within an Azure resource group. Equivalent to the\n * resource name.\n * @returns {BotFrameworkConfig} A new bot framework configuration instance.\n */\n static fromSubscription(subscription, region, botId) {\n Contracts_js_1.Contracts.throwIfNullOrWhitespace(subscription, \"subscription\");\n Contracts_js_1.Contracts.throwIfNullOrWhitespace(region, \"region\");\n const botFrameworkConfig = new DialogServiceConfig_js_1.DialogServiceConfigImpl();\n botFrameworkConfig.setProperty(Exports_js_1.PropertyId.Conversation_DialogType, DialogServiceConfig_js_1.DialogServiceConfig.DialogTypes.BotFramework);\n botFrameworkConfig.setProperty(Exports_js_1.PropertyId.SpeechServiceConnection_Key, subscription);\n botFrameworkConfig.setProperty(Exports_js_1.PropertyId.SpeechServiceConnection_Region, region);\n if (botId) {\n botFrameworkConfig.setProperty(Exports_js_1.PropertyId.Conversation_ApplicationId, botId);\n }\n return botFrameworkConfig;\n }\n /**\n * Creates a bot framework configuration instance for the specified authorization token and region.\n * Note: The caller must ensure that an authorization token is valid. Before an authorization token expires, the\n * caller must refresh it by setting the authorizationToken property on the corresponding\n * DialogServiceConnector instance created with this config. The contents of configuration objects are copied\n * when connectors are created, so setting authorizationToken on a DialogServiceConnector will not update the\n * original configuration's authorization token. Create a new configuration instance or set the\n * SpeechServiceAuthorization_Token property to update an existing instance if it will be used to create\n * further DialogServiceConnectors.\n * @member BotFrameworkConfig.fromAuthorizationToken\n * @function\n * @public\n * @param authorizationToken The authorization token associated with the bot\n * @param region The region name (see the <a href=\"https://aka.ms/csspeech/region\">region page</a>).\n * @param botId Optional. Identifier for using a specific bot within an Azure resource group. Equivalent to the\n * resource name.\n * @returns {BotFrameworkConfig} A new bot framework configuration instance.\n */\n static fromAuthorizationToken(authorizationToken, region, botId) {\n Contracts_js_1.Contracts.throwIfNullOrWhitespace(authorizationToken, \"authorizationToken\");\n Contracts_js_1.Contracts.throwIfNullOrWhitespace(region, \"region\");\n const botFrameworkConfig = new DialogServiceConfig_js_1.DialogServiceConfigImpl();\n botFrameworkConfig.setProperty(Exports_js_1.PropertyId.Conversation_DialogType, DialogServiceConfig_js_1.DialogServiceConfig.DialogTypes.BotFramework);\n botFrameworkConfig.setProperty(Exports_js_1.PropertyId.SpeechServiceAuthorization_Token, authorizationToken);\n botFrameworkConfig.setProperty(Exports_js_1.PropertyId.SpeechServiceConnection_Region, region);\n if (botId) {\n botFrameworkConfig.setProperty(Exports_js_1.PropertyId.Conversation_ApplicationId, botId);\n }\n return botFrameworkConfig;\n }\n /**\n * Creates an instance of a BotFrameworkConfig.\n * This method is intended only for users who use a non-default service host. The standard resource path will be\n * assumed. For services with a non-standard resource path or no path at all, use fromEndpoint instead.\n * Note: Query parameters are not allowed in the host URI and must be set by other APIs.\n * Note: To use an authorization token with fromHost, use fromHost(URL) and then set the AuthorizationToken\n * property on the created BotFrameworkConfig instance.\n * Note: Added in version 1.15.0.\n * @member BotFrameworkConfig.fromHost\n * @function\n * @public\n * @param {URL | string} host - If a URL is provided, the fully-qualified host with protocol (e.g.\n * wss://your.host.com:1234) will be used. If a string is provided, it will be embedded in\n * wss://{host}.convai.speech.azure.us.\n * @param {string} subscriptionKey - The subscription key. If a subscription key is not specified, an authorization\n * token must be set.\n * @param botId Optional. Identifier for using a specific bot within an Azure resource group. Equivalent to the\n * resource name.\n * @returns {BotFrameworkConfig} A new bot framework configuration instance.\n */\n static fromHost(host, subscriptionKey, botId) {\n void botId;\n Contracts_js_1.Contracts.throwIfNullOrUndefined(host, \"host\");\n const resolvedHost = host instanceof URL ? host : new URL(`wss://${host}.convai.speech.azure.us`);\n Contracts_js_1.Contracts.throwIfNullOrUndefined(resolvedHost, \"resolvedHost\");\n const botFrameworkConfig = new DialogServiceConfig_js_1.DialogServiceConfigImpl();\n botFrameworkConfig.setProperty(Exports_js_1.PropertyId.Conversation_DialogType, DialogServiceConfig_js_1.DialogServiceConfig.DialogTypes.BotFramework);\n botFrameworkConfig.setProperty(Exports_js_1.PropertyId.SpeechServiceConnection_Host, resolvedHost.toString());\n if (undefined !== subscriptionKey) {\n botFrameworkConfig.setProperty(Exports_js_1.PropertyId.SpeechServiceConnection_Key, subscriptionKey);\n }\n return botFrameworkConfig;\n }\n /**\n * Creates an instance of a BotFrameworkConfig.\n * This method is intended only for users who use a non-standard service endpoint or parameters.\n * Note: The query parameters specified in the endpoint URL are not changed, even if they are set by any other APIs.\n * Note: To use authorization token with fromEndpoint, pass an empty string to the subscriptionKey in the\n * fromEndpoint method, and then set authorizationToken=\"token\" on the created BotFrameworkConfig instance to\n * use the authorization token.\n * Note: Added in version 1.15.0.\n * @member BotFrameworkConfig.fromEndpoint\n * @function\n * @public\n * @param {URL} endpoint - The service endpoint to connect to.\n * @param {string} subscriptionKey - The subscription key. If a subscription key is not specified, an authorization\n * token must be set.\n * @returns {BotFrameworkConfig} - A new bot framework configuration instance using the provided endpoint.\n */\n static fromEndpoint(endpoint, subscriptionKey) {\n Contracts_js_1.Contracts.throwIfNull(endpoint, \"endpoint\");\n const botFrameworkConfig = new DialogServiceConfig_js_1.DialogServiceConfigImpl();\n botFrameworkConfig.setProperty(Exports_js_1.PropertyId.Conversation_DialogType, DialogServiceConfig_js_1.DialogServiceConfig.DialogTypes.BotFramework);\n botFrameworkConfig.setProperty(Exports_js_1.PropertyId.SpeechServiceConnection_Endpoint, endpoint.toString());\n if (undefined !== subscriptionKey) {\n botFrameworkConfig.setProperty(Exports_js_1.PropertyId.SpeechServiceConnection_Key, subscriptionKey);\n }\n return botFrameworkConfig;\n }\n}\nexports.BotFrameworkConfig = BotFrameworkConfig;","map":{"version":3,"names":["Object","defineProperty","exports","value","BotFrameworkConfig","Contracts_js_1","require","DialogServiceConfig_js_1","Exports_js_1","DialogServiceConfigImpl","constructor","fromSubscription","subscription","region","botId","Contracts","throwIfNullOrWhitespace","botFrameworkConfig","setProperty","PropertyId","Conversation_DialogType","DialogServiceConfig","DialogTypes","BotFramework","SpeechServiceConnection_Key","SpeechServiceConnection_Region","Conversation_ApplicationId","fromAuthorizationToken","authorizationToken","SpeechServiceAuthorization_Token","fromHost","host","subscriptionKey","throwIfNullOrUndefined","resolvedHost","URL","SpeechServiceConnection_Host","toString","undefined","fromEndpoint","endpoint","throwIfNull","SpeechServiceConnection_Endpoint"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/BotFrameworkConfig.js"],"sourcesContent":["\"use strict\";\n// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT license.\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.BotFrameworkConfig = void 0;\nconst Contracts_js_1 = require(\"./Contracts.js\");\nconst DialogServiceConfig_js_1 = require(\"./DialogServiceConfig.js\");\nconst Exports_js_1 = require(\"./Exports.js\");\n/**\n * Class that defines configurations for the dialog service connector object for using a Bot Framework backend.\n * @class BotFrameworkConfig\n */\nclass BotFrameworkConfig extends DialogServiceConfig_js_1.DialogServiceConfigImpl {\n /**\n * Creates an instance of BotFrameworkConfig.\n */\n constructor() {\n super();\n }\n /**\n * Creates a bot framework configuration instance with the provided subscription information.\n * @member BotFrameworkConfig.fromSubscription\n * @function\n * @public\n * @param subscription Subscription key associated with the bot\n * @param region The region name (see the <a href=\"https://aka.ms/csspeech/region\">region page</a>).\n * @param botId Optional. Identifier for using a specific bot within an Azure resource group. Equivalent to the\n * resource name.\n * @returns {BotFrameworkConfig} A new bot framework configuration instance.\n */\n static fromSubscription(subscription, region, botId) {\n Contracts_js_1.Contracts.throwIfNullOrWhitespace(subscription, \"subscription\");\n Contracts_js_1.Contracts.throwIfNullOrWhitespace(region, \"region\");\n const botFrameworkConfig = new DialogServiceConfig_js_1.DialogServiceConfigImpl();\n botFrameworkConfig.setProperty(Exports_js_1.PropertyId.Conversation_DialogType, DialogServiceConfig_js_1.DialogServiceConfig.DialogTypes.BotFramework);\n botFrameworkConfig.setProperty(Exports_js_1.PropertyId.SpeechServiceConnection_Key, subscription);\n botFrameworkConfig.setProperty(Exports_js_1.PropertyId.SpeechServiceConnection_Region, region);\n if (botId) {\n botFrameworkConfig.setProperty(Exports_js_1.PropertyId.Conversation_ApplicationId, botId);\n }\n return botFrameworkConfig;\n }\n /**\n * Creates a bot framework configuration instance for the specified authorization token and region.\n * Note: The caller must ensure that an authorization token is valid. Before an authorization token expires, the\n * caller must refresh it by setting the authorizationToken property on the corresponding\n * DialogServiceConnector instance created with this config. The contents of configuration objects are copied\n * when connectors are created, so setting authorizationToken on a DialogServiceConnector will not update the\n * original configuration's authorization token. Create a new configuration instance or set the\n * SpeechServiceAuthorization_Token property to update an existing instance if it will be used to create\n * further DialogServiceConnectors.\n * @member BotFrameworkConfig.fromAuthorizationToken\n * @function\n * @public\n * @param authorizationToken The authorization token associated with the bot\n * @param region The region name (see the <a href=\"https://aka.ms/csspeech/region\">region page</a>).\n * @param botId Optional. Identifier for using a specific bot within an Azure resource group. Equivalent to the\n * resource name.\n * @returns {BotFrameworkConfig} A new bot framework configuration instance.\n */\n static fromAuthorizationToken(authorizationToken, region, botId) {\n Contracts_js_1.Contracts.throwIfNullOrWhitespace(authorizationToken, \"authorizationToken\");\n Contracts_js_1.Contracts.throwIfNullOrWhitespace(region, \"region\");\n const botFrameworkConfig = new DialogServiceConfig_js_1.DialogServiceConfigImpl();\n botFrameworkConfig.setProperty(Exports_js_1.PropertyId.Conversation_DialogType, DialogServiceConfig_js_1.DialogServiceConfig.DialogTypes.BotFramework);\n botFrameworkConfig.setProperty(Exports_js_1.PropertyId.SpeechServiceAuthorization_Token, authorizationToken);\n botFrameworkConfig.setProperty(Exports_js_1.PropertyId.SpeechServiceConnection_Region, region);\n if (botId) {\n botFrameworkConfig.setProperty(Exports_js_1.PropertyId.Conversation_ApplicationId, botId);\n }\n return botFrameworkConfig;\n }\n /**\n * Creates an instance of a BotFrameworkConfig.\n * This method is intended only for users who use a non-default service host. The standard resource path will be\n * assumed. For services with a non-standard resource path or no path at all, use fromEndpoint instead.\n * Note: Query parameters are not allowed in the host URI and must be set by other APIs.\n * Note: To use an authorization token with fromHost, use fromHost(URL) and then set the AuthorizationToken\n * property on the created BotFrameworkConfig instance.\n * Note: Added in version 1.15.0.\n * @member BotFrameworkConfig.fromHost\n * @function\n * @public\n * @param {URL | string} host - If a URL is provided, the fully-qualified host with protocol (e.g.\n * wss://your.host.com:1234) will be used. If a string is provided, it will be embedded in\n * wss://{host}.convai.speech.azure.us.\n * @param {string} subscriptionKey - The subscription key. If a subscription key is not specified, an authorization\n * token must be set.\n * @param botId Optional. Identifier for using a specific bot within an Azure resource group. Equivalent to the\n * resource name.\n * @returns {BotFrameworkConfig} A new bot framework configuration instance.\n */\n static fromHost(host, subscriptionKey, botId) {\n void botId;\n Contracts_js_1.Contracts.throwIfNullOrUndefined(host, \"host\");\n const resolvedHost = host instanceof URL ? host : new URL(`wss://${host}.convai.speech.azure.us`);\n Contracts_js_1.Contracts.throwIfNullOrUndefined(resolvedHost, \"resolvedHost\");\n const botFrameworkConfig = new DialogServiceConfig_js_1.DialogServiceConfigImpl();\n botFrameworkConfig.setProperty(Exports_js_1.PropertyId.Conversation_DialogType, DialogServiceConfig_js_1.DialogServiceConfig.DialogTypes.BotFramework);\n botFrameworkConfig.setProperty(Exports_js_1.PropertyId.SpeechServiceConnection_Host, resolvedHost.toString());\n if (undefined !== subscriptionKey) {\n botFrameworkConfig.setProperty(Exports_js_1.PropertyId.SpeechServiceConnection_Key, subscriptionKey);\n }\n return botFrameworkConfig;\n }\n /**\n * Creates an instance of a BotFrameworkConfig.\n * This method is intended only for users who use a non-standard service endpoint or parameters.\n * Note: The query parameters specified in the endpoint URL are not changed, even if they are set by any other APIs.\n * Note: To use authorization token with fromEndpoint, pass an empty string to the subscriptionKey in the\n * fromEndpoint method, and then set authorizationToken=\"token\" on the created BotFrameworkConfig instance to\n * use the authorization token.\n * Note: Added in version 1.15.0.\n * @member BotFrameworkConfig.fromEndpoint\n * @function\n * @public\n * @param {URL} endpoint - The service endpoint to connect to.\n * @param {string} subscriptionKey - The subscription key. If a subscription key is not specified, an authorization\n * token must be set.\n * @returns {BotFrameworkConfig} - A new bot framework configuration instance using the provided endpoint.\n */\n static fromEndpoint(endpoint, subscriptionKey) {\n Contracts_js_1.Contracts.throwIfNull(endpoint, \"endpoint\");\n const botFrameworkConfig = new DialogServiceConfig_js_1.DialogServiceConfigImpl();\n botFrameworkConfig.setProperty(Exports_js_1.PropertyId.Conversation_DialogType, DialogServiceConfig_js_1.DialogServiceConfig.DialogTypes.BotFramework);\n botFrameworkConfig.setProperty(Exports_js_1.PropertyId.SpeechServiceConnection_Endpoint, endpoint.toString());\n if (undefined !== subscriptionKey) {\n botFrameworkConfig.setProperty(Exports_js_1.PropertyId.SpeechServiceConnection_Key, subscriptionKey);\n }\n return botFrameworkConfig;\n }\n}\nexports.BotFrameworkConfig = BotFrameworkConfig;\n\n"],"mappings":"AAAA,YAAY;;AACZ;AACA;AACAA,MAAM,CAACC,cAAc,CAACC,OAAO,EAAE,YAAY,EAAE;EAAEC,KAAK,EAAE;AAAK,C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