{"version":3,"sources":["src/common.speech/ConnectionFactoryBase.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAgB,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAE,kBAAkB,EAAmB,gBAAgB,EAA6B,MAAM,WAAW,CAAC;AAGvH,8BAAsB,qBAAsB,YAAW,kBAAkB;aACrD,MAAM,CAClB,MAAM,EAAE,gBAAgB,EACxB,QAAQ,EAAE,QAAQ,EAClB,YAAY,CAAC,EAAE,MAAM,GAAG,WAAW;IAEvC,SAAS,CAAC,kBAAkB,CACxB,MAAM,EAAE,gBAAgB,EACxB,WAAW,EAAE,iBAAiB,CAAC,MAAM,CAAC,EACtC,QAAQ,EAAE,MAAM,GAAG,IAAI;IA6C3B,SAAS,CAAC,eAAe,CACrB,MAAM,EAAE,UAAU,EAClB,aAAa,EAAE,MAAM,EACrB,MAAM,EAAE,gBAAgB,EACxB,WAAW,EAAE,iBAAiB,CAAC,MAAM,CAAC,EACtC,QAAQ,EAAE,MAAM,GAAG,IAAI;CAQ9B","file":"ConnectionFactoryBase.d.ts","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT license.\n\nimport {\n    ServicePropertiesPropertyName,\n} from \"../common.speech/Exports\";\nimport { IConnection, IStringDictionary } from \"../common/Exports\";\nimport { OutputFormat, PropertyId } from \"../sdk/Exports\";\nimport { AuthInfo, IConnectionFactory, RecognitionMode, RecognizerConfig, WebsocketMessageFormatter } from \"./Exports\";\nimport { QueryParameterNames } from \"./QueryParameterNames\";\n\nexport abstract class ConnectionFactoryBase implements IConnectionFactory {\n    public abstract create(\n        config: RecognizerConfig,\n        authInfo: AuthInfo,\n        connectionId?: string): IConnection;\n\n    protected setCommonUrlParams(\n        config: RecognizerConfig,\n        queryParams: IStringDictionary<string>,\n        endpoint: string): void {\n\n        this.setUrlParameter(PropertyId.SpeechServiceConnection_EnableAudioLogging,\n            QueryParameterNames.EnableAudioLogging,\n            config,\n            queryParams,\n            endpoint);\n\n        this.setUrlParameter(PropertyId.SpeechServiceResponse_RequestWordLevelTimestamps,\n            QueryParameterNames.EnableWordLevelTimestamps,\n            config,\n            queryParams,\n            endpoint);\n\n        this.setUrlParameter(PropertyId.SpeechServiceResponse_ProfanityOption,\n            QueryParameterNames.Profanify,\n            config,\n            queryParams,\n            endpoint);\n\n        this.setUrlParameter(PropertyId.SpeechServiceConnection_InitialSilenceTimeoutMs,\n            QueryParameterNames.InitialSilenceTimeoutMs,\n            config,\n            queryParams,\n            endpoint);\n\n        this.setUrlParameter(PropertyId.SpeechServiceConnection_EndSilenceTimeoutMs,\n            QueryParameterNames.EndSilenceTimeoutMs,\n            config,\n            queryParams,\n            endpoint);\n\n        this.setUrlParameter(PropertyId.SpeechServiceResponse_StablePartialResultThreshold,\n            QueryParameterNames.StableIntermediateThreshold,\n            config,\n            queryParams,\n            endpoint);\n\n        const serviceProperties: IStringDictionary<string> = JSON.parse(config.parameters.getProperty(ServicePropertiesPropertyName, \"{}\"));\n\n        Object.keys(serviceProperties).forEach((value: string, num: number, array: string[]) => {\n            queryParams[value] = serviceProperties[value];\n        });\n    }\n\n    protected setUrlParameter(\n        propId: PropertyId,\n        parameterName: string,\n        config: RecognizerConfig,\n        queryParams: IStringDictionary<string>,\n        endpoint: string): void {\n\n        const value: string = config.parameters.getProperty(propId, undefined);\n\n        if (value && (!endpoint || endpoint.search(parameterName) === -1)) {\n            queryParams[parameterName] = value.toLocaleLowerCase();\n        }\n    }\n}\n"]}