bson 4.6.1 → 4.6.4
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/bower.json +1 -1
- package/bson-ts34.d.ts +1133 -0
- package/bson.d.ts +1228 -1118
- package/dist/bson.browser.esm.js +23 -5
- package/dist/bson.browser.esm.js.map +1 -1
- package/dist/bson.browser.umd.js +23 -5
- package/dist/bson.browser.umd.js.map +1 -1
- package/dist/bson.bundle.js +23 -5
- package/dist/bson.bundle.js.map +1 -1
- package/dist/bson.esm.js +23 -5
- package/dist/bson.esm.js.map +1 -1
- package/lib/binary.js +1 -0
- package/lib/binary.js.map +1 -1
- package/lib/code.js +1 -0
- package/lib/code.js.map +1 -1
- package/lib/db_ref.js +1 -0
- package/lib/db_ref.js.map +1 -1
- package/lib/decimal128.js +1 -0
- package/lib/decimal128.js.map +1 -1
- package/lib/double.js +1 -0
- package/lib/double.js.map +1 -1
- package/lib/int_32.js +1 -0
- package/lib/int_32.js.map +1 -1
- package/lib/long.js +1 -0
- package/lib/long.js.map +1 -1
- package/lib/max_key.js +1 -0
- package/lib/max_key.js.map +1 -1
- package/lib/min_key.js +1 -0
- package/lib/min_key.js.map +1 -1
- package/lib/objectid.js +8 -4
- package/lib/objectid.js.map +1 -1
- package/lib/regexp.js +1 -0
- package/lib/regexp.js.map +1 -1
- package/lib/symbol.js +1 -0
- package/lib/symbol.js.map +1 -1
- package/lib/timestamp.js +4 -1
- package/lib/timestamp.js.map +1 -1
- package/package.json +11 -3
- package/src/binary.ts +1 -0
- package/src/code.ts +1 -0
- package/src/db_ref.ts +1 -0
- package/src/decimal128.ts +1 -0
- package/src/double.ts +1 -0
- package/src/int_32.ts +1 -0
- package/src/long.ts +1 -0
- package/src/max_key.ts +1 -0
- package/src/min_key.ts +1 -0
- package/src/objectid.ts +9 -5
- package/src/regexp.ts +1 -0
- package/src/symbol.ts +1 -0
- package/src/timestamp.ts +4 -1
package/dist/bson.esm.js
CHANGED
|
@@ -413,6 +413,7 @@ Object.defineProperty(UUID.prototype, '_bsontype', { value: 'UUID' });
|
|
|
413
413
|
/**
|
|
414
414
|
* A class representation of the BSON Binary type.
|
|
415
415
|
* @public
|
|
416
|
+
* @category BSONType
|
|
416
417
|
*/
|
|
417
418
|
var Binary = /** @class */ (function () {
|
|
418
419
|
/**
|
|
@@ -643,6 +644,7 @@ Object.defineProperty(Binary.prototype, '_bsontype', { value: 'Binary' });
|
|
|
643
644
|
/**
|
|
644
645
|
* A class representation of the BSON Code type.
|
|
645
646
|
* @public
|
|
647
|
+
* @category BSONType
|
|
646
648
|
*/
|
|
647
649
|
var Code = /** @class */ (function () {
|
|
648
650
|
/**
|
|
@@ -691,6 +693,7 @@ function isDBRefLike(value) {
|
|
|
691
693
|
/**
|
|
692
694
|
* A class representation of the BSON DBRef type.
|
|
693
695
|
* @public
|
|
696
|
+
* @category BSONType
|
|
694
697
|
*/
|
|
695
698
|
var DBRef = /** @class */ (function () {
|
|
696
699
|
/**
|
|
@@ -795,6 +798,7 @@ var UINT_CACHE = {};
|
|
|
795
798
|
/**
|
|
796
799
|
* A class representing a 64-bit integer
|
|
797
800
|
* @public
|
|
801
|
+
* @category BSONType
|
|
798
802
|
* @remarks
|
|
799
803
|
* The internal representation of a long is the two given signed, 32-bit values.
|
|
800
804
|
* We use 32-bit pieces because these are the size of integers on which
|
|
@@ -1757,6 +1761,7 @@ function invalidErr(string, message) {
|
|
|
1757
1761
|
/**
|
|
1758
1762
|
* A class representation of the BSON Decimal128 type.
|
|
1759
1763
|
* @public
|
|
1764
|
+
* @category BSONType
|
|
1760
1765
|
*/
|
|
1761
1766
|
var Decimal128 = /** @class */ (function () {
|
|
1762
1767
|
/**
|
|
@@ -2328,6 +2333,7 @@ Object.defineProperty(Decimal128.prototype, '_bsontype', { value: 'Decimal128' }
|
|
|
2328
2333
|
/**
|
|
2329
2334
|
* A class representation of the BSON Double type.
|
|
2330
2335
|
* @public
|
|
2336
|
+
* @category BSONType
|
|
2331
2337
|
*/
|
|
2332
2338
|
var Double = /** @class */ (function () {
|
|
2333
2339
|
/**
|
|
@@ -2399,6 +2405,7 @@ Object.defineProperty(Double.prototype, '_bsontype', { value: 'Double' });
|
|
|
2399
2405
|
/**
|
|
2400
2406
|
* A class representation of a BSON Int32 type.
|
|
2401
2407
|
* @public
|
|
2408
|
+
* @category BSONType
|
|
2402
2409
|
*/
|
|
2403
2410
|
var Int32 = /** @class */ (function () {
|
|
2404
2411
|
/**
|
|
@@ -2452,6 +2459,7 @@ Object.defineProperty(Int32.prototype, '_bsontype', { value: 'Int32' });
|
|
|
2452
2459
|
/**
|
|
2453
2460
|
* A class representation of the BSON MaxKey type.
|
|
2454
2461
|
* @public
|
|
2462
|
+
* @category BSONType
|
|
2455
2463
|
*/
|
|
2456
2464
|
var MaxKey = /** @class */ (function () {
|
|
2457
2465
|
function MaxKey() {
|
|
@@ -2480,6 +2488,7 @@ Object.defineProperty(MaxKey.prototype, '_bsontype', { value: 'MaxKey' });
|
|
|
2480
2488
|
/**
|
|
2481
2489
|
* A class representation of the BSON MinKey type.
|
|
2482
2490
|
* @public
|
|
2491
|
+
* @category BSONType
|
|
2483
2492
|
*/
|
|
2484
2493
|
var MinKey = /** @class */ (function () {
|
|
2485
2494
|
function MinKey() {
|
|
@@ -2513,6 +2522,7 @@ var kId = Symbol('id');
|
|
|
2513
2522
|
/**
|
|
2514
2523
|
* A class representation of the BSON ObjectId type.
|
|
2515
2524
|
* @public
|
|
2525
|
+
* @category BSONType
|
|
2516
2526
|
*/
|
|
2517
2527
|
var ObjectId = /** @class */ (function () {
|
|
2518
2528
|
/**
|
|
@@ -2546,7 +2556,8 @@ var ObjectId = /** @class */ (function () {
|
|
|
2546
2556
|
this[kId] = ObjectId.generate(typeof workingId === 'number' ? workingId : undefined);
|
|
2547
2557
|
}
|
|
2548
2558
|
else if (ArrayBuffer.isView(workingId) && workingId.byteLength === 12) {
|
|
2549
|
-
|
|
2559
|
+
// If intstanceof matches we can escape calling ensure buffer in Node.js environments
|
|
2560
|
+
this[kId] = workingId instanceof Buffer ? workingId : ensureBuffer(workingId);
|
|
2550
2561
|
}
|
|
2551
2562
|
else if (typeof workingId === 'string') {
|
|
2552
2563
|
if (workingId.length === 12) {
|
|
@@ -2562,7 +2573,7 @@ var ObjectId = /** @class */ (function () {
|
|
|
2562
2573
|
this[kId] = Buffer.from(workingId, 'hex');
|
|
2563
2574
|
}
|
|
2564
2575
|
else {
|
|
2565
|
-
throw new BSONTypeError('Argument passed in must be a string of 12 bytes or a string of 24 hex characters');
|
|
2576
|
+
throw new BSONTypeError('Argument passed in must be a string of 12 bytes or a string of 24 hex characters or an integer');
|
|
2566
2577
|
}
|
|
2567
2578
|
}
|
|
2568
2579
|
else {
|
|
@@ -2679,7 +2690,7 @@ var ObjectId = /** @class */ (function () {
|
|
|
2679
2690
|
return false;
|
|
2680
2691
|
}
|
|
2681
2692
|
if (otherId instanceof ObjectId) {
|
|
2682
|
-
return this
|
|
2693
|
+
return this[kId][11] === otherId[kId][11] && this[kId].equals(otherId[kId]);
|
|
2683
2694
|
}
|
|
2684
2695
|
if (typeof otherId === 'string' &&
|
|
2685
2696
|
ObjectId.isValid(otherId) &&
|
|
@@ -2696,7 +2707,9 @@ var ObjectId = /** @class */ (function () {
|
|
|
2696
2707
|
if (typeof otherId === 'object' &&
|
|
2697
2708
|
'toHexString' in otherId &&
|
|
2698
2709
|
typeof otherId.toHexString === 'function') {
|
|
2699
|
-
|
|
2710
|
+
var otherIdString = otherId.toHexString();
|
|
2711
|
+
var thisIdString = this.toHexString().toLowerCase();
|
|
2712
|
+
return typeof otherIdString === 'string' && otherIdString.toLowerCase() === thisIdString;
|
|
2700
2713
|
}
|
|
2701
2714
|
return false;
|
|
2702
2715
|
};
|
|
@@ -2798,6 +2811,7 @@ function alphabetize(str) {
|
|
|
2798
2811
|
/**
|
|
2799
2812
|
* A class representation of the BSON RegExp type.
|
|
2800
2813
|
* @public
|
|
2814
|
+
* @category BSONType
|
|
2801
2815
|
*/
|
|
2802
2816
|
var BSONRegExp = /** @class */ (function () {
|
|
2803
2817
|
/**
|
|
@@ -2863,6 +2877,7 @@ Object.defineProperty(BSONRegExp.prototype, '_bsontype', { value: 'BSONRegExp' }
|
|
|
2863
2877
|
/**
|
|
2864
2878
|
* A class representation of the BSON Symbol type.
|
|
2865
2879
|
* @public
|
|
2880
|
+
* @category BSONType
|
|
2866
2881
|
*/
|
|
2867
2882
|
var BSONSymbol = /** @class */ (function () {
|
|
2868
2883
|
/**
|
|
@@ -2905,7 +2920,10 @@ Object.defineProperty(BSONSymbol.prototype, '_bsontype', { value: 'Symbol' });
|
|
|
2905
2920
|
|
|
2906
2921
|
/** @public */
|
|
2907
2922
|
var LongWithoutOverridesClass = Long;
|
|
2908
|
-
/**
|
|
2923
|
+
/**
|
|
2924
|
+
* @public
|
|
2925
|
+
* @category BSONType
|
|
2926
|
+
* */
|
|
2909
2927
|
var Timestamp = /** @class */ (function (_super) {
|
|
2910
2928
|
__extends(Timestamp, _super);
|
|
2911
2929
|
function Timestamp(low, high) {
|