@azure/storage-blob-changefeed 12.0.0-alpha.20220418.2 → 12.0.0-alpha.20220419.3
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/CHANGELOG.md +4 -1
- package/dist/index.js +66 -65
- package/dist/index.js.map +1 -1
- package/dist-esm/storage-blob-changefeed/src/ChangeFeed.js.map +1 -1
- package/dist-esm/storage-blob-changefeed/src/ChangeFeedFactory.js.map +1 -1
- package/dist-esm/storage-blob-changefeed/src/LazyLoadingBlobStream.js.map +1 -1
- package/dist-esm/storage-blob-changefeed/src/Segment.js.map +1 -1
- package/dist-esm/storage-blob-changefeed/src/SegmentFactory.js.map +1 -1
- package/dist-esm/storage-blob-changefeed/src/Shard.js.map +1 -1
- package/dist-esm/storage-blob-changefeed/src/ShardFactory.js.map +1 -1
- package/dist-esm/storage-blob-changefeed/src/utils/utils.common.js +1 -1
- package/dist-esm/storage-blob-changefeed/src/utils/utils.common.js.map +1 -1
- package/dist-esm/storage-internal-avro/src/AvroParser.js +38 -40
- package/dist-esm/storage-internal-avro/src/AvroParser.js.map +1 -1
- package/dist-esm/storage-internal-avro/src/AvroReadableFromBlob.js +4 -4
- package/dist-esm/storage-internal-avro/src/AvroReadableFromBlob.js.map +1 -1
- package/dist-esm/storage-internal-avro/src/AvroReadableFromStream.js +7 -5
- package/dist-esm/storage-internal-avro/src/AvroReadableFromStream.js.map +1 -1
- package/dist-esm/storage-internal-avro/src/AvroReader.js +8 -6
- package/dist-esm/storage-internal-avro/src/AvroReader.js.map +1 -1
- package/dist-esm/storage-internal-avro/src/utils/utils.common.js +2 -1
- package/dist-esm/storage-internal-avro/src/utils/utils.common.js.map +1 -1
- package/package.json +2 -2
- package/types/3.1/storage-internal-avro/src/AvroParser.d.ts +1 -1
- package/types/3.1/storage-internal-avro/src/AvroReader.d.ts +1 -1
- package/types/latest/storage-internal-avro/src/AvroParser.d.ts +1 -1
- package/types/latest/storage-internal-avro/src/AvroParser.d.ts.map +1 -1
- package/types/latest/storage-internal-avro/src/AvroReadableFromBlob.d.ts.map +1 -1
- package/types/latest/storage-internal-avro/src/AvroReadableFromStream.d.ts.map +1 -1
- package/types/latest/storage-internal-avro/src/AvroReader.d.ts +1 -1
- package/types/latest/storage-internal-avro/src/AvroReader.d.ts.map +1 -1
- package/types/latest/storage-internal-avro/src/utils/utils.common.d.ts.map +1 -1
package/CHANGELOG.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -179,7 +179,7 @@ function rawEventToBlobChangeFeedEvent(rawEvent) {
|
|
|
179
179
|
delete previousInfo.SoftDeleteSnapshot;
|
|
180
180
|
}
|
|
181
181
|
if (previousInfo.WasBlobSoftDeleted) {
|
|
182
|
-
previousInfo.isBlobSoftDeleted = previousInfo.WasBlobSoftDeleted;
|
|
182
|
+
previousInfo.isBlobSoftDeleted = previousInfo.WasBlobSoftDeleted === "true";
|
|
183
183
|
delete previousInfo.WasBlobSoftDeleted;
|
|
184
184
|
}
|
|
185
185
|
if (previousInfo.BlobVersion) {
|
|
@@ -360,22 +360,6 @@ const AVRO_INIT_BYTES = new Uint8Array([79, 98, 106, 1]);
|
|
|
360
360
|
const AVRO_CODEC_KEY = "avro.codec";
|
|
361
361
|
const AVRO_SCHEMA_KEY = "avro.schema";
|
|
362
362
|
|
|
363
|
-
// Copyright (c) Microsoft Corporation.
|
|
364
|
-
// Licensed under the MIT license.
|
|
365
|
-
function arraysEqual(a, b) {
|
|
366
|
-
if (a === b)
|
|
367
|
-
return true;
|
|
368
|
-
if (a == null || b == null)
|
|
369
|
-
return false;
|
|
370
|
-
if (a.length != b.length)
|
|
371
|
-
return false;
|
|
372
|
-
for (let i = 0; i < a.length; ++i) {
|
|
373
|
-
if (a[i] !== b[i])
|
|
374
|
-
return false;
|
|
375
|
-
}
|
|
376
|
-
return true;
|
|
377
|
-
}
|
|
378
|
-
|
|
379
363
|
// Copyright (c) Microsoft Corporation.
|
|
380
364
|
// Licensed under the MIT license.
|
|
381
365
|
class AvroParser {
|
|
@@ -388,7 +372,7 @@ class AvroParser {
|
|
|
388
372
|
*/
|
|
389
373
|
static async readFixedBytes(stream, length, options = {}) {
|
|
390
374
|
const bytes = await stream.read(length, { abortSignal: options.abortSignal });
|
|
391
|
-
if (bytes.length
|
|
375
|
+
if (bytes.length !== length) {
|
|
392
376
|
throw new Error("Hit stream end.");
|
|
393
377
|
}
|
|
394
378
|
return bytes;
|
|
@@ -418,6 +402,7 @@ class AvroParser {
|
|
|
418
402
|
} while (haveMoreByte && significanceInBit < 28); // bitwise operation only works for 32-bit integers
|
|
419
403
|
if (haveMoreByte) {
|
|
420
404
|
// Switch to float arithmetic
|
|
405
|
+
// eslint-disable-next-line no-self-assign
|
|
421
406
|
zigZagEncoded = zigZagEncoded;
|
|
422
407
|
significanceInFloat = 268435456; // 2 ** 28.
|
|
423
408
|
do {
|
|
@@ -444,10 +429,10 @@ class AvroParser {
|
|
|
444
429
|
}
|
|
445
430
|
static async readBoolean(stream, options = {}) {
|
|
446
431
|
const b = await AvroParser.readByte(stream, options);
|
|
447
|
-
if (b
|
|
432
|
+
if (b === 1) {
|
|
448
433
|
return true;
|
|
449
434
|
}
|
|
450
|
-
else if (b
|
|
435
|
+
else if (b === 0) {
|
|
451
436
|
return false;
|
|
452
437
|
}
|
|
453
438
|
else {
|
|
@@ -469,16 +454,10 @@ class AvroParser {
|
|
|
469
454
|
if (size < 0) {
|
|
470
455
|
throw new Error("Bytes size was negative.");
|
|
471
456
|
}
|
|
472
|
-
return
|
|
457
|
+
return stream.read(size, { abortSignal: options.abortSignal });
|
|
473
458
|
}
|
|
474
459
|
static async readString(stream, options = {}) {
|
|
475
460
|
const u8arr = await AvroParser.readBytes(stream, options);
|
|
476
|
-
// polyfill TextDecoder to be backward compatible with older
|
|
477
|
-
// nodejs that doesn't expose TextDecoder as a global variable
|
|
478
|
-
if (typeof TextDecoder === "undefined" && typeof require !== "undefined") {
|
|
479
|
-
global.TextDecoder = require("util").TextDecoder;
|
|
480
|
-
}
|
|
481
|
-
// FUTURE: need TextDecoder polyfill for IE
|
|
482
461
|
const utf8decoder = new TextDecoder();
|
|
483
462
|
return utf8decoder.decode(u8arr);
|
|
484
463
|
}
|
|
@@ -489,8 +468,8 @@ class AvroParser {
|
|
|
489
468
|
return { key, value };
|
|
490
469
|
}
|
|
491
470
|
static async readMap(stream, readItemMethod, options = {}) {
|
|
492
|
-
const readPairMethod =
|
|
493
|
-
return
|
|
471
|
+
const readPairMethod = (s, opts = {}) => {
|
|
472
|
+
return AvroParser.readMapPair(s, readItemMethod, opts);
|
|
494
473
|
};
|
|
495
474
|
const pairs = await AvroParser.readArray(stream, readPairMethod, options);
|
|
496
475
|
const dict = {};
|
|
@@ -501,7 +480,7 @@ class AvroParser {
|
|
|
501
480
|
}
|
|
502
481
|
static async readArray(stream, readItemMethod, options = {}) {
|
|
503
482
|
const items = [];
|
|
504
|
-
for (let count = await AvroParser.readLong(stream, options); count
|
|
483
|
+
for (let count = await AvroParser.readLong(stream, options); count !== 0; count = await AvroParser.readLong(stream, options)) {
|
|
505
484
|
if (count < 0) {
|
|
506
485
|
// Ignore block sizes
|
|
507
486
|
await AvroParser.readLong(stream, options);
|
|
@@ -524,6 +503,17 @@ var AvroComplex;
|
|
|
524
503
|
AvroComplex["UNION"] = "union";
|
|
525
504
|
AvroComplex["FIXED"] = "fixed";
|
|
526
505
|
})(AvroComplex || (AvroComplex = {}));
|
|
506
|
+
var AvroPrimitive;
|
|
507
|
+
(function (AvroPrimitive) {
|
|
508
|
+
AvroPrimitive["NULL"] = "null";
|
|
509
|
+
AvroPrimitive["BOOLEAN"] = "boolean";
|
|
510
|
+
AvroPrimitive["INT"] = "int";
|
|
511
|
+
AvroPrimitive["LONG"] = "long";
|
|
512
|
+
AvroPrimitive["FLOAT"] = "float";
|
|
513
|
+
AvroPrimitive["DOUBLE"] = "double";
|
|
514
|
+
AvroPrimitive["BYTES"] = "bytes";
|
|
515
|
+
AvroPrimitive["STRING"] = "string";
|
|
516
|
+
})(AvroPrimitive || (AvroPrimitive = {}));
|
|
527
517
|
class AvroType {
|
|
528
518
|
/**
|
|
529
519
|
* Determines the AvroType from the Avro Schema.
|
|
@@ -563,7 +553,9 @@ class AvroType {
|
|
|
563
553
|
try {
|
|
564
554
|
return AvroType.fromStringSchema(type);
|
|
565
555
|
}
|
|
566
|
-
catch (err) {
|
|
556
|
+
catch (err) {
|
|
557
|
+
// eslint-disable-line no-empty
|
|
558
|
+
}
|
|
567
559
|
switch (type) {
|
|
568
560
|
case AvroComplex.RECORD:
|
|
569
561
|
if (schema.aliases) {
|
|
@@ -572,6 +564,7 @@ class AvroType {
|
|
|
572
564
|
if (!schema.name) {
|
|
573
565
|
throw new Error(`Required attribute 'name' doesn't exist on schema: ${schema}`);
|
|
574
566
|
}
|
|
567
|
+
// eslint-disable-next-line no-case-declarations
|
|
575
568
|
const fields = {};
|
|
576
569
|
if (!schema.fields) {
|
|
577
570
|
throw new Error(`Required attribute 'fields' doesn't exist on schema: ${schema}`);
|
|
@@ -600,40 +593,29 @@ class AvroType {
|
|
|
600
593
|
}
|
|
601
594
|
}
|
|
602
595
|
}
|
|
603
|
-
var AvroPrimitive;
|
|
604
|
-
(function (AvroPrimitive) {
|
|
605
|
-
AvroPrimitive["NULL"] = "null";
|
|
606
|
-
AvroPrimitive["BOOLEAN"] = "boolean";
|
|
607
|
-
AvroPrimitive["INT"] = "int";
|
|
608
|
-
AvroPrimitive["LONG"] = "long";
|
|
609
|
-
AvroPrimitive["FLOAT"] = "float";
|
|
610
|
-
AvroPrimitive["DOUBLE"] = "double";
|
|
611
|
-
AvroPrimitive["BYTES"] = "bytes";
|
|
612
|
-
AvroPrimitive["STRING"] = "string";
|
|
613
|
-
})(AvroPrimitive || (AvroPrimitive = {}));
|
|
614
596
|
class AvroPrimitiveType extends AvroType {
|
|
615
597
|
constructor(primitive) {
|
|
616
598
|
super();
|
|
617
599
|
this._primitive = primitive;
|
|
618
600
|
}
|
|
619
|
-
|
|
601
|
+
read(stream, options = {}) {
|
|
620
602
|
switch (this._primitive) {
|
|
621
603
|
case AvroPrimitive.NULL:
|
|
622
|
-
return
|
|
604
|
+
return AvroParser.readNull();
|
|
623
605
|
case AvroPrimitive.BOOLEAN:
|
|
624
|
-
return
|
|
606
|
+
return AvroParser.readBoolean(stream, options);
|
|
625
607
|
case AvroPrimitive.INT:
|
|
626
|
-
return
|
|
608
|
+
return AvroParser.readInt(stream, options);
|
|
627
609
|
case AvroPrimitive.LONG:
|
|
628
|
-
return
|
|
610
|
+
return AvroParser.readLong(stream, options);
|
|
629
611
|
case AvroPrimitive.FLOAT:
|
|
630
|
-
return
|
|
612
|
+
return AvroParser.readFloat(stream, options);
|
|
631
613
|
case AvroPrimitive.DOUBLE:
|
|
632
|
-
return
|
|
614
|
+
return AvroParser.readDouble(stream, options);
|
|
633
615
|
case AvroPrimitive.BYTES:
|
|
634
|
-
return
|
|
616
|
+
return AvroParser.readBytes(stream, options);
|
|
635
617
|
case AvroPrimitive.STRING:
|
|
636
|
-
return
|
|
618
|
+
return AvroParser.readString(stream, options);
|
|
637
619
|
default:
|
|
638
620
|
throw new Error("Unknown Avro Primitive");
|
|
639
621
|
}
|
|
@@ -656,7 +638,7 @@ class AvroUnionType extends AvroType {
|
|
|
656
638
|
}
|
|
657
639
|
async read(stream, options = {}) {
|
|
658
640
|
const typeIndex = await AvroParser.readInt(stream, options);
|
|
659
|
-
return
|
|
641
|
+
return this._types[typeIndex].read(stream, options);
|
|
660
642
|
}
|
|
661
643
|
}
|
|
662
644
|
class AvroMapType extends AvroType {
|
|
@@ -664,11 +646,11 @@ class AvroMapType extends AvroType {
|
|
|
664
646
|
super();
|
|
665
647
|
this._itemType = itemType;
|
|
666
648
|
}
|
|
667
|
-
|
|
668
|
-
const readItemMethod =
|
|
669
|
-
return
|
|
649
|
+
read(stream, options = {}) {
|
|
650
|
+
const readItemMethod = (s, opts) => {
|
|
651
|
+
return this._itemType.read(s, opts);
|
|
670
652
|
};
|
|
671
|
-
return
|
|
653
|
+
return AvroParser.readMap(stream, readItemMethod, options);
|
|
672
654
|
}
|
|
673
655
|
}
|
|
674
656
|
class AvroRecordType extends AvroType {
|
|
@@ -681,7 +663,7 @@ class AvroRecordType extends AvroType {
|
|
|
681
663
|
const record = {};
|
|
682
664
|
record["$schema"] = this._name;
|
|
683
665
|
for (const key in this._fields) {
|
|
684
|
-
if (
|
|
666
|
+
if (Object.prototype.hasOwnProperty.call(this._fields, key)) {
|
|
685
667
|
record[key] = await this._fields[key].read(stream, options);
|
|
686
668
|
}
|
|
687
669
|
}
|
|
@@ -689,6 +671,23 @@ class AvroRecordType extends AvroType {
|
|
|
689
671
|
}
|
|
690
672
|
}
|
|
691
673
|
|
|
674
|
+
// Copyright (c) Microsoft Corporation.
|
|
675
|
+
// Licensed under the MIT license.
|
|
676
|
+
function arraysEqual(a, b) {
|
|
677
|
+
if (a === b)
|
|
678
|
+
return true;
|
|
679
|
+
// eslint-disable-next-line eqeqeq
|
|
680
|
+
if (a == null || b == null)
|
|
681
|
+
return false;
|
|
682
|
+
if (a.length !== b.length)
|
|
683
|
+
return false;
|
|
684
|
+
for (let i = 0; i < a.length; ++i) {
|
|
685
|
+
if (a[i] !== b[i])
|
|
686
|
+
return false;
|
|
687
|
+
}
|
|
688
|
+
return true;
|
|
689
|
+
}
|
|
690
|
+
|
|
692
691
|
// Copyright (c) Microsoft Corporation.
|
|
693
692
|
class AvroReader {
|
|
694
693
|
constructor(dataStream, headerStream, currentBlockOffset, indexWithinCurrentBlock) {
|
|
@@ -719,7 +718,7 @@ class AvroReader {
|
|
|
719
718
|
});
|
|
720
719
|
// Validate codec
|
|
721
720
|
const codec = this._metadata[AVRO_CODEC_KEY];
|
|
722
|
-
if (!(codec
|
|
721
|
+
if (!(codec === undefined || codec === null || codec === "null")) {
|
|
723
722
|
throw new Error("Codecs are not supported");
|
|
724
723
|
}
|
|
725
724
|
// The 16-byte, randomly-generated sync marker for this file.
|
|
@@ -729,7 +728,7 @@ class AvroReader {
|
|
|
729
728
|
// Parse the schema
|
|
730
729
|
const schema = JSON.parse(this._metadata[AVRO_SCHEMA_KEY]);
|
|
731
730
|
this._itemType = AvroType.fromSchema(schema);
|
|
732
|
-
if (this._blockOffset
|
|
731
|
+
if (this._blockOffset === 0) {
|
|
733
732
|
this._blockOffset = this._initialBlockOffset + this._dataStream.position;
|
|
734
733
|
}
|
|
735
734
|
this._itemsRemainingInBlock = await AvroParser.readLong(this._dataStream, {
|
|
@@ -759,7 +758,7 @@ class AvroReader {
|
|
|
759
758
|
}));
|
|
760
759
|
this._itemsRemainingInBlock--;
|
|
761
760
|
this._objectIndex++;
|
|
762
|
-
if (this._itemsRemainingInBlock
|
|
761
|
+
if (this._itemsRemainingInBlock === 0) {
|
|
763
762
|
const marker = yield tslib.__await(AvroParser.readFixedBytes(this._dataStream, AVRO_SYNC_MARKER_SIZE, {
|
|
764
763
|
abortSignal: options.abortSignal,
|
|
765
764
|
}));
|
|
@@ -834,6 +833,7 @@ class AvroReadableFromStream extends AvroReadable {
|
|
|
834
833
|
else {
|
|
835
834
|
// register callback to wait for enough data to read
|
|
836
835
|
return new Promise((resolve, reject) => {
|
|
836
|
+
/* eslint-disable @typescript-eslint/no-use-before-define */
|
|
837
837
|
const cleanUp = () => {
|
|
838
838
|
this._readable.removeListener("readable", readableCallback);
|
|
839
839
|
this._readable.removeListener("error", rejectCallback);
|
|
@@ -844,12 +844,12 @@ class AvroReadableFromStream extends AvroReadable {
|
|
|
844
844
|
}
|
|
845
845
|
};
|
|
846
846
|
const readableCallback = () => {
|
|
847
|
-
const
|
|
848
|
-
if (
|
|
849
|
-
this._position +=
|
|
847
|
+
const callbackChunk = this._readable.read(size);
|
|
848
|
+
if (callbackChunk) {
|
|
849
|
+
this._position += callbackChunk.length;
|
|
850
850
|
cleanUp();
|
|
851
|
-
//
|
|
852
|
-
resolve(this.toUint8Array(
|
|
851
|
+
// callbackChunk.length maybe less than desired size if the stream ends.
|
|
852
|
+
resolve(this.toUint8Array(callbackChunk));
|
|
853
853
|
}
|
|
854
854
|
};
|
|
855
855
|
const rejectCallback = () => {
|
|
@@ -867,6 +867,7 @@ class AvroReadableFromStream extends AvroReadable {
|
|
|
867
867
|
if (options.abortSignal) {
|
|
868
868
|
options.abortSignal.addEventListener("abort", abortHandler);
|
|
869
869
|
}
|
|
870
|
+
/* eslint-enable @typescript-eslint/no-use-before-define */
|
|
870
871
|
});
|
|
871
872
|
}
|
|
872
873
|
}
|