1 |
- {"ast":null,"code":"\"use strict\";\n\n//\n// Copyright (c) Microsoft. All rights reserved.\n// Licensed under the MIT license. See LICENSE.md file in the project root for full license information.\n//\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.ConnectionMessageImpl = exports.ConnectionMessage = void 0;\n// eslint-disable-next-line max-classes-per-file\nconst HeaderNames_js_1 = require(\"../common.speech/HeaderNames.js\");\nconst Exports_js_1 = require(\"../common/Exports.js\");\nconst PropertyCollection_js_1 = require(\"./PropertyCollection.js\");\nconst PropertyId_js_1 = require(\"./PropertyId.js\");\n/**\n * ConnectionMessage represents implementation specific messages sent to and received from\n * the speech service. These messages are provided for debugging purposes and should not\n * be used for production use cases with the Azure Cognitive Services Speech Service.\n * Messages sent to and received from the Speech Service are subject to change without\n * notice. This includes message contents, headers, payloads, ordering, etc.\n * Added in version 1.11.0.\n */\nclass ConnectionMessage {}\nexports.ConnectionMessage = ConnectionMessage;\nclass ConnectionMessageImpl {\n constructor(message) {\n this.privConnectionMessage = message;\n this.privProperties = new PropertyCollection_js_1.PropertyCollection();\n if (!!this.privConnectionMessage.headers[HeaderNames_js_1.HeaderNames.ConnectionId]) {\n this.privProperties.setProperty(PropertyId_js_1.PropertyId.Speech_SessionId, this.privConnectionMessage.headers[HeaderNames_js_1.HeaderNames.ConnectionId]);\n }\n Object.keys(this.privConnectionMessage.headers).forEach(header => {\n this.privProperties.setProperty(header, this.privConnectionMessage.headers[header]);\n });\n }\n /**\n * The message path.\n */\n get path() {\n return this.privConnectionMessage.headers[Object.keys(this.privConnectionMessage.headers).find(key => key.toLowerCase() === \"path\".toLowerCase())];\n }\n /**\n * Checks to see if the ConnectionMessage is a text message.\n * See also IsBinaryMessage().\n */\n get isTextMessage() {\n return this.privConnectionMessage.messageType === Exports_js_1.MessageType.Text;\n }\n /**\n * Checks to see if the ConnectionMessage is a binary message.\n * See also GetBinaryMessage().\n */\n get isBinaryMessage() {\n return this.privConnectionMessage.messageType === Exports_js_1.MessageType.Binary;\n }\n /**\n * Gets the text message payload. Typically the text message content-type is\n * application/json. To determine other content-types use\n * Properties.GetProperty(\"Content-Type\").\n */\n get TextMessage() {\n return this.privConnectionMessage.textBody;\n }\n /**\n * Gets the binary message payload.\n */\n get binaryMessage() {\n return this.privConnectionMessage.binaryBody;\n }\n /**\n * A collection of properties and their values defined for this <see cref=\"ConnectionMessage\"/>.\n * Message headers can be accessed via this collection (e.g. \"Content-Type\").\n */\n get properties() {\n return this.privProperties;\n }\n /**\n * Returns a string that represents the connection message.\n */\n toString() {\n return \"\";\n }\n}\nexports.ConnectionMessageImpl = ConnectionMessageImpl;","map":{"version":3,"names":["Object","defineProperty","exports","value","ConnectionMessageImpl","ConnectionMessage","HeaderNames_js_1","require","Exports_js_1","PropertyCollection_js_1","PropertyId_js_1","constructor","message","privConnectionMessage","privProperties","PropertyCollection","headers","HeaderNames","ConnectionId","setProperty","PropertyId","Speech_SessionId","keys","forEach","header","path","find","key","toLowerCase","isTextMessage","messageType","MessageType","Text","isBinaryMessage","Binary","TextMessage","textBody","binaryMessage","binaryBody","properties","toString"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/microsoft-cognitiveservices-speech-sdk/distrib/lib/src/sdk/ConnectionMessage.js"],"sourcesContent":["\"use strict\";\n//\n// Copyright (c) Microsoft. All rights reserved.\n// Licensed under the MIT license. See LICENSE.md file in the project root for full license information.\n//\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.ConnectionMessageImpl = exports.ConnectionMessage = void 0;\n// eslint-disable-next-line max-classes-per-file\nconst HeaderNames_js_1 = require(\"../common.speech/HeaderNames.js\");\nconst Exports_js_1 = require(\"../common/Exports.js\");\nconst PropertyCollection_js_1 = require(\"./PropertyCollection.js\");\nconst PropertyId_js_1 = require(\"./PropertyId.js\");\n/**\n * ConnectionMessage represents implementation specific messages sent to and received from\n * the speech service. These messages are provided for debugging purposes and should not\n * be used for production use cases with the Azure Cognitive Services Speech Service.\n * Messages sent to and received from the Speech Service are subject to change without\n * notice. This includes message contents, headers, payloads, ordering, etc.\n * Added in version 1.11.0.\n */\nclass ConnectionMessage {\n}\nexports.ConnectionMessage = ConnectionMessage;\nclass ConnectionMessageImpl {\n constructor(message) {\n this.privConnectionMessage = message;\n this.privProperties = new PropertyCollection_js_1.PropertyCollection();\n if (!!this.privConnectionMessage.headers[HeaderNames_js_1.HeaderNames.ConnectionId]) {\n this.privProperties.setProperty(PropertyId_js_1.PropertyId.Speech_SessionId, this.privConnectionMessage.headers[HeaderNames_js_1.HeaderNames.ConnectionId]);\n }\n Object.keys(this.privConnectionMessage.headers).forEach((header) => {\n this.privProperties.setProperty(header, this.privConnectionMessage.headers[header]);\n });\n }\n /**\n * The message path.\n */\n get path() {\n return this.privConnectionMessage.headers[Object.keys(this.privConnectionMessage.headers).find((key) => key.toLowerCase() === \"path\".toLowerCase())];\n }\n /**\n * Checks to see if the ConnectionMessage is a text message.\n * See also IsBinaryMessage().\n */\n get isTextMessage() {\n return this.privConnectionMessage.messageType === Exports_js_1.MessageType.Text;\n }\n /**\n * Checks to see if the ConnectionMessage is a binary message.\n * See also GetBinaryMessage().\n */\n get isBinaryMessage() {\n return this.privConnectionMessage.messageType === Exports_js_1.MessageType.Binary;\n }\n /**\n * Gets the text message payload. Typically the text message content-type is\n * application/json. To determine other content-types use\n * Properties.GetProperty(\"Content-Type\").\n */\n get TextMessage() {\n return this.privConnectionMessage.textBody;\n }\n /**\n * Gets the binary message payload.\n */\n get binaryMessage() {\n return this.privConnectionMessage.binaryBody;\n }\n /**\n * A collection of properties and their values defined for this <see cref=\"ConnectionMessage\"/>.\n * Message headers can be accessed via this collection (e.g. \"Content-Type\").\n */\n get properties() {\n return this.privProperties;\n }\n /**\n * Returns a string that represents the connection message.\n */\n toString() {\n return \"\";\n }\n}\nexports.ConnectionMessageImpl = ConnectionMessageImpl;\n\n"],"mappings":"AAAA,YAAY;;AACZ;AACA;AACA;AACA;AACAA,MAAM,CAACC,cAAc,CAACC,OAAO,EAAE,YAAY,EA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,MAAM,CAACsB,IAAI,CAAC,IAAI,CAACT,qBAAqB,CAACG,OAAO,CAAC,CAACU,IAAI,CAAEC,GAAG,IAAKA,GAAG,CAACC,WAAW,CAAC,CAAC,KAAK,MAAM,CAACA,WAAW,CAAC,CAAC,CAAC,CAAC;EACxJ;EACA;AACJ;AACA;AACA;EACI,IAAIC,aAAaA,CAAA,EAAG;IAChB,OAAO,IAAI,CAAChB,qBAAqB,CAACiB,WAAW,KAAKtB,YAAY,CAACuB,WAAW,CAACC,IAAI;EACnF;EACA;AACJ;AACA;AACA;EACI,IAAIC,eAAeA,CAAA,EAAG;IAClB,OAAO,IAAI,CAACpB,qBAAqB,CAACiB,WAAW,KAAKtB,YAAY,CAACuB,WAAW,CAACG,MAAM;EACrF;EACA;AACJ;AACA;AACA;AACA;EACI,IAAIC,WAAWA,CAAA,EAAG;IACd,OAAO,IAAI,CAACtB,qBAAqB,CAACuB,QAAQ;EAC9C;EACA;AACJ;AACA;EACI,IAAIC,aAAaA,CAAA,EAAG;IAChB,OAAO,IAAI,CAACxB,qBAAqB,CAACyB,UAAU;EAChD;EACA;AACJ;AACA;AACA;EACI,IAAIC,UAAUA,CAAA,EAAG;IACb,OAAO,IAAI,CAACzB,cAAc;EAC9B;EACA;AACJ;AACA;EACI0B,QAAQA,CAAA,EAAG;IACP,OAAO,EAAE;EACb;AACJ;AACAtC,OAAO,CAACE,qBAAqB,GAAGA,qBAAqB","ignoreList":[]},"metadata":{},"sourceType":"script","externalDependencies":[]}
|