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.browser.esm.js
CHANGED
|
@@ -2444,6 +2444,7 @@ Object.defineProperty(UUID.prototype, '_bsontype', { value: 'UUID' });
|
|
|
2444
2444
|
/**
|
|
2445
2445
|
* A class representation of the BSON Binary type.
|
|
2446
2446
|
* @public
|
|
2447
|
+
* @category BSONType
|
|
2447
2448
|
*/
|
|
2448
2449
|
var Binary = /** @class */ (function () {
|
|
2449
2450
|
/**
|
|
@@ -2674,6 +2675,7 @@ Object.defineProperty(Binary.prototype, '_bsontype', { value: 'Binary' });
|
|
|
2674
2675
|
/**
|
|
2675
2676
|
* A class representation of the BSON Code type.
|
|
2676
2677
|
* @public
|
|
2678
|
+
* @category BSONType
|
|
2677
2679
|
*/
|
|
2678
2680
|
var Code = /** @class */ (function () {
|
|
2679
2681
|
/**
|
|
@@ -2722,6 +2724,7 @@ function isDBRefLike(value) {
|
|
|
2722
2724
|
/**
|
|
2723
2725
|
* A class representation of the BSON DBRef type.
|
|
2724
2726
|
* @public
|
|
2727
|
+
* @category BSONType
|
|
2725
2728
|
*/
|
|
2726
2729
|
var DBRef = /** @class */ (function () {
|
|
2727
2730
|
/**
|
|
@@ -2826,6 +2829,7 @@ var UINT_CACHE = {};
|
|
|
2826
2829
|
/**
|
|
2827
2830
|
* A class representing a 64-bit integer
|
|
2828
2831
|
* @public
|
|
2832
|
+
* @category BSONType
|
|
2829
2833
|
* @remarks
|
|
2830
2834
|
* The internal representation of a long is the two given signed, 32-bit values.
|
|
2831
2835
|
* We use 32-bit pieces because these are the size of integers on which
|
|
@@ -3788,6 +3792,7 @@ function invalidErr(string, message) {
|
|
|
3788
3792
|
/**
|
|
3789
3793
|
* A class representation of the BSON Decimal128 type.
|
|
3790
3794
|
* @public
|
|
3795
|
+
* @category BSONType
|
|
3791
3796
|
*/
|
|
3792
3797
|
var Decimal128 = /** @class */ (function () {
|
|
3793
3798
|
/**
|
|
@@ -4359,6 +4364,7 @@ Object.defineProperty(Decimal128.prototype, '_bsontype', { value: 'Decimal128' }
|
|
|
4359
4364
|
/**
|
|
4360
4365
|
* A class representation of the BSON Double type.
|
|
4361
4366
|
* @public
|
|
4367
|
+
* @category BSONType
|
|
4362
4368
|
*/
|
|
4363
4369
|
var Double = /** @class */ (function () {
|
|
4364
4370
|
/**
|
|
@@ -4430,6 +4436,7 @@ Object.defineProperty(Double.prototype, '_bsontype', { value: 'Double' });
|
|
|
4430
4436
|
/**
|
|
4431
4437
|
* A class representation of a BSON Int32 type.
|
|
4432
4438
|
* @public
|
|
4439
|
+
* @category BSONType
|
|
4433
4440
|
*/
|
|
4434
4441
|
var Int32 = /** @class */ (function () {
|
|
4435
4442
|
/**
|
|
@@ -4483,6 +4490,7 @@ Object.defineProperty(Int32.prototype, '_bsontype', { value: 'Int32' });
|
|
|
4483
4490
|
/**
|
|
4484
4491
|
* A class representation of the BSON MaxKey type.
|
|
4485
4492
|
* @public
|
|
4493
|
+
* @category BSONType
|
|
4486
4494
|
*/
|
|
4487
4495
|
var MaxKey = /** @class */ (function () {
|
|
4488
4496
|
function MaxKey() {
|
|
@@ -4511,6 +4519,7 @@ Object.defineProperty(MaxKey.prototype, '_bsontype', { value: 'MaxKey' });
|
|
|
4511
4519
|
/**
|
|
4512
4520
|
* A class representation of the BSON MinKey type.
|
|
4513
4521
|
* @public
|
|
4522
|
+
* @category BSONType
|
|
4514
4523
|
*/
|
|
4515
4524
|
var MinKey = /** @class */ (function () {
|
|
4516
4525
|
function MinKey() {
|
|
@@ -4544,6 +4553,7 @@ var kId = Symbol('id');
|
|
|
4544
4553
|
/**
|
|
4545
4554
|
* A class representation of the BSON ObjectId type.
|
|
4546
4555
|
* @public
|
|
4556
|
+
* @category BSONType
|
|
4547
4557
|
*/
|
|
4548
4558
|
var ObjectId = /** @class */ (function () {
|
|
4549
4559
|
/**
|
|
@@ -4577,7 +4587,8 @@ var ObjectId = /** @class */ (function () {
|
|
|
4577
4587
|
this[kId] = ObjectId.generate(typeof workingId === 'number' ? workingId : undefined);
|
|
4578
4588
|
}
|
|
4579
4589
|
else if (ArrayBuffer.isView(workingId) && workingId.byteLength === 12) {
|
|
4580
|
-
|
|
4590
|
+
// If intstanceof matches we can escape calling ensure buffer in Node.js environments
|
|
4591
|
+
this[kId] = workingId instanceof buffer_1 ? workingId : ensureBuffer(workingId);
|
|
4581
4592
|
}
|
|
4582
4593
|
else if (typeof workingId === 'string') {
|
|
4583
4594
|
if (workingId.length === 12) {
|
|
@@ -4593,7 +4604,7 @@ var ObjectId = /** @class */ (function () {
|
|
|
4593
4604
|
this[kId] = buffer_1.from(workingId, 'hex');
|
|
4594
4605
|
}
|
|
4595
4606
|
else {
|
|
4596
|
-
throw new BSONTypeError('Argument passed in must be a string of 12 bytes or a string of 24 hex characters');
|
|
4607
|
+
throw new BSONTypeError('Argument passed in must be a string of 12 bytes or a string of 24 hex characters or an integer');
|
|
4597
4608
|
}
|
|
4598
4609
|
}
|
|
4599
4610
|
else {
|
|
@@ -4710,7 +4721,7 @@ var ObjectId = /** @class */ (function () {
|
|
|
4710
4721
|
return false;
|
|
4711
4722
|
}
|
|
4712
4723
|
if (otherId instanceof ObjectId) {
|
|
4713
|
-
return this
|
|
4724
|
+
return this[kId][11] === otherId[kId][11] && this[kId].equals(otherId[kId]);
|
|
4714
4725
|
}
|
|
4715
4726
|
if (typeof otherId === 'string' &&
|
|
4716
4727
|
ObjectId.isValid(otherId) &&
|
|
@@ -4727,7 +4738,9 @@ var ObjectId = /** @class */ (function () {
|
|
|
4727
4738
|
if (typeof otherId === 'object' &&
|
|
4728
4739
|
'toHexString' in otherId &&
|
|
4729
4740
|
typeof otherId.toHexString === 'function') {
|
|
4730
|
-
|
|
4741
|
+
var otherIdString = otherId.toHexString();
|
|
4742
|
+
var thisIdString = this.toHexString().toLowerCase();
|
|
4743
|
+
return typeof otherIdString === 'string' && otherIdString.toLowerCase() === thisIdString;
|
|
4731
4744
|
}
|
|
4732
4745
|
return false;
|
|
4733
4746
|
};
|
|
@@ -4829,6 +4842,7 @@ function alphabetize(str) {
|
|
|
4829
4842
|
/**
|
|
4830
4843
|
* A class representation of the BSON RegExp type.
|
|
4831
4844
|
* @public
|
|
4845
|
+
* @category BSONType
|
|
4832
4846
|
*/
|
|
4833
4847
|
var BSONRegExp = /** @class */ (function () {
|
|
4834
4848
|
/**
|
|
@@ -4894,6 +4908,7 @@ Object.defineProperty(BSONRegExp.prototype, '_bsontype', { value: 'BSONRegExp' }
|
|
|
4894
4908
|
/**
|
|
4895
4909
|
* A class representation of the BSON Symbol type.
|
|
4896
4910
|
* @public
|
|
4911
|
+
* @category BSONType
|
|
4897
4912
|
*/
|
|
4898
4913
|
var BSONSymbol = /** @class */ (function () {
|
|
4899
4914
|
/**
|
|
@@ -4936,7 +4951,10 @@ Object.defineProperty(BSONSymbol.prototype, '_bsontype', { value: 'Symbol' });
|
|
|
4936
4951
|
|
|
4937
4952
|
/** @public */
|
|
4938
4953
|
var LongWithoutOverridesClass = Long;
|
|
4939
|
-
/**
|
|
4954
|
+
/**
|
|
4955
|
+
* @public
|
|
4956
|
+
* @category BSONType
|
|
4957
|
+
* */
|
|
4940
4958
|
var Timestamp = /** @class */ (function (_super) {
|
|
4941
4959
|
__extends(Timestamp, _super);
|
|
4942
4960
|
function Timestamp(low, high) {
|