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.ConnectionFactoryBase = void 0;\nconst Exports_js_1 = require(\"../common.speech/Exports.js\");\nconst Exports_js_2 = require(\"../sdk/Exports.js\");\nconst QueryParameterNames_js_1 = require(\"./QueryParameterNames.js\");\nclass ConnectionFactoryBase {\n static getHostSuffix(region) {\n if (!!region) {\n if (region.toLowerCase().startsWith(\"china\")) {\n return \".azure.cn\";\n }\n if (region.toLowerCase().startsWith(\"usgov\")) {\n return \".azure.us\";\n }\n }\n return \".microsoft.com\";\n }\n setCommonUrlParams(config, queryParams, endpoint) {\n const propertyIdToParameterMap = new Map([[Exports_js_2.PropertyId.Speech_SegmentationSilenceTimeoutMs, QueryParameterNames_js_1.QueryParameterNames.SegmentationSilenceTimeoutMs], [Exports_js_2.PropertyId.SpeechServiceConnection_EnableAudioLogging, QueryParameterNames_js_1.QueryParameterNames.EnableAudioLogging], [Exports_js_2.PropertyId.SpeechServiceConnection_EndSilenceTimeoutMs, QueryParameterNames_js_1.QueryParameterNames.EndSilenceTimeoutMs], [Exports_js_2.PropertyId.SpeechServiceConnection_InitialSilenceTimeoutMs, QueryParameterNames_js_1.QueryParameterNames.InitialSilenceTimeoutMs], [Exports_js_2.PropertyId.SpeechServiceResponse_PostProcessingOption, QueryParameterNames_js_1.QueryParameterNames.Postprocessing], [Exports_js_2.PropertyId.SpeechServiceResponse_ProfanityOption, QueryParameterNames_js_1.QueryParameterNames.Profanity], [Exports_js_2.PropertyId.SpeechServiceResponse_RequestWordLevelTimestamps, QueryParameterNames_js_1.QueryParameterNames.EnableWordLevelTimestamps], [Exports_js_2.PropertyId.SpeechServiceResponse_StablePartialResultThreshold, QueryParameterNames_js_1.QueryParameterNames.StableIntermediateThreshold]]);\n propertyIdToParameterMap.forEach((parameterName, propertyId) => {\n this.setUrlParameter(propertyId, parameterName, config, queryParams, endpoint);\n });\n const serviceProperties = JSON.parse(config.parameters.getProperty(Exports_js_1.ServicePropertiesPropertyName, \"{}\"));\n Object.keys(serviceProperties).forEach(value => {\n queryParams[value] = serviceProperties[value];\n });\n }\n setUrlParameter(propId, parameterName, config, queryParams, endpoint) {\n const value = config.parameters.getProperty(propId, undefined);\n // FIXME: The .search() check will incorrectly match parameter name anywhere in the string\n // including e.g. the path portion, or even as a substring of other query parameters\n if (value && (!endpoint || endpoint.search(parameterName) === -1)) {\n queryParams[parameterName] = value.toLocaleLowerCase();\n }\n }\n}\nexports.ConnectionFactoryBase = ConnectionFactoryBase;","map":{"version":3,"names":["Object","defineProperty","exports","value","ConnectionFactoryBase","Exports_js_1","require","Exports_js_2","QueryParameterNames_js_1","getHostSuffix","region","toLowerCase","startsWith","setCommonUrlParams","config","queryParams","endpoint","propertyIdToParameterMap","Map","PropertyId","Speech_SegmentationSilenceTimeoutMs","QueryParameterNames","SegmentationSilenceTimeoutMs","SpeechServiceConnection_EnableAudioLogging","EnableAudioLogging","SpeechServiceConnection_EndSilenceTimeoutMs","EndSilenceTimeoutMs","SpeechServiceConnection_InitialSilenceTimeoutMs","InitialSilenceTimeoutMs","SpeechServiceResponse_PostProcessingOption","Postprocessing","SpeechServiceResponse_ProfanityOption","Profanity","SpeechServiceResponse_RequestWordLevelTimestamps","EnableWordLevelTimestamps","SpeechServiceResponse_StablePartialResultThreshold","StableIntermediateThreshold","forEach","parameterName","propertyId","setUrlParameter","serviceProperties","JSON","parse","parameters","getProperty","ServicePropertiesPropertyName","keys","propId","undefined","search","toLocaleLowerCase"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/common.speech/ConnectionFactoryBase.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.ConnectionFactoryBase = void 0;\nconst Exports_js_1 = require(\"../common.speech/Exports.js\");\nconst Exports_js_2 = require(\"../sdk/Exports.js\");\nconst QueryParameterNames_js_1 = require(\"./QueryParameterNames.js\");\nclass ConnectionFactoryBase {\n static getHostSuffix(region) {\n if (!!region) {\n if (region.toLowerCase().startsWith(\"china\")) {\n return \".azure.cn\";\n }\n if (region.toLowerCase().startsWith(\"usgov\")) {\n return \".azure.us\";\n }\n }\n return \".microsoft.com\";\n }\n setCommonUrlParams(config, queryParams, endpoint) {\n const propertyIdToParameterMap = new Map([\n [Exports_js_2.PropertyId.Speech_SegmentationSilenceTimeoutMs, QueryParameterNames_js_1.QueryParameterNames.SegmentationSilenceTimeoutMs],\n [Exports_js_2.PropertyId.SpeechServiceConnection_EnableAudioLogging, QueryParameterNames_js_1.QueryParameterNames.EnableAudioLogging],\n [Exports_js_2.PropertyId.SpeechServiceConnection_EndSilenceTimeoutMs, QueryParameterNames_js_1.QueryParameterNames.EndSilenceTimeoutMs],\n [Exports_js_2.PropertyId.SpeechServiceConnection_InitialSilenceTimeoutMs, QueryParameterNames_js_1.QueryParameterNames.InitialSilenceTimeoutMs],\n [Exports_js_2.PropertyId.SpeechServiceResponse_PostProcessingOption, QueryParameterNames_js_1.QueryParameterNames.Postprocessing],\n [Exports_js_2.PropertyId.SpeechServiceResponse_ProfanityOption, QueryParameterNames_js_1.QueryParameterNames.Profanity],\n [Exports_js_2.PropertyId.SpeechServiceResponse_RequestWordLevelTimestamps, QueryParameterNames_js_1.QueryParameterNames.EnableWordLevelTimestamps],\n [Exports_js_2.PropertyId.SpeechServiceResponse_StablePartialResultThreshold, QueryParameterNames_js_1.QueryParameterNames.StableIntermediateThreshold],\n ]);\n propertyIdToParameterMap.forEach((parameterName, propertyId) => {\n this.setUrlParameter(propertyId, parameterName, config, queryParams, endpoint);\n });\n const serviceProperties = JSON.parse(config.parameters.getProperty(Exports_js_1.ServicePropertiesPropertyName, \"{}\"));\n Object.keys(serviceProperties).forEach((value) => {\n queryParams[value] = serviceProperties[value];\n });\n }\n setUrlParameter(propId, parameterName, config, queryParams, endpoint) {\n const value = config.parameters.getProperty(propId, undefined);\n // FIXME: The .search() check will incorrectly match parameter name anywhere in the string\n // including e.g. the path portion, or even as a substring of other query parameters\n if (value && (!endpoint || endpoint.search(parameterName) === -1)) {\n queryParams[parameterName] = value.toLocaleLowerCase();\n }\n }\n}\nexports.ConnectionFactoryBase = ConnectionFactoryBase;\n\n"],"mappings":"AAAA,YAAY;;AACZ;AACA;AACAA,MAAM,CAACC,cAAc,CAACC,OAAO,EAAE,YAAY,EAAE;EAAEC,KAAK,EAAE;AAAK,CAAC,CAAC;AAC7DD,OAAO,CAACE,qBAAqB,GAAG,KAAK,CAAC;AACtC,MAAMC,YAAY,GAAGC,OAAO,CAAC,6BAA6B,CAAC;AAC3D,MAAMC,YAAY,GAAGD,OAAO,CAAC,mBAAmB,CAAC;AACjD,MAAME,wBAAwB,GAAGF,OAAO,CAAC,0BAA0B,CAAC;AACpE,MAAMF,qBAAqB,CAAC;EACxB,OAAOK,aAAaA,CAACC,MAAM,EAAE;IACzB,IAAI,CAAC,CAACA,MAAM,EAAE;MACV,IAAIA,MAAM,CAACC,WAAW,CAAC,CAAC,CAACC,UAAU,CAAC,OAAO,CAAC,EAAE;QAC1C,OAAO,WAAW;MACtB;MACA,IAAIF,MAAM,CAACC,WAAW,CAAC,CAAC,CAACC,UAAU,CAAC,OAAO,CAAC,EAAE;QAC1C,OAAO,WAAW;MACtB;IACJ;IACA,OAAO,gBAAgB;EAC3B;EACAC,kBAAkBA,CAACC,MAAM,EAAEC,WAAW,EAAEC,QAAQ,EAAE;IAC9C,MAAMC,wBAAwB,GAAG,IAAIC,GAAG,CAAC,CACrC,CAACX,YAAY,CAACY,UAAU,CAACC,mCAAmC,EAAEZ,wBAAwB,CAACa,mBAAmB,CAACC,4BAA4B,CAAC,EACxI,CAACf,YAAY,CAACY,UAAU,CAACI,0CAA0C,EAAEf,wBAAwB,CAACa,mBAAmB,CAACG,kBAAkB,CAAC,EACrI,CAAC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