@azure/ai-language-text 1.1.0-alpha.20230210.1 → 1.1.0-alpha.20230228.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -41,7 +41,7 @@ const DEFAULT_COGNITIVE_SCOPE = "https://cognitiveservices.azure.com/.default";
41
41
  /**
42
42
  * @internal
43
43
  */
44
- const SDK_VERSION = "1.1.0-beta.1";
44
+ const SDK_VERSION = "1.1.0-beta.2";
45
45
  /**
46
46
  * @internal
47
47
  */
@@ -4161,13 +4161,24 @@ const jobStatusOperationSpec$1 = {
4161
4161
  queryParameters: [top, skip, includeStatistics],
4162
4162
  serializer: serializer$2,
4163
4163
  };
4164
+ function addOnResponse(options, cb) {
4165
+ return Object.assign(Object.assign({}, options), { onResponse: (rawResponse, response, error) => {
4166
+ var _a;
4167
+ cb(rawResponse, response, error);
4168
+ (_a = options.onResponse) === null || _a === void 0 ? void 0 : _a.call(options, rawResponse, response, error);
4169
+ } });
4170
+ }
4171
+ function logWarnHeader(rawResponse) {
4172
+ const warnHeader = rawResponse.headers.get("warn-text");
4173
+ if (warnHeader) {
4174
+ warnHeader.split(";").map((x) => logger.warning(x));
4175
+ }
4176
+ }
4164
4177
  async function getRawResponse(getResponse, options) {
4165
- const { onResponse } = options || {};
4166
4178
  let rawResponse;
4167
- const flatResponse = await getResponse(Object.assign(Object.assign({}, options), { onResponse: (response, flatResponseParam) => {
4168
- rawResponse = response;
4169
- onResponse === null || onResponse === void 0 ? void 0 : onResponse(response, flatResponseParam);
4170
- } }));
4179
+ const flatResponse = await getResponse(addOnResponse(options, (response) => {
4180
+ rawResponse = response;
4181
+ }));
4171
4182
  return {
4172
4183
  flatResponse,
4173
4184
  rawResponse: {
@@ -4190,14 +4201,12 @@ function createSendPollRequest(settings) {
4190
4201
  return async (path) => {
4191
4202
  return throwError(sendRequest({
4192
4203
  client,
4193
- opOptions: Object.assign(Object.assign({}, options), { onResponse: (rawResponse, response, error) => {
4194
- var _a;
4195
- const castResponse = response;
4196
- if (castResponse.status.toLowerCase() === "partiallysucceeded") {
4197
- castResponse.status = "failed";
4198
- }
4199
- (_a = options.onResponse) === null || _a === void 0 ? void 0 : _a.call(options, rawResponse, response, error);
4200
- } }),
4204
+ opOptions: addOnResponse(options, (_, response) => {
4205
+ const castResponse = response;
4206
+ if (castResponse.status.toLowerCase() === "partiallysucceeded") {
4207
+ castResponse.status = "failed";
4208
+ }
4209
+ }),
4201
4210
  path,
4202
4211
  spanStr,
4203
4212
  spec: jobStatusOperationSpec$1,
@@ -4212,7 +4221,7 @@ function createAnalyzeBatchLro(settings) {
4212
4221
  const { client, commonOptions, documents, initialRequestOptions, pollRequestOptions, tasks, tracing, } = settings;
4213
4222
  return {
4214
4223
  async sendInitialRequest() {
4215
- return tracing.withSpan(`${clientName}.beginAnalyzeBatch`, Object.assign(Object.assign({}, commonOptions), initialRequestOptions), async (finalOptions) => throwError(getRawResponse((paramOptions) => client.analyzeBatch({
4224
+ return tracing.withSpan(`${clientName}.beginAnalyzeBatch`, addOnResponse(Object.assign(Object.assign({}, commonOptions), initialRequestOptions), logWarnHeader), async (finalOptions) => throwError(getRawResponse((paramOptions) => client.analyzeBatch({
4216
4225
  tasks,
4217
4226
  analysisInput: {
4218
4227
  documents,
@@ -4421,7 +4430,7 @@ class GeneratedClient extends coreClient__namespace.ServiceClient {
4421
4430
  const defaults = {
4422
4431
  requestContentType: "application/json; charset=utf-8"
4423
4432
  };
4424
- const packageDetails = `azsdk-js-ai-language-text/1.1.0-beta.1`;
4433
+ const packageDetails = `azsdk-js-ai-language-text/1.1.0-beta.2`;
4425
4434
  const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix
4426
4435
  ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`
4427
4436
  : `${packageDetails}`;