@azure/ai-text-analytics 6.0.0-alpha.20220526.1 → 6.0.0-alpha.20220607.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 +22 -36
- package/dist/index.js.map +1 -1
- package/dist-esm/src/lro.js +6 -22
- package/dist-esm/src/lro.js.map +1 -1
- package/dist-esm/src/textAnalysisClient.js +10 -16
- package/dist-esm/src/textAnalysisClient.js.map +1 -1
- package/dist-esm/src/transforms.js +9 -1
- package/dist-esm/src/transforms.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3384,6 +3384,14 @@ function transformError(errorResponse) {
|
|
|
3384
3384
|
statusCode: strongErrorResponse.statusCode,
|
|
3385
3385
|
});
|
|
3386
3386
|
}
|
|
3387
|
+
async function throwError(p) {
|
|
3388
|
+
try {
|
|
3389
|
+
return await p;
|
|
3390
|
+
}
|
|
3391
|
+
catch (e) {
|
|
3392
|
+
throw transformError(e);
|
|
3393
|
+
}
|
|
3394
|
+
}
|
|
3387
3395
|
function toHealthcareResult(documents, results) {
|
|
3388
3396
|
function makeHealthcareEntity(entity) {
|
|
3389
3397
|
const { dataSources } = entity, rest = tslib.__rest(entity, ["dataSources"]);
|
|
@@ -3515,16 +3523,8 @@ async function getRawResponse(getResponse, options) {
|
|
|
3515
3523
|
}
|
|
3516
3524
|
async function sendRequest(settings) {
|
|
3517
3525
|
const { client, opOptions, path, spanStr, spec, tracing, httpMethod = "GET" } = settings;
|
|
3518
|
-
return tracing.withSpan(spanStr, opOptions, async (finalOptions) => {
|
|
3519
|
-
|
|
3520
|
-
const response = getRawResponse((options) => client.sendOperationRequest({ options }, Object.assign(Object.assign({}, spec), { path,
|
|
3521
|
-
httpMethod })), finalOptions);
|
|
3522
|
-
return response;
|
|
3523
|
-
}
|
|
3524
|
-
catch (e) {
|
|
3525
|
-
throw transformError(e);
|
|
3526
|
-
}
|
|
3527
|
-
});
|
|
3526
|
+
return tracing.withSpan(spanStr, opOptions, async (finalOptions) => throwError(getRawResponse((options) => client.sendOperationRequest({ options }, Object.assign(Object.assign({}, spec), { path,
|
|
3527
|
+
httpMethod })), finalOptions)));
|
|
3528
3528
|
}
|
|
3529
3529
|
/**
|
|
3530
3530
|
* @internal
|
|
@@ -3532,7 +3532,7 @@ async function sendRequest(settings) {
|
|
|
3532
3532
|
function createSendPollRequest(settings) {
|
|
3533
3533
|
const { client, options, tracing, spanStr } = settings;
|
|
3534
3534
|
return async (path) => {
|
|
3535
|
-
return
|
|
3535
|
+
return throwError(sendRequest({
|
|
3536
3536
|
client,
|
|
3537
3537
|
opOptions: options,
|
|
3538
3538
|
path,
|
|
@@ -3551,7 +3551,7 @@ function createAnalyzeBatchLro(settings) {
|
|
|
3551
3551
|
requestMethod: "POST",
|
|
3552
3552
|
requestPath: "/analyze-text/jobs",
|
|
3553
3553
|
async sendInitialRequest() {
|
|
3554
|
-
return tracing.withSpan(`${clientName}.beginAnalyzeBatch`, Object.assign(Object.assign({}, commonOptions), initialRequestOptions), async (finalOptions) =>
|
|
3554
|
+
return tracing.withSpan(`${clientName}.beginAnalyzeBatch`, Object.assign(Object.assign({}, commonOptions), initialRequestOptions), async (finalOptions) => throwError(getRawResponse((paramOptions) => client.analyzeText.submitJob({
|
|
3555
3555
|
tasks,
|
|
3556
3556
|
analysisInput: {
|
|
3557
3557
|
documents,
|
|
@@ -3650,21 +3650,13 @@ function createUpdateAnalyzeState(documents) {
|
|
|
3650
3650
|
}
|
|
3651
3651
|
};
|
|
3652
3652
|
}
|
|
3653
|
-
async function throwTransformErrors(p) {
|
|
3654
|
-
try {
|
|
3655
|
-
return await p;
|
|
3656
|
-
}
|
|
3657
|
-
catch (e) {
|
|
3658
|
-
throw transformError(e);
|
|
3659
|
-
}
|
|
3660
|
-
}
|
|
3661
3653
|
/**
|
|
3662
3654
|
* @internal
|
|
3663
3655
|
*/
|
|
3664
3656
|
function createCancelOperation(settings) {
|
|
3665
3657
|
return async ({ operationId }) => {
|
|
3666
3658
|
const { client, options, tracing } = settings;
|
|
3667
|
-
await tracing.withSpan(`${clientName}.beginAnalyzeBatch`, options, async (finalOptions) =>
|
|
3659
|
+
await tracing.withSpan(`${clientName}.beginAnalyzeBatch`, options, async (finalOptions) => throwError(getRawResponse((paramOptions) => client.analyzeText.cancelJob(operationId, paramOptions), finalOptions)));
|
|
3668
3660
|
};
|
|
3669
3661
|
}
|
|
3670
3662
|
|
|
@@ -3992,21 +3984,15 @@ class TextAnalysisClient {
|
|
|
3992
3984
|
languageOrCountryHintOrOptions || {};
|
|
3993
3985
|
}
|
|
3994
3986
|
const { options: operationOptions, rest: action } = getOperationOptions(realOptions);
|
|
3995
|
-
return this._tracing.withSpan("TextAnalysisClient.analyze", operationOptions, async (updatedOptions) =>
|
|
3996
|
-
|
|
3997
|
-
|
|
3998
|
-
|
|
3999
|
-
|
|
4000
|
-
|
|
4001
|
-
|
|
4002
|
-
|
|
4003
|
-
|
|
4004
|
-
return transformActionResult(actionName, realInputs, result);
|
|
4005
|
-
}
|
|
4006
|
-
catch (e) {
|
|
4007
|
-
throw transformError(e);
|
|
4008
|
-
}
|
|
4009
|
-
});
|
|
3987
|
+
return this._tracing.withSpan("TextAnalysisClient.analyze", operationOptions, async (updatedOptions) => throwError(this._client
|
|
3988
|
+
.analyze({
|
|
3989
|
+
kind: actionName,
|
|
3990
|
+
analysisInput: {
|
|
3991
|
+
documents: realInputs,
|
|
3992
|
+
},
|
|
3993
|
+
parameters: action,
|
|
3994
|
+
}, updatedOptions)
|
|
3995
|
+
.then((result) => transformActionResult(actionName, realInputs, result))));
|
|
4010
3996
|
}
|
|
4011
3997
|
// implementation
|
|
4012
3998
|
async beginAnalyzeBatch(actions, documents, languageOrOptions, options = {}) {
|