[ServiceBus] upgrade dependency @azure/abort-controller to ^2.1.2 (#29807)

- fix compilation errors
- fix v7-beta sample tagetting version
This commit is contained in:
Jeremy Meng 2024-05-24 15:57:03 -07:00 коммит произвёл GitHub
Родитель 5a86305892
Коммит 85fcbb3733
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
20 изменённых файлов: 46 добавлений и 48 удалений

Просмотреть файл

@ -15371,7 +15371,7 @@ packages:
rimraf: 5.0.7
ts-node: 10.9.2(@types/node@18.19.33)(typescript@5.4.5)
tslib: 2.6.2
tsx: 4.10.2
tsx: 4.10.5
typescript: 5.4.5
uglify-js: 3.17.4
transitivePeerDependencies:

Просмотреть файл

@ -12,6 +12,8 @@
### Other Changes
- upgrade dependency `@azure/abort-controller` version to `^2.1.2`.
## 7.9.4 (2024-02-06)
### Bugs Fixed

Просмотреть файл

@ -99,7 +99,7 @@
]
},
"dependencies": {
"@azure/abort-controller": "^1.0.0",
"@azure/abort-controller": "^2.1.2",
"@azure/core-amqp": "^4.2.2",
"@azure/core-auth": "^1.3.0",
"@azure/core-client": "^1.0.0",

Просмотреть файл

@ -19,7 +19,6 @@ import {
isServiceBusError,
} from "@azure/service-bus";
import * as dotenv from "dotenv";
import { AbortController } from "@azure/abort-controller";
dotenv.config();

Просмотреть файл

@ -25,7 +25,7 @@
},
"homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/servicebus/service-bus",
"dependencies": {
"@azure/service-bus": "next",
"@azure/service-bus": "7.8.1-beta.1",
"dotenv": "latest",
"ws": "^8.0.0",
"https-proxy-agent": "^7.0.0",

Просмотреть файл

@ -29,7 +29,7 @@
},
"homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/servicebus/service-bus",
"dependencies": {
"@azure/service-bus": "next",
"@azure/service-bus": "7.8.1-beta.1",
"dotenv": "latest",
"ws": "^8.0.0",
"https-proxy-agent": "^7.0.0",

Просмотреть файл

@ -31,6 +31,6 @@
"https-proxy-agent": "^7.0.0",
"@azure/identity": "^4.0.1",
"@azure/core-auth": "^1.3.0",
"@azure/abort-controller": "^1.0.0"
"@azure/abort-controller": "^2.1.2"
}
}

Просмотреть файл

@ -35,7 +35,7 @@
"https-proxy-agent": "^7.0.0",
"@azure/identity": "^4.0.1",
"@azure/core-auth": "^1.3.0",
"@azure/abort-controller": "^1.0.0"
"@azure/abort-controller": "^2.1.2"
},
"devDependencies": {
"@types/ws": "^7.2.4",

Просмотреть файл

@ -18,7 +18,6 @@ import {
isServiceBusError,
} from "@azure/service-bus";
import * as dotenv from "dotenv";
import { AbortController } from "@azure/abort-controller";
dotenv.config();

Просмотреть файл

@ -49,7 +49,7 @@ import {
import { max32BitNumber } from "../util/constants";
import { Buffer } from "buffer";
import { OperationOptionsBase } from "./../modelsToBeSharedWithEventHubs";
import { AbortController, AbortSignalLike } from "@azure/abort-controller";
import { AbortSignalLike } from "@azure/abort-controller";
import { ReceiveMode } from "../models";
import { translateServiceBusError } from "../serviceBusError";
import { defaultDataTransformer, tryToJsonDecode } from "../dataTransformer";
@ -265,23 +265,27 @@ export class ManagementClient extends LinkEntity<RequestResponseLink> {
`${this.logPrefix} new replyTo address: ${this.replyTo} generated`,
);
}
const { abortSignal } = options ?? {};
const { abortSignal } = options;
const aborter = new AbortController();
const { signal } = new AbortController([
aborter.signal,
...(abortSignal ? [abortSignal] : []),
]);
const abortListener = () => {
aborter.abort();
};
abortSignal?.addEventListener("abort", abortListener);
if (!this.isOpen()) {
await Promise.race([
this._init(signal),
this._init(aborter.signal),
delay(retryTimeoutInMs, { abortSignal: aborter.signal }).then(() => {
throw {
name: "OperationTimeoutError",
message: "The management request timed out. Please try again later.",
};
}),
]).finally(() => aborter.abort());
]).finally(() => {
aborter.abort();
abortSignal?.removeEventListener("abort", abortListener);
});
}
// time taken by the init operation

Просмотреть файл

@ -17,7 +17,6 @@ import {
getRandomTestClientType,
getRandomTestClientTypeWithSessions,
} from "../public/utils/testutils2";
import { AbortController } from "@azure/abort-controller";
import { Receiver, ReceiverEvents } from "rhea-promise";
import {
ServiceBusSessionReceiver,

Просмотреть файл

@ -9,7 +9,6 @@
// import { defaultLock } from "@azure/core-amqp";
// import { TestClientType } from "./utils/testUtils";
// import { ServiceBusSenderImpl } from "../src/sender";
// import { AbortController } from "@azure/abort-controller";
// chai.use(chaiAsPromised);

Просмотреть файл

@ -7,7 +7,6 @@ import chaiAsPromised from "chai-as-promised";
import chaiExclude from "chai-exclude";
import { ServiceBusAdministrationClient } from "../../src";
import { EnvVarNames, getEnvVars } from "../public/utils/envVarUtils";
import { AbortController } from "@azure/abort-controller";
import { createPipelineRequest } from "@azure/core-rest-pipeline";
import { executeAtomXmlOperation } from "../../src/util/atomXmlHelper";
import { NamespaceResourceSerializer } from "../../src/serializers/namespaceResourceSerializer";
@ -38,119 +37,119 @@ describe("Operation Options", () => {
it("getNamespaceProperties", async () => {
await verifyAbortError(async () =>
serviceBusAtomManagementClient.getNamespaceProperties({
abortSignal: AbortController.timeout(1),
abortSignal: AbortSignal.timeout(1),
}),
);
});
it("createQueue", async () => {
await verifyAbortError(async () =>
serviceBusAtomManagementClient.createQueue(entityName1, {
abortSignal: AbortController.timeout(1),
abortSignal: AbortSignal.timeout(1),
}),
);
});
it("getQueue", async () => {
await verifyAbortError(async () =>
serviceBusAtomManagementClient.getQueue(entityName1, {
abortSignal: AbortController.timeout(1),
abortSignal: AbortSignal.timeout(1),
}),
);
});
it("updateQueue", async () => {
await verifyAbortError(async () =>
serviceBusAtomManagementClient.updateQueue({ name: entityName1 } as any, {
abortSignal: AbortController.timeout(1),
abortSignal: AbortSignal.timeout(1),
}),
);
});
it("deleteQueue", async () => {
await verifyAbortError(async () =>
serviceBusAtomManagementClient.deleteQueue(entityName1, {
abortSignal: AbortController.timeout(1),
abortSignal: AbortSignal.timeout(1),
}),
);
});
it("getQueueRuntimeProperties", async () => {
await verifyAbortError(async () =>
serviceBusAtomManagementClient.getQueueRuntimeProperties(entityName1, {
abortSignal: AbortController.timeout(1),
abortSignal: AbortSignal.timeout(1),
}),
);
});
it("getQueues", async () => {
await verifyAbortError(async () =>
serviceBusAtomManagementClient["getQueues"]({
abortSignal: AbortController.timeout(1),
abortSignal: AbortSignal.timeout(1),
}),
);
});
it("getQueuesRuntimeProperties", async () => {
await verifyAbortError(async () =>
serviceBusAtomManagementClient["getQueuesRuntimeProperties"]({
abortSignal: AbortController.timeout(1),
abortSignal: AbortSignal.timeout(1),
}),
);
});
it("createTopic", async () => {
await verifyAbortError(async () =>
serviceBusAtomManagementClient.createTopic(entityName1, {
abortSignal: AbortController.timeout(1),
abortSignal: AbortSignal.timeout(1),
}),
);
});
it("getTopic", async () => {
await verifyAbortError(async () =>
serviceBusAtomManagementClient.getTopic(entityName1, {
abortSignal: AbortController.timeout(1),
abortSignal: AbortSignal.timeout(1),
}),
);
});
it("updateTopic", async () => {
await verifyAbortError(async () =>
serviceBusAtomManagementClient.updateTopic({ name: entityName1 } as any, {
abortSignal: AbortController.timeout(1),
abortSignal: AbortSignal.timeout(1),
}),
);
});
it("deleteTopic", async () => {
await verifyAbortError(async () =>
serviceBusAtomManagementClient.deleteTopic(entityName1, {
abortSignal: AbortController.timeout(1),
abortSignal: AbortSignal.timeout(1),
}),
);
});
it("getTopicRuntimeProperties", async () => {
await verifyAbortError(async () =>
serviceBusAtomManagementClient.getTopicRuntimeProperties(entityName1, {
abortSignal: AbortController.timeout(1),
abortSignal: AbortSignal.timeout(1),
}),
);
});
it("getTopics", async () => {
await verifyAbortError(async () =>
serviceBusAtomManagementClient["getTopics"]({
abortSignal: AbortController.timeout(1),
abortSignal: AbortSignal.timeout(1),
}),
);
});
it("getTopicsRuntimeProperties", async () => {
await verifyAbortError(async () =>
serviceBusAtomManagementClient["getTopicsRuntimeProperties"]({
abortSignal: AbortController.timeout(1),
abortSignal: AbortSignal.timeout(1),
}),
);
});
it("createSubscription", async () => {
await verifyAbortError(async () =>
serviceBusAtomManagementClient.createSubscription(entityName1, entityName2, {
abortSignal: AbortController.timeout(1),
abortSignal: AbortSignal.timeout(1),
}),
);
});
it("getSubscription", async () => {
await verifyAbortError(async () =>
serviceBusAtomManagementClient.getSubscription(entityName1, entityName2, {
abortSignal: AbortController.timeout(1),
abortSignal: AbortSignal.timeout(1),
}),
);
});
@ -159,7 +158,7 @@ describe("Operation Options", () => {
serviceBusAtomManagementClient.updateSubscription(
{ topicName: entityName1, subscriptionName: entityName2 } as any,
{
abortSignal: AbortController.timeout(1),
abortSignal: AbortSignal.timeout(1),
},
),
);
@ -167,28 +166,28 @@ describe("Operation Options", () => {
it("deleteSubscription", async () => {
await verifyAbortError(async () =>
serviceBusAtomManagementClient.deleteSubscription(entityName1, entityName2, {
abortSignal: AbortController.timeout(1),
abortSignal: AbortSignal.timeout(1),
}),
);
});
it("getSubscriptionRuntimeProperties", async () => {
await verifyAbortError(async () =>
serviceBusAtomManagementClient.getSubscriptionRuntimeProperties(entityName1, entityName2, {
abortSignal: AbortController.timeout(1),
abortSignal: AbortSignal.timeout(1),
}),
);
});
it("getSubscriptions", async () => {
await verifyAbortError(async () =>
serviceBusAtomManagementClient["getSubscriptions"](entityName1, {
abortSignal: AbortController.timeout(1),
abortSignal: AbortSignal.timeout(1),
}),
);
});
it("getSubscriptionsRuntimeProperties", async () => {
await verifyAbortError(async () =>
serviceBusAtomManagementClient["getSubscriptionsRuntimeProperties"](entityName1, {
abortSignal: AbortController.timeout(1),
abortSignal: AbortSignal.timeout(1),
}),
);
});

Просмотреть файл

@ -16,7 +16,6 @@ import {
} from "../../../src/core/batchingReceiver";
import { defer, createConnectionContextForTests } from "./unittestUtils";
import { createAbortSignalForTest } from "../../public/utils/abortSignalTestUtils";
import { AbortController } from "@azure/abort-controller";
import { ServiceBusMessageImpl } from "../../../src/serviceBusMessage";
import {
Receiver as RheaPromiseReceiver,

Просмотреть файл

@ -1,7 +1,7 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
import { AbortController, AbortSignalLike } from "@azure/abort-controller";
import { AbortSignalLike } from "@azure/abort-controller";
import chai from "chai";
import chaiAsPromised from "chai-as-promised";
import { Receiver, ReceiverOptions } from "rhea-promise";

Просмотреть файл

@ -16,7 +16,7 @@ import {
ServiceBusSessionReceiver,
ServiceBusSessionReceiverImpl,
} from "../../../src/receivers/sessionReceiver";
import { AbortController, AbortSignalLike } from "@azure/abort-controller";
import { AbortSignalLike } from "@azure/abort-controller";
import { ServiceBusSenderImpl } from "../../../src/sender";
import { MessageReceiver } from "../../../src/core/messageReceiver";
const assert: typeof chai.assert = chai.assert;

Просмотреть файл

@ -6,7 +6,7 @@ import {
waitForTimeoutOrAbortOrResolve,
} from "../../../src/util/utils";
import { StandardAbortMessage } from "@azure/core-amqp";
import { AbortController, AbortError, AbortSignalLike } from "@azure/abort-controller";
import { AbortError, AbortSignalLike } from "@azure/abort-controller";
import { delay } from "rhea-promise";
import chai from "chai";
import chaiAsPromised from "chai-as-promised";

Просмотреть файл

@ -20,7 +20,6 @@ import {
getRandomTestClientType,
} from "./utils/testutils2";
import { ServiceBusSender } from "../../src";
import { AbortController } from "@azure/abort-controller";
import { StandardAbortMessage } from "@azure/core-amqp";
const noSessionTestClientType = getRandomTestClientTypeWithNoSessions();

Просмотреть файл

@ -25,7 +25,6 @@ import {
testPeekMsgsLength,
getRandomTestClientTypeWithSessions,
} from "./utils/testutils2";
import { AbortController } from "@azure/abort-controller";
import sinon from "sinon";
import { ServiceBusSessionReceiverImpl } from "../../src/receivers/sessionReceiver";

Просмотреть файл

@ -7,7 +7,7 @@ import {
loopForever as loopInfinitely,
ServiceBusStressTester,
} from "./serviceBusStressTester";
import { AbortController, AbortSignalLike } from "@azure/abort-controller";
import { AbortSignalLike } from "@azure/abort-controller";
import { ServiceBusClient, ServiceBusSender } from "@azure/service-bus";
import { v4 as uuidv4 } from "uuid";