bson 4.0.4 → 4.2.2
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 +56 -1
- package/README.md +7 -9
- package/bower.json +1 -1
- package/bson.d.ts +983 -0
- package/dist/bson.browser.esm.js +7261 -5004
- package/dist/bson.browser.esm.js.map +1 -0
- package/dist/bson.browser.umd.js +7319 -5099
- package/dist/bson.browser.umd.js.map +1 -0
- package/dist/bson.bundle.js +8168 -9216
- package/dist/bson.bundle.js.map +1 -0
- package/dist/bson.esm.js +5643 -5409
- package/dist/bson.esm.js.map +1 -0
- package/etc/prepare.js +19 -0
- package/lib/binary.js +194 -377
- package/lib/binary.js.map +1 -0
- package/lib/bson.js +200 -243
- package/lib/bson.js.map +1 -0
- package/lib/code.js +36 -39
- package/lib/code.js.map +1 -0
- package/lib/constants.js +78 -203
- package/lib/constants.js.map +1 -0
- package/lib/db_ref.js +79 -79
- package/lib/db_ref.js.map +1 -0
- package/lib/decimal128.js +647 -760
- package/lib/decimal128.js.map +1 -0
- package/lib/double.js +61 -58
- package/lib/double.js.map +1 -0
- package/lib/ensure_buffer.js +22 -18
- package/lib/ensure_buffer.js.map +1 -0
- package/lib/extended_json.js +305 -322
- package/lib/extended_json.js.map +1 -0
- package/lib/float_parser.js +98 -104
- package/lib/float_parser.js.map +1 -0
- package/lib/int_32.js +45 -47
- package/lib/int_32.js.map +1 -0
- package/lib/long.js +876 -16
- package/lib/long.js.map +1 -0
- package/lib/map.js +123 -124
- package/lib/map.js.map +1 -0
- package/lib/max_key.js +21 -23
- package/lib/max_key.js.map +1 -0
- package/lib/min_key.js +21 -23
- package/lib/min_key.js.map +1 -0
- package/lib/objectid.js +264 -382
- package/lib/objectid.js.map +1 -0
- package/lib/parser/calculate_size.js +185 -224
- package/lib/parser/calculate_size.js.map +1 -0
- package/lib/parser/deserializer.js +543 -620
- package/lib/parser/deserializer.js.map +1 -0
- package/lib/parser/serializer.js +774 -918
- package/lib/parser/serializer.js.map +1 -0
- package/lib/parser/utils.js +81 -30
- package/lib/parser/utils.js.map +1 -0
- package/lib/regexp.js +54 -70
- package/lib/regexp.js.map +1 -0
- package/lib/symbol.js +40 -56
- package/lib/symbol.js.map +1 -0
- package/lib/timestamp.js +70 -95
- package/lib/timestamp.js.map +1 -0
- package/lib/uuid.js +48 -0
- package/lib/uuid.js.map +1 -0
- package/lib/validate_utf8.js +32 -33
- package/lib/validate_utf8.js.map +1 -0
- package/package.json +53 -31
- package/src/binary.ts +270 -0
- package/src/bson.ts +326 -0
- package/src/code.ts +57 -0
- package/src/constants.ts +104 -0
- package/src/db_ref.ts +115 -0
- package/src/decimal128.ts +801 -0
- package/src/double.ts +85 -0
- package/src/ensure_buffer.ts +26 -0
- package/src/extended_json.ts +395 -0
- package/src/float_parser.ts +152 -0
- package/src/int_32.ts +64 -0
- package/src/long.ts +1000 -0
- package/src/map.ts +139 -0
- package/src/max_key.ts +33 -0
- package/src/min_key.ts +33 -0
- package/src/objectid.ts +377 -0
- package/src/parser/calculate_size.ts +230 -0
- package/src/parser/deserializer.ts +655 -0
- package/src/parser/serializer.ts +1069 -0
- package/src/parser/utils.ts +93 -0
- package/src/regexp.ts +92 -0
- package/src/symbol.ts +57 -0
- package/src/timestamp.ts +103 -0
- package/src/uuid.ts +57 -0
- package/src/validate_utf8.ts +47 -0
- package/lib/fnv1a.js +0 -48
package/HISTORY.md
CHANGED
|
@@ -1,7 +1,62 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Changelog
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [4.2.2](https://github.com/mongodb/js-bson/compare/v4.2.1...v4.2.2) (2020-12-01)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* remove tslib usage and fix Long method alias ([#415](https://github.com/mongodb/js-bson/issues/415)) ([2d9a8e6](https://github.com/mongodb/js-bson/commit/2d9a8e678417ec43a0b82377743ab9c30a3c3b6b))
|
|
11
|
+
|
|
12
|
+
### [4.2.1](https://github.com/mongodb/js-bson/compare/v4.2.0...v4.2.1) (2020-12-01)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
|
|
17
|
+
* backwards compatibility with older BSON package versions ([#411](https://github.com/mongodb/js-bson/issues/411)) ([5167be2](https://github.com/mongodb/js-bson/commit/5167be2752369d5832057f7b69da0e240ed4c204))
|
|
18
|
+
* Downlevel type definitions ([#410](https://github.com/mongodb/js-bson/issues/410)) ([203402f](https://github.com/mongodb/js-bson/commit/203402f5cd9dd496a4103dc1008bad382d3c69c4))
|
|
19
|
+
* make inspect method for ObjectId work ([#412](https://github.com/mongodb/js-bson/issues/412)) ([a585a0c](https://github.com/mongodb/js-bson/commit/a585a0cf8cd1212617fb8f37581194e6c31e33fa))
|
|
20
|
+
* remove stringify overloads ([2df6b42](https://github.com/mongodb/js-bson/commit/2df6b42de4cbf81a307d2db144d15470d543976e))
|
|
21
|
+
|
|
22
|
+
## [4.2.0](https://github.com/mongodb/js-bson/compare/v4.1.0...v4.2.0) (2020-10-13)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Features
|
|
26
|
+
|
|
27
|
+
* add extended json parsing for $uuid ([b1b2a0e](https://github.com/mongodb/js-bson/commit/b1b2a0ee5f497c971aa28961cf80bde522fc1779))
|
|
28
|
+
* convert to TypeScript ([#393](https://github.com/mongodb/js-bson/issues/393)) ([9aad874](https://github.com/mongodb/js-bson/commit/9aad8746bbb2159012193a53a206509130a95fb0))
|
|
29
|
+
* Improve TS Typings ([#389](https://github.com/mongodb/js-bson/issues/389)) ([ae9ae2d](https://github.com/mongodb/js-bson/commit/ae9ae2df0d5d0a88adf27523d7fca7f3ad59a57a))
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
### Bug Fixes
|
|
33
|
+
|
|
34
|
+
* adds interfaces for EJSON objects ([7f5f1a3](https://github.com/mongodb/js-bson/commit/7f5f1a38d99d1d50b8bf261cc72916f5bce506ae))
|
|
35
|
+
* Correct API Extractor config to omit definition file from dist ([#407](https://github.com/mongodb/js-bson/issues/407)) ([ace8647](https://github.com/mongodb/js-bson/commit/ace8647646e20df61e77d0ce8ed7ea84a3ff7738))
|
|
36
|
+
* coverage ([992e2e0](https://github.com/mongodb/js-bson/commit/992e2e040806701d1c69e09d07186a6e1deacc0e))
|
|
37
|
+
* deprecate cacheFunctionsCrc32 ([ea83bf5](https://github.com/mongodb/js-bson/commit/ea83bf5200f4a936692f710063941ba802386da4))
|
|
38
|
+
* Rework rollup config to output named and default exports ([#404](https://github.com/mongodb/js-bson/issues/404)) ([a48676b](https://github.com/mongodb/js-bson/commit/a48676b0d442e06a71a413500194d35a7bea7587))
|
|
39
|
+
* Throw on BigInt type values ([#397](https://github.com/mongodb/js-bson/issues/397)) ([2dd54e5](https://github.com/mongodb/js-bson/commit/2dd54e5275fc72dd8cd579a1636d2a73b7b0e790))
|
|
40
|
+
* type issues with SerializeOptions and Long methods accepting Timestamp ([c18ba71](https://github.com/mongodb/js-bson/commit/c18ba71229129c8ea34e40265a9503c10e29a9e0))
|
|
41
|
+
|
|
42
|
+
<a name="4.1.0"></a>
|
|
43
|
+
# [4.1.0](https://github.com/mongodb/js-bson/compare/v4.0.4...v4.1.0) (2020-08-10)
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
### Bug Fixes
|
|
47
|
+
|
|
48
|
+
* spelling in deserializer errors ([4c6f2e4](https://github.com/mongodb/js-bson/commit/4c6f2e4))
|
|
49
|
+
* **object-id:** harden the duck-typing ([4b800ae](https://github.com/mongodb/js-bson/commit/4b800ae))
|
|
50
|
+
* parse value of Int32 in constructor ([5cda40f](https://github.com/mongodb/js-bson/commit/5cda40f))
|
|
51
|
+
* Reduce floating point precision required of extended json implementations ([#369](https://github.com/mongodb/js-bson/issues/369)) ([5e35d1a](https://github.com/mongodb/js-bson/commit/5e35d1a))
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
### Features
|
|
55
|
+
|
|
56
|
+
* add support for primitives to EJSON.stringify ([329857d](https://github.com/mongodb/js-bson/commit/329857d))
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
|
|
5
60
|
<a name="4.0.4"></a>
|
|
6
61
|
## [4.0.4](https://github.com/mongodb/js-bson/compare/v4.0.3...v4.0.4) (2020-03-26)
|
|
7
62
|
|
package/README.md
CHANGED
|
@@ -193,7 +193,7 @@ Starting with Angular 6, Angular CLI removed the shim for `global` and other nod
|
|
|
193
193
|
Parse an Extended JSON string, constructing the JavaScript value or object described by that
|
|
194
194
|
string.
|
|
195
195
|
|
|
196
|
-
**Example**
|
|
196
|
+
**Example**
|
|
197
197
|
```js
|
|
198
198
|
const { EJSON } = require('bson');
|
|
199
199
|
const text = '{ "int32": { "$numberInt": "10" } }';
|
|
@@ -221,7 +221,7 @@ Converts a BSON document to an Extended JSON string, optionally replacing values
|
|
|
221
221
|
function is specified or optionally including only the specified properties if a replacer array
|
|
222
222
|
is specified.
|
|
223
223
|
|
|
224
|
-
**Example**
|
|
224
|
+
**Example**
|
|
225
225
|
```js
|
|
226
226
|
const { EJSON } = require('bson');
|
|
227
227
|
const Int32 = require('mongodb').Int32;
|
|
@@ -278,7 +278,7 @@ Sets the size of the internal serialization buffer.
|
|
|
278
278
|
|
|
279
279
|
Serialize a Javascript object.
|
|
280
280
|
|
|
281
|
-
**Returns**: <code>Buffer</code> - returns the Buffer object containing the serialized object.
|
|
281
|
+
**Returns**: <code>Buffer</code> - returns the Buffer object containing the serialized object.
|
|
282
282
|
<a name="serializeWithBufferAndIndex"></a>
|
|
283
283
|
|
|
284
284
|
### serializeWithBufferAndIndex(object, buffer)
|
|
@@ -294,7 +294,7 @@ Serialize a Javascript object.
|
|
|
294
294
|
|
|
295
295
|
Serialize a Javascript object using a predefined Buffer and index into the buffer, useful when pre-allocating the space for serialization.
|
|
296
296
|
|
|
297
|
-
**Returns**: <code>Number</code> - returns the index pointing to the last written byte in the buffer.
|
|
297
|
+
**Returns**: <code>Number</code> - returns the index pointing to the last written byte in the buffer.
|
|
298
298
|
<a name="deserialize"></a>
|
|
299
299
|
|
|
300
300
|
### deserialize(buffer)
|
|
@@ -304,7 +304,6 @@ Serialize a Javascript object using a predefined Buffer and index into the buffe
|
|
|
304
304
|
| buffer | <code>Buffer</code> | | the buffer containing the serialized set of BSON documents. |
|
|
305
305
|
| [options.evalFunctions] | <code>Object</code> | <code>false</code> | evaluate functions in the BSON document scoped to the object deserialized. |
|
|
306
306
|
| [options.cacheFunctions] | <code>Object</code> | <code>false</code> | cache evaluated functions for reuse. |
|
|
307
|
-
| [options.cacheFunctionsCrc32] | <code>Object</code> | <code>false</code> | use a crc32 code for caching, otherwise use the string of the function. |
|
|
308
307
|
| [options.promoteLongs] | <code>Object</code> | <code>true</code> | when deserializing a Long will fit it into a Number if it's smaller than 53 bits |
|
|
309
308
|
| [options.promoteBuffers] | <code>Object</code> | <code>false</code> | when deserializing a Binary will return it as a node.js Buffer instance. |
|
|
310
309
|
| [options.promoteValues] | <code>Object</code> | <code>false</code> | when deserializing will promote BSON values to their Node.js closest equivalent types. |
|
|
@@ -314,7 +313,7 @@ Serialize a Javascript object using a predefined Buffer and index into the buffe
|
|
|
314
313
|
|
|
315
314
|
Deserialize data as BSON.
|
|
316
315
|
|
|
317
|
-
**Returns**: <code>Object</code> - returns the deserialized Javascript Object.
|
|
316
|
+
**Returns**: <code>Object</code> - returns the deserialized Javascript Object.
|
|
318
317
|
<a name="calculateObjectSize"></a>
|
|
319
318
|
|
|
320
319
|
### calculateObjectSize(object)
|
|
@@ -327,7 +326,7 @@ Deserialize data as BSON.
|
|
|
327
326
|
|
|
328
327
|
Calculate the bson size for a passed in Javascript object.
|
|
329
328
|
|
|
330
|
-
**Returns**: <code>Number</code> - returns the number of bytes the BSON object will take up.
|
|
329
|
+
**Returns**: <code>Number</code> - returns the number of bytes the BSON object will take up.
|
|
331
330
|
<a name="deserializeStream"></a>
|
|
332
331
|
|
|
333
332
|
### deserializeStream(data, startIndex, numberOfDocuments, documents, docStartIndex, [options])
|
|
@@ -342,7 +341,6 @@ Calculate the bson size for a passed in Javascript object.
|
|
|
342
341
|
| [options] | <code>Object</code> | | additional options used for the deserialization. |
|
|
343
342
|
| [options.evalFunctions] | <code>Object</code> | <code>false</code> | evaluate functions in the BSON document scoped to the object deserialized. |
|
|
344
343
|
| [options.cacheFunctions] | <code>Object</code> | <code>false</code> | cache evaluated functions for reuse. |
|
|
345
|
-
| [options.cacheFunctionsCrc32] | <code>Object</code> | <code>false</code> | use a crc32 code for caching, otherwise use the string of the function. |
|
|
346
344
|
| [options.promoteLongs] | <code>Object</code> | <code>true</code> | when deserializing a Long will fit it into a Number if it's smaller than 53 bits |
|
|
347
345
|
| [options.promoteBuffers] | <code>Object</code> | <code>false</code> | when deserializing a Binary will return it as a node.js Buffer instance. |
|
|
348
346
|
| [options.promoteValues] | <code>Object</code> | <code>false</code> | when deserializing will promote BSON values to their Node.js closest equivalent types. |
|
|
@@ -351,7 +349,7 @@ Calculate the bson size for a passed in Javascript object.
|
|
|
351
349
|
|
|
352
350
|
Deserialize stream data as BSON documents.
|
|
353
351
|
|
|
354
|
-
**Returns**: <code>Number</code> - returns the next index in the buffer after deserialization **x** numbers of documents.
|
|
352
|
+
**Returns**: <code>Number</code> - returns the next index in the buffer after deserialization **x** numbers of documents.
|
|
355
353
|
|
|
356
354
|
## FAQ
|
|
357
355
|
|
package/bower.json
CHANGED