Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type docs fix #11427

Merged
merged 4 commits into from
Sep 24, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions sdk/servicebus/service-bus/review/service-bus.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,8 @@ export interface CreateQueueOptions extends OperationOptions {
// @public
export interface CreateReceiverOptions<ReceiveModeT extends ReceiveMode> {
receiveMode?: ReceiveModeT;
subQueue?: SubQueue;
// @internal
_subQueue?: _SubQueue;
}

// @public
Expand Down Expand Up @@ -478,8 +479,8 @@ export interface SqlRuleFilter {
};
}

// @public
export type SubQueue = "deadLetter" | "transferDeadLetter";
// @internal
export type _SubQueue = "deadLetter" | "transferDeadLetter";

// @public
export interface SubscribeOptions extends MessageHandlerOptions {
Expand Down
2 changes: 1 addition & 1 deletion sdk/servicebus/service-bus/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export {
ReceiveMessagesOptions,
ReceiveMode,
SessionSubscribeOptions,
SubQueue,
_SubQueue,
SubscribeOptions
} from "./models";
export { OperationOptionsBase } from "./modelsToBeSharedWithEventHubs";
Expand Down
2 changes: 2 additions & 0 deletions sdk/servicebus/service-bus/src/log.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import { createClientLogger } from "@azure/logger";
/**
* The @azure/logger configuration for this package.
* This will output logs using the `azure:event-hubs` namespace prefix.
* @ignore
* @internal
*/
export const logger = createClientLogger("service-bus");

Expand Down
8 changes: 6 additions & 2 deletions sdk/servicebus/service-bus/src/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,10 @@ export type ReceiveMode = "peekLock" | "receiveAndDelete";
* Represents the sub queue that is applicable for any queue or subscription.
* Valid values are "deadLetter" and "transferDeadLetter". To learn more about dead letter queues,
* see https://docs.microsoft.com/azure/service-bus-messaging/service-bus-dead-letter-queues
* @internal
* @ignore
*/
export type SubQueue = "deadLetter" | "transferDeadLetter";
export type _SubQueue = "deadLetter" | "transferDeadLetter";

/**
*
Expand Down Expand Up @@ -78,8 +80,10 @@ export interface CreateReceiverOptions<ReceiveModeT extends ReceiveMode> {
* Represents the sub queue that is applicable for any queue or subscription.
* Valid values are "deadLetter" and "transferDeadLetter". To learn more about dead letter queues,
* see https://docs.microsoft.com/azure/service-bus-messaging/service-bus-dead-letter-queues
* @ignore
* @internal
*/
subQueue?: SubQueue;
_subQueue?: _SubQueue;
}

/**
Expand Down
6 changes: 3 additions & 3 deletions sdk/servicebus/service-bus/src/serviceBusClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,8 @@ export class ServiceBusClient {
);

let entityPathWithSubQueue = entityPath;
if (options?.subQueue) {
switch (options?.subQueue) {
if (options?._subQueue) {
switch (options?._subQueue) {
case "deadLetter":
entityPathWithSubQueue += "/$DeadLetterQueue";
break;
Expand All @@ -229,7 +229,7 @@ export class ServiceBusClient {
break;
default:
throw new Error(
`Invalid subQueue '${options?.subQueue}' provided. Valid values are 'deadLetter' and 'transferDeadLetter'`
`Invalid subQueue '${options?._subQueue}' provided. Valid values are 'deadLetter' and 'transferDeadLetter'`
);
}
}
Expand Down
2 changes: 2 additions & 0 deletions sdk/servicebus/service-bus/src/serviceBusMessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -826,6 +826,8 @@ export function fromAmqpMessage(
* @export
* @param {AmqpMessage} msg
* @returns {AmqpAnnotatedMessage}
* @internal
* @ignore
*/
export function toAmqpAnnotatedMessage(msg: AmqpMessage): AmqpAnnotatedMessage {
const messageHeader = MessageHeader.fromAmqpMessageHeader(msg);
Expand Down
8 changes: 6 additions & 2 deletions sdk/servicebus/service-bus/src/util/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import { ConnectionContext } from "../connectionContext";
import { AmqpError } from "rhea-promise";

/**
* Error message to use when EntityPath in connection string does not match the
* Error message to use when EntityPath in connection string does not match the
* queue or topic name passed to the methods in the ServiceBusClient that create
* senders and receivers.
*
*
* @internal
* @ignore
*/
Expand Down Expand Up @@ -217,6 +217,10 @@ export function logError(err: Error | AmqpError | undefined, ...args: any[]): vo
logErrorStackTrace(err);
}

/**
* @internal
* @ignore
*/
function isError(err: Error | AmqpError | undefined): err is Error {
return err != null && (err as any).name != null;
}
2 changes: 1 addition & 1 deletion sdk/servicebus/service-bus/test/invalidParameters.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ describe("invalid parameters", () => {
let errorCaught: string = "";
try {
// @ts-expect-error
sbClient.createReceiver("dummyQueue", { subQueue: 123 });
sbClient.createReceiver("dummyQueue", { _subQueue: 123 });
} catch (error) {
errorCaught = error.message;
}
Expand Down
2 changes: 1 addition & 1 deletion sdk/servicebus/service-bus/test/propsToModify.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ describe("dead lettering", () => {
// receiveAndDelete since I don't care about further settlement after it's been dead lettered!
serviceBusClient.createReceiver(entityNames.queue, {
receiveMode: "receiveAndDelete",
subQueue: "deadLetter"
_subQueue: "deadLetter"
})
);

Expand Down
4 changes: 2 additions & 2 deletions sdk/servicebus/service-bus/test/serviceBusClient.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -721,7 +721,7 @@ describe("entityPath on sender and receiver", async () => {

it("Entity Path on Queue deadletter Receiver", () => {
const dummyQueueName = "dummy";
const receiver = sbClient.createReceiver(dummyQueueName, { subQueue: "deadLetter" });
const receiver = sbClient.createReceiver(dummyQueueName, { _subQueue: "deadLetter" });
should.equal(
receiver.entityPath,
`${dummyQueueName}/$DeadLetterQueue`,
Expand All @@ -744,7 +744,7 @@ describe("entityPath on sender and receiver", async () => {
const dummyTopicName = "dummyTopicName";
const dummySubscriptionName = "dummySubscriptionName";
const receiver = sbClient.createReceiver(dummyTopicName, dummySubscriptionName, {
subQueue: "deadLetter"
_subQueue: "deadLetter"
});
should.equal(
receiver.entityPath,
Expand Down
8 changes: 4 additions & 4 deletions sdk/servicebus/service-bus/test/utils/testutils2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -425,9 +425,9 @@ export class ServiceBusTestHelpers {
): ServiceBusReceiver<ServiceBusReceivedMessageWithLock> {
return this.addToCleanup(
entityNames.queue
? this._serviceBusClient.createReceiver(entityNames.queue, { subQueue: "deadLetter" })
? this._serviceBusClient.createReceiver(entityNames.queue, { _subQueue: "deadLetter" })
: this._serviceBusClient.createReceiver(entityNames.topic!, entityNames.subscription!, {
subQueue: "deadLetter"
_subQueue: "deadLetter"
})
);
}
Expand Down Expand Up @@ -459,7 +459,7 @@ async function purgeForTestClientType(
receiver = serviceBusClient.createReceiver(entityPaths.queue, "receiveAndDelete");
deadLetterReceiver = serviceBusClient.createReceiver(entityPaths.queue, {
receiveMode: "receiveAndDelete",
subQueue: "deadLetter"
_subQueue: "deadLetter"
});
} else if (entityPaths.topic && entityPaths.subscription) {
receiver = serviceBusClient.createReceiver(entityPaths.topic, entityPaths.subscription, {
Expand All @@ -468,7 +468,7 @@ async function purgeForTestClientType(
deadLetterReceiver = serviceBusClient.createReceiver(
entityPaths.topic,
entityPaths.subscription,
{ receiveMode: "receiveAndDelete", subQueue: "deadLetter" }
{ receiveMode: "receiveAndDelete", _subQueue: "deadLetter" }
);
} else {
throw new Error(`Unsupported TestClientType for purge: ${testClientType}`);
Expand Down