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/package.json CHANGED
@@ -13,7 +13,7 @@
13
13
  "etc/prepare.js"
14
14
  ],
15
15
  "types": "bson.d.ts",
16
- "version": "5.0.0-alpha.0",
16
+ "version": "5.0.0-alpha.1",
17
17
  "author": {
18
18
  "name": "The MongoDB NodeJS Team",
19
19
  "email": "dbx-node@mongodb.com"
package/src/binary.ts CHANGED
@@ -2,7 +2,7 @@ import { bufferToUuidHexString, uuidHexStringToBuffer, uuidValidateString } from
2
2
  import { isUint8Array } from './parser/utils';
3
3
  import type { EJSONOptions } from './extended_json';
4
4
  import { BSONError, BSONTypeError } from './error';
5
- import { BSON_BINARY_SUBTYPE_UUID_NEW } from './constants';
5
+ import { BSON_BINARY_SUBTYPE_UUID_NEW, BSON_MAJOR_VERSION } from './constants';
6
6
  import { ByteUtils } from './utils/byte_utils';
7
7
 
8
8
  /** @public */
@@ -32,8 +32,8 @@ export class Binary {
32
32
  return 'Binary';
33
33
  }
34
34
  /** @internal */
35
- get [Symbol.for('@@mdb.bson.version')](): 5 {
36
- return 5;
35
+ get [Symbol.for('@@mdb.bson.version')](): BSON_MAJOR_VERSION {
36
+ return BSON_MAJOR_VERSION;
37
37
  }
38
38
 
39
39
  /**
@@ -310,8 +310,8 @@ const UUID_BYTE_LENGTH = 16;
310
310
  */
311
311
  export class UUID extends Binary {
312
312
  /** @internal */
313
- get [Symbol.for('@@mdb.bson.version')](): 5 {
314
- return 5;
313
+ get [Symbol.for('@@mdb.bson.version')](): BSON_MAJOR_VERSION {
314
+ return BSON_MAJOR_VERSION;
315
315
  }
316
316
 
317
317
  static cacheHexString: boolean;
package/src/code.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import type { Document } from './bson';
2
+ import { BSON_MAJOR_VERSION } from './constants';
2
3
 
3
4
  /** @public */
4
5
  export interface CodeExtended {
@@ -16,8 +17,8 @@ export class Code {
16
17
  return 'Code';
17
18
  }
18
19
  /** @internal */
19
- get [Symbol.for('@@mdb.bson.version')](): 5 {
20
- return 5;
20
+ get [Symbol.for('@@mdb.bson.version')](): BSON_MAJOR_VERSION {
21
+ return BSON_MAJOR_VERSION;
21
22
  }
22
23
 
23
24
  code: string;
package/src/constants.ts CHANGED
@@ -1,3 +1,8 @@
1
+ /** @internal */
2
+ export type BSON_MAJOR_VERSION = 5;
3
+ /** @internal */
4
+ export const BSON_MAJOR_VERSION: BSON_MAJOR_VERSION = 5;
5
+
1
6
  /** @internal */
2
7
  export const BSON_INT32_MAX = 0x7fffffff;
3
8
  /** @internal */
package/src/db_ref.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import type { Document } from './bson';
2
+ import { BSON_MAJOR_VERSION } from './constants';
2
3
  import type { EJSONOptions } from './extended_json';
3
4
  import type { ObjectId } from './objectid';
4
5
 
@@ -33,8 +34,8 @@ export class DBRef {
33
34
  return 'DBRef';
34
35
  }
35
36
  /** @internal */
36
- get [Symbol.for('@@mdb.bson.version')](): 5 {
37
- return 5;
37
+ get [Symbol.for('@@mdb.bson.version')](): BSON_MAJOR_VERSION {
38
+ return BSON_MAJOR_VERSION;
38
39
  }
39
40
 
40
41
  collection!: string;
package/src/decimal128.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import { BSON_MAJOR_VERSION } from './constants';
1
2
  import { BSONTypeError } from './error';
2
3
  import { Long } from './long';
3
4
  import { isUint8Array } from './parser/utils';
@@ -131,8 +132,8 @@ export class Decimal128 {
131
132
  return 'Decimal128';
132
133
  }
133
134
  /** @internal */
134
- get [Symbol.for('@@mdb.bson.version')](): 5 {
135
- return 5;
135
+ get [Symbol.for('@@mdb.bson.version')](): BSON_MAJOR_VERSION {
136
+ return BSON_MAJOR_VERSION;
136
137
  }
137
138
 
138
139
  readonly bytes!: Uint8Array;
package/src/double.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import { BSON_MAJOR_VERSION } from './constants';
1
2
  import type { EJSONOptions } from './extended_json';
2
3
 
3
4
  /** @public */
@@ -15,8 +16,8 @@ export class Double {
15
16
  return 'Double';
16
17
  }
17
18
  /** @internal */
18
- get [Symbol.for('@@mdb.bson.version')](): 5 {
19
- return 5;
19
+ get [Symbol.for('@@mdb.bson.version')](): BSON_MAJOR_VERSION {
20
+ return BSON_MAJOR_VERSION;
20
21
  }
21
22
 
22
23
  value!: number;
package/src/int_32.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import { BSON_MAJOR_VERSION } from './constants';
1
2
  import type { EJSONOptions } from './extended_json';
2
3
 
3
4
  /** @public */
@@ -15,8 +16,8 @@ export class Int32 {
15
16
  return 'Int32';
16
17
  }
17
18
  /** @internal */
18
- get [Symbol.for('@@mdb.bson.version')](): 5 {
19
- return 5;
19
+ get [Symbol.for('@@mdb.bson.version')](): BSON_MAJOR_VERSION {
20
+ return BSON_MAJOR_VERSION;
20
21
  }
21
22
 
22
23
  value!: number;
package/src/long.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import { BSON_MAJOR_VERSION } from './constants';
1
2
  import type { EJSONOptions } from './extended_json';
2
3
  import type { Timestamp } from './timestamp';
3
4
 
@@ -103,8 +104,8 @@ export class Long {
103
104
  return 'Long';
104
105
  }
105
106
  /** @internal */
106
- get [Symbol.for('@@mdb.bson.version')](): 5 {
107
- return 5;
107
+ get [Symbol.for('@@mdb.bson.version')](): BSON_MAJOR_VERSION {
108
+ return BSON_MAJOR_VERSION;
108
109
  }
109
110
 
110
111
  /** An indicator used to reliably determine if an object is a Long or not. */
package/src/max_key.ts CHANGED
@@ -1,3 +1,5 @@
1
+ import { BSON_MAJOR_VERSION } from './constants';
2
+
1
3
  /** @public */
2
4
  export interface MaxKeyExtended {
3
5
  $maxKey: 1;
@@ -13,8 +15,8 @@ export class MaxKey {
13
15
  return 'MaxKey';
14
16
  }
15
17
  /** @internal */
16
- get [Symbol.for('@@mdb.bson.version')](): 5 {
17
- return 5;
18
+ get [Symbol.for('@@mdb.bson.version')](): BSON_MAJOR_VERSION {
19
+ return BSON_MAJOR_VERSION;
18
20
  }
19
21
 
20
22
  /** @internal */
package/src/min_key.ts CHANGED
@@ -1,3 +1,5 @@
1
+ import { BSON_MAJOR_VERSION } from './constants';
2
+
1
3
  /** @public */
2
4
  export interface MinKeyExtended {
3
5
  $minKey: 1;
@@ -13,8 +15,8 @@ export class MinKey {
13
15
  return 'MinKey';
14
16
  }
15
17
  /** @internal */
16
- get [Symbol.for('@@mdb.bson.version')](): 5 {
17
- return 5;
18
+ get [Symbol.for('@@mdb.bson.version')](): BSON_MAJOR_VERSION {
19
+ return BSON_MAJOR_VERSION;
18
20
  }
19
21
 
20
22
  /** @internal */
package/src/objectid.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import { BSON_MAJOR_VERSION } from './constants';
1
2
  import { BSONTypeError } from './error';
2
3
  import { isUint8Array } from './parser/utils';
3
4
  import { BSONDataView, ByteUtils } from './utils/byte_utils';
@@ -32,8 +33,8 @@ export class ObjectId {
32
33
  return 'ObjectId';
33
34
  }
34
35
  /** @internal */
35
- get [Symbol.for('@@mdb.bson.version')](): 5 {
36
- return 5;
36
+ get [Symbol.for('@@mdb.bson.version')](): BSON_MAJOR_VERSION {
37
+ return BSON_MAJOR_VERSION;
37
38
  }
38
39
 
39
40
  /** @internal */
@@ -726,7 +726,7 @@ export function serializeInto(
726
726
  );
727
727
  } else if (value._bsontype === 'Binary') {
728
728
  index = serializeBinary(buffer, key, value, index);
729
- } else if (value._bsontype === 'Symbol') {
729
+ } else if (value._bsontype === 'BSONSymbol') {
730
730
  index = serializeSymbol(buffer, key, value, index);
731
731
  } else if (value._bsontype === 'DBRef') {
732
732
  index = serializeDBRef(buffer, key, value, index, depth, serializeFunctions, path);
@@ -829,7 +829,7 @@ export function serializeInto(
829
829
  index = serializeFunction(buffer, key, value, index);
830
830
  } else if (value._bsontype === 'Binary') {
831
831
  index = serializeBinary(buffer, key, value, index);
832
- } else if (value._bsontype === 'Symbol') {
832
+ } else if (value._bsontype === 'BSONSymbol') {
833
833
  index = serializeSymbol(buffer, key, value, index);
834
834
  } else if (value._bsontype === 'DBRef') {
835
835
  index = serializeDBRef(buffer, key, value, index, depth, serializeFunctions, path);
@@ -936,7 +936,7 @@ export function serializeInto(
936
936
  index = serializeFunction(buffer, key, value, index);
937
937
  } else if (value._bsontype === 'Binary') {
938
938
  index = serializeBinary(buffer, key, value, index);
939
- } else if (value._bsontype === 'Symbol') {
939
+ } else if (value._bsontype === 'BSONSymbol') {
940
940
  index = serializeSymbol(buffer, key, value, index);
941
941
  } else if (value._bsontype === 'DBRef') {
942
942
  index = serializeDBRef(buffer, key, value, index, depth, serializeFunctions, path);
package/src/regexp.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import { BSON_MAJOR_VERSION } from './constants';
1
2
  import { BSONError, BSONTypeError } from './error';
2
3
  import type { EJSONOptions } from './extended_json';
3
4
 
@@ -29,8 +30,8 @@ export class BSONRegExp {
29
30
  return 'BSONRegExp';
30
31
  }
31
32
  /** @internal */
32
- get [Symbol.for('@@mdb.bson.version')](): 5 {
33
- return 5;
33
+ get [Symbol.for('@@mdb.bson.version')](): BSON_MAJOR_VERSION {
34
+ return BSON_MAJOR_VERSION;
34
35
  }
35
36
 
36
37
  pattern!: string;
package/src/symbol.ts CHANGED
@@ -1,3 +1,5 @@
1
+ import { BSON_MAJOR_VERSION } from './constants';
2
+
1
3
  /** @public */
2
4
  export interface BSONSymbolExtended {
3
5
  $symbol: string;
@@ -13,8 +15,8 @@ export class BSONSymbol {
13
15
  return 'BSONSymbol';
14
16
  }
15
17
  /** @internal */
16
- get [Symbol.for('@@mdb.bson.version')](): 5 {
17
- return 5;
18
+ get [Symbol.for('@@mdb.bson.version')](): BSON_MAJOR_VERSION {
19
+ return BSON_MAJOR_VERSION;
18
20
  }
19
21
 
20
22
  value!: string;
package/src/timestamp.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import { BSON_MAJOR_VERSION } from './constants';
1
2
  import { BSONError } from './error';
2
3
  import type { Int32 } from './int_32';
3
4
  import { Long } from './long';
@@ -33,8 +34,8 @@ export class Timestamp extends LongWithoutOverridesClass {
33
34
  return 'Timestamp';
34
35
  }
35
36
  /** @internal */
36
- get [Symbol.for('@@mdb.bson.version')](): 5 {
37
- return 5;
37
+ get [Symbol.for('@@mdb.bson.version')](): BSON_MAJOR_VERSION {
38
+ return BSON_MAJOR_VERSION;
38
39
  }
39
40
 
40
41
  static readonly MAX_VALUE = Long.MAX_UNSIGNED_VALUE;