diff --git a/sdk/storage/storage-blob-changefeed/README.md b/sdk/storage/storage-blob-changefeed/README.md index 240d54c1356d..6dae63a2da72 100644 --- a/sdk/storage/storage-blob-changefeed/README.md +++ b/sdk/storage/storage-blob-changefeed/README.md @@ -6,7 +6,7 @@ The purpose of the change feed is to provide transaction logs of all the changes This project provides a client library in JavaScript that makes it easy to consume the change feed. -Use the client libararies in this package to: +Use the client libraries in this package to: - Reading change feed events, all or within a time range - Resuming reading events from a saved position @@ -34,19 +34,7 @@ This library uses an authenticated `BlobServiceClient` to initialize. Refer to [ ### Compatibility -For this perview, this library is only compatible with Node.js. - -### CORS - -You need to set up [Cross-Origin Resource Sharing (CORS)](https://docs.microsoft.com/rest/api/storageservices/cross-origin-resource-sharing--cors--support-for-the-azure-storage-services) rules for your storage account if you need to develop for browsers. Go to Azure portal and Azure Storage Explorer, find your storage account, create new CORS rules for blob/queue/file/table service(s). - -For example, you can create following CORS settings for debugging. But please customize the settings carefully according to your requirements in production environment. - -- Allowed origins: \* -- Allowed verbs: DELETE,GET,HEAD,MERGE,POST,OPTIONS,PUT -- Allowed headers: \* -- Exposed headers: \* -- Maximum age (seconds): 86400 +For this preview, this library is only compatible with Node.js. ## Key concepts @@ -69,7 +57,7 @@ The `BlobChangeFeedClient` requires a `BlobServiceClient` to initialize. Refer t const account = ""; const accountKey = ""; // Use StorageSharedKeyCredential with storage account and account key - // StorageSharedKeyCredential is only avaiable in Node.js runtime, not in browsers + // StorageSharedKeyCredential is only available in Node.js runtime, not in browsers const sharedKeyCredential = new StorageSharedKeyCredential(account, accountKey); const blobServiceClient = new BlobServiceClient( `https://${account}.blob.core.windows.net`, @@ -157,9 +145,9 @@ setLogLevel("info"); More code samples: -- [Blob Storage Samples (JavaScript)](https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/storage/storage-blob-changefeed/samples/javascript) -- [Blob Storage Samples (TypeScript)](https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/storage/storage-blob-changefeed/samples/typescript) -- [Blob Storage Test Cases](https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/storage/storage-blob-changefeed/test/) +- [Blob Storage Change Feed Samples (JavaScript)](https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/storage/storage-blob-changefeed/samples/javascript) +- [Blob Storage Change Feed Samples (TypeScript)](https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/storage/storage-blob-changefeed/samples/typescript) +- [Blob Storage Change Feed Test Cases](https://github.com/Azure/azure-sdk-for-js/tree/master/sdk/storage/storage-blob-changefeed/test/) ## Contributing diff --git a/sdk/storage/storage-blob-changefeed/review/storage-blob-change-feed.api.md b/sdk/storage/storage-blob-changefeed/review/storage-blob-change-feed.api.md deleted file mode 100644 index 6a7f4c6c3c9e..000000000000 --- a/sdk/storage/storage-blob-changefeed/review/storage-blob-change-feed.api.md +++ /dev/null @@ -1,91 +0,0 @@ -## API Report File for "@azure/storage-blob-changefeed" - -> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). - -```ts - -import { BlobServiceClient } from '@azure/storage-blob'; -import { PagedAsyncIterableIterator } from '@azure/core-paging'; - -// @public (undocumented) -export class BlobChangeFeedClient { - constructor(blobServiceClient: BlobServiceClient); - // (undocumented) - getChanges(options?: ChangeFeedGetChangesOptions): PagedAsyncIterableIterator; - } - -// @public (undocumented) -export interface BlobChangeFeedEvent { - // (undocumented) - data: BlobChangeFeedEventData; - // (undocumented) - dataVersion?: string; - // (undocumented) - eventTime: string; - // (undocumented) - eventType: BlobChangeFeedEventType; - // (undocumented) - id: string; - // (undocumented) - metadataVersion: string; - // (undocumented) - subject: string; - // (undocumented) - topic: string; -} - -// @public (undocumented) -export interface BlobChangeFeedEventData { - // (undocumented) - api: string; - // (undocumented) - blobType: BlobType; - // (undocumented) - clientRequestId: string; - // (undocumented) - contentLength: number; - // (undocumented) - contentType: string; - // (undocumented) - destinationUrl?: string; - // (undocumented) - eTag: string; - // (undocumented) - recursive?: string; - // (undocumented) - requestId: string; - // (undocumented) - sequencer: string; - // (undocumented) - sourceUrl?: string; - // (undocumented) - url: string; -} - -// @public (undocumented) -export class BlobChangeFeedEventPage { - constructor(); - // (undocumented) - continuationToken: string; - // (undocumented) - events: BlobChangeFeedEvent[]; -} - -// @public (undocumented) -export type BlobChangeFeedEventType = "BlobCreate" | "BlobDeleted"; - -// @public (undocumented) -export type BlobType = "BlockBlob" | "AppendBlob" | "PageBlob"; - -// @public (undocumented) -export interface ChangeFeedGetChangesOptions { - // (undocumented) - end?: Date; - // (undocumented) - start?: Date; -} - - -// (No @packageDocumentation comment for this package) - -``` diff --git a/sdk/storage/storage-blob-changefeed/src/AvroReaderFactory.ts b/sdk/storage/storage-blob-changefeed/src/AvroReaderFactory.ts index d2dc198ae591..59b59bd07233 100644 --- a/sdk/storage/storage-blob-changefeed/src/AvroReaderFactory.ts +++ b/sdk/storage/storage-blob-changefeed/src/AvroReaderFactory.ts @@ -1,16 +1,16 @@ import { AvroReadable, AvroReader } from "../../storage-internal-avro/src"; export class AvroReaderFactory { - public buildAvroReader(headerAndDataStream: AvroReadable): AvroReader; + public create(headerAndDataStream: AvroReadable): AvroReader; - public buildAvroReader( + public create( dataStream: AvroReadable, headerStream: AvroReadable, blockOffset: number, eventIndex: number ): AvroReader; - public buildAvroReader( + public create( dataStream: AvroReadable, headerStream?: AvroReadable, blockOffset?: number, diff --git a/sdk/storage/storage-blob-changefeed/src/BlobChangeFeedClient.ts b/sdk/storage/storage-blob-changefeed/src/BlobChangeFeedClient.ts index 7b6f0f56a629..d42d96405d02 100644 --- a/sdk/storage/storage-blob-changefeed/src/BlobChangeFeedClient.ts +++ b/sdk/storage/storage-blob-changefeed/src/BlobChangeFeedClient.ts @@ -3,7 +3,7 @@ import { PagedAsyncIterableIterator, PageSettings } from "@azure/core-paging"; import { BlobChangeFeedEvent } from "./models/BlobChangeFeedEvent"; import { ChangeFeedFactory } from "./ChangeFeedFactory"; import { ChangeFeed } from "./ChangeFeed"; -import { CHANGE_FEED_DEFAULT_PAGE_SIZE } from "./utils/constants"; +import { CHANGE_FEED_MAX_PAGE_SIZE } from "./utils/constants"; export interface ChangeFeedGetChangesOptions { start?: Date; @@ -65,7 +65,7 @@ export class BlobChangeFeedClient { private async *getChange( options: ChangeFeedGetChangesOptions = {} ): AsyncIterableIterator { - const changeFeed: ChangeFeed = await this._changeFeedFactory.buildChangeFeed( + const changeFeed: ChangeFeed = await this._changeFeedFactory.create( this._blobServiceClient, undefined, options.start, @@ -88,15 +88,15 @@ export class BlobChangeFeedClient { maxPageSize?: number, options: ChangeFeedGetChangesOptions = {} ): AsyncIterableIterator { - const changeFeed: ChangeFeed = await this._changeFeedFactory.buildChangeFeed( + const changeFeed: ChangeFeed = await this._changeFeedFactory.create( this._blobServiceClient, continuationToken, options.start, options.end ); - if (!maxPageSize || maxPageSize > CHANGE_FEED_DEFAULT_PAGE_SIZE) { - maxPageSize = CHANGE_FEED_DEFAULT_PAGE_SIZE; + if (!maxPageSize || maxPageSize > CHANGE_FEED_MAX_PAGE_SIZE) { + maxPageSize = CHANGE_FEED_MAX_PAGE_SIZE; } while (changeFeed.hasNext()) { let eventPage = new BlobChangeFeedEventPage(); diff --git a/sdk/storage/storage-blob-changefeed/src/ChangeFeed.ts b/sdk/storage/storage-blob-changefeed/src/ChangeFeed.ts index 17ced578ada9..e68643e46693 100644 --- a/sdk/storage/storage-blob-changefeed/src/ChangeFeed.ts +++ b/sdk/storage/storage-blob-changefeed/src/ChangeFeed.ts @@ -99,7 +99,7 @@ export class ChangeFeed { return { cursorVersion: 1, - urlHash: hashString(getURI(this._containerClient!.url)!), + urlHash: hashString(getURI(this._containerClient!.url)), endTime: this._endTime?.toJSON(), currentSegmentCursor: this._currentSegment!.getCursor() }; @@ -117,7 +117,7 @@ export class ChangeFeed { // If the current segment is completed, remove it if (this._segments.length > 0) { - this._currentSegment = await this._segmentFactory!.buildSegment( + this._currentSegment = await this._segmentFactory!.create( this._containerClient!, this._segments.shift()! ); @@ -133,7 +133,7 @@ export class ChangeFeed { ); if (this._segments.length > 0) { - this._currentSegment = await this._segmentFactory!.buildSegment( + this._currentSegment = await this._segmentFactory!.create( this._containerClient!, this._segments.shift()! ); diff --git a/sdk/storage/storage-blob-changefeed/src/ChangeFeedFactory.ts b/sdk/storage/storage-blob-changefeed/src/ChangeFeedFactory.ts index f98a67f73f6c..9c28ccc55b1c 100644 --- a/sdk/storage/storage-blob-changefeed/src/ChangeFeedFactory.ts +++ b/sdk/storage/storage-blob-changefeed/src/ChangeFeedFactory.ts @@ -38,7 +38,7 @@ export class ChangeFeedFactory { } } - public async buildChangeFeed( + public async create( blobServiceClient: BlobServiceClient, continuationToken?: string, startTime?: Date, @@ -107,7 +107,7 @@ export class ChangeFeedFactory { if (segments.length === 0) { return new ChangeFeed(); } - const currentSegment: Segment = await this._segmentFactory.buildSegment( + const currentSegment: Segment = await this._segmentFactory.create( containerClient, segments.shift()!, cursor?.currentSegmentCursor @@ -126,7 +126,7 @@ export class ChangeFeedFactory { } private static validateCursor(containerClient: ContainerClient, cursor: ChangeFeedCursor): void { - if (hashString(getURI(containerClient.url)!) !== cursor.urlHash) { + if (hashString(getURI(containerClient.url)) !== cursor.urlHash) { throw new Error("Cursor URL does not match container URL."); } } diff --git a/sdk/storage/storage-blob-changefeed/src/ChunkFactory.ts b/sdk/storage/storage-blob-changefeed/src/ChunkFactory.ts index faa86327ae03..9f98201ebcf3 100644 --- a/sdk/storage/storage-blob-changefeed/src/ChunkFactory.ts +++ b/sdk/storage/storage-blob-changefeed/src/ChunkFactory.ts @@ -11,7 +11,7 @@ export class ChunkFactory { this._avroReaderFactory = avroReaderFactory; } - public async buildChunk( + public async create( containerClient: ContainerClient, chunkPath: string, blockOffset?: number, @@ -28,14 +28,14 @@ export class ChunkFactory { if (blockOffset !== 0) { const headerDownloadRes = await blobClient.download(0); const headerStream = bodyToAvroReadable(headerDownloadRes); - avroReader = this._avroReaderFactory.buildAvroReader( + avroReader = this._avroReaderFactory.create( dataStream, headerStream, blockOffset, eventIndex ); } else { - avroReader = this._avroReaderFactory.buildAvroReader(dataStream); + avroReader = this._avroReaderFactory.create(dataStream); } return new Chunk(avroReader, blockOffset, eventIndex); diff --git a/sdk/storage/storage-blob-changefeed/src/SegmentFactory.ts b/sdk/storage/storage-blob-changefeed/src/SegmentFactory.ts index de56bc1f9f85..58a77fe52045 100644 --- a/sdk/storage/storage-blob-changefeed/src/SegmentFactory.ts +++ b/sdk/storage/storage-blob-changefeed/src/SegmentFactory.ts @@ -23,7 +23,7 @@ export class SegmentFactory { this._shardFactory = shardFactory; } - public async buildSegment( + public async create( containerClient: ContainerClient, manifestPath: string, cursor?: SegmentCursor @@ -44,7 +44,7 @@ export class SegmentFactory { const containerPrefixLength = CHANGE_FEED_CONTAINER_NAME.length + 1; // "$blobchangefeed/" for (const shardPath of segmentManifest.chunkFilePaths) { - const shard: Shard = await this._shardFactory.buildShard( + const shard: Shard = await this._shardFactory.create( containerClient, shardPath.substring(containerPrefixLength), cursor?.shardCursors[i++] diff --git a/sdk/storage/storage-blob-changefeed/src/Shard.ts b/sdk/storage/storage-blob-changefeed/src/Shard.ts index 286b7cb56c6a..aee0a6be31e1 100644 --- a/sdk/storage/storage-blob-changefeed/src/Shard.ts +++ b/sdk/storage/storage-blob-changefeed/src/Shard.ts @@ -40,7 +40,7 @@ export class Shard { // Remove currentChunk if it doesn't have more events. if (!this._currentChunk.hasNext() && this._chunks.length > 0) { - this._currentChunk = await this._chunkFactory.buildChunk( + this._currentChunk = await this._chunkFactory.create( this._containerClient, this._chunks.shift()! ); diff --git a/sdk/storage/storage-blob-changefeed/src/ShardFactory.ts b/sdk/storage/storage-blob-changefeed/src/ShardFactory.ts index 04027988962b..069dd94b3c59 100644 --- a/sdk/storage/storage-blob-changefeed/src/ShardFactory.ts +++ b/sdk/storage/storage-blob-changefeed/src/ShardFactory.ts @@ -10,7 +10,7 @@ export class ShardFactory { this._chunkFactory = chunkFactory; } - public async buildShard( + public async create( containerClient: ContainerClient, shardPath: string, shardCursor?: ShardCursor @@ -37,7 +37,7 @@ export class ShardFactory { chunks.splice(0, chunkIndex); } - const currentChunk = await this._chunkFactory.buildChunk( + const currentChunk = await this._chunkFactory.create( containerClient, chunks.shift()!, blockOffset, diff --git a/sdk/storage/storage-blob-changefeed/src/utils/constants.ts b/sdk/storage/storage-blob-changefeed/src/utils/constants.ts index 9838de65066c..5b4a0fae3965 100644 --- a/sdk/storage/storage-blob-changefeed/src/utils/constants.ts +++ b/sdk/storage/storage-blob-changefeed/src/utils/constants.ts @@ -1,6 +1,6 @@ export const CHANGE_FEED_CONTAINER_NAME: string = "$blobchangefeed"; export const CHANGE_FEED_META_SEGMENT_PATH: string = "meta/segments.json"; -export const CHANGE_FEED_DEFAULT_PAGE_SIZE: number = 5000; // align with rest API list operations +export const CHANGE_FEED_MAX_PAGE_SIZE: number = 5000; // align with rest API list operations export const CHANGE_FEED_STATUS_FINALIZED: string = "Finalized"; export const CHANGE_FEED_SEGMENT_PREFIX: string = "idx/segments/"; export const CHANGE_FEED_INITIALIZATION_SEGMENT: string = "1601"; diff --git a/sdk/storage/storage-blob-changefeed/src/utils/utils.common.ts b/sdk/storage/storage-blob-changefeed/src/utils/utils.common.ts index 182253e510ad..33908d6c3b7b 100644 --- a/sdk/storage/storage-blob-changefeed/src/utils/utils.common.ts +++ b/sdk/storage/storage-blob-changefeed/src/utils/utils.common.ts @@ -24,7 +24,7 @@ export function floorToNearestHour(date: Date | undefined): Date | undefined { * @param {string} url Source URL string * @returns {(string | undefined)} */ -export function getURI(url: string): string | undefined { +export function getURI(url: string): string { const urlParsed = URLBuilder.parse(url); return `${urlParsed.getHost()}${urlParsed.getPort()}${urlParsed.getPath()}`; } diff --git a/sdk/storage/storage-blob-changefeed/test/changefeed.spec.ts b/sdk/storage/storage-blob-changefeed/test/changefeed.spec.ts index af6ac21f08e0..e6cfcd321587 100644 --- a/sdk/storage/storage-blob-changefeed/test/changefeed.spec.ts +++ b/sdk/storage/storage-blob-changefeed/test/changefeed.spec.ts @@ -84,7 +84,7 @@ describe("Change Feed", async () => { const segmentIter = listTwoArray(segmentsIn2019, segmentsIn2020); for (let i = 0; i < segmentCount; i++) { segmentStubs.push(sinon.createStubInstance(Segment)); - segmentFactoryStub.buildSegment + segmentFactoryStub.create .withArgs(sinon.match.any, (await segmentIter.next()).value.name) .resolves(segmentStubs[i] as any); } @@ -103,7 +103,7 @@ describe("Change Feed", async () => { it("no valid years in change feed container", async () => { const yearPaths = [{ kind: "prefix", name: "idx/segments/1601/" }]; containerClientStub.listBlobsByHierarchy.withArgs("/").returns(fakeList(yearPaths) as any); - const changeFeed = await changeFeedFactory.buildChangeFeed(serviceClientStub as any); + const changeFeed = await changeFeedFactory.create(serviceClientStub as any); assert.ok(!changeFeed.hasNext()); }); @@ -113,7 +113,7 @@ describe("Change Feed", async () => { { kind: "prefix", name: "idx/segments/2019/" } ]; containerClientStub.listBlobsByHierarchy.withArgs("/").returns(fakeList(yearPaths) as any); - const changeFeed = await changeFeedFactory.buildChangeFeed( + const changeFeed = await changeFeedFactory.create( serviceClientStub as any, undefined, new Date(Date.UTC(2020, 0)) @@ -134,7 +134,7 @@ describe("Change Feed", async () => { ]; containerClientStub.listBlobsFlat.returns(fakeList(segments) as any); - const changeFeed = await changeFeedFactory.buildChangeFeed( + const changeFeed = await changeFeedFactory.create( serviceClientStub as any, undefined, new Date(Date.UTC(2019, 5)) @@ -143,7 +143,7 @@ describe("Change Feed", async () => { }); it("getChange", async () => { - const changeFeed = await changeFeedFactory.buildChangeFeed( + const changeFeed = await changeFeedFactory.create( serviceClientStub as any, undefined, new Date(Date.UTC(2019, 0)) @@ -179,7 +179,7 @@ describe("Change Feed", async () => { it("with start and end time", async () => { // no valid segment between start and end - const changeFeed = await changeFeedFactory.buildChangeFeed( + const changeFeed = await changeFeedFactory.create( serviceClientStub as any, undefined, new Date(Date.UTC(2019, 2, 2, 21)), @@ -188,7 +188,7 @@ describe("Change Feed", async () => { assert.ok(!changeFeed.hasNext()); // end earlier than lastConsumable - const changeFeed2 = await changeFeedFactory.buildChangeFeed( + const changeFeed2 = await changeFeedFactory.create( serviceClientStub as any, undefined, new Date(Date.UTC(2019, 3, 3, 22)), @@ -204,7 +204,7 @@ describe("Change Feed", async () => { assert.equal(event2, undefined); //end later than lastConsumable - const changeFeed3 = await changeFeedFactory.buildChangeFeed( + const changeFeed3 = await changeFeedFactory.create( serviceClientStub as any, undefined, lastConsumable, @@ -214,7 +214,7 @@ describe("Change Feed", async () => { }); it("with continuation token", async () => { - const changeFeed = await changeFeedFactory.buildChangeFeed( + const changeFeed = await changeFeedFactory.create( serviceClientStub as any, undefined, new Date(Date.UTC(2020, 2, 2, 20)) @@ -224,7 +224,7 @@ describe("Change Feed", async () => { const containerUri = "https://account.blob.core.windows.net/$blobchangefeed"; (containerClientStub as any).url = containerUri; const cursor = changeFeed.getCursor(); - assert.deepStrictEqual(cursor.urlHash, hashString(getURI(containerUri)!)); + assert.deepStrictEqual(cursor.urlHash, hashString(getURI(containerUri))); segmentStubs[3].getCursor.returns({ shardCursors: [], @@ -232,7 +232,7 @@ describe("Change Feed", async () => { segmentTime: new Date(Date.UTC(2020, 2, 2, 20)).toJSON() }); const continuation = JSON.stringify(changeFeed.getCursor()); - const changeFeed2 = await changeFeedFactory.buildChangeFeed( + const changeFeed2 = await changeFeedFactory.create( serviceClientStub as any, continuation ); @@ -244,7 +244,7 @@ describe("Change Feed", async () => { sinon.stub(segmentStubs[4], "finalized").value(true); segmentStubs[3].hasNext.returns(false); segmentStubs[3].getChange.resolves(undefined); - const changeFeed3 = await changeFeedFactory.buildChangeFeed( + const changeFeed3 = await changeFeedFactory.create( serviceClientStub as any, continuation ); diff --git a/sdk/storage/storage-blob-changefeed/test/segment.spec.ts b/sdk/storage/storage-blob-changefeed/test/segment.spec.ts index ab99ed1ed108..657a527ec7f7 100644 --- a/sdk/storage/storage-blob-changefeed/test/segment.spec.ts +++ b/sdk/storage/storage-blob-changefeed/test/segment.spec.ts @@ -29,7 +29,7 @@ describe("Shard", async () => { shardStubs = []; for (let i = 0; i < shardCount; i++) { shardStubs.push(sinon.createStubInstance(Shard)); - shardFactoryStub.buildShard.onCall(i).returns(shardStubs[i]); + shardFactoryStub.create.onCall(i).returns(shardStubs[i]); shardStubs[i].hasNext.returns(true); shardStubs[i].getChange.returns(i); @@ -42,7 +42,7 @@ describe("Shard", async () => { it("getChange round robin in shards", async () => { const segmentFactory = new SegmentFactory(shardFactoryStub); - const segment = await segmentFactory.buildSegment(containerClientStub, manifestPath); + const segment = await segmentFactory.create(containerClientStub, manifestPath); assert.ok(segment.hasNext()); assert.equal(segment.dateTime.getTime(), dateTime.getTime()); assert.ok(segment.finalized); @@ -80,7 +80,7 @@ describe("Shard", async () => { it("init with non-zero shardIndex", async () => { const shardIndex = 1; const segmentFactory = new SegmentFactory(shardFactoryStub); - const segment = await segmentFactory.buildSegment(containerClientStub, manifestPath, { + const segment = await segmentFactory.create(containerClientStub, manifestPath, { shardIndex, shardCursors: [] } as any); diff --git a/sdk/storage/storage-blob-changefeed/test/shard.spec.ts b/sdk/storage/storage-blob-changefeed/test/shard.spec.ts index 2613e54aeb8d..f001b69fe2d8 100644 --- a/sdk/storage/storage-blob-changefeed/test/shard.spec.ts +++ b/sdk/storage/storage-blob-changefeed/test/shard.spec.ts @@ -22,7 +22,7 @@ describe("Shard", async () => { containerClientSub = sinon.createStubInstance(ContainerClient); containerClientSub.listBlobsFlat.callsFake(fakeListBlobsFlat); chunkFactoryStub = sinon.createStubInstance(ChunkFactory); - chunkFactoryStub.buildChunk.returns(chunkStub); + chunkFactoryStub.create.returns(chunkStub); }); afterEach(() => { @@ -40,9 +40,9 @@ describe("Shard", async () => { // build shard correctly const shardFactory = new ShardFactory(chunkFactoryStub as any); - const shard = await shardFactory.buildShard(containerClientSub as any, shardPath, shardCursor); + const shard = await shardFactory.create(containerClientSub as any, shardPath, shardCursor); assert.ok( - chunkFactoryStub.buildChunk.calledWith( + chunkFactoryStub.create.calledWith( containerClientSub, `${shardPath}000${chunkIndex}.avro` ) @@ -56,11 +56,11 @@ describe("Shard", async () => { nextChunkStub.hasNext.returns(true); const event = { id: "a" }; nextChunkStub.getChange.resolves(event as any); - chunkFactoryStub.buildChunk.returns(nextChunkStub); + chunkFactoryStub.create.returns(nextChunkStub); const change = await shard.getChange(); assert.ok( - chunkFactoryStub.buildChunk.calledWith( + chunkFactoryStub.create.calledWith( containerClientSub, `${shardPath}000${chunkIndex + 1}.avro` ) @@ -74,11 +74,11 @@ describe("Shard", async () => { nextChunkStub.getChange.resolves(undefined); const lastChunkStub = sinon.createStubInstance(Chunk); lastChunkStub.hasNext.returns(false); - chunkFactoryStub.buildChunk.returns(lastChunkStub); + chunkFactoryStub.create.returns(lastChunkStub); const change2 = await shard.getChange(); assert.ok( - chunkFactoryStub.buildChunk.calledWith( + chunkFactoryStub.create.calledWith( containerClientSub, `${shardPath}000${chunkIndex + 2}.avro` )