@azure/ai-text-analytics 5.2.0-alpha.20211214.2 → 5.2.0-alpha.20220131.1

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.
Files changed (63) hide show
  1. package/dist/index.js +133 -103
  2. package/dist/index.js.map +1 -1
  3. package/dist-esm/src/analyzeActionsResult.js +15 -15
  4. package/dist-esm/src/analyzeActionsResult.js.map +1 -1
  5. package/dist-esm/src/analyzeHealthcareEntitiesResult.js +4 -4
  6. package/dist-esm/src/analyzeHealthcareEntitiesResult.js.map +1 -1
  7. package/dist-esm/src/analyzeLro.js +11 -11
  8. package/dist-esm/src/analyzeLro.js.map +1 -1
  9. package/dist-esm/src/analyzeSentimentResult.js +5 -5
  10. package/dist-esm/src/analyzeSentimentResult.js.map +1 -1
  11. package/dist-esm/src/analyzeSentimentResultArray.js +1 -1
  12. package/dist-esm/src/analyzeSentimentResultArray.js.map +1 -1
  13. package/dist-esm/src/azureKeyCredentialPolicy.js +1 -1
  14. package/dist-esm/src/azureKeyCredentialPolicy.js.map +1 -1
  15. package/dist-esm/src/detectLanguageResult.js +1 -1
  16. package/dist-esm/src/detectLanguageResult.js.map +1 -1
  17. package/dist-esm/src/detectLanguageResultArray.js +1 -1
  18. package/dist-esm/src/detectLanguageResultArray.js.map +1 -1
  19. package/dist-esm/src/extractKeyPhrasesResult.js +1 -1
  20. package/dist-esm/src/extractKeyPhrasesResult.js.map +1 -1
  21. package/dist-esm/src/extractKeyPhrasesResultArray.js +1 -1
  22. package/dist-esm/src/extractKeyPhrasesResultArray.js.map +1 -1
  23. package/dist-esm/src/extractSummaryResult.js +1 -1
  24. package/dist-esm/src/extractSummaryResult.js.map +1 -1
  25. package/dist-esm/src/extractSummaryResultArray.js +1 -1
  26. package/dist-esm/src/extractSummaryResultArray.js.map +1 -1
  27. package/dist-esm/src/healthLro.js +12 -12
  28. package/dist-esm/src/healthLro.js.map +1 -1
  29. package/dist-esm/src/index.js +2 -4
  30. package/dist-esm/src/index.js.map +1 -1
  31. package/dist-esm/src/multiCategoryClassifyResult.js +1 -1
  32. package/dist-esm/src/multiCategoryClassifyResult.js.map +1 -1
  33. package/dist-esm/src/multiCategoryClassifyResultArray.js +1 -1
  34. package/dist-esm/src/multiCategoryClassifyResultArray.js.map +1 -1
  35. package/dist-esm/src/recognizeCategorizedEntitiesResult.js +1 -1
  36. package/dist-esm/src/recognizeCategorizedEntitiesResult.js.map +1 -1
  37. package/dist-esm/src/recognizeCategorizedEntitiesResultArray.js +1 -1
  38. package/dist-esm/src/recognizeCategorizedEntitiesResultArray.js.map +1 -1
  39. package/dist-esm/src/recognizeCustomEntitiesResult.js +1 -1
  40. package/dist-esm/src/recognizeCustomEntitiesResult.js.map +1 -1
  41. package/dist-esm/src/recognizeCustomEntitiesResultArray.js +1 -1
  42. package/dist-esm/src/recognizeCustomEntitiesResultArray.js.map +1 -1
  43. package/dist-esm/src/recognizeLinkedEntitiesResult.js +1 -1
  44. package/dist-esm/src/recognizeLinkedEntitiesResult.js.map +1 -1
  45. package/dist-esm/src/recognizeLinkedEntitiesResultArray.js +1 -1
  46. package/dist-esm/src/recognizeLinkedEntitiesResultArray.js.map +1 -1
  47. package/dist-esm/src/recognizePiiEntitiesResult.js +1 -1
  48. package/dist-esm/src/recognizePiiEntitiesResult.js.map +1 -1
  49. package/dist-esm/src/recognizePiiEntitiesResultArray.js +1 -1
  50. package/dist-esm/src/recognizePiiEntitiesResultArray.js.map +1 -1
  51. package/dist-esm/src/singleCategoryClassifyResult.js +1 -1
  52. package/dist-esm/src/singleCategoryClassifyResult.js.map +1 -1
  53. package/dist-esm/src/singleCategoryClassifyResultArray.js +1 -1
  54. package/dist-esm/src/singleCategoryClassifyResultArray.js.map +1 -1
  55. package/dist-esm/src/textAnalyticsClient.js +41 -41
  56. package/dist-esm/src/textAnalyticsClient.js.map +1 -1
  57. package/dist-esm/src/textAnalyticsResult.js +5 -5
  58. package/dist-esm/src/textAnalyticsResult.js.map +1 -1
  59. package/dist-esm/src/tracing.js +1 -1
  60. package/dist-esm/src/tracing.js.map +1 -1
  61. package/dist-esm/src/util.js +9 -6
  62. package/dist-esm/src/util.js.map +1 -1
  63. package/package.json +8 -10
package/dist/index.js CHANGED
@@ -2,7 +2,6 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- require('@azure/core-asynciterator-polyfill');
6
5
  var coreAuth = require('@azure/core-auth');
7
6
  var tslib = require('tslib');
8
7
  var coreRestPipeline = require('@azure/core-rest-pipeline');
@@ -12,6 +11,26 @@ var coreTracing = require('@azure/core-tracing');
12
11
  var corePaging = require('@azure/core-paging');
13
12
  var coreLro = require('@azure/core-lro');
14
13
 
14
+ function _interopNamespace(e) {
15
+ if (e && e.__esModule) return e;
16
+ var n = Object.create(null);
17
+ if (e) {
18
+ Object.keys(e).forEach(function (k) {
19
+ if (k !== 'default') {
20
+ var d = Object.getOwnPropertyDescriptor(e, k);
21
+ Object.defineProperty(n, k, d.get ? d : {
22
+ enumerable: true,
23
+ get: function () { return e[k]; }
24
+ });
25
+ }
26
+ });
27
+ }
28
+ n["default"] = e;
29
+ return Object.freeze(n);
30
+ }
31
+
32
+ var coreClient__namespace = /*#__PURE__*/_interopNamespace(coreClient);
33
+
15
34
  /*
16
35
  * Copyright (c) Microsoft Corporation.
17
36
  * Licensed under the MIT License.
@@ -3600,7 +3619,7 @@ const opinionMining = {
3600
3619
  * Changes may cause incorrect behavior and will be lost if the code is regenerated.
3601
3620
  */
3602
3621
  /** @internal */
3603
- class GeneratedClientContext extends coreClient.ServiceClient {
3622
+ class GeneratedClientContext extends coreClient__namespace.ServiceClient {
3604
3623
  /**
3605
3624
  * Initializes a new instance of the GeneratedClientContext class.
3606
3625
  * @param endpoint Supported Cognitive Services endpoints (protocol and hostname, for example:
@@ -3666,7 +3685,7 @@ class GeneratedClient extends GeneratedClientContext {
3666
3685
  * @param options The options parameters.
3667
3686
  */
3668
3687
  analyzeStatus(jobId, options) {
3669
- return this.sendOperationRequest({ jobId, options }, analyzeStatusOperationSpec);
3688
+ return this.sendOperationRequest({ jobId, options }, analyzeStatusOperationSpec$1);
3670
3689
  }
3671
3690
  /**
3672
3691
  * Get details of the healthcare prediction job specified by the jobId.
@@ -3674,7 +3693,7 @@ class GeneratedClient extends GeneratedClientContext {
3674
3693
  * @param options The options parameters.
3675
3694
  */
3676
3695
  healthStatus(jobId, options) {
3677
- return this.sendOperationRequest({ jobId, options }, healthStatusOperationSpec);
3696
+ return this.sendOperationRequest({ jobId, options }, healthStatusOperationSpec$1);
3678
3697
  }
3679
3698
  /**
3680
3699
  * Cancel healthcare prediction job.
@@ -3759,7 +3778,7 @@ class GeneratedClient extends GeneratedClientContext {
3759
3778
  }
3760
3779
  }
3761
3780
  // Operation Specifications
3762
- const serializer = coreClient.createSerializer(Mappers, /* isXml */ false);
3781
+ const serializer$2 = coreClient__namespace.createSerializer(Mappers, /* isXml */ false);
3763
3782
  const analyzeOperationSpec = {
3764
3783
  path: "/analyze",
3765
3784
  httpMethod: "POST",
@@ -3775,9 +3794,9 @@ const analyzeOperationSpec = {
3775
3794
  urlParameters: [endpoint, apiVersion],
3776
3795
  headerParameters: [contentType, accept],
3777
3796
  mediaType: "json",
3778
- serializer
3797
+ serializer: serializer$2
3779
3798
  };
3780
- const analyzeStatusOperationSpec = {
3799
+ const analyzeStatusOperationSpec$1 = {
3781
3800
  path: "/analyze/jobs/{jobId}",
3782
3801
  httpMethod: "GET",
3783
3802
  responses: {
@@ -3795,9 +3814,9 @@ const analyzeStatusOperationSpec = {
3795
3814
  ],
3796
3815
  urlParameters: [endpoint, apiVersion, jobId],
3797
3816
  headerParameters: [accept],
3798
- serializer
3817
+ serializer: serializer$2
3799
3818
  };
3800
- const healthStatusOperationSpec = {
3819
+ const healthStatusOperationSpec$1 = {
3801
3820
  path: "/entities/health/jobs/{jobId}",
3802
3821
  httpMethod: "GET",
3803
3822
  responses: {
@@ -3819,7 +3838,7 @@ const healthStatusOperationSpec = {
3819
3838
  jobId1
3820
3839
  ],
3821
3840
  headerParameters: [accept],
3822
- serializer
3841
+ serializer: serializer$2
3823
3842
  };
3824
3843
  const cancelHealthJobOperationSpec = {
3825
3844
  path: "/entities/health/jobs/{jobId}",
@@ -3838,7 +3857,7 @@ const cancelHealthJobOperationSpec = {
3838
3857
  jobId1
3839
3858
  ],
3840
3859
  headerParameters: [accept],
3841
- serializer
3860
+ serializer: serializer$2
3842
3861
  };
3843
3862
  const healthOperationSpec = {
3844
3863
  path: "/entities/health/jobs",
@@ -3860,7 +3879,7 @@ const healthOperationSpec = {
3860
3879
  urlParameters: [endpoint, apiVersion],
3861
3880
  headerParameters: [contentType, accept],
3862
3881
  mediaType: "json",
3863
- serializer
3882
+ serializer: serializer$2
3864
3883
  };
3865
3884
  const entitiesRecognitionGeneralOperationSpec = {
3866
3885
  path: "/entities/recognition/general",
@@ -3883,7 +3902,7 @@ const entitiesRecognitionGeneralOperationSpec = {
3883
3902
  urlParameters: [endpoint, apiVersion],
3884
3903
  headerParameters: [contentType, accept],
3885
3904
  mediaType: "json",
3886
- serializer
3905
+ serializer: serializer$2
3887
3906
  };
3888
3907
  const entitiesRecognitionPiiOperationSpec = {
3889
3908
  path: "/entities/recognition/pii",
@@ -3908,7 +3927,7 @@ const entitiesRecognitionPiiOperationSpec = {
3908
3927
  urlParameters: [endpoint, apiVersion],
3909
3928
  headerParameters: [contentType, accept],
3910
3929
  mediaType: "json",
3911
- serializer
3930
+ serializer: serializer$2
3912
3931
  };
3913
3932
  const entitiesLinkingOperationSpec = {
3914
3933
  path: "/entities/linking",
@@ -3931,7 +3950,7 @@ const entitiesLinkingOperationSpec = {
3931
3950
  urlParameters: [endpoint, apiVersion],
3932
3951
  headerParameters: [contentType, accept],
3933
3952
  mediaType: "json",
3934
- serializer
3953
+ serializer: serializer$2
3935
3954
  };
3936
3955
  const keyPhrasesOperationSpec = {
3937
3956
  path: "/keyPhrases",
@@ -3953,7 +3972,7 @@ const keyPhrasesOperationSpec = {
3953
3972
  urlParameters: [endpoint, apiVersion],
3954
3973
  headerParameters: [contentType, accept],
3955
3974
  mediaType: "json",
3956
- serializer
3975
+ serializer: serializer$2
3957
3976
  };
3958
3977
  const languagesOperationSpec = {
3959
3978
  path: "/languages",
@@ -3975,7 +3994,7 @@ const languagesOperationSpec = {
3975
3994
  urlParameters: [endpoint, apiVersion],
3976
3995
  headerParameters: [contentType, accept],
3977
3996
  mediaType: "json",
3978
- serializer
3997
+ serializer: serializer$2
3979
3998
  };
3980
3999
  const sentimentOperationSpec = {
3981
4000
  path: "/sentiment",
@@ -3999,7 +4018,7 @@ const sentimentOperationSpec = {
3999
4018
  urlParameters: [endpoint, apiVersion],
4000
4019
  headerParameters: [contentType, accept],
4001
4020
  mediaType: "json",
4002
- serializer
4021
+ serializer: serializer$2
4003
4022
  };
4004
4023
 
4005
4024
  // Copyright (c) Microsoft Corporation.
@@ -4016,7 +4035,7 @@ const logger = logger$1.createClientLogger("ai-text-analytics");
4016
4035
  */
4017
4036
  const createSpan = coreTracing.createSpanFunction({
4018
4037
  packagePrefix: "Azure.CognitiveServices.TextAnalytics",
4019
- namespace: "Microsoft.CognitiveServices"
4038
+ namespace: "Microsoft.CognitiveServices",
4020
4039
  });
4021
4040
 
4022
4041
  // Copyright (c) Microsoft Corporation.
@@ -4056,7 +4075,7 @@ function parseAssessmentIndex(pointer) {
4056
4075
  const assessmentIndex = {
4057
4076
  document: parseInt(res[1]),
4058
4077
  sentence: parseInt(res[2]),
4059
- assessment: parseInt(res[3])
4078
+ assessment: parseInt(res[3]),
4060
4079
  };
4061
4080
  return assessmentIndex;
4062
4081
  }
@@ -4140,6 +4159,9 @@ function appendReadableErrorMessage(currentMessage, innerMessage) {
4140
4159
  function compileError(errorResponse) {
4141
4160
  var _a;
4142
4161
  const castErrorResponse = errorResponse;
4162
+ if (!castErrorResponse.response) {
4163
+ throw errorResponse;
4164
+ }
4143
4165
  const topLevelError = (_a = castErrorResponse.response.parsedBody) === null || _a === void 0 ? void 0 : _a.error;
4144
4166
  if (!topLevelError)
4145
4167
  return errorResponse;
@@ -4158,7 +4180,7 @@ function compileError(errorResponse) {
4158
4180
  unwrap(topLevelError);
4159
4181
  return new coreRestPipeline.RestError(errorMessage, {
4160
4182
  code: invalidDocumentBatchCode ? "InvalidDocumentBatch" : topLevelError.code,
4161
- statusCode: castErrorResponse.statusCode
4183
+ statusCode: castErrorResponse.statusCode,
4162
4184
  });
4163
4185
  }
4164
4186
  /**
@@ -4182,8 +4204,8 @@ async function getRawResponse(f, options) {
4182
4204
  rawResponse: {
4183
4205
  statusCode: rawResponse.status,
4184
4206
  headers: rawResponse.headers.toJSON(),
4185
- body: rawResponse.parsedBody
4186
- }
4207
+ body: rawResponse.parsedBody,
4208
+ },
4187
4209
  };
4188
4210
  }
4189
4211
  /**
@@ -4197,13 +4219,13 @@ client, spec, spanStr, options, path) {
4197
4219
  const { flatResponse, rawResponse } = await getRawResponse((paramOptions) => client.sendOperationRequest({ options: paramOptions }, Object.assign(Object.assign({}, spec), { path, httpMethod: "GET" })), finalOptions);
4198
4220
  return {
4199
4221
  flatResponse: flatResponse,
4200
- rawResponse
4222
+ rawResponse,
4201
4223
  };
4202
4224
  }
4203
4225
  catch (e) {
4204
4226
  span.setStatus({
4205
4227
  code: coreTracing.SpanStatusCode.ERROR,
4206
- message: e.message
4228
+ message: e.message,
4207
4229
  });
4208
4230
  throw e;
4209
4231
  }
@@ -4227,7 +4249,7 @@ function intoTextAnalyticsError(errorModel) {
4227
4249
  return {
4228
4250
  code: errorModel.code,
4229
4251
  message: errorModel.message,
4230
- target: errorModel.target
4252
+ target: errorModel.target,
4231
4253
  };
4232
4254
  }
4233
4255
  /**
@@ -4237,7 +4259,7 @@ function makeTextAnalyticsSuccessResult(id, warnings, statistics) {
4237
4259
  return {
4238
4260
  id,
4239
4261
  statistics,
4240
- warnings
4262
+ warnings,
4241
4263
  };
4242
4264
  }
4243
4265
  /**
@@ -4246,7 +4268,7 @@ function makeTextAnalyticsSuccessResult(id, warnings, statistics) {
4246
4268
  function makeTextAnalyticsErrorResult(id, error) {
4247
4269
  return {
4248
4270
  id,
4249
- error: intoTextAnalyticsError(error)
4271
+ error: intoTextAnalyticsError(error),
4250
4272
  };
4251
4273
  }
4252
4274
  /**
@@ -4274,7 +4296,7 @@ function combineSuccessfulAndErroneousDocumentsWithStatisticsAndModelVersion(inp
4274
4296
  const sorted = processAndCombineSuccessfulAndErroneousDocuments(input, response, processSuccess, processError);
4275
4297
  return Object.assign(sorted, {
4276
4298
  statistics: response.statistics,
4277
- modelVersion: response.modelVersion
4299
+ modelVersion: response.modelVersion,
4278
4300
  });
4279
4301
  }
4280
4302
  /**
@@ -4290,7 +4312,7 @@ function combineSuccessfulAndErroneousDocumentsWithStatisticsAndCustomProjectInf
4290
4312
  return Object.assign(sorted, {
4291
4313
  statistics: response.statistics,
4292
4314
  projectName: response.projectName,
4293
- deploymentName: response.deploymentName
4315
+ deploymentName: response.deploymentName,
4294
4316
  });
4295
4317
  }
4296
4318
 
@@ -4346,7 +4368,7 @@ function makeRecognizeCategorizedEntitiesResultArray(input, response) {
4346
4368
  * @internal
4347
4369
  */
4348
4370
  function makeAnalyzeSentimentResult(result) {
4349
- const { id, sentiment, confidenceScores, sentenceSentiments: sentences, warnings, statistics } = result;
4371
+ const { id, sentiment, confidenceScores, sentenceSentiments: sentences, warnings, statistics, } = result;
4350
4372
  return Object.assign(Object.assign({}, makeTextAnalyticsSuccessResult(id, warnings, statistics)), { sentiment,
4351
4373
  confidenceScores, sentences: sentences.map((sentence) => convertGeneratedSentenceSentiment(sentence, result)) });
4352
4374
  }
@@ -4379,13 +4401,13 @@ function convertGeneratedSentenceSentiment(sentence, result) {
4379
4401
  sentiment: target.sentiment,
4380
4402
  text: target.text,
4381
4403
  offset: target.offset,
4382
- length: target.length
4404
+ length: target.length,
4383
4405
  },
4384
4406
  assessments: target.relations
4385
4407
  .filter((relation) => relation.relationType === "assessment")
4386
- .map((relation) => convertTargetRelationToAssessmentSentiment(relation, result))
4408
+ .map((relation) => convertTargetRelationToAssessmentSentiment(relation, result)),
4387
4409
  }))
4388
- : []
4410
+ : [],
4389
4411
  };
4390
4412
  }
4391
4413
  /**
@@ -4507,7 +4529,7 @@ function textAnalyticsAzureKeyCredentialPolicy(credential) {
4507
4529
  sendRequest(request, next) {
4508
4530
  request.headers.set(API_KEY_HEADER_NAME, credential.key);
4509
4531
  return next(request);
4510
- }
4532
+ },
4511
4533
  };
4512
4534
  }
4513
4535
 
@@ -4529,7 +4551,7 @@ function makeHealthcareEntitiesWithoutNeighbors(entity) {
4529
4551
  text,
4530
4552
  normalizedText: name,
4531
4553
  subCategory: subcategory,
4532
- dataSources: (_a = links === null || links === void 0 ? void 0 : links.map(({ dataSource, id }) => ({ name: dataSource, entityId: id }))) !== null && _a !== void 0 ? _a : []
4554
+ dataSources: (_a = links === null || links === void 0 ? void 0 : links.map(({ dataSource, id }) => ({ name: dataSource, entityId: id }))) !== null && _a !== void 0 ? _a : [],
4533
4555
  };
4534
4556
  }
4535
4557
  /**
@@ -4540,8 +4562,8 @@ function makeHealthcareRelations(entities, relations) {
4540
4562
  relationType: relation.relationType,
4541
4563
  roles: relation.entities.map((role) => ({
4542
4564
  entity: entities[parseHealthcareEntityIndex(role.ref)],
4543
- name: role.role
4544
- }))
4565
+ name: role.role,
4566
+ })),
4545
4567
  }));
4546
4568
  }
4547
4569
  /**
@@ -4564,21 +4586,21 @@ function makeHealthcareEntitiesErrorResult(id, error) {
4564
4586
  // Copyright (c) Microsoft Corporation.
4565
4587
  const serializer$1 = coreClient.createSerializer(Mappers, /* isXml */ false);
4566
4588
  // Consider whether the spec can be exported by code gen
4567
- const healthStatusOperationSpec$1 = {
4589
+ const healthStatusOperationSpec = {
4568
4590
  path: "/entities/health/jobs/{jobId}",
4569
4591
  httpMethod: "GET",
4570
4592
  responses: {
4571
4593
  200: {
4572
- bodyMapper: HealthcareJobState
4594
+ bodyMapper: HealthcareJobState,
4573
4595
  },
4574
4596
  default: {
4575
- bodyMapper: ErrorResponse
4576
- }
4597
+ bodyMapper: ErrorResponse,
4598
+ },
4577
4599
  },
4578
4600
  queryParameters: [includeStatistics, top, skip],
4579
4601
  urlParameters: [endpoint, apiVersion],
4580
4602
  headerParameters: [accept],
4581
- serializer: serializer$1
4603
+ serializer: serializer$1,
4582
4604
  };
4583
4605
  /**
4584
4606
  * @internal
@@ -4601,14 +4623,14 @@ class HealthLro {
4601
4623
  const { flatResponse, rawResponse } = await getRawResponse((paramOptions) => this.client.health({ documents: this.documents }, paramOptions), finalOptions);
4602
4624
  return {
4603
4625
  flatResponse: flatResponse,
4604
- rawResponse
4626
+ rawResponse,
4605
4627
  };
4606
4628
  }
4607
4629
  catch (e) {
4608
4630
  const exception = compileError(e);
4609
4631
  span.setStatus({
4610
4632
  code: coreTracing.SpanStatusCode.ERROR,
4611
- message: exception.message
4633
+ message: exception.message,
4612
4634
  });
4613
4635
  throw exception;
4614
4636
  }
@@ -4617,7 +4639,7 @@ class HealthLro {
4617
4639
  }
4618
4640
  }
4619
4641
  async sendPollRequest(path) {
4620
- return sendGetRequest(this.client, healthStatusOperationSpec$1, "HealthStatus", Object.assign(Object.assign({}, this.baseOptions), this.pollOptions), path);
4642
+ return sendGetRequest(this.client, healthStatusOperationSpec, "HealthStatus", Object.assign(Object.assign({}, this.baseOptions), this.pollOptions), path);
4621
4643
  }
4622
4644
  }
4623
4645
  /**
@@ -4656,7 +4678,7 @@ client, documents, options) {
4656
4678
  const pagedResult = {
4657
4679
  firstPageLink: pollingURL,
4658
4680
  getPage: async (pageLink, maxPageSize) => {
4659
- const response = await sendGetRequest(client, healthStatusOperationSpec$1, "HealthStatus",
4681
+ const response = await sendGetRequest(client, healthStatusOperationSpec, "HealthStatus",
4660
4682
  // if `top` is set to `undefined`, the default value will not be sent
4661
4683
  // as part of the request.
4662
4684
  maxPageSize ? Object.assign(Object.assign({}, options), { top: maxPageSize }) : options, pageLink);
@@ -4664,18 +4686,18 @@ client, documents, options) {
4664
4686
  if (flatResponse.results) {
4665
4687
  return {
4666
4688
  page: processAndCombineSuccessfulAndErroneousDocuments(documents, flatResponse.results, makeHealthcareEntitiesResult, makeHealthcareEntitiesErrorResult),
4667
- nextPageLink: flatResponse.nextLink
4689
+ nextPageLink: flatResponse.nextLink,
4668
4690
  };
4669
4691
  }
4670
4692
  else {
4671
4693
  throw new Error("Healthcare action has succeeded but there are no results!");
4672
4694
  }
4673
- }
4695
+ },
4674
4696
  };
4675
4697
  const pagedIterator = corePaging.getPagedAsyncIterator(pagedResult);
4676
4698
  return Object.assign(pagedIterator, {
4677
4699
  statistics: result.results.statistics,
4678
- modelVersion: result.results.modelVersion
4700
+ modelVersion: result.results.modelVersion,
4679
4701
  });
4680
4702
  };
4681
4703
  }
@@ -4838,7 +4860,7 @@ function parseActionError(erredActions) {
4838
4860
  code: erredActions.code,
4839
4861
  message: erredActions.message,
4840
4862
  index: parseInt(result[2]),
4841
- type: convertTaskTypeToActionType(result[1])
4863
+ type: convertTaskTypeToActionType(result[1]),
4842
4864
  };
4843
4865
  }
4844
4866
  else {
@@ -4909,7 +4931,7 @@ function createErredAction(error, lastUpdateDateTime, taskName) {
4909
4931
  return {
4910
4932
  error: intoTextAnalyticsError(error),
4911
4933
  failedOn: lastUpdateDateTime,
4912
- actionName: taskName
4934
+ actionName: taskName,
4913
4935
  };
4914
4936
  }
4915
4937
  /**
@@ -4931,14 +4953,14 @@ function makeActionResult(documents, makeResultsArray, succeededTasks, erredActi
4931
4953
  {
4932
4954
  results: recognizeEntitiesResults,
4933
4955
  completedOn: lastUpdateDateTime,
4934
- actionName: taskName
4935
- }
4956
+ actionName: taskName,
4957
+ },
4936
4958
  ];
4937
4959
  }
4938
4960
  else {
4939
4961
  return [
4940
4962
  ...actions,
4941
- createErredAction(erredActions[errorIndex++], lastUpdateDateTime, taskName)
4963
+ createErredAction(erredActions[errorIndex++], lastUpdateDateTime, taskName),
4942
4964
  ];
4943
4965
  }
4944
4966
  }
@@ -4972,27 +4994,27 @@ function createAnalyzeActionsResult(response, documents) {
4972
4994
  extractSummaryResults: makeActionResult(documents, makeExtractSummaryResultArray, (_g = response.tasks.extractiveSummarizationTasks) !== null && _g !== void 0 ? _g : [], extractSummarySentencesActionErrors),
4973
4995
  recognizeCustomEntitiesResults: makeActionResult(documents, makeRecognizeCustomEntitiesResultArray, (_h = response.tasks.customEntityRecognitionTasks) !== null && _h !== void 0 ? _h : [], recognizeCustomEntitiesActionErrors),
4974
4996
  singleCategoryClassifyResults: makeActionResult(documents, makeSingleCategoryClassifyResultArray, (_j = response.tasks.customSingleClassificationTasks) !== null && _j !== void 0 ? _j : [], singleCategoryClassifyActionErrors),
4975
- multiCategoryClassifyResults: makeActionResult(documents, makeMultiCategoryClassifyResultArray, (_k = response.tasks.customMultiClassificationTasks) !== null && _k !== void 0 ? _k : [], multiCategoryClassifyActionErrors)
4997
+ multiCategoryClassifyResults: makeActionResult(documents, makeMultiCategoryClassifyResultArray, (_k = response.tasks.customMultiClassificationTasks) !== null && _k !== void 0 ? _k : [], multiCategoryClassifyActionErrors),
4976
4998
  };
4977
4999
  }
4978
5000
 
4979
5001
  // Copyright (c) Microsoft Corporation.
4980
- const serializer$2 = coreClient.createSerializer(Mappers, /* isXml */ false);
5002
+ const serializer = coreClient.createSerializer(Mappers, /* isXml */ false);
4981
5003
  // Consider whether the spec can be exported by code gen
4982
- const analyzeStatusOperationSpec$1 = {
5004
+ const analyzeStatusOperationSpec = {
4983
5005
  httpMethod: "GET",
4984
5006
  responses: {
4985
5007
  200: {
4986
- bodyMapper: AnalyzeJobState
5008
+ bodyMapper: AnalyzeJobState,
4987
5009
  },
4988
5010
  default: {
4989
- bodyMapper: ErrorResponse
4990
- }
5011
+ bodyMapper: ErrorResponse,
5012
+ },
4991
5013
  },
4992
5014
  queryParameters: [includeStatistics, top, skip],
4993
5015
  urlParameters: [endpoint, apiVersion],
4994
5016
  headerParameters: [accept],
4995
- serializer: serializer$2
5017
+ serializer,
4996
5018
  };
4997
5019
  /**
4998
5020
  * @internal
@@ -5016,18 +5038,18 @@ class AnalyzeLro {
5016
5038
  const { flatResponse, rawResponse } = await getRawResponse((paramOptions) => this.client.analyze(Object.assign({ body: {
5017
5039
  analysisInput: { documents: this.documents },
5018
5040
  tasks: this.tasks,
5019
- displayName: this.initOptions.displayName
5041
+ displayName: this.initOptions.displayName,
5020
5042
  } }, paramOptions)), finalOptions);
5021
5043
  return {
5022
5044
  flatResponse: flatResponse,
5023
- rawResponse
5045
+ rawResponse,
5024
5046
  };
5025
5047
  }
5026
5048
  catch (e) {
5027
5049
  const exception = compileError(e);
5028
5050
  span.setStatus({
5029
5051
  code: coreTracing.SpanStatusCode.ERROR,
5030
- message: exception.message
5052
+ message: exception.message,
5031
5053
  });
5032
5054
  throw exception;
5033
5055
  }
@@ -5036,7 +5058,7 @@ class AnalyzeLro {
5036
5058
  }
5037
5059
  }
5038
5060
  async sendPollRequest(path) {
5039
- return sendGetRequest(this.client, analyzeStatusOperationSpec$1, "AnalyzeStatus", Object.assign(Object.assign({}, this.baseOptions), this.pollOptions), path);
5061
+ return sendGetRequest(this.client, analyzeStatusOperationSpec, "AnalyzeStatus", Object.assign(Object.assign({}, this.baseOptions), this.pollOptions), path);
5040
5062
  }
5041
5063
  }
5042
5064
  /**
@@ -5064,16 +5086,16 @@ client, documents, options) {
5064
5086
  const pagedResult = {
5065
5087
  firstPageLink: pollingURL,
5066
5088
  getPage: async (pageLink, maxPageSize) => {
5067
- const response = await sendGetRequest(client, analyzeStatusOperationSpec$1, "AnalyzeStatus",
5089
+ const response = await sendGetRequest(client, analyzeStatusOperationSpec, "AnalyzeStatus",
5068
5090
  // if `top` is set to `undefined`, the default value will not be sent
5069
5091
  // as part of the request.
5070
5092
  maxPageSize ? Object.assign(Object.assign({}, options), { top: maxPageSize }) : options, pageLink);
5071
5093
  const flatResponse = response.flatResponse;
5072
5094
  return {
5073
5095
  page: createAnalyzeActionsResult(flatResponse, documents),
5074
- nextPageLink: flatResponse.nextLink
5096
+ nextPageLink: flatResponse.nextLink,
5075
5097
  };
5076
- }
5098
+ },
5077
5099
  };
5078
5100
  const pagedIterator = corePaging.getPagedAsyncIterator(pagedResult);
5079
5101
  // Attach stats if the service starts to return them
@@ -5101,6 +5123,10 @@ function updateAnalyzeState(state, lastResponse) {
5101
5123
 
5102
5124
  // Copyright (c) Microsoft Corporation.
5103
5125
  const DEFAULT_COGNITIVE_SCOPE = "https://cognitiveservices.azure.com/.default";
5126
+ /**
5127
+ * The types of PII domains the user can choose from.
5128
+ */
5129
+ exports.PiiEntityDomain = void 0;
5104
5130
  (function (PiiEntityDomain) {
5105
5131
  /**
5106
5132
  * @see {@link https://aka.ms/tanerpii} for more information.
@@ -5135,8 +5161,8 @@ class TextAnalyticsClient {
5135
5161
  const internalPipelineOptions = Object.assign(Object.assign({}, pipelineOptions), {
5136
5162
  loggingOptions: {
5137
5163
  logger: logger.info,
5138
- additionalAllowedHeaderNames: ["x-ms-correlation-request-id", "x-ms-request-id"]
5139
- }
5164
+ additionalAllowedHeaderNames: ["x-ms-correlation-request-id", "x-ms-request-id"],
5165
+ },
5140
5166
  });
5141
5167
  this.client = new GeneratedClient(this.endpointUrl, internalPipelineOptions);
5142
5168
  const authPolicy = coreAuth.isTokenCredential(credential)
@@ -5163,14 +5189,14 @@ class TextAnalyticsClient {
5163
5189
  const { span, updatedOptions: finalOptions } = createSpan("TextAnalyticsClient-detectLanguages", makeGeneratedDetectLanguageOptions(realOptions));
5164
5190
  try {
5165
5191
  const result = await this.client.languages({
5166
- documents: realInputs
5192
+ documents: realInputs,
5167
5193
  }, finalOptions);
5168
5194
  return makeDetectLanguageResultArray(realInputs, result);
5169
5195
  }
5170
5196
  catch (e) {
5171
5197
  span.setStatus({
5172
5198
  code: coreTracing.SpanStatusCode.ERROR,
5173
- message: e.message
5199
+ message: e.message,
5174
5200
  });
5175
5201
  throw e;
5176
5202
  }
@@ -5198,7 +5224,7 @@ class TextAnalyticsClient {
5198
5224
  const { span, updatedOptions: finalOptions } = createSpan("TextAnalyticsClient-recognizeEntities", makeGeneratedRecognizeCategorizedEntitiesOptions(realOptions));
5199
5225
  try {
5200
5226
  const result = await this.client.entitiesRecognitionGeneral({
5201
- documents: realInputs
5227
+ documents: realInputs,
5202
5228
  }, finalOptions);
5203
5229
  return makeRecognizeCategorizedEntitiesResultArray(realInputs, result);
5204
5230
  }
@@ -5214,7 +5240,7 @@ class TextAnalyticsClient {
5214
5240
  const backwardCompatibleException = compileError(e);
5215
5241
  span.setStatus({
5216
5242
  code: coreTracing.SpanStatusCode.ERROR,
5217
- message: backwardCompatibleException.message
5243
+ message: backwardCompatibleException.message,
5218
5244
  });
5219
5245
  throw backwardCompatibleException;
5220
5246
  }
@@ -5240,14 +5266,14 @@ class TextAnalyticsClient {
5240
5266
  const { span, updatedOptions: finalOptions } = createSpan("TextAnalyticsClient-analyzeSentiment", makeGeneratedAnalyzeSentimentOptions(realOptions));
5241
5267
  try {
5242
5268
  const result = await this.client.sentiment({
5243
- documents: realInputs
5269
+ documents: realInputs,
5244
5270
  }, finalOptions);
5245
5271
  return makeAnalyzeSentimentResultArray(realInputs, result);
5246
5272
  }
5247
5273
  catch (e) {
5248
5274
  span.setStatus({
5249
5275
  code: coreTracing.SpanStatusCode.ERROR,
5250
- message: e.message
5276
+ message: e.message,
5251
5277
  });
5252
5278
  throw e;
5253
5279
  }
@@ -5273,14 +5299,14 @@ class TextAnalyticsClient {
5273
5299
  const { span, updatedOptions: finalOptions } = createSpan("TextAnalyticsClient-extractKeyPhrases", makeGeneratedExtractKeyPhrasesOptions(realOptions));
5274
5300
  try {
5275
5301
  const result = await this.client.keyPhrases({
5276
- documents: realInputs
5302
+ documents: realInputs,
5277
5303
  }, finalOptions);
5278
5304
  return makeExtractKeyPhrasesResultArray(realInputs, result);
5279
5305
  }
5280
5306
  catch (e) {
5281
5307
  span.setStatus({
5282
5308
  code: coreTracing.SpanStatusCode.ERROR,
5283
- message: e.message
5309
+ message: e.message,
5284
5310
  });
5285
5311
  throw e;
5286
5312
  }
@@ -5303,14 +5329,14 @@ class TextAnalyticsClient {
5303
5329
  const { span, updatedOptions: finalOptions } = createSpan("TextAnalyticsClient-recognizePiiEntities", makeGeneratedRecognizePiiEntitiesOptions(realOptions));
5304
5330
  try {
5305
5331
  const result = await this.client.entitiesRecognitionPii({
5306
- documents: realInputs
5332
+ documents: realInputs,
5307
5333
  }, finalOptions);
5308
5334
  return makeRecognizePiiEntitiesResultArray(realInputs, result);
5309
5335
  }
5310
5336
  catch (e) {
5311
5337
  span.setStatus({
5312
5338
  code: coreTracing.SpanStatusCode.ERROR,
5313
- message: e.message
5339
+ message: e.message,
5314
5340
  });
5315
5341
  throw e;
5316
5342
  }
@@ -5336,14 +5362,14 @@ class TextAnalyticsClient {
5336
5362
  const { span, updatedOptions: finalOptions } = createSpan("TextAnalyticsClient-recognizeLinkedEntities", makeGeneratedRecognizeLinkingEntitiesOptions(realOptions));
5337
5363
  try {
5338
5364
  const result = await this.client.entitiesLinking({
5339
- documents: realInputs
5365
+ documents: realInputs,
5340
5366
  }, finalOptions);
5341
5367
  return makeRecognizeLinkedEntitiesResultArray(realInputs, result);
5342
5368
  }
5343
5369
  catch (e) {
5344
5370
  span.setStatus({
5345
5371
  code: coreTracing.SpanStatusCode.ERROR,
5346
- message: e.message
5372
+ message: e.message,
5347
5373
  });
5348
5374
  throw e;
5349
5375
  }
@@ -5363,13 +5389,13 @@ class TextAnalyticsClient {
5363
5389
  realInputs = documents;
5364
5390
  realOptions = languageOrOptions || {};
5365
5391
  }
5366
- const { updateIntervalInMs, resumeFrom, onResponse, disableServiceLogs, modelVersion, requestOptions, serializerOptions, abortSignal, stringIndexType, includeStatistics, tracingOptions } = realOptions;
5392
+ const { updateIntervalInMs, resumeFrom, onResponse, disableServiceLogs, modelVersion, requestOptions, serializerOptions, abortSignal, stringIndexType, includeStatistics, tracingOptions, } = realOptions;
5367
5393
  const lro = new HealthLro(this.client, {
5368
5394
  onResponse,
5369
5395
  requestOptions,
5370
5396
  serializerOptions,
5371
5397
  abortSignal,
5372
- tracingOptions
5398
+ tracingOptions,
5373
5399
  }, { loggingOptOut: disableServiceLogs, stringIndexType, modelVersion }, { includeStatistics }, realInputs);
5374
5400
  const poller = new coreLro.LroEngine(lro, {
5375
5401
  intervalInMs: updateIntervalInMs,
@@ -5380,10 +5406,10 @@ class TextAnalyticsClient {
5380
5406
  serializerOptions,
5381
5407
  abortSignal,
5382
5408
  tracingOptions,
5383
- includeStatistics
5409
+ includeStatistics,
5384
5410
  }),
5385
5411
  isDone: isHealthDone,
5386
- updateState: updateHealthState
5412
+ updateState: updateHealthState,
5387
5413
  });
5388
5414
  await poller.poll();
5389
5415
  return poller;
@@ -5404,13 +5430,13 @@ class TextAnalyticsClient {
5404
5430
  realOptions = languageOrOptions || {};
5405
5431
  }
5406
5432
  const compiledActions = compileAnalyzeInput(actions);
5407
- const { updateIntervalInMs, resumeFrom, displayName, includeStatistics, onResponse, requestOptions, serializerOptions, abortSignal, tracingOptions } = realOptions;
5433
+ const { updateIntervalInMs, resumeFrom, displayName, includeStatistics, onResponse, requestOptions, serializerOptions, abortSignal, tracingOptions, } = realOptions;
5408
5434
  const lro = new AnalyzeLro(this.client, {
5409
5435
  onResponse,
5410
5436
  requestOptions,
5411
5437
  serializerOptions,
5412
5438
  abortSignal,
5413
- tracingOptions
5439
+ tracingOptions,
5414
5440
  }, { displayName }, { includeStatistics }, realInputs, compiledActions);
5415
5441
  const poller = new coreLro.LroEngine(lro, {
5416
5442
  intervalInMs: updateIntervalInMs,
@@ -5421,10 +5447,10 @@ class TextAnalyticsClient {
5421
5447
  serializerOptions,
5422
5448
  abortSignal,
5423
5449
  tracingOptions,
5424
- includeStatistics
5450
+ includeStatistics,
5425
5451
  }),
5426
5452
  isDone: isAnalyzeDone,
5427
- updateState: updateAnalyzeState
5453
+ updateState: updateAnalyzeState,
5428
5454
  });
5429
5455
  await poller.poll();
5430
5456
  return poller;
@@ -5444,7 +5470,7 @@ function compileAnalyzeInput(actions) {
5444
5470
  extractiveSummarizationTasks: (_f = actions.extractSummaryActions) === null || _f === void 0 ? void 0 : _f.map(compose(setStrEncodingParam, compose(setSentenceCount, compose(setOrderBy, addParamsToTask)))),
5445
5471
  customEntityRecognitionTasks: (_g = actions.recognizeCustomEntitiesActions) === null || _g === void 0 ? void 0 : _g.map(compose(setStrEncodingParam, addParamsToTask)),
5446
5472
  customSingleClassificationTasks: (_h = actions.singleCategoryClassifyActions) === null || _h === void 0 ? void 0 : _h.map(addParamsToTask),
5447
- customMultiClassificationTasks: (_j = actions.multiCategoryClassifyActions) === null || _j === void 0 ? void 0 : _j.map(addParamsToTask)
5473
+ customMultiClassificationTasks: (_j = actions.multiCategoryClassifyActions) === null || _j === void 0 ? void 0 : _j.map(addParamsToTask),
5448
5474
  };
5449
5475
  }
5450
5476
  function isStringArray(documents) {
@@ -5461,7 +5487,7 @@ function convertToDetectLanguageInput(inputs, countryHint) {
5461
5487
  return {
5462
5488
  id: String(index),
5463
5489
  countryHint,
5464
- text
5490
+ text,
5465
5491
  };
5466
5492
  });
5467
5493
  }
@@ -5473,7 +5499,7 @@ function convertToTextDocumentInput(inputs, language) {
5473
5499
  return {
5474
5500
  id: String(index),
5475
5501
  language,
5476
- text
5502
+ text,
5477
5503
  };
5478
5504
  });
5479
5505
  }
@@ -5493,7 +5519,7 @@ function makeGeneratedAnalyzeSentimentOptions(params) {
5493
5519
  tracingOptions: params.tracingOptions,
5494
5520
  onResponse: params.onResponse,
5495
5521
  serializerOptions: params.serializerOptions,
5496
- loggingOptOut: params.disableServiceLogs
5522
+ loggingOptOut: params.disableServiceLogs,
5497
5523
  };
5498
5524
  }
5499
5525
  /**
@@ -5513,7 +5539,7 @@ function makeGeneratedRecognizePiiEntitiesOptions(params) {
5513
5539
  piiCategories: params.categoriesFilter,
5514
5540
  onResponse: params.onResponse,
5515
5541
  serializerOptions: params.serializerOptions,
5516
- loggingOptOut: params.disableServiceLogs
5542
+ loggingOptOut: params.disableServiceLogs,
5517
5543
  };
5518
5544
  }
5519
5545
  /**
@@ -5531,7 +5557,7 @@ function makeGeneratedRecognizeCategorizedEntitiesOptions(params) {
5531
5557
  tracingOptions: params.tracingOptions,
5532
5558
  onResponse: params.onResponse,
5533
5559
  serializerOptions: params.serializerOptions,
5534
- loggingOptOut: params.disableServiceLogs
5560
+ loggingOptOut: params.disableServiceLogs,
5535
5561
  };
5536
5562
  }
5537
5563
  /**
@@ -5548,7 +5574,7 @@ function makeGeneratedDetectLanguageOptions(params) {
5548
5574
  tracingOptions: params.tracingOptions,
5549
5575
  onResponse: params.onResponse,
5550
5576
  serializerOptions: params.serializerOptions,
5551
- loggingOptOut: params.disableServiceLogs
5577
+ loggingOptOut: params.disableServiceLogs,
5552
5578
  };
5553
5579
  }
5554
5580
  /**
@@ -5565,7 +5591,7 @@ function makeGeneratedExtractKeyPhrasesOptions(params) {
5565
5591
  tracingOptions: params.tracingOptions,
5566
5592
  onResponse: params.onResponse,
5567
5593
  serializerOptions: params.serializerOptions,
5568
- loggingOptOut: params.disableServiceLogs
5594
+ loggingOptOut: params.disableServiceLogs,
5569
5595
  };
5570
5596
  }
5571
5597
  /**
@@ -5583,7 +5609,7 @@ function makeGeneratedRecognizeLinkingEntitiesOptions(params) {
5583
5609
  onResponse: params.onResponse,
5584
5610
  serializerOptions: params.serializerOptions,
5585
5611
  loggingOptOut: params.disableServiceLogs,
5586
- stringIndexType: setStrEncodingParamValue(params.stringIndexType)
5612
+ stringIndexType: setStrEncodingParamValue(params.stringIndexType),
5587
5613
  };
5588
5614
  }
5589
5615
 
@@ -5802,6 +5828,8 @@ var KnownErrorCodeValue;
5802
5828
  KnownErrorCodeValue["ServiceUnavailable"] = "ServiceUnavailable";
5803
5829
  KnownErrorCodeValue["NotFound"] = "NotFound";
5804
5830
  })(KnownErrorCodeValue || (KnownErrorCodeValue = {}));
5831
+ /** Known values of {@link InnerErrorCodeValue} that the service accepts. */
5832
+ exports.KnownInnerErrorCodeValue = void 0;
5805
5833
  (function (KnownInnerErrorCodeValue) {
5806
5834
  KnownInnerErrorCodeValue["InvalidParameterValue"] = "InvalidParameterValue";
5807
5835
  KnownInnerErrorCodeValue["InvalidRequestBodyFormat"] = "InvalidRequestBodyFormat";
@@ -5813,10 +5841,14 @@ var KnownErrorCodeValue;
5813
5841
  KnownInnerErrorCodeValue["UnsupportedLanguageCode"] = "UnsupportedLanguageCode";
5814
5842
  KnownInnerErrorCodeValue["InvalidCountryHint"] = "InvalidCountryHint";
5815
5843
  })(exports.KnownInnerErrorCodeValue || (exports.KnownInnerErrorCodeValue = {}));
5844
+ /** Known values of {@link WarningCode} that the service accepts. */
5845
+ exports.KnownWarningCode = void 0;
5816
5846
  (function (KnownWarningCode) {
5817
5847
  KnownWarningCode["LongWordsInDocument"] = "LongWordsInDocument";
5818
5848
  KnownWarningCode["DocumentTruncated"] = "DocumentTruncated";
5819
5849
  })(exports.KnownWarningCode || (exports.KnownWarningCode = {}));
5850
+ /** Known values of {@link HealthcareEntityCategory} that the service accepts. */
5851
+ exports.KnownHealthcareEntityCategory = void 0;
5820
5852
  (function (KnownHealthcareEntityCategory) {
5821
5853
  KnownHealthcareEntityCategory["BodyStructure"] = "BODY_STRUCTURE";
5822
5854
  KnownHealthcareEntityCategory["AGE"] = "AGE";
@@ -5873,9 +5905,7 @@ var KnownRelationType;
5873
5905
 
5874
5906
  Object.defineProperty(exports, 'AzureKeyCredential', {
5875
5907
  enumerable: true,
5876
- get: function () {
5877
- return coreAuth.AzureKeyCredential;
5878
- }
5908
+ get: function () { return coreAuth.AzureKeyCredential; }
5879
5909
  });
5880
5910
  exports.TextAnalyticsClient = TextAnalyticsClient;
5881
5911
  //# sourceMappingURL=index.js.map