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