From d3ab92ce1e4610266a40f1a5fe2d5ead9df45970 Mon Sep 17 00:00:00 2001 From: Joel Mut Date: Wed, 18 Dec 2024 16:56:52 -0300 Subject: [PATCH] fix --- .../serviceClientContext.ts | 50 ++++++++++--------- yarn.lock | 9 +++- 2 files changed, 34 insertions(+), 25 deletions(-) diff --git a/libraries/botbuilder-stdlib/src/azureCoreHttpCompat/serviceClientContext.ts b/libraries/botbuilder-stdlib/src/azureCoreHttpCompat/serviceClientContext.ts index ceb261a5be..0c3a93c000 100644 --- a/libraries/botbuilder-stdlib/src/azureCoreHttpCompat/serviceClientContext.ts +++ b/libraries/botbuilder-stdlib/src/azureCoreHttpCompat/serviceClientContext.ts @@ -131,29 +131,29 @@ export class ServiceClientContext extends ServiceClient { operationSpec: OperationSpec, callback?: ServiceCallback, ): Promise { - let resolve: any; - let reject: any; - const result = new Promise((res, rej) => { - resolve = res; - reject = rej; - }); + // let resolve: any; + // let reject: any; + // const result = new Promise((res, rej) => { + // resolve = res; + // reject = rej; + // }); const options = this.createOptions(operationArguments.options as LegacyOperationArguments['options'], callback) ?? {}; - const innerOnResponse = options.onResponse; - options.onResponse = (rawResponse, flatResponse, error) => { - innerOnResponse?.(rawResponse, flatResponse, error); - if (error) { - reject(error); - } else { - Object.defineProperty(flatResponse, '_response', { - value: rawResponse, - }); - resolve(flatResponse); - } - }; - - await super.sendOperationRequest({ ...operationArguments, options }, operationSpec); + // const innerOnResponse = options.onResponse; + // options.onResponse = (rawResponse, flatResponse, error) => { + // innerOnResponse?.(rawResponse, flatResponse, error); + // if (error) { + // reject(error); + // } else { + // Object.defineProperty(flatResponse, '_response', { + // value: rawResponse, + // }); + // resolve(flatResponse); + // } + // }; + + const result = await super.sendOperationRequest({ ...operationArguments, options }, operationSpec); return result; } @@ -192,15 +192,17 @@ export class ServiceClientContext extends ServiceClient { customHeaders: options?.customHeaders, timeout: options?.timeout, shouldDeserialize(response) { - return typeof options?.shouldDeserialize === 'function' - ? options?.shouldDeserialize?.(toCompatResponse(response)) - : options?.shouldDeserialize === true; + if (typeof options?.shouldDeserialize === 'function') { + return options?.shouldDeserialize?.(toCompatResponse(response)); + } else if (typeof options?.shouldDeserialize === 'boolean') { + return options?.shouldDeserialize; + } + return true; }, onDownloadProgress: options?.onDownloadProgress, onUploadProgress: options?.onUploadProgress, }, onResponse(rawResponse: any, flatResponse, error) { - const args = []; typeof options === 'function' ?? (options as ServiceCallback)?.( error as Error, diff --git a/yarn.lock b/yarn.lock index c1ef2f3650..4cbd53845e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -17,7 +17,7 @@ dependencies: tslib "^1.9.3" -"@azure/abort-controller@^2.0.0": +"@azure/abort-controller@^2.0.0", "@azure/abort-controller@^2.1.2": version "2.1.2" resolved "https://registry.yarnpkg.com/@azure/abort-controller/-/abort-controller-2.1.2.tgz#42fe0ccab23841d9905812c58f1082d27784566d" integrity sha512-nBrLsEWm4J2u5LpAPjxADTlq3trDgVZZXHNKabeXZtpq3d3AbN/KGO82R87rdDz5/lYB024rtEf10/q0urNgsA== @@ -129,6 +129,13 @@ dependencies: tslib "^2.6.2" +"@azure/core-tracing@^1.2.0": + version "1.2.0" + resolved "https://registry.yarnpkg.com/@azure/core-tracing/-/core-tracing-1.2.0.tgz#7be5d53c3522d639cf19042cbcdb19f71bc35ab2" + integrity sha512-UKTiEJPkWcESPYJz3X5uKRYyOcJD+4nYph+KpfdPRnQJVrZfk0KJgdnaAWKfhsBBtAf/D58Az4AvCJEmWgIBAg== + dependencies: + tslib "^2.6.2" + "@azure/core-util@^1.1.0", "@azure/core-util@^1.3.0", "@azure/core-util@^1.6.1", "@azure/core-util@^1.8.1", "@azure/core-util@^1.9.0": version "1.9.2" resolved "https://registry.yarnpkg.com/@azure/core-util/-/core-util-1.9.2.tgz#1dc37dc5b0dae34c578be62cf98905ba7c0cafe7"