diff --git a/sdk/servicebus/service-bus/CHANGELOG.md b/sdk/servicebus/service-bus/CHANGELOG.md index 45df73270c5e..04c08bcb2a44 100644 --- a/sdk/servicebus/service-bus/CHANGELOG.md +++ b/sdk/servicebus/service-bus/CHANGELOG.md @@ -8,6 +8,8 @@ ### Bugs Fixed +- Correct typing of `propertiesToModify` options to `abandonMessages()`, `deferMessages()`, and "deadLetterMessages()" [PR #20577](https://github.com/Azure/azure-sdk-for-js/pull/20577) + ### Other Changes - Migrate to depend on newer version of Core libraries core-client and core-rest-pipeline which bring better maintainability and performance. [PR #19587](https://github.com/Azure/azure-sdk-for-js/pull/19587) diff --git a/sdk/servicebus/service-bus/review/service-bus.api.md b/sdk/servicebus/service-bus/review/service-bus.api.md index 1e4390ffe7ce..9dfb3cb92275 100644 --- a/sdk/servicebus/service-bus/review/service-bus.api.md +++ b/sdk/servicebus/service-bus/review/service-bus.api.md @@ -468,15 +468,15 @@ export interface ServiceBusReceivedMessage extends ServiceBusMessage { // @public export interface ServiceBusReceiver { abandonMessage(message: ServiceBusReceivedMessage, propertiesToModify?: { - [key: string]: any; + [key: string]: number | boolean | string | Date | null; }): Promise; close(): Promise; completeMessage(message: ServiceBusReceivedMessage): Promise; deadLetterMessage(message: ServiceBusReceivedMessage, options?: DeadLetterOptions & { - [key: string]: any; + [key: string]: number | boolean | string | Date | null; }): Promise; deferMessage(message: ServiceBusReceivedMessage, propertiesToModify?: { - [key: string]: any; + [key: string]: number | boolean | string | Date | null; }): Promise; entityPath: string; getMessageIterator(options?: GetMessageIteratorOptions): AsyncIterableIterator; diff --git a/sdk/servicebus/service-bus/src/receivers/receiver.ts b/sdk/servicebus/service-bus/src/receivers/receiver.ts index 7198658b4862..7ffdd559e519 100644 --- a/sdk/servicebus/service-bus/src/receivers/receiver.ts +++ b/sdk/servicebus/service-bus/src/receivers/receiver.ts @@ -193,7 +193,7 @@ export interface ServiceBusReceiver { */ abandonMessage( message: ServiceBusReceivedMessage, - propertiesToModify?: { [key: string]: any } + propertiesToModify?: { [key: string]: number | boolean | string | Date | null } ): Promise; /** * Defers the processing of the message. Save the `sequenceNumber` of the message, in order to @@ -219,7 +219,7 @@ export interface ServiceBusReceiver { */ deferMessage( message: ServiceBusReceivedMessage, - propertiesToModify?: { [key: string]: any } + propertiesToModify?: { [key: string]: number | boolean | string | Date | null } ): Promise; /** * Moves the message to the deadletter sub-queue. To receive a deadletted message, create a new @@ -246,7 +246,7 @@ export interface ServiceBusReceiver { */ deadLetterMessage( message: ServiceBusReceivedMessage, - options?: DeadLetterOptions & { [key: string]: any } + options?: DeadLetterOptions & { [key: string]: number | boolean | string | Date | null } ): Promise; /** * Renews the lock on the message for the duration as specified during the Queue/Subscription @@ -543,7 +543,7 @@ export class ServiceBusReceiverImpl implements ServiceBusReceiver { async abandonMessage( message: ServiceBusReceivedMessage, - propertiesToModify?: { [key: string]: any } + propertiesToModify?: { [key: string]: number | boolean | string | Date | null } ): Promise { this._throwIfReceiverOrConnectionClosed(); throwErrorIfInvalidOperationOnMessage(message, this.receiveMode, this._context.connectionId); @@ -559,7 +559,7 @@ export class ServiceBusReceiverImpl implements ServiceBusReceiver { async deferMessage( message: ServiceBusReceivedMessage, - propertiesToModify?: { [key: string]: any } + propertiesToModify?: { [key: string]: number | boolean | string | Date | null } ): Promise { this._throwIfReceiverOrConnectionClosed(); throwErrorIfInvalidOperationOnMessage(message, this.receiveMode, this._context.connectionId); @@ -575,7 +575,7 @@ export class ServiceBusReceiverImpl implements ServiceBusReceiver { async deadLetterMessage( message: ServiceBusReceivedMessage, - options?: DeadLetterOptions & { [key: string]: any } + options?: DeadLetterOptions & { [key: string]: number | boolean | string | Date | null } ): Promise { this._throwIfReceiverOrConnectionClosed(); throwErrorIfInvalidOperationOnMessage(message, this.receiveMode, this._context.connectionId); diff --git a/sdk/servicebus/service-bus/src/receivers/receiverCommon.ts b/sdk/servicebus/service-bus/src/receivers/receiverCommon.ts index c98c75ec9bb4..69fe9105e03f 100644 --- a/sdk/servicebus/service-bus/src/receivers/receiverCommon.ts +++ b/sdk/servicebus/service-bus/src/receivers/receiverCommon.ts @@ -108,7 +108,7 @@ export function abandonMessage( message: ServiceBusMessageImpl, context: ConnectionContext, entityPath: string, - propertiesToModify: { [key: string]: any } | undefined, + propertiesToModify: { [key: string]: number | boolean | string | Date | null } | undefined, retryOptions: RetryOptions | undefined ): Promise { receiverLogger.verbose( @@ -130,7 +130,7 @@ export function deferMessage( message: ServiceBusMessageImpl, context: ConnectionContext, entityPath: string, - propertiesToModify: { [key: string]: any } | undefined, + propertiesToModify: { [key: string]: number | boolean | string | Date | null } | undefined, retryOptions: RetryOptions | undefined ): Promise { receiverLogger.verbose( @@ -152,7 +152,9 @@ export function deadLetterMessage( message: ServiceBusMessageImpl, context: ConnectionContext, entityPath: string, - propertiesToModify: (DeadLetterOptions & { [key: string]: any }) | undefined, + propertiesToModify: + | (DeadLetterOptions & { [key: string]: number | boolean | string | Date | null }) + | undefined, retryOptions: RetryOptions | undefined ): Promise { receiverLogger.verbose( diff --git a/sdk/servicebus/service-bus/src/receivers/sessionReceiver.ts b/sdk/servicebus/service-bus/src/receivers/sessionReceiver.ts index ff63a7864b0a..5cadd9a2b65e 100644 --- a/sdk/servicebus/service-bus/src/receivers/sessionReceiver.ts +++ b/sdk/servicebus/service-bus/src/receivers/sessionReceiver.ts @@ -510,7 +510,7 @@ export class ServiceBusSessionReceiverImpl implements ServiceBusSessionReceiver async abandonMessage( message: ServiceBusReceivedMessage, - propertiesToModify?: { [key: string]: any } + propertiesToModify?: { [key: string]: number | boolean | string | Date | null } ): Promise { this._throwIfReceiverOrConnectionClosed(); throwErrorIfInvalidOperationOnMessage(message, this.receiveMode, this._context.connectionId); @@ -526,7 +526,7 @@ export class ServiceBusSessionReceiverImpl implements ServiceBusSessionReceiver async deferMessage( message: ServiceBusReceivedMessage, - propertiesToModify?: { [key: string]: any } + propertiesToModify?: { [key: string]: number | boolean | string | Date | null } ): Promise { this._throwIfReceiverOrConnectionClosed(); throwErrorIfInvalidOperationOnMessage(message, this.receiveMode, this._context.connectionId); @@ -542,7 +542,7 @@ export class ServiceBusSessionReceiverImpl implements ServiceBusSessionReceiver async deadLetterMessage( message: ServiceBusReceivedMessage, - options?: DeadLetterOptions & { [key: string]: any } + options?: DeadLetterOptions & { [key: string]: number | boolean | string | Date | null } ): Promise { this._throwIfReceiverOrConnectionClosed(); throwErrorIfInvalidOperationOnMessage(message, this.receiveMode, this._context.connectionId);