UNPKG

@euirim/microsoft-cognitiveservices-speech-sdk

Version:
1 lines 1.94 kB
{"version":3,"sources":["src/common.speech/DialogServiceTurnStateManager.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAGlE,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.\n// Licensed under the MIT license.\n\nimport { InvalidOperationError } from \"../common/Error\";\nimport { AudioOutputStream, PullAudioOutputStreamImpl } from \"../sdk/Audio/AudioOutputStream\";\nimport { DialogServiceTurnState } from \"./DialogServiceTurnState\";\nimport { ActivityPayloadResponse } from \"./ServiceMessages/ActivityResponsePayload\";\n\nexport class DialogServiceTurnStateManager {\n private privTurnMap: Map<string, DialogServiceTurnState>;\n\n constructor() {\n this.privTurnMap = new Map<string, DialogServiceTurnState>();\n return;\n }\n\n public StartTurn(id: string): DialogServiceTurnState {\n if (this.privTurnMap.has(id)) {\n throw new InvalidOperationError(\"Service error: There is already a turn with id:\" + id);\n }\n const turnState: DialogServiceTurnState = new DialogServiceTurnState(this, id);\n this.privTurnMap.set(id, turnState);\n return this.privTurnMap.get(id);\n }\n\n public GetTurn(id: string): DialogServiceTurnState {\n return this.privTurnMap.get(id);\n }\n\n public CompleteTurn(id: string): DialogServiceTurnState {\n if (!this.privTurnMap.has(id)) {\n throw new InvalidOperationError(\"Service error: Received turn end for an unknown turn id:\" + id);\n }\n const turnState = this.privTurnMap.get(id);\n turnState.complete();\n this.privTurnMap.delete(id);\n return turnState;\n }\n}\n"]}