bson 4.2.2 → 4.4.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/HISTORY.md +44 -0
- package/bower.json +1 -1
- package/bson.d.ts +77 -6
- package/dist/bson.browser.esm.js +2116 -1292
- package/dist/bson.browser.esm.js.map +1 -1
- package/dist/bson.browser.umd.js +2172 -1347
- package/dist/bson.browser.umd.js.map +1 -1
- package/dist/bson.bundle.js +2174 -1347
- package/dist/bson.bundle.js.map +1 -1
- package/dist/bson.esm.js +2061 -1241
- package/dist/bson.esm.js.map +1 -1
- package/lib/binary.js +71 -60
- package/lib/binary.js.map +1 -1
- package/lib/bson.js +60 -52
- package/lib/bson.js.map +1 -1
- package/lib/code.js +18 -15
- package/lib/code.js.map +1 -1
- package/lib/db_ref.js +40 -30
- package/lib/db_ref.js.map +1 -1
- package/lib/decimal128.js +135 -124
- package/lib/decimal128.js.map +1 -1
- package/lib/double.js +24 -21
- package/lib/double.js.map +1 -1
- package/lib/ensure_buffer.js +4 -7
- package/lib/ensure_buffer.js.map +1 -1
- package/lib/extended_json.js +113 -71
- package/lib/extended_json.js.map +1 -1
- package/lib/float_parser.js +21 -21
- package/lib/float_parser.js.map +1 -1
- package/lib/int_32.js +19 -16
- package/lib/int_32.js.map +1 -1
- package/lib/long.js +248 -230
- package/lib/long.js.map +1 -1
- package/lib/map.js +54 -45
- package/lib/map.js.map +1 -1
- package/lib/max_key.js +16 -11
- package/lib/max_key.js.map +1 -1
- package/lib/min_key.js +16 -11
- package/lib/min_key.js.map +1 -1
- package/lib/objectid.js +96 -93
- package/lib/objectid.js.map +1 -1
- package/lib/parser/calculate_size.js +17 -15
- package/lib/parser/calculate_size.js.map +1 -1
- package/lib/parser/deserializer.js +135 -123
- package/lib/parser/deserializer.js.map +1 -1
- package/lib/parser/serializer.js +108 -88
- package/lib/parser/serializer.js.map +1 -1
- package/lib/parser/utils.js +47 -25
- package/lib/parser/utils.js.map +1 -1
- package/lib/regexp.js +16 -15
- package/lib/regexp.js.map +1 -1
- package/lib/symbol.js +21 -18
- package/lib/symbol.js.map +1 -1
- package/lib/timestamp.js +50 -27
- package/lib/timestamp.js.map +1 -1
- package/lib/uuid.js +173 -42
- package/lib/uuid.js.map +1 -1
- package/lib/uuid_utils.js +34 -0
- package/lib/uuid_utils.js.map +1 -0
- package/lib/validate_utf8.js +12 -12
- package/lib/validate_utf8.js.map +1 -1
- package/package.json +5 -4
- package/src/binary.ts +20 -6
- package/src/bson.ts +3 -0
- package/src/code.ts +6 -2
- package/src/db_ref.ts +14 -5
- package/src/decimal128.ts +14 -5
- package/src/double.ts +4 -2
- package/src/ensure_buffer.ts +7 -7
- package/src/extended_json.ts +64 -16
- package/src/int_32.ts +4 -2
- package/src/long.ts +22 -8
- package/src/max_key.ts +5 -1
- package/src/min_key.ts +5 -1
- package/src/objectid.ts +15 -20
- package/src/parser/calculate_size.ts +8 -11
- package/src/parser/deserializer.ts +46 -36
- package/src/parser/serializer.ts +13 -12
- package/src/parser/utils.ts +49 -17
- package/src/regexp.ts +5 -5
- package/src/symbol.ts +4 -2
- package/src/timestamp.ts +6 -1
- package/src/uuid.ts +192 -40
- package/src/uuid_utils.ts +31 -0
package/lib/int_32.js
CHANGED
|
@@ -5,13 +5,15 @@ exports.Int32 = void 0;
|
|
|
5
5
|
* A class representation of a BSON Int32 type.
|
|
6
6
|
* @public
|
|
7
7
|
*/
|
|
8
|
-
|
|
8
|
+
var Int32 = /** @class */ (function () {
|
|
9
9
|
/**
|
|
10
10
|
* Create an Int32 type
|
|
11
11
|
*
|
|
12
12
|
* @param value - the number we want to represent as an int32.
|
|
13
13
|
*/
|
|
14
|
-
|
|
14
|
+
function Int32(value) {
|
|
15
|
+
if (!(this instanceof Int32))
|
|
16
|
+
return new Int32(value);
|
|
15
17
|
if (value instanceof Number) {
|
|
16
18
|
value = value.valueOf();
|
|
17
19
|
}
|
|
@@ -22,31 +24,32 @@ class Int32 {
|
|
|
22
24
|
*
|
|
23
25
|
* @returns returns the wrapped int32 number.
|
|
24
26
|
*/
|
|
25
|
-
valueOf() {
|
|
27
|
+
Int32.prototype.valueOf = function () {
|
|
26
28
|
return this.value;
|
|
27
|
-
}
|
|
29
|
+
};
|
|
28
30
|
/** @internal */
|
|
29
|
-
toJSON() {
|
|
31
|
+
Int32.prototype.toJSON = function () {
|
|
30
32
|
return this.value;
|
|
31
|
-
}
|
|
33
|
+
};
|
|
32
34
|
/** @internal */
|
|
33
|
-
toExtendedJSON(options) {
|
|
35
|
+
Int32.prototype.toExtendedJSON = function (options) {
|
|
34
36
|
if (options && (options.relaxed || options.legacy))
|
|
35
37
|
return this.value;
|
|
36
38
|
return { $numberInt: this.value.toString() };
|
|
37
|
-
}
|
|
39
|
+
};
|
|
38
40
|
/** @internal */
|
|
39
|
-
|
|
41
|
+
Int32.fromExtendedJSON = function (doc, options) {
|
|
40
42
|
return options && options.relaxed ? parseInt(doc.$numberInt, 10) : new Int32(doc.$numberInt);
|
|
41
|
-
}
|
|
43
|
+
};
|
|
42
44
|
/** @internal */
|
|
43
|
-
[Symbol.for('nodejs.util.inspect.custom')]() {
|
|
45
|
+
Int32.prototype[Symbol.for('nodejs.util.inspect.custom')] = function () {
|
|
44
46
|
return this.inspect();
|
|
45
|
-
}
|
|
46
|
-
inspect() {
|
|
47
|
-
return
|
|
48
|
-
}
|
|
49
|
-
|
|
47
|
+
};
|
|
48
|
+
Int32.prototype.inspect = function () {
|
|
49
|
+
return "new Int32(" + this.valueOf() + ")";
|
|
50
|
+
};
|
|
51
|
+
return Int32;
|
|
52
|
+
}());
|
|
50
53
|
exports.Int32 = Int32;
|
|
51
54
|
Object.defineProperty(Int32.prototype, '_bsontype', { value: 'Int32' });
|
|
52
55
|
//# sourceMappingURL=int_32.js.map
|
package/lib/int_32.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"int_32.js","sourceRoot":"","sources":["../src/int_32.ts"],"names":[],"mappings":";;;AAOA;;;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