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.cjs CHANGED
@@ -252,6 +252,7 @@ function isDate(d) {
252
252
  return Object.prototype.toString.call(d) === '[object Date]';
253
253
  }
254
254
 
255
+ const BSON_MAJOR_VERSION = 5;
255
256
  const BSON_INT32_MAX = 0x7fffffff;
256
257
  const BSON_INT32_MIN = -0x80000000;
257
258
  const BSON_INT64_MAX = Math.pow(2, 63) - 1;
@@ -310,7 +311,7 @@ class Binary {
310
311
  return 'Binary';
311
312
  }
312
313
  get [Symbol.for('@@mdb.bson.version')]() {
313
- return 5;
314
+ return BSON_MAJOR_VERSION;
314
315
  }
315
316
  constructor(buffer, subType) {
316
317
  if (!(buffer == null) &&
@@ -484,7 +485,7 @@ Binary.SUBTYPE_USER_DEFINED = 128;
484
485
  const UUID_BYTE_LENGTH = 16;
485
486
  class UUID extends Binary {
486
487
  get [Symbol.for('@@mdb.bson.version')]() {
487
- return 5;
488
+ return BSON_MAJOR_VERSION;
488
489
  }
489
490
  constructor(input) {
490
491
  let bytes;
@@ -595,7 +596,7 @@ class Code {
595
596
  return 'Code';
596
597
  }
597
598
  get [Symbol.for('@@mdb.bson.version')]() {
598
- return 5;
599
+ return BSON_MAJOR_VERSION;
599
600
  }
600
601
  constructor(code, scope) {
601
602
  this.code = code.toString();
@@ -639,7 +640,7 @@ class DBRef {
639
640
  return 'DBRef';
640
641
  }
641
642
  get [Symbol.for('@@mdb.bson.version')]() {
642
- return 5;
643
+ return BSON_MAJOR_VERSION;
643
644
  }
644
645
  constructor(collection, oid, db, fields) {
645
646
  const parts = collection.split('.');
@@ -715,7 +716,7 @@ class Long {
715
716
  return 'Long';
716
717
  }
717
718
  get [Symbol.for('@@mdb.bson.version')]() {
718
- return 5;
719
+ return BSON_MAJOR_VERSION;
719
720
  }
720
721
  get __isLong__() {
721
722
  return true;
@@ -1403,7 +1404,7 @@ class Decimal128 {
1403
1404
  return 'Decimal128';
1404
1405
  }
1405
1406
  get [Symbol.for('@@mdb.bson.version')]() {
1406
- return 5;
1407
+ return BSON_MAJOR_VERSION;
1407
1408
  }
1408
1409
  constructor(bytes) {
1409
1410
  if (typeof bytes === 'string') {
@@ -1832,7 +1833,7 @@ class Double {
1832
1833
  return 'Double';
1833
1834
  }
1834
1835
  get [Symbol.for('@@mdb.bson.version')]() {
1835
- return 5;
1836
+ return BSON_MAJOR_VERSION;
1836
1837
  }
1837
1838
  constructor(value) {
1838
1839
  if (value instanceof Number) {
@@ -1886,7 +1887,7 @@ class Int32 {
1886
1887
  return 'Int32';
1887
1888
  }
1888
1889
  get [Symbol.for('@@mdb.bson.version')]() {
1889
- return 5;
1890
+ return BSON_MAJOR_VERSION;
1890
1891
  }
1891
1892
  constructor(value) {
1892
1893
  if (value instanceof Number) {
@@ -1924,7 +1925,7 @@ class MaxKey {
1924
1925
  return 'MaxKey';
1925
1926
  }
1926
1927
  get [Symbol.for('@@mdb.bson.version')]() {
1927
- return 5;
1928
+ return BSON_MAJOR_VERSION;
1928
1929
  }
1929
1930
  toExtendedJSON() {
1930
1931
  return { $maxKey: 1 };
@@ -1945,7 +1946,7 @@ class MinKey {
1945
1946
  return 'MinKey';
1946
1947
  }
1947
1948
  get [Symbol.for('@@mdb.bson.version')]() {
1948
- return 5;
1949
+ return BSON_MAJOR_VERSION;
1949
1950
  }
1950
1951
  toExtendedJSON() {
1951
1952
  return { $minKey: 1 };
@@ -1969,7 +1970,7 @@ class ObjectId {
1969
1970
  return 'ObjectId';
1970
1971
  }
1971
1972
  get [Symbol.for('@@mdb.bson.version')]() {
1972
- return 5;
1973
+ return BSON_MAJOR_VERSION;
1973
1974
  }
1974
1975
  constructor(inputId) {
1975
1976
  let workingId;
@@ -2302,7 +2303,7 @@ class BSONRegExp {
2302
2303
  return 'BSONRegExp';
2303
2304
  }
2304
2305
  get [Symbol.for('@@mdb.bson.version')]() {
2305
- return 5;
2306
+ return BSON_MAJOR_VERSION;
2306
2307
  }
2307
2308
  constructor(pattern, options) {
2308
2309
  this.pattern = pattern;
@@ -2363,7 +2364,7 @@ class BSONSymbol {
2363
2364
  return 'BSONSymbol';
2364
2365
  }
2365
2366
  get [Symbol.for('@@mdb.bson.version')]() {
2366
- return 5;
2367
+ return BSON_MAJOR_VERSION;
2367
2368
  }
2368
2369
  constructor(value) {
2369
2370
  this.value = value;
@@ -2397,7 +2398,7 @@ class Timestamp extends LongWithoutOverridesClass {
2397
2398
  return 'Timestamp';
2398
2399
  }
2399
2400
  get [Symbol.for('@@mdb.bson.version')]() {
2400
- return 5;
2401
+ return BSON_MAJOR_VERSION;
2401
2402
  }
2402
2403
  constructor(low) {
2403
2404
  if (low == null) {
@@ -3416,7 +3417,7 @@ function serializeInto(buffer, object, checkKeys, startingIndex, depth, serializ
3416
3417
  else if (value._bsontype === 'Binary') {
3417
3418
  index = serializeBinary(buffer, key, value, index);
3418
3419
  }
3419
- else if (value._bsontype === 'Symbol') {
3420
+ else if (value._bsontype === 'BSONSymbol') {
3420
3421
  index = serializeSymbol(buffer, key, value, index);
3421
3422
  }
3422
3423
  else if (value._bsontype === 'DBRef') {
@@ -3511,7 +3512,7 @@ function serializeInto(buffer, object, checkKeys, startingIndex, depth, serializ
3511
3512
  else if (value._bsontype === 'Binary') {
3512
3513
  index = serializeBinary(buffer, key, value, index);
3513
3514
  }
3514
- else if (value._bsontype === 'Symbol') {
3515
+ else if (value._bsontype === 'BSONSymbol') {
3515
3516
  index = serializeSymbol(buffer, key, value, index);
3516
3517
  }
3517
3518
  else if (value._bsontype === 'DBRef') {
@@ -3612,7 +3613,7 @@ function serializeInto(buffer, object, checkKeys, startingIndex, depth, serializ
3612
3613
  else if (value._bsontype === 'Binary') {
3613
3614
  index = serializeBinary(buffer, key, value, index);
3614
3615
  }
3615
- else if (value._bsontype === 'Symbol') {
3616
+ else if (value._bsontype === 'BSONSymbol') {
3616
3617
  index = serializeSymbol(buffer, key, value, index);
3617
3618
  }
3618
3619
  else if (value._bsontype === 'DBRef') {