Skip to content

Commit 6684e1c

Browse files
authored
[Language Text] Mitigation for modifiedOn (#23729)
Mitigation for the incorrect name used in for the `lastUpdatedDateTime` property in the job states. The service currently returns it as `lastUpdateDateTime` instead.
1 parent e7b7a32 commit 6684e1c

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

‎sdk/cognitivelanguage/ai-language-text/src/lro.ts‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -266,13 +266,14 @@ type Writable<T> = {
266266
*/
267267
export function createUpdateAnalyzeState(docIds?: string[]) {
268268
return (state: AnalyzeBatchOperationState, lastResponse: LroResponse): void => {
269-
const { createdOn, modifiedOn, id, displayName, expiresOn, tasks } =
270-
lastResponse.flatResponse as AnalyzeTextJobStatusResponse;
269+
const { createdOn, modifiedOn, id, displayName, expiresOn, tasks, lastUpdateDateTime } =
270+
lastResponse.flatResponse as AnalyzeTextJobStatusResponse & { lastUpdateDateTime: string };
271271
const mutableState = state as Writable<AnalyzeBatchOperationState> & {
272272
docIds?: string[];
273273
};
274274
mutableState.createdOn = createdOn;
275-
mutableState.modifiedOn = modifiedOn;
275+
// FIXME: remove this mitigation when the service API is fixed
276+
mutableState.modifiedOn = modifiedOn ? modifiedOn : new Date(lastUpdateDateTime);
276277
mutableState.expiresOn = expiresOn;
277278
mutableState.displayName = displayName;
278279
mutableState.id = id;

‎sdk/cognitivelanguage/ai-language-text/test/public/analyzeBatch.spec.ts‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -964,8 +964,7 @@ matrix([["APIKey", "AAD"]] as const, async (authMethod: AuthMethod) => {
964964
poller.onProgress((state) => {
965965
assert.ok(state.createdOn, "createdOn is undefined!");
966966
assert.ok(state.expiresOn, "expiresOn is undefined!");
967-
// FIXME uncomment this line when the service fixes the issue
968-
// assert.ok(state.modifiedOn, "modifiedOn is undefined!");
967+
assert.ok(state.modifiedOn, "modifiedOn is undefined!");
969968
assert.ok(state.status, "status is undefined!");
970969
assert.ok(state.id, "id is undefined!");
971970
assert.equal(state.displayName, "testJob");

0 commit comments

Comments
 (0)