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.
Files changed (90) hide show
  1. package/HISTORY.md +56 -1
  2. package/README.md +7 -9
  3. package/bower.json +1 -1
  4. package/bson.d.ts +983 -0
  5. package/dist/bson.browser.esm.js +7261 -5004
  6. package/dist/bson.browser.esm.js.map +1 -0
  7. package/dist/bson.browser.umd.js +7319 -5099
  8. package/dist/bson.browser.umd.js.map +1 -0
  9. package/dist/bson.bundle.js +8168 -9216
  10. package/dist/bson.bundle.js.map +1 -0
  11. package/dist/bson.esm.js +5643 -5409
  12. package/dist/bson.esm.js.map +1 -0
  13. package/etc/prepare.js +19 -0
  14. package/lib/binary.js +194 -377
  15. package/lib/binary.js.map +1 -0
  16. package/lib/bson.js +200 -243
  17. package/lib/bson.js.map +1 -0
  18. package/lib/code.js +36 -39
  19. package/lib/code.js.map +1 -0
  20. package/lib/constants.js +78 -203
  21. package/lib/constants.js.map +1 -0
  22. package/lib/db_ref.js +79 -79
  23. package/lib/db_ref.js.map +1 -0
  24. package/lib/decimal128.js +647 -760
  25. package/lib/decimal128.js.map +1 -0
  26. package/lib/double.js +61 -58
  27. package/lib/double.js.map +1 -0
  28. package/lib/ensure_buffer.js +22 -18
  29. package/lib/ensure_buffer.js.map +1 -0
  30. package/lib/extended_json.js +305 -322
  31. package/lib/extended_json.js.map +1 -0
  32. package/lib/float_parser.js +98 -104
  33. package/lib/float_parser.js.map +1 -0
  34. package/lib/int_32.js +45 -47
  35. package/lib/int_32.js.map +1 -0
  36. package/lib/long.js +876 -16
  37. package/lib/long.js.map +1 -0
  38. package/lib/map.js +123 -124
  39. package/lib/map.js.map +1 -0
  40. package/lib/max_key.js +21 -23
  41. package/lib/max_key.js.map +1 -0
  42. package/lib/min_key.js +21 -23
  43. package/lib/min_key.js.map +1 -0
  44. package/lib/objectid.js +264 -382
  45. package/lib/objectid.js.map +1 -0
  46. package/lib/parser/calculate_size.js +185 -224
  47. package/lib/parser/calculate_size.js.map +1 -0
  48. package/lib/parser/deserializer.js +543 -620
  49. package/lib/parser/deserializer.js.map +1 -0
  50. package/lib/parser/serializer.js +774 -918
  51. package/lib/parser/serializer.js.map +1 -0
  52. package/lib/parser/utils.js +81 -30
  53. package/lib/parser/utils.js.map +1 -0
  54. package/lib/regexp.js +54 -70
  55. package/lib/regexp.js.map +1 -0
  56. package/lib/symbol.js +40 -56
  57. package/lib/symbol.js.map +1 -0
  58. package/lib/timestamp.js +70 -95
  59. package/lib/timestamp.js.map +1 -0
  60. package/lib/uuid.js +48 -0
  61. package/lib/uuid.js.map +1 -0
  62. package/lib/validate_utf8.js +32 -33
  63. package/lib/validate_utf8.js.map +1 -0
  64. package/package.json +53 -31
  65. package/src/binary.ts +270 -0
  66. package/src/bson.ts +326 -0
  67. package/src/code.ts +57 -0
  68. package/src/constants.ts +104 -0
  69. package/src/db_ref.ts +115 -0
  70. package/src/decimal128.ts +801 -0
  71. package/src/double.ts +85 -0
  72. package/src/ensure_buffer.ts +26 -0
  73. package/src/extended_json.ts +395 -0
  74. package/src/float_parser.ts +152 -0
  75. package/src/int_32.ts +64 -0
  76. package/src/long.ts +1000 -0
  77. package/src/map.ts +139 -0
  78. package/src/max_key.ts +33 -0
  79. package/src/min_key.ts +33 -0
  80. package/src/objectid.ts +377 -0
  81. package/src/parser/calculate_size.ts +230 -0
  82. package/src/parser/deserializer.ts +655 -0
  83. package/src/parser/serializer.ts +1069 -0
  84. package/src/parser/utils.ts +93 -0
  85. package/src/regexp.ts +92 -0
  86. package/src/symbol.ts +57 -0
  87. package/src/timestamp.ts +103 -0
  88. package/src/uuid.ts +57 -0
  89. package/src/validate_utf8.ts +47 -0
  90. package/lib/fnv1a.js +0 -48
package/HISTORY.md CHANGED
@@ -1,7 +1,62 @@
1
- # Change Log
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
@@ -22,5 +22,5 @@
22
22
  "test",
23
23
  "tools"
24
24
  ],
25
- "version": "4.0.4"
25
+ "version": "4.2.2"
26
26
  }