@azure/storage-blob-changefeed 12.0.0-alpha.20211217.2 → 12.0.0-alpha.20220104.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (28) hide show
  1. package/dist/index.js +47 -47
  2. package/dist/index.js.map +1 -1
  3. package/dist-esm/storage-blob-changefeed/src/BlobChangeFeedClient.js +4 -4
  4. package/dist-esm/storage-blob-changefeed/src/BlobChangeFeedClient.js.map +1 -1
  5. package/dist-esm/storage-blob-changefeed/src/ChangeFeed.js +8 -8
  6. package/dist-esm/storage-blob-changefeed/src/ChangeFeed.js.map +1 -1
  7. package/dist-esm/storage-blob-changefeed/src/ChangeFeedFactory.js +7 -7
  8. package/dist-esm/storage-blob-changefeed/src/ChangeFeedFactory.js.map +1 -1
  9. package/dist-esm/storage-blob-changefeed/src/ChunkFactory.js +1 -1
  10. package/dist-esm/storage-blob-changefeed/src/ChunkFactory.js.map +1 -1
  11. package/dist-esm/storage-blob-changefeed/src/LazyLoadingBlobStream.js +5 -5
  12. package/dist-esm/storage-blob-changefeed/src/LazyLoadingBlobStream.js.map +1 -1
  13. package/dist-esm/storage-blob-changefeed/src/Segment.js +3 -3
  14. package/dist-esm/storage-blob-changefeed/src/Segment.js.map +1 -1
  15. package/dist-esm/storage-blob-changefeed/src/SegmentFactory.js +3 -3
  16. package/dist-esm/storage-blob-changefeed/src/SegmentFactory.js.map +1 -1
  17. package/dist-esm/storage-blob-changefeed/src/Shard.js +3 -3
  18. package/dist-esm/storage-blob-changefeed/src/Shard.js.map +1 -1
  19. package/dist-esm/storage-blob-changefeed/src/ShardFactory.js +3 -3
  20. package/dist-esm/storage-blob-changefeed/src/ShardFactory.js.map +1 -1
  21. package/dist-esm/storage-blob-changefeed/src/utils/tracing.js +1 -1
  22. package/dist-esm/storage-blob-changefeed/src/utils/tracing.js.map +1 -1
  23. package/dist-esm/storage-blob-changefeed/src/utils/utils.common.js +4 -4
  24. package/dist-esm/storage-blob-changefeed/src/utils/utils.common.js.map +1 -1
  25. package/dist-esm/storage-internal-avro/src/AvroParser.js.map +1 -1
  26. package/dist-esm/storage-internal-avro/src/AvroReader.js +8 -8
  27. package/dist-esm/storage-internal-avro/src/AvroReader.js.map +1 -1
  28. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -27,7 +27,7 @@ const CHANGE_FEED_CHUNK_BLOCK_DOWNLOAD_SIZE = 16 * 1024 * 1024;
27
27
  */
28
28
  const createSpan = coreTracing.createSpanFunction({
29
29
  packagePrefix: "Azure.Storage.Blob.Changefeed",
30
- namespace: "Microsoft.Storage"
30
+ namespace: "Microsoft.Storage",
31
31
  });
32
32
 
33
33
  // Copyright (c) Microsoft Corporation.
@@ -62,7 +62,7 @@ async function getYearsPaths(containerClient, options = {}) {
62
62
  for (var _b = tslib.__asyncValues(containerClient.listBlobsByHierarchy("/", {
63
63
  abortSignal: options.abortSignal,
64
64
  tracingOptions: updatedOptions.tracingOptions,
65
- prefix: CHANGE_FEED_SEGMENT_PREFIX
65
+ prefix: CHANGE_FEED_SEGMENT_PREFIX,
66
66
  })), _c; _c = await _b.next(), !_c.done;) {
67
67
  const item = _c.value;
68
68
  if (item.kind === "prefix" && !item.name.includes(CHANGE_FEED_INITIALIZATION_SEGMENT)) {
@@ -83,7 +83,7 @@ async function getYearsPaths(containerClient, options = {}) {
83
83
  catch (e) {
84
84
  span.setStatus({
85
85
  code: coreTracing.SpanStatusCode.ERROR,
86
- message: e.message
86
+ message: e.message,
87
87
  });
88
88
  throw e;
89
89
  }
@@ -105,7 +105,7 @@ async function getSegmentsInYear(containerClient, year, startTime, endTime, opti
105
105
  for (var _b = tslib.__asyncValues(containerClient.listBlobsFlat({
106
106
  prefix,
107
107
  abortSignal: options.abortSignal,
108
- tracingOptions: updatedOptions.tracingOptions
108
+ tracingOptions: updatedOptions.tracingOptions,
109
109
  })), _c; _c = await _b.next(), !_c.done;) {
110
110
  const item = _c.value;
111
111
  const segmentTime = parseDateFromSegmentPath(item.name);
@@ -127,7 +127,7 @@ async function getSegmentsInYear(containerClient, year, startTime, endTime, opti
127
127
  catch (e) {
128
128
  span.setStatus({
129
129
  code: coreTracing.SpanStatusCode.ERROR,
130
- message: e.message
130
+ message: e.message,
131
131
  });
132
132
  throw e;
133
133
  }
@@ -189,7 +189,7 @@ class ChangeFeed {
189
189
  if (this.segments.length > 0) {
190
190
  this.currentSegment = await this.segmentFactory.create(this.containerClient, this.segments.shift(), undefined, {
191
191
  abortSignal: options.abortSignal,
192
- tracingOptions: updatedOptions.tracingOptions
192
+ tracingOptions: updatedOptions.tracingOptions,
193
193
  });
194
194
  }
195
195
  // If segments is empty, refill it
@@ -197,12 +197,12 @@ class ChangeFeed {
197
197
  const year = this.years.shift();
198
198
  this.segments = await getSegmentsInYear(this.containerClient, year, this.startTime, this.end, {
199
199
  abortSignal: options.abortSignal,
200
- tracingOptions: updatedOptions.tracingOptions
200
+ tracingOptions: updatedOptions.tracingOptions,
201
201
  });
202
202
  if (this.segments.length > 0) {
203
203
  this.currentSegment = await this.segmentFactory.create(this.containerClient, this.segments.shift(), undefined, {
204
204
  abortSignal: options.abortSignal,
205
- tracingOptions: updatedOptions.tracingOptions
205
+ tracingOptions: updatedOptions.tracingOptions,
206
206
  });
207
207
  }
208
208
  else {
@@ -213,7 +213,7 @@ class ChangeFeed {
213
213
  catch (e) {
214
214
  span.setStatus({
215
215
  code: coreTracing.SpanStatusCode.ERROR,
216
- message: e.message
216
+ message: e.message,
217
217
  });
218
218
  throw e;
219
219
  }
@@ -238,11 +238,11 @@ class ChangeFeed {
238
238
  while (event === undefined && this.hasNext()) {
239
239
  event = await this.currentSegment.getChange({
240
240
  abortSignal: options.abortSignal,
241
- tracingOptions: updatedOptions.tracingOptions
241
+ tracingOptions: updatedOptions.tracingOptions,
242
242
  });
243
243
  await this.advanceSegmentIfNecessary({
244
244
  abortSignal: options.abortSignal,
245
- tracingOptions: updatedOptions.tracingOptions
245
+ tracingOptions: updatedOptions.tracingOptions,
246
246
  });
247
247
  }
248
248
  return event;
@@ -250,7 +250,7 @@ class ChangeFeed {
250
250
  catch (e) {
251
251
  span.setStatus({
252
252
  code: coreTracing.SpanStatusCode.ERROR,
253
- message: e.message
253
+ message: e.message,
254
254
  });
255
255
  throw e;
256
256
  }
@@ -267,7 +267,7 @@ class ChangeFeed {
267
267
  CursorVersion: 1,
268
268
  UrlHost: getHost(this.containerClient.url),
269
269
  EndTime: (_a = this.endTime) === null || _a === void 0 ? void 0 : _a.toJSON(),
270
- CurrentSegmentCursor: this.currentSegment.getCursor()
270
+ CurrentSegmentCursor: this.currentSegment.getCursor(),
271
271
  };
272
272
  }
273
273
  }
@@ -626,7 +626,7 @@ class AvroReader {
626
626
  }
627
627
  async initialize(options = {}) {
628
628
  const header = await AvroParser.readFixedBytes(this._headerStream, AVRO_INIT_BYTES.length, {
629
- abortSignal: options.abortSignal
629
+ abortSignal: options.abortSignal,
630
630
  });
631
631
  if (!arraysEqual(header, AVRO_INIT_BYTES)) {
632
632
  throw new Error("Stream is not an Avro file.");
@@ -634,7 +634,7 @@ class AvroReader {
634
634
  // File metadata is written as if defined by the following map schema:
635
635
  // { "type": "map", "values": "bytes"}
636
636
  this._metadata = await AvroParser.readMap(this._headerStream, AvroParser.readString, {
637
- abortSignal: options.abortSignal
637
+ abortSignal: options.abortSignal,
638
638
  });
639
639
  // Validate codec
640
640
  const codec = this._metadata[AVRO_CODEC_KEY];
@@ -643,7 +643,7 @@ class AvroReader {
643
643
  }
644
644
  // The 16-byte, randomly-generated sync marker for this file.
645
645
  this._syncMarker = await AvroParser.readFixedBytes(this._headerStream, AVRO_SYNC_MARKER_SIZE, {
646
- abortSignal: options.abortSignal
646
+ abortSignal: options.abortSignal,
647
647
  });
648
648
  // Parse the schema
649
649
  const schema = JSON.parse(this._metadata[AVRO_SCHEMA_KEY]);
@@ -652,7 +652,7 @@ class AvroReader {
652
652
  this._blockOffset = this._initialBlockOffset + this._dataStream.position;
653
653
  }
654
654
  this._itemsRemainingInBlock = await AvroParser.readLong(this._dataStream, {
655
- abortSignal: options.abortSignal
655
+ abortSignal: options.abortSignal,
656
656
  });
657
657
  // skip block length
658
658
  await AvroParser.readLong(this._dataStream, { abortSignal: options.abortSignal });
@@ -674,13 +674,13 @@ class AvroReader {
674
674
  }
675
675
  while (this.hasNext()) {
676
676
  const result = yield tslib.__await(this._itemType.read(this._dataStream, {
677
- abortSignal: options.abortSignal
677
+ abortSignal: options.abortSignal,
678
678
  }));
679
679
  this._itemsRemainingInBlock--;
680
680
  this._objectIndex++;
681
681
  if (this._itemsRemainingInBlock == 0) {
682
682
  const marker = yield tslib.__await(AvroParser.readFixedBytes(this._dataStream, AVRO_SYNC_MARKER_SIZE, {
683
- abortSignal: options.abortSignal
683
+ abortSignal: options.abortSignal,
684
684
  }));
685
685
  this._blockOffset = this._initialBlockOffset + this._dataStream.position;
686
686
  this._objectIndex = 0;
@@ -689,7 +689,7 @@ class AvroReader {
689
689
  }
690
690
  try {
691
691
  this._itemsRemainingInBlock = yield tslib.__await(AvroParser.readLong(this._dataStream, {
692
- abortSignal: options.abortSignal
692
+ abortSignal: options.abortSignal,
693
693
  }));
694
694
  }
695
695
  catch (err) {
@@ -848,7 +848,7 @@ class Segment {
848
848
  const currentShard = this.shards[this.shardIndex];
849
849
  event = await currentShard.getChange({
850
850
  abortSignal: options.abortSignal,
851
- tracingOptions: updatedOptions.tracingOptions
851
+ tracingOptions: updatedOptions.tracingOptions,
852
852
  });
853
853
  if (!currentShard.hasNext()) {
854
854
  this.shardDone[this.shardIndex] = true;
@@ -862,7 +862,7 @@ class Segment {
862
862
  catch (e) {
863
863
  span.setStatus({
864
864
  code: coreTracing.SpanStatusCode.ERROR,
865
- message: e.message
865
+ message: e.message,
866
866
  });
867
867
  throw e;
868
868
  }
@@ -881,7 +881,7 @@ class Segment {
881
881
  return {
882
882
  SegmentPath: this.manifestPath,
883
883
  ShardCursors: shardCursors,
884
- CurrentShardPath: this.shards[this.shardIndex].shardPath
884
+ CurrentShardPath: this.shards[this.shardIndex].shardPath,
885
885
  };
886
886
  }
887
887
  }
@@ -899,7 +899,7 @@ class SegmentFactory {
899
899
  const blobClient = containerClient.getBlobClient(manifestPath);
900
900
  const blobDownloadRes = await blobClient.download(undefined, undefined, {
901
901
  abortSignal: options.abortSignal,
902
- tracingOptions: updatedOptions.tracingOptions
902
+ tracingOptions: updatedOptions.tracingOptions,
903
903
  });
904
904
  const blobContent = await bodyToString(blobDownloadRes);
905
905
  const segmentManifest = JSON.parse(blobContent);
@@ -909,7 +909,7 @@ class SegmentFactory {
909
909
  const shardCursor = cursor === null || cursor === void 0 ? void 0 : cursor.ShardCursors.find((x) => x.CurrentChunkPath.startsWith(shardPathSubStr));
910
910
  const shard = await this.shardFactory.create(containerClient, shardPathSubStr, shardCursor, {
911
911
  abortSignal: options.abortSignal,
912
- tracingOptions: updatedOptions.tracingOptions
912
+ tracingOptions: updatedOptions.tracingOptions,
913
913
  });
914
914
  if (shard.hasNext()) {
915
915
  shards.push(shard);
@@ -927,7 +927,7 @@ class SegmentFactory {
927
927
  catch (e) {
928
928
  span.setStatus({
929
929
  code: coreTracing.SpanStatusCode.ERROR,
930
- message: e.message
930
+ message: e.message,
931
931
  });
932
932
  throw e;
933
933
  }
@@ -959,7 +959,7 @@ class Shard {
959
959
  if (!this.currentChunk.hasNext() && this.chunks.length > 0) {
960
960
  this.currentChunk = await this.chunkFactory.create(this.containerClient, this.chunks.shift(), undefined, undefined, {
961
961
  abortSignal: options.abortSignal,
962
- tracingOptions: updatedOptions.tracingOptions
962
+ tracingOptions: updatedOptions.tracingOptions,
963
963
  });
964
964
  }
965
965
  }
@@ -968,7 +968,7 @@ class Shard {
968
968
  catch (e) {
969
969
  span.setStatus({
970
970
  code: coreTracing.SpanStatusCode.ERROR,
971
- message: e.message
971
+ message: e.message,
972
972
  });
973
973
  throw e;
974
974
  }
@@ -982,7 +982,7 @@ class Shard {
982
982
  : {
983
983
  CurrentChunkPath: this.currentChunk.chunkPath,
984
984
  BlockOffset: this.currentChunk.blockOffset,
985
- EventIndex: this.currentChunk.eventIndex
985
+ EventIndex: this.currentChunk.eventIndex,
986
986
  };
987
987
  }
988
988
  }
@@ -1003,7 +1003,7 @@ class ShardFactory {
1003
1003
  for (var _b = tslib.__asyncValues(containerClient.listBlobsFlat({
1004
1004
  prefix: shardPath,
1005
1005
  abortSignal: options.abortSignal,
1006
- tracingOptions: updatedOptions.tracingOptions
1006
+ tracingOptions: updatedOptions.tracingOptions,
1007
1007
  })), _c; _c = await _b.next(), !_c.done;) {
1008
1008
  const blobItem = _c.value;
1009
1009
  chunks.push(blobItem.name);
@@ -1042,7 +1042,7 @@ class ShardFactory {
1042
1042
  }
1043
1043
  currentChunk = await this.chunkFactory.create(containerClient, chunks.shift(), blockOffset, eventIndex, {
1044
1044
  abortSignal: options.abortSignal,
1045
- tracingOptions: updatedOptions.tracingOptions
1045
+ tracingOptions: updatedOptions.tracingOptions,
1046
1046
  });
1047
1047
  }
1048
1048
  return new Shard(containerClient, this.chunkFactory, chunks, currentChunk, shardPath);
@@ -1050,7 +1050,7 @@ class ShardFactory {
1050
1050
  catch (e) {
1051
1051
  span.setStatus({
1052
1052
  code: coreTracing.SpanStatusCode.ERROR,
1053
- message: e.message
1053
+ message: e.message,
1054
1054
  });
1055
1055
  throw e;
1056
1056
  }
@@ -1126,7 +1126,7 @@ class ChunkFactory {
1126
1126
  avroReader = this.avroReaderFactory.create(dataStream);
1127
1127
  }
1128
1128
  return new Chunk(avroReader, blockOffset, eventIndex, chunkPath, {
1129
- abortSignal: options.abortSignal
1129
+ abortSignal: options.abortSignal,
1130
1130
  });
1131
1131
  }
1132
1132
  }
@@ -1170,7 +1170,7 @@ class LazyLoadingBlobStream extends stream.Readable {
1170
1170
  try {
1171
1171
  const properties = await this.blobClient.getProperties({
1172
1172
  abortSignal: options.abortSignal,
1173
- tracingOptions: updatedOptions.tracingOptions
1173
+ tracingOptions: updatedOptions.tracingOptions,
1174
1174
  });
1175
1175
  this.blobLength = properties.contentLength;
1176
1176
  this.lastDownloadBytes = Math.min(this.blockSize, this.blobLength - this.offset);
@@ -1180,14 +1180,14 @@ class LazyLoadingBlobStream extends stream.Readable {
1180
1180
  }
1181
1181
  this.lastDownloadData = await this.blobClient.downloadToBuffer(this.offset, this.lastDownloadBytes, {
1182
1182
  abortSignal: options.abortSignal,
1183
- tracingOptions: updatedOptions.tracingOptions
1183
+ tracingOptions: updatedOptions.tracingOptions,
1184
1184
  });
1185
1185
  this.offset += this.lastDownloadBytes;
1186
1186
  }
1187
1187
  catch (e) {
1188
1188
  span.setStatus({
1189
1189
  code: coreTracing.SpanStatusCode.ERROR,
1190
- message: e.message
1190
+ message: e.message,
1191
1191
  });
1192
1192
  throw e;
1193
1193
  }
@@ -1214,7 +1214,7 @@ class LazyLoadingBlobStream extends stream.Readable {
1214
1214
  if (this.lastDownloadData === undefined || ((_a = this.lastDownloadData) === null || _a === void 0 ? void 0 : _a.byteLength) === 0) {
1215
1215
  await this.downloadBlock({
1216
1216
  abortSignal: (_b = this.options) === null || _b === void 0 ? void 0 : _b.abortSignal,
1217
- tracingOptions: updatedOptions === null || updatedOptions === void 0 ? void 0 : updatedOptions.tracingOptions
1217
+ tracingOptions: updatedOptions === null || updatedOptions === void 0 ? void 0 : updatedOptions.tracingOptions,
1218
1218
  });
1219
1219
  }
1220
1220
  if ((_c = this.lastDownloadData) === null || _c === void 0 ? void 0 : _c.byteLength) {
@@ -1235,7 +1235,7 @@ class LazyLoadingBlobStream extends stream.Readable {
1235
1235
  catch (e) {
1236
1236
  span.setStatus({
1237
1237
  code: coreTracing.SpanStatusCode.ERROR,
1238
- message: e.message
1238
+ message: e.message,
1239
1239
  });
1240
1240
  this.emit("error", e);
1241
1241
  }
@@ -1290,7 +1290,7 @@ class ChangeFeedFactory {
1290
1290
  // Check if Change Feed has been enabled for this account.
1291
1291
  const changeFeedContainerExists = await containerClient.exists({
1292
1292
  abortSignal: options.abortSignal,
1293
- tracingOptions: updatedOptions.tracingOptions
1293
+ tracingOptions: updatedOptions.tracingOptions,
1294
1294
  });
1295
1295
  if (!changeFeedContainerExists) {
1296
1296
  throw new Error("Change Feed hasn't been enabled on this account, or is currently being enabled.");
@@ -1302,13 +1302,13 @@ class ChangeFeedFactory {
1302
1302
  const blobClient = containerClient.getBlobClient(CHANGE_FEED_META_SEGMENT_PATH);
1303
1303
  const blobDownloadRes = await blobClient.download(undefined, undefined, {
1304
1304
  abortSignal: options.abortSignal,
1305
- tracingOptions: updatedOptions.tracingOptions
1305
+ tracingOptions: updatedOptions.tracingOptions,
1306
1306
  });
1307
1307
  const lastConsumable = new Date(JSON.parse(await bodyToString(blobDownloadRes)).lastConsumable);
1308
1308
  // Get year paths
1309
1309
  const years = await getYearsPaths(containerClient, {
1310
1310
  abortSignal: options.abortSignal,
1311
- tracingOptions: updatedOptions.tracingOptions
1311
+ tracingOptions: updatedOptions.tracingOptions,
1312
1312
  });
1313
1313
  // Dequeue any years that occur before start time.
1314
1314
  if (options.start) {
@@ -1324,7 +1324,7 @@ class ChangeFeedFactory {
1324
1324
  while (segments.length === 0 && years.length !== 0) {
1325
1325
  segments = await getSegmentsInYear(containerClient, years.shift(), options.start, minDate(lastConsumable, options.end), {
1326
1326
  abortSignal: options.abortSignal,
1327
- tracingOptions: updatedOptions.tracingOptions
1327
+ tracingOptions: updatedOptions.tracingOptions,
1328
1328
  });
1329
1329
  }
1330
1330
  if (segments.length === 0) {
@@ -1332,14 +1332,14 @@ class ChangeFeedFactory {
1332
1332
  }
1333
1333
  const currentSegment = await this.segmentFactory.create(containerClient, segments.shift(), cursor === null || cursor === void 0 ? void 0 : cursor.CurrentSegmentCursor, {
1334
1334
  abortSignal: options.abortSignal,
1335
- tracingOptions: updatedOptions.tracingOptions
1335
+ tracingOptions: updatedOptions.tracingOptions,
1336
1336
  });
1337
1337
  return new ChangeFeed(containerClient, this.segmentFactory, years, segments, currentSegment, lastConsumable, options.start, options.end);
1338
1338
  }
1339
1339
  catch (e) {
1340
1340
  span.setStatus({
1341
1341
  code: coreTracing.SpanStatusCode.ERROR,
1342
- message: e.message
1342
+ message: e.message,
1343
1343
  });
1344
1344
  throw e;
1345
1345
  }
@@ -1427,7 +1427,7 @@ class BlobChangeFeedClient {
1427
1427
  while (changeFeed.hasNext()) {
1428
1428
  const event = yield tslib.__await(changeFeed.getChange({
1429
1429
  abortSignal: options.abortSignal,
1430
- tracingOptions: options.tracingOptions
1430
+ tracingOptions: options.tracingOptions,
1431
1431
  }));
1432
1432
  if (event) {
1433
1433
  yield yield tslib.__await(event);
@@ -1450,7 +1450,7 @@ class BlobChangeFeedClient {
1450
1450
  while (changeFeed.hasNext() && eventPage.events.length < maxPageSize) {
1451
1451
  const event = yield tslib.__await(changeFeed.getChange({
1452
1452
  abortSignal: options.abortSignal,
1453
- tracingOptions: options.tracingOptions
1453
+ tracingOptions: options.tracingOptions,
1454
1454
  }));
1455
1455
  if (event) {
1456
1456
  eventPage.events.push(event);
@@ -1560,7 +1560,7 @@ class BlobChangeFeedClient {
1560
1560
  */
1561
1561
  byPage: (settings = {}) => {
1562
1562
  return this.getPage(settings.continuationToken, settings.maxPageSize, options);
1563
- }
1563
+ },
1564
1564
  };
1565
1565
  }
1566
1566
  }