bson 5.3.0 → 5.4.0

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 (67) hide show
  1. package/README.md +4 -11
  2. package/lib/bson.bundle.js +20 -18
  3. package/lib/bson.bundle.js.map +1 -1
  4. package/lib/bson.cjs +20 -18
  5. package/lib/bson.cjs.map +1 -1
  6. package/lib/bson.mjs +20 -18
  7. package/lib/bson.mjs.map +1 -1
  8. package/lib/bson.rn.cjs +4110 -0
  9. package/lib/bson.rn.cjs.map +1 -0
  10. package/package.json +8 -7
  11. package/src/binary.ts +3 -2
  12. package/src/bson.ts +2 -2
  13. package/src/parser/deserializer.ts +8 -8
  14. package/src/timestamp.ts +7 -5
  15. package/src/utils/byte_utils.ts +1 -1
  16. package/src/utils/node_byte_utils.ts +3 -3
  17. package/src/utils/web_byte_utils.ts +2 -2
  18. package/vendor/base64/LICENSE-MIT.txt +20 -0
  19. package/vendor/base64/README.md +112 -0
  20. package/vendor/base64/base64.js +157 -0
  21. package/vendor/base64/package.json +43 -0
  22. package/vendor/text-encoding/LICENSE.md +237 -0
  23. package/vendor/text-encoding/README.md +111 -0
  24. package/vendor/text-encoding/index.js +9 -0
  25. package/vendor/text-encoding/lib/encoding-indexes.js +47 -0
  26. package/vendor/text-encoding/lib/encoding.js +3301 -0
  27. package/vendor/text-encoding/package.json +37 -0
  28. package/lib/binary.d.ts +0 -182
  29. package/lib/binary.d.ts.map +0 -1
  30. package/lib/bson.d.ts +0 -97
  31. package/lib/bson.d.ts.map +0 -1
  32. package/lib/bson_value.d.ts +0 -10
  33. package/lib/bson_value.d.ts.map +0 -1
  34. package/lib/code.d.ts +0 -32
  35. package/lib/code.d.ts.map +0 -1
  36. package/lib/constants.d.ts +0 -107
  37. package/lib/constants.d.ts.map +0 -1
  38. package/lib/db_ref.d.ts +0 -40
  39. package/lib/db_ref.d.ts.map +0 -1
  40. package/lib/decimal128.d.ts +0 -34
  41. package/lib/decimal128.d.ts.map +0 -1
  42. package/lib/double.d.ts +0 -35
  43. package/lib/double.d.ts.map +0 -1
  44. package/lib/error.d.ts +0 -50
  45. package/lib/error.d.ts.map +0 -1
  46. package/lib/extended_json.d.ts +0 -82
  47. package/lib/extended_json.d.ts.map +0 -1
  48. package/lib/index.d.ts +0 -4
  49. package/lib/index.d.ts.map +0 -1
  50. package/lib/int_32.d.ts +0 -35
  51. package/lib/int_32.d.ts.map +0 -1
  52. package/lib/long.d.ts +0 -323
  53. package/lib/long.d.ts.map +0 -1
  54. package/lib/max_key.d.ts +0 -19
  55. package/lib/max_key.d.ts.map +0 -1
  56. package/lib/min_key.d.ts +0 -19
  57. package/lib/min_key.d.ts.map +0 -1
  58. package/lib/objectid.d.ts +0 -96
  59. package/lib/objectid.d.ts.map +0 -1
  60. package/lib/regexp.d.ts +0 -36
  61. package/lib/regexp.d.ts.map +0 -1
  62. package/lib/symbol.d.ts +0 -28
  63. package/lib/symbol.d.ts.map +0 -1
  64. package/lib/timestamp.d.ts +0 -66
  65. package/lib/timestamp.d.ts.map +0 -1
  66. package/lib/validate_utf8.d.ts +0 -10
  67. package/lib/validate_utf8.d.ts.map +0 -1
@@ -0,0 +1,111 @@
1
+ text-encoding
2
+ ==============
3
+
4
+ This is a polyfill for the [Encoding Living
5
+ Standard](https://encoding.spec.whatwg.org/) API for the Web, allowing
6
+ encoding and decoding of textual data to and from Typed Array buffers
7
+ for binary data in JavaScript.
8
+
9
+ By default it adheres to the spec and does not support *encoding* to
10
+ legacy encodings, only *decoding*. It is also implemented to match the
11
+ specification's algorithms, rather than for performance. The intended
12
+ use is within Web pages, so it has no dependency on server frameworks
13
+ or particular module schemes.
14
+
15
+ Basic examples and tests are included.
16
+
17
+ ### Install ###
18
+
19
+ There are a few ways you can get and use the `text-encoding` library.
20
+
21
+ ### HTML Page Usage ###
22
+
23
+ Clone the repo and include the files directly:
24
+
25
+ ```html
26
+ <!-- Required for non-UTF encodings -->
27
+ <script src="encoding-indexes.js"></script>
28
+ <script src="encoding.js"></script>
29
+ ```
30
+
31
+ This is the only use case the developer cares about. If you want those
32
+ fancy module and/or package manager things that are popular these days
33
+ you should probably use a different library.
34
+
35
+ #### Package Managers ####
36
+
37
+ The package is published to **npm** and **bower** as `text-encoding`.
38
+ Use through these is not really supported, since they aren't used by
39
+ the developer of the library. Using `require()` in interesting ways
40
+ probably breaks. Patches welcome, as long as they don't break the
41
+ basic use of the files via `<script>`.
42
+
43
+ ### API Overview ###
44
+
45
+ Basic Usage
46
+
47
+ ```js
48
+ var uint8array = new TextEncoder().encode(string);
49
+ var string = new TextDecoder(encoding).decode(uint8array);
50
+ ```
51
+
52
+ Streaming Decode
53
+
54
+ ```js
55
+ var string = "", decoder = new TextDecoder(encoding), buffer;
56
+ while (buffer = next_chunk()) {
57
+ string += decoder.decode(buffer, {stream:true});
58
+ }
59
+ string += decoder.decode(); // finish the stream
60
+ ```
61
+
62
+ ### Encodings ###
63
+
64
+ All encodings from the Encoding specification are supported:
65
+
66
+ utf-8 ibm866 iso-8859-2 iso-8859-3 iso-8859-4 iso-8859-5 iso-8859-6
67
+ iso-8859-7 iso-8859-8 iso-8859-8-i iso-8859-10 iso-8859-13 iso-8859-14
68
+ iso-8859-15 iso-8859-16 koi8-r koi8-u macintosh windows-874
69
+ windows-1250 windows-1251 windows-1252 windows-1253 windows-1254
70
+ windows-1255 windows-1256 windows-1257 windows-1258 x-mac-cyrillic
71
+ gb18030 hz-gb-2312 big5 euc-jp iso-2022-jp shift_jis euc-kr
72
+ replacement utf-16be utf-16le x-user-defined
73
+
74
+ (Some encodings may be supported under other names, e.g. ascii,
75
+ iso-8859-1, etc. See [Encoding](https://encoding.spec.whatwg.org/) for
76
+ additional labels for each encoding.)
77
+
78
+ Encodings other than **utf-8**, **utf-16le** and **utf-16be** require
79
+ an additional `encoding-indexes.js` file to be included. It is rather
80
+ large (596kB uncompressed, 188kB gzipped); portions may be deleted if
81
+ support for some encodings is not required.
82
+
83
+ ### Non-Standard Behavior ###
84
+
85
+ As required by the specification, only encoding to **utf-8** is
86
+ supported. If you want to try it out, you can force a non-standard
87
+ behavior by passing the `NONSTANDARD_allowLegacyEncoding` option to
88
+ TextEncoder and a label. For example:
89
+
90
+ ```js
91
+ var uint8array = new TextEncoder(
92
+ 'windows-1252', { NONSTANDARD_allowLegacyEncoding: true }).encode(text);
93
+ ```
94
+
95
+ But note that the above won't work if you're using the polyfill in a
96
+ browser that natively supports the TextEncoder API natively, since the
97
+ polyfill won't be used!
98
+
99
+ You can force the polyfill to be used by using this before the polyfill:
100
+
101
+ ```html
102
+ <script>
103
+ window.TextEncoder = window.TextDecoder = null;
104
+ </script>
105
+ ```
106
+
107
+ To support the legacy encodings (which may be stateful), the
108
+ TextEncoder `encode()` method accepts an optional dictionary and
109
+ `stream` option, e.g. `encoder.encode(string, {stream: true});` This
110
+ is not needed for standard encoding since the input is always in
111
+ complete code points.
@@ -0,0 +1,9 @@
1
+ // This is free and unencumbered software released into the public domain.
2
+ // See LICENSE.md for more information.
3
+
4
+ var encoding = require("./lib/encoding.js");
5
+
6
+ module.exports = {
7
+ TextEncoder: encoding.TextEncoder,
8
+ TextDecoder: encoding.TextDecoder,
9
+ };