diff --git a/sdk/core/core-amqp/CHANGELOG.md b/sdk/core/core-amqp/CHANGELOG.md index cd01d485a28e..2b6f6441622b 100644 --- a/sdk/core/core-amqp/CHANGELOG.md +++ b/sdk/core/core-amqp/CHANGELOG.md @@ -2,6 +2,11 @@ ## 2.0.0 (Unreleased) +### Breaking changes + +- `DefaultDataTransformer` is no longer exported. + [PR 12320](https://github.com/Azure/azure-sdk-for-js/pull/12320) + ## 2.0.0-beta.1 (2020-11-03) - `AmqpAnnotatedMessage` interface that closely represents the AMQP annotated message from the [AMQP spec](https://docs.oasis-open.org/amqp/core/v1.0/os/amqp-core-messaging-v1.0-os.html#section-message-format) has been added. New `AmqpMessageHeaders` and `AmqpMessageProperties` interfaces(properties with camelCasing) have been added in the place of re-exports from "rhea" library(properties with snake_casing). diff --git a/sdk/core/core-amqp/review/core-amqp.api.md b/sdk/core/core-amqp/review/core-amqp.api.md index 65e55292e054..003eeae84446 100644 --- a/sdk/core/core-amqp/review/core-amqp.api.md +++ b/sdk/core/core-amqp/review/core-amqp.api.md @@ -384,12 +384,6 @@ export interface DataTransformer { encode: (body: any) => any; } -// @public -export class DefaultDataTransformer implements DataTransformer { - decode(body: any): any; - encode(body: any): any; -} - // @public export const defaultLock: AsyncLock; diff --git a/sdk/core/core-amqp/src/index.ts b/sdk/core/core-amqp/src/index.ts index ca971e056b2c..95bc81054eea 100644 --- a/sdk/core/core-amqp/src/index.ts +++ b/sdk/core/core-amqp/src/index.ts @@ -5,7 +5,7 @@ export { RequestResponseLink, SendRequestOptions } from "./requestResponseLink"; export { retry, RetryOptions, RetryConfig, RetryOperationType, RetryMode } from "./retry"; -export { DataTransformer, DefaultDataTransformer } from "./dataTransformer"; +export { DataTransformer } from "./dataTransformer"; export { TokenType } from "./auth/token"; export { ConnectionConfig, ConnectionConfigOptions } from "./connectionConfig/connectionConfig"; diff --git a/sdk/core/core-amqp/test/context.spec.ts b/sdk/core/core-amqp/test/context.spec.ts index 4c51c56b4910..d3dfe98c69f3 100644 --- a/sdk/core/core-amqp/test/context.spec.ts +++ b/sdk/core/core-amqp/test/context.spec.ts @@ -3,9 +3,10 @@ import * as chai from "chai"; const should = chai.should(); -import { CbsClient, ConnectionConfig, ConnectionContextBase, DefaultDataTransformer } from "../src"; +import { CbsClient, ConnectionConfig, ConnectionContextBase } from "../src"; import { Connection } from "rhea-promise"; import { isNode } from "../src/util/utils"; +import { DefaultDataTransformer } from "../src/dataTransformer"; describe("ConnectionContextBase", function() { it("should be created with required parameters", function(done) { diff --git a/sdk/core/core-amqp/test/dataTransformer.spec.ts b/sdk/core/core-amqp/test/dataTransformer.spec.ts index 6c089822a4ef..a212847b6305 100644 --- a/sdk/core/core-amqp/test/dataTransformer.spec.ts +++ b/sdk/core/core-amqp/test/dataTransformer.spec.ts @@ -6,8 +6,7 @@ import * as chai from "chai"; const should = chai.should(); import * as assert from "assert"; import isBuffer from "is-buffer"; - -import { DefaultDataTransformer } from "../src"; +import { DefaultDataTransformer } from "../src/dataTransformer"; describe("DataTransformer", function() { const objectBody: any = { @@ -38,7 +37,7 @@ describe("DataTransformer", function() { const nullBody: null = null; const undefinedBody: undefined = undefined; const emptyStringBody: string = ""; - const bufferbody: Buffer = Buffer.from("zzz", "utf8"); + const bufferBody: Buffer = Buffer.from("zzz", "utf8"); const hexBufferBody: Buffer = Buffer.from("7468697320697320612074c3a97374", "hex"); const transformer = new DefaultDataTransformer(); @@ -115,11 +114,11 @@ describe("DataTransformer", function() { }); it("should correctly encode/decode a buffer message body", function(done) { - const encoded: any = transformer.encode(bufferbody); + const encoded: any = transformer.encode(bufferBody); encoded.typecode.should.equal(117); isBuffer(encoded.content).should.equal(true); const decoded: any = transformer.decode(encoded); - assert.deepEqual(decoded, bufferbody); + assert.deepEqual(decoded, bufferBody); done(); }); @@ -184,8 +183,8 @@ describe("DataTransformer", function() { }); it("should correctly decode a buffer message body", function(done) { - const decoded: any = transformer.decode(bufferbody); - assert.deepEqual(decoded, bufferbody); + const decoded: any = transformer.decode(bufferBody); + assert.deepEqual(decoded, bufferBody); done(); }); diff --git a/sdk/servicebus/service-bus/test/internal/unittestUtils.ts b/sdk/servicebus/service-bus/test/internal/unittestUtils.ts index 8a35bc44e0e9..000f8b8b983a 100644 --- a/sdk/servicebus/service-bus/test/internal/unittestUtils.ts +++ b/sdk/servicebus/service-bus/test/internal/unittestUtils.ts @@ -8,7 +8,7 @@ import { ReceiverEvents, ReceiverOptions } from "rhea-promise"; -import { DefaultDataTransformer, Constants } from "@azure/core-amqp"; +import { Constants } from "@azure/core-amqp"; import { AccessToken } from "@azure/core-auth"; import { EventEmitter } from "events"; import { getUniqueName } from "../../src/util/utils"; @@ -88,7 +88,10 @@ export function createConnectionContextForTests( }, async close(): Promise {} }, - dataTransformer: new DefaultDataTransformer(), + dataTransformer: { + encode: (data: any) => data, + decode: (data: any) => data + }, tokenCredential: { getToken() { return {