@azure/storage-blob-changefeed 12.0.0-alpha.20230320.1 → 12.0.0-alpha.20230418.1
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.
- package/dist/index.js +77 -56
- package/dist/index.js.map +1 -1
- package/dist-esm/storage-blob-changefeed/src/BlobChangeFeedClient.js +13 -13
- package/dist-esm/storage-blob-changefeed/src/BlobChangeFeedClient.js.map +1 -1
- package/dist-esm/storage-blob-changefeed/src/Chunk.js +6 -6
- package/dist-esm/storage-blob-changefeed/src/Chunk.js.map +1 -1
- package/dist-esm/storage-blob-changefeed/src/Segment.js +3 -3
- package/dist-esm/storage-blob-changefeed/src/Segment.js.map +1 -1
- package/dist-esm/storage-blob-changefeed/src/ShardFactory.js +13 -6
- package/dist-esm/storage-blob-changefeed/src/ShardFactory.js.map +1 -1
- package/dist-esm/storage-blob-changefeed/src/utils/utils.common.js +31 -17
- package/dist-esm/storage-blob-changefeed/src/utils/utils.common.js.map +1 -1
- package/dist-esm/storage-internal-avro/src/AvroReadableFromStream.js +5 -5
- package/dist-esm/storage-internal-avro/src/AvroReadableFromStream.js.map +1 -1
- package/dist-esm/storage-internal-avro/src/AvroReader.js +6 -6
- package/dist-esm/storage-internal-avro/src/AvroReader.js.map +1 -1
- package/package.json +2 -2
- package/types/3.1/storage-blob-changefeed/src/models/BlobChangeFeedEvent.d.ts +4 -4
- package/types/3.1/storage-blob-changefeed/test/utils/testutils.common.d.ts +1 -1
- package/types/latest/storage-blob-changefeed/src/models/BlobChangeFeedEvent.d.ts +4 -4
- package/types/latest/storage-blob-changefeed/src/models/BlobChangeFeedEvent.d.ts.map +1 -1
- package/types/latest/storage-blob-changefeed/test/utils/testutils.common.d.ts +1 -1
- package/types/latest/storage-blob-changefeed/test/utils/testutils.common.d.ts.map +1 -1
package/dist/index.js
CHANGED
|
@@ -55,25 +55,32 @@ function getHost(url) {
|
|
|
55
55
|
}
|
|
56
56
|
async function getYearsPaths(containerClient, options = {}) {
|
|
57
57
|
return tracingClient.withSpan("getYearsPaths", options, async (updatedOptions) => {
|
|
58
|
-
var e_1,
|
|
58
|
+
var _a, e_1, _b, _c;
|
|
59
59
|
const years = [];
|
|
60
60
|
try {
|
|
61
|
-
for (var
|
|
61
|
+
for (var _d = true, _e = tslib.__asyncValues(containerClient.listBlobsByHierarchy("/", {
|
|
62
62
|
abortSignal: options.abortSignal,
|
|
63
63
|
tracingOptions: updatedOptions.tracingOptions,
|
|
64
64
|
prefix: CHANGE_FEED_SEGMENT_PREFIX,
|
|
65
|
-
})),
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
65
|
+
})), _f; _f = await _e.next(), _a = _f.done, !_a;) {
|
|
66
|
+
_c = _f.value;
|
|
67
|
+
_d = false;
|
|
68
|
+
try {
|
|
69
|
+
const item = _c;
|
|
70
|
+
if (item.kind === "prefix" && !item.name.includes(CHANGE_FEED_INITIALIZATION_SEGMENT)) {
|
|
71
|
+
const yearStr = item.name.slice(CHANGE_FEED_SEGMENT_PREFIX.length, -1);
|
|
72
|
+
years.push(parseInt(yearStr));
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
finally {
|
|
76
|
+
_d = true;
|
|
70
77
|
}
|
|
71
78
|
}
|
|
72
79
|
}
|
|
73
80
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
74
81
|
finally {
|
|
75
82
|
try {
|
|
76
|
-
if (
|
|
83
|
+
if (!_d && !_a && (_b = _e.return)) await _b.call(_e);
|
|
77
84
|
}
|
|
78
85
|
finally { if (e_1) throw e_1.error; }
|
|
79
86
|
}
|
|
@@ -82,7 +89,7 @@ async function getYearsPaths(containerClient, options = {}) {
|
|
|
82
89
|
}
|
|
83
90
|
async function getSegmentsInYear(containerClient, year, startTime, endTime, options = {}) {
|
|
84
91
|
return tracingClient.withSpan("getSegmentsInYear", options, async (updatedOptions) => {
|
|
85
|
-
var e_2,
|
|
92
|
+
var _a, e_2, _b, _c;
|
|
86
93
|
const segments = [];
|
|
87
94
|
const yearBeginTime = new Date(Date.UTC(year, 0));
|
|
88
95
|
if (endTime && yearBeginTime >= endTime) {
|
|
@@ -90,23 +97,30 @@ async function getSegmentsInYear(containerClient, year, startTime, endTime, opti
|
|
|
90
97
|
}
|
|
91
98
|
const prefix = `${CHANGE_FEED_SEGMENT_PREFIX}${year}/`;
|
|
92
99
|
try {
|
|
93
|
-
for (var
|
|
100
|
+
for (var _d = true, _e = tslib.__asyncValues(containerClient.listBlobsFlat({
|
|
94
101
|
prefix,
|
|
95
102
|
abortSignal: options.abortSignal,
|
|
96
103
|
tracingOptions: updatedOptions.tracingOptions,
|
|
97
|
-
})),
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
104
|
+
})), _f; _f = await _e.next(), _a = _f.done, !_a;) {
|
|
105
|
+
_c = _f.value;
|
|
106
|
+
_d = false;
|
|
107
|
+
try {
|
|
108
|
+
const item = _c;
|
|
109
|
+
const segmentTime = parseDateFromSegmentPath(item.name);
|
|
110
|
+
if ((startTime && segmentTime < startTime) || (endTime && segmentTime >= endTime)) {
|
|
111
|
+
continue;
|
|
112
|
+
}
|
|
113
|
+
segments.push(item.name);
|
|
114
|
+
}
|
|
115
|
+
finally {
|
|
116
|
+
_d = true;
|
|
102
117
|
}
|
|
103
|
-
segments.push(item.name);
|
|
104
118
|
}
|
|
105
119
|
}
|
|
106
120
|
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
107
121
|
finally {
|
|
108
122
|
try {
|
|
109
|
-
if (
|
|
123
|
+
if (!_d && !_a && (_b = _e.return)) await _b.call(_e);
|
|
110
124
|
}
|
|
111
125
|
finally { if (e_2) throw e_2.error; }
|
|
112
126
|
}
|
|
@@ -647,6 +661,12 @@ function arraysEqual(a, b) {
|
|
|
647
661
|
|
|
648
662
|
// Copyright (c) Microsoft Corporation.
|
|
649
663
|
class AvroReader {
|
|
664
|
+
get blockOffset() {
|
|
665
|
+
return this._blockOffset;
|
|
666
|
+
}
|
|
667
|
+
get objectIndex() {
|
|
668
|
+
return this._objectIndex;
|
|
669
|
+
}
|
|
650
670
|
constructor(dataStream, headerStream, currentBlockOffset, indexWithinCurrentBlock) {
|
|
651
671
|
this._dataStream = dataStream;
|
|
652
672
|
this._headerStream = headerStream || dataStream;
|
|
@@ -655,12 +675,6 @@ class AvroReader {
|
|
|
655
675
|
this._objectIndex = indexWithinCurrentBlock || 0;
|
|
656
676
|
this._initialBlockOffset = currentBlockOffset || 0;
|
|
657
677
|
}
|
|
658
|
-
get blockOffset() {
|
|
659
|
-
return this._blockOffset;
|
|
660
|
-
}
|
|
661
|
-
get objectIndex() {
|
|
662
|
-
return this._objectIndex;
|
|
663
|
-
}
|
|
664
678
|
async initialize(options = {}) {
|
|
665
679
|
const header = await AvroParser.readFixedBytes(this._headerStream, AVRO_INIT_BYTES.length, {
|
|
666
680
|
abortSignal: options.abortSignal,
|
|
@@ -752,17 +766,17 @@ class AvroReadable {
|
|
|
752
766
|
// Copyright (c) Microsoft Corporation.
|
|
753
767
|
const ABORT_ERROR = new abortController.AbortError("Reading from the avro stream was aborted.");
|
|
754
768
|
class AvroReadableFromStream extends AvroReadable {
|
|
755
|
-
constructor(readable) {
|
|
756
|
-
super();
|
|
757
|
-
this._readable = readable;
|
|
758
|
-
this._position = 0;
|
|
759
|
-
}
|
|
760
769
|
toUint8Array(data) {
|
|
761
770
|
if (typeof data === "string") {
|
|
762
771
|
return Buffer.from(data);
|
|
763
772
|
}
|
|
764
773
|
return data;
|
|
765
774
|
}
|
|
775
|
+
constructor(readable) {
|
|
776
|
+
super();
|
|
777
|
+
this._readable = readable;
|
|
778
|
+
this._position = 0;
|
|
779
|
+
}
|
|
766
780
|
get position() {
|
|
767
781
|
return this._position;
|
|
768
782
|
}
|
|
@@ -858,6 +872,9 @@ function streamToAvroReadable(readableStream) {
|
|
|
858
872
|
|
|
859
873
|
// Copyright (c) Microsoft Corporation.
|
|
860
874
|
class Segment {
|
|
875
|
+
get dateTime() {
|
|
876
|
+
return this._dateTime;
|
|
877
|
+
}
|
|
861
878
|
constructor(shards, shardIndex, dateTime, manifestPath) {
|
|
862
879
|
this.manifestPath = manifestPath;
|
|
863
880
|
this.shards = shards;
|
|
@@ -866,9 +883,6 @@ class Segment {
|
|
|
866
883
|
this.shardDone = Array(shards.length).fill(false);
|
|
867
884
|
this.shardDoneCount = 0;
|
|
868
885
|
}
|
|
869
|
-
get dateTime() {
|
|
870
|
-
return this._dateTime;
|
|
871
|
-
}
|
|
872
886
|
hasNext() {
|
|
873
887
|
return this.shards.length > this.shardDoneCount;
|
|
874
888
|
}
|
|
@@ -1000,24 +1014,31 @@ class ShardFactory {
|
|
|
1000
1014
|
}
|
|
1001
1015
|
async create(containerClient, shardPath, shardCursor, options = {}) {
|
|
1002
1016
|
return tracingClient.withSpan("ShardFactory-create", options, async (updatedOptions) => {
|
|
1003
|
-
var e_1,
|
|
1017
|
+
var _a, e_1, _b, _c;
|
|
1004
1018
|
const chunks = [];
|
|
1005
1019
|
const blockOffset = (shardCursor === null || shardCursor === void 0 ? void 0 : shardCursor.BlockOffset) || 0;
|
|
1006
1020
|
const eventIndex = (shardCursor === null || shardCursor === void 0 ? void 0 : shardCursor.EventIndex) || 0;
|
|
1007
1021
|
try {
|
|
1008
|
-
for (var
|
|
1022
|
+
for (var _d = true, _e = tslib.__asyncValues(containerClient.listBlobsFlat({
|
|
1009
1023
|
prefix: shardPath,
|
|
1010
1024
|
abortSignal: options.abortSignal,
|
|
1011
1025
|
tracingOptions: updatedOptions.tracingOptions,
|
|
1012
|
-
})),
|
|
1013
|
-
|
|
1014
|
-
|
|
1026
|
+
})), _f; _f = await _e.next(), _a = _f.done, !_a;) {
|
|
1027
|
+
_c = _f.value;
|
|
1028
|
+
_d = false;
|
|
1029
|
+
try {
|
|
1030
|
+
const blobItem = _c;
|
|
1031
|
+
chunks.push(blobItem.name);
|
|
1032
|
+
}
|
|
1033
|
+
finally {
|
|
1034
|
+
_d = true;
|
|
1035
|
+
}
|
|
1015
1036
|
}
|
|
1016
1037
|
}
|
|
1017
1038
|
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
1018
1039
|
finally {
|
|
1019
1040
|
try {
|
|
1020
|
-
if (
|
|
1041
|
+
if (!_d && !_a && (_b = _e.return)) await _b.call(_e);
|
|
1021
1042
|
}
|
|
1022
1043
|
finally { if (e_1) throw e_1.error; }
|
|
1023
1044
|
}
|
|
@@ -1057,6 +1078,12 @@ class ShardFactory {
|
|
|
1057
1078
|
|
|
1058
1079
|
// Copyright (c) Microsoft Corporation.
|
|
1059
1080
|
class Chunk {
|
|
1081
|
+
get blockOffset() {
|
|
1082
|
+
return this._blockOffset;
|
|
1083
|
+
}
|
|
1084
|
+
get eventIndex() {
|
|
1085
|
+
return this._eventIndex;
|
|
1086
|
+
}
|
|
1060
1087
|
constructor(avroReader, blockOffset, eventIndex, chunkPath, avroOptions = {}) {
|
|
1061
1088
|
this.chunkPath = chunkPath;
|
|
1062
1089
|
this.avroReader = avroReader;
|
|
@@ -1064,12 +1091,6 @@ class Chunk {
|
|
|
1064
1091
|
this._eventIndex = eventIndex;
|
|
1065
1092
|
this.iter = this.avroReader.parseObjects(avroOptions);
|
|
1066
1093
|
}
|
|
1067
|
-
get blockOffset() {
|
|
1068
|
-
return this._blockOffset;
|
|
1069
|
-
}
|
|
1070
|
-
get eventIndex() {
|
|
1071
|
-
return this._eventIndex;
|
|
1072
|
-
}
|
|
1073
1094
|
hasNext() {
|
|
1074
1095
|
return this.avroReader.hasNext();
|
|
1075
1096
|
}
|
|
@@ -1366,19 +1387,6 @@ function appendUserAgentPrefix(options) {
|
|
|
1366
1387
|
* @see https://docs.microsoft.com/en-us/azure/storage/blobs/storage-blob-change-feed?tabs=azure-portal
|
|
1367
1388
|
*/
|
|
1368
1389
|
class BlobChangeFeedClient {
|
|
1369
|
-
constructor(urlOrClient, credentialOrPipeline,
|
|
1370
|
-
// Legacy, no way to fix the eslint error without breaking. Disable the rule for this line.
|
|
1371
|
-
/* eslint-disable-next-line @azure/azure-sdk/ts-naming-options */
|
|
1372
|
-
options, changeFeedClientOptions) {
|
|
1373
|
-
this.changeFeedClientOptions = changeFeedClientOptions || {};
|
|
1374
|
-
this.changeFeedFactory = new ChangeFeedFactory(this.changeFeedClientOptions.maximumTransferSize);
|
|
1375
|
-
if (credentialOrPipeline instanceof storageBlob.Pipeline) {
|
|
1376
|
-
this.blobServiceClient = new storageBlob.BlobServiceClient(urlOrClient, credentialOrPipeline);
|
|
1377
|
-
}
|
|
1378
|
-
else {
|
|
1379
|
-
this.blobServiceClient = new storageBlob.BlobServiceClient(urlOrClient, credentialOrPipeline, appendUserAgentPrefix(options));
|
|
1380
|
-
}
|
|
1381
|
-
}
|
|
1382
1390
|
/**
|
|
1383
1391
|
*
|
|
1384
1392
|
* Creates an instance of BlobChangeFeedClient from connection string.
|
|
@@ -1401,6 +1409,19 @@ class BlobChangeFeedClient {
|
|
|
1401
1409
|
const blobServiceClient = storageBlob.BlobServiceClient.fromConnectionString(connectionString, options);
|
|
1402
1410
|
return new BlobChangeFeedClient(blobServiceClient.url, blobServiceClient.credential, appendUserAgentPrefix(options), changeFeedClientOptions);
|
|
1403
1411
|
}
|
|
1412
|
+
constructor(urlOrClient, credentialOrPipeline,
|
|
1413
|
+
// Legacy, no way to fix the eslint error without breaking. Disable the rule for this line.
|
|
1414
|
+
/* eslint-disable-next-line @azure/azure-sdk/ts-naming-options */
|
|
1415
|
+
options, changeFeedClientOptions) {
|
|
1416
|
+
this.changeFeedClientOptions = changeFeedClientOptions || {};
|
|
1417
|
+
this.changeFeedFactory = new ChangeFeedFactory(this.changeFeedClientOptions.maximumTransferSize);
|
|
1418
|
+
if (credentialOrPipeline instanceof storageBlob.Pipeline) {
|
|
1419
|
+
this.blobServiceClient = new storageBlob.BlobServiceClient(urlOrClient, credentialOrPipeline);
|
|
1420
|
+
}
|
|
1421
|
+
else {
|
|
1422
|
+
this.blobServiceClient = new storageBlob.BlobServiceClient(urlOrClient, credentialOrPipeline, appendUserAgentPrefix(options));
|
|
1423
|
+
}
|
|
1424
|
+
}
|
|
1404
1425
|
getChange(options = {}) {
|
|
1405
1426
|
return tslib.__asyncGenerator(this, arguments, function* getChange_1() {
|
|
1406
1427
|
const changeFeed = yield tslib.__await(this.changeFeedFactory.create(this.blobServiceClient, undefined, options));
|