bson 5.0.0-alpha.0 → 5.0.0-alpha.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/lib/bson.mjs CHANGED
@@ -250,6 +250,7 @@ function isDate(d) {
250
250
  return Object.prototype.toString.call(d) === '[object Date]';
251
251
  }
252
252
 
253
+ const BSON_MAJOR_VERSION = 5;
253
254
  const BSON_INT32_MAX = 0x7fffffff;
254
255
  const BSON_INT32_MIN = -0x80000000;
255
256
  const BSON_INT64_MAX = Math.pow(2, 63) - 1;
@@ -308,7 +309,7 @@ class Binary {
308
309
  return 'Binary';
309
310
  }
310
311
  get [Symbol.for('@@mdb.bson.version')]() {
311
- return 5;
312
+ return BSON_MAJOR_VERSION;
312
313
  }
313
314
  constructor(buffer, subType) {
314
315
  if (!(buffer == null) &&
@@ -482,7 +483,7 @@ Binary.SUBTYPE_USER_DEFINED = 128;
482
483
  const UUID_BYTE_LENGTH = 16;
483
484
  class UUID extends Binary {
484
485
  get [Symbol.for('@@mdb.bson.version')]() {
485
- return 5;
486
+ return BSON_MAJOR_VERSION;
486
487
  }
487
488
  constructor(input) {
488
489
  let bytes;
@@ -593,7 +594,7 @@ class Code {
593
594
  return 'Code';
594
595
  }
595
596
  get [Symbol.for('@@mdb.bson.version')]() {
596
- return 5;
597
+ return BSON_MAJOR_VERSION;
597
598
  }
598
599
  constructor(code, scope) {
599
600
  this.code = code.toString();
@@ -637,7 +638,7 @@ class DBRef {
637
638
  return 'DBRef';
638
639
  }
639
640
  get [Symbol.for('@@mdb.bson.version')]() {
640
- return 5;
641
+ return BSON_MAJOR_VERSION;
641
642
  }
642
643
  constructor(collection, oid, db, fields) {
643
644
  const parts = collection.split('.');
@@ -713,7 +714,7 @@ class Long {
713
714
  return 'Long';
714
715
  }
715
716
  get [Symbol.for('@@mdb.bson.version')]() {
716
- return 5;
717
+ return BSON_MAJOR_VERSION;
717
718
  }
718
719
  get __isLong__() {
719
720
  return true;
@@ -1401,7 +1402,7 @@ class Decimal128 {
1401
1402
  return 'Decimal128';
1402
1403
  }
1403
1404
  get [Symbol.for('@@mdb.bson.version')]() {
1404
- return 5;
1405
+ return BSON_MAJOR_VERSION;
1405
1406
  }
1406
1407
  constructor(bytes) {
1407
1408
  if (typeof bytes === 'string') {
@@ -1830,7 +1831,7 @@ class Double {
1830
1831
  return 'Double';
1831
1832
  }
1832
1833
  get [Symbol.for('@@mdb.bson.version')]() {
1833
- return 5;
1834
+ return BSON_MAJOR_VERSION;
1834
1835
  }
1835
1836
  constructor(value) {
1836
1837
  if (value instanceof Number) {
@@ -1884,7 +1885,7 @@ class Int32 {
1884
1885
  return 'Int32';
1885
1886
  }
1886
1887
  get [Symbol.for('@@mdb.bson.version')]() {
1887
- return 5;
1888
+ return BSON_MAJOR_VERSION;
1888
1889
  }
1889
1890
  constructor(value) {
1890
1891
  if (value instanceof Number) {
@@ -1922,7 +1923,7 @@ class MaxKey {
1922
1923
  return 'MaxKey';
1923
1924
  }
1924
1925
  get [Symbol.for('@@mdb.bson.version')]() {
1925
- return 5;
1926
+ return BSON_MAJOR_VERSION;
1926
1927
  }
1927
1928
  toExtendedJSON() {
1928
1929
  return { $maxKey: 1 };
@@ -1943,7 +1944,7 @@ class MinKey {
1943
1944
  return 'MinKey';
1944
1945
  }
1945
1946
  get [Symbol.for('@@mdb.bson.version')]() {
1946
- return 5;
1947
+ return BSON_MAJOR_VERSION;
1947
1948
  }
1948
1949
  toExtendedJSON() {
1949
1950
  return { $minKey: 1 };
@@ -1967,7 +1968,7 @@ class ObjectId {
1967
1968
  return 'ObjectId';
1968
1969
  }
1969
1970
  get [Symbol.for('@@mdb.bson.version')]() {
1970
- return 5;
1971
+ return BSON_MAJOR_VERSION;
1971
1972
  }
1972
1973
  constructor(inputId) {
1973
1974
  let workingId;
@@ -2300,7 +2301,7 @@ class BSONRegExp {
2300
2301
  return 'BSONRegExp';
2301
2302
  }
2302
2303
  get [Symbol.for('@@mdb.bson.version')]() {
2303
- return 5;
2304
+ return BSON_MAJOR_VERSION;
2304
2305
  }
2305
2306
  constructor(pattern, options) {
2306
2307
  this.pattern = pattern;
@@ -2361,7 +2362,7 @@ class BSONSymbol {
2361
2362
  return 'BSONSymbol';
2362
2363
  }
2363
2364
  get [Symbol.for('@@mdb.bson.version')]() {
2364
- return 5;
2365
+ return BSON_MAJOR_VERSION;
2365
2366
  }
2366
2367
  constructor(value) {
2367
2368
  this.value = value;
@@ -2395,7 +2396,7 @@ class Timestamp extends LongWithoutOverridesClass {
2395
2396
  return 'Timestamp';
2396
2397
  }
2397
2398
  get [Symbol.for('@@mdb.bson.version')]() {
2398
- return 5;
2399
+ return BSON_MAJOR_VERSION;
2399
2400
  }
2400
2401
  constructor(low) {
2401
2402
  if (low == null) {
@@ -3414,7 +3415,7 @@ function serializeInto(buffer, object, checkKeys, startingIndex, depth, serializ
3414
3415
  else if (value._bsontype === 'Binary') {
3415
3416
  index = serializeBinary(buffer, key, value, index);
3416
3417
  }
3417
- else if (value._bsontype === 'Symbol') {
3418
+ else if (value._bsontype === 'BSONSymbol') {
3418
3419
  index = serializeSymbol(buffer, key, value, index);
3419
3420
  }
3420
3421
  else if (value._bsontype === 'DBRef') {
@@ -3509,7 +3510,7 @@ function serializeInto(buffer, object, checkKeys, startingIndex, depth, serializ
3509
3510
  else if (value._bsontype === 'Binary') {
3510
3511
  index = serializeBinary(buffer, key, value, index);
3511
3512
  }
3512
- else if (value._bsontype === 'Symbol') {
3513
+ else if (value._bsontype === 'BSONSymbol') {
3513
3514
  index = serializeSymbol(buffer, key, value, index);
3514
3515
  }
3515
3516
  else if (value._bsontype === 'DBRef') {
@@ -3610,7 +3611,7 @@ function serializeInto(buffer, object, checkKeys, startingIndex, depth, serializ
3610
3611
  else if (value._bsontype === 'Binary') {
3611
3612
  index = serializeBinary(buffer, key, value, index);
3612
3613
  }
3613
- else if (value._bsontype === 'Symbol') {
3614
+ else if (value._bsontype === 'BSONSymbol') {
3614
3615
  index = serializeSymbol(buffer, key, value, index);
3615
3616
  }
3616
3617
  else if (value._bsontype === 'DBRef') {