@azure/ai-text-analytics 5.1.1-alpha.20240111.1 → 5.1.1-alpha.20240112.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 (31) hide show
  1. package/dist/index.js +164 -107
  2. package/dist/index.js.map +1 -1
  3. package/dist-esm/src/analyzeActionsResult.js +6 -7
  4. package/dist-esm/src/analyzeActionsResult.js.map +1 -1
  5. package/dist-esm/src/analyzeHealthcareEntitiesResult.js +7 -3
  6. package/dist-esm/src/analyzeHealthcareEntitiesResult.js.map +1 -1
  7. package/dist-esm/src/analyzeSentimentResult.js +7 -4
  8. package/dist-esm/src/analyzeSentimentResult.js.map +1 -1
  9. package/dist-esm/src/detectLanguageResult.js +4 -1
  10. package/dist-esm/src/detectLanguageResult.js.map +1 -1
  11. package/dist-esm/src/extractKeyPhrasesResult.js +4 -1
  12. package/dist-esm/src/extractKeyPhrasesResult.js.map +1 -1
  13. package/dist-esm/src/generated/generatedClient.js +10 -4
  14. package/dist-esm/src/generated/generatedClient.js.map +1 -1
  15. package/dist-esm/src/generated/models/mappers.js +44 -10
  16. package/dist-esm/src/generated/models/mappers.js.map +1 -1
  17. package/dist-esm/src/lro/analyze/operation.js +21 -18
  18. package/dist-esm/src/lro/analyze/operation.js.map +1 -1
  19. package/dist-esm/src/lro/health/operation.js +22 -34
  20. package/dist-esm/src/lro/health/operation.js.map +1 -1
  21. package/dist-esm/src/recognizeCategorizedEntitiesResult.js +4 -1
  22. package/dist-esm/src/recognizeCategorizedEntitiesResult.js.map +1 -1
  23. package/dist-esm/src/recognizeLinkedEntitiesResult.js +4 -1
  24. package/dist-esm/src/recognizeLinkedEntitiesResult.js.map +1 -1
  25. package/dist-esm/src/recognizePiiEntitiesResult.js +5 -2
  26. package/dist-esm/src/recognizePiiEntitiesResult.js.map +1 -1
  27. package/dist-esm/src/textAnalyticsClient.js +20 -16
  28. package/dist-esm/src/textAnalyticsClient.js.map +1 -1
  29. package/dist-esm/src/util.js +6 -8
  30. package/dist-esm/src/util.js.map +1 -1
  31. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -3,7 +3,6 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var coreAuth = require('@azure/core-auth');
6
- var tslib = require('tslib');
7
6
  var coreRestPipeline = require('@azure/core-rest-pipeline');
8
7
  var coreClient = require('@azure/core-client');
9
8
  var logger$1 = require('@azure/logger');
@@ -2366,70 +2365,104 @@ const AnalyzeBatchInput = {
2366
2365
  type: {
2367
2366
  name: "Composite",
2368
2367
  className: "AnalyzeBatchInput",
2369
- modelProperties: Object.assign(Object.assign(Object.assign({}, JobDescriptor.type.modelProperties), AnalysisInput.type.modelProperties), JobManifest.type.modelProperties)
2368
+ modelProperties: {
2369
+ ...JobDescriptor.type.modelProperties,
2370
+ ...AnalysisInput.type.modelProperties,
2371
+ ...JobManifest.type.modelProperties
2372
+ }
2370
2373
  }
2371
2374
  };
2372
2375
  const AnalyzeJobMetadata = {
2373
2376
  type: {
2374
2377
  name: "Composite",
2375
2378
  className: "AnalyzeJobMetadata",
2376
- modelProperties: Object.assign(Object.assign({}, JobMetadata.type.modelProperties), AnalyzeJobDisplayName.type.modelProperties)
2379
+ modelProperties: {
2380
+ ...JobMetadata.type.modelProperties,
2381
+ ...AnalyzeJobDisplayName.type.modelProperties
2382
+ }
2377
2383
  }
2378
2384
  };
2379
2385
  const HealthcareJobState = {
2380
2386
  type: {
2381
2387
  name: "Composite",
2382
2388
  className: "HealthcareJobState",
2383
- modelProperties: Object.assign(Object.assign(Object.assign({}, JobMetadata.type.modelProperties), HealthcareTaskResult.type.modelProperties), Pagination.type.modelProperties)
2389
+ modelProperties: {
2390
+ ...JobMetadata.type.modelProperties,
2391
+ ...HealthcareTaskResult.type.modelProperties,
2392
+ ...Pagination.type.modelProperties
2393
+ }
2384
2394
  }
2385
2395
  };
2386
2396
  const AnalyzeJobState = {
2387
2397
  type: {
2388
2398
  name: "Composite",
2389
2399
  className: "AnalyzeJobState",
2390
- modelProperties: Object.assign(Object.assign(Object.assign(Object.assign({}, AnalyzeJobMetadata.type.modelProperties), TasksState.type.modelProperties), AnalyzeJobErrorsAndStatistics.type.modelProperties), Pagination.type.modelProperties)
2400
+ modelProperties: {
2401
+ ...AnalyzeJobMetadata.type.modelProperties,
2402
+ ...TasksState.type.modelProperties,
2403
+ ...AnalyzeJobErrorsAndStatistics.type.modelProperties,
2404
+ ...Pagination.type.modelProperties
2405
+ }
2391
2406
  }
2392
2407
  };
2393
2408
  const TasksStateTasksEntityRecognitionTasksItem = {
2394
2409
  type: {
2395
2410
  name: "Composite",
2396
2411
  className: "TasksStateTasksEntityRecognitionTasksItem",
2397
- modelProperties: Object.assign(Object.assign({}, TaskState.type.modelProperties), EntitiesTaskResult.type.modelProperties)
2412
+ modelProperties: {
2413
+ ...TaskState.type.modelProperties,
2414
+ ...EntitiesTaskResult.type.modelProperties
2415
+ }
2398
2416
  }
2399
2417
  };
2400
2418
  const TasksStateTasksEntityRecognitionPiiTasksItem = {
2401
2419
  type: {
2402
2420
  name: "Composite",
2403
2421
  className: "TasksStateTasksEntityRecognitionPiiTasksItem",
2404
- modelProperties: Object.assign(Object.assign({}, TaskState.type.modelProperties), PiiTaskResult.type.modelProperties)
2422
+ modelProperties: {
2423
+ ...TaskState.type.modelProperties,
2424
+ ...PiiTaskResult.type.modelProperties
2425
+ }
2405
2426
  }
2406
2427
  };
2407
2428
  const TasksStateTasksKeyPhraseExtractionTasksItem = {
2408
2429
  type: {
2409
2430
  name: "Composite",
2410
2431
  className: "TasksStateTasksKeyPhraseExtractionTasksItem",
2411
- modelProperties: Object.assign(Object.assign({}, TaskState.type.modelProperties), KeyPhraseTaskResult.type.modelProperties)
2432
+ modelProperties: {
2433
+ ...TaskState.type.modelProperties,
2434
+ ...KeyPhraseTaskResult.type.modelProperties
2435
+ }
2412
2436
  }
2413
2437
  };
2414
2438
  const TasksStateTasksEntityLinkingTasksItem = {
2415
2439
  type: {
2416
2440
  name: "Composite",
2417
2441
  className: "TasksStateTasksEntityLinkingTasksItem",
2418
- modelProperties: Object.assign(Object.assign({}, TaskState.type.modelProperties), EntityLinkingTaskResult.type.modelProperties)
2442
+ modelProperties: {
2443
+ ...TaskState.type.modelProperties,
2444
+ ...EntityLinkingTaskResult.type.modelProperties
2445
+ }
2419
2446
  }
2420
2447
  };
2421
2448
  const TasksStateTasksSentimentAnalysisTasksItem = {
2422
2449
  type: {
2423
2450
  name: "Composite",
2424
2451
  className: "TasksStateTasksSentimentAnalysisTasksItem",
2425
- modelProperties: Object.assign(Object.assign({}, TaskState.type.modelProperties), SentimentTaskResult.type.modelProperties)
2452
+ modelProperties: {
2453
+ ...TaskState.type.modelProperties,
2454
+ ...SentimentTaskResult.type.modelProperties
2455
+ }
2426
2456
  }
2427
2457
  };
2428
2458
  const HealthcareEntity = {
2429
2459
  type: {
2430
2460
  name: "Composite",
2431
2461
  className: "HealthcareEntity",
2432
- modelProperties: Object.assign(Object.assign({}, HealthcareEntityProperties.type.modelProperties), HealthcareLinkingProperties.type.modelProperties)
2462
+ modelProperties: {
2463
+ ...HealthcareEntityProperties.type.modelProperties,
2464
+ ...HealthcareLinkingProperties.type.modelProperties
2465
+ }
2433
2466
  }
2434
2467
  };
2435
2468
  const GeneratedClientAnalyzeHeaders = {
@@ -2760,7 +2793,6 @@ class GeneratedClient extends coreClient__namespace.ServiceClient {
2760
2793
  * @param options The parameter options
2761
2794
  */
2762
2795
  constructor(endpoint, options) {
2763
- var _a, _b;
2764
2796
  if (endpoint === undefined) {
2765
2797
  throw new Error("'endpoint' cannot be null");
2766
2798
  }
@@ -2775,11 +2807,18 @@ class GeneratedClient extends coreClient__namespace.ServiceClient {
2775
2807
  const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix
2776
2808
  ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`
2777
2809
  : `${packageDetails}`;
2778
- const optionsWithDefaults = Object.assign(Object.assign(Object.assign({}, defaults), options), { userAgentOptions: {
2810
+ const optionsWithDefaults = {
2811
+ ...defaults,
2812
+ ...options,
2813
+ userAgentOptions: {
2779
2814
  userAgentPrefix
2780
- }, baseUri: (_b = (_a = options.endpoint) !== null && _a !== void 0 ? _a : options.baseUri) !== null && _b !== void 0 ? _b : "{Endpoint}/text/analytics/{ApiVersion}" });
2815
+ },
2816
+ baseUri: options.endpoint ??
2817
+ options.baseUri ??
2818
+ "{Endpoint}/text/analytics/{ApiVersion}"
2819
+ };
2781
2820
  super(optionsWithDefaults);
2782
- if ((options === null || options === void 0 ? void 0 : options.pipeline) && options.pipeline.getOrderedPolicies().length > 0) {
2821
+ if (options?.pipeline && options.pipeline.getOrderedPolicies().length > 0) {
2783
2822
  const pipelinePolicies = options.pipeline.getOrderedPolicies();
2784
2823
  const bearerTokenAuthenticationPolicyFound = pipelinePolicies.some((pipelinePolicy) => pipelinePolicy.name ===
2785
2824
  coreRestPipeline__namespace.bearerTokenAuthenticationPolicyName);
@@ -3225,7 +3264,7 @@ const jsEncodingUnit = "Utf16CodeUnit";
3225
3264
  * @internal
3226
3265
  */
3227
3266
  function addStrEncodingParam(options) {
3228
- return Object.assign(Object.assign({}, options), { stringIndexType: options.stringIndexType || jsEncodingUnit });
3267
+ return { ...options, stringIndexType: options.stringIndexType || jsEncodingUnit };
3229
3268
  }
3230
3269
  /**
3231
3270
  * Set the stringIndexType property with default if it does not exist in x.
@@ -3233,7 +3272,7 @@ function addStrEncodingParam(options) {
3233
3272
  * @internal
3234
3273
  */
3235
3274
  function setStrEncodingParam(x) {
3236
- return Object.assign(Object.assign({}, x), { stringIndexType: x.stringIndexType || jsEncodingUnit });
3275
+ return { ...x, stringIndexType: x.stringIndexType || jsEncodingUnit };
3237
3276
  }
3238
3277
  function setStrEncodingParamValue(stringIndexType) {
3239
3278
  return stringIndexType || jsEncodingUnit;
@@ -3243,20 +3282,20 @@ function setStrEncodingParamValue(stringIndexType) {
3243
3282
  * @internal
3244
3283
  */
3245
3284
  function setOpinionMining(x) {
3246
- return Object.assign(Object.assign({}, x), { opinionMining: x.includeOpinionMining });
3285
+ return { ...x, opinionMining: x.includeOpinionMining };
3247
3286
  }
3248
3287
  /**
3249
3288
  * Set the pii categories property
3250
3289
  * @internal
3251
3290
  */
3252
3291
  function setCategoriesFilter(x) {
3253
- return Object.assign(Object.assign({}, x), { piiCategories: x.categoriesFilter });
3292
+ return { ...x, piiCategories: x.categoriesFilter };
3254
3293
  }
3255
3294
  /**
3256
3295
  * @internal
3257
3296
  */
3258
3297
  function addParamsToTask(action) {
3259
- const { actionName } = action, params = tslib.__rest(action, ["actionName"]);
3298
+ const { actionName, ...params } = action;
3260
3299
  return { parameters: params, taskName: actionName };
3261
3300
  }
3262
3301
  /**
@@ -3304,12 +3343,11 @@ function appendReadableErrorMessage(currentMessage, innerMessage) {
3304
3343
  * @param error - the incoming error
3305
3344
  */
3306
3345
  function transformError(errorResponse) {
3307
- var _a;
3308
3346
  const strongErrorResponse = errorResponse;
3309
3347
  if (!strongErrorResponse.response) {
3310
3348
  throw errorResponse;
3311
3349
  }
3312
- const topLevelError = (_a = strongErrorResponse.response.parsedBody) === null || _a === void 0 ? void 0 : _a.error;
3350
+ const topLevelError = strongErrorResponse.response.parsedBody?.error;
3313
3351
  if (!topLevelError)
3314
3352
  return errorResponse;
3315
3353
  let errorMessage = topLevelError.message;
@@ -3431,7 +3469,10 @@ function combineSuccessfulAndErroneousDocumentsWithStatisticsAndModelVersion(inp
3431
3469
  */
3432
3470
  function makeDetectLanguageResult(response) {
3433
3471
  const { id, warnings, statistics, detectedLanguage } = response;
3434
- return Object.assign(Object.assign({}, makeTextAnalyticsSuccessResult(id, warnings, statistics)), { primaryLanguage: detectedLanguage });
3472
+ return {
3473
+ ...makeTextAnalyticsSuccessResult(id, warnings, statistics),
3474
+ primaryLanguage: detectedLanguage,
3475
+ };
3435
3476
  }
3436
3477
  /**
3437
3478
  * @internal
@@ -3456,7 +3497,10 @@ function makeDetectLanguageResultArray(input, response) {
3456
3497
  */
3457
3498
  function makeRecognizeCategorizedEntitiesResult(result) {
3458
3499
  const { entities, statistics, warnings, id } = result;
3459
- return Object.assign(Object.assign({}, makeTextAnalyticsSuccessResult(id, warnings, statistics)), { entities });
3500
+ return {
3501
+ ...makeTextAnalyticsSuccessResult(id, warnings, statistics),
3502
+ entities,
3503
+ };
3460
3504
  }
3461
3505
  /**
3462
3506
  * @internal
@@ -3482,8 +3526,12 @@ function makeRecognizeCategorizedEntitiesResultArray(input, response) {
3482
3526
  */
3483
3527
  function makeAnalyzeSentimentResult(result) {
3484
3528
  const { id, sentiment, confidenceScores, sentenceSentiments: sentences, warnings, statistics, } = result;
3485
- return Object.assign(Object.assign({}, makeTextAnalyticsSuccessResult(id, warnings, statistics)), { sentiment,
3486
- confidenceScores, sentences: sentences.map((sentence) => convertGeneratedSentenceSentiment(sentence, result)) });
3529
+ return {
3530
+ ...makeTextAnalyticsSuccessResult(id, warnings, statistics),
3531
+ sentiment,
3532
+ confidenceScores,
3533
+ sentences: sentences.map((sentence) => convertGeneratedSentenceSentiment(sentence, result)),
3534
+ };
3487
3535
  }
3488
3536
  /**
3489
3537
  * @internal
@@ -3534,10 +3582,9 @@ function convertGeneratedSentenceSentiment(sentence, result) {
3534
3582
  * @internal
3535
3583
  */
3536
3584
  function convertTargetRelationToAssessmentSentiment(targetRelation, result) {
3537
- var _a, _b;
3538
3585
  const assessmentPtr = targetRelation.ref;
3539
3586
  const assessmentIndex = parseAssessmentIndex(assessmentPtr);
3540
- const assessment = (_b = (_a = result.sentenceSentiments) === null || _a === void 0 ? void 0 : _a[assessmentIndex.sentence].assessments) === null || _b === void 0 ? void 0 : _b[assessmentIndex.assessment];
3587
+ const assessment = result.sentenceSentiments?.[assessmentIndex.sentence].assessments?.[assessmentIndex.assessment];
3541
3588
  if (assessment !== undefined) {
3542
3589
  return assessment;
3543
3590
  }
@@ -3562,7 +3609,10 @@ function makeAnalyzeSentimentResultArray(input, response) {
3562
3609
  */
3563
3610
  function makeExtractKeyPhrasesResult(result) {
3564
3611
  const { id, warnings, statistics, keyPhrases } = result;
3565
- return Object.assign(Object.assign({}, makeTextAnalyticsSuccessResult(id, warnings, statistics)), { keyPhrases });
3612
+ return {
3613
+ ...makeTextAnalyticsSuccessResult(id, warnings, statistics),
3614
+ keyPhrases,
3615
+ };
3566
3616
  }
3567
3617
  /**
3568
3618
  * @internal
@@ -3587,8 +3637,11 @@ function makeExtractKeyPhrasesResultArray(input, response) {
3587
3637
  */
3588
3638
  function makeRecognizePiiEntitiesResult(document) {
3589
3639
  const { id, entities, warnings, statistics, redactedText } = document;
3590
- return Object.assign(Object.assign({}, makeTextAnalyticsSuccessResult(id, warnings, statistics)), { entities,
3591
- redactedText });
3640
+ return {
3641
+ ...makeTextAnalyticsSuccessResult(id, warnings, statistics),
3642
+ entities,
3643
+ redactedText,
3644
+ };
3592
3645
  }
3593
3646
  /**
3594
3647
  * @internal
@@ -3613,7 +3666,10 @@ function makeRecognizePiiEntitiesResultArray(input, response) {
3613
3666
  */
3614
3667
  function makeRecognizeLinkedEntitiesResult(result) {
3615
3668
  const { statistics, id, warnings, entities } = result;
3616
- return Object.assign(Object.assign({}, makeTextAnalyticsSuccessResult(id, warnings, statistics)), { entities });
3669
+ return {
3670
+ ...makeTextAnalyticsSuccessResult(id, warnings, statistics),
3671
+ entities,
3672
+ };
3617
3673
  }
3618
3674
  /**
3619
3675
  * @internal
@@ -3700,7 +3756,6 @@ class AnalysisPollOperation {
3700
3756
  * @internal
3701
3757
  */
3702
3758
  function makeHealthcareEntitiesWithoutNeighbors(entity) {
3703
- var _a;
3704
3759
  const { category, confidenceScore, assertion, offset, text, links, subcategory, length, name } = entity;
3705
3760
  return {
3706
3761
  category,
@@ -3711,7 +3766,8 @@ function makeHealthcareEntitiesWithoutNeighbors(entity) {
3711
3766
  text,
3712
3767
  normalizedText: name,
3713
3768
  subCategory: subcategory,
3714
- dataSources: (_a = links === null || links === void 0 ? void 0 : links.map(({ dataSource, id }) => ({ name: dataSource, entityId: id }))) !== null && _a !== void 0 ? _a : [],
3769
+ dataSources: links?.map(({ dataSource, id }) => ({ name: dataSource, entityId: id })) ??
3770
+ [],
3715
3771
  };
3716
3772
  }
3717
3773
  /**
@@ -3734,7 +3790,11 @@ function makeHealthcareRelations(entities, relations) {
3734
3790
  function makeHealthcareEntitiesResult(document) {
3735
3791
  const { id, entities, relations, warnings, statistics } = document;
3736
3792
  const newEntities = entities.map(makeHealthcareEntitiesWithoutNeighbors);
3737
- return Object.assign(Object.assign({}, makeTextAnalyticsSuccessResult(id, warnings, statistics)), { entities: newEntities, entityRelations: makeHealthcareRelations(newEntities, relations) });
3793
+ return {
3794
+ ...makeTextAnalyticsSuccessResult(id, warnings, statistics),
3795
+ entities: newEntities,
3796
+ entityRelations: makeHealthcareRelations(newEntities, relations),
3797
+ };
3738
3798
  }
3739
3799
  /**
3740
3800
  * @internal
@@ -3786,7 +3846,7 @@ class BeginAnalyzeHealthcarePollerOperation extends AnalysisPollOperation {
3786
3846
  return this;
3787
3847
  },
3788
3848
  byPage: (settings) => {
3789
- const pageOptions = Object.assign(Object.assign({}, options), { top: settings === null || settings === void 0 ? void 0 : settings.maxPageSize });
3849
+ const pageOptions = { ...options, top: settings?.maxPageSize };
3790
3850
  return this._listHealthcareEntitiesPaged(operationId, pageOptions);
3791
3851
  },
3792
3852
  };
@@ -3794,39 +3854,26 @@ class BeginAnalyzeHealthcarePollerOperation extends AnalysisPollOperation {
3794
3854
  /**
3795
3855
  * returns an iterator to the results of a healthcare operation.
3796
3856
  */
3797
- _listHealthcareEntities(operationId, options) {
3798
- return tslib.__asyncGenerator(this, arguments, function* _listHealthcareEntities_1() {
3799
- var _a, e_1, _b, _c;
3800
- try {
3801
- for (var _d = true, _e = tslib.__asyncValues(this._listHealthcareEntitiesPaged(operationId, options)), _f; _f = yield tslib.__await(_e.next()), _a = _f.done, !_a; _d = true) {
3802
- _c = _f.value;
3803
- _d = false;
3804
- const page = _c;
3805
- yield tslib.__await(yield* tslib.__asyncDelegator(tslib.__asyncValues(page)));
3806
- }
3807
- }
3808
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
3809
- finally {
3810
- try {
3811
- if (!_d && !_a && (_b = _e.return)) yield tslib.__await(_b.call(_e));
3812
- }
3813
- finally { if (e_1) throw e_1.error; }
3814
- }
3815
- });
3857
+ async *_listHealthcareEntities(operationId, options) {
3858
+ for await (const page of this._listHealthcareEntitiesPaged(operationId, options)) {
3859
+ yield* page;
3860
+ }
3816
3861
  }
3817
3862
  /**
3818
3863
  * returns an iterator to arrays of the results of a healthcare operation.
3819
3864
  */
3820
- _listHealthcareEntitiesPaged(operationId, options) {
3821
- return tslib.__asyncGenerator(this, arguments, function* _listHealthcareEntitiesPaged_1() {
3822
- let response = yield tslib.__await(this._listHealthcareEntitiesSinglePage(operationId, options));
3823
- yield yield tslib.__await(response.result);
3824
- while (response.skip) {
3825
- const optionsWithContinuation = Object.assign(Object.assign({}, options), { top: response.top, skip: response.skip });
3826
- response = yield tslib.__await(this._listHealthcareEntitiesSinglePage(operationId, optionsWithContinuation));
3827
- yield yield tslib.__await(response.result);
3828
- }
3829
- });
3865
+ async *_listHealthcareEntitiesPaged(operationId, options) {
3866
+ let response = await this._listHealthcareEntitiesSinglePage(operationId, options);
3867
+ yield response.result;
3868
+ while (response.skip) {
3869
+ const optionsWithContinuation = {
3870
+ ...options,
3871
+ top: response.top,
3872
+ skip: response.skip,
3873
+ };
3874
+ response = await this._listHealthcareEntitiesSinglePage(operationId, optionsWithContinuation);
3875
+ yield response.result;
3876
+ }
3830
3877
  }
3831
3878
  /**
3832
3879
  * returns an iterator to arrays of the sorted results of a healthcare operation.
@@ -3836,7 +3883,8 @@ class BeginAnalyzeHealthcarePollerOperation extends AnalysisPollOperation {
3836
3883
  if (response.results) {
3837
3884
  const result = processAndCombineSuccessfulAndErroneousDocuments(this.documents, response.results, makeHealthcareEntitiesResult, makeHealthcareEntitiesErrorResult);
3838
3885
  return response.nextLink
3839
- ? Object.assign({ result }, nextLinkToTopAndSkip(response.nextLink)) : { result };
3886
+ ? { result, ...nextLinkToTopAndSkip(response.nextLink) }
3887
+ : { result };
3840
3888
  }
3841
3889
  else {
3842
3890
  throw new Error("Healthcare action has succeeded but the there are no results!");
@@ -3847,14 +3895,15 @@ class BeginAnalyzeHealthcarePollerOperation extends AnalysisPollOperation {
3847
3895
  * statistics and the model version used.
3848
3896
  */
3849
3897
  async getHealthStatus(operationId, options) {
3850
- var _a;
3851
3898
  const response = await this.tracing.withSpan("TextAnalyticsClient-getHealthStatus", options || {}, (finalOptions) => this.client.healthStatus(operationId, finalOptions));
3852
3899
  switch (response.status) {
3853
3900
  case "notStarted":
3854
3901
  case "running":
3855
3902
  break;
3856
3903
  case "failed": {
3857
- const errors = (_a = response.errors) === null || _a === void 0 ? void 0 : _a.map((e) => ` code ${e.code}, message: '${e.message}'`).join("\n");
3904
+ const errors = response.errors
3905
+ ?.map((e) => ` code ${e.code}, message: '${e.message}'`)
3906
+ .join("\n");
3858
3907
  const message = `Healthcare analysis failed. Error(s): ${errors || ""}`;
3859
3908
  throw new Error(message);
3860
3909
  }
@@ -4093,19 +4142,18 @@ function makeActionResult(documents, makeResultsArray, succeededTasks, erredActi
4093
4142
  * @internal
4094
4143
  */
4095
4144
  function createAnalyzeActionsResult(response, documents) {
4096
- var _a, _b, _c, _d, _e, _f;
4097
4145
  const recognizeEntitiesActionErrors = [];
4098
4146
  const recognizePiiEntitiesActionErrors = [];
4099
4147
  const extractKeyPhrasesActionErrors = [];
4100
4148
  const recognizeLinkedEntitiesActionErrors = [];
4101
4149
  const analyzeSentimentActionErrors = [];
4102
- categorizeActionErrors((_a = response === null || response === void 0 ? void 0 : response.errors) !== null && _a !== void 0 ? _a : [], recognizeEntitiesActionErrors, recognizePiiEntitiesActionErrors, extractKeyPhrasesActionErrors, recognizeLinkedEntitiesActionErrors, analyzeSentimentActionErrors);
4150
+ categorizeActionErrors(response?.errors ?? [], recognizeEntitiesActionErrors, recognizePiiEntitiesActionErrors, extractKeyPhrasesActionErrors, recognizeLinkedEntitiesActionErrors, analyzeSentimentActionErrors);
4103
4151
  return {
4104
- recognizeEntitiesResults: makeActionResult(documents, makeRecognizeCategorizedEntitiesResultArray, (_b = response.tasks.entityRecognitionTasks) !== null && _b !== void 0 ? _b : [], recognizeEntitiesActionErrors),
4105
- recognizePiiEntitiesResults: makeActionResult(documents, makeRecognizePiiEntitiesResultArray, (_c = response.tasks.entityRecognitionPiiTasks) !== null && _c !== void 0 ? _c : [], recognizePiiEntitiesActionErrors),
4106
- extractKeyPhrasesResults: makeActionResult(documents, makeExtractKeyPhrasesResultArray, (_d = response.tasks.keyPhraseExtractionTasks) !== null && _d !== void 0 ? _d : [], extractKeyPhrasesActionErrors),
4107
- recognizeLinkedEntitiesResults: makeActionResult(documents, makeRecognizeLinkedEntitiesResultArray, (_e = response.tasks.entityLinkingTasks) !== null && _e !== void 0 ? _e : [], recognizeLinkedEntitiesActionErrors),
4108
- analyzeSentimentResults: makeActionResult(documents, makeAnalyzeSentimentResultArray, (_f = response.tasks.sentimentAnalysisTasks) !== null && _f !== void 0 ? _f : [], analyzeSentimentActionErrors),
4152
+ recognizeEntitiesResults: makeActionResult(documents, makeRecognizeCategorizedEntitiesResultArray, response.tasks.entityRecognitionTasks ?? [], recognizeEntitiesActionErrors),
4153
+ recognizePiiEntitiesResults: makeActionResult(documents, makeRecognizePiiEntitiesResultArray, response.tasks.entityRecognitionPiiTasks ?? [], recognizePiiEntitiesActionErrors),
4154
+ extractKeyPhrasesResults: makeActionResult(documents, makeExtractKeyPhrasesResultArray, response.tasks.keyPhraseExtractionTasks ?? [], extractKeyPhrasesActionErrors),
4155
+ recognizeLinkedEntitiesResults: makeActionResult(documents, makeRecognizeLinkedEntitiesResultArray, response.tasks.entityLinkingTasks ?? [], recognizeLinkedEntitiesActionErrors),
4156
+ analyzeSentimentResults: makeActionResult(documents, makeAnalyzeSentimentResultArray, response.tasks.sentimentAnalysisTasks ?? [], analyzeSentimentActionErrors),
4109
4157
  };
4110
4158
  }
4111
4159
 
@@ -4158,7 +4206,7 @@ class BeginAnalyzeActionsPollerOperation extends AnalysisPollOperation {
4158
4206
  return this;
4159
4207
  },
4160
4208
  byPage: (settings) => {
4161
- const pageOptions = Object.assign(Object.assign({}, options), { top: settings === null || settings === void 0 ? void 0 : settings.maxPageSize });
4209
+ const pageOptions = { ...options, top: settings?.maxPageSize };
4162
4210
  return this._listAnalyzeActionsResultsPaged(operationId, pageOptions);
4163
4211
  },
4164
4212
  };
@@ -4166,16 +4214,18 @@ class BeginAnalyzeActionsPollerOperation extends AnalysisPollOperation {
4166
4214
  /**
4167
4215
  * returns an iterator to arrays of the results of an analyze actions operation.
4168
4216
  */
4169
- _listAnalyzeActionsResultsPaged(operationId, options) {
4170
- return tslib.__asyncGenerator(this, arguments, function* _listAnalyzeActionsResultsPaged_1() {
4171
- let response = yield tslib.__await(this._listAnalyzeActionsResultsSinglePage(operationId, options));
4172
- yield yield tslib.__await(response.result);
4173
- while (response.skip) {
4174
- const optionsWithContinuation = Object.assign(Object.assign({}, options), { top: response.top, skip: response.skip });
4175
- response = yield tslib.__await(this._listAnalyzeActionsResultsSinglePage(operationId, optionsWithContinuation));
4176
- yield yield tslib.__await(response.result);
4177
- }
4178
- });
4217
+ async *_listAnalyzeActionsResultsPaged(operationId, options) {
4218
+ let response = await this._listAnalyzeActionsResultsSinglePage(operationId, options);
4219
+ yield response.result;
4220
+ while (response.skip) {
4221
+ const optionsWithContinuation = {
4222
+ ...options,
4223
+ top: response.top,
4224
+ skip: response.skip,
4225
+ };
4226
+ response = await this._listAnalyzeActionsResultsSinglePage(operationId, optionsWithContinuation);
4227
+ yield response.result;
4228
+ }
4179
4229
  }
4180
4230
  /**
4181
4231
  * returns an iterator to arrays of the sorted results of an analyze actions operation.
@@ -4183,7 +4233,7 @@ class BeginAnalyzeActionsPollerOperation extends AnalysisPollOperation {
4183
4233
  async _listAnalyzeActionsResultsSinglePage(operationId, options) {
4184
4234
  const response = await this.tracing.withSpan("TextAnalyticsClient-_listAnalyzeActionsResultsSinglePage", options || {}, (finalOptions) => this.client.analyzeStatus(operationId, finalOptions));
4185
4235
  const result = createAnalyzeActionsResult(response, this.documents);
4186
- return response.nextLink ? Object.assign({ result }, nextLinkToTopAndSkip(response.nextLink)) : { result };
4236
+ return response.nextLink ? { result, ...nextLinkToTopAndSkip(response.nextLink) } : { result };
4187
4237
  }
4188
4238
  /**
4189
4239
  * returns whether the analyze actions operation is done and if so returns also
@@ -4206,14 +4256,16 @@ class BeginAnalyzeActionsPollerOperation extends AnalysisPollOperation {
4206
4256
  return { done: false, operationMetdata: getMetaInfoFromResponse(response) };
4207
4257
  }
4208
4258
  async beginAnalyzeActions(documents, actions, options) {
4209
- return this.tracing.withSpan("TextAnalyticsClient-beginAnalyze", options || {}, (finalOptions) => throwError(this.client.analyze(Object.assign({ body: {
4259
+ return this.tracing.withSpan("TextAnalyticsClient-beginAnalyze", options || {}, (finalOptions) => throwError(this.client.analyze({
4260
+ body: {
4210
4261
  analysisInput: { documents: documents },
4211
4262
  tasks: actions,
4212
- displayName: options === null || options === void 0 ? void 0 : options.displayName,
4213
- } }, finalOptions))));
4263
+ displayName: options?.displayName,
4264
+ },
4265
+ ...finalOptions,
4266
+ })));
4214
4267
  }
4215
4268
  async update(options = {}) {
4216
- var _a;
4217
4269
  const state = this.state;
4218
4270
  const updatedAbortSignal = options.abortSignal;
4219
4271
  if (!state.isStarted) {
@@ -4241,7 +4293,7 @@ class BeginAnalyzeActionsPollerOperation extends AnalysisPollOperation {
4241
4293
  state.actionsSucceededCount = operationStatus.operationMetdata.actionsSucceededCount;
4242
4294
  state.actionsFailedCount = operationStatus.operationMetdata.actionsFailedCount;
4243
4295
  state.actionsInProgressCount = operationStatus.operationMetdata.actionsInProgressCount;
4244
- state.displayName = (_a = operationStatus.operationMetdata) === null || _a === void 0 ? void 0 : _a.displayName;
4296
+ state.displayName = operationStatus.operationMetdata?.displayName;
4245
4297
  if (!state.isCompleted && operationStatus.done) {
4246
4298
  const pagedIterator = this.listAnalyzeActionsResults(state.operationId, {
4247
4299
  abortSignal: this.options.abortSignal,
@@ -4329,7 +4381,7 @@ class TextAnalyticsClient {
4329
4381
  */
4330
4382
  constructor(endpointUrl, credential, options = {}) {
4331
4383
  this.endpointUrl = endpointUrl;
4332
- const { defaultCountryHint = "us", defaultLanguage = "en" } = options, pipelineOptions = tslib.__rest(options, ["defaultCountryHint", "defaultLanguage"]);
4384
+ const { defaultCountryHint = "us", defaultLanguage = "en", ...pipelineOptions } = options;
4333
4385
  this.defaultCountryHint = defaultCountryHint;
4334
4386
  this.defaultLanguage = defaultLanguage;
4335
4387
  const libInfo = `azsdk-js-ai-textanalytics/${SDK_VERSION}`;
@@ -4342,12 +4394,15 @@ class TextAnalyticsClient {
4342
4394
  else {
4343
4395
  pipelineOptions.userAgentOptions.userAgentPrefix = libInfo;
4344
4396
  }
4345
- const internalPipelineOptions = Object.assign(Object.assign({}, pipelineOptions), {
4346
- loggingOptions: {
4347
- logger: logger.info,
4348
- additionalAllowedHeaderNames: ["x-ms-correlation-request-id", "x-ms-request-id"],
4397
+ const internalPipelineOptions = {
4398
+ ...pipelineOptions,
4399
+ ...{
4400
+ loggingOptions: {
4401
+ logger: logger.info,
4402
+ additionalAllowedHeaderNames: ["x-ms-correlation-request-id", "x-ms-request-id"],
4403
+ },
4349
4404
  },
4350
- });
4405
+ };
4351
4406
  this.client = new GeneratedClient(this.endpointUrl, internalPipelineOptions);
4352
4407
  const authPolicy = coreAuth.isTokenCredential(credential)
4353
4408
  ? coreRestPipeline.bearerTokenAuthenticationPolicy({ credential, scopes: DEFAULT_COGNITIVE_SCOPE })
@@ -4372,7 +4427,10 @@ class TextAnalyticsClient {
4372
4427
  }
4373
4428
  else {
4374
4429
  // Replace "none" hints with ""
4375
- realInputs = documents.map((input) => (Object.assign(Object.assign({}, input), { countryHint: input.countryHint === "none" ? "" : input.countryHint })));
4430
+ realInputs = documents.map((input) => ({
4431
+ ...input,
4432
+ countryHint: input.countryHint === "none" ? "" : input.countryHint,
4433
+ }));
4376
4434
  realOptions = countryHintOrOptions || {};
4377
4435
  }
4378
4436
  return this._tracing.withSpan("TextAnalyticsClient-detectLanguages", makeGeneratedDetectLanguageOptions(realOptions), (finalOptions) => this.client
@@ -4495,7 +4553,7 @@ class TextAnalyticsClient {
4495
4553
  realInputs = documents;
4496
4554
  realOptions = languageOrOptions || {};
4497
4555
  }
4498
- const { updateIntervalInMs, resumeFrom } = realOptions, restOptions = tslib.__rest(realOptions, ["updateIntervalInMs", "resumeFrom"]);
4556
+ const { updateIntervalInMs, resumeFrom, ...restOptions } = realOptions;
4499
4557
  const poller = new BeginAnalyzeHealthcarePoller({
4500
4558
  client: this.client,
4501
4559
  tracing: this._tracing,
@@ -4523,7 +4581,7 @@ class TextAnalyticsClient {
4523
4581
  realOptions = languageOrOptions || {};
4524
4582
  }
4525
4583
  const compiledActions = compileAnalyzeInput(actions);
4526
- const { updateIntervalInMs, resumeFrom } = realOptions, restOptions = tslib.__rest(realOptions, ["updateIntervalInMs", "resumeFrom"]);
4584
+ const { updateIntervalInMs, resumeFrom, ...restOptions } = realOptions;
4527
4585
  const poller = new BeginAnalyzeActionsPoller({
4528
4586
  client: this.client,
4529
4587
  tracing: this._tracing,
@@ -4541,13 +4599,12 @@ class TextAnalyticsClient {
4541
4599
  * @internal
4542
4600
  */
4543
4601
  function compileAnalyzeInput(actions) {
4544
- var _a, _b, _c, _d, _e;
4545
4602
  return {
4546
- entityRecognitionPiiTasks: (_a = actions.recognizePiiEntitiesActions) === null || _a === void 0 ? void 0 : _a.map(compose(setStrEncodingParam, compose(setCategoriesFilter, addParamsToTask))),
4547
- entityRecognitionTasks: (_b = actions.recognizeEntitiesActions) === null || _b === void 0 ? void 0 : _b.map(compose(setStrEncodingParam, addParamsToTask)),
4548
- keyPhraseExtractionTasks: (_c = actions.extractKeyPhrasesActions) === null || _c === void 0 ? void 0 : _c.map(addParamsToTask),
4549
- entityLinkingTasks: (_d = actions.recognizeLinkedEntitiesActions) === null || _d === void 0 ? void 0 : _d.map(compose(setStrEncodingParam, addParamsToTask)),
4550
- sentimentAnalysisTasks: (_e = actions.analyzeSentimentActions) === null || _e === void 0 ? void 0 : _e.map(compose(setStrEncodingParam, compose(setOpinionMining, addParamsToTask))),
4603
+ entityRecognitionPiiTasks: actions.recognizePiiEntitiesActions?.map(compose(setStrEncodingParam, compose(setCategoriesFilter, addParamsToTask))),
4604
+ entityRecognitionTasks: actions.recognizeEntitiesActions?.map(compose(setStrEncodingParam, addParamsToTask)),
4605
+ keyPhraseExtractionTasks: actions.extractKeyPhrasesActions?.map(addParamsToTask),
4606
+ entityLinkingTasks: actions.recognizeLinkedEntitiesActions?.map(compose(setStrEncodingParam, addParamsToTask)),
4607
+ sentimentAnalysisTasks: actions.analyzeSentimentActions?.map(compose(setStrEncodingParam, compose(setOpinionMining, addParamsToTask))),
4551
4608
  };
4552
4609
  }
4553
4610
  function isStringArray(documents) {