microsoft-cognitiveservices-speech-sdk
Version:
Microsoft Cognitive Services Speech SDK for JavaScript
1 lines • 1.84 kB
Source Map (JSON)
{"version":3,"sources":["src/common.speech/DialogServiceTurnStateManager.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAErE,qBAAa,6BAA6B;IACtC,OAAO,CAAC,WAAW,CAAsC;;IAOlD,SAAS,CAAC,EAAE,EAAE,MAAM,GAAG,sBAAsB;IAS7C,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,sBAAsB;IAI3C,YAAY,CAAC,EAAE,EAAE,MAAM,GAAG,sBAAsB;CAS1D","file":"DialogServiceTurnStateManager.d.ts","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved.\r\n// Licensed under the MIT license.\r\n\r\nimport { InvalidOperationError } from \"../common/Error.js\";\r\nimport { DialogServiceTurnState } from \"./DialogServiceTurnState.js\";\r\n\r\nexport class DialogServiceTurnStateManager {\r\n private privTurnMap: Map<string, DialogServiceTurnState>;\r\n\r\n public constructor() {\r\n this.privTurnMap = new Map<string, DialogServiceTurnState>();\r\n return;\r\n }\r\n\r\n public StartTurn(id: string): DialogServiceTurnState {\r\n if (this.privTurnMap.has(id)) {\r\n throw new InvalidOperationError(\"Service error: There is already a turn with id:\" + id);\r\n }\r\n const turnState: DialogServiceTurnState = new DialogServiceTurnState(this, id);\r\n this.privTurnMap.set(id, turnState);\r\n return this.privTurnMap.get(id);\r\n }\r\n\r\n public GetTurn(id: string): DialogServiceTurnState {\r\n return this.privTurnMap.get(id);\r\n }\r\n\r\n public CompleteTurn(id: string): DialogServiceTurnState {\r\n if (!this.privTurnMap.has(id)) {\r\n throw new InvalidOperationError(\"Service error: Received turn end for an unknown turn id:\" + id);\r\n }\r\n const turnState = this.privTurnMap.get(id);\r\n turnState.complete();\r\n this.privTurnMap.delete(id);\r\n return turnState;\r\n }\r\n}\r\n"]}