@azure/ai-language-text 1.1.0-alpha.20230210.1 → 1.1.0-alpha.20230223.3
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 +23 -14
- package/dist/index.js.map +1 -1
- package/dist-esm/src/lro.js +23 -14
- package/dist-esm/src/lro.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
@@ -4161,13 +4161,24 @@ const jobStatusOperationSpec$1 = {
|
|
4161
4161
|
queryParameters: [top, skip, includeStatistics],
|
4162
4162
|
serializer: serializer$2,
|
4163
4163
|
};
|
4164
|
+
function addOnResponse(options, cb) {
|
4165
|
+
return Object.assign(Object.assign({}, options), { onResponse: (rawResponse, response, error) => {
|
4166
|
+
var _a;
|
4167
|
+
cb(rawResponse, response, error);
|
4168
|
+
(_a = options.onResponse) === null || _a === void 0 ? void 0 : _a.call(options, rawResponse, response, error);
|
4169
|
+
} });
|
4170
|
+
}
|
4171
|
+
function logWarnHeader(rawResponse) {
|
4172
|
+
const warnHeader = rawResponse.headers.get("warn-text");
|
4173
|
+
if (warnHeader) {
|
4174
|
+
warnHeader.split(";").map((x) => logger.warning(x));
|
4175
|
+
}
|
4176
|
+
}
|
4164
4177
|
async function getRawResponse(getResponse, options) {
|
4165
|
-
const { onResponse } = options || {};
|
4166
4178
|
let rawResponse;
|
4167
|
-
const flatResponse = await getResponse(
|
4168
|
-
|
4169
|
-
|
4170
|
-
} }));
|
4179
|
+
const flatResponse = await getResponse(addOnResponse(options, (response) => {
|
4180
|
+
rawResponse = response;
|
4181
|
+
}));
|
4171
4182
|
return {
|
4172
4183
|
flatResponse,
|
4173
4184
|
rawResponse: {
|
@@ -4190,14 +4201,12 @@ function createSendPollRequest(settings) {
|
|
4190
4201
|
return async (path) => {
|
4191
4202
|
return throwError(sendRequest({
|
4192
4203
|
client,
|
4193
|
-
opOptions:
|
4194
|
-
|
4195
|
-
|
4196
|
-
|
4197
|
-
|
4198
|
-
|
4199
|
-
(_a = options.onResponse) === null || _a === void 0 ? void 0 : _a.call(options, rawResponse, response, error);
|
4200
|
-
} }),
|
4204
|
+
opOptions: addOnResponse(options, (_, response) => {
|
4205
|
+
const castResponse = response;
|
4206
|
+
if (castResponse.status.toLowerCase() === "partiallysucceeded") {
|
4207
|
+
castResponse.status = "failed";
|
4208
|
+
}
|
4209
|
+
}),
|
4201
4210
|
path,
|
4202
4211
|
spanStr,
|
4203
4212
|
spec: jobStatusOperationSpec$1,
|
@@ -4212,7 +4221,7 @@ function createAnalyzeBatchLro(settings) {
|
|
4212
4221
|
const { client, commonOptions, documents, initialRequestOptions, pollRequestOptions, tasks, tracing, } = settings;
|
4213
4222
|
return {
|
4214
4223
|
async sendInitialRequest() {
|
4215
|
-
return tracing.withSpan(`${clientName}.beginAnalyzeBatch`, Object.assign(Object.assign({}, commonOptions), initialRequestOptions), async (finalOptions) => throwError(getRawResponse((paramOptions) => client.analyzeBatch({
|
4224
|
+
return tracing.withSpan(`${clientName}.beginAnalyzeBatch`, addOnResponse(Object.assign(Object.assign({}, commonOptions), initialRequestOptions), logWarnHeader), async (finalOptions) => throwError(getRawResponse((paramOptions) => client.analyzeBatch({
|
4216
4225
|
tasks,
|
4217
4226
|
analysisInput: {
|
4218
4227
|
documents,
|