create-exam-cli 1.0.0 → 1.0.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.
Files changed (1947) hide show
  1. package/index.js +7 -3
  2. package/package.json +2 -2
  3. package/templates/backend/.env +2 -0
  4. package/templates/backend/node_modules/.bin/bcrypt +16 -0
  5. package/templates/backend/node_modules/.bin/bcrypt.cmd +17 -0
  6. package/templates/backend/node_modules/.bin/bcrypt.ps1 +28 -0
  7. package/templates/backend/node_modules/.bin/nodemon +16 -0
  8. package/templates/backend/node_modules/.bin/nodemon.cmd +17 -0
  9. package/templates/backend/node_modules/.bin/nodemon.ps1 +28 -0
  10. package/templates/backend/node_modules/.bin/nodetouch +16 -0
  11. package/templates/backend/node_modules/.bin/nodetouch.cmd +17 -0
  12. package/templates/backend/node_modules/.bin/nodetouch.ps1 +28 -0
  13. package/templates/backend/node_modules/.bin/semver +16 -0
  14. package/templates/backend/node_modules/.bin/semver.cmd +17 -0
  15. package/templates/backend/node_modules/.bin/semver.ps1 +28 -0
  16. package/templates/backend/node_modules/.package-lock.json +1515 -0
  17. package/templates/backend/node_modules/@mongodb-js/saslprep/LICENSE +22 -0
  18. package/templates/backend/node_modules/@mongodb-js/saslprep/dist/.esm-wrapper.mjs +4 -0
  19. package/templates/backend/node_modules/@mongodb-js/saslprep/dist/browser.d.ts +5 -0
  20. package/templates/backend/node_modules/@mongodb-js/saslprep/dist/browser.d.ts.map +1 -0
  21. package/templates/backend/node_modules/@mongodb-js/saslprep/dist/browser.js +12 -0
  22. package/templates/backend/node_modules/@mongodb-js/saslprep/dist/browser.js.map +1 -0
  23. package/templates/backend/node_modules/@mongodb-js/saslprep/dist/code-points-data-browser.d.ts +3 -0
  24. package/templates/backend/node_modules/@mongodb-js/saslprep/dist/code-points-data-browser.d.ts.map +1 -0
  25. package/templates/backend/node_modules/@mongodb-js/saslprep/dist/code-points-data-browser.js +5 -0
  26. package/templates/backend/node_modules/@mongodb-js/saslprep/dist/code-points-data-browser.js.map +1 -0
  27. package/templates/backend/node_modules/@mongodb-js/saslprep/dist/code-points-data.d.ts +3 -0
  28. package/templates/backend/node_modules/@mongodb-js/saslprep/dist/code-points-data.d.ts.map +1 -0
  29. package/templates/backend/node_modules/@mongodb-js/saslprep/dist/code-points-data.js +5 -0
  30. package/templates/backend/node_modules/@mongodb-js/saslprep/dist/code-points-data.js.map +1 -0
  31. package/templates/backend/node_modules/@mongodb-js/saslprep/dist/code-points-src.d.ts +7 -0
  32. package/templates/backend/node_modules/@mongodb-js/saslprep/dist/code-points-src.d.ts.map +1 -0
  33. package/templates/backend/node_modules/@mongodb-js/saslprep/dist/code-points-src.js +881 -0
  34. package/templates/backend/node_modules/@mongodb-js/saslprep/dist/code-points-src.js.map +1 -0
  35. package/templates/backend/node_modules/@mongodb-js/saslprep/dist/generate-code-points.d.ts +2 -0
  36. package/templates/backend/node_modules/@mongodb-js/saslprep/dist/generate-code-points.d.ts.map +1 -0
  37. package/templates/backend/node_modules/@mongodb-js/saslprep/dist/generate-code-points.js +83 -0
  38. package/templates/backend/node_modules/@mongodb-js/saslprep/dist/generate-code-points.js.map +1 -0
  39. package/templates/backend/node_modules/@mongodb-js/saslprep/dist/index.d.ts +11 -0
  40. package/templates/backend/node_modules/@mongodb-js/saslprep/dist/index.d.ts.map +1 -0
  41. package/templates/backend/node_modules/@mongodb-js/saslprep/dist/index.js +65 -0
  42. package/templates/backend/node_modules/@mongodb-js/saslprep/dist/index.js.map +1 -0
  43. package/templates/backend/node_modules/@mongodb-js/saslprep/dist/memory-code-points.d.ts +10 -0
  44. package/templates/backend/node_modules/@mongodb-js/saslprep/dist/memory-code-points.d.ts.map +1 -0
  45. package/templates/backend/node_modules/@mongodb-js/saslprep/dist/memory-code-points.js +32 -0
  46. package/templates/backend/node_modules/@mongodb-js/saslprep/dist/memory-code-points.js.map +1 -0
  47. package/templates/backend/node_modules/@mongodb-js/saslprep/dist/node.d.ts +10 -0
  48. package/templates/backend/node_modules/@mongodb-js/saslprep/dist/node.d.ts.map +1 -0
  49. package/templates/backend/node_modules/@mongodb-js/saslprep/dist/node.js +15 -0
  50. package/templates/backend/node_modules/@mongodb-js/saslprep/dist/node.js.map +1 -0
  51. package/templates/backend/node_modules/@mongodb-js/saslprep/dist/util.d.ts +2 -0
  52. package/templates/backend/node_modules/@mongodb-js/saslprep/dist/util.d.ts.map +1 -0
  53. package/templates/backend/node_modules/@mongodb-js/saslprep/dist/util.js +11 -0
  54. package/templates/backend/node_modules/@mongodb-js/saslprep/dist/util.js.map +1 -0
  55. package/templates/backend/node_modules/@mongodb-js/saslprep/package.json +87 -0
  56. package/templates/backend/node_modules/@mongodb-js/saslprep/readme.md +29 -0
  57. package/templates/backend/node_modules/@types/webidl-conversions/LICENSE +21 -0
  58. package/templates/backend/node_modules/@types/webidl-conversions/README.md +15 -0
  59. package/templates/backend/node_modules/@types/webidl-conversions/index.d.ts +91 -0
  60. package/templates/backend/node_modules/@types/webidl-conversions/package.json +30 -0
  61. package/templates/backend/node_modules/@types/whatwg-url/LICENSE +21 -0
  62. package/templates/backend/node_modules/@types/whatwg-url/README.md +15 -0
  63. package/templates/backend/node_modules/@types/whatwg-url/index.d.ts +172 -0
  64. package/templates/backend/node_modules/@types/whatwg-url/lib/URL-impl.d.ts +22 -0
  65. package/templates/backend/node_modules/@types/whatwg-url/lib/URL.d.ts +66 -0
  66. package/templates/backend/node_modules/@types/whatwg-url/lib/URLSearchParams-impl.d.ts +20 -0
  67. package/templates/backend/node_modules/@types/whatwg-url/lib/URLSearchParams.d.ts +92 -0
  68. package/templates/backend/node_modules/@types/whatwg-url/package.json +38 -0
  69. package/templates/backend/node_modules/@types/whatwg-url/webidl2js-wrapper.d.ts +4 -0
  70. package/templates/backend/node_modules/accepts/HISTORY.md +250 -0
  71. package/templates/backend/node_modules/accepts/LICENSE +23 -0
  72. package/templates/backend/node_modules/accepts/README.md +140 -0
  73. package/templates/backend/node_modules/accepts/index.js +238 -0
  74. package/templates/backend/node_modules/accepts/package.json +47 -0
  75. package/templates/backend/node_modules/anymatch/LICENSE +15 -0
  76. package/templates/backend/node_modules/anymatch/README.md +87 -0
  77. package/templates/backend/node_modules/anymatch/index.d.ts +20 -0
  78. package/templates/backend/node_modules/anymatch/index.js +104 -0
  79. package/templates/backend/node_modules/anymatch/package.json +48 -0
  80. package/templates/backend/node_modules/balanced-match/LICENSE.md +23 -0
  81. package/templates/backend/node_modules/balanced-match/README.md +57 -0
  82. package/templates/backend/node_modules/balanced-match/dist/commonjs/index.d.ts +9 -0
  83. package/templates/backend/node_modules/balanced-match/dist/commonjs/index.d.ts.map +1 -0
  84. package/templates/backend/node_modules/balanced-match/dist/commonjs/index.js +59 -0
  85. package/templates/backend/node_modules/balanced-match/dist/commonjs/index.js.map +1 -0
  86. package/templates/backend/node_modules/balanced-match/dist/commonjs/package.json +3 -0
  87. package/templates/backend/node_modules/balanced-match/dist/esm/index.d.ts +9 -0
  88. package/templates/backend/node_modules/balanced-match/dist/esm/index.d.ts.map +1 -0
  89. package/templates/backend/node_modules/balanced-match/dist/esm/index.js +54 -0
  90. package/templates/backend/node_modules/balanced-match/dist/esm/index.js.map +1 -0
  91. package/templates/backend/node_modules/balanced-match/dist/esm/package.json +3 -0
  92. package/templates/backend/node_modules/balanced-match/package.json +68 -0
  93. package/templates/backend/node_modules/bcryptjs/LICENSE +27 -0
  94. package/templates/backend/node_modules/bcryptjs/README.md +201 -0
  95. package/templates/backend/node_modules/bcryptjs/bin/bcrypt +23 -0
  96. package/templates/backend/node_modules/bcryptjs/index.d.ts +3 -0
  97. package/templates/backend/node_modules/bcryptjs/index.js +1159 -0
  98. package/templates/backend/node_modules/bcryptjs/package.json +76 -0
  99. package/templates/backend/node_modules/bcryptjs/types.d.ts +157 -0
  100. package/templates/backend/node_modules/bcryptjs/umd/index.d.ts +3 -0
  101. package/templates/backend/node_modules/bcryptjs/umd/index.js +1220 -0
  102. package/templates/backend/node_modules/bcryptjs/umd/package.json +3 -0
  103. package/templates/backend/node_modules/bcryptjs/umd/types.d.ts +157 -0
  104. package/templates/backend/node_modules/binary-extensions/binary-extensions.json +263 -0
  105. package/templates/backend/node_modules/binary-extensions/binary-extensions.json.d.ts +3 -0
  106. package/templates/backend/node_modules/binary-extensions/index.d.ts +14 -0
  107. package/templates/backend/node_modules/binary-extensions/index.js +1 -0
  108. package/templates/backend/node_modules/binary-extensions/license +10 -0
  109. package/templates/backend/node_modules/binary-extensions/package.json +40 -0
  110. package/templates/backend/node_modules/binary-extensions/readme.md +25 -0
  111. package/templates/backend/node_modules/body-parser/LICENSE +23 -0
  112. package/templates/backend/node_modules/body-parser/README.md +494 -0
  113. package/templates/backend/node_modules/body-parser/index.js +71 -0
  114. package/templates/backend/node_modules/body-parser/lib/read.js +247 -0
  115. package/templates/backend/node_modules/body-parser/lib/types/json.js +158 -0
  116. package/templates/backend/node_modules/body-parser/lib/types/raw.js +42 -0
  117. package/templates/backend/node_modules/body-parser/lib/types/text.js +36 -0
  118. package/templates/backend/node_modules/body-parser/lib/types/urlencoded.js +142 -0
  119. package/templates/backend/node_modules/body-parser/lib/utils.js +98 -0
  120. package/templates/backend/node_modules/body-parser/package.json +52 -0
  121. package/templates/backend/node_modules/brace-expansion/LICENSE +23 -0
  122. package/templates/backend/node_modules/brace-expansion/README.md +94 -0
  123. package/templates/backend/node_modules/brace-expansion/dist/commonjs/index.d.ts +6 -0
  124. package/templates/backend/node_modules/brace-expansion/dist/commonjs/index.d.ts.map +1 -0
  125. package/templates/backend/node_modules/brace-expansion/dist/commonjs/index.js +201 -0
  126. package/templates/backend/node_modules/brace-expansion/dist/commonjs/index.js.map +1 -0
  127. package/templates/backend/node_modules/brace-expansion/dist/commonjs/package.json +3 -0
  128. package/templates/backend/node_modules/brace-expansion/dist/esm/index.d.ts +6 -0
  129. package/templates/backend/node_modules/brace-expansion/dist/esm/index.d.ts.map +1 -0
  130. package/templates/backend/node_modules/brace-expansion/dist/esm/index.js +197 -0
  131. package/templates/backend/node_modules/brace-expansion/dist/esm/index.js.map +1 -0
  132. package/templates/backend/node_modules/brace-expansion/dist/esm/package.json +3 -0
  133. package/templates/backend/node_modules/brace-expansion/package.json +64 -0
  134. package/templates/backend/node_modules/braces/LICENSE +21 -0
  135. package/templates/backend/node_modules/braces/README.md +586 -0
  136. package/templates/backend/node_modules/braces/index.js +170 -0
  137. package/templates/backend/node_modules/braces/lib/compile.js +60 -0
  138. package/templates/backend/node_modules/braces/lib/constants.js +57 -0
  139. package/templates/backend/node_modules/braces/lib/expand.js +113 -0
  140. package/templates/backend/node_modules/braces/lib/parse.js +331 -0
  141. package/templates/backend/node_modules/braces/lib/stringify.js +32 -0
  142. package/templates/backend/node_modules/braces/lib/utils.js +122 -0
  143. package/templates/backend/node_modules/braces/package.json +77 -0
  144. package/templates/backend/node_modules/bson/LICENSE.md +201 -0
  145. package/templates/backend/node_modules/bson/README.md +291 -0
  146. package/templates/backend/node_modules/bson/bson.d.ts +1770 -0
  147. package/templates/backend/node_modules/bson/etc/prepare.js +19 -0
  148. package/templates/backend/node_modules/bson/lib/bson.bundle.js +4750 -0
  149. package/templates/backend/node_modules/bson/lib/bson.bundle.js.map +1 -0
  150. package/templates/backend/node_modules/bson/lib/bson.cjs +4745 -0
  151. package/templates/backend/node_modules/bson/lib/bson.cjs.map +1 -0
  152. package/templates/backend/node_modules/bson/lib/bson.mjs +4712 -0
  153. package/templates/backend/node_modules/bson/lib/bson.mjs.map +1 -0
  154. package/templates/backend/node_modules/bson/lib/bson.node.mjs +4712 -0
  155. package/templates/backend/node_modules/bson/lib/bson.node.mjs.map +1 -0
  156. package/templates/backend/node_modules/bson/lib/bson.rn.cjs +4755 -0
  157. package/templates/backend/node_modules/bson/lib/bson.rn.cjs.map +1 -0
  158. package/templates/backend/node_modules/bson/package.json +118 -0
  159. package/templates/backend/node_modules/bson/src/binary.ts +751 -0
  160. package/templates/backend/node_modules/bson/src/bson.ts +255 -0
  161. package/templates/backend/node_modules/bson/src/bson_value.ts +55 -0
  162. package/templates/backend/node_modules/bson/src/code.ts +69 -0
  163. package/templates/backend/node_modules/bson/src/constants.ts +147 -0
  164. package/templates/backend/node_modules/bson/src/db_ref.ts +128 -0
  165. package/templates/backend/node_modules/bson/src/decimal128.ts +855 -0
  166. package/templates/backend/node_modules/bson/src/double.ts +115 -0
  167. package/templates/backend/node_modules/bson/src/error.ts +105 -0
  168. package/templates/backend/node_modules/bson/src/extended_json.ts +533 -0
  169. package/templates/backend/node_modules/bson/src/index.ts +19 -0
  170. package/templates/backend/node_modules/bson/src/int_32.ts +101 -0
  171. package/templates/backend/node_modules/bson/src/long.ts +1240 -0
  172. package/templates/backend/node_modules/bson/src/max_key.ts +31 -0
  173. package/templates/backend/node_modules/bson/src/min_key.ts +31 -0
  174. package/templates/backend/node_modules/bson/src/objectid.ts +382 -0
  175. package/templates/backend/node_modules/bson/src/parse_utf8.ts +35 -0
  176. package/templates/backend/node_modules/bson/src/parser/calculate_size.ts +218 -0
  177. package/templates/backend/node_modules/bson/src/parser/deserializer.ts +627 -0
  178. package/templates/backend/node_modules/bson/src/parser/on_demand/index.ts +32 -0
  179. package/templates/backend/node_modules/bson/src/parser/on_demand/parse_to_elements.ts +190 -0
  180. package/templates/backend/node_modules/bson/src/parser/serializer.ts +954 -0
  181. package/templates/backend/node_modules/bson/src/parser/utils.ts +69 -0
  182. package/templates/backend/node_modules/bson/src/regexp.ts +114 -0
  183. package/templates/backend/node_modules/bson/src/symbol.ts +55 -0
  184. package/templates/backend/node_modules/bson/src/timestamp.ts +176 -0
  185. package/templates/backend/node_modules/bson/src/utils/byte_utils.ts +80 -0
  186. package/templates/backend/node_modules/bson/src/utils/latin.ts +104 -0
  187. package/templates/backend/node_modules/bson/src/utils/node_byte_utils.ts +193 -0
  188. package/templates/backend/node_modules/bson/src/utils/number_utils.ts +204 -0
  189. package/templates/backend/node_modules/bson/src/utils/string_utils.ts +44 -0
  190. package/templates/backend/node_modules/bson/src/utils/web_byte_utils.ts +304 -0
  191. package/templates/backend/node_modules/buffer-equal-constant-time/.travis.yml +4 -0
  192. package/templates/backend/node_modules/buffer-equal-constant-time/LICENSE.txt +12 -0
  193. package/templates/backend/node_modules/buffer-equal-constant-time/README.md +50 -0
  194. package/templates/backend/node_modules/buffer-equal-constant-time/index.js +41 -0
  195. package/templates/backend/node_modules/buffer-equal-constant-time/package.json +21 -0
  196. package/templates/backend/node_modules/buffer-equal-constant-time/test.js +42 -0
  197. package/templates/backend/node_modules/bytes/History.md +97 -0
  198. package/templates/backend/node_modules/bytes/LICENSE +23 -0
  199. package/templates/backend/node_modules/bytes/Readme.md +152 -0
  200. package/templates/backend/node_modules/bytes/index.js +170 -0
  201. package/templates/backend/node_modules/bytes/package.json +42 -0
  202. package/templates/backend/node_modules/call-bind-apply-helpers/.eslintrc +17 -0
  203. package/templates/backend/node_modules/call-bind-apply-helpers/.github/FUNDING.yml +12 -0
  204. package/templates/backend/node_modules/call-bind-apply-helpers/.nycrc +9 -0
  205. package/templates/backend/node_modules/call-bind-apply-helpers/CHANGELOG.md +30 -0
  206. package/templates/backend/node_modules/call-bind-apply-helpers/LICENSE +21 -0
  207. package/templates/backend/node_modules/call-bind-apply-helpers/README.md +62 -0
  208. package/templates/backend/node_modules/call-bind-apply-helpers/actualApply.d.ts +1 -0
  209. package/templates/backend/node_modules/call-bind-apply-helpers/actualApply.js +10 -0
  210. package/templates/backend/node_modules/call-bind-apply-helpers/applyBind.d.ts +19 -0
  211. package/templates/backend/node_modules/call-bind-apply-helpers/applyBind.js +10 -0
  212. package/templates/backend/node_modules/call-bind-apply-helpers/functionApply.d.ts +1 -0
  213. package/templates/backend/node_modules/call-bind-apply-helpers/functionApply.js +4 -0
  214. package/templates/backend/node_modules/call-bind-apply-helpers/functionCall.d.ts +1 -0
  215. package/templates/backend/node_modules/call-bind-apply-helpers/functionCall.js +4 -0
  216. package/templates/backend/node_modules/call-bind-apply-helpers/index.d.ts +64 -0
  217. package/templates/backend/node_modules/call-bind-apply-helpers/index.js +15 -0
  218. package/templates/backend/node_modules/call-bind-apply-helpers/package.json +85 -0
  219. package/templates/backend/node_modules/call-bind-apply-helpers/reflectApply.d.ts +3 -0
  220. package/templates/backend/node_modules/call-bind-apply-helpers/reflectApply.js +4 -0
  221. package/templates/backend/node_modules/call-bind-apply-helpers/test/index.js +63 -0
  222. package/templates/backend/node_modules/call-bind-apply-helpers/tsconfig.json +9 -0
  223. package/templates/backend/node_modules/call-bound/.eslintrc +13 -0
  224. package/templates/backend/node_modules/call-bound/.github/FUNDING.yml +12 -0
  225. package/templates/backend/node_modules/call-bound/.nycrc +9 -0
  226. package/templates/backend/node_modules/call-bound/CHANGELOG.md +42 -0
  227. package/templates/backend/node_modules/call-bound/LICENSE +21 -0
  228. package/templates/backend/node_modules/call-bound/README.md +53 -0
  229. package/templates/backend/node_modules/call-bound/index.d.ts +94 -0
  230. package/templates/backend/node_modules/call-bound/index.js +19 -0
  231. package/templates/backend/node_modules/call-bound/package.json +99 -0
  232. package/templates/backend/node_modules/call-bound/test/index.js +61 -0
  233. package/templates/backend/node_modules/call-bound/tsconfig.json +10 -0
  234. package/templates/backend/node_modules/chokidar/LICENSE +21 -0
  235. package/templates/backend/node_modules/chokidar/README.md +308 -0
  236. package/templates/backend/node_modules/chokidar/index.js +973 -0
  237. package/templates/backend/node_modules/chokidar/lib/constants.js +66 -0
  238. package/templates/backend/node_modules/chokidar/lib/fsevents-handler.js +526 -0
  239. package/templates/backend/node_modules/chokidar/lib/nodefs-handler.js +654 -0
  240. package/templates/backend/node_modules/chokidar/package.json +70 -0
  241. package/templates/backend/node_modules/chokidar/types/index.d.ts +192 -0
  242. package/templates/backend/node_modules/content-disposition/LICENSE +22 -0
  243. package/templates/backend/node_modules/content-disposition/README.md +141 -0
  244. package/templates/backend/node_modules/content-disposition/index.js +536 -0
  245. package/templates/backend/node_modules/content-disposition/package.json +40 -0
  246. package/templates/backend/node_modules/content-type/HISTORY.md +29 -0
  247. package/templates/backend/node_modules/content-type/LICENSE +22 -0
  248. package/templates/backend/node_modules/content-type/README.md +94 -0
  249. package/templates/backend/node_modules/content-type/index.js +225 -0
  250. package/templates/backend/node_modules/content-type/package.json +42 -0
  251. package/templates/backend/node_modules/cookie/LICENSE +24 -0
  252. package/templates/backend/node_modules/cookie/README.md +317 -0
  253. package/templates/backend/node_modules/cookie/SECURITY.md +25 -0
  254. package/templates/backend/node_modules/cookie/index.js +335 -0
  255. package/templates/backend/node_modules/cookie/package.json +44 -0
  256. package/templates/backend/node_modules/cookie-signature/History.md +70 -0
  257. package/templates/backend/node_modules/cookie-signature/LICENSE +22 -0
  258. package/templates/backend/node_modules/cookie-signature/Readme.md +23 -0
  259. package/templates/backend/node_modules/cookie-signature/index.js +47 -0
  260. package/templates/backend/node_modules/cookie-signature/package.json +24 -0
  261. package/templates/backend/node_modules/cors/LICENSE +22 -0
  262. package/templates/backend/node_modules/cors/README.md +277 -0
  263. package/templates/backend/node_modules/cors/lib/index.js +238 -0
  264. package/templates/backend/node_modules/cors/package.json +42 -0
  265. package/templates/backend/node_modules/debug/LICENSE +20 -0
  266. package/templates/backend/node_modules/debug/README.md +481 -0
  267. package/templates/backend/node_modules/debug/package.json +64 -0
  268. package/templates/backend/node_modules/debug/src/browser.js +272 -0
  269. package/templates/backend/node_modules/debug/src/common.js +292 -0
  270. package/templates/backend/node_modules/debug/src/index.js +10 -0
  271. package/templates/backend/node_modules/debug/src/node.js +263 -0
  272. package/templates/backend/node_modules/depd/History.md +103 -0
  273. package/templates/backend/node_modules/depd/LICENSE +22 -0
  274. package/templates/backend/node_modules/depd/Readme.md +280 -0
  275. package/templates/backend/node_modules/depd/index.js +538 -0
  276. package/templates/backend/node_modules/depd/lib/browser/index.js +77 -0
  277. package/templates/backend/node_modules/depd/package.json +45 -0
  278. package/templates/backend/node_modules/dotenv/CHANGELOG.md +643 -0
  279. package/templates/backend/node_modules/dotenv/LICENSE +23 -0
  280. package/templates/backend/node_modules/dotenv/README-es.md +757 -0
  281. package/templates/backend/node_modules/dotenv/README.md +812 -0
  282. package/templates/backend/node_modules/dotenv/SECURITY.md +1 -0
  283. package/templates/backend/node_modules/dotenv/config.d.ts +1 -0
  284. package/templates/backend/node_modules/dotenv/config.js +9 -0
  285. package/templates/backend/node_modules/dotenv/lib/cli-options.js +17 -0
  286. package/templates/backend/node_modules/dotenv/lib/env-options.js +28 -0
  287. package/templates/backend/node_modules/dotenv/lib/main.d.ts +179 -0
  288. package/templates/backend/node_modules/dotenv/lib/main.js +423 -0
  289. package/templates/backend/node_modules/dotenv/package.json +62 -0
  290. package/templates/backend/node_modules/dotenv/skills/dotenv/SKILL.md +200 -0
  291. package/templates/backend/node_modules/dotenv/skills/dotenvx/SKILL.md +118 -0
  292. package/templates/backend/node_modules/dunder-proto/.eslintrc +5 -0
  293. package/templates/backend/node_modules/dunder-proto/.github/FUNDING.yml +12 -0
  294. package/templates/backend/node_modules/dunder-proto/.nycrc +13 -0
  295. package/templates/backend/node_modules/dunder-proto/CHANGELOG.md +24 -0
  296. package/templates/backend/node_modules/dunder-proto/LICENSE +21 -0
  297. package/templates/backend/node_modules/dunder-proto/README.md +54 -0
  298. package/templates/backend/node_modules/dunder-proto/get.d.ts +5 -0
  299. package/templates/backend/node_modules/dunder-proto/get.js +30 -0
  300. package/templates/backend/node_modules/dunder-proto/package.json +76 -0
  301. package/templates/backend/node_modules/dunder-proto/set.d.ts +5 -0
  302. package/templates/backend/node_modules/dunder-proto/set.js +35 -0
  303. package/templates/backend/node_modules/dunder-proto/test/get.js +34 -0
  304. package/templates/backend/node_modules/dunder-proto/test/index.js +4 -0
  305. package/templates/backend/node_modules/dunder-proto/test/set.js +50 -0
  306. package/templates/backend/node_modules/dunder-proto/tsconfig.json +9 -0
  307. package/templates/backend/node_modules/ecdsa-sig-formatter/CODEOWNERS +1 -0
  308. package/templates/backend/node_modules/ecdsa-sig-formatter/LICENSE +201 -0
  309. package/templates/backend/node_modules/ecdsa-sig-formatter/README.md +65 -0
  310. package/templates/backend/node_modules/ecdsa-sig-formatter/package.json +46 -0
  311. package/templates/backend/node_modules/ecdsa-sig-formatter/src/ecdsa-sig-formatter.d.ts +17 -0
  312. package/templates/backend/node_modules/ecdsa-sig-formatter/src/ecdsa-sig-formatter.js +187 -0
  313. package/templates/backend/node_modules/ecdsa-sig-formatter/src/param-bytes-for-alg.js +23 -0
  314. package/templates/backend/node_modules/ee-first/LICENSE +22 -0
  315. package/templates/backend/node_modules/ee-first/README.md +80 -0
  316. package/templates/backend/node_modules/ee-first/index.js +95 -0
  317. package/templates/backend/node_modules/ee-first/package.json +29 -0
  318. package/templates/backend/node_modules/encodeurl/LICENSE +22 -0
  319. package/templates/backend/node_modules/encodeurl/README.md +109 -0
  320. package/templates/backend/node_modules/encodeurl/index.js +60 -0
  321. package/templates/backend/node_modules/encodeurl/package.json +40 -0
  322. package/templates/backend/node_modules/es-define-property/.eslintrc +13 -0
  323. package/templates/backend/node_modules/es-define-property/.github/FUNDING.yml +12 -0
  324. package/templates/backend/node_modules/es-define-property/.nycrc +9 -0
  325. package/templates/backend/node_modules/es-define-property/CHANGELOG.md +29 -0
  326. package/templates/backend/node_modules/es-define-property/LICENSE +21 -0
  327. package/templates/backend/node_modules/es-define-property/README.md +49 -0
  328. package/templates/backend/node_modules/es-define-property/index.d.ts +3 -0
  329. package/templates/backend/node_modules/es-define-property/index.js +14 -0
  330. package/templates/backend/node_modules/es-define-property/package.json +81 -0
  331. package/templates/backend/node_modules/es-define-property/test/index.js +56 -0
  332. package/templates/backend/node_modules/es-define-property/tsconfig.json +10 -0
  333. package/templates/backend/node_modules/es-errors/.eslintrc +5 -0
  334. package/templates/backend/node_modules/es-errors/.github/FUNDING.yml +12 -0
  335. package/templates/backend/node_modules/es-errors/CHANGELOG.md +40 -0
  336. package/templates/backend/node_modules/es-errors/LICENSE +21 -0
  337. package/templates/backend/node_modules/es-errors/README.md +55 -0
  338. package/templates/backend/node_modules/es-errors/eval.d.ts +3 -0
  339. package/templates/backend/node_modules/es-errors/eval.js +4 -0
  340. package/templates/backend/node_modules/es-errors/index.d.ts +3 -0
  341. package/templates/backend/node_modules/es-errors/index.js +4 -0
  342. package/templates/backend/node_modules/es-errors/package.json +80 -0
  343. package/templates/backend/node_modules/es-errors/range.d.ts +3 -0
  344. package/templates/backend/node_modules/es-errors/range.js +4 -0
  345. package/templates/backend/node_modules/es-errors/ref.d.ts +3 -0
  346. package/templates/backend/node_modules/es-errors/ref.js +4 -0
  347. package/templates/backend/node_modules/es-errors/syntax.d.ts +3 -0
  348. package/templates/backend/node_modules/es-errors/syntax.js +4 -0
  349. package/templates/backend/node_modules/es-errors/test/index.js +19 -0
  350. package/templates/backend/node_modules/es-errors/tsconfig.json +49 -0
  351. package/templates/backend/node_modules/es-errors/type.d.ts +3 -0
  352. package/templates/backend/node_modules/es-errors/type.js +4 -0
  353. package/templates/backend/node_modules/es-errors/uri.d.ts +3 -0
  354. package/templates/backend/node_modules/es-errors/uri.js +4 -0
  355. package/templates/backend/node_modules/es-object-atoms/.eslintrc +16 -0
  356. package/templates/backend/node_modules/es-object-atoms/.github/FUNDING.yml +12 -0
  357. package/templates/backend/node_modules/es-object-atoms/CHANGELOG.md +37 -0
  358. package/templates/backend/node_modules/es-object-atoms/LICENSE +21 -0
  359. package/templates/backend/node_modules/es-object-atoms/README.md +63 -0
  360. package/templates/backend/node_modules/es-object-atoms/RequireObjectCoercible.d.ts +3 -0
  361. package/templates/backend/node_modules/es-object-atoms/RequireObjectCoercible.js +11 -0
  362. package/templates/backend/node_modules/es-object-atoms/ToObject.d.ts +7 -0
  363. package/templates/backend/node_modules/es-object-atoms/ToObject.js +10 -0
  364. package/templates/backend/node_modules/es-object-atoms/index.d.ts +3 -0
  365. package/templates/backend/node_modules/es-object-atoms/index.js +4 -0
  366. package/templates/backend/node_modules/es-object-atoms/isObject.d.ts +3 -0
  367. package/templates/backend/node_modules/es-object-atoms/isObject.js +6 -0
  368. package/templates/backend/node_modules/es-object-atoms/package.json +80 -0
  369. package/templates/backend/node_modules/es-object-atoms/test/index.js +38 -0
  370. package/templates/backend/node_modules/es-object-atoms/tsconfig.json +6 -0
  371. package/templates/backend/node_modules/escape-html/LICENSE +24 -0
  372. package/templates/backend/node_modules/escape-html/Readme.md +43 -0
  373. package/templates/backend/node_modules/escape-html/index.js +78 -0
  374. package/templates/backend/node_modules/escape-html/package.json +24 -0
  375. package/templates/backend/node_modules/etag/HISTORY.md +83 -0
  376. package/templates/backend/node_modules/etag/LICENSE +22 -0
  377. package/templates/backend/node_modules/etag/README.md +159 -0
  378. package/templates/backend/node_modules/etag/index.js +131 -0
  379. package/templates/backend/node_modules/etag/package.json +47 -0
  380. package/templates/backend/node_modules/express/LICENSE +24 -0
  381. package/templates/backend/node_modules/express/Readme.md +276 -0
  382. package/templates/backend/node_modules/express/index.js +11 -0
  383. package/templates/backend/node_modules/express/lib/application.js +631 -0
  384. package/templates/backend/node_modules/express/lib/express.js +81 -0
  385. package/templates/backend/node_modules/express/lib/request.js +514 -0
  386. package/templates/backend/node_modules/express/lib/response.js +1053 -0
  387. package/templates/backend/node_modules/express/lib/utils.js +271 -0
  388. package/templates/backend/node_modules/express/lib/view.js +205 -0
  389. package/templates/backend/node_modules/express/package.json +99 -0
  390. package/templates/backend/node_modules/fill-range/LICENSE +21 -0
  391. package/templates/backend/node_modules/fill-range/README.md +237 -0
  392. package/templates/backend/node_modules/fill-range/index.js +248 -0
  393. package/templates/backend/node_modules/fill-range/package.json +74 -0
  394. package/templates/backend/node_modules/finalhandler/HISTORY.md +239 -0
  395. package/templates/backend/node_modules/finalhandler/LICENSE +22 -0
  396. package/templates/backend/node_modules/finalhandler/README.md +150 -0
  397. package/templates/backend/node_modules/finalhandler/index.js +293 -0
  398. package/templates/backend/node_modules/finalhandler/package.json +47 -0
  399. package/templates/backend/node_modules/forwarded/HISTORY.md +21 -0
  400. package/templates/backend/node_modules/forwarded/LICENSE +22 -0
  401. package/templates/backend/node_modules/forwarded/README.md +57 -0
  402. package/templates/backend/node_modules/forwarded/index.js +90 -0
  403. package/templates/backend/node_modules/forwarded/package.json +45 -0
  404. package/templates/backend/node_modules/fresh/HISTORY.md +80 -0
  405. package/templates/backend/node_modules/fresh/LICENSE +23 -0
  406. package/templates/backend/node_modules/fresh/README.md +117 -0
  407. package/templates/backend/node_modules/fresh/index.js +136 -0
  408. package/templates/backend/node_modules/fresh/package.json +46 -0
  409. package/templates/backend/node_modules/function-bind/.eslintrc +21 -0
  410. package/templates/backend/node_modules/function-bind/.github/FUNDING.yml +12 -0
  411. package/templates/backend/node_modules/function-bind/.github/SECURITY.md +3 -0
  412. package/templates/backend/node_modules/function-bind/.nycrc +13 -0
  413. package/templates/backend/node_modules/function-bind/CHANGELOG.md +136 -0
  414. package/templates/backend/node_modules/function-bind/LICENSE +20 -0
  415. package/templates/backend/node_modules/function-bind/README.md +46 -0
  416. package/templates/backend/node_modules/function-bind/implementation.js +84 -0
  417. package/templates/backend/node_modules/function-bind/index.js +5 -0
  418. package/templates/backend/node_modules/function-bind/package.json +87 -0
  419. package/templates/backend/node_modules/function-bind/test/.eslintrc +9 -0
  420. package/templates/backend/node_modules/function-bind/test/index.js +252 -0
  421. package/templates/backend/node_modules/get-intrinsic/.eslintrc +42 -0
  422. package/templates/backend/node_modules/get-intrinsic/.github/FUNDING.yml +12 -0
  423. package/templates/backend/node_modules/get-intrinsic/.nycrc +9 -0
  424. package/templates/backend/node_modules/get-intrinsic/CHANGELOG.md +186 -0
  425. package/templates/backend/node_modules/get-intrinsic/LICENSE +21 -0
  426. package/templates/backend/node_modules/get-intrinsic/README.md +71 -0
  427. package/templates/backend/node_modules/get-intrinsic/index.js +378 -0
  428. package/templates/backend/node_modules/get-intrinsic/package.json +97 -0
  429. package/templates/backend/node_modules/get-intrinsic/test/GetIntrinsic.js +274 -0
  430. package/templates/backend/node_modules/get-proto/.eslintrc +10 -0
  431. package/templates/backend/node_modules/get-proto/.github/FUNDING.yml +12 -0
  432. package/templates/backend/node_modules/get-proto/.nycrc +9 -0
  433. package/templates/backend/node_modules/get-proto/CHANGELOG.md +21 -0
  434. package/templates/backend/node_modules/get-proto/LICENSE +21 -0
  435. package/templates/backend/node_modules/get-proto/Object.getPrototypeOf.d.ts +5 -0
  436. package/templates/backend/node_modules/get-proto/Object.getPrototypeOf.js +6 -0
  437. package/templates/backend/node_modules/get-proto/README.md +50 -0
  438. package/templates/backend/node_modules/get-proto/Reflect.getPrototypeOf.d.ts +3 -0
  439. package/templates/backend/node_modules/get-proto/Reflect.getPrototypeOf.js +4 -0
  440. package/templates/backend/node_modules/get-proto/index.d.ts +5 -0
  441. package/templates/backend/node_modules/get-proto/index.js +27 -0
  442. package/templates/backend/node_modules/get-proto/package.json +81 -0
  443. package/templates/backend/node_modules/get-proto/test/index.js +68 -0
  444. package/templates/backend/node_modules/get-proto/tsconfig.json +9 -0
  445. package/templates/backend/node_modules/glob-parent/CHANGELOG.md +110 -0
  446. package/templates/backend/node_modules/glob-parent/LICENSE +15 -0
  447. package/templates/backend/node_modules/glob-parent/README.md +137 -0
  448. package/templates/backend/node_modules/glob-parent/index.js +42 -0
  449. package/templates/backend/node_modules/glob-parent/package.json +48 -0
  450. package/templates/backend/node_modules/gopd/.eslintrc +16 -0
  451. package/templates/backend/node_modules/gopd/.github/FUNDING.yml +12 -0
  452. package/templates/backend/node_modules/gopd/CHANGELOG.md +45 -0
  453. package/templates/backend/node_modules/gopd/LICENSE +21 -0
  454. package/templates/backend/node_modules/gopd/README.md +40 -0
  455. package/templates/backend/node_modules/gopd/gOPD.d.ts +1 -0
  456. package/templates/backend/node_modules/gopd/gOPD.js +4 -0
  457. package/templates/backend/node_modules/gopd/index.d.ts +5 -0
  458. package/templates/backend/node_modules/gopd/index.js +15 -0
  459. package/templates/backend/node_modules/gopd/package.json +77 -0
  460. package/templates/backend/node_modules/gopd/test/index.js +36 -0
  461. package/templates/backend/node_modules/gopd/tsconfig.json +9 -0
  462. package/templates/backend/node_modules/has-flag/index.js +8 -0
  463. package/templates/backend/node_modules/has-flag/license +9 -0
  464. package/templates/backend/node_modules/has-flag/package.json +44 -0
  465. package/templates/backend/node_modules/has-flag/readme.md +70 -0
  466. package/templates/backend/node_modules/has-symbols/.eslintrc +11 -0
  467. package/templates/backend/node_modules/has-symbols/.github/FUNDING.yml +12 -0
  468. package/templates/backend/node_modules/has-symbols/.nycrc +9 -0
  469. package/templates/backend/node_modules/has-symbols/CHANGELOG.md +91 -0
  470. package/templates/backend/node_modules/has-symbols/LICENSE +21 -0
  471. package/templates/backend/node_modules/has-symbols/README.md +46 -0
  472. package/templates/backend/node_modules/has-symbols/index.d.ts +3 -0
  473. package/templates/backend/node_modules/has-symbols/index.js +14 -0
  474. package/templates/backend/node_modules/has-symbols/package.json +111 -0
  475. package/templates/backend/node_modules/has-symbols/shams.d.ts +3 -0
  476. package/templates/backend/node_modules/has-symbols/shams.js +45 -0
  477. package/templates/backend/node_modules/has-symbols/test/index.js +22 -0
  478. package/templates/backend/node_modules/has-symbols/test/shams/core-js.js +29 -0
  479. package/templates/backend/node_modules/has-symbols/test/shams/get-own-property-symbols.js +29 -0
  480. package/templates/backend/node_modules/has-symbols/test/tests.js +58 -0
  481. package/templates/backend/node_modules/has-symbols/tsconfig.json +10 -0
  482. package/templates/backend/node_modules/hasown/.github/FUNDING.yml +12 -0
  483. package/templates/backend/node_modules/hasown/.nycrc +13 -0
  484. package/templates/backend/node_modules/hasown/CHANGELOG.md +51 -0
  485. package/templates/backend/node_modules/hasown/LICENSE +21 -0
  486. package/templates/backend/node_modules/hasown/README.md +40 -0
  487. package/templates/backend/node_modules/hasown/eslint.config.mjs +6 -0
  488. package/templates/backend/node_modules/hasown/index.d.ts +4 -0
  489. package/templates/backend/node_modules/hasown/index.js +8 -0
  490. package/templates/backend/node_modules/hasown/package.json +92 -0
  491. package/templates/backend/node_modules/hasown/tsconfig.json +6 -0
  492. package/templates/backend/node_modules/http-errors/HISTORY.md +186 -0
  493. package/templates/backend/node_modules/http-errors/LICENSE +23 -0
  494. package/templates/backend/node_modules/http-errors/README.md +169 -0
  495. package/templates/backend/node_modules/http-errors/index.js +290 -0
  496. package/templates/backend/node_modules/http-errors/package.json +54 -0
  497. package/templates/backend/node_modules/iconv-lite/LICENSE +21 -0
  498. package/templates/backend/node_modules/iconv-lite/README.md +138 -0
  499. package/templates/backend/node_modules/iconv-lite/encodings/dbcs-codec.js +532 -0
  500. package/templates/backend/node_modules/iconv-lite/encodings/dbcs-data.js +185 -0
  501. package/templates/backend/node_modules/iconv-lite/encodings/index.js +23 -0
  502. package/templates/backend/node_modules/iconv-lite/encodings/internal.js +218 -0
  503. package/templates/backend/node_modules/iconv-lite/encodings/sbcs-codec.js +75 -0
  504. package/templates/backend/node_modules/iconv-lite/encodings/sbcs-data-generated.js +451 -0
  505. package/templates/backend/node_modules/iconv-lite/encodings/sbcs-data.js +178 -0
  506. package/templates/backend/node_modules/iconv-lite/encodings/tables/big5-added.json +122 -0
  507. package/templates/backend/node_modules/iconv-lite/encodings/tables/cp936.json +264 -0
  508. package/templates/backend/node_modules/iconv-lite/encodings/tables/cp949.json +273 -0
  509. package/templates/backend/node_modules/iconv-lite/encodings/tables/cp950.json +177 -0
  510. package/templates/backend/node_modules/iconv-lite/encodings/tables/eucjp.json +182 -0
  511. package/templates/backend/node_modules/iconv-lite/encodings/tables/gb18030-ranges.json +1 -0
  512. package/templates/backend/node_modules/iconv-lite/encodings/tables/gbk-added.json +56 -0
  513. package/templates/backend/node_modules/iconv-lite/encodings/tables/shiftjis.json +125 -0
  514. package/templates/backend/node_modules/iconv-lite/encodings/utf16.js +187 -0
  515. package/templates/backend/node_modules/iconv-lite/encodings/utf32.js +307 -0
  516. package/templates/backend/node_modules/iconv-lite/encodings/utf7.js +283 -0
  517. package/templates/backend/node_modules/iconv-lite/lib/bom-handling.js +48 -0
  518. package/templates/backend/node_modules/iconv-lite/lib/helpers/merge-exports.js +13 -0
  519. package/templates/backend/node_modules/iconv-lite/lib/index.d.ts +129 -0
  520. package/templates/backend/node_modules/iconv-lite/lib/index.js +182 -0
  521. package/templates/backend/node_modules/iconv-lite/lib/streams.js +105 -0
  522. package/templates/backend/node_modules/iconv-lite/package.json +70 -0
  523. package/templates/backend/node_modules/iconv-lite/types/encodings.d.ts +423 -0
  524. package/templates/backend/node_modules/ignore-by-default/LICENSE +14 -0
  525. package/templates/backend/node_modules/ignore-by-default/README.md +26 -0
  526. package/templates/backend/node_modules/ignore-by-default/index.js +12 -0
  527. package/templates/backend/node_modules/ignore-by-default/package.json +34 -0
  528. package/templates/backend/node_modules/inherits/LICENSE +16 -0
  529. package/templates/backend/node_modules/inherits/README.md +42 -0
  530. package/templates/backend/node_modules/inherits/inherits.js +9 -0
  531. package/templates/backend/node_modules/inherits/inherits_browser.js +27 -0
  532. package/templates/backend/node_modules/inherits/package.json +29 -0
  533. package/templates/backend/node_modules/ipaddr.js/LICENSE +19 -0
  534. package/templates/backend/node_modules/ipaddr.js/README.md +233 -0
  535. package/templates/backend/node_modules/ipaddr.js/ipaddr.min.js +1 -0
  536. package/templates/backend/node_modules/ipaddr.js/lib/ipaddr.js +673 -0
  537. package/templates/backend/node_modules/ipaddr.js/lib/ipaddr.js.d.ts +68 -0
  538. package/templates/backend/node_modules/ipaddr.js/package.json +35 -0
  539. package/templates/backend/node_modules/is-binary-path/index.d.ts +17 -0
  540. package/templates/backend/node_modules/is-binary-path/index.js +7 -0
  541. package/templates/backend/node_modules/is-binary-path/license +9 -0
  542. package/templates/backend/node_modules/is-binary-path/package.json +40 -0
  543. package/templates/backend/node_modules/is-binary-path/readme.md +34 -0
  544. package/templates/backend/node_modules/is-extglob/LICENSE +21 -0
  545. package/templates/backend/node_modules/is-extglob/README.md +107 -0
  546. package/templates/backend/node_modules/is-extglob/index.js +20 -0
  547. package/templates/backend/node_modules/is-extglob/package.json +69 -0
  548. package/templates/backend/node_modules/is-glob/LICENSE +21 -0
  549. package/templates/backend/node_modules/is-glob/README.md +206 -0
  550. package/templates/backend/node_modules/is-glob/index.js +150 -0
  551. package/templates/backend/node_modules/is-glob/package.json +81 -0
  552. package/templates/backend/node_modules/is-number/LICENSE +21 -0
  553. package/templates/backend/node_modules/is-number/README.md +187 -0
  554. package/templates/backend/node_modules/is-number/index.js +18 -0
  555. package/templates/backend/node_modules/is-number/package.json +82 -0
  556. package/templates/backend/node_modules/is-promise/LICENSE +19 -0
  557. package/templates/backend/node_modules/is-promise/index.d.ts +2 -0
  558. package/templates/backend/node_modules/is-promise/index.js +6 -0
  559. package/templates/backend/node_modules/is-promise/index.mjs +3 -0
  560. package/templates/backend/node_modules/is-promise/package.json +30 -0
  561. package/templates/backend/node_modules/is-promise/readme.md +33 -0
  562. package/templates/backend/node_modules/jsonwebtoken/LICENSE +21 -0
  563. package/templates/backend/node_modules/jsonwebtoken/README.md +396 -0
  564. package/templates/backend/node_modules/jsonwebtoken/decode.js +30 -0
  565. package/templates/backend/node_modules/jsonwebtoken/index.js +8 -0
  566. package/templates/backend/node_modules/jsonwebtoken/lib/JsonWebTokenError.js +14 -0
  567. package/templates/backend/node_modules/jsonwebtoken/lib/NotBeforeError.js +13 -0
  568. package/templates/backend/node_modules/jsonwebtoken/lib/TokenExpiredError.js +13 -0
  569. package/templates/backend/node_modules/jsonwebtoken/lib/asymmetricKeyDetailsSupported.js +3 -0
  570. package/templates/backend/node_modules/jsonwebtoken/lib/psSupported.js +3 -0
  571. package/templates/backend/node_modules/jsonwebtoken/lib/rsaPssKeyDetailsSupported.js +3 -0
  572. package/templates/backend/node_modules/jsonwebtoken/lib/timespan.js +18 -0
  573. package/templates/backend/node_modules/jsonwebtoken/lib/validateAsymmetricKey.js +66 -0
  574. package/templates/backend/node_modules/jsonwebtoken/package.json +70 -0
  575. package/templates/backend/node_modules/jsonwebtoken/sign.js +253 -0
  576. package/templates/backend/node_modules/jsonwebtoken/verify.js +263 -0
  577. package/templates/backend/node_modules/jwa/LICENSE +17 -0
  578. package/templates/backend/node_modules/jwa/README.md +150 -0
  579. package/templates/backend/node_modules/jwa/index.js +266 -0
  580. package/templates/backend/node_modules/jwa/opslevel.yml +6 -0
  581. package/templates/backend/node_modules/jwa/package.json +37 -0
  582. package/templates/backend/node_modules/jws/CHANGELOG.md +56 -0
  583. package/templates/backend/node_modules/jws/LICENSE +17 -0
  584. package/templates/backend/node_modules/jws/index.js +22 -0
  585. package/templates/backend/node_modules/jws/lib/data-stream.js +55 -0
  586. package/templates/backend/node_modules/jws/lib/sign-stream.js +83 -0
  587. package/templates/backend/node_modules/jws/lib/tostring.js +10 -0
  588. package/templates/backend/node_modules/jws/lib/verify-stream.js +125 -0
  589. package/templates/backend/node_modules/jws/opslevel.yml +6 -0
  590. package/templates/backend/node_modules/jws/package.json +34 -0
  591. package/templates/backend/node_modules/jws/readme.md +255 -0
  592. package/templates/backend/node_modules/kareem/CHANGELOG.md +845 -0
  593. package/templates/backend/node_modules/kareem/LICENSE +202 -0
  594. package/templates/backend/node_modules/kareem/README.md +385 -0
  595. package/templates/backend/node_modules/kareem/SECURITY.md +5 -0
  596. package/templates/backend/node_modules/kareem/index.d.ts +31 -0
  597. package/templates/backend/node_modules/kareem/index.js +553 -0
  598. package/templates/backend/node_modules/kareem/package.json +28 -0
  599. package/templates/backend/node_modules/lodash.includes/LICENSE +47 -0
  600. package/templates/backend/node_modules/lodash.includes/README.md +18 -0
  601. package/templates/backend/node_modules/lodash.includes/index.js +745 -0
  602. package/templates/backend/node_modules/lodash.includes/package.json +17 -0
  603. package/templates/backend/node_modules/lodash.isboolean/LICENSE +22 -0
  604. package/templates/backend/node_modules/lodash.isboolean/README.md +18 -0
  605. package/templates/backend/node_modules/lodash.isboolean/index.js +70 -0
  606. package/templates/backend/node_modules/lodash.isboolean/package.json +17 -0
  607. package/templates/backend/node_modules/lodash.isinteger/LICENSE +47 -0
  608. package/templates/backend/node_modules/lodash.isinteger/README.md +18 -0
  609. package/templates/backend/node_modules/lodash.isinteger/index.js +265 -0
  610. package/templates/backend/node_modules/lodash.isinteger/package.json +17 -0
  611. package/templates/backend/node_modules/lodash.isnumber/LICENSE +22 -0
  612. package/templates/backend/node_modules/lodash.isnumber/README.md +18 -0
  613. package/templates/backend/node_modules/lodash.isnumber/index.js +79 -0
  614. package/templates/backend/node_modules/lodash.isnumber/package.json +17 -0
  615. package/templates/backend/node_modules/lodash.isplainobject/LICENSE +47 -0
  616. package/templates/backend/node_modules/lodash.isplainobject/README.md +18 -0
  617. package/templates/backend/node_modules/lodash.isplainobject/index.js +139 -0
  618. package/templates/backend/node_modules/lodash.isplainobject/package.json +17 -0
  619. package/templates/backend/node_modules/lodash.isstring/LICENSE +22 -0
  620. package/templates/backend/node_modules/lodash.isstring/README.md +18 -0
  621. package/templates/backend/node_modules/lodash.isstring/index.js +95 -0
  622. package/templates/backend/node_modules/lodash.isstring/package.json +17 -0
  623. package/templates/backend/node_modules/lodash.once/LICENSE +47 -0
  624. package/templates/backend/node_modules/lodash.once/README.md +18 -0
  625. package/templates/backend/node_modules/lodash.once/index.js +294 -0
  626. package/templates/backend/node_modules/lodash.once/package.json +17 -0
  627. package/templates/backend/node_modules/math-intrinsics/.eslintrc +16 -0
  628. package/templates/backend/node_modules/math-intrinsics/.github/FUNDING.yml +12 -0
  629. package/templates/backend/node_modules/math-intrinsics/CHANGELOG.md +24 -0
  630. package/templates/backend/node_modules/math-intrinsics/LICENSE +21 -0
  631. package/templates/backend/node_modules/math-intrinsics/README.md +50 -0
  632. package/templates/backend/node_modules/math-intrinsics/abs.d.ts +1 -0
  633. package/templates/backend/node_modules/math-intrinsics/abs.js +4 -0
  634. package/templates/backend/node_modules/math-intrinsics/constants/maxArrayLength.d.ts +3 -0
  635. package/templates/backend/node_modules/math-intrinsics/constants/maxArrayLength.js +4 -0
  636. package/templates/backend/node_modules/math-intrinsics/constants/maxSafeInteger.d.ts +3 -0
  637. package/templates/backend/node_modules/math-intrinsics/constants/maxSafeInteger.js +5 -0
  638. package/templates/backend/node_modules/math-intrinsics/constants/maxValue.d.ts +3 -0
  639. package/templates/backend/node_modules/math-intrinsics/constants/maxValue.js +5 -0
  640. package/templates/backend/node_modules/math-intrinsics/floor.d.ts +1 -0
  641. package/templates/backend/node_modules/math-intrinsics/floor.js +4 -0
  642. package/templates/backend/node_modules/math-intrinsics/isFinite.d.ts +3 -0
  643. package/templates/backend/node_modules/math-intrinsics/isFinite.js +12 -0
  644. package/templates/backend/node_modules/math-intrinsics/isInteger.d.ts +3 -0
  645. package/templates/backend/node_modules/math-intrinsics/isInteger.js +16 -0
  646. package/templates/backend/node_modules/math-intrinsics/isNaN.d.ts +1 -0
  647. package/templates/backend/node_modules/math-intrinsics/isNaN.js +6 -0
  648. package/templates/backend/node_modules/math-intrinsics/isNegativeZero.d.ts +3 -0
  649. package/templates/backend/node_modules/math-intrinsics/isNegativeZero.js +6 -0
  650. package/templates/backend/node_modules/math-intrinsics/max.d.ts +1 -0
  651. package/templates/backend/node_modules/math-intrinsics/max.js +4 -0
  652. package/templates/backend/node_modules/math-intrinsics/min.d.ts +1 -0
  653. package/templates/backend/node_modules/math-intrinsics/min.js +4 -0
  654. package/templates/backend/node_modules/math-intrinsics/mod.d.ts +3 -0
  655. package/templates/backend/node_modules/math-intrinsics/mod.js +9 -0
  656. package/templates/backend/node_modules/math-intrinsics/package.json +86 -0
  657. package/templates/backend/node_modules/math-intrinsics/pow.d.ts +1 -0
  658. package/templates/backend/node_modules/math-intrinsics/pow.js +4 -0
  659. package/templates/backend/node_modules/math-intrinsics/round.d.ts +1 -0
  660. package/templates/backend/node_modules/math-intrinsics/round.js +4 -0
  661. package/templates/backend/node_modules/math-intrinsics/sign.d.ts +3 -0
  662. package/templates/backend/node_modules/math-intrinsics/sign.js +11 -0
  663. package/templates/backend/node_modules/math-intrinsics/test/index.js +192 -0
  664. package/templates/backend/node_modules/math-intrinsics/tsconfig.json +3 -0
  665. package/templates/backend/node_modules/media-typer/HISTORY.md +50 -0
  666. package/templates/backend/node_modules/media-typer/LICENSE +22 -0
  667. package/templates/backend/node_modules/media-typer/README.md +93 -0
  668. package/templates/backend/node_modules/media-typer/index.js +143 -0
  669. package/templates/backend/node_modules/media-typer/package.json +33 -0
  670. package/templates/backend/node_modules/memory-pager/.travis.yml +4 -0
  671. package/templates/backend/node_modules/memory-pager/LICENSE +21 -0
  672. package/templates/backend/node_modules/memory-pager/README.md +65 -0
  673. package/templates/backend/node_modules/memory-pager/index.js +160 -0
  674. package/templates/backend/node_modules/memory-pager/package.json +24 -0
  675. package/templates/backend/node_modules/memory-pager/test.js +80 -0
  676. package/templates/backend/node_modules/merge-descriptors/index.d.ts +11 -0
  677. package/templates/backend/node_modules/merge-descriptors/index.js +26 -0
  678. package/templates/backend/node_modules/merge-descriptors/license +11 -0
  679. package/templates/backend/node_modules/merge-descriptors/package.json +50 -0
  680. package/templates/backend/node_modules/merge-descriptors/readme.md +55 -0
  681. package/templates/backend/node_modules/mime-db/HISTORY.md +541 -0
  682. package/templates/backend/node_modules/mime-db/LICENSE +23 -0
  683. package/templates/backend/node_modules/mime-db/README.md +109 -0
  684. package/templates/backend/node_modules/mime-db/db.json +9342 -0
  685. package/templates/backend/node_modules/mime-db/index.js +12 -0
  686. package/templates/backend/node_modules/mime-db/package.json +56 -0
  687. package/templates/backend/node_modules/mime-types/HISTORY.md +428 -0
  688. package/templates/backend/node_modules/mime-types/LICENSE +23 -0
  689. package/templates/backend/node_modules/mime-types/README.md +126 -0
  690. package/templates/backend/node_modules/mime-types/index.js +211 -0
  691. package/templates/backend/node_modules/mime-types/mimeScore.js +57 -0
  692. package/templates/backend/node_modules/mime-types/package.json +49 -0
  693. package/templates/backend/node_modules/minimatch/LICENSE.md +55 -0
  694. package/templates/backend/node_modules/minimatch/README.md +528 -0
  695. package/templates/backend/node_modules/minimatch/dist/commonjs/assert-valid-pattern.d.ts +2 -0
  696. package/templates/backend/node_modules/minimatch/dist/commonjs/assert-valid-pattern.d.ts.map +1 -0
  697. package/templates/backend/node_modules/minimatch/dist/commonjs/assert-valid-pattern.js +14 -0
  698. package/templates/backend/node_modules/minimatch/dist/commonjs/assert-valid-pattern.js.map +1 -0
  699. package/templates/backend/node_modules/minimatch/dist/commonjs/ast.d.ts +22 -0
  700. package/templates/backend/node_modules/minimatch/dist/commonjs/ast.d.ts.map +1 -0
  701. package/templates/backend/node_modules/minimatch/dist/commonjs/ast.js +845 -0
  702. package/templates/backend/node_modules/minimatch/dist/commonjs/ast.js.map +1 -0
  703. package/templates/backend/node_modules/minimatch/dist/commonjs/brace-expressions.d.ts +8 -0
  704. package/templates/backend/node_modules/minimatch/dist/commonjs/brace-expressions.d.ts.map +1 -0
  705. package/templates/backend/node_modules/minimatch/dist/commonjs/brace-expressions.js +150 -0
  706. package/templates/backend/node_modules/minimatch/dist/commonjs/brace-expressions.js.map +1 -0
  707. package/templates/backend/node_modules/minimatch/dist/commonjs/escape.d.ts +15 -0
  708. package/templates/backend/node_modules/minimatch/dist/commonjs/escape.d.ts.map +1 -0
  709. package/templates/backend/node_modules/minimatch/dist/commonjs/escape.js +30 -0
  710. package/templates/backend/node_modules/minimatch/dist/commonjs/escape.js.map +1 -0
  711. package/templates/backend/node_modules/minimatch/dist/commonjs/index.d.ts +174 -0
  712. package/templates/backend/node_modules/minimatch/dist/commonjs/index.d.ts.map +1 -0
  713. package/templates/backend/node_modules/minimatch/dist/commonjs/index.js +1127 -0
  714. package/templates/backend/node_modules/minimatch/dist/commonjs/index.js.map +1 -0
  715. package/templates/backend/node_modules/minimatch/dist/commonjs/package.json +3 -0
  716. package/templates/backend/node_modules/minimatch/dist/commonjs/unescape.d.ts +22 -0
  717. package/templates/backend/node_modules/minimatch/dist/commonjs/unescape.d.ts.map +1 -0
  718. package/templates/backend/node_modules/minimatch/dist/commonjs/unescape.js +38 -0
  719. package/templates/backend/node_modules/minimatch/dist/commonjs/unescape.js.map +1 -0
  720. package/templates/backend/node_modules/minimatch/dist/esm/assert-valid-pattern.d.ts +2 -0
  721. package/templates/backend/node_modules/minimatch/dist/esm/assert-valid-pattern.d.ts.map +1 -0
  722. package/templates/backend/node_modules/minimatch/dist/esm/assert-valid-pattern.js +10 -0
  723. package/templates/backend/node_modules/minimatch/dist/esm/assert-valid-pattern.js.map +1 -0
  724. package/templates/backend/node_modules/minimatch/dist/esm/ast.d.ts +22 -0
  725. package/templates/backend/node_modules/minimatch/dist/esm/ast.d.ts.map +1 -0
  726. package/templates/backend/node_modules/minimatch/dist/esm/ast.js +841 -0
  727. package/templates/backend/node_modules/minimatch/dist/esm/ast.js.map +1 -0
  728. package/templates/backend/node_modules/minimatch/dist/esm/brace-expressions.d.ts +8 -0
  729. package/templates/backend/node_modules/minimatch/dist/esm/brace-expressions.d.ts.map +1 -0
  730. package/templates/backend/node_modules/minimatch/dist/esm/brace-expressions.js +146 -0
  731. package/templates/backend/node_modules/minimatch/dist/esm/brace-expressions.js.map +1 -0
  732. package/templates/backend/node_modules/minimatch/dist/esm/escape.d.ts +15 -0
  733. package/templates/backend/node_modules/minimatch/dist/esm/escape.d.ts.map +1 -0
  734. package/templates/backend/node_modules/minimatch/dist/esm/escape.js +26 -0
  735. package/templates/backend/node_modules/minimatch/dist/esm/escape.js.map +1 -0
  736. package/templates/backend/node_modules/minimatch/dist/esm/index.d.ts +174 -0
  737. package/templates/backend/node_modules/minimatch/dist/esm/index.d.ts.map +1 -0
  738. package/templates/backend/node_modules/minimatch/dist/esm/index.js +1114 -0
  739. package/templates/backend/node_modules/minimatch/dist/esm/index.js.map +1 -0
  740. package/templates/backend/node_modules/minimatch/dist/esm/package.json +3 -0
  741. package/templates/backend/node_modules/minimatch/dist/esm/unescape.d.ts +22 -0
  742. package/templates/backend/node_modules/minimatch/dist/esm/unescape.d.ts.map +1 -0
  743. package/templates/backend/node_modules/minimatch/dist/esm/unescape.js +34 -0
  744. package/templates/backend/node_modules/minimatch/dist/esm/unescape.js.map +1 -0
  745. package/templates/backend/node_modules/minimatch/package.json +73 -0
  746. package/templates/backend/node_modules/mongodb/LICENSE.md +201 -0
  747. package/templates/backend/node_modules/mongodb/README.md +366 -0
  748. package/templates/backend/node_modules/mongodb/etc/prepare.js +12 -0
  749. package/templates/backend/node_modules/mongodb/lib/admin.js +136 -0
  750. package/templates/backend/node_modules/mongodb/lib/admin.js.map +1 -0
  751. package/templates/backend/node_modules/mongodb/lib/bson.js +106 -0
  752. package/templates/backend/node_modules/mongodb/lib/bson.js.map +1 -0
  753. package/templates/backend/node_modules/mongodb/lib/bulk/common.js +835 -0
  754. package/templates/backend/node_modules/mongodb/lib/bulk/common.js.map +1 -0
  755. package/templates/backend/node_modules/mongodb/lib/bulk/ordered.js +67 -0
  756. package/templates/backend/node_modules/mongodb/lib/bulk/ordered.js.map +1 -0
  757. package/templates/backend/node_modules/mongodb/lib/bulk/unordered.js +92 -0
  758. package/templates/backend/node_modules/mongodb/lib/bulk/unordered.js.map +1 -0
  759. package/templates/backend/node_modules/mongodb/lib/change_stream.js +517 -0
  760. package/templates/backend/node_modules/mongodb/lib/change_stream.js.map +1 -0
  761. package/templates/backend/node_modules/mongodb/lib/client-side-encryption/auto_encrypter.js +281 -0
  762. package/templates/backend/node_modules/mongodb/lib/client-side-encryption/auto_encrypter.js.map +1 -0
  763. package/templates/backend/node_modules/mongodb/lib/client-side-encryption/client_encryption.js +607 -0
  764. package/templates/backend/node_modules/mongodb/lib/client-side-encryption/client_encryption.js.map +1 -0
  765. package/templates/backend/node_modules/mongodb/lib/client-side-encryption/errors.js +138 -0
  766. package/templates/backend/node_modules/mongodb/lib/client-side-encryption/errors.js.map +1 -0
  767. package/templates/backend/node_modules/mongodb/lib/client-side-encryption/mongocryptd_manager.js +85 -0
  768. package/templates/backend/node_modules/mongodb/lib/client-side-encryption/mongocryptd_manager.js.map +1 -0
  769. package/templates/backend/node_modules/mongodb/lib/client-side-encryption/providers/aws.js +23 -0
  770. package/templates/backend/node_modules/mongodb/lib/client-side-encryption/providers/aws.js.map +1 -0
  771. package/templates/backend/node_modules/mongodb/lib/client-side-encryption/providers/azure.js +132 -0
  772. package/templates/backend/node_modules/mongodb/lib/client-side-encryption/providers/azure.js.map +1 -0
  773. package/templates/backend/node_modules/mongodb/lib/client-side-encryption/providers/gcp.js +16 -0
  774. package/templates/backend/node_modules/mongodb/lib/client-side-encryption/providers/gcp.js.map +1 -0
  775. package/templates/backend/node_modules/mongodb/lib/client-side-encryption/providers/index.js +43 -0
  776. package/templates/backend/node_modules/mongodb/lib/client-side-encryption/providers/index.js.map +1 -0
  777. package/templates/backend/node_modules/mongodb/lib/client-side-encryption/state_machine.js +427 -0
  778. package/templates/backend/node_modules/mongodb/lib/client-side-encryption/state_machine.js.map +1 -0
  779. package/templates/backend/node_modules/mongodb/lib/cmap/auth/auth_provider.js +51 -0
  780. package/templates/backend/node_modules/mongodb/lib/cmap/auth/auth_provider.js.map +1 -0
  781. package/templates/backend/node_modules/mongodb/lib/cmap/auth/aws4.js +161 -0
  782. package/templates/backend/node_modules/mongodb/lib/cmap/auth/aws4.js.map +1 -0
  783. package/templates/backend/node_modules/mongodb/lib/cmap/auth/aws_temporary_credentials.js +103 -0
  784. package/templates/backend/node_modules/mongodb/lib/cmap/auth/aws_temporary_credentials.js.map +1 -0
  785. package/templates/backend/node_modules/mongodb/lib/cmap/auth/gssapi.js +152 -0
  786. package/templates/backend/node_modules/mongodb/lib/cmap/auth/gssapi.js.map +1 -0
  787. package/templates/backend/node_modules/mongodb/lib/cmap/auth/mongo_credentials.js +169 -0
  788. package/templates/backend/node_modules/mongodb/lib/cmap/auth/mongo_credentials.js.map +1 -0
  789. package/templates/backend/node_modules/mongodb/lib/cmap/auth/mongodb_aws.js +129 -0
  790. package/templates/backend/node_modules/mongodb/lib/cmap/auth/mongodb_aws.js.map +1 -0
  791. package/templates/backend/node_modules/mongodb/lib/cmap/auth/mongodb_oidc/automated_callback_workflow.js +84 -0
  792. package/templates/backend/node_modules/mongodb/lib/cmap/auth/mongodb_oidc/automated_callback_workflow.js.map +1 -0
  793. package/templates/backend/node_modules/mongodb/lib/cmap/auth/mongodb_oidc/azure_machine_workflow.js +62 -0
  794. package/templates/backend/node_modules/mongodb/lib/cmap/auth/mongodb_oidc/azure_machine_workflow.js.map +1 -0
  795. package/templates/backend/node_modules/mongodb/lib/cmap/auth/mongodb_oidc/callback_workflow.js +141 -0
  796. package/templates/backend/node_modules/mongodb/lib/cmap/auth/mongodb_oidc/callback_workflow.js.map +1 -0
  797. package/templates/backend/node_modules/mongodb/lib/cmap/auth/mongodb_oidc/command_builders.js +44 -0
  798. package/templates/backend/node_modules/mongodb/lib/cmap/auth/mongodb_oidc/command_builders.js.map +1 -0
  799. package/templates/backend/node_modules/mongodb/lib/cmap/auth/mongodb_oidc/gcp_machine_workflow.js +39 -0
  800. package/templates/backend/node_modules/mongodb/lib/cmap/auth/mongodb_oidc/gcp_machine_workflow.js.map +1 -0
  801. package/templates/backend/node_modules/mongodb/lib/cmap/auth/mongodb_oidc/human_callback_workflow.js +122 -0
  802. package/templates/backend/node_modules/mongodb/lib/cmap/auth/mongodb_oidc/human_callback_workflow.js.map +1 -0
  803. package/templates/backend/node_modules/mongodb/lib/cmap/auth/mongodb_oidc/k8s_machine_workflow.js +32 -0
  804. package/templates/backend/node_modules/mongodb/lib/cmap/auth/mongodb_oidc/k8s_machine_workflow.js.map +1 -0
  805. package/templates/backend/node_modules/mongodb/lib/cmap/auth/mongodb_oidc/token_cache.js +52 -0
  806. package/templates/backend/node_modules/mongodb/lib/cmap/auth/mongodb_oidc/token_cache.js.map +1 -0
  807. package/templates/backend/node_modules/mongodb/lib/cmap/auth/mongodb_oidc/token_machine_workflow.js +23 -0
  808. package/templates/backend/node_modules/mongodb/lib/cmap/auth/mongodb_oidc/token_machine_workflow.js.map +1 -0
  809. package/templates/backend/node_modules/mongodb/lib/cmap/auth/mongodb_oidc.js +73 -0
  810. package/templates/backend/node_modules/mongodb/lib/cmap/auth/mongodb_oidc.js.map +1 -0
  811. package/templates/backend/node_modules/mongodb/lib/cmap/auth/plain.js +26 -0
  812. package/templates/backend/node_modules/mongodb/lib/cmap/auth/plain.js.map +1 -0
  813. package/templates/backend/node_modules/mongodb/lib/cmap/auth/providers.js +22 -0
  814. package/templates/backend/node_modules/mongodb/lib/cmap/auth/providers.js.map +1 -0
  815. package/templates/backend/node_modules/mongodb/lib/cmap/auth/scram.js +267 -0
  816. package/templates/backend/node_modules/mongodb/lib/cmap/auth/scram.js.map +1 -0
  817. package/templates/backend/node_modules/mongodb/lib/cmap/auth/x509.js +36 -0
  818. package/templates/backend/node_modules/mongodb/lib/cmap/auth/x509.js.map +1 -0
  819. package/templates/backend/node_modules/mongodb/lib/cmap/command_monitoring_events.js +223 -0
  820. package/templates/backend/node_modules/mongodb/lib/cmap/command_monitoring_events.js.map +1 -0
  821. package/templates/backend/node_modules/mongodb/lib/cmap/commands.js +542 -0
  822. package/templates/backend/node_modules/mongodb/lib/cmap/commands.js.map +1 -0
  823. package/templates/backend/node_modules/mongodb/lib/cmap/connect.js +398 -0
  824. package/templates/backend/node_modules/mongodb/lib/cmap/connect.js.map +1 -0
  825. package/templates/backend/node_modules/mongodb/lib/cmap/connection.js +574 -0
  826. package/templates/backend/node_modules/mongodb/lib/cmap/connection.js.map +1 -0
  827. package/templates/backend/node_modules/mongodb/lib/cmap/connection_pool.js +558 -0
  828. package/templates/backend/node_modules/mongodb/lib/cmap/connection_pool.js.map +1 -0
  829. package/templates/backend/node_modules/mongodb/lib/cmap/connection_pool_events.js +190 -0
  830. package/templates/backend/node_modules/mongodb/lib/cmap/connection_pool_events.js.map +1 -0
  831. package/templates/backend/node_modules/mongodb/lib/cmap/errors.js +108 -0
  832. package/templates/backend/node_modules/mongodb/lib/cmap/errors.js.map +1 -0
  833. package/templates/backend/node_modules/mongodb/lib/cmap/handshake/client_metadata.js +241 -0
  834. package/templates/backend/node_modules/mongodb/lib/cmap/handshake/client_metadata.js.map +1 -0
  835. package/templates/backend/node_modules/mongodb/lib/cmap/metrics.js +62 -0
  836. package/templates/backend/node_modules/mongodb/lib/cmap/metrics.js.map +1 -0
  837. package/templates/backend/node_modules/mongodb/lib/cmap/stream_description.js +70 -0
  838. package/templates/backend/node_modules/mongodb/lib/cmap/stream_description.js.map +1 -0
  839. package/templates/backend/node_modules/mongodb/lib/cmap/wire_protocol/compression.js +179 -0
  840. package/templates/backend/node_modules/mongodb/lib/cmap/wire_protocol/compression.js.map +1 -0
  841. package/templates/backend/node_modules/mongodb/lib/cmap/wire_protocol/constants.js +21 -0
  842. package/templates/backend/node_modules/mongodb/lib/cmap/wire_protocol/constants.js.map +1 -0
  843. package/templates/backend/node_modules/mongodb/lib/cmap/wire_protocol/on_data.js +111 -0
  844. package/templates/backend/node_modules/mongodb/lib/cmap/wire_protocol/on_data.js.map +1 -0
  845. package/templates/backend/node_modules/mongodb/lib/cmap/wire_protocol/on_demand/document.js +222 -0
  846. package/templates/backend/node_modules/mongodb/lib/cmap/wire_protocol/on_demand/document.js.map +1 -0
  847. package/templates/backend/node_modules/mongodb/lib/cmap/wire_protocol/responses.js +315 -0
  848. package/templates/backend/node_modules/mongodb/lib/cmap/wire_protocol/responses.js.map +1 -0
  849. package/templates/backend/node_modules/mongodb/lib/cmap/wire_protocol/shared.js +35 -0
  850. package/templates/backend/node_modules/mongodb/lib/cmap/wire_protocol/shared.js.map +1 -0
  851. package/templates/backend/node_modules/mongodb/lib/collection.js +751 -0
  852. package/templates/backend/node_modules/mongodb/lib/collection.js.map +1 -0
  853. package/templates/backend/node_modules/mongodb/lib/connection_string.js +1106 -0
  854. package/templates/backend/node_modules/mongodb/lib/connection_string.js.map +1 -0
  855. package/templates/backend/node_modules/mongodb/lib/constants.js +170 -0
  856. package/templates/backend/node_modules/mongodb/lib/constants.js.map +1 -0
  857. package/templates/backend/node_modules/mongodb/lib/cursor/abstract_cursor.js +924 -0
  858. package/templates/backend/node_modules/mongodb/lib/cursor/abstract_cursor.js.map +1 -0
  859. package/templates/backend/node_modules/mongodb/lib/cursor/aggregation_cursor.js +164 -0
  860. package/templates/backend/node_modules/mongodb/lib/cursor/aggregation_cursor.js.map +1 -0
  861. package/templates/backend/node_modules/mongodb/lib/cursor/change_stream_cursor.js +104 -0
  862. package/templates/backend/node_modules/mongodb/lib/cursor/change_stream_cursor.js.map +1 -0
  863. package/templates/backend/node_modules/mongodb/lib/cursor/client_bulk_write_cursor.js +52 -0
  864. package/templates/backend/node_modules/mongodb/lib/cursor/client_bulk_write_cursor.js.map +1 -0
  865. package/templates/backend/node_modules/mongodb/lib/cursor/explainable_cursor.js +36 -0
  866. package/templates/backend/node_modules/mongodb/lib/cursor/explainable_cursor.js.map +1 -0
  867. package/templates/backend/node_modules/mongodb/lib/cursor/find_cursor.js +399 -0
  868. package/templates/backend/node_modules/mongodb/lib/cursor/find_cursor.js.map +1 -0
  869. package/templates/backend/node_modules/mongodb/lib/cursor/list_collections_cursor.js +34 -0
  870. package/templates/backend/node_modules/mongodb/lib/cursor/list_collections_cursor.js.map +1 -0
  871. package/templates/backend/node_modules/mongodb/lib/cursor/list_indexes_cursor.js +32 -0
  872. package/templates/backend/node_modules/mongodb/lib/cursor/list_indexes_cursor.js.map +1 -0
  873. package/templates/backend/node_modules/mongodb/lib/cursor/list_search_indexes_cursor.js +14 -0
  874. package/templates/backend/node_modules/mongodb/lib/cursor/list_search_indexes_cursor.js.map +1 -0
  875. package/templates/backend/node_modules/mongodb/lib/cursor/run_command_cursor.js +94 -0
  876. package/templates/backend/node_modules/mongodb/lib/cursor/run_command_cursor.js.map +1 -0
  877. package/templates/backend/node_modules/mongodb/lib/db.js +419 -0
  878. package/templates/backend/node_modules/mongodb/lib/db.js.map +1 -0
  879. package/templates/backend/node_modules/mongodb/lib/deps.js +112 -0
  880. package/templates/backend/node_modules/mongodb/lib/deps.js.map +1 -0
  881. package/templates/backend/node_modules/mongodb/lib/encrypter.js +106 -0
  882. package/templates/backend/node_modules/mongodb/lib/encrypter.js.map +1 -0
  883. package/templates/backend/node_modules/mongodb/lib/error.js +1380 -0
  884. package/templates/backend/node_modules/mongodb/lib/error.js.map +1 -0
  885. package/templates/backend/node_modules/mongodb/lib/explain.js +59 -0
  886. package/templates/backend/node_modules/mongodb/lib/explain.js.map +1 -0
  887. package/templates/backend/node_modules/mongodb/lib/gridfs/download.js +306 -0
  888. package/templates/backend/node_modules/mongodb/lib/gridfs/download.js.map +1 -0
  889. package/templates/backend/node_modules/mongodb/lib/gridfs/index.js +164 -0
  890. package/templates/backend/node_modules/mongodb/lib/gridfs/index.js.map +1 -0
  891. package/templates/backend/node_modules/mongodb/lib/gridfs/upload.js +358 -0
  892. package/templates/backend/node_modules/mongodb/lib/gridfs/upload.js.map +1 -0
  893. package/templates/backend/node_modules/mongodb/lib/index.js +193 -0
  894. package/templates/backend/node_modules/mongodb/lib/index.js.map +1 -0
  895. package/templates/backend/node_modules/mongodb/lib/mongo_client.js +557 -0
  896. package/templates/backend/node_modules/mongodb/lib/mongo_client.js.map +1 -0
  897. package/templates/backend/node_modules/mongodb/lib/mongo_client_auth_providers.js +80 -0
  898. package/templates/backend/node_modules/mongodb/lib/mongo_client_auth_providers.js.map +1 -0
  899. package/templates/backend/node_modules/mongodb/lib/mongo_logger.js +655 -0
  900. package/templates/backend/node_modules/mongodb/lib/mongo_logger.js.map +1 -0
  901. package/templates/backend/node_modules/mongodb/lib/mongo_types.js +56 -0
  902. package/templates/backend/node_modules/mongodb/lib/mongo_types.js.map +1 -0
  903. package/templates/backend/node_modules/mongodb/lib/operations/aggregate.js +90 -0
  904. package/templates/backend/node_modules/mongodb/lib/operations/aggregate.js.map +1 -0
  905. package/templates/backend/node_modules/mongodb/lib/operations/client_bulk_write/client_bulk_write.js +51 -0
  906. package/templates/backend/node_modules/mongodb/lib/operations/client_bulk_write/client_bulk_write.js.map +1 -0
  907. package/templates/backend/node_modules/mongodb/lib/operations/client_bulk_write/command_builder.js +340 -0
  908. package/templates/backend/node_modules/mongodb/lib/operations/client_bulk_write/command_builder.js.map +1 -0
  909. package/templates/backend/node_modules/mongodb/lib/operations/client_bulk_write/common.js +3 -0
  910. package/templates/backend/node_modules/mongodb/lib/operations/client_bulk_write/common.js.map +1 -0
  911. package/templates/backend/node_modules/mongodb/lib/operations/client_bulk_write/executor.js +120 -0
  912. package/templates/backend/node_modules/mongodb/lib/operations/client_bulk_write/executor.js.map +1 -0
  913. package/templates/backend/node_modules/mongodb/lib/operations/client_bulk_write/results_merger.js +204 -0
  914. package/templates/backend/node_modules/mongodb/lib/operations/client_bulk_write/results_merger.js.map +1 -0
  915. package/templates/backend/node_modules/mongodb/lib/operations/command.js +83 -0
  916. package/templates/backend/node_modules/mongodb/lib/operations/command.js.map +1 -0
  917. package/templates/backend/node_modules/mongodb/lib/operations/count.js +45 -0
  918. package/templates/backend/node_modules/mongodb/lib/operations/count.js.map +1 -0
  919. package/templates/backend/node_modules/mongodb/lib/operations/create_collection.js +109 -0
  920. package/templates/backend/node_modules/mongodb/lib/operations/create_collection.js.map +1 -0
  921. package/templates/backend/node_modules/mongodb/lib/operations/delete.js +125 -0
  922. package/templates/backend/node_modules/mongodb/lib/operations/delete.js.map +1 -0
  923. package/templates/backend/node_modules/mongodb/lib/operations/distinct.js +61 -0
  924. package/templates/backend/node_modules/mongodb/lib/operations/distinct.js.map +1 -0
  925. package/templates/backend/node_modules/mongodb/lib/operations/drop.js +93 -0
  926. package/templates/backend/node_modules/mongodb/lib/operations/drop.js.map +1 -0
  927. package/templates/backend/node_modules/mongodb/lib/operations/end_sessions.js +34 -0
  928. package/templates/backend/node_modules/mongodb/lib/operations/end_sessions.js.map +1 -0
  929. package/templates/backend/node_modules/mongodb/lib/operations/estimated_document_count.js +41 -0
  930. package/templates/backend/node_modules/mongodb/lib/operations/estimated_document_count.js.map +1 -0
  931. package/templates/backend/node_modules/mongodb/lib/operations/execute_operation.js +312 -0
  932. package/templates/backend/node_modules/mongodb/lib/operations/execute_operation.js.map +1 -0
  933. package/templates/backend/node_modules/mongodb/lib/operations/find.js +148 -0
  934. package/templates/backend/node_modules/mongodb/lib/operations/find.js.map +1 -0
  935. package/templates/backend/node_modules/mongodb/lib/operations/find_and_modify.js +158 -0
  936. package/templates/backend/node_modules/mongodb/lib/operations/find_and_modify.js.map +1 -0
  937. package/templates/backend/node_modules/mongodb/lib/operations/get_more.js +62 -0
  938. package/templates/backend/node_modules/mongodb/lib/operations/get_more.js.map +1 -0
  939. package/templates/backend/node_modules/mongodb/lib/operations/indexes.js +186 -0
  940. package/templates/backend/node_modules/mongodb/lib/operations/indexes.js.map +1 -0
  941. package/templates/backend/node_modules/mongodb/lib/operations/insert.js +70 -0
  942. package/templates/backend/node_modules/mongodb/lib/operations/insert.js.map +1 -0
  943. package/templates/backend/node_modules/mongodb/lib/operations/kill_cursors.js +43 -0
  944. package/templates/backend/node_modules/mongodb/lib/operations/kill_cursors.js.map +1 -0
  945. package/templates/backend/node_modules/mongodb/lib/operations/list_collections.js +53 -0
  946. package/templates/backend/node_modules/mongodb/lib/operations/list_collections.js.map +1 -0
  947. package/templates/backend/node_modules/mongodb/lib/operations/list_databases.js +40 -0
  948. package/templates/backend/node_modules/mongodb/lib/operations/list_databases.js.map +1 -0
  949. package/templates/backend/node_modules/mongodb/lib/operations/operation.js +103 -0
  950. package/templates/backend/node_modules/mongodb/lib/operations/operation.js.map +1 -0
  951. package/templates/backend/node_modules/mongodb/lib/operations/profiling_level.js +43 -0
  952. package/templates/backend/node_modules/mongodb/lib/operations/profiling_level.js.map +1 -0
  953. package/templates/backend/node_modules/mongodb/lib/operations/remove_user.js +27 -0
  954. package/templates/backend/node_modules/mongodb/lib/operations/remove_user.js.map +1 -0
  955. package/templates/backend/node_modules/mongodb/lib/operations/rename.js +38 -0
  956. package/templates/backend/node_modules/mongodb/lib/operations/rename.js.map +1 -0
  957. package/templates/backend/node_modules/mongodb/lib/operations/run_command.js +47 -0
  958. package/templates/backend/node_modules/mongodb/lib/operations/run_command.js.map +1 -0
  959. package/templates/backend/node_modules/mongodb/lib/operations/search_indexes/create.js +33 -0
  960. package/templates/backend/node_modules/mongodb/lib/operations/search_indexes/create.js.map +1 -0
  961. package/templates/backend/node_modules/mongodb/lib/operations/search_indexes/drop.js +43 -0
  962. package/templates/backend/node_modules/mongodb/lib/operations/search_indexes/drop.js.map +1 -0
  963. package/templates/backend/node_modules/mongodb/lib/operations/search_indexes/update.js +35 -0
  964. package/templates/backend/node_modules/mongodb/lib/operations/search_indexes/update.js.map +1 -0
  965. package/templates/backend/node_modules/mongodb/lib/operations/set_profiling_level.js +53 -0
  966. package/templates/backend/node_modules/mongodb/lib/operations/set_profiling_level.js.map +1 -0
  967. package/templates/backend/node_modules/mongodb/lib/operations/stats.js +27 -0
  968. package/templates/backend/node_modules/mongodb/lib/operations/stats.js.map +1 -0
  969. package/templates/backend/node_modules/mongodb/lib/operations/update.js +188 -0
  970. package/templates/backend/node_modules/mongodb/lib/operations/update.js.map +1 -0
  971. package/templates/backend/node_modules/mongodb/lib/operations/validate_collection.js +37 -0
  972. package/templates/backend/node_modules/mongodb/lib/operations/validate_collection.js.map +1 -0
  973. package/templates/backend/node_modules/mongodb/lib/read_concern.js +73 -0
  974. package/templates/backend/node_modules/mongodb/lib/read_concern.js.map +1 -0
  975. package/templates/backend/node_modules/mongodb/lib/read_preference.js +191 -0
  976. package/templates/backend/node_modules/mongodb/lib/read_preference.js.map +1 -0
  977. package/templates/backend/node_modules/mongodb/lib/runtime_adapters.js +32 -0
  978. package/templates/backend/node_modules/mongodb/lib/runtime_adapters.js.map +1 -0
  979. package/templates/backend/node_modules/mongodb/lib/sdam/common.js +49 -0
  980. package/templates/backend/node_modules/mongodb/lib/sdam/common.js.map +1 -0
  981. package/templates/backend/node_modules/mongodb/lib/sdam/events.js +146 -0
  982. package/templates/backend/node_modules/mongodb/lib/sdam/events.js.map +1 -0
  983. package/templates/backend/node_modules/mongodb/lib/sdam/monitor.js +544 -0
  984. package/templates/backend/node_modules/mongodb/lib/sdam/monitor.js.map +1 -0
  985. package/templates/backend/node_modules/mongodb/lib/sdam/server.js +404 -0
  986. package/templates/backend/node_modules/mongodb/lib/sdam/server.js.map +1 -0
  987. package/templates/backend/node_modules/mongodb/lib/sdam/server_description.js +204 -0
  988. package/templates/backend/node_modules/mongodb/lib/sdam/server_description.js.map +1 -0
  989. package/templates/backend/node_modules/mongodb/lib/sdam/server_selection.js +294 -0
  990. package/templates/backend/node_modules/mongodb/lib/sdam/server_selection.js.map +1 -0
  991. package/templates/backend/node_modules/mongodb/lib/sdam/server_selection_events.js +85 -0
  992. package/templates/backend/node_modules/mongodb/lib/sdam/server_selection_events.js.map +1 -0
  993. package/templates/backend/node_modules/mongodb/lib/sdam/srv_polling.js +108 -0
  994. package/templates/backend/node_modules/mongodb/lib/sdam/srv_polling.js.map +1 -0
  995. package/templates/backend/node_modules/mongodb/lib/sdam/topology.js +654 -0
  996. package/templates/backend/node_modules/mongodb/lib/sdam/topology.js.map +1 -0
  997. package/templates/backend/node_modules/mongodb/lib/sdam/topology_description.js +383 -0
  998. package/templates/backend/node_modules/mongodb/lib/sdam/topology_description.js.map +1 -0
  999. package/templates/backend/node_modules/mongodb/lib/sessions.js +937 -0
  1000. package/templates/backend/node_modules/mongodb/lib/sessions.js.map +1 -0
  1001. package/templates/backend/node_modules/mongodb/lib/sort.js +103 -0
  1002. package/templates/backend/node_modules/mongodb/lib/sort.js.map +1 -0
  1003. package/templates/backend/node_modules/mongodb/lib/timeout.js +296 -0
  1004. package/templates/backend/node_modules/mongodb/lib/timeout.js.map +1 -0
  1005. package/templates/backend/node_modules/mongodb/lib/transactions.js +135 -0
  1006. package/templates/backend/node_modules/mongodb/lib/transactions.js.map +1 -0
  1007. package/templates/backend/node_modules/mongodb/lib/utils.js +1155 -0
  1008. package/templates/backend/node_modules/mongodb/lib/utils.js.map +1 -0
  1009. package/templates/backend/node_modules/mongodb/lib/write_concern.js +100 -0
  1010. package/templates/backend/node_modules/mongodb/lib/write_concern.js.map +1 -0
  1011. package/templates/backend/node_modules/mongodb/mongodb.d.ts +9061 -0
  1012. package/templates/backend/node_modules/mongodb/package.json +182 -0
  1013. package/templates/backend/node_modules/mongodb/src/admin.ts +173 -0
  1014. package/templates/backend/node_modules/mongodb/src/bson.ts +172 -0
  1015. package/templates/backend/node_modules/mongodb/src/bulk/common.ts +1251 -0
  1016. package/templates/backend/node_modules/mongodb/src/bulk/ordered.ts +83 -0
  1017. package/templates/backend/node_modules/mongodb/src/bulk/unordered.ts +115 -0
  1018. package/templates/backend/node_modules/mongodb/src/change_stream.ts +1165 -0
  1019. package/templates/backend/node_modules/mongodb/src/client-side-encryption/auto_encrypter.ts +475 -0
  1020. package/templates/backend/node_modules/mongodb/src/client-side-encryption/client_encryption.ts +1148 -0
  1021. package/templates/backend/node_modules/mongodb/src/client-side-encryption/errors.ts +144 -0
  1022. package/templates/backend/node_modules/mongodb/src/client-side-encryption/mongocryptd_manager.ts +100 -0
  1023. package/templates/backend/node_modules/mongodb/src/client-side-encryption/providers/aws.ts +33 -0
  1024. package/templates/backend/node_modules/mongodb/src/client-side-encryption/providers/azure.ts +181 -0
  1025. package/templates/backend/node_modules/mongodb/src/client-side-encryption/providers/gcp.ts +16 -0
  1026. package/templates/backend/node_modules/mongodb/src/client-side-encryption/providers/index.ts +207 -0
  1027. package/templates/backend/node_modules/mongodb/src/client-side-encryption/state_machine.ts +651 -0
  1028. package/templates/backend/node_modules/mongodb/src/cmap/auth/auth_provider.ts +77 -0
  1029. package/templates/backend/node_modules/mongodb/src/cmap/auth/aws4.ts +207 -0
  1030. package/templates/backend/node_modules/mongodb/src/cmap/auth/aws_temporary_credentials.ts +129 -0
  1031. package/templates/backend/node_modules/mongodb/src/cmap/auth/gssapi.ts +206 -0
  1032. package/templates/backend/node_modules/mongodb/src/cmap/auth/mongo_credentials.ts +292 -0
  1033. package/templates/backend/node_modules/mongodb/src/cmap/auth/mongodb_aws.ts +179 -0
  1034. package/templates/backend/node_modules/mongodb/src/cmap/auth/mongodb_oidc/automated_callback_workflow.ts +88 -0
  1035. package/templates/backend/node_modules/mongodb/src/cmap/auth/mongodb_oidc/azure_machine_workflow.ts +73 -0
  1036. package/templates/backend/node_modules/mongodb/src/cmap/auth/mongodb_oidc/callback_workflow.ts +188 -0
  1037. package/templates/backend/node_modules/mongodb/src/cmap/auth/mongodb_oidc/command_builders.ts +53 -0
  1038. package/templates/backend/node_modules/mongodb/src/cmap/auth/mongodb_oidc/gcp_machine_workflow.ts +46 -0
  1039. package/templates/backend/node_modules/mongodb/src/cmap/auth/mongodb_oidc/human_callback_workflow.ts +141 -0
  1040. package/templates/backend/node_modules/mongodb/src/cmap/auth/mongodb_oidc/k8s_machine_workflow.ts +31 -0
  1041. package/templates/backend/node_modules/mongodb/src/cmap/auth/mongodb_oidc/token_cache.ts +62 -0
  1042. package/templates/backend/node_modules/mongodb/src/cmap/auth/mongodb_oidc/token_machine_workflow.ts +22 -0
  1043. package/templates/backend/node_modules/mongodb/src/cmap/auth/mongodb_oidc.ts +185 -0
  1044. package/templates/backend/node_modules/mongodb/src/cmap/auth/plain.ts +25 -0
  1045. package/templates/backend/node_modules/mongodb/src/cmap/auth/providers.ts +22 -0
  1046. package/templates/backend/node_modules/mongodb/src/cmap/auth/scram.ts +371 -0
  1047. package/templates/backend/node_modules/mongodb/src/cmap/auth/x509.ts +43 -0
  1048. package/templates/backend/node_modules/mongodb/src/cmap/command_monitoring_events.ts +316 -0
  1049. package/templates/backend/node_modules/mongodb/src/cmap/commands.ts +807 -0
  1050. package/templates/backend/node_modules/mongodb/src/cmap/connect.ts +538 -0
  1051. package/templates/backend/node_modules/mongodb/src/cmap/connection.ts +938 -0
  1052. package/templates/backend/node_modules/mongodb/src/cmap/connection_pool.ts +831 -0
  1053. package/templates/backend/node_modules/mongodb/src/cmap/connection_pool_events.ts +300 -0
  1054. package/templates/backend/node_modules/mongodb/src/cmap/errors.ts +119 -0
  1055. package/templates/backend/node_modules/mongodb/src/cmap/handshake/client_metadata.ts +353 -0
  1056. package/templates/backend/node_modules/mongodb/src/cmap/metrics.ts +58 -0
  1057. package/templates/backend/node_modules/mongodb/src/cmap/stream_description.ts +96 -0
  1058. package/templates/backend/node_modules/mongodb/src/cmap/wire_protocol/compression.ts +215 -0
  1059. package/templates/backend/node_modules/mongodb/src/cmap/wire_protocol/constants.ts +17 -0
  1060. package/templates/backend/node_modules/mongodb/src/cmap/wire_protocol/on_data.ts +139 -0
  1061. package/templates/backend/node_modules/mongodb/src/cmap/wire_protocol/on_demand/document.ts +356 -0
  1062. package/templates/backend/node_modules/mongodb/src/cmap/wire_protocol/responses.ts +393 -0
  1063. package/templates/backend/node_modules/mongodb/src/cmap/wire_protocol/shared.ts +48 -0
  1064. package/templates/backend/node_modules/mongodb/src/collection.ts +1314 -0
  1065. package/templates/backend/node_modules/mongodb/src/connection_string.ts +1315 -0
  1066. package/templates/backend/node_modules/mongodb/src/constants.ts +176 -0
  1067. package/templates/backend/node_modules/mongodb/src/cursor/abstract_cursor.ts +1247 -0
  1068. package/templates/backend/node_modules/mongodb/src/cursor/aggregation_cursor.ts +245 -0
  1069. package/templates/backend/node_modules/mongodb/src/cursor/change_stream_cursor.ts +171 -0
  1070. package/templates/backend/node_modules/mongodb/src/cursor/client_bulk_write_cursor.ts +83 -0
  1071. package/templates/backend/node_modules/mongodb/src/cursor/explainable_cursor.ts +51 -0
  1072. package/templates/backend/node_modules/mongodb/src/cursor/find_cursor.ts +497 -0
  1073. package/templates/backend/node_modules/mongodb/src/cursor/list_collections_cursor.ts +50 -0
  1074. package/templates/backend/node_modules/mongodb/src/cursor/list_indexes_cursor.ts +37 -0
  1075. package/templates/backend/node_modules/mongodb/src/cursor/list_search_indexes_cursor.ts +20 -0
  1076. package/templates/backend/node_modules/mongodb/src/cursor/run_command_cursor.ts +178 -0
  1077. package/templates/backend/node_modules/mongodb/src/db.ts +621 -0
  1078. package/templates/backend/node_modules/mongodb/src/deps.ts +227 -0
  1079. package/templates/backend/node_modules/mongodb/src/encrypter.ts +127 -0
  1080. package/templates/backend/node_modules/mongodb/src/error.ts +1567 -0
  1081. package/templates/backend/node_modules/mongodb/src/explain.ts +124 -0
  1082. package/templates/backend/node_modules/mongodb/src/gridfs/download.ts +483 -0
  1083. package/templates/backend/node_modules/mongodb/src/gridfs/index.ts +264 -0
  1084. package/templates/backend/node_modules/mongodb/src/gridfs/upload.ts +538 -0
  1085. package/templates/backend/node_modules/mongodb/src/index.ts +634 -0
  1086. package/templates/backend/node_modules/mongodb/src/mongo_client.ts +1179 -0
  1087. package/templates/backend/node_modules/mongodb/src/mongo_client_auth_providers.ts +87 -0
  1088. package/templates/backend/node_modules/mongodb/src/mongo_logger.ts +1081 -0
  1089. package/templates/backend/node_modules/mongodb/src/mongo_types.ts +678 -0
  1090. package/templates/backend/node_modules/mongodb/src/operations/aggregate.ts +153 -0
  1091. package/templates/backend/node_modules/mongodb/src/operations/client_bulk_write/client_bulk_write.ts +72 -0
  1092. package/templates/backend/node_modules/mongodb/src/operations/client_bulk_write/command_builder.ts +487 -0
  1093. package/templates/backend/node_modules/mongodb/src/operations/client_bulk_write/common.ts +276 -0
  1094. package/templates/backend/node_modules/mongodb/src/operations/client_bulk_write/executor.ts +149 -0
  1095. package/templates/backend/node_modules/mongodb/src/operations/client_bulk_write/results_merger.ts +260 -0
  1096. package/templates/backend/node_modules/mongodb/src/operations/command.ts +171 -0
  1097. package/templates/backend/node_modules/mongodb/src/operations/count.ts +74 -0
  1098. package/templates/backend/node_modules/mongodb/src/operations/create_collection.ts +218 -0
  1099. package/templates/backend/node_modules/mongodb/src/operations/delete.ts +183 -0
  1100. package/templates/backend/node_modules/mongodb/src/operations/distinct.ts +92 -0
  1101. package/templates/backend/node_modules/mongodb/src/operations/drop.ts +130 -0
  1102. package/templates/backend/node_modules/mongodb/src/operations/end_sessions.ts +44 -0
  1103. package/templates/backend/node_modules/mongodb/src/operations/estimated_document_count.ts +61 -0
  1104. package/templates/backend/node_modules/mongodb/src/operations/execute_operation.ts +420 -0
  1105. package/templates/backend/node_modules/mongodb/src/operations/find.ts +254 -0
  1106. package/templates/backend/node_modules/mongodb/src/operations/find_and_modify.ts +319 -0
  1107. package/templates/backend/node_modules/mongodb/src/operations/get_more.ts +108 -0
  1108. package/templates/backend/node_modules/mongodb/src/operations/indexes.ts +418 -0
  1109. package/templates/backend/node_modules/mongodb/src/operations/insert.ts +108 -0
  1110. package/templates/backend/node_modules/mongodb/src/operations/kill_cursors.ts +64 -0
  1111. package/templates/backend/node_modules/mongodb/src/operations/list_collections.ts +108 -0
  1112. package/templates/backend/node_modules/mongodb/src/operations/list_databases.ts +68 -0
  1113. package/templates/backend/node_modules/mongodb/src/operations/operation.ts +189 -0
  1114. package/templates/backend/node_modules/mongodb/src/operations/profiling_level.ts +46 -0
  1115. package/templates/backend/node_modules/mongodb/src/operations/remove_user.ts +36 -0
  1116. package/templates/backend/node_modules/mongodb/src/operations/rename.ts +60 -0
  1117. package/templates/backend/node_modules/mongodb/src/operations/run_command.ts +79 -0
  1118. package/templates/backend/node_modules/mongodb/src/operations/search_indexes/create.ts +56 -0
  1119. package/templates/backend/node_modules/mongodb/src/operations/search_indexes/drop.ts +58 -0
  1120. package/templates/backend/node_modules/mongodb/src/operations/search_indexes/update.ts +45 -0
  1121. package/templates/backend/node_modules/mongodb/src/operations/set_profiling_level.ts +74 -0
  1122. package/templates/backend/node_modules/mongodb/src/operations/stats.ts +37 -0
  1123. package/templates/backend/node_modules/mongodb/src/operations/update.ts +318 -0
  1124. package/templates/backend/node_modules/mongodb/src/operations/validate_collection.ts +50 -0
  1125. package/templates/backend/node_modules/mongodb/src/read_concern.ts +88 -0
  1126. package/templates/backend/node_modules/mongodb/src/read_preference.ts +256 -0
  1127. package/templates/backend/node_modules/mongodb/src/runtime_adapters.ts +64 -0
  1128. package/templates/backend/node_modules/mongodb/src/sdam/common.ts +74 -0
  1129. package/templates/backend/node_modules/mongodb/src/sdam/events.ts +219 -0
  1130. package/templates/backend/node_modules/mongodb/src/sdam/monitor.ts +771 -0
  1131. package/templates/backend/node_modules/mongodb/src/sdam/server.ts +595 -0
  1132. package/templates/backend/node_modules/mongodb/src/sdam/server_description.ts +297 -0
  1133. package/templates/backend/node_modules/mongodb/src/sdam/server_selection.ts +415 -0
  1134. package/templates/backend/node_modules/mongodb/src/sdam/server_selection_events.ts +142 -0
  1135. package/templates/backend/node_modules/mongodb/src/sdam/srv_polling.ts +146 -0
  1136. package/templates/backend/node_modules/mongodb/src/sdam/topology.ts +1103 -0
  1137. package/templates/backend/node_modules/mongodb/src/sdam/topology_description.ts +548 -0
  1138. package/templates/backend/node_modules/mongodb/src/sessions.ts +1288 -0
  1139. package/templates/backend/node_modules/mongodb/src/sort.ts +141 -0
  1140. package/templates/backend/node_modules/mongodb/src/timeout.ts +405 -0
  1141. package/templates/backend/node_modules/mongodb/src/transactions.ts +181 -0
  1142. package/templates/backend/node_modules/mongodb/src/utils.ts +1429 -0
  1143. package/templates/backend/node_modules/mongodb/src/write_concern.ts +183 -0
  1144. package/templates/backend/node_modules/mongodb/tsconfig.json +46 -0
  1145. package/templates/backend/node_modules/mongodb-connection-string-url/.esm-wrapper.mjs +6 -0
  1146. package/templates/backend/node_modules/mongodb-connection-string-url/LICENSE +192 -0
  1147. package/templates/backend/node_modules/mongodb-connection-string-url/README.md +25 -0
  1148. package/templates/backend/node_modules/mongodb-connection-string-url/lib/index.d.ts +63 -0
  1149. package/templates/backend/node_modules/mongodb-connection-string-url/lib/index.js +239 -0
  1150. package/templates/backend/node_modules/mongodb-connection-string-url/lib/index.js.map +1 -0
  1151. package/templates/backend/node_modules/mongodb-connection-string-url/lib/redact.d.ts +7 -0
  1152. package/templates/backend/node_modules/mongodb-connection-string-url/lib/redact.js +97 -0
  1153. package/templates/backend/node_modules/mongodb-connection-string-url/lib/redact.js.map +1 -0
  1154. package/templates/backend/node_modules/mongodb-connection-string-url/package.json +71 -0
  1155. package/templates/backend/node_modules/mongoose/LICENSE.md +22 -0
  1156. package/templates/backend/node_modules/mongoose/README.md +395 -0
  1157. package/templates/backend/node_modules/mongoose/SECURITY.md +1 -0
  1158. package/templates/backend/node_modules/mongoose/eslint.config.mjs +198 -0
  1159. package/templates/backend/node_modules/mongoose/index.js +64 -0
  1160. package/templates/backend/node_modules/mongoose/lib/aggregate.js +1226 -0
  1161. package/templates/backend/node_modules/mongoose/lib/cast/bigint.js +46 -0
  1162. package/templates/backend/node_modules/mongoose/lib/cast/boolean.js +32 -0
  1163. package/templates/backend/node_modules/mongoose/lib/cast/date.js +41 -0
  1164. package/templates/backend/node_modules/mongoose/lib/cast/decimal128.js +39 -0
  1165. package/templates/backend/node_modules/mongoose/lib/cast/double.js +50 -0
  1166. package/templates/backend/node_modules/mongoose/lib/cast/int32.js +36 -0
  1167. package/templates/backend/node_modules/mongoose/lib/cast/number.js +42 -0
  1168. package/templates/backend/node_modules/mongoose/lib/cast/objectid.js +29 -0
  1169. package/templates/backend/node_modules/mongoose/lib/cast/string.js +37 -0
  1170. package/templates/backend/node_modules/mongoose/lib/cast/uuid.js +35 -0
  1171. package/templates/backend/node_modules/mongoose/lib/cast.js +436 -0
  1172. package/templates/backend/node_modules/mongoose/lib/collection.js +321 -0
  1173. package/templates/backend/node_modules/mongoose/lib/connection.js +1853 -0
  1174. package/templates/backend/node_modules/mongoose/lib/connectionState.js +26 -0
  1175. package/templates/backend/node_modules/mongoose/lib/constants.js +73 -0
  1176. package/templates/backend/node_modules/mongoose/lib/cursor/aggregationCursor.js +466 -0
  1177. package/templates/backend/node_modules/mongoose/lib/cursor/changeStream.js +218 -0
  1178. package/templates/backend/node_modules/mongoose/lib/cursor/queryCursor.js +625 -0
  1179. package/templates/backend/node_modules/mongoose/lib/document.js +5693 -0
  1180. package/templates/backend/node_modules/mongoose/lib/driver.js +15 -0
  1181. package/templates/backend/node_modules/mongoose/lib/drivers/SPEC.md +4 -0
  1182. package/templates/backend/node_modules/mongoose/lib/drivers/node-mongodb-native/bulkWriteResult.js +5 -0
  1183. package/templates/backend/node_modules/mongoose/lib/drivers/node-mongodb-native/collection.js +426 -0
  1184. package/templates/backend/node_modules/mongoose/lib/drivers/node-mongodb-native/connection.js +519 -0
  1185. package/templates/backend/node_modules/mongoose/lib/drivers/node-mongodb-native/index.js +10 -0
  1186. package/templates/backend/node_modules/mongoose/lib/error/browserMissingSchema.js +29 -0
  1187. package/templates/backend/node_modules/mongoose/lib/error/bulkSaveIncompleteError.js +44 -0
  1188. package/templates/backend/node_modules/mongoose/lib/error/bulkWriteError.js +41 -0
  1189. package/templates/backend/node_modules/mongoose/lib/error/cast.js +167 -0
  1190. package/templates/backend/node_modules/mongoose/lib/error/createCollectionsError.js +26 -0
  1191. package/templates/backend/node_modules/mongoose/lib/error/divergentArray.js +40 -0
  1192. package/templates/backend/node_modules/mongoose/lib/error/eachAsyncMultiError.js +41 -0
  1193. package/templates/backend/node_modules/mongoose/lib/error/index.js +237 -0
  1194. package/templates/backend/node_modules/mongoose/lib/error/invalidSchemaOption.js +32 -0
  1195. package/templates/backend/node_modules/mongoose/lib/error/messages.js +48 -0
  1196. package/templates/backend/node_modules/mongoose/lib/error/missingSchema.js +33 -0
  1197. package/templates/backend/node_modules/mongoose/lib/error/mongooseError.js +13 -0
  1198. package/templates/backend/node_modules/mongoose/lib/error/notFound.js +47 -0
  1199. package/templates/backend/node_modules/mongoose/lib/error/objectExpected.js +31 -0
  1200. package/templates/backend/node_modules/mongoose/lib/error/objectParameter.js +31 -0
  1201. package/templates/backend/node_modules/mongoose/lib/error/overwriteModel.js +31 -0
  1202. package/templates/backend/node_modules/mongoose/lib/error/parallelSave.js +33 -0
  1203. package/templates/backend/node_modules/mongoose/lib/error/parallelValidate.js +33 -0
  1204. package/templates/backend/node_modules/mongoose/lib/error/serverSelection.js +62 -0
  1205. package/templates/backend/node_modules/mongoose/lib/error/setOptionError.js +103 -0
  1206. package/templates/backend/node_modules/mongoose/lib/error/strict.js +35 -0
  1207. package/templates/backend/node_modules/mongoose/lib/error/strictPopulate.js +31 -0
  1208. package/templates/backend/node_modules/mongoose/lib/error/syncIndexes.js +30 -0
  1209. package/templates/backend/node_modules/mongoose/lib/error/validation.js +97 -0
  1210. package/templates/backend/node_modules/mongoose/lib/error/validator.js +100 -0
  1211. package/templates/backend/node_modules/mongoose/lib/error/version.js +38 -0
  1212. package/templates/backend/node_modules/mongoose/lib/helpers/aggregate/prepareDiscriminatorPipeline.js +39 -0
  1213. package/templates/backend/node_modules/mongoose/lib/helpers/aggregate/stringifyFunctionOperators.js +50 -0
  1214. package/templates/backend/node_modules/mongoose/lib/helpers/arrayDepth.js +33 -0
  1215. package/templates/backend/node_modules/mongoose/lib/helpers/buildMiddlewareFilter.js +24 -0
  1216. package/templates/backend/node_modules/mongoose/lib/helpers/clone.js +236 -0
  1217. package/templates/backend/node_modules/mongoose/lib/helpers/common.js +127 -0
  1218. package/templates/backend/node_modules/mongoose/lib/helpers/cursor/eachAsync.js +225 -0
  1219. package/templates/backend/node_modules/mongoose/lib/helpers/discriminator/applyEmbeddedDiscriminators.js +36 -0
  1220. package/templates/backend/node_modules/mongoose/lib/helpers/discriminator/areDiscriminatorValuesEqual.js +16 -0
  1221. package/templates/backend/node_modules/mongoose/lib/helpers/discriminator/checkEmbeddedDiscriminatorKeyProjection.js +12 -0
  1222. package/templates/backend/node_modules/mongoose/lib/helpers/discriminator/getConstructor.js +29 -0
  1223. package/templates/backend/node_modules/mongoose/lib/helpers/discriminator/getDiscriminatorByValue.js +28 -0
  1224. package/templates/backend/node_modules/mongoose/lib/helpers/discriminator/getSchemaDiscriminatorByValue.js +27 -0
  1225. package/templates/backend/node_modules/mongoose/lib/helpers/discriminator/mergeDiscriminatorSchema.js +96 -0
  1226. package/templates/backend/node_modules/mongoose/lib/helpers/document/applyDefaults.js +132 -0
  1227. package/templates/backend/node_modules/mongoose/lib/helpers/document/applyTimestamps.js +106 -0
  1228. package/templates/backend/node_modules/mongoose/lib/helpers/document/applyVirtuals.js +147 -0
  1229. package/templates/backend/node_modules/mongoose/lib/helpers/document/cleanModifiedSubpaths.js +45 -0
  1230. package/templates/backend/node_modules/mongoose/lib/helpers/document/compile.js +241 -0
  1231. package/templates/backend/node_modules/mongoose/lib/helpers/document/getDeepestSubdocumentForPath.js +38 -0
  1232. package/templates/backend/node_modules/mongoose/lib/helpers/document/getEmbeddedDiscriminatorPath.js +53 -0
  1233. package/templates/backend/node_modules/mongoose/lib/helpers/document/handleSpreadDoc.js +35 -0
  1234. package/templates/backend/node_modules/mongoose/lib/helpers/document/isInPathsToSave.js +24 -0
  1235. package/templates/backend/node_modules/mongoose/lib/helpers/each.js +25 -0
  1236. package/templates/backend/node_modules/mongoose/lib/helpers/error/combinePathErrors.js +22 -0
  1237. package/templates/backend/node_modules/mongoose/lib/helpers/firstKey.js +8 -0
  1238. package/templates/backend/node_modules/mongoose/lib/helpers/get.js +65 -0
  1239. package/templates/backend/node_modules/mongoose/lib/helpers/getConstructorName.js +16 -0
  1240. package/templates/backend/node_modules/mongoose/lib/helpers/getDefaultBulkwriteResult.js +18 -0
  1241. package/templates/backend/node_modules/mongoose/lib/helpers/getFunctionName.js +10 -0
  1242. package/templates/backend/node_modules/mongoose/lib/helpers/immediate.js +16 -0
  1243. package/templates/backend/node_modules/mongoose/lib/helpers/indexes/applySchemaCollation.js +13 -0
  1244. package/templates/backend/node_modules/mongoose/lib/helpers/indexes/decorateDiscriminatorIndexOptions.js +14 -0
  1245. package/templates/backend/node_modules/mongoose/lib/helpers/indexes/getRelatedIndexes.js +63 -0
  1246. package/templates/backend/node_modules/mongoose/lib/helpers/indexes/isDefaultIdIndex.js +18 -0
  1247. package/templates/backend/node_modules/mongoose/lib/helpers/indexes/isIndexEqual.js +95 -0
  1248. package/templates/backend/node_modules/mongoose/lib/helpers/indexes/isIndexSpecEqual.js +32 -0
  1249. package/templates/backend/node_modules/mongoose/lib/helpers/indexes/isTextIndex.js +16 -0
  1250. package/templates/backend/node_modules/mongoose/lib/helpers/indexes/isTimeseriesIndex.js +16 -0
  1251. package/templates/backend/node_modules/mongoose/lib/helpers/isAsyncFunction.js +9 -0
  1252. package/templates/backend/node_modules/mongoose/lib/helpers/isBsonType.js +15 -0
  1253. package/templates/backend/node_modules/mongoose/lib/helpers/isMongooseObject.js +22 -0
  1254. package/templates/backend/node_modules/mongoose/lib/helpers/isObject.js +16 -0
  1255. package/templates/backend/node_modules/mongoose/lib/helpers/isPOJO.js +12 -0
  1256. package/templates/backend/node_modules/mongoose/lib/helpers/isPromise.js +6 -0
  1257. package/templates/backend/node_modules/mongoose/lib/helpers/isSimpleValidator.js +22 -0
  1258. package/templates/backend/node_modules/mongoose/lib/helpers/minimize.js +41 -0
  1259. package/templates/backend/node_modules/mongoose/lib/helpers/model/applyDefaultsToPOJO.js +52 -0
  1260. package/templates/backend/node_modules/mongoose/lib/helpers/model/applyHooks.js +151 -0
  1261. package/templates/backend/node_modules/mongoose/lib/helpers/model/applyMethods.js +70 -0
  1262. package/templates/backend/node_modules/mongoose/lib/helpers/model/applyStaticHooks.js +33 -0
  1263. package/templates/backend/node_modules/mongoose/lib/helpers/model/applyStatics.js +13 -0
  1264. package/templates/backend/node_modules/mongoose/lib/helpers/model/castBulkWrite.js +322 -0
  1265. package/templates/backend/node_modules/mongoose/lib/helpers/model/decorateBulkWriteResult.js +8 -0
  1266. package/templates/backend/node_modules/mongoose/lib/helpers/model/discriminator.js +265 -0
  1267. package/templates/backend/node_modules/mongoose/lib/helpers/model/pushNestedArrayPaths.js +15 -0
  1268. package/templates/backend/node_modules/mongoose/lib/helpers/omitUndefined.js +20 -0
  1269. package/templates/backend/node_modules/mongoose/lib/helpers/once.js +12 -0
  1270. package/templates/backend/node_modules/mongoose/lib/helpers/parallelLimit.js +37 -0
  1271. package/templates/backend/node_modules/mongoose/lib/helpers/path/parentPaths.js +18 -0
  1272. package/templates/backend/node_modules/mongoose/lib/helpers/path/setDottedPath.js +33 -0
  1273. package/templates/backend/node_modules/mongoose/lib/helpers/pluralize.js +95 -0
  1274. package/templates/backend/node_modules/mongoose/lib/helpers/populate/assignRawDocsToIdStructure.js +129 -0
  1275. package/templates/backend/node_modules/mongoose/lib/helpers/populate/assignVals.js +360 -0
  1276. package/templates/backend/node_modules/mongoose/lib/helpers/populate/createPopulateQueryFilter.js +97 -0
  1277. package/templates/backend/node_modules/mongoose/lib/helpers/populate/getModelsMapForPopulate.js +894 -0
  1278. package/templates/backend/node_modules/mongoose/lib/helpers/populate/getSchemaTypes.js +229 -0
  1279. package/templates/backend/node_modules/mongoose/lib/helpers/populate/getVirtual.js +103 -0
  1280. package/templates/backend/node_modules/mongoose/lib/helpers/populate/leanPopulateMap.js +7 -0
  1281. package/templates/backend/node_modules/mongoose/lib/helpers/populate/lookupLocalFields.js +40 -0
  1282. package/templates/backend/node_modules/mongoose/lib/helpers/populate/markArraySubdocsPopulated.js +49 -0
  1283. package/templates/backend/node_modules/mongoose/lib/helpers/populate/modelNamesFromRefPath.js +74 -0
  1284. package/templates/backend/node_modules/mongoose/lib/helpers/populate/removeDeselectedForeignField.js +31 -0
  1285. package/templates/backend/node_modules/mongoose/lib/helpers/populate/setPopulatedVirtualValue.js +33 -0
  1286. package/templates/backend/node_modules/mongoose/lib/helpers/populate/skipPopulateValue.js +10 -0
  1287. package/templates/backend/node_modules/mongoose/lib/helpers/populate/validateRef.js +19 -0
  1288. package/templates/backend/node_modules/mongoose/lib/helpers/printJestWarning.js +21 -0
  1289. package/templates/backend/node_modules/mongoose/lib/helpers/processConnectionOptions.js +65 -0
  1290. package/templates/backend/node_modules/mongoose/lib/helpers/projection/applyProjection.js +83 -0
  1291. package/templates/backend/node_modules/mongoose/lib/helpers/projection/hasIncludedChildren.js +41 -0
  1292. package/templates/backend/node_modules/mongoose/lib/helpers/projection/isDefiningProjection.js +18 -0
  1293. package/templates/backend/node_modules/mongoose/lib/helpers/projection/isExclusive.js +37 -0
  1294. package/templates/backend/node_modules/mongoose/lib/helpers/projection/isInclusive.js +39 -0
  1295. package/templates/backend/node_modules/mongoose/lib/helpers/projection/isNestedProjection.js +8 -0
  1296. package/templates/backend/node_modules/mongoose/lib/helpers/projection/isPathExcluded.js +40 -0
  1297. package/templates/backend/node_modules/mongoose/lib/helpers/projection/isPathSelectedInclusive.js +28 -0
  1298. package/templates/backend/node_modules/mongoose/lib/helpers/projection/isSubpath.js +14 -0
  1299. package/templates/backend/node_modules/mongoose/lib/helpers/projection/parseProjection.js +38 -0
  1300. package/templates/backend/node_modules/mongoose/lib/helpers/query/applyGlobalOption.js +29 -0
  1301. package/templates/backend/node_modules/mongoose/lib/helpers/query/cast$expr.js +287 -0
  1302. package/templates/backend/node_modules/mongoose/lib/helpers/query/castFilterPath.js +54 -0
  1303. package/templates/backend/node_modules/mongoose/lib/helpers/query/castUpdate.js +647 -0
  1304. package/templates/backend/node_modules/mongoose/lib/helpers/query/getEmbeddedDiscriminatorPath.js +103 -0
  1305. package/templates/backend/node_modules/mongoose/lib/helpers/query/handleImmutable.js +44 -0
  1306. package/templates/backend/node_modules/mongoose/lib/helpers/query/handleReadPreferenceAliases.js +23 -0
  1307. package/templates/backend/node_modules/mongoose/lib/helpers/query/hasDollarKeys.js +23 -0
  1308. package/templates/backend/node_modules/mongoose/lib/helpers/query/isOperator.js +14 -0
  1309. package/templates/backend/node_modules/mongoose/lib/helpers/query/sanitizeFilter.js +41 -0
  1310. package/templates/backend/node_modules/mongoose/lib/helpers/query/sanitizeProjection.js +14 -0
  1311. package/templates/backend/node_modules/mongoose/lib/helpers/query/selectPopulatedFields.js +62 -0
  1312. package/templates/backend/node_modules/mongoose/lib/helpers/query/trusted.js +13 -0
  1313. package/templates/backend/node_modules/mongoose/lib/helpers/query/validOps.js +3 -0
  1314. package/templates/backend/node_modules/mongoose/lib/helpers/schema/addAutoId.js +7 -0
  1315. package/templates/backend/node_modules/mongoose/lib/helpers/schema/applyBuiltinPlugins.js +12 -0
  1316. package/templates/backend/node_modules/mongoose/lib/helpers/schema/applyPlugins.js +55 -0
  1317. package/templates/backend/node_modules/mongoose/lib/helpers/schema/applyReadConcern.js +20 -0
  1318. package/templates/backend/node_modules/mongoose/lib/helpers/schema/applyWriteConcern.js +39 -0
  1319. package/templates/backend/node_modules/mongoose/lib/helpers/schema/cleanPositionalOperators.js +12 -0
  1320. package/templates/backend/node_modules/mongoose/lib/helpers/schema/getIndexes.js +171 -0
  1321. package/templates/backend/node_modules/mongoose/lib/helpers/schema/getKeysInSchemaOrder.js +28 -0
  1322. package/templates/backend/node_modules/mongoose/lib/helpers/schema/getPath.js +43 -0
  1323. package/templates/backend/node_modules/mongoose/lib/helpers/schema/getSubdocumentStrictValue.js +32 -0
  1324. package/templates/backend/node_modules/mongoose/lib/helpers/schema/handleIdOption.js +20 -0
  1325. package/templates/backend/node_modules/mongoose/lib/helpers/schema/handleTimestampOption.js +24 -0
  1326. package/templates/backend/node_modules/mongoose/lib/helpers/schema/idGetter.js +34 -0
  1327. package/templates/backend/node_modules/mongoose/lib/helpers/schema/merge.js +36 -0
  1328. package/templates/backend/node_modules/mongoose/lib/helpers/schematype/handleImmutable.js +50 -0
  1329. package/templates/backend/node_modules/mongoose/lib/helpers/setDefaultsOnInsert.js +174 -0
  1330. package/templates/backend/node_modules/mongoose/lib/helpers/specialProperties.js +3 -0
  1331. package/templates/backend/node_modules/mongoose/lib/helpers/symbols.js +20 -0
  1332. package/templates/backend/node_modules/mongoose/lib/helpers/timers.js +3 -0
  1333. package/templates/backend/node_modules/mongoose/lib/helpers/timestamps/setDocumentTimestamps.js +26 -0
  1334. package/templates/backend/node_modules/mongoose/lib/helpers/timestamps/setupTimestamps.js +132 -0
  1335. package/templates/backend/node_modules/mongoose/lib/helpers/topology/allServersUnknown.js +12 -0
  1336. package/templates/backend/node_modules/mongoose/lib/helpers/topology/isAtlas.js +31 -0
  1337. package/templates/backend/node_modules/mongoose/lib/helpers/topology/isSSLError.js +16 -0
  1338. package/templates/backend/node_modules/mongoose/lib/helpers/update/applyTimestampsToChildren.js +193 -0
  1339. package/templates/backend/node_modules/mongoose/lib/helpers/update/applyTimestampsToUpdate.js +131 -0
  1340. package/templates/backend/node_modules/mongoose/lib/helpers/update/castArrayFilters.js +113 -0
  1341. package/templates/backend/node_modules/mongoose/lib/helpers/update/decorateUpdateWithVersionKey.js +35 -0
  1342. package/templates/backend/node_modules/mongoose/lib/helpers/update/modifiedPaths.js +33 -0
  1343. package/templates/backend/node_modules/mongoose/lib/helpers/update/moveImmutableProperties.js +53 -0
  1344. package/templates/backend/node_modules/mongoose/lib/helpers/update/removeUnusedArrayFilters.js +37 -0
  1345. package/templates/backend/node_modules/mongoose/lib/helpers/update/updatedPathsByArrayFilter.js +27 -0
  1346. package/templates/backend/node_modules/mongoose/lib/helpers/updateValidators.js +186 -0
  1347. package/templates/backend/node_modules/mongoose/lib/index.js +17 -0
  1348. package/templates/backend/node_modules/mongoose/lib/internal.js +46 -0
  1349. package/templates/backend/node_modules/mongoose/lib/model.js +5202 -0
  1350. package/templates/backend/node_modules/mongoose/lib/modifiedPathsSnapshot.js +9 -0
  1351. package/templates/backend/node_modules/mongoose/lib/mongoose.js +1435 -0
  1352. package/templates/backend/node_modules/mongoose/lib/options/populateOptions.js +36 -0
  1353. package/templates/backend/node_modules/mongoose/lib/options/propertyOptions.js +8 -0
  1354. package/templates/backend/node_modules/mongoose/lib/options/saveOptions.js +16 -0
  1355. package/templates/backend/node_modules/mongoose/lib/options/schemaArrayOptions.js +78 -0
  1356. package/templates/backend/node_modules/mongoose/lib/options/schemaBufferOptions.js +38 -0
  1357. package/templates/backend/node_modules/mongoose/lib/options/schemaDateOptions.js +71 -0
  1358. package/templates/backend/node_modules/mongoose/lib/options/schemaDocumentArrayOptions.js +91 -0
  1359. package/templates/backend/node_modules/mongoose/lib/options/schemaMapOptions.js +43 -0
  1360. package/templates/backend/node_modules/mongoose/lib/options/schemaNumberOptions.js +101 -0
  1361. package/templates/backend/node_modules/mongoose/lib/options/schemaObjectIdOptions.js +64 -0
  1362. package/templates/backend/node_modules/mongoose/lib/options/schemaStringOptions.js +138 -0
  1363. package/templates/backend/node_modules/mongoose/lib/options/schemaSubdocumentOptions.js +89 -0
  1364. package/templates/backend/node_modules/mongoose/lib/options/schemaTypeOptions.js +258 -0
  1365. package/templates/backend/node_modules/mongoose/lib/options/schemaUnionOptions.js +32 -0
  1366. package/templates/backend/node_modules/mongoose/lib/options/virtualOptions.js +164 -0
  1367. package/templates/backend/node_modules/mongoose/lib/options.js +18 -0
  1368. package/templates/backend/node_modules/mongoose/lib/plugins/index.js +5 -0
  1369. package/templates/backend/node_modules/mongoose/lib/plugins/saveSubdocs.js +94 -0
  1370. package/templates/backend/node_modules/mongoose/lib/plugins/sharding.js +101 -0
  1371. package/templates/backend/node_modules/mongoose/lib/plugins/trackTransaction.js +89 -0
  1372. package/templates/backend/node_modules/mongoose/lib/query.js +5845 -0
  1373. package/templates/backend/node_modules/mongoose/lib/queryHelpers.js +396 -0
  1374. package/templates/backend/node_modules/mongoose/lib/schema/array.js +700 -0
  1375. package/templates/backend/node_modules/mongoose/lib/schema/bigint.js +280 -0
  1376. package/templates/backend/node_modules/mongoose/lib/schema/boolean.js +330 -0
  1377. package/templates/backend/node_modules/mongoose/lib/schema/buffer.js +341 -0
  1378. package/templates/backend/node_modules/mongoose/lib/schema/date.js +465 -0
  1379. package/templates/backend/node_modules/mongoose/lib/schema/decimal128.js +261 -0
  1380. package/templates/backend/node_modules/mongoose/lib/schema/documentArray.js +664 -0
  1381. package/templates/backend/node_modules/mongoose/lib/schema/documentArrayElement.js +136 -0
  1382. package/templates/backend/node_modules/mongoose/lib/schema/double.js +244 -0
  1383. package/templates/backend/node_modules/mongoose/lib/schema/index.js +32 -0
  1384. package/templates/backend/node_modules/mongoose/lib/schema/int32.js +287 -0
  1385. package/templates/backend/node_modules/mongoose/lib/schema/map.js +194 -0
  1386. package/templates/backend/node_modules/mongoose/lib/schema/mixed.js +146 -0
  1387. package/templates/backend/node_modules/mongoose/lib/schema/number.js +508 -0
  1388. package/templates/backend/node_modules/mongoose/lib/schema/objectId.js +331 -0
  1389. package/templates/backend/node_modules/mongoose/lib/schema/operators/bitwise.js +38 -0
  1390. package/templates/backend/node_modules/mongoose/lib/schema/operators/exists.js +12 -0
  1391. package/templates/backend/node_modules/mongoose/lib/schema/operators/geospatial.js +107 -0
  1392. package/templates/backend/node_modules/mongoose/lib/schema/operators/helpers.js +32 -0
  1393. package/templates/backend/node_modules/mongoose/lib/schema/operators/text.js +39 -0
  1394. package/templates/backend/node_modules/mongoose/lib/schema/operators/type.js +20 -0
  1395. package/templates/backend/node_modules/mongoose/lib/schema/string.js +731 -0
  1396. package/templates/backend/node_modules/mongoose/lib/schema/subdocument.js +434 -0
  1397. package/templates/backend/node_modules/mongoose/lib/schema/symbols.js +5 -0
  1398. package/templates/backend/node_modules/mongoose/lib/schema/union.js +163 -0
  1399. package/templates/backend/node_modules/mongoose/lib/schema/uuid.js +303 -0
  1400. package/templates/backend/node_modules/mongoose/lib/schema.js +3244 -0
  1401. package/templates/backend/node_modules/mongoose/lib/schemaType.js +1928 -0
  1402. package/templates/backend/node_modules/mongoose/lib/stateMachine.js +229 -0
  1403. package/templates/backend/node_modules/mongoose/lib/types/array/index.js +119 -0
  1404. package/templates/backend/node_modules/mongoose/lib/types/array/isMongooseArray.js +5 -0
  1405. package/templates/backend/node_modules/mongoose/lib/types/array/methods/index.js +1095 -0
  1406. package/templates/backend/node_modules/mongoose/lib/types/arraySubdocument.js +208 -0
  1407. package/templates/backend/node_modules/mongoose/lib/types/buffer.js +294 -0
  1408. package/templates/backend/node_modules/mongoose/lib/types/decimal128.js +13 -0
  1409. package/templates/backend/node_modules/mongoose/lib/types/documentArray/index.js +113 -0
  1410. package/templates/backend/node_modules/mongoose/lib/types/documentArray/isMongooseDocumentArray.js +5 -0
  1411. package/templates/backend/node_modules/mongoose/lib/types/documentArray/methods/index.js +415 -0
  1412. package/templates/backend/node_modules/mongoose/lib/types/double.js +13 -0
  1413. package/templates/backend/node_modules/mongoose/lib/types/index.js +23 -0
  1414. package/templates/backend/node_modules/mongoose/lib/types/map.js +368 -0
  1415. package/templates/backend/node_modules/mongoose/lib/types/objectid.js +41 -0
  1416. package/templates/backend/node_modules/mongoose/lib/types/subdocument.js +443 -0
  1417. package/templates/backend/node_modules/mongoose/lib/types/uuid.js +13 -0
  1418. package/templates/backend/node_modules/mongoose/lib/utils.js +1064 -0
  1419. package/templates/backend/node_modules/mongoose/lib/validOptions.js +43 -0
  1420. package/templates/backend/node_modules/mongoose/lib/virtualType.js +204 -0
  1421. package/templates/backend/node_modules/mongoose/package.json +139 -0
  1422. package/templates/backend/node_modules/mongoose/tstyche.json +7 -0
  1423. package/templates/backend/node_modules/mongoose/types/aggregate.d.ts +185 -0
  1424. package/templates/backend/node_modules/mongoose/types/augmentations.d.ts +9 -0
  1425. package/templates/backend/node_modules/mongoose/types/callback.d.ts +8 -0
  1426. package/templates/backend/node_modules/mongoose/types/collection.d.ts +49 -0
  1427. package/templates/backend/node_modules/mongoose/types/connection.d.ts +297 -0
  1428. package/templates/backend/node_modules/mongoose/types/cursor.d.ts +67 -0
  1429. package/templates/backend/node_modules/mongoose/types/document.d.ts +328 -0
  1430. package/templates/backend/node_modules/mongoose/types/error.d.ts +143 -0
  1431. package/templates/backend/node_modules/mongoose/types/expressions.d.ts +3053 -0
  1432. package/templates/backend/node_modules/mongoose/types/helpers.d.ts +32 -0
  1433. package/templates/backend/node_modules/mongoose/types/index.d.ts +1161 -0
  1434. package/templates/backend/node_modules/mongoose/types/indexes.d.ts +97 -0
  1435. package/templates/backend/node_modules/mongoose/types/inferhydrateddoctype.d.ts +135 -0
  1436. package/templates/backend/node_modules/mongoose/types/inferrawdoctype.d.ts +185 -0
  1437. package/templates/backend/node_modules/mongoose/types/inferschematype.d.ts +387 -0
  1438. package/templates/backend/node_modules/mongoose/types/middlewares.d.ts +66 -0
  1439. package/templates/backend/node_modules/mongoose/types/models.d.ts +1265 -0
  1440. package/templates/backend/node_modules/mongoose/types/mongooseoptions.d.ts +232 -0
  1441. package/templates/backend/node_modules/mongoose/types/pipelinestage.d.ts +334 -0
  1442. package/templates/backend/node_modules/mongoose/types/populate.d.ts +97 -0
  1443. package/templates/backend/node_modules/mongoose/types/query.d.ts +982 -0
  1444. package/templates/backend/node_modules/mongoose/types/schemaoptions.d.ts +284 -0
  1445. package/templates/backend/node_modules/mongoose/types/schematypes.d.ts +667 -0
  1446. package/templates/backend/node_modules/mongoose/types/session.d.ts +32 -0
  1447. package/templates/backend/node_modules/mongoose/types/types.d.ts +109 -0
  1448. package/templates/backend/node_modules/mongoose/types/utility.d.ts +175 -0
  1449. package/templates/backend/node_modules/mongoose/types/validation.d.ts +39 -0
  1450. package/templates/backend/node_modules/mongoose/types/virtuals.d.ts +14 -0
  1451. package/templates/backend/node_modules/mpath/.travis.yml +9 -0
  1452. package/templates/backend/node_modules/mpath/History.md +88 -0
  1453. package/templates/backend/node_modules/mpath/LICENSE +22 -0
  1454. package/templates/backend/node_modules/mpath/README.md +278 -0
  1455. package/templates/backend/node_modules/mpath/SECURITY.md +5 -0
  1456. package/templates/backend/node_modules/mpath/index.js +3 -0
  1457. package/templates/backend/node_modules/mpath/lib/index.js +336 -0
  1458. package/templates/backend/node_modules/mpath/lib/stringToParts.js +48 -0
  1459. package/templates/backend/node_modules/mpath/package.json +144 -0
  1460. package/templates/backend/node_modules/mpath/test/.eslintrc.yml +4 -0
  1461. package/templates/backend/node_modules/mpath/test/index.js +1879 -0
  1462. package/templates/backend/node_modules/mpath/test/stringToParts.js +30 -0
  1463. package/templates/backend/node_modules/mquery/.github/ISSUE_TEMPLATE.md +11 -0
  1464. package/templates/backend/node_modules/mquery/.github/PULL_REQUEST_TEMPLATE.md +9 -0
  1465. package/templates/backend/node_modules/mquery/History.md +393 -0
  1466. package/templates/backend/node_modules/mquery/LICENSE +22 -0
  1467. package/templates/backend/node_modules/mquery/README.md +1387 -0
  1468. package/templates/backend/node_modules/mquery/SECURITY.md +1 -0
  1469. package/templates/backend/node_modules/mquery/lib/collection/collection.js +47 -0
  1470. package/templates/backend/node_modules/mquery/lib/collection/index.js +13 -0
  1471. package/templates/backend/node_modules/mquery/lib/collection/node.js +128 -0
  1472. package/templates/backend/node_modules/mquery/lib/env.js +22 -0
  1473. package/templates/backend/node_modules/mquery/lib/mquery.js +2748 -0
  1474. package/templates/backend/node_modules/mquery/lib/permissions.js +93 -0
  1475. package/templates/backend/node_modules/mquery/lib/utils.js +297 -0
  1476. package/templates/backend/node_modules/mquery/package.json +35 -0
  1477. package/templates/backend/node_modules/ms/index.js +162 -0
  1478. package/templates/backend/node_modules/ms/license.md +21 -0
  1479. package/templates/backend/node_modules/ms/package.json +38 -0
  1480. package/templates/backend/node_modules/ms/readme.md +59 -0
  1481. package/templates/backend/node_modules/negotiator/HISTORY.md +114 -0
  1482. package/templates/backend/node_modules/negotiator/LICENSE +24 -0
  1483. package/templates/backend/node_modules/negotiator/README.md +212 -0
  1484. package/templates/backend/node_modules/negotiator/index.js +83 -0
  1485. package/templates/backend/node_modules/negotiator/lib/charset.js +169 -0
  1486. package/templates/backend/node_modules/negotiator/lib/encoding.js +205 -0
  1487. package/templates/backend/node_modules/negotiator/lib/language.js +179 -0
  1488. package/templates/backend/node_modules/negotiator/lib/mediaType.js +294 -0
  1489. package/templates/backend/node_modules/negotiator/package.json +43 -0
  1490. package/templates/backend/node_modules/nodemon/.prettierrc.json +3 -0
  1491. package/templates/backend/node_modules/nodemon/LICENSE +21 -0
  1492. package/templates/backend/node_modules/nodemon/README.md +439 -0
  1493. package/templates/backend/node_modules/nodemon/bin/nodemon.js +16 -0
  1494. package/templates/backend/node_modules/nodemon/bin/windows-kill.exe +0 -0
  1495. package/templates/backend/node_modules/nodemon/doc/cli/authors.txt +8 -0
  1496. package/templates/backend/node_modules/nodemon/doc/cli/config.txt +44 -0
  1497. package/templates/backend/node_modules/nodemon/doc/cli/help.txt +29 -0
  1498. package/templates/backend/node_modules/nodemon/doc/cli/logo.txt +20 -0
  1499. package/templates/backend/node_modules/nodemon/doc/cli/options.txt +36 -0
  1500. package/templates/backend/node_modules/nodemon/doc/cli/topics.txt +8 -0
  1501. package/templates/backend/node_modules/nodemon/doc/cli/usage.txt +3 -0
  1502. package/templates/backend/node_modules/nodemon/doc/cli/whoami.txt +9 -0
  1503. package/templates/backend/node_modules/nodemon/index.d.ts +124 -0
  1504. package/templates/backend/node_modules/nodemon/jsconfig.json +7 -0
  1505. package/templates/backend/node_modules/nodemon/lib/cli/index.js +49 -0
  1506. package/templates/backend/node_modules/nodemon/lib/cli/parse.js +230 -0
  1507. package/templates/backend/node_modules/nodemon/lib/config/command.js +43 -0
  1508. package/templates/backend/node_modules/nodemon/lib/config/defaults.js +34 -0
  1509. package/templates/backend/node_modules/nodemon/lib/config/exec.js +240 -0
  1510. package/templates/backend/node_modules/nodemon/lib/config/index.js +93 -0
  1511. package/templates/backend/node_modules/nodemon/lib/config/load.js +225 -0
  1512. package/templates/backend/node_modules/nodemon/lib/help/index.js +27 -0
  1513. package/templates/backend/node_modules/nodemon/lib/index.js +1 -0
  1514. package/templates/backend/node_modules/nodemon/lib/monitor/index.js +4 -0
  1515. package/templates/backend/node_modules/nodemon/lib/monitor/match.js +288 -0
  1516. package/templates/backend/node_modules/nodemon/lib/monitor/run.js +562 -0
  1517. package/templates/backend/node_modules/nodemon/lib/monitor/signals.js +34 -0
  1518. package/templates/backend/node_modules/nodemon/lib/monitor/watch.js +244 -0
  1519. package/templates/backend/node_modules/nodemon/lib/nodemon.js +317 -0
  1520. package/templates/backend/node_modules/nodemon/lib/rules/add.js +89 -0
  1521. package/templates/backend/node_modules/nodemon/lib/rules/index.js +53 -0
  1522. package/templates/backend/node_modules/nodemon/lib/rules/parse.js +43 -0
  1523. package/templates/backend/node_modules/nodemon/lib/spawn.js +74 -0
  1524. package/templates/backend/node_modules/nodemon/lib/utils/bus.js +44 -0
  1525. package/templates/backend/node_modules/nodemon/lib/utils/clone.js +40 -0
  1526. package/templates/backend/node_modules/nodemon/lib/utils/colour.js +26 -0
  1527. package/templates/backend/node_modules/nodemon/lib/utils/index.js +103 -0
  1528. package/templates/backend/node_modules/nodemon/lib/utils/log.js +82 -0
  1529. package/templates/backend/node_modules/nodemon/lib/utils/merge.js +47 -0
  1530. package/templates/backend/node_modules/nodemon/lib/version.js +100 -0
  1531. package/templates/backend/node_modules/nodemon/package.json +78 -0
  1532. package/templates/backend/node_modules/normalize-path/LICENSE +21 -0
  1533. package/templates/backend/node_modules/normalize-path/README.md +127 -0
  1534. package/templates/backend/node_modules/normalize-path/index.js +35 -0
  1535. package/templates/backend/node_modules/normalize-path/package.json +77 -0
  1536. package/templates/backend/node_modules/object-assign/index.js +90 -0
  1537. package/templates/backend/node_modules/object-assign/license +21 -0
  1538. package/templates/backend/node_modules/object-assign/package.json +42 -0
  1539. package/templates/backend/node_modules/object-assign/readme.md +61 -0
  1540. package/templates/backend/node_modules/object-inspect/.eslintrc +53 -0
  1541. package/templates/backend/node_modules/object-inspect/.github/FUNDING.yml +12 -0
  1542. package/templates/backend/node_modules/object-inspect/.nycrc +13 -0
  1543. package/templates/backend/node_modules/object-inspect/CHANGELOG.md +424 -0
  1544. package/templates/backend/node_modules/object-inspect/LICENSE +21 -0
  1545. package/templates/backend/node_modules/object-inspect/example/all.js +23 -0
  1546. package/templates/backend/node_modules/object-inspect/example/circular.js +6 -0
  1547. package/templates/backend/node_modules/object-inspect/example/fn.js +5 -0
  1548. package/templates/backend/node_modules/object-inspect/example/inspect.js +10 -0
  1549. package/templates/backend/node_modules/object-inspect/index.js +544 -0
  1550. package/templates/backend/node_modules/object-inspect/package-support.json +20 -0
  1551. package/templates/backend/node_modules/object-inspect/package.json +105 -0
  1552. package/templates/backend/node_modules/object-inspect/readme.markdown +84 -0
  1553. package/templates/backend/node_modules/object-inspect/test/bigint.js +58 -0
  1554. package/templates/backend/node_modules/object-inspect/test/browser/dom.js +15 -0
  1555. package/templates/backend/node_modules/object-inspect/test/circular.js +16 -0
  1556. package/templates/backend/node_modules/object-inspect/test/deep.js +12 -0
  1557. package/templates/backend/node_modules/object-inspect/test/element.js +53 -0
  1558. package/templates/backend/node_modules/object-inspect/test/err.js +48 -0
  1559. package/templates/backend/node_modules/object-inspect/test/fakes.js +29 -0
  1560. package/templates/backend/node_modules/object-inspect/test/fn.js +76 -0
  1561. package/templates/backend/node_modules/object-inspect/test/global.js +17 -0
  1562. package/templates/backend/node_modules/object-inspect/test/has.js +15 -0
  1563. package/templates/backend/node_modules/object-inspect/test/holes.js +15 -0
  1564. package/templates/backend/node_modules/object-inspect/test/indent-option.js +271 -0
  1565. package/templates/backend/node_modules/object-inspect/test/inspect.js +139 -0
  1566. package/templates/backend/node_modules/object-inspect/test/lowbyte.js +12 -0
  1567. package/templates/backend/node_modules/object-inspect/test/number.js +58 -0
  1568. package/templates/backend/node_modules/object-inspect/test/quoteStyle.js +26 -0
  1569. package/templates/backend/node_modules/object-inspect/test/toStringTag.js +40 -0
  1570. package/templates/backend/node_modules/object-inspect/test/undef.js +12 -0
  1571. package/templates/backend/node_modules/object-inspect/test/values.js +261 -0
  1572. package/templates/backend/node_modules/object-inspect/test-core-js.js +26 -0
  1573. package/templates/backend/node_modules/object-inspect/util.inspect.js +1 -0
  1574. package/templates/backend/node_modules/on-finished/HISTORY.md +98 -0
  1575. package/templates/backend/node_modules/on-finished/LICENSE +23 -0
  1576. package/templates/backend/node_modules/on-finished/README.md +162 -0
  1577. package/templates/backend/node_modules/on-finished/index.js +234 -0
  1578. package/templates/backend/node_modules/on-finished/package.json +39 -0
  1579. package/templates/backend/node_modules/once/LICENSE +15 -0
  1580. package/templates/backend/node_modules/once/README.md +79 -0
  1581. package/templates/backend/node_modules/once/once.js +42 -0
  1582. package/templates/backend/node_modules/once/package.json +33 -0
  1583. package/templates/backend/node_modules/parseurl/HISTORY.md +58 -0
  1584. package/templates/backend/node_modules/parseurl/LICENSE +24 -0
  1585. package/templates/backend/node_modules/parseurl/README.md +133 -0
  1586. package/templates/backend/node_modules/parseurl/index.js +158 -0
  1587. package/templates/backend/node_modules/parseurl/package.json +40 -0
  1588. package/templates/backend/node_modules/path-to-regexp/LICENSE +21 -0
  1589. package/templates/backend/node_modules/path-to-regexp/Readme.md +224 -0
  1590. package/templates/backend/node_modules/path-to-regexp/dist/index.d.ts +147 -0
  1591. package/templates/backend/node_modules/path-to-regexp/dist/index.js +431 -0
  1592. package/templates/backend/node_modules/path-to-regexp/dist/index.js.map +1 -0
  1593. package/templates/backend/node_modules/path-to-regexp/package.json +64 -0
  1594. package/templates/backend/node_modules/picomatch/LICENSE +21 -0
  1595. package/templates/backend/node_modules/picomatch/README.md +716 -0
  1596. package/templates/backend/node_modules/picomatch/index.js +3 -0
  1597. package/templates/backend/node_modules/picomatch/lib/constants.js +184 -0
  1598. package/templates/backend/node_modules/picomatch/lib/parse.js +1392 -0
  1599. package/templates/backend/node_modules/picomatch/lib/picomatch.js +342 -0
  1600. package/templates/backend/node_modules/picomatch/lib/scan.js +391 -0
  1601. package/templates/backend/node_modules/picomatch/lib/utils.js +64 -0
  1602. package/templates/backend/node_modules/picomatch/package.json +81 -0
  1603. package/templates/backend/node_modules/proxy-addr/HISTORY.md +161 -0
  1604. package/templates/backend/node_modules/proxy-addr/LICENSE +22 -0
  1605. package/templates/backend/node_modules/proxy-addr/README.md +139 -0
  1606. package/templates/backend/node_modules/proxy-addr/index.js +327 -0
  1607. package/templates/backend/node_modules/proxy-addr/package.json +47 -0
  1608. package/templates/backend/node_modules/pstree.remy/.travis.yml +8 -0
  1609. package/templates/backend/node_modules/pstree.remy/LICENSE +7 -0
  1610. package/templates/backend/node_modules/pstree.remy/README.md +26 -0
  1611. package/templates/backend/node_modules/pstree.remy/lib/index.js +37 -0
  1612. package/templates/backend/node_modules/pstree.remy/lib/tree.js +37 -0
  1613. package/templates/backend/node_modules/pstree.remy/lib/utils.js +53 -0
  1614. package/templates/backend/node_modules/pstree.remy/package.json +33 -0
  1615. package/templates/backend/node_modules/pstree.remy/tests/fixtures/index.js +13 -0
  1616. package/templates/backend/node_modules/pstree.remy/tests/fixtures/out1 +10 -0
  1617. package/templates/backend/node_modules/pstree.remy/tests/fixtures/out2 +29 -0
  1618. package/templates/backend/node_modules/pstree.remy/tests/index.test.js +51 -0
  1619. package/templates/backend/node_modules/punycode/LICENSE-MIT.txt +20 -0
  1620. package/templates/backend/node_modules/punycode/README.md +148 -0
  1621. package/templates/backend/node_modules/punycode/package.json +58 -0
  1622. package/templates/backend/node_modules/punycode/punycode.es6.js +444 -0
  1623. package/templates/backend/node_modules/punycode/punycode.js +443 -0
  1624. package/templates/backend/node_modules/qs/.editorconfig +46 -0
  1625. package/templates/backend/node_modules/qs/.github/FUNDING.yml +12 -0
  1626. package/templates/backend/node_modules/qs/.github/SECURITY.md +11 -0
  1627. package/templates/backend/node_modules/qs/.github/THREAT_MODEL.md +78 -0
  1628. package/templates/backend/node_modules/qs/.nycrc +13 -0
  1629. package/templates/backend/node_modules/qs/CHANGELOG.md +822 -0
  1630. package/templates/backend/node_modules/qs/LICENSE.md +29 -0
  1631. package/templates/backend/node_modules/qs/README.md +758 -0
  1632. package/templates/backend/node_modules/qs/dist/qs.js +141 -0
  1633. package/templates/backend/node_modules/qs/eslint.config.mjs +57 -0
  1634. package/templates/backend/node_modules/qs/lib/formats.js +23 -0
  1635. package/templates/backend/node_modules/qs/lib/index.js +11 -0
  1636. package/templates/backend/node_modules/qs/lib/parse.js +403 -0
  1637. package/templates/backend/node_modules/qs/lib/stringify.js +363 -0
  1638. package/templates/backend/node_modules/qs/lib/utils.js +342 -0
  1639. package/templates/backend/node_modules/qs/package.json +94 -0
  1640. package/templates/backend/node_modules/qs/test/empty-keys-cases.js +267 -0
  1641. package/templates/backend/node_modules/qs/test/parse.js +1703 -0
  1642. package/templates/backend/node_modules/qs/test/stringify.js +1448 -0
  1643. package/templates/backend/node_modules/qs/test/utils.js +432 -0
  1644. package/templates/backend/node_modules/range-parser/HISTORY.md +56 -0
  1645. package/templates/backend/node_modules/range-parser/LICENSE +23 -0
  1646. package/templates/backend/node_modules/range-parser/README.md +84 -0
  1647. package/templates/backend/node_modules/range-parser/index.js +162 -0
  1648. package/templates/backend/node_modules/range-parser/package.json +44 -0
  1649. package/templates/backend/node_modules/raw-body/LICENSE +22 -0
  1650. package/templates/backend/node_modules/raw-body/README.md +223 -0
  1651. package/templates/backend/node_modules/raw-body/index.d.ts +85 -0
  1652. package/templates/backend/node_modules/raw-body/index.js +336 -0
  1653. package/templates/backend/node_modules/raw-body/package.json +46 -0
  1654. package/templates/backend/node_modules/readdirp/LICENSE +21 -0
  1655. package/templates/backend/node_modules/readdirp/README.md +122 -0
  1656. package/templates/backend/node_modules/readdirp/index.d.ts +43 -0
  1657. package/templates/backend/node_modules/readdirp/index.js +287 -0
  1658. package/templates/backend/node_modules/readdirp/package.json +122 -0
  1659. package/templates/backend/node_modules/router/HISTORY.md +228 -0
  1660. package/templates/backend/node_modules/router/LICENSE +23 -0
  1661. package/templates/backend/node_modules/router/README.md +416 -0
  1662. package/templates/backend/node_modules/router/index.js +748 -0
  1663. package/templates/backend/node_modules/router/lib/layer.js +247 -0
  1664. package/templates/backend/node_modules/router/lib/route.js +242 -0
  1665. package/templates/backend/node_modules/router/package.json +44 -0
  1666. package/templates/backend/node_modules/safe-buffer/LICENSE +21 -0
  1667. package/templates/backend/node_modules/safe-buffer/README.md +584 -0
  1668. package/templates/backend/node_modules/safe-buffer/index.d.ts +187 -0
  1669. package/templates/backend/node_modules/safe-buffer/index.js +65 -0
  1670. package/templates/backend/node_modules/safe-buffer/package.json +51 -0
  1671. package/templates/backend/node_modules/safer-buffer/LICENSE +21 -0
  1672. package/templates/backend/node_modules/safer-buffer/Porting-Buffer.md +268 -0
  1673. package/templates/backend/node_modules/safer-buffer/Readme.md +156 -0
  1674. package/templates/backend/node_modules/safer-buffer/dangerous.js +58 -0
  1675. package/templates/backend/node_modules/safer-buffer/package.json +34 -0
  1676. package/templates/backend/node_modules/safer-buffer/safer.js +77 -0
  1677. package/templates/backend/node_modules/safer-buffer/tests.js +406 -0
  1678. package/templates/backend/node_modules/semver/LICENSE +15 -0
  1679. package/templates/backend/node_modules/semver/README.md +680 -0
  1680. package/templates/backend/node_modules/semver/bin/semver.js +195 -0
  1681. package/templates/backend/node_modules/semver/classes/comparator.js +143 -0
  1682. package/templates/backend/node_modules/semver/classes/index.js +7 -0
  1683. package/templates/backend/node_modules/semver/classes/range.js +557 -0
  1684. package/templates/backend/node_modules/semver/classes/semver.js +333 -0
  1685. package/templates/backend/node_modules/semver/functions/clean.js +8 -0
  1686. package/templates/backend/node_modules/semver/functions/cmp.js +54 -0
  1687. package/templates/backend/node_modules/semver/functions/coerce.js +62 -0
  1688. package/templates/backend/node_modules/semver/functions/compare-build.js +9 -0
  1689. package/templates/backend/node_modules/semver/functions/compare-loose.js +5 -0
  1690. package/templates/backend/node_modules/semver/functions/compare.js +7 -0
  1691. package/templates/backend/node_modules/semver/functions/diff.js +60 -0
  1692. package/templates/backend/node_modules/semver/functions/eq.js +5 -0
  1693. package/templates/backend/node_modules/semver/functions/gt.js +5 -0
  1694. package/templates/backend/node_modules/semver/functions/gte.js +5 -0
  1695. package/templates/backend/node_modules/semver/functions/inc.js +21 -0
  1696. package/templates/backend/node_modules/semver/functions/lt.js +5 -0
  1697. package/templates/backend/node_modules/semver/functions/lte.js +5 -0
  1698. package/templates/backend/node_modules/semver/functions/major.js +5 -0
  1699. package/templates/backend/node_modules/semver/functions/minor.js +5 -0
  1700. package/templates/backend/node_modules/semver/functions/neq.js +5 -0
  1701. package/templates/backend/node_modules/semver/functions/parse.js +18 -0
  1702. package/templates/backend/node_modules/semver/functions/patch.js +5 -0
  1703. package/templates/backend/node_modules/semver/functions/prerelease.js +8 -0
  1704. package/templates/backend/node_modules/semver/functions/rcompare.js +5 -0
  1705. package/templates/backend/node_modules/semver/functions/rsort.js +5 -0
  1706. package/templates/backend/node_modules/semver/functions/satisfies.js +12 -0
  1707. package/templates/backend/node_modules/semver/functions/sort.js +5 -0
  1708. package/templates/backend/node_modules/semver/functions/truncate.js +48 -0
  1709. package/templates/backend/node_modules/semver/functions/valid.js +8 -0
  1710. package/templates/backend/node_modules/semver/index.js +93 -0
  1711. package/templates/backend/node_modules/semver/internal/constants.js +37 -0
  1712. package/templates/backend/node_modules/semver/internal/debug.js +11 -0
  1713. package/templates/backend/node_modules/semver/internal/identifiers.js +29 -0
  1714. package/templates/backend/node_modules/semver/internal/lrucache.js +42 -0
  1715. package/templates/backend/node_modules/semver/internal/parse-options.js +17 -0
  1716. package/templates/backend/node_modules/semver/internal/re.js +223 -0
  1717. package/templates/backend/node_modules/semver/package.json +78 -0
  1718. package/templates/backend/node_modules/semver/preload.js +4 -0
  1719. package/templates/backend/node_modules/semver/range.bnf +17 -0
  1720. package/templates/backend/node_modules/semver/ranges/gtr.js +6 -0
  1721. package/templates/backend/node_modules/semver/ranges/intersects.js +9 -0
  1722. package/templates/backend/node_modules/semver/ranges/ltr.js +6 -0
  1723. package/templates/backend/node_modules/semver/ranges/max-satisfying.js +27 -0
  1724. package/templates/backend/node_modules/semver/ranges/min-satisfying.js +26 -0
  1725. package/templates/backend/node_modules/semver/ranges/min-version.js +63 -0
  1726. package/templates/backend/node_modules/semver/ranges/outside.js +82 -0
  1727. package/templates/backend/node_modules/semver/ranges/simplify.js +49 -0
  1728. package/templates/backend/node_modules/semver/ranges/subset.js +249 -0
  1729. package/templates/backend/node_modules/semver/ranges/to-comparators.js +10 -0
  1730. package/templates/backend/node_modules/semver/ranges/valid.js +13 -0
  1731. package/templates/backend/node_modules/send/LICENSE +23 -0
  1732. package/templates/backend/node_modules/send/README.md +317 -0
  1733. package/templates/backend/node_modules/send/index.js +997 -0
  1734. package/templates/backend/node_modules/send/package.json +63 -0
  1735. package/templates/backend/node_modules/serve-static/LICENSE +25 -0
  1736. package/templates/backend/node_modules/serve-static/README.md +253 -0
  1737. package/templates/backend/node_modules/serve-static/index.js +208 -0
  1738. package/templates/backend/node_modules/serve-static/package.json +44 -0
  1739. package/templates/backend/node_modules/setprototypeof/LICENSE +13 -0
  1740. package/templates/backend/node_modules/setprototypeof/README.md +31 -0
  1741. package/templates/backend/node_modules/setprototypeof/index.d.ts +2 -0
  1742. package/templates/backend/node_modules/setprototypeof/index.js +17 -0
  1743. package/templates/backend/node_modules/setprototypeof/package.json +38 -0
  1744. package/templates/backend/node_modules/setprototypeof/test/index.js +24 -0
  1745. package/templates/backend/node_modules/side-channel/.editorconfig +9 -0
  1746. package/templates/backend/node_modules/side-channel/.eslintrc +12 -0
  1747. package/templates/backend/node_modules/side-channel/.github/FUNDING.yml +12 -0
  1748. package/templates/backend/node_modules/side-channel/.nycrc +13 -0
  1749. package/templates/backend/node_modules/side-channel/CHANGELOG.md +110 -0
  1750. package/templates/backend/node_modules/side-channel/LICENSE +21 -0
  1751. package/templates/backend/node_modules/side-channel/README.md +61 -0
  1752. package/templates/backend/node_modules/side-channel/index.d.ts +14 -0
  1753. package/templates/backend/node_modules/side-channel/index.js +43 -0
  1754. package/templates/backend/node_modules/side-channel/package.json +85 -0
  1755. package/templates/backend/node_modules/side-channel/test/index.js +104 -0
  1756. package/templates/backend/node_modules/side-channel/tsconfig.json +9 -0
  1757. package/templates/backend/node_modules/side-channel-list/.editorconfig +9 -0
  1758. package/templates/backend/node_modules/side-channel-list/.eslintrc +11 -0
  1759. package/templates/backend/node_modules/side-channel-list/.github/FUNDING.yml +12 -0
  1760. package/templates/backend/node_modules/side-channel-list/.nycrc +13 -0
  1761. package/templates/backend/node_modules/side-channel-list/CHANGELOG.md +36 -0
  1762. package/templates/backend/node_modules/side-channel-list/LICENSE +21 -0
  1763. package/templates/backend/node_modules/side-channel-list/README.md +62 -0
  1764. package/templates/backend/node_modules/side-channel-list/index.d.ts +13 -0
  1765. package/templates/backend/node_modules/side-channel-list/index.js +111 -0
  1766. package/templates/backend/node_modules/side-channel-list/list.d.ts +14 -0
  1767. package/templates/backend/node_modules/side-channel-list/package.json +77 -0
  1768. package/templates/backend/node_modules/side-channel-list/test/index.js +154 -0
  1769. package/templates/backend/node_modules/side-channel-list/tsconfig.json +9 -0
  1770. package/templates/backend/node_modules/side-channel-map/.editorconfig +9 -0
  1771. package/templates/backend/node_modules/side-channel-map/.eslintrc +11 -0
  1772. package/templates/backend/node_modules/side-channel-map/.github/FUNDING.yml +12 -0
  1773. package/templates/backend/node_modules/side-channel-map/.nycrc +13 -0
  1774. package/templates/backend/node_modules/side-channel-map/CHANGELOG.md +22 -0
  1775. package/templates/backend/node_modules/side-channel-map/LICENSE +21 -0
  1776. package/templates/backend/node_modules/side-channel-map/README.md +62 -0
  1777. package/templates/backend/node_modules/side-channel-map/index.d.ts +15 -0
  1778. package/templates/backend/node_modules/side-channel-map/index.js +68 -0
  1779. package/templates/backend/node_modules/side-channel-map/package.json +80 -0
  1780. package/templates/backend/node_modules/side-channel-map/test/index.js +114 -0
  1781. package/templates/backend/node_modules/side-channel-map/tsconfig.json +9 -0
  1782. package/templates/backend/node_modules/side-channel-weakmap/.editorconfig +9 -0
  1783. package/templates/backend/node_modules/side-channel-weakmap/.eslintrc +12 -0
  1784. package/templates/backend/node_modules/side-channel-weakmap/.github/FUNDING.yml +12 -0
  1785. package/templates/backend/node_modules/side-channel-weakmap/.nycrc +13 -0
  1786. package/templates/backend/node_modules/side-channel-weakmap/CHANGELOG.md +28 -0
  1787. package/templates/backend/node_modules/side-channel-weakmap/LICENSE +21 -0
  1788. package/templates/backend/node_modules/side-channel-weakmap/README.md +62 -0
  1789. package/templates/backend/node_modules/side-channel-weakmap/index.d.ts +15 -0
  1790. package/templates/backend/node_modules/side-channel-weakmap/index.js +84 -0
  1791. package/templates/backend/node_modules/side-channel-weakmap/package.json +87 -0
  1792. package/templates/backend/node_modules/side-channel-weakmap/test/index.js +114 -0
  1793. package/templates/backend/node_modules/side-channel-weakmap/tsconfig.json +9 -0
  1794. package/templates/backend/node_modules/sift/MIT-LICENSE.txt +20 -0
  1795. package/templates/backend/node_modules/sift/README.md +465 -0
  1796. package/templates/backend/node_modules/sift/es/index.js +632 -0
  1797. package/templates/backend/node_modules/sift/es/index.js.map +1 -0
  1798. package/templates/backend/node_modules/sift/es5m/index.js +743 -0
  1799. package/templates/backend/node_modules/sift/es5m/index.js.map +1 -0
  1800. package/templates/backend/node_modules/sift/index.d.ts +4 -0
  1801. package/templates/backend/node_modules/sift/index.js +4 -0
  1802. package/templates/backend/node_modules/sift/lib/core.d.ts +116 -0
  1803. package/templates/backend/node_modules/sift/lib/index.d.ts +6 -0
  1804. package/templates/backend/node_modules/sift/lib/index.js +781 -0
  1805. package/templates/backend/node_modules/sift/lib/index.js.map +1 -0
  1806. package/templates/backend/node_modules/sift/lib/operations.d.ts +88 -0
  1807. package/templates/backend/node_modules/sift/lib/utils.d.ts +11 -0
  1808. package/templates/backend/node_modules/sift/package.json +61 -0
  1809. package/templates/backend/node_modules/sift/sift.csp.min.js +778 -0
  1810. package/templates/backend/node_modules/sift/sift.csp.min.js.map +1 -0
  1811. package/templates/backend/node_modules/sift/sift.min.js +2 -0
  1812. package/templates/backend/node_modules/sift/sift.min.js.map +1 -0
  1813. package/templates/backend/node_modules/sift/src/core.ts +494 -0
  1814. package/templates/backend/node_modules/sift/src/index.ts +54 -0
  1815. package/templates/backend/node_modules/sift/src/operations.ts +422 -0
  1816. package/templates/backend/node_modules/sift/src/utils.ts +74 -0
  1817. package/templates/backend/node_modules/simple-update-notifier/LICENSE +21 -0
  1818. package/templates/backend/node_modules/simple-update-notifier/README.md +82 -0
  1819. package/templates/backend/node_modules/simple-update-notifier/build/index.d.ts +13 -0
  1820. package/templates/backend/node_modules/simple-update-notifier/build/index.js +210 -0
  1821. package/templates/backend/node_modules/simple-update-notifier/package.json +100 -0
  1822. package/templates/backend/node_modules/simple-update-notifier/src/borderedText.ts +12 -0
  1823. package/templates/backend/node_modules/simple-update-notifier/src/cache.spec.ts +17 -0
  1824. package/templates/backend/node_modules/simple-update-notifier/src/cache.ts +44 -0
  1825. package/templates/backend/node_modules/simple-update-notifier/src/getDistVersion.spec.ts +35 -0
  1826. package/templates/backend/node_modules/simple-update-notifier/src/getDistVersion.ts +29 -0
  1827. package/templates/backend/node_modules/simple-update-notifier/src/hasNewVersion.spec.ts +82 -0
  1828. package/templates/backend/node_modules/simple-update-notifier/src/hasNewVersion.ts +40 -0
  1829. package/templates/backend/node_modules/simple-update-notifier/src/index.spec.ts +27 -0
  1830. package/templates/backend/node_modules/simple-update-notifier/src/index.ts +34 -0
  1831. package/templates/backend/node_modules/simple-update-notifier/src/isNpmOrYarn.ts +12 -0
  1832. package/templates/backend/node_modules/simple-update-notifier/src/types.ts +8 -0
  1833. package/templates/backend/node_modules/sparse-bitfield/.travis.yml +6 -0
  1834. package/templates/backend/node_modules/sparse-bitfield/LICENSE +21 -0
  1835. package/templates/backend/node_modules/sparse-bitfield/README.md +62 -0
  1836. package/templates/backend/node_modules/sparse-bitfield/index.js +95 -0
  1837. package/templates/backend/node_modules/sparse-bitfield/package.json +27 -0
  1838. package/templates/backend/node_modules/sparse-bitfield/test.js +79 -0
  1839. package/templates/backend/node_modules/statuses/HISTORY.md +87 -0
  1840. package/templates/backend/node_modules/statuses/LICENSE +23 -0
  1841. package/templates/backend/node_modules/statuses/README.md +139 -0
  1842. package/templates/backend/node_modules/statuses/codes.json +65 -0
  1843. package/templates/backend/node_modules/statuses/index.js +146 -0
  1844. package/templates/backend/node_modules/statuses/package.json +49 -0
  1845. package/templates/backend/node_modules/supports-color/browser.js +5 -0
  1846. package/templates/backend/node_modules/supports-color/index.js +131 -0
  1847. package/templates/backend/node_modules/supports-color/license +9 -0
  1848. package/templates/backend/node_modules/supports-color/package.json +53 -0
  1849. package/templates/backend/node_modules/supports-color/readme.md +66 -0
  1850. package/templates/backend/node_modules/to-regex-range/LICENSE +21 -0
  1851. package/templates/backend/node_modules/to-regex-range/README.md +305 -0
  1852. package/templates/backend/node_modules/to-regex-range/index.js +288 -0
  1853. package/templates/backend/node_modules/to-regex-range/package.json +88 -0
  1854. package/templates/backend/node_modules/toidentifier/HISTORY.md +9 -0
  1855. package/templates/backend/node_modules/toidentifier/LICENSE +21 -0
  1856. package/templates/backend/node_modules/toidentifier/README.md +61 -0
  1857. package/templates/backend/node_modules/toidentifier/index.js +32 -0
  1858. package/templates/backend/node_modules/toidentifier/package.json +38 -0
  1859. package/templates/backend/node_modules/touch/LICENSE +15 -0
  1860. package/templates/backend/node_modules/touch/README.md +52 -0
  1861. package/templates/backend/node_modules/touch/bin/nodetouch.js +112 -0
  1862. package/templates/backend/node_modules/touch/index.js +224 -0
  1863. package/templates/backend/node_modules/touch/package.json +25 -0
  1864. package/templates/backend/node_modules/tr46/LICENSE.md +21 -0
  1865. package/templates/backend/node_modules/tr46/README.md +76 -0
  1866. package/templates/backend/node_modules/tr46/index.js +344 -0
  1867. package/templates/backend/node_modules/tr46/lib/mappingTable.json +1 -0
  1868. package/templates/backend/node_modules/tr46/lib/regexes.js +29 -0
  1869. package/templates/backend/node_modules/tr46/lib/statusMapping.js +9 -0
  1870. package/templates/backend/node_modules/tr46/package.json +44 -0
  1871. package/templates/backend/node_modules/type-is/HISTORY.md +292 -0
  1872. package/templates/backend/node_modules/type-is/LICENSE +23 -0
  1873. package/templates/backend/node_modules/type-is/README.md +198 -0
  1874. package/templates/backend/node_modules/type-is/index.js +240 -0
  1875. package/templates/backend/node_modules/type-is/node_modules/content-type/LICENSE +22 -0
  1876. package/templates/backend/node_modules/type-is/node_modules/content-type/README.md +69 -0
  1877. package/templates/backend/node_modules/type-is/node_modules/content-type/dist/index.d.ts +26 -0
  1878. package/templates/backend/node_modules/type-is/node_modules/content-type/dist/index.js +170 -0
  1879. package/templates/backend/node_modules/type-is/node_modules/content-type/dist/index.js.map +1 -0
  1880. package/templates/backend/node_modules/type-is/node_modules/content-type/package.json +52 -0
  1881. package/templates/backend/node_modules/type-is/package.json +51 -0
  1882. package/templates/backend/node_modules/undefsafe/.github/workflows/release.yml +25 -0
  1883. package/templates/backend/node_modules/undefsafe/.jscsrc +13 -0
  1884. package/templates/backend/node_modules/undefsafe/.jshintrc +16 -0
  1885. package/templates/backend/node_modules/undefsafe/.travis.yml +18 -0
  1886. package/templates/backend/node_modules/undefsafe/LICENSE +22 -0
  1887. package/templates/backend/node_modules/undefsafe/README.md +63 -0
  1888. package/templates/backend/node_modules/undefsafe/example.js +14 -0
  1889. package/templates/backend/node_modules/undefsafe/lib/undefsafe.js +125 -0
  1890. package/templates/backend/node_modules/undefsafe/package.json +34 -0
  1891. package/templates/backend/node_modules/unpipe/HISTORY.md +4 -0
  1892. package/templates/backend/node_modules/unpipe/LICENSE +22 -0
  1893. package/templates/backend/node_modules/unpipe/README.md +43 -0
  1894. package/templates/backend/node_modules/unpipe/index.js +69 -0
  1895. package/templates/backend/node_modules/unpipe/package.json +27 -0
  1896. package/templates/backend/node_modules/vary/HISTORY.md +39 -0
  1897. package/templates/backend/node_modules/vary/LICENSE +22 -0
  1898. package/templates/backend/node_modules/vary/README.md +101 -0
  1899. package/templates/backend/node_modules/vary/index.js +149 -0
  1900. package/templates/backend/node_modules/vary/package.json +43 -0
  1901. package/templates/backend/node_modules/webidl-conversions/LICENSE.md +12 -0
  1902. package/templates/backend/node_modules/webidl-conversions/README.md +99 -0
  1903. package/templates/backend/node_modules/webidl-conversions/lib/index.js +450 -0
  1904. package/templates/backend/node_modules/webidl-conversions/package.json +35 -0
  1905. package/templates/backend/node_modules/whatwg-url/LICENSE.txt +21 -0
  1906. package/templates/backend/node_modules/whatwg-url/README.md +106 -0
  1907. package/templates/backend/node_modules/whatwg-url/index.js +27 -0
  1908. package/templates/backend/node_modules/whatwg-url/lib/Function.js +42 -0
  1909. package/templates/backend/node_modules/whatwg-url/lib/URL-impl.js +233 -0
  1910. package/templates/backend/node_modules/whatwg-url/lib/URL.js +499 -0
  1911. package/templates/backend/node_modules/whatwg-url/lib/URLSearchParams-impl.js +135 -0
  1912. package/templates/backend/node_modules/whatwg-url/lib/URLSearchParams.js +505 -0
  1913. package/templates/backend/node_modules/whatwg-url/lib/VoidFunction.js +26 -0
  1914. package/templates/backend/node_modules/whatwg-url/lib/encoding.js +16 -0
  1915. package/templates/backend/node_modules/whatwg-url/lib/infra.js +26 -0
  1916. package/templates/backend/node_modules/whatwg-url/lib/percent-encoding.js +142 -0
  1917. package/templates/backend/node_modules/whatwg-url/lib/url-state-machine.js +1274 -0
  1918. package/templates/backend/node_modules/whatwg-url/lib/urlencoded.js +89 -0
  1919. package/templates/backend/node_modules/whatwg-url/lib/utils.js +190 -0
  1920. package/templates/backend/node_modules/whatwg-url/package.json +53 -0
  1921. package/templates/backend/node_modules/whatwg-url/webidl2js-wrapper.js +7 -0
  1922. package/templates/backend/node_modules/wrappy/LICENSE +15 -0
  1923. package/templates/backend/node_modules/wrappy/README.md +36 -0
  1924. package/templates/backend/node_modules/wrappy/package.json +29 -0
  1925. package/templates/backend/node_modules/wrappy/wrappy.js +33 -0
  1926. package/templates/backend/package-lock.json +1543 -0
  1927. package/templates/backend/package.json +22 -0
  1928. package/templates/backend/server.js +131 -0
  1929. package/templates/frontend/README.md +18 -0
  1930. package/templates/frontend/eslint.config.js +21 -0
  1931. package/templates/frontend/index.html +13 -0
  1932. package/templates/frontend/package-lock.json +3136 -0
  1933. package/templates/frontend/package.json +34 -0
  1934. package/templates/frontend/public/favicon.svg +1 -0
  1935. package/templates/frontend/public/icons.svg +24 -0
  1936. package/templates/frontend/src/App.css +184 -0
  1937. package/templates/frontend/src/App.jsx +17 -0
  1938. package/templates/frontend/src/admin.jsx +29 -0
  1939. package/templates/frontend/src/assets/hero.png +0 -0
  1940. package/templates/frontend/src/assets/react.svg +1 -0
  1941. package/templates/frontend/src/assets/vite.svg +1 -0
  1942. package/templates/frontend/src/auth/login.jsx +82 -0
  1943. package/templates/frontend/src/auth/logout.jsx +17 -0
  1944. package/templates/frontend/src/auth/signup.jsx +137 -0
  1945. package/templates/frontend/src/index.css +1 -0
  1946. package/templates/frontend/src/main.jsx +10 -0
  1947. package/templates/frontend/vite.config.js +12 -0
@@ -0,0 +1,4755 @@
1
+ 'use strict';
2
+
3
+ const TypedArrayPrototypeGetSymbolToStringTag = (() => {
4
+ const g = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Uint8Array.prototype), Symbol.toStringTag).get;
5
+ return (value) => g.call(value);
6
+ })();
7
+ function isUint8Array(value) {
8
+ return TypedArrayPrototypeGetSymbolToStringTag(value) === 'Uint8Array';
9
+ }
10
+ function isAnyArrayBuffer(value) {
11
+ return (typeof value === 'object' &&
12
+ value != null &&
13
+ Symbol.toStringTag in value &&
14
+ (value[Symbol.toStringTag] === 'ArrayBuffer' ||
15
+ value[Symbol.toStringTag] === 'SharedArrayBuffer'));
16
+ }
17
+ function isRegExp(regexp) {
18
+ return regexp instanceof RegExp || Object.prototype.toString.call(regexp) === '[object RegExp]';
19
+ }
20
+ function isMap(value) {
21
+ return (typeof value === 'object' &&
22
+ value != null &&
23
+ Symbol.toStringTag in value &&
24
+ value[Symbol.toStringTag] === 'Map');
25
+ }
26
+ function isDate(date) {
27
+ return date instanceof Date || Object.prototype.toString.call(date) === '[object Date]';
28
+ }
29
+ function defaultInspect(x, _options) {
30
+ return JSON.stringify(x, (k, v) => {
31
+ if (typeof v === 'bigint') {
32
+ return { $numberLong: `${v}` };
33
+ }
34
+ else if (isMap(v)) {
35
+ return Object.fromEntries(v);
36
+ }
37
+ return v;
38
+ });
39
+ }
40
+ function getStylizeFunction(options) {
41
+ const stylizeExists = options != null &&
42
+ typeof options === 'object' &&
43
+ 'stylize' in options &&
44
+ typeof options.stylize === 'function';
45
+ if (stylizeExists) {
46
+ return options.stylize;
47
+ }
48
+ }
49
+
50
+ const BSON_MAJOR_VERSION = 7;
51
+ const BSON_VERSION_SYMBOL = Symbol.for('@@mdb.bson.version');
52
+ const BSON_INT32_MAX = 0x7fffffff;
53
+ const BSON_INT32_MIN = -0x80000000;
54
+ const BSON_INT64_MAX = Math.pow(2, 63) - 1;
55
+ const BSON_INT64_MIN = -Math.pow(2, 63);
56
+ const JS_INT_MAX = Math.pow(2, 53);
57
+ const JS_INT_MIN = -Math.pow(2, 53);
58
+ const BSON_DATA_NUMBER = 1;
59
+ const BSON_DATA_STRING = 2;
60
+ const BSON_DATA_OBJECT = 3;
61
+ const BSON_DATA_ARRAY = 4;
62
+ const BSON_DATA_BINARY = 5;
63
+ const BSON_DATA_UNDEFINED = 6;
64
+ const BSON_DATA_OID = 7;
65
+ const BSON_DATA_BOOLEAN = 8;
66
+ const BSON_DATA_DATE = 9;
67
+ const BSON_DATA_NULL = 10;
68
+ const BSON_DATA_REGEXP = 11;
69
+ const BSON_DATA_DBPOINTER = 12;
70
+ const BSON_DATA_CODE = 13;
71
+ const BSON_DATA_SYMBOL = 14;
72
+ const BSON_DATA_CODE_W_SCOPE = 15;
73
+ const BSON_DATA_INT = 16;
74
+ const BSON_DATA_TIMESTAMP = 17;
75
+ const BSON_DATA_LONG = 18;
76
+ const BSON_DATA_DECIMAL128 = 19;
77
+ const BSON_DATA_MIN_KEY = 0xff;
78
+ const BSON_DATA_MAX_KEY = 0x7f;
79
+ const BSON_BINARY_SUBTYPE_DEFAULT = 0;
80
+ const BSON_BINARY_SUBTYPE_FUNCTION = 1;
81
+ const BSON_BINARY_SUBTYPE_BYTE_ARRAY = 2;
82
+ const BSON_BINARY_SUBTYPE_UUID = 3;
83
+ const BSON_BINARY_SUBTYPE_UUID_NEW = 4;
84
+ const BSON_BINARY_SUBTYPE_MD5 = 5;
85
+ const BSON_BINARY_SUBTYPE_ENCRYPTED = 6;
86
+ const BSON_BINARY_SUBTYPE_COLUMN = 7;
87
+ const BSON_BINARY_SUBTYPE_SENSITIVE = 8;
88
+ const BSON_BINARY_SUBTYPE_USER_DEFINED = 128;
89
+ const BSONType = Object.freeze({
90
+ double: 1,
91
+ string: 2,
92
+ object: 3,
93
+ array: 4,
94
+ binData: 5,
95
+ undefined: 6,
96
+ objectId: 7,
97
+ bool: 8,
98
+ date: 9,
99
+ null: 10,
100
+ regex: 11,
101
+ dbPointer: 12,
102
+ javascript: 13,
103
+ symbol: 14,
104
+ javascriptWithScope: 15,
105
+ int: 16,
106
+ timestamp: 17,
107
+ long: 18,
108
+ decimal: 19,
109
+ minKey: -1,
110
+ maxKey: 127
111
+ });
112
+
113
+ class BSONError extends Error {
114
+ get bsonError() {
115
+ return true;
116
+ }
117
+ get name() {
118
+ return 'BSONError';
119
+ }
120
+ constructor(message, options) {
121
+ super(message, options);
122
+ }
123
+ static isBSONError(value) {
124
+ return (value != null &&
125
+ typeof value === 'object' &&
126
+ 'bsonError' in value &&
127
+ value.bsonError === true &&
128
+ 'name' in value &&
129
+ 'message' in value &&
130
+ 'stack' in value);
131
+ }
132
+ }
133
+ class BSONVersionError extends BSONError {
134
+ get name() {
135
+ return 'BSONVersionError';
136
+ }
137
+ constructor() {
138
+ super(`Unsupported BSON version, bson types must be from bson ${BSON_MAJOR_VERSION}.x.x`);
139
+ }
140
+ }
141
+ class BSONRuntimeError extends BSONError {
142
+ get name() {
143
+ return 'BSONRuntimeError';
144
+ }
145
+ constructor(message) {
146
+ super(message);
147
+ }
148
+ }
149
+ class BSONOffsetError extends BSONError {
150
+ get name() {
151
+ return 'BSONOffsetError';
152
+ }
153
+ offset;
154
+ constructor(message, offset, options) {
155
+ super(`${message}. offset: ${offset}`, options);
156
+ this.offset = offset;
157
+ }
158
+ }
159
+
160
+ let TextDecoderFatal;
161
+ let TextDecoderNonFatal;
162
+ function parseUtf8(buffer, start, end, fatal) {
163
+ if (fatal) {
164
+ TextDecoderFatal ??= new TextDecoder('utf8', { fatal: true });
165
+ try {
166
+ return TextDecoderFatal.decode(buffer.subarray(start, end));
167
+ }
168
+ catch (cause) {
169
+ throw new BSONError('Invalid UTF-8 string in BSON document', { cause });
170
+ }
171
+ }
172
+ TextDecoderNonFatal ??= new TextDecoder('utf8', { fatal: false });
173
+ return TextDecoderNonFatal.decode(buffer.subarray(start, end));
174
+ }
175
+
176
+ function tryReadBasicLatin(uint8array, start, end) {
177
+ if (uint8array.length === 0) {
178
+ return '';
179
+ }
180
+ const stringByteLength = end - start;
181
+ if (stringByteLength === 0) {
182
+ return '';
183
+ }
184
+ if (stringByteLength > 20) {
185
+ return null;
186
+ }
187
+ if (stringByteLength === 1 && uint8array[start] < 128) {
188
+ return String.fromCharCode(uint8array[start]);
189
+ }
190
+ if (stringByteLength === 2 && uint8array[start] < 128 && uint8array[start + 1] < 128) {
191
+ return String.fromCharCode(uint8array[start]) + String.fromCharCode(uint8array[start + 1]);
192
+ }
193
+ if (stringByteLength === 3 &&
194
+ uint8array[start] < 128 &&
195
+ uint8array[start + 1] < 128 &&
196
+ uint8array[start + 2] < 128) {
197
+ return (String.fromCharCode(uint8array[start]) +
198
+ String.fromCharCode(uint8array[start + 1]) +
199
+ String.fromCharCode(uint8array[start + 2]));
200
+ }
201
+ const latinBytes = [];
202
+ for (let i = start; i < end; i++) {
203
+ const byte = uint8array[i];
204
+ if (byte > 127) {
205
+ return null;
206
+ }
207
+ latinBytes.push(byte);
208
+ }
209
+ return String.fromCharCode(...latinBytes);
210
+ }
211
+ function tryWriteBasicLatin(destination, source, offset) {
212
+ if (source.length === 0)
213
+ return 0;
214
+ if (source.length > 25)
215
+ return null;
216
+ if (destination.length - offset < source.length)
217
+ return null;
218
+ for (let charOffset = 0, destinationOffset = offset; charOffset < source.length; charOffset++, destinationOffset++) {
219
+ const char = source.charCodeAt(charOffset);
220
+ if (char > 127)
221
+ return null;
222
+ destination[destinationOffset] = char;
223
+ }
224
+ return source.length;
225
+ }
226
+
227
+ function nodejsMathRandomBytes(byteLength) {
228
+ return nodeJsByteUtils.fromNumberArray(Array.from({ length: byteLength }, () => Math.floor(Math.random() * 256)));
229
+ }
230
+ function nodejsSecureRandomBytes(byteLength) {
231
+ return crypto.getRandomValues(nodeJsByteUtils.allocate(byteLength));
232
+ }
233
+ const nodejsRandomBytes = (() => {
234
+ const { crypto } = globalThis;
235
+ if (crypto != null && typeof crypto.getRandomValues === 'function') {
236
+ return nodejsSecureRandomBytes;
237
+ }
238
+ else {
239
+ return nodejsMathRandomBytes;
240
+ }
241
+ })();
242
+ const nodeJsByteUtils = {
243
+ isUint8Array: isUint8Array,
244
+ toLocalBufferType(potentialBuffer) {
245
+ if (Buffer.isBuffer(potentialBuffer)) {
246
+ return potentialBuffer;
247
+ }
248
+ if (ArrayBuffer.isView(potentialBuffer)) {
249
+ return Buffer.from(potentialBuffer.buffer, potentialBuffer.byteOffset, potentialBuffer.byteLength);
250
+ }
251
+ const stringTag = potentialBuffer?.[Symbol.toStringTag] ?? Object.prototype.toString.call(potentialBuffer);
252
+ if (stringTag === 'ArrayBuffer' ||
253
+ stringTag === 'SharedArrayBuffer' ||
254
+ stringTag === '[object ArrayBuffer]' ||
255
+ stringTag === '[object SharedArrayBuffer]') {
256
+ return Buffer.from(potentialBuffer);
257
+ }
258
+ throw new BSONError(`Cannot create Buffer from the passed potentialBuffer.`);
259
+ },
260
+ allocate(size) {
261
+ return Buffer.alloc(size);
262
+ },
263
+ allocateUnsafe(size) {
264
+ return Buffer.allocUnsafe(size);
265
+ },
266
+ compare(a, b) {
267
+ return nodeJsByteUtils.toLocalBufferType(a).compare(b);
268
+ },
269
+ concat(list) {
270
+ return Buffer.concat(list);
271
+ },
272
+ copy(source, target, targetStart, sourceStart, sourceEnd) {
273
+ return nodeJsByteUtils
274
+ .toLocalBufferType(source)
275
+ .copy(target, targetStart ?? 0, sourceStart ?? 0, sourceEnd ?? source.length);
276
+ },
277
+ equals(a, b) {
278
+ return nodeJsByteUtils.toLocalBufferType(a).equals(b);
279
+ },
280
+ fromNumberArray(array) {
281
+ return Buffer.from(array);
282
+ },
283
+ fromBase64(base64) {
284
+ return Buffer.from(base64, 'base64');
285
+ },
286
+ fromUTF8(utf8) {
287
+ return Buffer.from(utf8, 'utf8');
288
+ },
289
+ toBase64(buffer) {
290
+ return nodeJsByteUtils.toLocalBufferType(buffer).toString('base64');
291
+ },
292
+ fromISO88591(codePoints) {
293
+ return Buffer.from(codePoints, 'binary');
294
+ },
295
+ toISO88591(buffer) {
296
+ return nodeJsByteUtils.toLocalBufferType(buffer).toString('binary');
297
+ },
298
+ fromHex(hex) {
299
+ return Buffer.from(hex, 'hex');
300
+ },
301
+ toHex(buffer) {
302
+ return nodeJsByteUtils.toLocalBufferType(buffer).toString('hex');
303
+ },
304
+ toUTF8(buffer, start, end, fatal) {
305
+ const basicLatin = end - start <= 20 ? tryReadBasicLatin(buffer, start, end) : null;
306
+ if (basicLatin != null) {
307
+ return basicLatin;
308
+ }
309
+ const string = nodeJsByteUtils.toLocalBufferType(buffer).toString('utf8', start, end);
310
+ if (fatal) {
311
+ for (let i = 0; i < string.length; i++) {
312
+ if (string.charCodeAt(i) === 0xfffd) {
313
+ parseUtf8(buffer, start, end, true);
314
+ break;
315
+ }
316
+ }
317
+ }
318
+ return string;
319
+ },
320
+ utf8ByteLength(input) {
321
+ return Buffer.byteLength(input, 'utf8');
322
+ },
323
+ encodeUTF8Into(buffer, source, byteOffset) {
324
+ const latinBytesWritten = tryWriteBasicLatin(buffer, source, byteOffset);
325
+ if (latinBytesWritten != null) {
326
+ return latinBytesWritten;
327
+ }
328
+ return nodeJsByteUtils.toLocalBufferType(buffer).write(source, byteOffset, undefined, 'utf8');
329
+ },
330
+ randomBytes: nodejsRandomBytes,
331
+ swap32(buffer) {
332
+ return nodeJsByteUtils.toLocalBufferType(buffer).swap32();
333
+ }
334
+ };
335
+
336
+ function isReactNative() {
337
+ const { navigator } = globalThis;
338
+ return typeof navigator === 'object' && navigator.product === 'ReactNative';
339
+ }
340
+ function webMathRandomBytes(byteLength) {
341
+ if (byteLength < 0) {
342
+ throw new RangeError(`The argument 'byteLength' is invalid. Received ${byteLength}`);
343
+ }
344
+ return webByteUtils.fromNumberArray(Array.from({ length: byteLength }, () => Math.floor(Math.random() * 256)));
345
+ }
346
+ const webRandomBytes = (() => {
347
+ const { crypto } = globalThis;
348
+ if (crypto != null && typeof crypto.getRandomValues === 'function') {
349
+ return (byteLength) => {
350
+ return crypto.getRandomValues(webByteUtils.allocate(byteLength));
351
+ };
352
+ }
353
+ else {
354
+ if (isReactNative()) {
355
+ const { console } = globalThis;
356
+ console?.warn?.('BSON: For React Native please polyfill crypto.getRandomValues, e.g. using: https://www.npmjs.com/package/react-native-get-random-values.');
357
+ }
358
+ return webMathRandomBytes;
359
+ }
360
+ })();
361
+ const HEX_DIGIT = /(\d|[a-f])/i;
362
+ const webByteUtils = {
363
+ isUint8Array: isUint8Array,
364
+ toLocalBufferType(potentialUint8array) {
365
+ const stringTag = potentialUint8array?.[Symbol.toStringTag] ??
366
+ Object.prototype.toString.call(potentialUint8array);
367
+ if (stringTag === 'Uint8Array') {
368
+ return potentialUint8array;
369
+ }
370
+ if (ArrayBuffer.isView(potentialUint8array)) {
371
+ return new Uint8Array(potentialUint8array.buffer.slice(potentialUint8array.byteOffset, potentialUint8array.byteOffset + potentialUint8array.byteLength));
372
+ }
373
+ if (stringTag === 'ArrayBuffer' ||
374
+ stringTag === 'SharedArrayBuffer' ||
375
+ stringTag === '[object ArrayBuffer]' ||
376
+ stringTag === '[object SharedArrayBuffer]') {
377
+ return new Uint8Array(potentialUint8array);
378
+ }
379
+ throw new BSONError(`Cannot make a Uint8Array from passed potentialBuffer.`);
380
+ },
381
+ allocate(size) {
382
+ if (typeof size !== 'number') {
383
+ throw new TypeError(`The "size" argument must be of type number. Received ${String(size)}`);
384
+ }
385
+ return new Uint8Array(size);
386
+ },
387
+ allocateUnsafe(size) {
388
+ return webByteUtils.allocate(size);
389
+ },
390
+ compare(uint8Array, otherUint8Array) {
391
+ if (uint8Array === otherUint8Array)
392
+ return 0;
393
+ const len = Math.min(uint8Array.length, otherUint8Array.length);
394
+ for (let i = 0; i < len; i++) {
395
+ if (uint8Array[i] < otherUint8Array[i])
396
+ return -1;
397
+ if (uint8Array[i] > otherUint8Array[i])
398
+ return 1;
399
+ }
400
+ if (uint8Array.length < otherUint8Array.length)
401
+ return -1;
402
+ if (uint8Array.length > otherUint8Array.length)
403
+ return 1;
404
+ return 0;
405
+ },
406
+ concat(uint8Arrays) {
407
+ if (uint8Arrays.length === 0)
408
+ return webByteUtils.allocate(0);
409
+ let totalLength = 0;
410
+ for (const uint8Array of uint8Arrays) {
411
+ totalLength += uint8Array.length;
412
+ }
413
+ const result = webByteUtils.allocate(totalLength);
414
+ let offset = 0;
415
+ for (const uint8Array of uint8Arrays) {
416
+ result.set(uint8Array, offset);
417
+ offset += uint8Array.length;
418
+ }
419
+ return result;
420
+ },
421
+ copy(source, target, targetStart, sourceStart, sourceEnd) {
422
+ if (sourceEnd !== undefined && sourceEnd < 0) {
423
+ throw new RangeError(`The value of "sourceEnd" is out of range. It must be >= 0. Received ${sourceEnd}`);
424
+ }
425
+ sourceEnd = sourceEnd ?? source.length;
426
+ if (sourceStart !== undefined && (sourceStart < 0 || sourceStart > sourceEnd)) {
427
+ throw new RangeError(`The value of "sourceStart" is out of range. It must be >= 0 and <= ${sourceEnd}. Received ${sourceStart}`);
428
+ }
429
+ sourceStart = sourceStart ?? 0;
430
+ if (targetStart !== undefined && targetStart < 0) {
431
+ throw new RangeError(`The value of "targetStart" is out of range. It must be >= 0. Received ${targetStart}`);
432
+ }
433
+ targetStart = targetStart ?? 0;
434
+ const srcSlice = source.subarray(sourceStart, sourceEnd);
435
+ const maxLen = Math.min(srcSlice.length, target.length - targetStart);
436
+ if (maxLen <= 0) {
437
+ return 0;
438
+ }
439
+ target.set(srcSlice.subarray(0, maxLen), targetStart);
440
+ return maxLen;
441
+ },
442
+ equals(uint8Array, otherUint8Array) {
443
+ if (uint8Array.byteLength !== otherUint8Array.byteLength) {
444
+ return false;
445
+ }
446
+ for (let i = 0; i < uint8Array.byteLength; i++) {
447
+ if (uint8Array[i] !== otherUint8Array[i]) {
448
+ return false;
449
+ }
450
+ }
451
+ return true;
452
+ },
453
+ fromNumberArray(array) {
454
+ return Uint8Array.from(array);
455
+ },
456
+ fromBase64(base64) {
457
+ return Uint8Array.from(atob(base64), c => c.charCodeAt(0));
458
+ },
459
+ fromUTF8(utf8) {
460
+ return new TextEncoder().encode(utf8);
461
+ },
462
+ toBase64(uint8array) {
463
+ return btoa(webByteUtils.toISO88591(uint8array));
464
+ },
465
+ fromISO88591(codePoints) {
466
+ return Uint8Array.from(codePoints, c => c.charCodeAt(0) & 0xff);
467
+ },
468
+ toISO88591(uint8array) {
469
+ return Array.from(Uint16Array.from(uint8array), b => String.fromCharCode(b)).join('');
470
+ },
471
+ fromHex(hex) {
472
+ const evenLengthHex = hex.length % 2 === 0 ? hex : hex.slice(0, hex.length - 1);
473
+ const buffer = [];
474
+ for (let i = 0; i < evenLengthHex.length; i += 2) {
475
+ const firstDigit = evenLengthHex[i];
476
+ const secondDigit = evenLengthHex[i + 1];
477
+ if (!HEX_DIGIT.test(firstDigit)) {
478
+ break;
479
+ }
480
+ if (!HEX_DIGIT.test(secondDigit)) {
481
+ break;
482
+ }
483
+ const hexDigit = Number.parseInt(`${firstDigit}${secondDigit}`, 16);
484
+ buffer.push(hexDigit);
485
+ }
486
+ return Uint8Array.from(buffer);
487
+ },
488
+ toHex(uint8array) {
489
+ return Array.from(uint8array, byte => byte.toString(16).padStart(2, '0')).join('');
490
+ },
491
+ toUTF8(uint8array, start, end, fatal) {
492
+ const basicLatin = end - start <= 20 ? tryReadBasicLatin(uint8array, start, end) : null;
493
+ if (basicLatin != null) {
494
+ return basicLatin;
495
+ }
496
+ return parseUtf8(uint8array, start, end, fatal);
497
+ },
498
+ utf8ByteLength(input) {
499
+ return new TextEncoder().encode(input).byteLength;
500
+ },
501
+ encodeUTF8Into(uint8array, source, byteOffset) {
502
+ const bytes = new TextEncoder().encode(source);
503
+ uint8array.set(bytes, byteOffset);
504
+ return bytes.byteLength;
505
+ },
506
+ randomBytes: webRandomBytes,
507
+ swap32(buffer) {
508
+ if (buffer.length % 4 !== 0) {
509
+ throw new RangeError('Buffer size must be a multiple of 32-bits');
510
+ }
511
+ for (let i = 0; i < buffer.length; i += 4) {
512
+ const byte0 = buffer[i];
513
+ const byte1 = buffer[i + 1];
514
+ const byte2 = buffer[i + 2];
515
+ const byte3 = buffer[i + 3];
516
+ buffer[i] = byte3;
517
+ buffer[i + 1] = byte2;
518
+ buffer[i + 2] = byte1;
519
+ buffer[i + 3] = byte0;
520
+ }
521
+ return buffer;
522
+ }
523
+ };
524
+
525
+ const hasGlobalBuffer = typeof Buffer === 'function' && Buffer.prototype?._isBuffer !== true;
526
+ const ByteUtils = hasGlobalBuffer ? nodeJsByteUtils : webByteUtils;
527
+
528
+ const bsonType = Symbol.for('@@mdb.bson.type');
529
+ class BSONValue {
530
+ get [bsonType]() {
531
+ return this._bsontype;
532
+ }
533
+ get [BSON_VERSION_SYMBOL]() {
534
+ return BSON_MAJOR_VERSION;
535
+ }
536
+ [Symbol.for('nodejs.util.inspect.custom')](depth, options, inspect) {
537
+ return this.inspect(depth, options, inspect);
538
+ }
539
+ }
540
+
541
+ const FLOAT = new Float64Array(1);
542
+ const FLOAT_BYTES = new Uint8Array(FLOAT.buffer, 0, 8);
543
+ FLOAT[0] = -1;
544
+ const isBigEndian = FLOAT_BYTES[7] === 0;
545
+ const NumberUtils = {
546
+ isBigEndian,
547
+ getNonnegativeInt32LE(source, offset) {
548
+ if (source[offset + 3] > 127) {
549
+ throw new RangeError(`Size cannot be negative at offset: ${offset}`);
550
+ }
551
+ return (source[offset] |
552
+ (source[offset + 1] << 8) |
553
+ (source[offset + 2] << 16) |
554
+ (source[offset + 3] << 24));
555
+ },
556
+ getInt32LE(source, offset) {
557
+ return (source[offset] |
558
+ (source[offset + 1] << 8) |
559
+ (source[offset + 2] << 16) |
560
+ (source[offset + 3] << 24));
561
+ },
562
+ getUint32LE(source, offset) {
563
+ return (source[offset] +
564
+ source[offset + 1] * 256 +
565
+ source[offset + 2] * 65536 +
566
+ source[offset + 3] * 16777216);
567
+ },
568
+ getUint32BE(source, offset) {
569
+ return (source[offset + 3] +
570
+ source[offset + 2] * 256 +
571
+ source[offset + 1] * 65536 +
572
+ source[offset] * 16777216);
573
+ },
574
+ getBigInt64LE(source, offset) {
575
+ const hi = BigInt(source[offset + 4] +
576
+ source[offset + 5] * 256 +
577
+ source[offset + 6] * 65536 +
578
+ (source[offset + 7] << 24));
579
+ const lo = BigInt(source[offset] +
580
+ source[offset + 1] * 256 +
581
+ source[offset + 2] * 65536 +
582
+ source[offset + 3] * 16777216);
583
+ return (hi << 32n) + lo;
584
+ },
585
+ getFloat64LE: isBigEndian
586
+ ? (source, offset) => {
587
+ FLOAT_BYTES[7] = source[offset];
588
+ FLOAT_BYTES[6] = source[offset + 1];
589
+ FLOAT_BYTES[5] = source[offset + 2];
590
+ FLOAT_BYTES[4] = source[offset + 3];
591
+ FLOAT_BYTES[3] = source[offset + 4];
592
+ FLOAT_BYTES[2] = source[offset + 5];
593
+ FLOAT_BYTES[1] = source[offset + 6];
594
+ FLOAT_BYTES[0] = source[offset + 7];
595
+ return FLOAT[0];
596
+ }
597
+ : (source, offset) => {
598
+ FLOAT_BYTES[0] = source[offset];
599
+ FLOAT_BYTES[1] = source[offset + 1];
600
+ FLOAT_BYTES[2] = source[offset + 2];
601
+ FLOAT_BYTES[3] = source[offset + 3];
602
+ FLOAT_BYTES[4] = source[offset + 4];
603
+ FLOAT_BYTES[5] = source[offset + 5];
604
+ FLOAT_BYTES[6] = source[offset + 6];
605
+ FLOAT_BYTES[7] = source[offset + 7];
606
+ return FLOAT[0];
607
+ },
608
+ setInt32BE(destination, offset, value) {
609
+ destination[offset + 3] = value;
610
+ value >>>= 8;
611
+ destination[offset + 2] = value;
612
+ value >>>= 8;
613
+ destination[offset + 1] = value;
614
+ value >>>= 8;
615
+ destination[offset] = value;
616
+ return 4;
617
+ },
618
+ setInt32LE(destination, offset, value) {
619
+ destination[offset] = value;
620
+ value >>>= 8;
621
+ destination[offset + 1] = value;
622
+ value >>>= 8;
623
+ destination[offset + 2] = value;
624
+ value >>>= 8;
625
+ destination[offset + 3] = value;
626
+ return 4;
627
+ },
628
+ setBigInt64LE(destination, offset, value) {
629
+ const mask32bits = 0xffffffffn;
630
+ let lo = Number(value & mask32bits);
631
+ destination[offset] = lo;
632
+ lo >>= 8;
633
+ destination[offset + 1] = lo;
634
+ lo >>= 8;
635
+ destination[offset + 2] = lo;
636
+ lo >>= 8;
637
+ destination[offset + 3] = lo;
638
+ let hi = Number((value >> 32n) & mask32bits);
639
+ destination[offset + 4] = hi;
640
+ hi >>= 8;
641
+ destination[offset + 5] = hi;
642
+ hi >>= 8;
643
+ destination[offset + 6] = hi;
644
+ hi >>= 8;
645
+ destination[offset + 7] = hi;
646
+ return 8;
647
+ },
648
+ setFloat64LE: isBigEndian
649
+ ? (destination, offset, value) => {
650
+ FLOAT[0] = value;
651
+ destination[offset] = FLOAT_BYTES[7];
652
+ destination[offset + 1] = FLOAT_BYTES[6];
653
+ destination[offset + 2] = FLOAT_BYTES[5];
654
+ destination[offset + 3] = FLOAT_BYTES[4];
655
+ destination[offset + 4] = FLOAT_BYTES[3];
656
+ destination[offset + 5] = FLOAT_BYTES[2];
657
+ destination[offset + 6] = FLOAT_BYTES[1];
658
+ destination[offset + 7] = FLOAT_BYTES[0];
659
+ return 8;
660
+ }
661
+ : (destination, offset, value) => {
662
+ FLOAT[0] = value;
663
+ destination[offset] = FLOAT_BYTES[0];
664
+ destination[offset + 1] = FLOAT_BYTES[1];
665
+ destination[offset + 2] = FLOAT_BYTES[2];
666
+ destination[offset + 3] = FLOAT_BYTES[3];
667
+ destination[offset + 4] = FLOAT_BYTES[4];
668
+ destination[offset + 5] = FLOAT_BYTES[5];
669
+ destination[offset + 6] = FLOAT_BYTES[6];
670
+ destination[offset + 7] = FLOAT_BYTES[7];
671
+ return 8;
672
+ }
673
+ };
674
+
675
+ class Binary extends BSONValue {
676
+ get _bsontype() {
677
+ return 'Binary';
678
+ }
679
+ static BSON_BINARY_SUBTYPE_DEFAULT = 0;
680
+ static BUFFER_SIZE = 256;
681
+ static SUBTYPE_DEFAULT = 0;
682
+ static SUBTYPE_FUNCTION = 1;
683
+ static SUBTYPE_BYTE_ARRAY = 2;
684
+ static SUBTYPE_UUID_OLD = 3;
685
+ static SUBTYPE_UUID = 4;
686
+ static SUBTYPE_MD5 = 5;
687
+ static SUBTYPE_ENCRYPTED = 6;
688
+ static SUBTYPE_COLUMN = 7;
689
+ static SUBTYPE_SENSITIVE = 8;
690
+ static SUBTYPE_VECTOR = 9;
691
+ static SUBTYPE_USER_DEFINED = 128;
692
+ static VECTOR_TYPE = Object.freeze({
693
+ Int8: 0x03,
694
+ Float32: 0x27,
695
+ PackedBit: 0x10
696
+ });
697
+ buffer;
698
+ sub_type;
699
+ position;
700
+ constructor(buffer, subType) {
701
+ super();
702
+ if (!(buffer == null) &&
703
+ typeof buffer === 'string' &&
704
+ !ArrayBuffer.isView(buffer) &&
705
+ !isAnyArrayBuffer(buffer) &&
706
+ !Array.isArray(buffer)) {
707
+ throw new BSONError('Binary can only be constructed from Uint8Array or number[]');
708
+ }
709
+ this.sub_type = subType ?? Binary.BSON_BINARY_SUBTYPE_DEFAULT;
710
+ if (buffer == null) {
711
+ this.buffer = ByteUtils.allocate(Binary.BUFFER_SIZE);
712
+ this.position = 0;
713
+ }
714
+ else {
715
+ this.buffer = Array.isArray(buffer)
716
+ ? ByteUtils.fromNumberArray(buffer)
717
+ : ByteUtils.toLocalBufferType(buffer);
718
+ this.position = this.buffer.byteLength;
719
+ }
720
+ }
721
+ put(byteValue) {
722
+ if (typeof byteValue === 'string' && byteValue.length !== 1) {
723
+ throw new BSONError('only accepts single character String');
724
+ }
725
+ else if (typeof byteValue !== 'number' && byteValue.length !== 1)
726
+ throw new BSONError('only accepts single character Uint8Array or Array');
727
+ let decodedByte;
728
+ if (typeof byteValue === 'string') {
729
+ decodedByte = byteValue.charCodeAt(0);
730
+ }
731
+ else if (typeof byteValue === 'number') {
732
+ decodedByte = byteValue;
733
+ }
734
+ else {
735
+ decodedByte = byteValue[0];
736
+ }
737
+ if (decodedByte < 0 || decodedByte > 255) {
738
+ throw new BSONError('only accepts number in a valid unsigned byte range 0-255');
739
+ }
740
+ if (this.buffer.byteLength > this.position) {
741
+ this.buffer[this.position++] = decodedByte;
742
+ }
743
+ else {
744
+ const newSpace = ByteUtils.allocate(Binary.BUFFER_SIZE + this.buffer.length);
745
+ newSpace.set(this.buffer, 0);
746
+ this.buffer = newSpace;
747
+ this.buffer[this.position++] = decodedByte;
748
+ }
749
+ }
750
+ write(sequence, offset) {
751
+ offset = typeof offset === 'number' ? offset : this.position;
752
+ if (this.buffer.byteLength < offset + sequence.length) {
753
+ const newSpace = ByteUtils.allocate(this.buffer.byteLength + sequence.length);
754
+ newSpace.set(this.buffer, 0);
755
+ this.buffer = newSpace;
756
+ }
757
+ if (ArrayBuffer.isView(sequence)) {
758
+ this.buffer.set(ByteUtils.toLocalBufferType(sequence), offset);
759
+ this.position =
760
+ offset + sequence.byteLength > this.position ? offset + sequence.length : this.position;
761
+ }
762
+ else if (typeof sequence === 'string') {
763
+ throw new BSONError('input cannot be string');
764
+ }
765
+ }
766
+ read(position, length) {
767
+ length = length && length > 0 ? length : this.position;
768
+ const end = position + length;
769
+ return this.buffer.subarray(position, end > this.position ? this.position : end);
770
+ }
771
+ value() {
772
+ return this.buffer.length === this.position
773
+ ? this.buffer
774
+ : this.buffer.subarray(0, this.position);
775
+ }
776
+ length() {
777
+ return this.position;
778
+ }
779
+ toJSON() {
780
+ return ByteUtils.toBase64(this.buffer.subarray(0, this.position));
781
+ }
782
+ toString(encoding) {
783
+ if (encoding === 'hex')
784
+ return ByteUtils.toHex(this.buffer.subarray(0, this.position));
785
+ if (encoding === 'base64')
786
+ return ByteUtils.toBase64(this.buffer.subarray(0, this.position));
787
+ if (encoding === 'utf8' || encoding === 'utf-8')
788
+ return ByteUtils.toUTF8(this.buffer, 0, this.position, false);
789
+ return ByteUtils.toUTF8(this.buffer, 0, this.position, false);
790
+ }
791
+ toExtendedJSON(options) {
792
+ options = options || {};
793
+ if (this.sub_type === Binary.SUBTYPE_VECTOR) {
794
+ validateBinaryVector(this);
795
+ }
796
+ const base64String = ByteUtils.toBase64(this.buffer);
797
+ const subType = Number(this.sub_type).toString(16);
798
+ if (options.legacy) {
799
+ return {
800
+ $binary: base64String,
801
+ $type: subType.length === 1 ? '0' + subType : subType
802
+ };
803
+ }
804
+ return {
805
+ $binary: {
806
+ base64: base64String,
807
+ subType: subType.length === 1 ? '0' + subType : subType
808
+ }
809
+ };
810
+ }
811
+ toUUID() {
812
+ if (this.sub_type === Binary.SUBTYPE_UUID) {
813
+ return new UUID(this.buffer.subarray(0, this.position));
814
+ }
815
+ throw new BSONError(`Binary sub_type "${this.sub_type}" is not supported for converting to UUID. Only "${Binary.SUBTYPE_UUID}" is currently supported.`);
816
+ }
817
+ static createFromHexString(hex, subType) {
818
+ return new Binary(ByteUtils.fromHex(hex), subType);
819
+ }
820
+ static createFromBase64(base64, subType) {
821
+ return new Binary(ByteUtils.fromBase64(base64), subType);
822
+ }
823
+ static fromExtendedJSON(doc, options) {
824
+ options = options || {};
825
+ let data;
826
+ let type;
827
+ if ('$binary' in doc) {
828
+ if (options.legacy && typeof doc.$binary === 'string' && '$type' in doc) {
829
+ type = doc.$type ? parseInt(doc.$type, 16) : 0;
830
+ data = ByteUtils.fromBase64(doc.$binary);
831
+ }
832
+ else {
833
+ if (typeof doc.$binary !== 'string') {
834
+ type = doc.$binary.subType ? parseInt(doc.$binary.subType, 16) : 0;
835
+ data = ByteUtils.fromBase64(doc.$binary.base64);
836
+ }
837
+ }
838
+ }
839
+ else if ('$uuid' in doc) {
840
+ type = 4;
841
+ data = UUID.bytesFromString(doc.$uuid);
842
+ }
843
+ if (!data) {
844
+ throw new BSONError(`Unexpected Binary Extended JSON format ${JSON.stringify(doc)}`);
845
+ }
846
+ return type === BSON_BINARY_SUBTYPE_UUID_NEW ? new UUID(data) : new Binary(data, type);
847
+ }
848
+ inspect(depth, options, inspect) {
849
+ inspect ??= defaultInspect;
850
+ const base64 = ByteUtils.toBase64(this.buffer.subarray(0, this.position));
851
+ const base64Arg = inspect(base64, options);
852
+ const subTypeArg = inspect(this.sub_type, options);
853
+ return `Binary.createFromBase64(${base64Arg}, ${subTypeArg})`;
854
+ }
855
+ toInt8Array() {
856
+ if (this.sub_type !== Binary.SUBTYPE_VECTOR) {
857
+ throw new BSONError('Binary sub_type is not Vector');
858
+ }
859
+ if (this.buffer[0] !== Binary.VECTOR_TYPE.Int8) {
860
+ throw new BSONError('Binary datatype field is not Int8');
861
+ }
862
+ validateBinaryVector(this);
863
+ return new Int8Array(this.buffer.buffer.slice(this.buffer.byteOffset + 2, this.buffer.byteOffset + this.position));
864
+ }
865
+ toFloat32Array() {
866
+ if (this.sub_type !== Binary.SUBTYPE_VECTOR) {
867
+ throw new BSONError('Binary sub_type is not Vector');
868
+ }
869
+ if (this.buffer[0] !== Binary.VECTOR_TYPE.Float32) {
870
+ throw new BSONError('Binary datatype field is not Float32');
871
+ }
872
+ validateBinaryVector(this);
873
+ const floatBytes = new Uint8Array(this.buffer.buffer.slice(this.buffer.byteOffset + 2, this.buffer.byteOffset + this.position));
874
+ if (NumberUtils.isBigEndian)
875
+ ByteUtils.swap32(floatBytes);
876
+ return new Float32Array(floatBytes.buffer);
877
+ }
878
+ toPackedBits() {
879
+ if (this.sub_type !== Binary.SUBTYPE_VECTOR) {
880
+ throw new BSONError('Binary sub_type is not Vector');
881
+ }
882
+ if (this.buffer[0] !== Binary.VECTOR_TYPE.PackedBit) {
883
+ throw new BSONError('Binary datatype field is not packed bit');
884
+ }
885
+ validateBinaryVector(this);
886
+ return new Uint8Array(this.buffer.buffer.slice(this.buffer.byteOffset + 2, this.buffer.byteOffset + this.position));
887
+ }
888
+ toBits() {
889
+ if (this.sub_type !== Binary.SUBTYPE_VECTOR) {
890
+ throw new BSONError('Binary sub_type is not Vector');
891
+ }
892
+ if (this.buffer[0] !== Binary.VECTOR_TYPE.PackedBit) {
893
+ throw new BSONError('Binary datatype field is not packed bit');
894
+ }
895
+ validateBinaryVector(this);
896
+ const byteCount = this.length() - 2;
897
+ const bitCount = byteCount * 8 - this.buffer[1];
898
+ const bits = new Int8Array(bitCount);
899
+ for (let bitOffset = 0; bitOffset < bits.length; bitOffset++) {
900
+ const byteOffset = (bitOffset / 8) | 0;
901
+ const byte = this.buffer[byteOffset + 2];
902
+ const shift = 7 - (bitOffset % 8);
903
+ const bit = (byte >> shift) & 1;
904
+ bits[bitOffset] = bit;
905
+ }
906
+ return bits;
907
+ }
908
+ static fromInt8Array(array) {
909
+ const buffer = ByteUtils.allocate(array.byteLength + 2);
910
+ buffer[0] = Binary.VECTOR_TYPE.Int8;
911
+ buffer[1] = 0;
912
+ const intBytes = new Uint8Array(array.buffer, array.byteOffset, array.byteLength);
913
+ buffer.set(intBytes, 2);
914
+ const bin = new this(buffer, this.SUBTYPE_VECTOR);
915
+ validateBinaryVector(bin);
916
+ return bin;
917
+ }
918
+ static fromFloat32Array(array) {
919
+ const binaryBytes = ByteUtils.allocate(array.byteLength + 2);
920
+ binaryBytes[0] = Binary.VECTOR_TYPE.Float32;
921
+ binaryBytes[1] = 0;
922
+ const floatBytes = new Uint8Array(array.buffer, array.byteOffset, array.byteLength);
923
+ binaryBytes.set(floatBytes, 2);
924
+ if (NumberUtils.isBigEndian)
925
+ ByteUtils.swap32(new Uint8Array(binaryBytes.buffer, 2));
926
+ const bin = new this(binaryBytes, this.SUBTYPE_VECTOR);
927
+ validateBinaryVector(bin);
928
+ return bin;
929
+ }
930
+ static fromPackedBits(array, padding = 0) {
931
+ const buffer = ByteUtils.allocate(array.byteLength + 2);
932
+ buffer[0] = Binary.VECTOR_TYPE.PackedBit;
933
+ buffer[1] = padding;
934
+ buffer.set(array, 2);
935
+ const bin = new this(buffer, this.SUBTYPE_VECTOR);
936
+ validateBinaryVector(bin);
937
+ return bin;
938
+ }
939
+ static fromBits(bits) {
940
+ const byteLength = (bits.length + 7) >>> 3;
941
+ const bytes = new Uint8Array(byteLength + 2);
942
+ bytes[0] = Binary.VECTOR_TYPE.PackedBit;
943
+ const remainder = bits.length % 8;
944
+ bytes[1] = remainder === 0 ? 0 : 8 - remainder;
945
+ for (let bitOffset = 0; bitOffset < bits.length; bitOffset++) {
946
+ const byteOffset = bitOffset >>> 3;
947
+ const bit = bits[bitOffset];
948
+ if (bit !== 0 && bit !== 1) {
949
+ throw new BSONError(`Invalid bit value at ${bitOffset}: must be 0 or 1, found ${bits[bitOffset]}`);
950
+ }
951
+ if (bit === 0)
952
+ continue;
953
+ const shift = 7 - (bitOffset % 8);
954
+ bytes[byteOffset + 2] |= bit << shift;
955
+ }
956
+ return new this(bytes, Binary.SUBTYPE_VECTOR);
957
+ }
958
+ }
959
+ function validateBinaryVector(vector) {
960
+ if (vector.sub_type !== Binary.SUBTYPE_VECTOR)
961
+ return;
962
+ const size = vector.position;
963
+ const datatype = vector.buffer[0];
964
+ const padding = vector.buffer[1];
965
+ if ((datatype === Binary.VECTOR_TYPE.Float32 || datatype === Binary.VECTOR_TYPE.Int8) &&
966
+ padding !== 0) {
967
+ throw new BSONError('Invalid Vector: padding must be zero for int8 and float32 vectors');
968
+ }
969
+ if (datatype === Binary.VECTOR_TYPE.Float32) {
970
+ if (size !== 0 && size - 2 !== 0 && (size - 2) % 4 !== 0) {
971
+ throw new BSONError('Invalid Vector: Float32 vector must contain a multiple of 4 bytes');
972
+ }
973
+ }
974
+ if (datatype === Binary.VECTOR_TYPE.PackedBit && padding !== 0 && size === 2) {
975
+ throw new BSONError('Invalid Vector: padding must be zero for packed bit vectors that are empty');
976
+ }
977
+ if (datatype === Binary.VECTOR_TYPE.PackedBit && padding > 7) {
978
+ throw new BSONError(`Invalid Vector: padding must be a value between 0 and 7. found: ${padding}`);
979
+ }
980
+ }
981
+ const UUID_BYTE_LENGTH = 16;
982
+ const UUID_WITHOUT_DASHES = /^[0-9A-F]{32}$/i;
983
+ const UUID_WITH_DASHES = /^[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}$/i;
984
+ class UUID extends Binary {
985
+ constructor(input) {
986
+ let bytes;
987
+ if (input == null) {
988
+ bytes = UUID.generate();
989
+ }
990
+ else if (input instanceof UUID) {
991
+ bytes = ByteUtils.toLocalBufferType(new Uint8Array(input.buffer));
992
+ }
993
+ else if (ArrayBuffer.isView(input) && input.byteLength === UUID_BYTE_LENGTH) {
994
+ bytes = ByteUtils.toLocalBufferType(input);
995
+ }
996
+ else if (typeof input === 'string') {
997
+ bytes = UUID.bytesFromString(input);
998
+ }
999
+ else {
1000
+ throw new BSONError('Argument passed in UUID constructor must be a UUID, a 16 byte Buffer or a 32/36 character hex string (dashes excluded/included, format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).');
1001
+ }
1002
+ super(bytes, BSON_BINARY_SUBTYPE_UUID_NEW);
1003
+ }
1004
+ get id() {
1005
+ return this.buffer;
1006
+ }
1007
+ set id(value) {
1008
+ this.buffer = value;
1009
+ }
1010
+ toHexString(includeDashes = true) {
1011
+ if (includeDashes) {
1012
+ return [
1013
+ ByteUtils.toHex(this.buffer.subarray(0, 4)),
1014
+ ByteUtils.toHex(this.buffer.subarray(4, 6)),
1015
+ ByteUtils.toHex(this.buffer.subarray(6, 8)),
1016
+ ByteUtils.toHex(this.buffer.subarray(8, 10)),
1017
+ ByteUtils.toHex(this.buffer.subarray(10, 16))
1018
+ ].join('-');
1019
+ }
1020
+ return ByteUtils.toHex(this.buffer);
1021
+ }
1022
+ toString(encoding) {
1023
+ if (encoding === 'hex')
1024
+ return ByteUtils.toHex(this.id);
1025
+ if (encoding === 'base64')
1026
+ return ByteUtils.toBase64(this.id);
1027
+ return this.toHexString();
1028
+ }
1029
+ toJSON() {
1030
+ return this.toHexString();
1031
+ }
1032
+ equals(otherId) {
1033
+ if (!otherId) {
1034
+ return false;
1035
+ }
1036
+ if (otherId instanceof UUID) {
1037
+ return ByteUtils.equals(otherId.id, this.id);
1038
+ }
1039
+ try {
1040
+ return ByteUtils.equals(new UUID(otherId).id, this.id);
1041
+ }
1042
+ catch {
1043
+ return false;
1044
+ }
1045
+ }
1046
+ toBinary() {
1047
+ return new Binary(this.id, Binary.SUBTYPE_UUID);
1048
+ }
1049
+ static generate() {
1050
+ const bytes = ByteUtils.randomBytes(UUID_BYTE_LENGTH);
1051
+ bytes[6] = (bytes[6] & 0x0f) | 0x40;
1052
+ bytes[8] = (bytes[8] & 0x3f) | 0x80;
1053
+ return bytes;
1054
+ }
1055
+ static isValid(input) {
1056
+ if (!input) {
1057
+ return false;
1058
+ }
1059
+ if (typeof input === 'string') {
1060
+ return UUID.isValidUUIDString(input);
1061
+ }
1062
+ if (isUint8Array(input)) {
1063
+ return input.byteLength === UUID_BYTE_LENGTH;
1064
+ }
1065
+ return (input._bsontype === 'Binary' &&
1066
+ input.sub_type === this.SUBTYPE_UUID &&
1067
+ input.buffer.byteLength === 16);
1068
+ }
1069
+ static createFromHexString(hexString) {
1070
+ const buffer = UUID.bytesFromString(hexString);
1071
+ return new UUID(buffer);
1072
+ }
1073
+ static createFromBase64(base64) {
1074
+ return new UUID(ByteUtils.fromBase64(base64));
1075
+ }
1076
+ static bytesFromString(representation) {
1077
+ if (!UUID.isValidUUIDString(representation)) {
1078
+ throw new BSONError('UUID string representation must be 32 hex digits or canonical hyphenated representation');
1079
+ }
1080
+ return ByteUtils.fromHex(representation.replace(/-/g, ''));
1081
+ }
1082
+ static isValidUUIDString(representation) {
1083
+ return UUID_WITHOUT_DASHES.test(representation) || UUID_WITH_DASHES.test(representation);
1084
+ }
1085
+ inspect(depth, options, inspect) {
1086
+ inspect ??= defaultInspect;
1087
+ return `new UUID(${inspect(this.toHexString(), options)})`;
1088
+ }
1089
+ }
1090
+
1091
+ class Code extends BSONValue {
1092
+ get _bsontype() {
1093
+ return 'Code';
1094
+ }
1095
+ code;
1096
+ scope;
1097
+ constructor(code, scope) {
1098
+ super();
1099
+ this.code = code.toString();
1100
+ this.scope = scope ?? null;
1101
+ }
1102
+ toJSON() {
1103
+ if (this.scope != null) {
1104
+ return { code: this.code, scope: this.scope };
1105
+ }
1106
+ return { code: this.code };
1107
+ }
1108
+ toExtendedJSON() {
1109
+ if (this.scope) {
1110
+ return { $code: this.code, $scope: this.scope };
1111
+ }
1112
+ return { $code: this.code };
1113
+ }
1114
+ static fromExtendedJSON(doc) {
1115
+ return new Code(doc.$code, doc.$scope);
1116
+ }
1117
+ inspect(depth, options, inspect) {
1118
+ inspect ??= defaultInspect;
1119
+ let parametersString = inspect(this.code, options);
1120
+ const multiLineFn = parametersString.includes('\n');
1121
+ if (this.scope != null) {
1122
+ parametersString += `,${multiLineFn ? '\n' : ' '}${inspect(this.scope, options)}`;
1123
+ }
1124
+ const endingNewline = multiLineFn && this.scope === null;
1125
+ return `new Code(${multiLineFn ? '\n' : ''}${parametersString}${endingNewline ? '\n' : ''})`;
1126
+ }
1127
+ }
1128
+
1129
+ function isDBRefLike(value) {
1130
+ return (value != null &&
1131
+ typeof value === 'object' &&
1132
+ '$id' in value &&
1133
+ value.$id != null &&
1134
+ '$ref' in value &&
1135
+ typeof value.$ref === 'string' &&
1136
+ (!('$db' in value) || ('$db' in value && typeof value.$db === 'string')));
1137
+ }
1138
+ class DBRef extends BSONValue {
1139
+ get _bsontype() {
1140
+ return 'DBRef';
1141
+ }
1142
+ collection;
1143
+ oid;
1144
+ db;
1145
+ fields;
1146
+ constructor(collection, oid, db, fields) {
1147
+ super();
1148
+ const parts = collection.split('.');
1149
+ if (parts.length === 2) {
1150
+ db = parts.shift();
1151
+ collection = parts.shift();
1152
+ }
1153
+ this.collection = collection;
1154
+ this.oid = oid;
1155
+ this.db = db;
1156
+ this.fields = fields || {};
1157
+ }
1158
+ get namespace() {
1159
+ return this.collection;
1160
+ }
1161
+ set namespace(value) {
1162
+ this.collection = value;
1163
+ }
1164
+ toJSON() {
1165
+ const o = Object.assign({
1166
+ $ref: this.collection,
1167
+ $id: this.oid
1168
+ }, this.fields);
1169
+ if (this.db != null)
1170
+ o.$db = this.db;
1171
+ return o;
1172
+ }
1173
+ toExtendedJSON(options) {
1174
+ options = options || {};
1175
+ let o = {
1176
+ $ref: this.collection,
1177
+ $id: this.oid
1178
+ };
1179
+ if (options.legacy) {
1180
+ return o;
1181
+ }
1182
+ if (this.db)
1183
+ o.$db = this.db;
1184
+ o = Object.assign(o, this.fields);
1185
+ return o;
1186
+ }
1187
+ static fromExtendedJSON(doc) {
1188
+ const copy = Object.assign({}, doc);
1189
+ delete copy.$ref;
1190
+ delete copy.$id;
1191
+ delete copy.$db;
1192
+ return new DBRef(doc.$ref, doc.$id, doc.$db, copy);
1193
+ }
1194
+ inspect(depth, options, inspect) {
1195
+ inspect ??= defaultInspect;
1196
+ const args = [
1197
+ inspect(this.namespace, options),
1198
+ inspect(this.oid, options),
1199
+ ...(this.db ? [inspect(this.db, options)] : []),
1200
+ ...(Object.keys(this.fields).length > 0 ? [inspect(this.fields, options)] : [])
1201
+ ];
1202
+ args[1] = inspect === defaultInspect ? `new ObjectId(${args[1]})` : args[1];
1203
+ return `new DBRef(${args.join(', ')})`;
1204
+ }
1205
+ }
1206
+
1207
+ function removeLeadingZerosAndExplicitPlus(str) {
1208
+ if (str === '') {
1209
+ return str;
1210
+ }
1211
+ let startIndex = 0;
1212
+ const isNegative = str[startIndex] === '-';
1213
+ const isExplicitlyPositive = str[startIndex] === '+';
1214
+ if (isExplicitlyPositive || isNegative) {
1215
+ startIndex += 1;
1216
+ }
1217
+ let foundInsignificantZero = false;
1218
+ for (; startIndex < str.length && str[startIndex] === '0'; ++startIndex) {
1219
+ foundInsignificantZero = true;
1220
+ }
1221
+ if (!foundInsignificantZero) {
1222
+ return isExplicitlyPositive ? str.slice(1) : str;
1223
+ }
1224
+ return `${isNegative ? '-' : ''}${str.length === startIndex ? '0' : str.slice(startIndex)}`;
1225
+ }
1226
+ function validateStringCharacters(str, radix) {
1227
+ radix = radix ?? 10;
1228
+ const validCharacters = '0123456789abcdefghijklmnopqrstuvwxyz'.slice(0, radix);
1229
+ const regex = new RegExp(`[^-+${validCharacters}]`, 'i');
1230
+ return regex.test(str) ? false : str;
1231
+ }
1232
+
1233
+ let wasm = undefined;
1234
+ try {
1235
+ wasm = new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0, 97, 115, 109, 1, 0, 0, 0, 1, 13, 2, 96, 0, 1, 127, 96, 4, 127, 127, 127, 127, 1, 127, 3, 7, 6, 0, 1, 1, 1, 1, 1, 6, 6, 1, 127, 1, 65, 0, 11, 7, 50, 6, 3, 109, 117, 108, 0, 1, 5, 100, 105, 118, 95, 115, 0, 2, 5, 100, 105, 118, 95, 117, 0, 3, 5, 114, 101, 109, 95, 115, 0, 4, 5, 114, 101, 109, 95, 117, 0, 5, 8, 103, 101, 116, 95, 104, 105, 103, 104, 0, 0, 10, 191, 1, 6, 4, 0, 35, 0, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 126, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 127, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 128, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 129, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 130, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11])), {}).exports;
1236
+ }
1237
+ catch {
1238
+ }
1239
+ const TWO_PWR_16_DBL = 1 << 16;
1240
+ const TWO_PWR_24_DBL = 1 << 24;
1241
+ const TWO_PWR_32_DBL = TWO_PWR_16_DBL * TWO_PWR_16_DBL;
1242
+ const TWO_PWR_64_DBL = TWO_PWR_32_DBL * TWO_PWR_32_DBL;
1243
+ const TWO_PWR_63_DBL = TWO_PWR_64_DBL / 2;
1244
+ const INT_CACHE = {};
1245
+ const UINT_CACHE = {};
1246
+ const MAX_INT64_STRING_LENGTH = 20;
1247
+ const DECIMAL_REG_EX = /^(\+?0|(\+|-)?[1-9][0-9]*)$/;
1248
+ class Long extends BSONValue {
1249
+ get _bsontype() {
1250
+ return 'Long';
1251
+ }
1252
+ get __isLong__() {
1253
+ return true;
1254
+ }
1255
+ high;
1256
+ low;
1257
+ unsigned;
1258
+ constructor(lowOrValue = 0, highOrUnsigned, unsigned) {
1259
+ super();
1260
+ const unsignedBool = typeof highOrUnsigned === 'boolean' ? highOrUnsigned : Boolean(unsigned);
1261
+ const high = typeof highOrUnsigned === 'number' ? highOrUnsigned : 0;
1262
+ const res = typeof lowOrValue === 'string'
1263
+ ? Long.fromString(lowOrValue, unsignedBool)
1264
+ : typeof lowOrValue === 'bigint'
1265
+ ? Long.fromBigInt(lowOrValue, unsignedBool)
1266
+ : { low: lowOrValue | 0, high: high | 0, unsigned: unsignedBool };
1267
+ this.low = res.low;
1268
+ this.high = res.high;
1269
+ this.unsigned = res.unsigned;
1270
+ }
1271
+ static TWO_PWR_24 = Long.fromInt(TWO_PWR_24_DBL);
1272
+ static MAX_UNSIGNED_VALUE = Long.fromBits(0xffffffff | 0, 0xffffffff | 0, true);
1273
+ static ZERO = Long.fromInt(0);
1274
+ static UZERO = Long.fromInt(0, true);
1275
+ static ONE = Long.fromInt(1);
1276
+ static UONE = Long.fromInt(1, true);
1277
+ static NEG_ONE = Long.fromInt(-1);
1278
+ static MAX_VALUE = Long.fromBits(0xffffffff | 0, 0x7fffffff | 0, false);
1279
+ static MIN_VALUE = Long.fromBits(0, 0x80000000 | 0, false);
1280
+ static fromBits(lowBits, highBits, unsigned) {
1281
+ return new Long(lowBits, highBits, unsigned);
1282
+ }
1283
+ static fromInt(value, unsigned) {
1284
+ let obj, cachedObj, cache;
1285
+ if (unsigned) {
1286
+ value >>>= 0;
1287
+ if ((cache = 0 <= value && value < 256)) {
1288
+ cachedObj = UINT_CACHE[value];
1289
+ if (cachedObj)
1290
+ return cachedObj;
1291
+ }
1292
+ obj = Long.fromBits(value, (value | 0) < 0 ? -1 : 0, true);
1293
+ if (cache)
1294
+ UINT_CACHE[value] = obj;
1295
+ return obj;
1296
+ }
1297
+ else {
1298
+ value |= 0;
1299
+ if ((cache = -128 <= value && value < 128)) {
1300
+ cachedObj = INT_CACHE[value];
1301
+ if (cachedObj)
1302
+ return cachedObj;
1303
+ }
1304
+ obj = Long.fromBits(value, value < 0 ? -1 : 0, false);
1305
+ if (cache)
1306
+ INT_CACHE[value] = obj;
1307
+ return obj;
1308
+ }
1309
+ }
1310
+ static fromNumber(value, unsigned) {
1311
+ if (isNaN(value))
1312
+ return unsigned ? Long.UZERO : Long.ZERO;
1313
+ if (unsigned) {
1314
+ if (value < 0)
1315
+ return Long.UZERO;
1316
+ if (value >= TWO_PWR_64_DBL)
1317
+ return Long.MAX_UNSIGNED_VALUE;
1318
+ }
1319
+ else {
1320
+ if (value <= -TWO_PWR_63_DBL)
1321
+ return Long.MIN_VALUE;
1322
+ if (value + 1 >= TWO_PWR_63_DBL)
1323
+ return Long.MAX_VALUE;
1324
+ }
1325
+ if (value < 0)
1326
+ return Long.fromNumber(-value, unsigned).neg();
1327
+ return Long.fromBits(value % TWO_PWR_32_DBL | 0, (value / TWO_PWR_32_DBL) | 0, unsigned);
1328
+ }
1329
+ static fromBigInt(value, unsigned) {
1330
+ const FROM_BIGINT_BIT_MASK = 0xffffffffn;
1331
+ const FROM_BIGINT_BIT_SHIFT = 32n;
1332
+ return new Long(Number(value & FROM_BIGINT_BIT_MASK), Number((value >> FROM_BIGINT_BIT_SHIFT) & FROM_BIGINT_BIT_MASK), unsigned);
1333
+ }
1334
+ static _fromString(str, unsigned, radix) {
1335
+ if (str.length === 0)
1336
+ throw new BSONError('empty string');
1337
+ if (radix < 2 || 36 < radix)
1338
+ throw new BSONError('radix');
1339
+ let p;
1340
+ if ((p = str.indexOf('-')) > 0)
1341
+ throw new BSONError('interior hyphen');
1342
+ else if (p === 0) {
1343
+ return Long._fromString(str.substring(1), unsigned, radix).neg();
1344
+ }
1345
+ const radixToPower = Long.fromNumber(Math.pow(radix, 8));
1346
+ let result = Long.ZERO;
1347
+ for (let i = 0; i < str.length; i += 8) {
1348
+ const size = Math.min(8, str.length - i), value = parseInt(str.substring(i, i + size), radix);
1349
+ if (size < 8) {
1350
+ const power = Long.fromNumber(Math.pow(radix, size));
1351
+ result = result.mul(power).add(Long.fromNumber(value));
1352
+ }
1353
+ else {
1354
+ result = result.mul(radixToPower);
1355
+ result = result.add(Long.fromNumber(value));
1356
+ }
1357
+ }
1358
+ result.unsigned = unsigned;
1359
+ return result;
1360
+ }
1361
+ static fromStringStrict(str, unsignedOrRadix, radix) {
1362
+ let unsigned = false;
1363
+ if (typeof unsignedOrRadix === 'number') {
1364
+ ((radix = unsignedOrRadix), (unsignedOrRadix = false));
1365
+ }
1366
+ else {
1367
+ unsigned = !!unsignedOrRadix;
1368
+ }
1369
+ radix ??= 10;
1370
+ if (str.trim() !== str) {
1371
+ throw new BSONError(`Input: '${str}' contains leading and/or trailing whitespace`);
1372
+ }
1373
+ if (!validateStringCharacters(str, radix)) {
1374
+ throw new BSONError(`Input: '${str}' contains invalid characters for radix: ${radix}`);
1375
+ }
1376
+ const cleanedStr = removeLeadingZerosAndExplicitPlus(str);
1377
+ const result = Long._fromString(cleanedStr, unsigned, radix);
1378
+ if (result.toString(radix).toLowerCase() !== cleanedStr.toLowerCase()) {
1379
+ throw new BSONError(`Input: ${str} is not representable as ${result.unsigned ? 'an unsigned' : 'a signed'} 64-bit Long ${radix != null ? `with radix: ${radix}` : ''}`);
1380
+ }
1381
+ return result;
1382
+ }
1383
+ static fromString(str, unsignedOrRadix, radix) {
1384
+ let unsigned = false;
1385
+ if (typeof unsignedOrRadix === 'number') {
1386
+ ((radix = unsignedOrRadix), (unsignedOrRadix = false));
1387
+ }
1388
+ else {
1389
+ unsigned = !!unsignedOrRadix;
1390
+ }
1391
+ radix ??= 10;
1392
+ if (str === 'NaN' && radix < 24) {
1393
+ return Long.ZERO;
1394
+ }
1395
+ else if ((str === 'Infinity' || str === '+Infinity' || str === '-Infinity') && radix < 35) {
1396
+ return Long.ZERO;
1397
+ }
1398
+ return Long._fromString(str, unsigned, radix);
1399
+ }
1400
+ static fromBytes(bytes, unsigned, le) {
1401
+ return le ? Long.fromBytesLE(bytes, unsigned) : Long.fromBytesBE(bytes, unsigned);
1402
+ }
1403
+ static fromBytesLE(bytes, unsigned) {
1404
+ return new Long(bytes[0] | (bytes[1] << 8) | (bytes[2] << 16) | (bytes[3] << 24), bytes[4] | (bytes[5] << 8) | (bytes[6] << 16) | (bytes[7] << 24), unsigned);
1405
+ }
1406
+ static fromBytesBE(bytes, unsigned) {
1407
+ return new Long((bytes[4] << 24) | (bytes[5] << 16) | (bytes[6] << 8) | bytes[7], (bytes[0] << 24) | (bytes[1] << 16) | (bytes[2] << 8) | bytes[3], unsigned);
1408
+ }
1409
+ static isLong(value) {
1410
+ return (value != null &&
1411
+ typeof value === 'object' &&
1412
+ '__isLong__' in value &&
1413
+ value.__isLong__ === true);
1414
+ }
1415
+ static fromValue(val, unsigned) {
1416
+ if (typeof val === 'number')
1417
+ return Long.fromNumber(val, unsigned);
1418
+ if (typeof val === 'string')
1419
+ return Long.fromString(val, unsigned);
1420
+ return Long.fromBits(val.low, val.high, typeof unsigned === 'boolean' ? unsigned : val.unsigned);
1421
+ }
1422
+ add(addend) {
1423
+ if (!Long.isLong(addend))
1424
+ addend = Long.fromValue(addend);
1425
+ const a48 = this.high >>> 16;
1426
+ const a32 = this.high & 0xffff;
1427
+ const a16 = this.low >>> 16;
1428
+ const a00 = this.low & 0xffff;
1429
+ const b48 = addend.high >>> 16;
1430
+ const b32 = addend.high & 0xffff;
1431
+ const b16 = addend.low >>> 16;
1432
+ const b00 = addend.low & 0xffff;
1433
+ let c48 = 0, c32 = 0, c16 = 0, c00 = 0;
1434
+ c00 += a00 + b00;
1435
+ c16 += c00 >>> 16;
1436
+ c00 &= 0xffff;
1437
+ c16 += a16 + b16;
1438
+ c32 += c16 >>> 16;
1439
+ c16 &= 0xffff;
1440
+ c32 += a32 + b32;
1441
+ c48 += c32 >>> 16;
1442
+ c32 &= 0xffff;
1443
+ c48 += a48 + b48;
1444
+ c48 &= 0xffff;
1445
+ return Long.fromBits((c16 << 16) | c00, (c48 << 16) | c32, this.unsigned);
1446
+ }
1447
+ and(other) {
1448
+ if (!Long.isLong(other))
1449
+ other = Long.fromValue(other);
1450
+ return Long.fromBits(this.low & other.low, this.high & other.high, this.unsigned);
1451
+ }
1452
+ compare(other) {
1453
+ if (!Long.isLong(other))
1454
+ other = Long.fromValue(other);
1455
+ if (this.eq(other))
1456
+ return 0;
1457
+ const thisNeg = this.isNegative(), otherNeg = other.isNegative();
1458
+ if (thisNeg && !otherNeg)
1459
+ return -1;
1460
+ if (!thisNeg && otherNeg)
1461
+ return 1;
1462
+ if (!this.unsigned)
1463
+ return this.sub(other).isNegative() ? -1 : 1;
1464
+ return other.high >>> 0 > this.high >>> 0 ||
1465
+ (other.high === this.high && other.low >>> 0 > this.low >>> 0)
1466
+ ? -1
1467
+ : 1;
1468
+ }
1469
+ comp(other) {
1470
+ return this.compare(other);
1471
+ }
1472
+ divide(divisor) {
1473
+ if (!Long.isLong(divisor))
1474
+ divisor = Long.fromValue(divisor);
1475
+ if (divisor.isZero())
1476
+ throw new BSONError('division by zero');
1477
+ if (wasm) {
1478
+ if (!this.unsigned &&
1479
+ this.high === -0x80000000 &&
1480
+ divisor.low === -1 &&
1481
+ divisor.high === -1) {
1482
+ return this;
1483
+ }
1484
+ const low = (this.unsigned ? wasm.div_u : wasm.div_s)(this.low, this.high, divisor.low, divisor.high);
1485
+ return Long.fromBits(low, wasm.get_high(), this.unsigned);
1486
+ }
1487
+ if (this.isZero())
1488
+ return this.unsigned ? Long.UZERO : Long.ZERO;
1489
+ let approx, rem, res;
1490
+ if (!this.unsigned) {
1491
+ if (this.eq(Long.MIN_VALUE)) {
1492
+ if (divisor.eq(Long.ONE) || divisor.eq(Long.NEG_ONE))
1493
+ return Long.MIN_VALUE;
1494
+ else if (divisor.eq(Long.MIN_VALUE))
1495
+ return Long.ONE;
1496
+ else {
1497
+ const halfThis = this.shr(1);
1498
+ approx = halfThis.div(divisor).shl(1);
1499
+ if (approx.eq(Long.ZERO)) {
1500
+ return divisor.isNegative() ? Long.ONE : Long.NEG_ONE;
1501
+ }
1502
+ else {
1503
+ rem = this.sub(divisor.mul(approx));
1504
+ res = approx.add(rem.div(divisor));
1505
+ return res;
1506
+ }
1507
+ }
1508
+ }
1509
+ else if (divisor.eq(Long.MIN_VALUE))
1510
+ return this.unsigned ? Long.UZERO : Long.ZERO;
1511
+ if (this.isNegative()) {
1512
+ if (divisor.isNegative())
1513
+ return this.neg().div(divisor.neg());
1514
+ return this.neg().div(divisor).neg();
1515
+ }
1516
+ else if (divisor.isNegative())
1517
+ return this.div(divisor.neg()).neg();
1518
+ res = Long.ZERO;
1519
+ }
1520
+ else {
1521
+ if (!divisor.unsigned)
1522
+ divisor = divisor.toUnsigned();
1523
+ if (divisor.gt(this))
1524
+ return Long.UZERO;
1525
+ if (divisor.gt(this.shru(1)))
1526
+ return Long.UONE;
1527
+ res = Long.UZERO;
1528
+ }
1529
+ rem = this;
1530
+ while (rem.gte(divisor)) {
1531
+ approx = Math.max(1, Math.floor(rem.toNumber() / divisor.toNumber()));
1532
+ const log2 = Math.ceil(Math.log(approx) / Math.LN2);
1533
+ const delta = log2 <= 48 ? 1 : Math.pow(2, log2 - 48);
1534
+ let approxRes = Long.fromNumber(approx);
1535
+ let approxRem = approxRes.mul(divisor);
1536
+ while (approxRem.isNegative() || approxRem.gt(rem)) {
1537
+ approx -= delta;
1538
+ approxRes = Long.fromNumber(approx, this.unsigned);
1539
+ approxRem = approxRes.mul(divisor);
1540
+ }
1541
+ if (approxRes.isZero())
1542
+ approxRes = Long.ONE;
1543
+ res = res.add(approxRes);
1544
+ rem = rem.sub(approxRem);
1545
+ }
1546
+ return res;
1547
+ }
1548
+ div(divisor) {
1549
+ return this.divide(divisor);
1550
+ }
1551
+ equals(other) {
1552
+ if (!Long.isLong(other))
1553
+ other = Long.fromValue(other);
1554
+ if (this.unsigned !== other.unsigned && this.high >>> 31 === 1 && other.high >>> 31 === 1)
1555
+ return false;
1556
+ return this.high === other.high && this.low === other.low;
1557
+ }
1558
+ eq(other) {
1559
+ return this.equals(other);
1560
+ }
1561
+ getHighBits() {
1562
+ return this.high;
1563
+ }
1564
+ getHighBitsUnsigned() {
1565
+ return this.high >>> 0;
1566
+ }
1567
+ getLowBits() {
1568
+ return this.low;
1569
+ }
1570
+ getLowBitsUnsigned() {
1571
+ return this.low >>> 0;
1572
+ }
1573
+ getNumBitsAbs() {
1574
+ if (this.isNegative()) {
1575
+ return this.eq(Long.MIN_VALUE) ? 64 : this.neg().getNumBitsAbs();
1576
+ }
1577
+ const val = this.high !== 0 ? this.high : this.low;
1578
+ let bit;
1579
+ for (bit = 31; bit > 0; bit--)
1580
+ if ((val & (1 << bit)) !== 0)
1581
+ break;
1582
+ return this.high !== 0 ? bit + 33 : bit + 1;
1583
+ }
1584
+ greaterThan(other) {
1585
+ return this.comp(other) > 0;
1586
+ }
1587
+ gt(other) {
1588
+ return this.greaterThan(other);
1589
+ }
1590
+ greaterThanOrEqual(other) {
1591
+ return this.comp(other) >= 0;
1592
+ }
1593
+ gte(other) {
1594
+ return this.greaterThanOrEqual(other);
1595
+ }
1596
+ ge(other) {
1597
+ return this.greaterThanOrEqual(other);
1598
+ }
1599
+ isEven() {
1600
+ return (this.low & 1) === 0;
1601
+ }
1602
+ isNegative() {
1603
+ return !this.unsigned && this.high < 0;
1604
+ }
1605
+ isOdd() {
1606
+ return (this.low & 1) === 1;
1607
+ }
1608
+ isPositive() {
1609
+ return this.unsigned || this.high >= 0;
1610
+ }
1611
+ isZero() {
1612
+ return this.high === 0 && this.low === 0;
1613
+ }
1614
+ lessThan(other) {
1615
+ return this.comp(other) < 0;
1616
+ }
1617
+ lt(other) {
1618
+ return this.lessThan(other);
1619
+ }
1620
+ lessThanOrEqual(other) {
1621
+ return this.comp(other) <= 0;
1622
+ }
1623
+ lte(other) {
1624
+ return this.lessThanOrEqual(other);
1625
+ }
1626
+ modulo(divisor) {
1627
+ if (!Long.isLong(divisor))
1628
+ divisor = Long.fromValue(divisor);
1629
+ if (wasm) {
1630
+ const low = (this.unsigned ? wasm.rem_u : wasm.rem_s)(this.low, this.high, divisor.low, divisor.high);
1631
+ return Long.fromBits(low, wasm.get_high(), this.unsigned);
1632
+ }
1633
+ return this.sub(this.div(divisor).mul(divisor));
1634
+ }
1635
+ mod(divisor) {
1636
+ return this.modulo(divisor);
1637
+ }
1638
+ rem(divisor) {
1639
+ return this.modulo(divisor);
1640
+ }
1641
+ multiply(multiplier) {
1642
+ if (this.isZero())
1643
+ return Long.ZERO;
1644
+ if (!Long.isLong(multiplier))
1645
+ multiplier = Long.fromValue(multiplier);
1646
+ if (wasm) {
1647
+ const low = wasm.mul(this.low, this.high, multiplier.low, multiplier.high);
1648
+ return Long.fromBits(low, wasm.get_high(), this.unsigned);
1649
+ }
1650
+ if (multiplier.isZero())
1651
+ return Long.ZERO;
1652
+ if (this.eq(Long.MIN_VALUE))
1653
+ return multiplier.isOdd() ? Long.MIN_VALUE : Long.ZERO;
1654
+ if (multiplier.eq(Long.MIN_VALUE))
1655
+ return this.isOdd() ? Long.MIN_VALUE : Long.ZERO;
1656
+ if (this.isNegative()) {
1657
+ if (multiplier.isNegative())
1658
+ return this.neg().mul(multiplier.neg());
1659
+ else
1660
+ return this.neg().mul(multiplier).neg();
1661
+ }
1662
+ else if (multiplier.isNegative())
1663
+ return this.mul(multiplier.neg()).neg();
1664
+ if (this.lt(Long.TWO_PWR_24) && multiplier.lt(Long.TWO_PWR_24))
1665
+ return Long.fromNumber(this.toNumber() * multiplier.toNumber(), this.unsigned);
1666
+ const a48 = this.high >>> 16;
1667
+ const a32 = this.high & 0xffff;
1668
+ const a16 = this.low >>> 16;
1669
+ const a00 = this.low & 0xffff;
1670
+ const b48 = multiplier.high >>> 16;
1671
+ const b32 = multiplier.high & 0xffff;
1672
+ const b16 = multiplier.low >>> 16;
1673
+ const b00 = multiplier.low & 0xffff;
1674
+ let c48 = 0, c32 = 0, c16 = 0, c00 = 0;
1675
+ c00 += a00 * b00;
1676
+ c16 += c00 >>> 16;
1677
+ c00 &= 0xffff;
1678
+ c16 += a16 * b00;
1679
+ c32 += c16 >>> 16;
1680
+ c16 &= 0xffff;
1681
+ c16 += a00 * b16;
1682
+ c32 += c16 >>> 16;
1683
+ c16 &= 0xffff;
1684
+ c32 += a32 * b00;
1685
+ c48 += c32 >>> 16;
1686
+ c32 &= 0xffff;
1687
+ c32 += a16 * b16;
1688
+ c48 += c32 >>> 16;
1689
+ c32 &= 0xffff;
1690
+ c32 += a00 * b32;
1691
+ c48 += c32 >>> 16;
1692
+ c32 &= 0xffff;
1693
+ c48 += a48 * b00 + a32 * b16 + a16 * b32 + a00 * b48;
1694
+ c48 &= 0xffff;
1695
+ return Long.fromBits((c16 << 16) | c00, (c48 << 16) | c32, this.unsigned);
1696
+ }
1697
+ mul(multiplier) {
1698
+ return this.multiply(multiplier);
1699
+ }
1700
+ negate() {
1701
+ if (!this.unsigned && this.eq(Long.MIN_VALUE))
1702
+ return Long.MIN_VALUE;
1703
+ return this.not().add(Long.ONE);
1704
+ }
1705
+ neg() {
1706
+ return this.negate();
1707
+ }
1708
+ not() {
1709
+ return Long.fromBits(~this.low, ~this.high, this.unsigned);
1710
+ }
1711
+ notEquals(other) {
1712
+ return !this.equals(other);
1713
+ }
1714
+ neq(other) {
1715
+ return this.notEquals(other);
1716
+ }
1717
+ ne(other) {
1718
+ return this.notEquals(other);
1719
+ }
1720
+ or(other) {
1721
+ if (!Long.isLong(other))
1722
+ other = Long.fromValue(other);
1723
+ return Long.fromBits(this.low | other.low, this.high | other.high, this.unsigned);
1724
+ }
1725
+ shiftLeft(numBits) {
1726
+ if (Long.isLong(numBits))
1727
+ numBits = numBits.toInt();
1728
+ if ((numBits &= 63) === 0)
1729
+ return this;
1730
+ else if (numBits < 32)
1731
+ return Long.fromBits(this.low << numBits, (this.high << numBits) | (this.low >>> (32 - numBits)), this.unsigned);
1732
+ else
1733
+ return Long.fromBits(0, this.low << (numBits - 32), this.unsigned);
1734
+ }
1735
+ shl(numBits) {
1736
+ return this.shiftLeft(numBits);
1737
+ }
1738
+ shiftRight(numBits) {
1739
+ if (Long.isLong(numBits))
1740
+ numBits = numBits.toInt();
1741
+ if ((numBits &= 63) === 0)
1742
+ return this;
1743
+ else if (numBits < 32)
1744
+ return Long.fromBits((this.low >>> numBits) | (this.high << (32 - numBits)), this.high >> numBits, this.unsigned);
1745
+ else
1746
+ return Long.fromBits(this.high >> (numBits - 32), this.high >= 0 ? 0 : -1, this.unsigned);
1747
+ }
1748
+ shr(numBits) {
1749
+ return this.shiftRight(numBits);
1750
+ }
1751
+ shiftRightUnsigned(numBits) {
1752
+ if (Long.isLong(numBits))
1753
+ numBits = numBits.toInt();
1754
+ numBits &= 63;
1755
+ if (numBits === 0)
1756
+ return this;
1757
+ else {
1758
+ const high = this.high;
1759
+ if (numBits < 32) {
1760
+ const low = this.low;
1761
+ return Long.fromBits((low >>> numBits) | (high << (32 - numBits)), high >>> numBits, this.unsigned);
1762
+ }
1763
+ else if (numBits === 32)
1764
+ return Long.fromBits(high, 0, this.unsigned);
1765
+ else
1766
+ return Long.fromBits(high >>> (numBits - 32), 0, this.unsigned);
1767
+ }
1768
+ }
1769
+ shr_u(numBits) {
1770
+ return this.shiftRightUnsigned(numBits);
1771
+ }
1772
+ shru(numBits) {
1773
+ return this.shiftRightUnsigned(numBits);
1774
+ }
1775
+ subtract(subtrahend) {
1776
+ if (!Long.isLong(subtrahend))
1777
+ subtrahend = Long.fromValue(subtrahend);
1778
+ return this.add(subtrahend.neg());
1779
+ }
1780
+ sub(subtrahend) {
1781
+ return this.subtract(subtrahend);
1782
+ }
1783
+ toInt() {
1784
+ return this.unsigned ? this.low >>> 0 : this.low;
1785
+ }
1786
+ toNumber() {
1787
+ if (this.unsigned)
1788
+ return (this.high >>> 0) * TWO_PWR_32_DBL + (this.low >>> 0);
1789
+ return this.high * TWO_PWR_32_DBL + (this.low >>> 0);
1790
+ }
1791
+ toBigInt() {
1792
+ return BigInt(this.toString());
1793
+ }
1794
+ toBytes(le) {
1795
+ return le ? this.toBytesLE() : this.toBytesBE();
1796
+ }
1797
+ toBytesLE() {
1798
+ const hi = this.high, lo = this.low;
1799
+ return [
1800
+ lo & 0xff,
1801
+ (lo >>> 8) & 0xff,
1802
+ (lo >>> 16) & 0xff,
1803
+ lo >>> 24,
1804
+ hi & 0xff,
1805
+ (hi >>> 8) & 0xff,
1806
+ (hi >>> 16) & 0xff,
1807
+ hi >>> 24
1808
+ ];
1809
+ }
1810
+ toBytesBE() {
1811
+ const hi = this.high, lo = this.low;
1812
+ return [
1813
+ hi >>> 24,
1814
+ (hi >>> 16) & 0xff,
1815
+ (hi >>> 8) & 0xff,
1816
+ hi & 0xff,
1817
+ lo >>> 24,
1818
+ (lo >>> 16) & 0xff,
1819
+ (lo >>> 8) & 0xff,
1820
+ lo & 0xff
1821
+ ];
1822
+ }
1823
+ toSigned() {
1824
+ if (!this.unsigned)
1825
+ return this;
1826
+ return Long.fromBits(this.low, this.high, false);
1827
+ }
1828
+ toString(radix) {
1829
+ radix = radix || 10;
1830
+ if (radix < 2 || 36 < radix)
1831
+ throw new BSONError('radix');
1832
+ if (this.isZero())
1833
+ return '0';
1834
+ if (this.isNegative()) {
1835
+ if (this.eq(Long.MIN_VALUE)) {
1836
+ const radixLong = Long.fromNumber(radix), div = this.div(radixLong), rem1 = div.mul(radixLong).sub(this);
1837
+ return div.toString(radix) + rem1.toInt().toString(radix);
1838
+ }
1839
+ else
1840
+ return '-' + this.neg().toString(radix);
1841
+ }
1842
+ const radixToPower = Long.fromNumber(Math.pow(radix, 6), this.unsigned);
1843
+ let rem = this;
1844
+ let result = '';
1845
+ while (true) {
1846
+ const remDiv = rem.div(radixToPower);
1847
+ const intval = rem.sub(remDiv.mul(radixToPower)).toInt() >>> 0;
1848
+ let digits = intval.toString(radix);
1849
+ rem = remDiv;
1850
+ if (rem.isZero()) {
1851
+ return digits + result;
1852
+ }
1853
+ else {
1854
+ while (digits.length < 6)
1855
+ digits = '0' + digits;
1856
+ result = '' + digits + result;
1857
+ }
1858
+ }
1859
+ }
1860
+ toUnsigned() {
1861
+ if (this.unsigned)
1862
+ return this;
1863
+ return Long.fromBits(this.low, this.high, true);
1864
+ }
1865
+ xor(other) {
1866
+ if (!Long.isLong(other))
1867
+ other = Long.fromValue(other);
1868
+ return Long.fromBits(this.low ^ other.low, this.high ^ other.high, this.unsigned);
1869
+ }
1870
+ eqz() {
1871
+ return this.isZero();
1872
+ }
1873
+ le(other) {
1874
+ return this.lessThanOrEqual(other);
1875
+ }
1876
+ toExtendedJSON(options) {
1877
+ if (options && options.relaxed)
1878
+ return this.toNumber();
1879
+ return { $numberLong: this.toString() };
1880
+ }
1881
+ static fromExtendedJSON(doc, options) {
1882
+ const { useBigInt64 = false, relaxed = true } = { ...options };
1883
+ if (doc.$numberLong.length > MAX_INT64_STRING_LENGTH) {
1884
+ throw new BSONError('$numberLong string is too long');
1885
+ }
1886
+ if (!DECIMAL_REG_EX.test(doc.$numberLong)) {
1887
+ throw new BSONError(`$numberLong string "${doc.$numberLong}" is in an invalid format`);
1888
+ }
1889
+ if (useBigInt64) {
1890
+ const bigIntResult = BigInt(doc.$numberLong);
1891
+ return BigInt.asIntN(64, bigIntResult);
1892
+ }
1893
+ const longResult = Long.fromString(doc.$numberLong);
1894
+ if (relaxed) {
1895
+ return longResult.toNumber();
1896
+ }
1897
+ return longResult;
1898
+ }
1899
+ inspect(depth, options, inspect) {
1900
+ inspect ??= defaultInspect;
1901
+ const longVal = inspect(this.toString(), options);
1902
+ const unsignedVal = this.unsigned ? `, ${inspect(this.unsigned, options)}` : '';
1903
+ return `new Long(${longVal}${unsignedVal})`;
1904
+ }
1905
+ }
1906
+
1907
+ const PARSE_STRING_REGEXP = /^(\+|-)?(\d+|(\d*\.\d*))?(E|e)?([-+])?(\d+)?$/;
1908
+ const PARSE_INF_REGEXP = /^(\+|-)?(Infinity|inf)$/i;
1909
+ const PARSE_NAN_REGEXP = /^(\+|-)?NaN$/i;
1910
+ const EXPONENT_MAX = 6111;
1911
+ const EXPONENT_MIN = -6176;
1912
+ const EXPONENT_BIAS = 6176;
1913
+ const MAX_DIGITS = 34;
1914
+ const NAN_BUFFER = ByteUtils.fromNumberArray([
1915
+ 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
1916
+ ].reverse());
1917
+ const INF_NEGATIVE_BUFFER = ByteUtils.fromNumberArray([
1918
+ 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
1919
+ ].reverse());
1920
+ const INF_POSITIVE_BUFFER = ByteUtils.fromNumberArray([
1921
+ 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
1922
+ ].reverse());
1923
+ const EXPONENT_REGEX = /^([-+])?(\d+)?$/;
1924
+ const COMBINATION_MASK = 0x1f;
1925
+ const EXPONENT_MASK = 0x3fff;
1926
+ const COMBINATION_INFINITY = 30;
1927
+ const COMBINATION_NAN = 31;
1928
+ function isDigit(value) {
1929
+ return !isNaN(parseInt(value, 10));
1930
+ }
1931
+ function divideu128(value) {
1932
+ const DIVISOR = Long.fromNumber(1000 * 1000 * 1000);
1933
+ let _rem = Long.fromNumber(0);
1934
+ if (!value.parts[0] && !value.parts[1] && !value.parts[2] && !value.parts[3]) {
1935
+ return { quotient: value, rem: _rem };
1936
+ }
1937
+ for (let i = 0; i <= 3; i++) {
1938
+ _rem = _rem.shiftLeft(32);
1939
+ _rem = _rem.add(new Long(value.parts[i], 0));
1940
+ value.parts[i] = _rem.div(DIVISOR).low;
1941
+ _rem = _rem.modulo(DIVISOR);
1942
+ }
1943
+ return { quotient: value, rem: _rem };
1944
+ }
1945
+ function multiply64x2(left, right) {
1946
+ if (!left && !right) {
1947
+ return { high: Long.fromNumber(0), low: Long.fromNumber(0) };
1948
+ }
1949
+ const leftHigh = left.shiftRightUnsigned(32);
1950
+ const leftLow = new Long(left.getLowBits(), 0);
1951
+ const rightHigh = right.shiftRightUnsigned(32);
1952
+ const rightLow = new Long(right.getLowBits(), 0);
1953
+ let productHigh = leftHigh.multiply(rightHigh);
1954
+ let productMid = leftHigh.multiply(rightLow);
1955
+ const productMid2 = leftLow.multiply(rightHigh);
1956
+ let productLow = leftLow.multiply(rightLow);
1957
+ productHigh = productHigh.add(productMid.shiftRightUnsigned(32));
1958
+ productMid = new Long(productMid.getLowBits(), 0)
1959
+ .add(productMid2)
1960
+ .add(productLow.shiftRightUnsigned(32));
1961
+ productHigh = productHigh.add(productMid.shiftRightUnsigned(32));
1962
+ productLow = productMid.shiftLeft(32).add(new Long(productLow.getLowBits(), 0));
1963
+ return { high: productHigh, low: productLow };
1964
+ }
1965
+ function lessThan(left, right) {
1966
+ const uhleft = left.high >>> 0;
1967
+ const uhright = right.high >>> 0;
1968
+ if (uhleft < uhright) {
1969
+ return true;
1970
+ }
1971
+ else if (uhleft === uhright) {
1972
+ const ulleft = left.low >>> 0;
1973
+ const ulright = right.low >>> 0;
1974
+ if (ulleft < ulright)
1975
+ return true;
1976
+ }
1977
+ return false;
1978
+ }
1979
+ function invalidErr(string, message) {
1980
+ throw new BSONError(`"${string}" is not a valid Decimal128 string - ${message}`);
1981
+ }
1982
+ class Decimal128 extends BSONValue {
1983
+ get _bsontype() {
1984
+ return 'Decimal128';
1985
+ }
1986
+ bytes;
1987
+ constructor(bytes) {
1988
+ super();
1989
+ if (typeof bytes === 'string') {
1990
+ this.bytes = Decimal128.fromString(bytes).bytes;
1991
+ }
1992
+ else if (bytes instanceof Uint8Array || isUint8Array(bytes)) {
1993
+ if (bytes.byteLength !== 16) {
1994
+ throw new BSONError('Decimal128 must take a Buffer of 16 bytes');
1995
+ }
1996
+ this.bytes = bytes;
1997
+ }
1998
+ else {
1999
+ throw new BSONError('Decimal128 must take a Buffer or string');
2000
+ }
2001
+ }
2002
+ static fromString(representation) {
2003
+ return Decimal128._fromString(representation, { allowRounding: false });
2004
+ }
2005
+ static fromStringWithRounding(representation) {
2006
+ return Decimal128._fromString(representation, { allowRounding: true });
2007
+ }
2008
+ static _fromString(representation, options) {
2009
+ let isNegative = false;
2010
+ let sawSign = false;
2011
+ let sawRadix = false;
2012
+ let foundNonZero = false;
2013
+ let significantDigits = 0;
2014
+ let nDigitsRead = 0;
2015
+ let nDigits = 0;
2016
+ let radixPosition = 0;
2017
+ let firstNonZero = 0;
2018
+ const digits = [0];
2019
+ let nDigitsStored = 0;
2020
+ let digitsInsert = 0;
2021
+ let lastDigit = 0;
2022
+ let exponent = 0;
2023
+ let significandHigh = new Long(0, 0);
2024
+ let significandLow = new Long(0, 0);
2025
+ let biasedExponent = 0;
2026
+ let index = 0;
2027
+ if (representation.length >= 7000) {
2028
+ throw new BSONError('' + representation + ' not a valid Decimal128 string');
2029
+ }
2030
+ const stringMatch = representation.match(PARSE_STRING_REGEXP);
2031
+ const infMatch = representation.match(PARSE_INF_REGEXP);
2032
+ const nanMatch = representation.match(PARSE_NAN_REGEXP);
2033
+ if ((!stringMatch && !infMatch && !nanMatch) || representation.length === 0) {
2034
+ throw new BSONError('' + representation + ' not a valid Decimal128 string');
2035
+ }
2036
+ if (stringMatch) {
2037
+ const unsignedNumber = stringMatch[2];
2038
+ const e = stringMatch[4];
2039
+ const expSign = stringMatch[5];
2040
+ const expNumber = stringMatch[6];
2041
+ if (e && expNumber === undefined)
2042
+ invalidErr(representation, 'missing exponent power');
2043
+ if (e && unsignedNumber === undefined)
2044
+ invalidErr(representation, 'missing exponent base');
2045
+ if (e === undefined && (expSign || expNumber)) {
2046
+ invalidErr(representation, 'missing e before exponent');
2047
+ }
2048
+ }
2049
+ if (representation[index] === '+' || representation[index] === '-') {
2050
+ sawSign = true;
2051
+ isNegative = representation[index++] === '-';
2052
+ }
2053
+ if (!isDigit(representation[index]) && representation[index] !== '.') {
2054
+ if (representation[index] === 'i' || representation[index] === 'I') {
2055
+ return new Decimal128(isNegative ? INF_NEGATIVE_BUFFER : INF_POSITIVE_BUFFER);
2056
+ }
2057
+ else if (representation[index] === 'N') {
2058
+ return new Decimal128(NAN_BUFFER);
2059
+ }
2060
+ }
2061
+ while (isDigit(representation[index]) || representation[index] === '.') {
2062
+ if (representation[index] === '.') {
2063
+ if (sawRadix)
2064
+ invalidErr(representation, 'contains multiple periods');
2065
+ sawRadix = true;
2066
+ index = index + 1;
2067
+ continue;
2068
+ }
2069
+ if (nDigitsStored < MAX_DIGITS) {
2070
+ if (representation[index] !== '0' || foundNonZero) {
2071
+ if (!foundNonZero) {
2072
+ firstNonZero = nDigitsRead;
2073
+ }
2074
+ foundNonZero = true;
2075
+ digits[digitsInsert++] = parseInt(representation[index], 10);
2076
+ nDigitsStored = nDigitsStored + 1;
2077
+ }
2078
+ }
2079
+ if (foundNonZero)
2080
+ nDigits = nDigits + 1;
2081
+ if (sawRadix)
2082
+ radixPosition = radixPosition + 1;
2083
+ nDigitsRead = nDigitsRead + 1;
2084
+ index = index + 1;
2085
+ }
2086
+ if (sawRadix && !nDigitsRead)
2087
+ throw new BSONError('' + representation + ' not a valid Decimal128 string');
2088
+ if (representation[index] === 'e' || representation[index] === 'E') {
2089
+ const match = representation.substr(++index).match(EXPONENT_REGEX);
2090
+ if (!match || !match[2])
2091
+ return new Decimal128(NAN_BUFFER);
2092
+ exponent = parseInt(match[0], 10);
2093
+ index = index + match[0].length;
2094
+ }
2095
+ if (representation[index])
2096
+ return new Decimal128(NAN_BUFFER);
2097
+ if (!nDigitsStored) {
2098
+ digits[0] = 0;
2099
+ nDigits = 1;
2100
+ nDigitsStored = 1;
2101
+ significantDigits = 0;
2102
+ }
2103
+ else {
2104
+ lastDigit = nDigitsStored - 1;
2105
+ significantDigits = nDigits;
2106
+ if (significantDigits !== 1) {
2107
+ while (representation[firstNonZero + significantDigits - 1 + Number(sawSign) + Number(sawRadix)] === '0') {
2108
+ significantDigits = significantDigits - 1;
2109
+ }
2110
+ }
2111
+ }
2112
+ if (exponent <= radixPosition && radixPosition > exponent + (1 << 14)) {
2113
+ exponent = EXPONENT_MIN;
2114
+ }
2115
+ else {
2116
+ exponent = exponent - radixPosition;
2117
+ }
2118
+ while (exponent > EXPONENT_MAX) {
2119
+ lastDigit = lastDigit + 1;
2120
+ if (lastDigit >= MAX_DIGITS) {
2121
+ if (significantDigits === 0) {
2122
+ exponent = EXPONENT_MAX;
2123
+ break;
2124
+ }
2125
+ invalidErr(representation, 'overflow');
2126
+ }
2127
+ exponent = exponent - 1;
2128
+ }
2129
+ if (options.allowRounding) {
2130
+ while (exponent < EXPONENT_MIN || nDigitsStored < nDigits) {
2131
+ if (lastDigit === 0 && significantDigits < nDigitsStored) {
2132
+ exponent = EXPONENT_MIN;
2133
+ significantDigits = 0;
2134
+ break;
2135
+ }
2136
+ if (nDigitsStored < nDigits) {
2137
+ nDigits = nDigits - 1;
2138
+ }
2139
+ else {
2140
+ lastDigit = lastDigit - 1;
2141
+ }
2142
+ if (exponent < EXPONENT_MAX) {
2143
+ exponent = exponent + 1;
2144
+ }
2145
+ else {
2146
+ const digitsString = digits.join('');
2147
+ if (digitsString.match(/^0+$/)) {
2148
+ exponent = EXPONENT_MAX;
2149
+ break;
2150
+ }
2151
+ invalidErr(representation, 'overflow');
2152
+ }
2153
+ }
2154
+ if (lastDigit + 1 < significantDigits) {
2155
+ let endOfString = nDigitsRead;
2156
+ if (sawRadix) {
2157
+ firstNonZero = firstNonZero + 1;
2158
+ endOfString = endOfString + 1;
2159
+ }
2160
+ if (sawSign) {
2161
+ firstNonZero = firstNonZero + 1;
2162
+ endOfString = endOfString + 1;
2163
+ }
2164
+ const roundDigit = parseInt(representation[firstNonZero + lastDigit + 1], 10);
2165
+ let roundBit = 0;
2166
+ if (roundDigit >= 5) {
2167
+ roundBit = 1;
2168
+ if (roundDigit === 5) {
2169
+ roundBit = digits[lastDigit] % 2 === 1 ? 1 : 0;
2170
+ for (let i = firstNonZero + lastDigit + 2; i < endOfString; i++) {
2171
+ if (parseInt(representation[i], 10)) {
2172
+ roundBit = 1;
2173
+ break;
2174
+ }
2175
+ }
2176
+ }
2177
+ }
2178
+ if (roundBit) {
2179
+ let dIdx = lastDigit;
2180
+ for (; dIdx >= 0; dIdx--) {
2181
+ if (++digits[dIdx] > 9) {
2182
+ digits[dIdx] = 0;
2183
+ if (dIdx === 0) {
2184
+ if (exponent < EXPONENT_MAX) {
2185
+ exponent = exponent + 1;
2186
+ digits[dIdx] = 1;
2187
+ }
2188
+ else {
2189
+ return new Decimal128(isNegative ? INF_NEGATIVE_BUFFER : INF_POSITIVE_BUFFER);
2190
+ }
2191
+ }
2192
+ }
2193
+ else {
2194
+ break;
2195
+ }
2196
+ }
2197
+ }
2198
+ }
2199
+ }
2200
+ else {
2201
+ while (exponent < EXPONENT_MIN || nDigitsStored < nDigits) {
2202
+ if (lastDigit === 0) {
2203
+ if (significantDigits === 0) {
2204
+ exponent = EXPONENT_MIN;
2205
+ break;
2206
+ }
2207
+ invalidErr(representation, 'exponent underflow');
2208
+ }
2209
+ if (nDigitsStored < nDigits) {
2210
+ if (representation[nDigits - 1 + Number(sawSign) + Number(sawRadix)] !== '0' &&
2211
+ significantDigits !== 0) {
2212
+ invalidErr(representation, 'inexact rounding');
2213
+ }
2214
+ nDigits = nDigits - 1;
2215
+ }
2216
+ else {
2217
+ if (digits[lastDigit] !== 0) {
2218
+ invalidErr(representation, 'inexact rounding');
2219
+ }
2220
+ lastDigit = lastDigit - 1;
2221
+ }
2222
+ if (exponent < EXPONENT_MAX) {
2223
+ exponent = exponent + 1;
2224
+ }
2225
+ else {
2226
+ invalidErr(representation, 'overflow');
2227
+ }
2228
+ }
2229
+ if (lastDigit + 1 < significantDigits) {
2230
+ if (sawRadix) {
2231
+ firstNonZero = firstNonZero + 1;
2232
+ }
2233
+ if (sawSign) {
2234
+ firstNonZero = firstNonZero + 1;
2235
+ }
2236
+ const roundDigit = parseInt(representation[firstNonZero + lastDigit + 1], 10);
2237
+ if (roundDigit !== 0) {
2238
+ invalidErr(representation, 'inexact rounding');
2239
+ }
2240
+ }
2241
+ }
2242
+ significandHigh = Long.fromNumber(0);
2243
+ significandLow = Long.fromNumber(0);
2244
+ if (significantDigits === 0) {
2245
+ significandHigh = Long.fromNumber(0);
2246
+ significandLow = Long.fromNumber(0);
2247
+ }
2248
+ else if (lastDigit < 17) {
2249
+ let dIdx = 0;
2250
+ significandLow = Long.fromNumber(digits[dIdx++]);
2251
+ significandHigh = new Long(0, 0);
2252
+ for (; dIdx <= lastDigit; dIdx++) {
2253
+ significandLow = significandLow.multiply(Long.fromNumber(10));
2254
+ significandLow = significandLow.add(Long.fromNumber(digits[dIdx]));
2255
+ }
2256
+ }
2257
+ else {
2258
+ let dIdx = 0;
2259
+ significandHigh = Long.fromNumber(digits[dIdx++]);
2260
+ for (; dIdx <= lastDigit - 17; dIdx++) {
2261
+ significandHigh = significandHigh.multiply(Long.fromNumber(10));
2262
+ significandHigh = significandHigh.add(Long.fromNumber(digits[dIdx]));
2263
+ }
2264
+ significandLow = Long.fromNumber(digits[dIdx++]);
2265
+ for (; dIdx <= lastDigit; dIdx++) {
2266
+ significandLow = significandLow.multiply(Long.fromNumber(10));
2267
+ significandLow = significandLow.add(Long.fromNumber(digits[dIdx]));
2268
+ }
2269
+ }
2270
+ const significand = multiply64x2(significandHigh, Long.fromString('100000000000000000'));
2271
+ significand.low = significand.low.add(significandLow);
2272
+ if (lessThan(significand.low, significandLow)) {
2273
+ significand.high = significand.high.add(Long.fromNumber(1));
2274
+ }
2275
+ biasedExponent = exponent + EXPONENT_BIAS;
2276
+ const dec = { low: Long.fromNumber(0), high: Long.fromNumber(0) };
2277
+ if (significand.high.shiftRightUnsigned(49).and(Long.fromNumber(1)).equals(Long.fromNumber(1))) {
2278
+ dec.high = dec.high.or(Long.fromNumber(0x3).shiftLeft(61));
2279
+ dec.high = dec.high.or(Long.fromNumber(biasedExponent).and(Long.fromNumber(0x3fff).shiftLeft(47)));
2280
+ dec.high = dec.high.or(significand.high.and(Long.fromNumber(0x7fffffffffff)));
2281
+ }
2282
+ else {
2283
+ dec.high = dec.high.or(Long.fromNumber(biasedExponent & 0x3fff).shiftLeft(49));
2284
+ dec.high = dec.high.or(significand.high.and(Long.fromNumber(0x1ffffffffffff)));
2285
+ }
2286
+ dec.low = significand.low;
2287
+ if (isNegative) {
2288
+ dec.high = dec.high.or(Long.fromString('9223372036854775808'));
2289
+ }
2290
+ const buffer = ByteUtils.allocateUnsafe(16);
2291
+ index = 0;
2292
+ buffer[index++] = dec.low.low & 0xff;
2293
+ buffer[index++] = (dec.low.low >> 8) & 0xff;
2294
+ buffer[index++] = (dec.low.low >> 16) & 0xff;
2295
+ buffer[index++] = (dec.low.low >> 24) & 0xff;
2296
+ buffer[index++] = dec.low.high & 0xff;
2297
+ buffer[index++] = (dec.low.high >> 8) & 0xff;
2298
+ buffer[index++] = (dec.low.high >> 16) & 0xff;
2299
+ buffer[index++] = (dec.low.high >> 24) & 0xff;
2300
+ buffer[index++] = dec.high.low & 0xff;
2301
+ buffer[index++] = (dec.high.low >> 8) & 0xff;
2302
+ buffer[index++] = (dec.high.low >> 16) & 0xff;
2303
+ buffer[index++] = (dec.high.low >> 24) & 0xff;
2304
+ buffer[index++] = dec.high.high & 0xff;
2305
+ buffer[index++] = (dec.high.high >> 8) & 0xff;
2306
+ buffer[index++] = (dec.high.high >> 16) & 0xff;
2307
+ buffer[index++] = (dec.high.high >> 24) & 0xff;
2308
+ return new Decimal128(buffer);
2309
+ }
2310
+ toString() {
2311
+ let biased_exponent;
2312
+ let significand_digits = 0;
2313
+ const significand = new Array(36);
2314
+ for (let i = 0; i < significand.length; i++)
2315
+ significand[i] = 0;
2316
+ let index = 0;
2317
+ let is_zero = false;
2318
+ let significand_msb;
2319
+ let significand128 = { parts: [0, 0, 0, 0] };
2320
+ let j, k;
2321
+ const string = [];
2322
+ index = 0;
2323
+ const buffer = this.bytes;
2324
+ const low = buffer[index++] | (buffer[index++] << 8) | (buffer[index++] << 16) | (buffer[index++] << 24);
2325
+ const midl = buffer[index++] | (buffer[index++] << 8) | (buffer[index++] << 16) | (buffer[index++] << 24);
2326
+ const midh = buffer[index++] | (buffer[index++] << 8) | (buffer[index++] << 16) | (buffer[index++] << 24);
2327
+ const high = buffer[index++] | (buffer[index++] << 8) | (buffer[index++] << 16) | (buffer[index++] << 24);
2328
+ index = 0;
2329
+ const dec = {
2330
+ low: new Long(low, midl),
2331
+ high: new Long(midh, high)
2332
+ };
2333
+ if (dec.high.lessThan(Long.ZERO)) {
2334
+ string.push('-');
2335
+ }
2336
+ const combination = (high >> 26) & COMBINATION_MASK;
2337
+ if (combination >> 3 === 3) {
2338
+ if (combination === COMBINATION_INFINITY) {
2339
+ return string.join('') + 'Infinity';
2340
+ }
2341
+ else if (combination === COMBINATION_NAN) {
2342
+ return 'NaN';
2343
+ }
2344
+ else {
2345
+ biased_exponent = (high >> 15) & EXPONENT_MASK;
2346
+ significand_msb = 0x08 + ((high >> 14) & 0x01);
2347
+ }
2348
+ }
2349
+ else {
2350
+ significand_msb = (high >> 14) & 0x07;
2351
+ biased_exponent = (high >> 17) & EXPONENT_MASK;
2352
+ }
2353
+ const exponent = biased_exponent - EXPONENT_BIAS;
2354
+ significand128.parts[0] = (high & 0x3fff) + ((significand_msb & 0xf) << 14);
2355
+ significand128.parts[1] = midh;
2356
+ significand128.parts[2] = midl;
2357
+ significand128.parts[3] = low;
2358
+ if (significand128.parts[0] === 0 &&
2359
+ significand128.parts[1] === 0 &&
2360
+ significand128.parts[2] === 0 &&
2361
+ significand128.parts[3] === 0) {
2362
+ is_zero = true;
2363
+ }
2364
+ else {
2365
+ for (k = 3; k >= 0; k--) {
2366
+ let least_digits = 0;
2367
+ const result = divideu128(significand128);
2368
+ significand128 = result.quotient;
2369
+ least_digits = result.rem.low;
2370
+ if (!least_digits)
2371
+ continue;
2372
+ for (j = 8; j >= 0; j--) {
2373
+ significand[k * 9 + j] = least_digits % 10;
2374
+ least_digits = Math.floor(least_digits / 10);
2375
+ }
2376
+ }
2377
+ }
2378
+ if (is_zero) {
2379
+ significand_digits = 1;
2380
+ significand[index] = 0;
2381
+ }
2382
+ else {
2383
+ significand_digits = 36;
2384
+ while (!significand[index]) {
2385
+ significand_digits = significand_digits - 1;
2386
+ index = index + 1;
2387
+ }
2388
+ }
2389
+ const scientific_exponent = significand_digits - 1 + exponent;
2390
+ if (scientific_exponent >= 34 || scientific_exponent <= -7 || exponent > 0) {
2391
+ if (significand_digits > 34) {
2392
+ string.push(`${0}`);
2393
+ if (exponent > 0)
2394
+ string.push(`E+${exponent}`);
2395
+ else if (exponent < 0)
2396
+ string.push(`E${exponent}`);
2397
+ return string.join('');
2398
+ }
2399
+ string.push(`${significand[index++]}`);
2400
+ significand_digits = significand_digits - 1;
2401
+ if (significand_digits) {
2402
+ string.push('.');
2403
+ }
2404
+ for (let i = 0; i < significand_digits; i++) {
2405
+ string.push(`${significand[index++]}`);
2406
+ }
2407
+ string.push('E');
2408
+ if (scientific_exponent > 0) {
2409
+ string.push(`+${scientific_exponent}`);
2410
+ }
2411
+ else {
2412
+ string.push(`${scientific_exponent}`);
2413
+ }
2414
+ }
2415
+ else {
2416
+ if (exponent >= 0) {
2417
+ for (let i = 0; i < significand_digits; i++) {
2418
+ string.push(`${significand[index++]}`);
2419
+ }
2420
+ }
2421
+ else {
2422
+ let radix_position = significand_digits + exponent;
2423
+ if (radix_position > 0) {
2424
+ for (let i = 0; i < radix_position; i++) {
2425
+ string.push(`${significand[index++]}`);
2426
+ }
2427
+ }
2428
+ else {
2429
+ string.push('0');
2430
+ }
2431
+ string.push('.');
2432
+ while (radix_position++ < 0) {
2433
+ string.push('0');
2434
+ }
2435
+ for (let i = 0; i < significand_digits - Math.max(radix_position - 1, 0); i++) {
2436
+ string.push(`${significand[index++]}`);
2437
+ }
2438
+ }
2439
+ }
2440
+ return string.join('');
2441
+ }
2442
+ toJSON() {
2443
+ return { $numberDecimal: this.toString() };
2444
+ }
2445
+ toExtendedJSON() {
2446
+ return { $numberDecimal: this.toString() };
2447
+ }
2448
+ static fromExtendedJSON(doc) {
2449
+ return Decimal128.fromString(doc.$numberDecimal);
2450
+ }
2451
+ inspect(depth, options, inspect) {
2452
+ inspect ??= defaultInspect;
2453
+ const d128string = inspect(this.toString(), options);
2454
+ return `new Decimal128(${d128string})`;
2455
+ }
2456
+ }
2457
+
2458
+ class Double extends BSONValue {
2459
+ get _bsontype() {
2460
+ return 'Double';
2461
+ }
2462
+ value;
2463
+ constructor(value) {
2464
+ super();
2465
+ if (value instanceof Number) {
2466
+ value = value.valueOf();
2467
+ }
2468
+ this.value = +value;
2469
+ }
2470
+ static fromString(value) {
2471
+ const coercedValue = Number(value);
2472
+ if (value === 'NaN')
2473
+ return new Double(NaN);
2474
+ if (value === 'Infinity')
2475
+ return new Double(Infinity);
2476
+ if (value === '-Infinity')
2477
+ return new Double(-Infinity);
2478
+ if (!Number.isFinite(coercedValue)) {
2479
+ throw new BSONError(`Input: ${value} is not representable as a Double`);
2480
+ }
2481
+ if (value.trim() !== value) {
2482
+ throw new BSONError(`Input: '${value}' contains whitespace`);
2483
+ }
2484
+ if (value === '') {
2485
+ throw new BSONError(`Input is an empty string`);
2486
+ }
2487
+ if (/[^-0-9.+eE]/.test(value)) {
2488
+ throw new BSONError(`Input: '${value}' is not in decimal or exponential notation`);
2489
+ }
2490
+ return new Double(coercedValue);
2491
+ }
2492
+ valueOf() {
2493
+ return this.value;
2494
+ }
2495
+ toJSON() {
2496
+ return this.value;
2497
+ }
2498
+ toString(radix) {
2499
+ return this.value.toString(radix);
2500
+ }
2501
+ toExtendedJSON(options) {
2502
+ if (options && (options.legacy || (options.relaxed && isFinite(this.value)))) {
2503
+ return this.value;
2504
+ }
2505
+ if (Object.is(Math.sign(this.value), -0)) {
2506
+ return { $numberDouble: '-0.0' };
2507
+ }
2508
+ return {
2509
+ $numberDouble: Number.isInteger(this.value) ? this.value.toFixed(1) : this.value.toString()
2510
+ };
2511
+ }
2512
+ static fromExtendedJSON(doc, options) {
2513
+ const doubleValue = parseFloat(doc.$numberDouble);
2514
+ return options && options.relaxed ? doubleValue : new Double(doubleValue);
2515
+ }
2516
+ inspect(depth, options, inspect) {
2517
+ inspect ??= defaultInspect;
2518
+ return `new Double(${inspect(this.value, options)})`;
2519
+ }
2520
+ }
2521
+
2522
+ class Int32 extends BSONValue {
2523
+ get _bsontype() {
2524
+ return 'Int32';
2525
+ }
2526
+ value;
2527
+ constructor(value) {
2528
+ super();
2529
+ if (value instanceof Number) {
2530
+ value = value.valueOf();
2531
+ }
2532
+ this.value = +value | 0;
2533
+ }
2534
+ static fromString(value) {
2535
+ const cleanedValue = removeLeadingZerosAndExplicitPlus(value);
2536
+ const coercedValue = Number(value);
2537
+ if (BSON_INT32_MAX < coercedValue) {
2538
+ throw new BSONError(`Input: '${value}' is larger than the maximum value for Int32`);
2539
+ }
2540
+ else if (BSON_INT32_MIN > coercedValue) {
2541
+ throw new BSONError(`Input: '${value}' is smaller than the minimum value for Int32`);
2542
+ }
2543
+ else if (!Number.isSafeInteger(coercedValue)) {
2544
+ throw new BSONError(`Input: '${value}' is not a safe integer`);
2545
+ }
2546
+ else if (coercedValue.toString() !== cleanedValue) {
2547
+ throw new BSONError(`Input: '${value}' is not a valid Int32 string`);
2548
+ }
2549
+ return new Int32(coercedValue);
2550
+ }
2551
+ valueOf() {
2552
+ return this.value;
2553
+ }
2554
+ toString(radix) {
2555
+ return this.value.toString(radix);
2556
+ }
2557
+ toJSON() {
2558
+ return this.value;
2559
+ }
2560
+ toExtendedJSON(options) {
2561
+ if (options && (options.relaxed || options.legacy))
2562
+ return this.value;
2563
+ return { $numberInt: this.value.toString() };
2564
+ }
2565
+ static fromExtendedJSON(doc, options) {
2566
+ return options && options.relaxed ? parseInt(doc.$numberInt, 10) : new Int32(doc.$numberInt);
2567
+ }
2568
+ inspect(depth, options, inspect) {
2569
+ inspect ??= defaultInspect;
2570
+ return `new Int32(${inspect(this.value, options)})`;
2571
+ }
2572
+ }
2573
+
2574
+ class MaxKey extends BSONValue {
2575
+ get _bsontype() {
2576
+ return 'MaxKey';
2577
+ }
2578
+ toExtendedJSON() {
2579
+ return { $maxKey: 1 };
2580
+ }
2581
+ static fromExtendedJSON() {
2582
+ return new MaxKey();
2583
+ }
2584
+ inspect() {
2585
+ return 'new MaxKey()';
2586
+ }
2587
+ }
2588
+
2589
+ class MinKey extends BSONValue {
2590
+ get _bsontype() {
2591
+ return 'MinKey';
2592
+ }
2593
+ toExtendedJSON() {
2594
+ return { $minKey: 1 };
2595
+ }
2596
+ static fromExtendedJSON() {
2597
+ return new MinKey();
2598
+ }
2599
+ inspect() {
2600
+ return 'new MinKey()';
2601
+ }
2602
+ }
2603
+
2604
+ let PROCESS_UNIQUE = null;
2605
+ const __idCache = new WeakMap();
2606
+ class ObjectId extends BSONValue {
2607
+ get _bsontype() {
2608
+ return 'ObjectId';
2609
+ }
2610
+ static index = Math.floor(Math.random() * 0xffffff);
2611
+ static cacheHexString;
2612
+ buffer;
2613
+ constructor(inputId) {
2614
+ super();
2615
+ let workingId;
2616
+ if (typeof inputId === 'object' && inputId && 'id' in inputId) {
2617
+ if (typeof inputId.id !== 'string' && !ArrayBuffer.isView(inputId.id)) {
2618
+ throw new BSONError('Argument passed in must have an id that is of type string or Buffer');
2619
+ }
2620
+ if ('toHexString' in inputId && typeof inputId.toHexString === 'function') {
2621
+ workingId = ByteUtils.fromHex(inputId.toHexString());
2622
+ }
2623
+ else {
2624
+ workingId = inputId.id;
2625
+ }
2626
+ }
2627
+ else {
2628
+ workingId = inputId;
2629
+ }
2630
+ if (workingId == null) {
2631
+ this.buffer = ObjectId.generate();
2632
+ }
2633
+ else if (ArrayBuffer.isView(workingId) && workingId.byteLength === 12) {
2634
+ this.buffer = ByteUtils.toLocalBufferType(workingId);
2635
+ }
2636
+ else if (typeof workingId === 'string') {
2637
+ if (ObjectId.validateHexString(workingId)) {
2638
+ this.buffer = ByteUtils.fromHex(workingId);
2639
+ if (ObjectId.cacheHexString) {
2640
+ __idCache.set(this, workingId);
2641
+ }
2642
+ }
2643
+ else {
2644
+ throw new BSONError('input must be a 24 character hex string, 12 byte Uint8Array, or an integer');
2645
+ }
2646
+ }
2647
+ else {
2648
+ throw new BSONError('Argument passed in does not match the accepted types');
2649
+ }
2650
+ }
2651
+ get id() {
2652
+ return this.buffer;
2653
+ }
2654
+ set id(value) {
2655
+ this.buffer = value;
2656
+ if (ObjectId.cacheHexString) {
2657
+ __idCache.set(this, ByteUtils.toHex(value));
2658
+ }
2659
+ }
2660
+ static validateHexString(string) {
2661
+ if (string?.length !== 24)
2662
+ return false;
2663
+ for (let i = 0; i < 24; i++) {
2664
+ const char = string.charCodeAt(i);
2665
+ if ((char >= 48 && char <= 57) ||
2666
+ (char >= 97 && char <= 102) ||
2667
+ (char >= 65 && char <= 70)) {
2668
+ continue;
2669
+ }
2670
+ return false;
2671
+ }
2672
+ return true;
2673
+ }
2674
+ toHexString() {
2675
+ if (ObjectId.cacheHexString) {
2676
+ const __id = __idCache.get(this);
2677
+ if (__id)
2678
+ return __id;
2679
+ }
2680
+ const hexString = ByteUtils.toHex(this.id);
2681
+ if (ObjectId.cacheHexString) {
2682
+ __idCache.set(this, hexString);
2683
+ }
2684
+ return hexString;
2685
+ }
2686
+ static getInc() {
2687
+ return (ObjectId.index = (ObjectId.index + 1) % 0xffffff);
2688
+ }
2689
+ static generate(time) {
2690
+ if ('number' !== typeof time) {
2691
+ time = Math.floor(Date.now() / 1000);
2692
+ }
2693
+ const inc = ObjectId.getInc();
2694
+ const buffer = ByteUtils.allocateUnsafe(12);
2695
+ NumberUtils.setInt32BE(buffer, 0, time);
2696
+ if (PROCESS_UNIQUE === null) {
2697
+ PROCESS_UNIQUE = ByteUtils.randomBytes(5);
2698
+ }
2699
+ buffer[4] = PROCESS_UNIQUE[0];
2700
+ buffer[5] = PROCESS_UNIQUE[1];
2701
+ buffer[6] = PROCESS_UNIQUE[2];
2702
+ buffer[7] = PROCESS_UNIQUE[3];
2703
+ buffer[8] = PROCESS_UNIQUE[4];
2704
+ buffer[11] = inc & 0xff;
2705
+ buffer[10] = (inc >> 8) & 0xff;
2706
+ buffer[9] = (inc >> 16) & 0xff;
2707
+ return buffer;
2708
+ }
2709
+ toString(encoding) {
2710
+ if (encoding === 'base64')
2711
+ return ByteUtils.toBase64(this.id);
2712
+ if (encoding === 'hex')
2713
+ return this.toHexString();
2714
+ return this.toHexString();
2715
+ }
2716
+ toJSON() {
2717
+ return this.toHexString();
2718
+ }
2719
+ static is(variable) {
2720
+ return (variable != null &&
2721
+ typeof variable === 'object' &&
2722
+ '_bsontype' in variable &&
2723
+ variable._bsontype === 'ObjectId');
2724
+ }
2725
+ equals(otherId) {
2726
+ if (otherId === undefined || otherId === null) {
2727
+ return false;
2728
+ }
2729
+ if (ObjectId.is(otherId)) {
2730
+ return (this.buffer[11] === otherId.buffer[11] && ByteUtils.equals(this.buffer, otherId.buffer));
2731
+ }
2732
+ if (typeof otherId === 'string') {
2733
+ return otherId.toLowerCase() === this.toHexString();
2734
+ }
2735
+ if (typeof otherId === 'object' && typeof otherId.toHexString === 'function') {
2736
+ const otherIdString = otherId.toHexString();
2737
+ const thisIdString = this.toHexString();
2738
+ return typeof otherIdString === 'string' && otherIdString.toLowerCase() === thisIdString;
2739
+ }
2740
+ return false;
2741
+ }
2742
+ getTimestamp() {
2743
+ const timestamp = new Date();
2744
+ const time = NumberUtils.getUint32BE(this.buffer, 0);
2745
+ timestamp.setTime(Math.floor(time) * 1000);
2746
+ return timestamp;
2747
+ }
2748
+ static createPk() {
2749
+ return new ObjectId();
2750
+ }
2751
+ serializeInto(uint8array, index) {
2752
+ uint8array[index] = this.buffer[0];
2753
+ uint8array[index + 1] = this.buffer[1];
2754
+ uint8array[index + 2] = this.buffer[2];
2755
+ uint8array[index + 3] = this.buffer[3];
2756
+ uint8array[index + 4] = this.buffer[4];
2757
+ uint8array[index + 5] = this.buffer[5];
2758
+ uint8array[index + 6] = this.buffer[6];
2759
+ uint8array[index + 7] = this.buffer[7];
2760
+ uint8array[index + 8] = this.buffer[8];
2761
+ uint8array[index + 9] = this.buffer[9];
2762
+ uint8array[index + 10] = this.buffer[10];
2763
+ uint8array[index + 11] = this.buffer[11];
2764
+ return 12;
2765
+ }
2766
+ static createFromTime(time) {
2767
+ const buffer = ByteUtils.allocate(12);
2768
+ for (let i = 11; i >= 4; i--)
2769
+ buffer[i] = 0;
2770
+ NumberUtils.setInt32BE(buffer, 0, time);
2771
+ return new ObjectId(buffer);
2772
+ }
2773
+ static createFromHexString(hexString) {
2774
+ if (hexString?.length !== 24) {
2775
+ throw new BSONError('hex string must be 24 characters');
2776
+ }
2777
+ return new ObjectId(ByteUtils.fromHex(hexString));
2778
+ }
2779
+ static createFromBase64(base64) {
2780
+ if (base64?.length !== 16) {
2781
+ throw new BSONError('base64 string must be 16 characters');
2782
+ }
2783
+ return new ObjectId(ByteUtils.fromBase64(base64));
2784
+ }
2785
+ static isValid(id) {
2786
+ if (id == null)
2787
+ return false;
2788
+ if (typeof id === 'string')
2789
+ return ObjectId.validateHexString(id);
2790
+ try {
2791
+ new ObjectId(id);
2792
+ return true;
2793
+ }
2794
+ catch {
2795
+ return false;
2796
+ }
2797
+ }
2798
+ toExtendedJSON() {
2799
+ if (this.toHexString)
2800
+ return { $oid: this.toHexString() };
2801
+ return { $oid: this.toString('hex') };
2802
+ }
2803
+ static fromExtendedJSON(doc) {
2804
+ return new ObjectId(doc.$oid);
2805
+ }
2806
+ isCached() {
2807
+ return ObjectId.cacheHexString && __idCache.has(this);
2808
+ }
2809
+ inspect(depth, options, inspect) {
2810
+ inspect ??= defaultInspect;
2811
+ return `new ObjectId(${inspect(this.toHexString(), options)})`;
2812
+ }
2813
+ }
2814
+
2815
+ function internalCalculateObjectSize(object, serializeFunctions, ignoreUndefined) {
2816
+ let totalLength = 4 + 1;
2817
+ if (Array.isArray(object)) {
2818
+ for (let i = 0; i < object.length; i++) {
2819
+ totalLength += calculateElement(i.toString(), object[i], serializeFunctions, true, ignoreUndefined);
2820
+ }
2821
+ }
2822
+ else {
2823
+ if (typeof object?.toBSON === 'function') {
2824
+ object = object.toBSON();
2825
+ }
2826
+ for (const key of Object.keys(object)) {
2827
+ totalLength += calculateElement(key, object[key], serializeFunctions, false, ignoreUndefined);
2828
+ }
2829
+ }
2830
+ return totalLength;
2831
+ }
2832
+ function calculateElement(name, value, serializeFunctions = false, isArray = false, ignoreUndefined = false) {
2833
+ if (typeof value?.toBSON === 'function') {
2834
+ value = value.toBSON();
2835
+ }
2836
+ switch (typeof value) {
2837
+ case 'string':
2838
+ return 1 + ByteUtils.utf8ByteLength(name) + 1 + 4 + ByteUtils.utf8ByteLength(value) + 1;
2839
+ case 'number':
2840
+ if (Math.floor(value) === value &&
2841
+ value >= JS_INT_MIN &&
2842
+ value <= JS_INT_MAX) {
2843
+ if (value >= BSON_INT32_MIN && value <= BSON_INT32_MAX) {
2844
+ return (name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) + (4 + 1);
2845
+ }
2846
+ else {
2847
+ return (name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) + (8 + 1);
2848
+ }
2849
+ }
2850
+ else {
2851
+ return (name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) + (8 + 1);
2852
+ }
2853
+ case 'undefined':
2854
+ if (isArray || !ignoreUndefined)
2855
+ return (name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) + 1;
2856
+ return 0;
2857
+ case 'boolean':
2858
+ return (name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) + (1 + 1);
2859
+ case 'object':
2860
+ if (value != null &&
2861
+ typeof value._bsontype === 'string' &&
2862
+ value[BSON_VERSION_SYMBOL] !== BSON_MAJOR_VERSION) {
2863
+ throw new BSONVersionError();
2864
+ }
2865
+ else if (value == null || value._bsontype === 'MinKey' || value._bsontype === 'MaxKey') {
2866
+ return (name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) + 1;
2867
+ }
2868
+ else if (value._bsontype === 'ObjectId') {
2869
+ return (name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) + (12 + 1);
2870
+ }
2871
+ else if (value instanceof Date || isDate(value)) {
2872
+ return (name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) + (8 + 1);
2873
+ }
2874
+ else if (ArrayBuffer.isView(value) ||
2875
+ value instanceof ArrayBuffer ||
2876
+ isAnyArrayBuffer(value)) {
2877
+ return ((name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) + (1 + 4 + 1) + value.byteLength);
2878
+ }
2879
+ else if (value._bsontype === 'Long' ||
2880
+ value._bsontype === 'Double' ||
2881
+ value._bsontype === 'Timestamp') {
2882
+ return (name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) + (8 + 1);
2883
+ }
2884
+ else if (value._bsontype === 'Decimal128') {
2885
+ return (name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) + (16 + 1);
2886
+ }
2887
+ else if (value._bsontype === 'Code') {
2888
+ if (value.scope != null && Object.keys(value.scope).length > 0) {
2889
+ return ((name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) +
2890
+ 1 +
2891
+ 4 +
2892
+ 4 +
2893
+ ByteUtils.utf8ByteLength(value.code.toString()) +
2894
+ 1 +
2895
+ internalCalculateObjectSize(value.scope, serializeFunctions, ignoreUndefined));
2896
+ }
2897
+ else {
2898
+ return ((name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) +
2899
+ 1 +
2900
+ 4 +
2901
+ ByteUtils.utf8ByteLength(value.code.toString()) +
2902
+ 1);
2903
+ }
2904
+ }
2905
+ else if (value._bsontype === 'Binary') {
2906
+ const binary = value;
2907
+ if (binary.sub_type === Binary.SUBTYPE_BYTE_ARRAY) {
2908
+ return ((name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) +
2909
+ (binary.position + 1 + 4 + 1 + 4));
2910
+ }
2911
+ else {
2912
+ return ((name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) + (binary.position + 1 + 4 + 1));
2913
+ }
2914
+ }
2915
+ else if (value._bsontype === 'Symbol') {
2916
+ return ((name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) +
2917
+ ByteUtils.utf8ByteLength(value.value) +
2918
+ 4 +
2919
+ 1 +
2920
+ 1);
2921
+ }
2922
+ else if (value._bsontype === 'DBRef') {
2923
+ const ordered_values = Object.assign({
2924
+ $ref: value.collection,
2925
+ $id: value.oid
2926
+ }, value.fields);
2927
+ if (value.db != null) {
2928
+ ordered_values['$db'] = value.db;
2929
+ }
2930
+ return ((name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) +
2931
+ 1 +
2932
+ internalCalculateObjectSize(ordered_values, serializeFunctions, ignoreUndefined));
2933
+ }
2934
+ else if (value instanceof RegExp || isRegExp(value)) {
2935
+ return ((name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) +
2936
+ 1 +
2937
+ ByteUtils.utf8ByteLength(value.source) +
2938
+ 1 +
2939
+ (value.global ? 1 : 0) +
2940
+ (value.ignoreCase ? 1 : 0) +
2941
+ (value.multiline ? 1 : 0) +
2942
+ 1);
2943
+ }
2944
+ else if (value._bsontype === 'BSONRegExp') {
2945
+ return ((name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) +
2946
+ 1 +
2947
+ ByteUtils.utf8ByteLength(value.pattern) +
2948
+ 1 +
2949
+ ByteUtils.utf8ByteLength(value.options) +
2950
+ 1);
2951
+ }
2952
+ else {
2953
+ return ((name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) +
2954
+ internalCalculateObjectSize(value, serializeFunctions, ignoreUndefined) +
2955
+ 1);
2956
+ }
2957
+ case 'function':
2958
+ if (serializeFunctions) {
2959
+ return ((name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) +
2960
+ 1 +
2961
+ 4 +
2962
+ ByteUtils.utf8ByteLength(value.toString()) +
2963
+ 1);
2964
+ }
2965
+ return 0;
2966
+ case 'bigint':
2967
+ return (name != null ? ByteUtils.utf8ByteLength(name) + 1 : 0) + (8 + 1);
2968
+ case 'symbol':
2969
+ return 0;
2970
+ default:
2971
+ throw new BSONError(`Unrecognized JS type: ${typeof value}`);
2972
+ }
2973
+ return 0;
2974
+ }
2975
+
2976
+ function alphabetize(str) {
2977
+ return str.split('').sort().join('');
2978
+ }
2979
+ class BSONRegExp extends BSONValue {
2980
+ get _bsontype() {
2981
+ return 'BSONRegExp';
2982
+ }
2983
+ pattern;
2984
+ options;
2985
+ constructor(pattern, options) {
2986
+ super();
2987
+ this.pattern = pattern;
2988
+ this.options = alphabetize(options ?? '');
2989
+ if (this.pattern.indexOf('\x00') !== -1) {
2990
+ throw new BSONError(`BSON Regex patterns cannot contain null bytes, found: ${JSON.stringify(this.pattern)}`);
2991
+ }
2992
+ if (this.options.indexOf('\x00') !== -1) {
2993
+ throw new BSONError(`BSON Regex options cannot contain null bytes, found: ${JSON.stringify(this.options)}`);
2994
+ }
2995
+ for (let i = 0; i < this.options.length; i++) {
2996
+ if (!(this.options[i] === 'i' ||
2997
+ this.options[i] === 'm' ||
2998
+ this.options[i] === 'x' ||
2999
+ this.options[i] === 'l' ||
3000
+ this.options[i] === 's' ||
3001
+ this.options[i] === 'u')) {
3002
+ throw new BSONError(`The regular expression option [${this.options[i]}] is not supported`);
3003
+ }
3004
+ }
3005
+ }
3006
+ static parseOptions(options) {
3007
+ return options ? options.split('').sort().join('') : '';
3008
+ }
3009
+ toExtendedJSON(options) {
3010
+ options = options || {};
3011
+ if (options.legacy) {
3012
+ return { $regex: this.pattern, $options: this.options };
3013
+ }
3014
+ return { $regularExpression: { pattern: this.pattern, options: this.options } };
3015
+ }
3016
+ static fromExtendedJSON(doc) {
3017
+ if ('$regex' in doc) {
3018
+ if (typeof doc.$regex !== 'string') {
3019
+ if (doc.$regex._bsontype === 'BSONRegExp') {
3020
+ return doc;
3021
+ }
3022
+ }
3023
+ else {
3024
+ return new BSONRegExp(doc.$regex, BSONRegExp.parseOptions(doc.$options));
3025
+ }
3026
+ }
3027
+ if ('$regularExpression' in doc) {
3028
+ return new BSONRegExp(doc.$regularExpression.pattern, BSONRegExp.parseOptions(doc.$regularExpression.options));
3029
+ }
3030
+ throw new BSONError(`Unexpected BSONRegExp EJSON object form: ${JSON.stringify(doc)}`);
3031
+ }
3032
+ inspect(depth, options, inspect) {
3033
+ const stylize = getStylizeFunction(options) ?? (v => v);
3034
+ inspect ??= defaultInspect;
3035
+ const pattern = stylize(inspect(this.pattern), 'regexp');
3036
+ const flags = stylize(inspect(this.options), 'regexp');
3037
+ return `new BSONRegExp(${pattern}, ${flags})`;
3038
+ }
3039
+ }
3040
+
3041
+ class BSONSymbol extends BSONValue {
3042
+ get _bsontype() {
3043
+ return 'BSONSymbol';
3044
+ }
3045
+ value;
3046
+ constructor(value) {
3047
+ super();
3048
+ this.value = value;
3049
+ }
3050
+ valueOf() {
3051
+ return this.value;
3052
+ }
3053
+ toString() {
3054
+ return this.value;
3055
+ }
3056
+ toJSON() {
3057
+ return this.value;
3058
+ }
3059
+ toExtendedJSON() {
3060
+ return { $symbol: this.value };
3061
+ }
3062
+ static fromExtendedJSON(doc) {
3063
+ return new BSONSymbol(doc.$symbol);
3064
+ }
3065
+ inspect(depth, options, inspect) {
3066
+ inspect ??= defaultInspect;
3067
+ return `new BSONSymbol(${inspect(this.value, options)})`;
3068
+ }
3069
+ }
3070
+
3071
+ const LongWithoutOverridesClass = Long;
3072
+ class Timestamp extends LongWithoutOverridesClass {
3073
+ get _bsontype() {
3074
+ return 'Timestamp';
3075
+ }
3076
+ get [bsonType]() {
3077
+ return 'Timestamp';
3078
+ }
3079
+ static MAX_VALUE = Long.MAX_UNSIGNED_VALUE;
3080
+ get i() {
3081
+ return this.low >>> 0;
3082
+ }
3083
+ get t() {
3084
+ return this.high >>> 0;
3085
+ }
3086
+ constructor(low) {
3087
+ if (low == null) {
3088
+ super(0, 0, true);
3089
+ }
3090
+ else if (typeof low === 'bigint') {
3091
+ super(low, true);
3092
+ }
3093
+ else if (Long.isLong(low)) {
3094
+ super(low.low, low.high, true);
3095
+ }
3096
+ else if (typeof low === 'object' && 't' in low && 'i' in low) {
3097
+ if (typeof low.t !== 'number' && (typeof low.t !== 'object' || low.t._bsontype !== 'Int32')) {
3098
+ throw new BSONError('Timestamp constructed from { t, i } must provide t as a number');
3099
+ }
3100
+ if (typeof low.i !== 'number' && (typeof low.i !== 'object' || low.i._bsontype !== 'Int32')) {
3101
+ throw new BSONError('Timestamp constructed from { t, i } must provide i as a number');
3102
+ }
3103
+ const t = Number(low.t);
3104
+ const i = Number(low.i);
3105
+ if (t < 0 || Number.isNaN(t)) {
3106
+ throw new BSONError('Timestamp constructed from { t, i } must provide a positive t');
3107
+ }
3108
+ if (i < 0 || Number.isNaN(i)) {
3109
+ throw new BSONError('Timestamp constructed from { t, i } must provide a positive i');
3110
+ }
3111
+ if (t > 0xffff_ffff) {
3112
+ throw new BSONError('Timestamp constructed from { t, i } must provide t equal or less than uint32 max');
3113
+ }
3114
+ if (i > 0xffff_ffff) {
3115
+ throw new BSONError('Timestamp constructed from { t, i } must provide i equal or less than uint32 max');
3116
+ }
3117
+ super(i, t, true);
3118
+ }
3119
+ else {
3120
+ throw new BSONError('A Timestamp can only be constructed with: bigint, Long, or { t: number; i: number }');
3121
+ }
3122
+ }
3123
+ toJSON() {
3124
+ return {
3125
+ $timestamp: this.toString()
3126
+ };
3127
+ }
3128
+ static fromInt(value) {
3129
+ return new Timestamp(Long.fromInt(value, true));
3130
+ }
3131
+ static fromNumber(value) {
3132
+ return new Timestamp(Long.fromNumber(value, true));
3133
+ }
3134
+ static fromBits(lowBits, highBits) {
3135
+ return new Timestamp({ i: lowBits, t: highBits });
3136
+ }
3137
+ static fromString(str, optRadix) {
3138
+ return new Timestamp(Long.fromString(str, true, optRadix));
3139
+ }
3140
+ toExtendedJSON() {
3141
+ return { $timestamp: { t: this.t, i: this.i } };
3142
+ }
3143
+ static fromExtendedJSON(doc) {
3144
+ const i = Long.isLong(doc.$timestamp.i)
3145
+ ? doc.$timestamp.i.getLowBitsUnsigned()
3146
+ : doc.$timestamp.i;
3147
+ const t = Long.isLong(doc.$timestamp.t)
3148
+ ? doc.$timestamp.t.getLowBitsUnsigned()
3149
+ : doc.$timestamp.t;
3150
+ return new Timestamp({ t, i });
3151
+ }
3152
+ inspect(depth, options, inspect) {
3153
+ inspect ??= defaultInspect;
3154
+ const t = inspect(this.t, options);
3155
+ const i = inspect(this.i, options);
3156
+ return `new Timestamp({ t: ${t}, i: ${i} })`;
3157
+ }
3158
+ }
3159
+
3160
+ const JS_INT_MAX_LONG = Long.fromNumber(JS_INT_MAX);
3161
+ const JS_INT_MIN_LONG = Long.fromNumber(JS_INT_MIN);
3162
+ function internalDeserialize(buffer, options, isArray) {
3163
+ options = options == null ? {} : options;
3164
+ const index = options && options.index ? options.index : 0;
3165
+ const size = NumberUtils.getInt32LE(buffer, index);
3166
+ if (size < 5) {
3167
+ throw new BSONError(`bson size must be >= 5, is ${size}`);
3168
+ }
3169
+ if (options.allowObjectSmallerThanBufferSize && buffer.length < size) {
3170
+ throw new BSONError(`buffer length ${buffer.length} must be >= bson size ${size}`);
3171
+ }
3172
+ if (!options.allowObjectSmallerThanBufferSize && buffer.length !== size) {
3173
+ throw new BSONError(`buffer length ${buffer.length} must === bson size ${size}`);
3174
+ }
3175
+ if (size + index > buffer.byteLength) {
3176
+ throw new BSONError(`(bson size ${size} + options.index ${index} must be <= buffer length ${buffer.byteLength})`);
3177
+ }
3178
+ if (buffer[index + size - 1] !== 0) {
3179
+ throw new BSONError("One object, sized correctly, with a spot for an EOO, but the EOO isn't 0x00");
3180
+ }
3181
+ return deserializeObject(buffer, index, options, isArray);
3182
+ }
3183
+ const allowedDBRefKeys = /^\$ref$|^\$id$|^\$db$/;
3184
+ function deserializeObject(buffer, index, options, isArray = false) {
3185
+ const fieldsAsRaw = options['fieldsAsRaw'] == null ? null : options['fieldsAsRaw'];
3186
+ const raw = options['raw'] == null ? false : options['raw'];
3187
+ const bsonRegExp = typeof options['bsonRegExp'] === 'boolean' ? options['bsonRegExp'] : false;
3188
+ const promoteBuffers = options.promoteBuffers ?? false;
3189
+ const promoteLongs = options.promoteLongs ?? true;
3190
+ const promoteValues = options.promoteValues ?? true;
3191
+ const useBigInt64 = options.useBigInt64 ?? false;
3192
+ if (useBigInt64 && !promoteValues) {
3193
+ throw new BSONError('Must either request bigint or Long for int64 deserialization');
3194
+ }
3195
+ if (useBigInt64 && !promoteLongs) {
3196
+ throw new BSONError('Must either request bigint or Long for int64 deserialization');
3197
+ }
3198
+ const validation = options.validation == null ? { utf8: true } : options.validation;
3199
+ let globalUTFValidation = true;
3200
+ let validationSetting;
3201
+ let utf8KeysSet;
3202
+ const utf8ValidatedKeys = validation.utf8;
3203
+ if (typeof utf8ValidatedKeys === 'boolean') {
3204
+ validationSetting = utf8ValidatedKeys;
3205
+ }
3206
+ else {
3207
+ globalUTFValidation = false;
3208
+ const utf8ValidationValues = Object.keys(utf8ValidatedKeys).map(function (key) {
3209
+ return utf8ValidatedKeys[key];
3210
+ });
3211
+ if (utf8ValidationValues.length === 0) {
3212
+ throw new BSONError('UTF-8 validation setting cannot be empty');
3213
+ }
3214
+ if (typeof utf8ValidationValues[0] !== 'boolean') {
3215
+ throw new BSONError('Invalid UTF-8 validation option, must specify boolean values');
3216
+ }
3217
+ validationSetting = utf8ValidationValues[0];
3218
+ if (!utf8ValidationValues.every(item => item === validationSetting)) {
3219
+ throw new BSONError('Invalid UTF-8 validation option - keys must be all true or all false');
3220
+ }
3221
+ }
3222
+ if (!globalUTFValidation) {
3223
+ utf8KeysSet = new Set();
3224
+ for (const key of Object.keys(utf8ValidatedKeys)) {
3225
+ utf8KeysSet.add(key);
3226
+ }
3227
+ }
3228
+ const startIndex = index;
3229
+ if (buffer.length < 5)
3230
+ throw new BSONError('corrupt bson message < 5 bytes long');
3231
+ const size = NumberUtils.getInt32LE(buffer, index);
3232
+ index += 4;
3233
+ if (size < 5 || size > buffer.length)
3234
+ throw new BSONError('corrupt bson message');
3235
+ const object = isArray ? [] : {};
3236
+ let arrayIndex = 0;
3237
+ const done = false;
3238
+ let isPossibleDBRef = isArray ? false : null;
3239
+ while (!done) {
3240
+ const elementType = buffer[index++];
3241
+ if (elementType === 0)
3242
+ break;
3243
+ let i = index;
3244
+ while (buffer[i] !== 0x00 && i < buffer.length) {
3245
+ i++;
3246
+ }
3247
+ if (i >= buffer.byteLength)
3248
+ throw new BSONError('Bad BSON Document: illegal CString');
3249
+ const name = isArray ? arrayIndex++ : ByteUtils.toUTF8(buffer, index, i, false);
3250
+ let shouldValidateKey = true;
3251
+ if (globalUTFValidation || utf8KeysSet?.has(name)) {
3252
+ shouldValidateKey = validationSetting;
3253
+ }
3254
+ else {
3255
+ shouldValidateKey = !validationSetting;
3256
+ }
3257
+ if (isPossibleDBRef !== false && name[0] === '$') {
3258
+ isPossibleDBRef = allowedDBRefKeys.test(name);
3259
+ }
3260
+ let value;
3261
+ index = i + 1;
3262
+ if (elementType === BSON_DATA_STRING) {
3263
+ const stringSize = NumberUtils.getInt32LE(buffer, index);
3264
+ index += 4;
3265
+ if (stringSize <= 0 ||
3266
+ stringSize > buffer.length - index ||
3267
+ buffer[index + stringSize - 1] !== 0) {
3268
+ throw new BSONError('bad string length in bson');
3269
+ }
3270
+ value = ByteUtils.toUTF8(buffer, index, index + stringSize - 1, shouldValidateKey);
3271
+ index = index + stringSize;
3272
+ }
3273
+ else if (elementType === BSON_DATA_OID) {
3274
+ const oid = ByteUtils.allocateUnsafe(12);
3275
+ for (let i = 0; i < 12; i++)
3276
+ oid[i] = buffer[index + i];
3277
+ value = new ObjectId(oid);
3278
+ index = index + 12;
3279
+ }
3280
+ else if (elementType === BSON_DATA_INT && promoteValues === false) {
3281
+ value = new Int32(NumberUtils.getInt32LE(buffer, index));
3282
+ index += 4;
3283
+ }
3284
+ else if (elementType === BSON_DATA_INT) {
3285
+ value = NumberUtils.getInt32LE(buffer, index);
3286
+ index += 4;
3287
+ }
3288
+ else if (elementType === BSON_DATA_NUMBER) {
3289
+ value = NumberUtils.getFloat64LE(buffer, index);
3290
+ index += 8;
3291
+ if (promoteValues === false)
3292
+ value = new Double(value);
3293
+ }
3294
+ else if (elementType === BSON_DATA_DATE) {
3295
+ const lowBits = NumberUtils.getInt32LE(buffer, index);
3296
+ const highBits = NumberUtils.getInt32LE(buffer, index + 4);
3297
+ index += 8;
3298
+ value = new Date(new Long(lowBits, highBits).toNumber());
3299
+ }
3300
+ else if (elementType === BSON_DATA_BOOLEAN) {
3301
+ if (buffer[index] !== 0 && buffer[index] !== 1)
3302
+ throw new BSONError('illegal boolean type value');
3303
+ value = buffer[index++] === 1;
3304
+ }
3305
+ else if (elementType === BSON_DATA_OBJECT) {
3306
+ const _index = index;
3307
+ const objectSize = NumberUtils.getInt32LE(buffer, index);
3308
+ if (objectSize <= 0 || objectSize > buffer.length - index)
3309
+ throw new BSONError('bad embedded document length in bson');
3310
+ if (raw) {
3311
+ value = buffer.subarray(index, index + objectSize);
3312
+ }
3313
+ else {
3314
+ let objectOptions = options;
3315
+ if (!globalUTFValidation) {
3316
+ objectOptions = { ...options, validation: { utf8: shouldValidateKey } };
3317
+ }
3318
+ value = deserializeObject(buffer, _index, objectOptions, false);
3319
+ }
3320
+ index = index + objectSize;
3321
+ }
3322
+ else if (elementType === BSON_DATA_ARRAY) {
3323
+ const _index = index;
3324
+ const objectSize = NumberUtils.getInt32LE(buffer, index);
3325
+ let arrayOptions = options;
3326
+ const stopIndex = index + objectSize;
3327
+ if (fieldsAsRaw && fieldsAsRaw[name]) {
3328
+ arrayOptions = { ...options, raw: true };
3329
+ }
3330
+ if (!globalUTFValidation) {
3331
+ arrayOptions = { ...arrayOptions, validation: { utf8: shouldValidateKey } };
3332
+ }
3333
+ value = deserializeObject(buffer, _index, arrayOptions, true);
3334
+ index = index + objectSize;
3335
+ if (buffer[index - 1] !== 0)
3336
+ throw new BSONError('invalid array terminator byte');
3337
+ if (index !== stopIndex)
3338
+ throw new BSONError('corrupted array bson');
3339
+ }
3340
+ else if (elementType === BSON_DATA_UNDEFINED) {
3341
+ value = undefined;
3342
+ }
3343
+ else if (elementType === BSON_DATA_NULL) {
3344
+ value = null;
3345
+ }
3346
+ else if (elementType === BSON_DATA_LONG) {
3347
+ if (useBigInt64) {
3348
+ value = NumberUtils.getBigInt64LE(buffer, index);
3349
+ index += 8;
3350
+ }
3351
+ else {
3352
+ const lowBits = NumberUtils.getInt32LE(buffer, index);
3353
+ const highBits = NumberUtils.getInt32LE(buffer, index + 4);
3354
+ index += 8;
3355
+ const long = new Long(lowBits, highBits);
3356
+ if (promoteLongs && promoteValues === true) {
3357
+ value =
3358
+ long.lessThanOrEqual(JS_INT_MAX_LONG) && long.greaterThanOrEqual(JS_INT_MIN_LONG)
3359
+ ? long.toNumber()
3360
+ : long;
3361
+ }
3362
+ else {
3363
+ value = long;
3364
+ }
3365
+ }
3366
+ }
3367
+ else if (elementType === BSON_DATA_DECIMAL128) {
3368
+ const bytes = ByteUtils.allocateUnsafe(16);
3369
+ for (let i = 0; i < 16; i++)
3370
+ bytes[i] = buffer[index + i];
3371
+ index = index + 16;
3372
+ value = new Decimal128(bytes);
3373
+ }
3374
+ else if (elementType === BSON_DATA_BINARY) {
3375
+ let binarySize = NumberUtils.getInt32LE(buffer, index);
3376
+ index += 4;
3377
+ const totalBinarySize = binarySize;
3378
+ const subType = buffer[index++];
3379
+ if (binarySize < 0)
3380
+ throw new BSONError('Negative binary type element size found');
3381
+ if (binarySize > buffer.byteLength)
3382
+ throw new BSONError('Binary type size larger than document size');
3383
+ if (subType === Binary.SUBTYPE_BYTE_ARRAY) {
3384
+ binarySize = NumberUtils.getInt32LE(buffer, index);
3385
+ index += 4;
3386
+ if (binarySize < 0)
3387
+ throw new BSONError('Negative binary type element size found for subtype 0x02');
3388
+ if (binarySize > totalBinarySize - 4)
3389
+ throw new BSONError('Binary type with subtype 0x02 contains too long binary size');
3390
+ if (binarySize < totalBinarySize - 4)
3391
+ throw new BSONError('Binary type with subtype 0x02 contains too short binary size');
3392
+ }
3393
+ if (promoteBuffers && promoteValues) {
3394
+ value = ByteUtils.toLocalBufferType(buffer.subarray(index, index + binarySize));
3395
+ }
3396
+ else {
3397
+ value = new Binary(buffer.subarray(index, index + binarySize), subType);
3398
+ if (subType === BSON_BINARY_SUBTYPE_UUID_NEW && UUID.isValid(value)) {
3399
+ value = value.toUUID();
3400
+ }
3401
+ }
3402
+ index = index + binarySize;
3403
+ }
3404
+ else if (elementType === BSON_DATA_REGEXP && bsonRegExp === false) {
3405
+ i = index;
3406
+ while (buffer[i] !== 0x00 && i < buffer.length) {
3407
+ i++;
3408
+ }
3409
+ if (i >= buffer.length)
3410
+ throw new BSONError('Bad BSON Document: illegal CString');
3411
+ const source = ByteUtils.toUTF8(buffer, index, i, false);
3412
+ index = i + 1;
3413
+ i = index;
3414
+ while (buffer[i] !== 0x00 && i < buffer.length) {
3415
+ i++;
3416
+ }
3417
+ if (i >= buffer.length)
3418
+ throw new BSONError('Bad BSON Document: illegal CString');
3419
+ const regExpOptions = ByteUtils.toUTF8(buffer, index, i, false);
3420
+ index = i + 1;
3421
+ const optionsArray = new Array(regExpOptions.length);
3422
+ for (i = 0; i < regExpOptions.length; i++) {
3423
+ switch (regExpOptions[i]) {
3424
+ case 'm':
3425
+ optionsArray[i] = 'm';
3426
+ break;
3427
+ case 's':
3428
+ optionsArray[i] = 'g';
3429
+ break;
3430
+ case 'i':
3431
+ optionsArray[i] = 'i';
3432
+ break;
3433
+ }
3434
+ }
3435
+ value = new RegExp(source, optionsArray.join(''));
3436
+ }
3437
+ else if (elementType === BSON_DATA_REGEXP && bsonRegExp === true) {
3438
+ i = index;
3439
+ while (buffer[i] !== 0x00 && i < buffer.length) {
3440
+ i++;
3441
+ }
3442
+ if (i >= buffer.length)
3443
+ throw new BSONError('Bad BSON Document: illegal CString');
3444
+ const source = ByteUtils.toUTF8(buffer, index, i, false);
3445
+ index = i + 1;
3446
+ i = index;
3447
+ while (buffer[i] !== 0x00 && i < buffer.length) {
3448
+ i++;
3449
+ }
3450
+ if (i >= buffer.length)
3451
+ throw new BSONError('Bad BSON Document: illegal CString');
3452
+ const regExpOptions = ByteUtils.toUTF8(buffer, index, i, false);
3453
+ index = i + 1;
3454
+ value = new BSONRegExp(source, regExpOptions);
3455
+ }
3456
+ else if (elementType === BSON_DATA_SYMBOL) {
3457
+ const stringSize = NumberUtils.getInt32LE(buffer, index);
3458
+ index += 4;
3459
+ if (stringSize <= 0 ||
3460
+ stringSize > buffer.length - index ||
3461
+ buffer[index + stringSize - 1] !== 0) {
3462
+ throw new BSONError('bad string length in bson');
3463
+ }
3464
+ const symbol = ByteUtils.toUTF8(buffer, index, index + stringSize - 1, shouldValidateKey);
3465
+ value = promoteValues ? symbol : new BSONSymbol(symbol);
3466
+ index = index + stringSize;
3467
+ }
3468
+ else if (elementType === BSON_DATA_TIMESTAMP) {
3469
+ value = new Timestamp({
3470
+ i: NumberUtils.getUint32LE(buffer, index),
3471
+ t: NumberUtils.getUint32LE(buffer, index + 4)
3472
+ });
3473
+ index += 8;
3474
+ }
3475
+ else if (elementType === BSON_DATA_MIN_KEY) {
3476
+ value = new MinKey();
3477
+ }
3478
+ else if (elementType === BSON_DATA_MAX_KEY) {
3479
+ value = new MaxKey();
3480
+ }
3481
+ else if (elementType === BSON_DATA_CODE) {
3482
+ const stringSize = NumberUtils.getInt32LE(buffer, index);
3483
+ index += 4;
3484
+ if (stringSize <= 0 ||
3485
+ stringSize > buffer.length - index ||
3486
+ buffer[index + stringSize - 1] !== 0) {
3487
+ throw new BSONError('bad string length in bson');
3488
+ }
3489
+ const functionString = ByteUtils.toUTF8(buffer, index, index + stringSize - 1, shouldValidateKey);
3490
+ value = new Code(functionString);
3491
+ index = index + stringSize;
3492
+ }
3493
+ else if (elementType === BSON_DATA_CODE_W_SCOPE) {
3494
+ const totalSize = NumberUtils.getInt32LE(buffer, index);
3495
+ index += 4;
3496
+ if (totalSize < 4 + 4 + 4 + 1) {
3497
+ throw new BSONError('code_w_scope total size shorter minimum expected length');
3498
+ }
3499
+ const stringSize = NumberUtils.getInt32LE(buffer, index);
3500
+ index += 4;
3501
+ if (stringSize <= 0 ||
3502
+ stringSize > buffer.length - index ||
3503
+ buffer[index + stringSize - 1] !== 0) {
3504
+ throw new BSONError('bad string length in bson');
3505
+ }
3506
+ const functionString = ByteUtils.toUTF8(buffer, index, index + stringSize - 1, shouldValidateKey);
3507
+ index = index + stringSize;
3508
+ const _index = index;
3509
+ const objectSize = NumberUtils.getInt32LE(buffer, index);
3510
+ const scopeObject = deserializeObject(buffer, _index, options, false);
3511
+ index = index + objectSize;
3512
+ if (totalSize < 4 + 4 + objectSize + stringSize) {
3513
+ throw new BSONError('code_w_scope total size is too short, truncating scope');
3514
+ }
3515
+ if (totalSize > 4 + 4 + objectSize + stringSize) {
3516
+ throw new BSONError('code_w_scope total size is too long, clips outer document');
3517
+ }
3518
+ value = new Code(functionString, scopeObject);
3519
+ }
3520
+ else if (elementType === BSON_DATA_DBPOINTER) {
3521
+ const stringSize = NumberUtils.getInt32LE(buffer, index);
3522
+ index += 4;
3523
+ if (stringSize <= 0 ||
3524
+ stringSize > buffer.length - index ||
3525
+ buffer[index + stringSize - 1] !== 0)
3526
+ throw new BSONError('bad string length in bson');
3527
+ const namespace = ByteUtils.toUTF8(buffer, index, index + stringSize - 1, shouldValidateKey);
3528
+ index = index + stringSize;
3529
+ const oidBuffer = ByteUtils.allocateUnsafe(12);
3530
+ for (let i = 0; i < 12; i++)
3531
+ oidBuffer[i] = buffer[index + i];
3532
+ const oid = new ObjectId(oidBuffer);
3533
+ index = index + 12;
3534
+ value = new DBRef(namespace, oid);
3535
+ }
3536
+ else {
3537
+ throw new BSONError(`Detected unknown BSON type ${elementType.toString(16)} for fieldname "${name}"`);
3538
+ }
3539
+ if (name === '__proto__') {
3540
+ Object.defineProperty(object, name, {
3541
+ value,
3542
+ writable: true,
3543
+ enumerable: true,
3544
+ configurable: true
3545
+ });
3546
+ }
3547
+ else {
3548
+ object[name] = value;
3549
+ }
3550
+ }
3551
+ if (size !== index - startIndex) {
3552
+ if (isArray)
3553
+ throw new BSONError('corrupt array bson');
3554
+ throw new BSONError('corrupt object bson');
3555
+ }
3556
+ if (!isPossibleDBRef)
3557
+ return object;
3558
+ if (isDBRefLike(object)) {
3559
+ const copy = Object.assign({}, object);
3560
+ delete copy.$ref;
3561
+ delete copy.$id;
3562
+ delete copy.$db;
3563
+ return new DBRef(object.$ref, object.$id, object.$db, copy);
3564
+ }
3565
+ return object;
3566
+ }
3567
+
3568
+ const regexp = /\x00/;
3569
+ const ignoreKeys = new Set(['$db', '$ref', '$id', '$clusterTime']);
3570
+ function serializeString(buffer, key, value, index) {
3571
+ buffer[index++] = BSON_DATA_STRING;
3572
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
3573
+ index = index + numberOfWrittenBytes + 1;
3574
+ buffer[index - 1] = 0;
3575
+ const size = ByteUtils.encodeUTF8Into(buffer, value, index + 4);
3576
+ NumberUtils.setInt32LE(buffer, index, size + 1);
3577
+ index = index + 4 + size;
3578
+ buffer[index++] = 0;
3579
+ return index;
3580
+ }
3581
+ function serializeNumber(buffer, key, value, index) {
3582
+ const isNegativeZero = Object.is(value, -0);
3583
+ const type = !isNegativeZero &&
3584
+ Number.isSafeInteger(value) &&
3585
+ value <= BSON_INT32_MAX &&
3586
+ value >= BSON_INT32_MIN
3587
+ ? BSON_DATA_INT
3588
+ : BSON_DATA_NUMBER;
3589
+ buffer[index++] = type;
3590
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
3591
+ index = index + numberOfWrittenBytes;
3592
+ buffer[index++] = 0x00;
3593
+ if (type === BSON_DATA_INT) {
3594
+ index += NumberUtils.setInt32LE(buffer, index, value);
3595
+ }
3596
+ else {
3597
+ index += NumberUtils.setFloat64LE(buffer, index, value);
3598
+ }
3599
+ return index;
3600
+ }
3601
+ function serializeBigInt(buffer, key, value, index) {
3602
+ buffer[index++] = BSON_DATA_LONG;
3603
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
3604
+ index += numberOfWrittenBytes;
3605
+ buffer[index++] = 0;
3606
+ index += NumberUtils.setBigInt64LE(buffer, index, value);
3607
+ return index;
3608
+ }
3609
+ function serializeNull(buffer, key, _, index) {
3610
+ buffer[index++] = BSON_DATA_NULL;
3611
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
3612
+ index = index + numberOfWrittenBytes;
3613
+ buffer[index++] = 0;
3614
+ return index;
3615
+ }
3616
+ function serializeBoolean(buffer, key, value, index) {
3617
+ buffer[index++] = BSON_DATA_BOOLEAN;
3618
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
3619
+ index = index + numberOfWrittenBytes;
3620
+ buffer[index++] = 0;
3621
+ buffer[index++] = value ? 1 : 0;
3622
+ return index;
3623
+ }
3624
+ function serializeDate(buffer, key, value, index) {
3625
+ buffer[index++] = BSON_DATA_DATE;
3626
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
3627
+ index = index + numberOfWrittenBytes;
3628
+ buffer[index++] = 0;
3629
+ const dateInMilis = Long.fromNumber(value.getTime());
3630
+ const lowBits = dateInMilis.getLowBits();
3631
+ const highBits = dateInMilis.getHighBits();
3632
+ index += NumberUtils.setInt32LE(buffer, index, lowBits);
3633
+ index += NumberUtils.setInt32LE(buffer, index, highBits);
3634
+ return index;
3635
+ }
3636
+ function serializeRegExp(buffer, key, value, index) {
3637
+ buffer[index++] = BSON_DATA_REGEXP;
3638
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
3639
+ index = index + numberOfWrittenBytes;
3640
+ buffer[index++] = 0;
3641
+ if (value.source && value.source.match(regexp) != null) {
3642
+ throw new BSONError('value ' + value.source + ' must not contain null bytes');
3643
+ }
3644
+ index = index + ByteUtils.encodeUTF8Into(buffer, value.source, index);
3645
+ buffer[index++] = 0x00;
3646
+ if (value.ignoreCase)
3647
+ buffer[index++] = 0x69;
3648
+ if (value.global)
3649
+ buffer[index++] = 0x73;
3650
+ if (value.multiline)
3651
+ buffer[index++] = 0x6d;
3652
+ buffer[index++] = 0x00;
3653
+ return index;
3654
+ }
3655
+ function serializeBSONRegExp(buffer, key, value, index) {
3656
+ buffer[index++] = BSON_DATA_REGEXP;
3657
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
3658
+ index = index + numberOfWrittenBytes;
3659
+ buffer[index++] = 0;
3660
+ if (value.pattern.match(regexp) != null) {
3661
+ throw new BSONError('pattern ' + value.pattern + ' must not contain null bytes');
3662
+ }
3663
+ index = index + ByteUtils.encodeUTF8Into(buffer, value.pattern, index);
3664
+ buffer[index++] = 0x00;
3665
+ const sortedOptions = value.options.split('').sort().join('');
3666
+ index = index + ByteUtils.encodeUTF8Into(buffer, sortedOptions, index);
3667
+ buffer[index++] = 0x00;
3668
+ return index;
3669
+ }
3670
+ function serializeMinMax(buffer, key, value, index) {
3671
+ if (value === null) {
3672
+ buffer[index++] = BSON_DATA_NULL;
3673
+ }
3674
+ else if (value._bsontype === 'MinKey') {
3675
+ buffer[index++] = BSON_DATA_MIN_KEY;
3676
+ }
3677
+ else {
3678
+ buffer[index++] = BSON_DATA_MAX_KEY;
3679
+ }
3680
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
3681
+ index = index + numberOfWrittenBytes;
3682
+ buffer[index++] = 0;
3683
+ return index;
3684
+ }
3685
+ function serializeObjectId(buffer, key, value, index) {
3686
+ buffer[index++] = BSON_DATA_OID;
3687
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
3688
+ index = index + numberOfWrittenBytes;
3689
+ buffer[index++] = 0;
3690
+ index += value.serializeInto(buffer, index);
3691
+ return index;
3692
+ }
3693
+ function serializeBuffer(buffer, key, value, index) {
3694
+ buffer[index++] = BSON_DATA_BINARY;
3695
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
3696
+ index = index + numberOfWrittenBytes;
3697
+ buffer[index++] = 0;
3698
+ const size = value.length;
3699
+ index += NumberUtils.setInt32LE(buffer, index, size);
3700
+ buffer[index++] = BSON_BINARY_SUBTYPE_DEFAULT;
3701
+ if (size <= 16) {
3702
+ for (let i = 0; i < size; i++)
3703
+ buffer[index + i] = value[i];
3704
+ }
3705
+ else {
3706
+ buffer.set(value, index);
3707
+ }
3708
+ index = index + size;
3709
+ return index;
3710
+ }
3711
+ function serializeObject(buffer, key, value, index, checkKeys, depth, serializeFunctions, ignoreUndefined, path) {
3712
+ if (path.has(value)) {
3713
+ throw new BSONError('Cannot convert circular structure to BSON');
3714
+ }
3715
+ path.add(value);
3716
+ buffer[index++] = Array.isArray(value) ? BSON_DATA_ARRAY : BSON_DATA_OBJECT;
3717
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
3718
+ index = index + numberOfWrittenBytes;
3719
+ buffer[index++] = 0;
3720
+ const endIndex = serializeInto(buffer, value, checkKeys, index, depth + 1, serializeFunctions, ignoreUndefined, path);
3721
+ path.delete(value);
3722
+ return endIndex;
3723
+ }
3724
+ function serializeDecimal128(buffer, key, value, index) {
3725
+ buffer[index++] = BSON_DATA_DECIMAL128;
3726
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
3727
+ index = index + numberOfWrittenBytes;
3728
+ buffer[index++] = 0;
3729
+ for (let i = 0; i < 16; i++)
3730
+ buffer[index + i] = value.bytes[i];
3731
+ return index + 16;
3732
+ }
3733
+ function serializeLong(buffer, key, value, index) {
3734
+ buffer[index++] =
3735
+ value._bsontype === 'Long' ? BSON_DATA_LONG : BSON_DATA_TIMESTAMP;
3736
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
3737
+ index = index + numberOfWrittenBytes;
3738
+ buffer[index++] = 0;
3739
+ const lowBits = value.getLowBits();
3740
+ const highBits = value.getHighBits();
3741
+ index += NumberUtils.setInt32LE(buffer, index, lowBits);
3742
+ index += NumberUtils.setInt32LE(buffer, index, highBits);
3743
+ return index;
3744
+ }
3745
+ function serializeInt32(buffer, key, value, index) {
3746
+ value = value.valueOf();
3747
+ buffer[index++] = BSON_DATA_INT;
3748
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
3749
+ index = index + numberOfWrittenBytes;
3750
+ buffer[index++] = 0;
3751
+ index += NumberUtils.setInt32LE(buffer, index, value);
3752
+ return index;
3753
+ }
3754
+ function serializeDouble(buffer, key, value, index) {
3755
+ buffer[index++] = BSON_DATA_NUMBER;
3756
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
3757
+ index = index + numberOfWrittenBytes;
3758
+ buffer[index++] = 0;
3759
+ index += NumberUtils.setFloat64LE(buffer, index, value.value);
3760
+ return index;
3761
+ }
3762
+ function serializeFunction(buffer, key, value, index) {
3763
+ buffer[index++] = BSON_DATA_CODE;
3764
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
3765
+ index = index + numberOfWrittenBytes;
3766
+ buffer[index++] = 0;
3767
+ const functionString = value.toString();
3768
+ const size = ByteUtils.encodeUTF8Into(buffer, functionString, index + 4) + 1;
3769
+ NumberUtils.setInt32LE(buffer, index, size);
3770
+ index = index + 4 + size - 1;
3771
+ buffer[index++] = 0;
3772
+ return index;
3773
+ }
3774
+ function serializeCode(buffer, key, value, index, checkKeys = false, depth = 0, serializeFunctions = false, ignoreUndefined = true, path) {
3775
+ if (value.scope && typeof value.scope === 'object') {
3776
+ buffer[index++] = BSON_DATA_CODE_W_SCOPE;
3777
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
3778
+ index = index + numberOfWrittenBytes;
3779
+ buffer[index++] = 0;
3780
+ let startIndex = index;
3781
+ const functionString = value.code;
3782
+ index = index + 4;
3783
+ const codeSize = ByteUtils.encodeUTF8Into(buffer, functionString, index + 4) + 1;
3784
+ NumberUtils.setInt32LE(buffer, index, codeSize);
3785
+ buffer[index + 4 + codeSize - 1] = 0;
3786
+ index = index + codeSize + 4;
3787
+ const endIndex = serializeInto(buffer, value.scope, checkKeys, index, depth + 1, serializeFunctions, ignoreUndefined, path);
3788
+ index = endIndex - 1;
3789
+ const totalSize = endIndex - startIndex;
3790
+ startIndex += NumberUtils.setInt32LE(buffer, startIndex, totalSize);
3791
+ buffer[index++] = 0;
3792
+ }
3793
+ else {
3794
+ buffer[index++] = BSON_DATA_CODE;
3795
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
3796
+ index = index + numberOfWrittenBytes;
3797
+ buffer[index++] = 0;
3798
+ const functionString = value.code.toString();
3799
+ const size = ByteUtils.encodeUTF8Into(buffer, functionString, index + 4) + 1;
3800
+ NumberUtils.setInt32LE(buffer, index, size);
3801
+ index = index + 4 + size - 1;
3802
+ buffer[index++] = 0;
3803
+ }
3804
+ return index;
3805
+ }
3806
+ function serializeBinary(buffer, key, value, index) {
3807
+ buffer[index++] = BSON_DATA_BINARY;
3808
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
3809
+ index = index + numberOfWrittenBytes;
3810
+ buffer[index++] = 0;
3811
+ const data = value.buffer;
3812
+ let size = value.position;
3813
+ if (value.sub_type === Binary.SUBTYPE_BYTE_ARRAY)
3814
+ size = size + 4;
3815
+ index += NumberUtils.setInt32LE(buffer, index, size);
3816
+ buffer[index++] = value.sub_type;
3817
+ if (value.sub_type === Binary.SUBTYPE_BYTE_ARRAY) {
3818
+ size = size - 4;
3819
+ index += NumberUtils.setInt32LE(buffer, index, size);
3820
+ }
3821
+ if (value.sub_type === Binary.SUBTYPE_VECTOR) {
3822
+ validateBinaryVector(value);
3823
+ }
3824
+ if (size <= 16) {
3825
+ for (let i = 0; i < size; i++)
3826
+ buffer[index + i] = data[i];
3827
+ }
3828
+ else {
3829
+ buffer.set(data, index);
3830
+ }
3831
+ index = index + value.position;
3832
+ return index;
3833
+ }
3834
+ function serializeSymbol(buffer, key, value, index) {
3835
+ buffer[index++] = BSON_DATA_SYMBOL;
3836
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
3837
+ index = index + numberOfWrittenBytes;
3838
+ buffer[index++] = 0;
3839
+ const size = ByteUtils.encodeUTF8Into(buffer, value.value, index + 4) + 1;
3840
+ NumberUtils.setInt32LE(buffer, index, size);
3841
+ index = index + 4 + size - 1;
3842
+ buffer[index++] = 0;
3843
+ return index;
3844
+ }
3845
+ function serializeDBRef(buffer, key, value, index, depth, serializeFunctions, path) {
3846
+ buffer[index++] = BSON_DATA_OBJECT;
3847
+ const numberOfWrittenBytes = ByteUtils.encodeUTF8Into(buffer, key, index);
3848
+ index = index + numberOfWrittenBytes;
3849
+ buffer[index++] = 0;
3850
+ let startIndex = index;
3851
+ let output = {
3852
+ $ref: value.collection || value.namespace,
3853
+ $id: value.oid
3854
+ };
3855
+ if (value.db != null) {
3856
+ output.$db = value.db;
3857
+ }
3858
+ output = Object.assign(output, value.fields);
3859
+ const endIndex = serializeInto(buffer, output, false, index, depth + 1, serializeFunctions, true, path);
3860
+ const size = endIndex - startIndex;
3861
+ startIndex += NumberUtils.setInt32LE(buffer, index, size);
3862
+ return endIndex;
3863
+ }
3864
+ function serializeInto(buffer, object, checkKeys, startingIndex, depth, serializeFunctions, ignoreUndefined, path) {
3865
+ if (path == null) {
3866
+ if (object == null) {
3867
+ buffer[0] = 0x05;
3868
+ buffer[1] = 0x00;
3869
+ buffer[2] = 0x00;
3870
+ buffer[3] = 0x00;
3871
+ buffer[4] = 0x00;
3872
+ return 5;
3873
+ }
3874
+ if (Array.isArray(object)) {
3875
+ throw new BSONError('serialize does not support an array as the root input');
3876
+ }
3877
+ if (typeof object !== 'object') {
3878
+ throw new BSONError('serialize does not support non-object as the root input');
3879
+ }
3880
+ else if ('_bsontype' in object && typeof object._bsontype === 'string') {
3881
+ throw new BSONError(`BSON types cannot be serialized as a document`);
3882
+ }
3883
+ else if (isDate(object) ||
3884
+ isRegExp(object) ||
3885
+ isUint8Array(object) ||
3886
+ isAnyArrayBuffer(object)) {
3887
+ throw new BSONError(`date, regexp, typedarray, and arraybuffer cannot be BSON documents`);
3888
+ }
3889
+ path = new Set();
3890
+ }
3891
+ path.add(object);
3892
+ let index = startingIndex + 4;
3893
+ if (Array.isArray(object)) {
3894
+ for (let i = 0; i < object.length; i++) {
3895
+ const key = `${i}`;
3896
+ let value = object[i];
3897
+ if (typeof value?.toBSON === 'function') {
3898
+ value = value.toBSON();
3899
+ }
3900
+ const type = typeof value;
3901
+ if (value === undefined) {
3902
+ index = serializeNull(buffer, key, value, index);
3903
+ }
3904
+ else if (value === null) {
3905
+ index = serializeNull(buffer, key, value, index);
3906
+ }
3907
+ else if (type === 'string') {
3908
+ index = serializeString(buffer, key, value, index);
3909
+ }
3910
+ else if (type === 'number') {
3911
+ index = serializeNumber(buffer, key, value, index);
3912
+ }
3913
+ else if (type === 'bigint') {
3914
+ index = serializeBigInt(buffer, key, value, index);
3915
+ }
3916
+ else if (type === 'boolean') {
3917
+ index = serializeBoolean(buffer, key, value, index);
3918
+ }
3919
+ else if (type === 'object' && value._bsontype == null) {
3920
+ if (value instanceof Date || isDate(value)) {
3921
+ index = serializeDate(buffer, key, value, index);
3922
+ }
3923
+ else if (value instanceof Uint8Array || isUint8Array(value)) {
3924
+ index = serializeBuffer(buffer, key, value, index);
3925
+ }
3926
+ else if (value instanceof RegExp || isRegExp(value)) {
3927
+ index = serializeRegExp(buffer, key, value, index);
3928
+ }
3929
+ else {
3930
+ index = serializeObject(buffer, key, value, index, checkKeys, depth, serializeFunctions, ignoreUndefined, path);
3931
+ }
3932
+ }
3933
+ else if (type === 'object') {
3934
+ if (value[BSON_VERSION_SYMBOL] !== BSON_MAJOR_VERSION) {
3935
+ throw new BSONVersionError();
3936
+ }
3937
+ else if (value._bsontype === 'ObjectId') {
3938
+ index = serializeObjectId(buffer, key, value, index);
3939
+ }
3940
+ else if (value._bsontype === 'Decimal128') {
3941
+ index = serializeDecimal128(buffer, key, value, index);
3942
+ }
3943
+ else if (value._bsontype === 'Long' || value._bsontype === 'Timestamp') {
3944
+ index = serializeLong(buffer, key, value, index);
3945
+ }
3946
+ else if (value._bsontype === 'Double') {
3947
+ index = serializeDouble(buffer, key, value, index);
3948
+ }
3949
+ else if (value._bsontype === 'Code') {
3950
+ index = serializeCode(buffer, key, value, index, checkKeys, depth, serializeFunctions, ignoreUndefined, path);
3951
+ }
3952
+ else if (value._bsontype === 'Binary') {
3953
+ index = serializeBinary(buffer, key, value, index);
3954
+ }
3955
+ else if (value._bsontype === 'BSONSymbol') {
3956
+ index = serializeSymbol(buffer, key, value, index);
3957
+ }
3958
+ else if (value._bsontype === 'DBRef') {
3959
+ index = serializeDBRef(buffer, key, value, index, depth, serializeFunctions, path);
3960
+ }
3961
+ else if (value._bsontype === 'BSONRegExp') {
3962
+ index = serializeBSONRegExp(buffer, key, value, index);
3963
+ }
3964
+ else if (value._bsontype === 'Int32') {
3965
+ index = serializeInt32(buffer, key, value, index);
3966
+ }
3967
+ else if (value._bsontype === 'MinKey' || value._bsontype === 'MaxKey') {
3968
+ index = serializeMinMax(buffer, key, value, index);
3969
+ }
3970
+ else if (typeof value._bsontype !== 'undefined') {
3971
+ throw new BSONError(`Unrecognized or invalid _bsontype: ${String(value._bsontype)}`);
3972
+ }
3973
+ }
3974
+ else if (type === 'function' && serializeFunctions) {
3975
+ index = serializeFunction(buffer, key, value, index);
3976
+ }
3977
+ }
3978
+ }
3979
+ else if (object instanceof Map || isMap(object)) {
3980
+ const iterator = object.entries();
3981
+ let done = false;
3982
+ while (!done) {
3983
+ const entry = iterator.next();
3984
+ done = !!entry.done;
3985
+ if (done)
3986
+ continue;
3987
+ const key = entry.value ? entry.value[0] : undefined;
3988
+ let value = entry.value ? entry.value[1] : undefined;
3989
+ if (typeof value?.toBSON === 'function') {
3990
+ value = value.toBSON();
3991
+ }
3992
+ const type = typeof value;
3993
+ if (typeof key === 'string' && !ignoreKeys.has(key)) {
3994
+ if (key.match(regexp) != null) {
3995
+ throw new BSONError('key ' + key + ' must not contain null bytes');
3996
+ }
3997
+ if (checkKeys) {
3998
+ if ('$' === key[0]) {
3999
+ throw new BSONError('key ' + key + " must not start with '$'");
4000
+ }
4001
+ else if (key.includes('.')) {
4002
+ throw new BSONError('key ' + key + " must not contain '.'");
4003
+ }
4004
+ }
4005
+ }
4006
+ if (value === undefined) {
4007
+ if (ignoreUndefined === false)
4008
+ index = serializeNull(buffer, key, value, index);
4009
+ }
4010
+ else if (value === null) {
4011
+ index = serializeNull(buffer, key, value, index);
4012
+ }
4013
+ else if (type === 'string') {
4014
+ index = serializeString(buffer, key, value, index);
4015
+ }
4016
+ else if (type === 'number') {
4017
+ index = serializeNumber(buffer, key, value, index);
4018
+ }
4019
+ else if (type === 'bigint') {
4020
+ index = serializeBigInt(buffer, key, value, index);
4021
+ }
4022
+ else if (type === 'boolean') {
4023
+ index = serializeBoolean(buffer, key, value, index);
4024
+ }
4025
+ else if (type === 'object' && value._bsontype == null) {
4026
+ if (value instanceof Date || isDate(value)) {
4027
+ index = serializeDate(buffer, key, value, index);
4028
+ }
4029
+ else if (value instanceof Uint8Array || isUint8Array(value)) {
4030
+ index = serializeBuffer(buffer, key, value, index);
4031
+ }
4032
+ else if (value instanceof RegExp || isRegExp(value)) {
4033
+ index = serializeRegExp(buffer, key, value, index);
4034
+ }
4035
+ else {
4036
+ index = serializeObject(buffer, key, value, index, checkKeys, depth, serializeFunctions, ignoreUndefined, path);
4037
+ }
4038
+ }
4039
+ else if (type === 'object') {
4040
+ if (value[BSON_VERSION_SYMBOL] !== BSON_MAJOR_VERSION) {
4041
+ throw new BSONVersionError();
4042
+ }
4043
+ else if (value._bsontype === 'ObjectId') {
4044
+ index = serializeObjectId(buffer, key, value, index);
4045
+ }
4046
+ else if (value._bsontype === 'Decimal128') {
4047
+ index = serializeDecimal128(buffer, key, value, index);
4048
+ }
4049
+ else if (value._bsontype === 'Long' || value._bsontype === 'Timestamp') {
4050
+ index = serializeLong(buffer, key, value, index);
4051
+ }
4052
+ else if (value._bsontype === 'Double') {
4053
+ index = serializeDouble(buffer, key, value, index);
4054
+ }
4055
+ else if (value._bsontype === 'Code') {
4056
+ index = serializeCode(buffer, key, value, index, checkKeys, depth, serializeFunctions, ignoreUndefined, path);
4057
+ }
4058
+ else if (value._bsontype === 'Binary') {
4059
+ index = serializeBinary(buffer, key, value, index);
4060
+ }
4061
+ else if (value._bsontype === 'BSONSymbol') {
4062
+ index = serializeSymbol(buffer, key, value, index);
4063
+ }
4064
+ else if (value._bsontype === 'DBRef') {
4065
+ index = serializeDBRef(buffer, key, value, index, depth, serializeFunctions, path);
4066
+ }
4067
+ else if (value._bsontype === 'BSONRegExp') {
4068
+ index = serializeBSONRegExp(buffer, key, value, index);
4069
+ }
4070
+ else if (value._bsontype === 'Int32') {
4071
+ index = serializeInt32(buffer, key, value, index);
4072
+ }
4073
+ else if (value._bsontype === 'MinKey' || value._bsontype === 'MaxKey') {
4074
+ index = serializeMinMax(buffer, key, value, index);
4075
+ }
4076
+ else if (typeof value._bsontype !== 'undefined') {
4077
+ throw new BSONError(`Unrecognized or invalid _bsontype: ${String(value._bsontype)}`);
4078
+ }
4079
+ }
4080
+ else if (type === 'function' && serializeFunctions) {
4081
+ index = serializeFunction(buffer, key, value, index);
4082
+ }
4083
+ }
4084
+ }
4085
+ else {
4086
+ if (typeof object?.toBSON === 'function') {
4087
+ object = object.toBSON();
4088
+ if (object != null && typeof object !== 'object') {
4089
+ throw new BSONError('toBSON function did not return an object');
4090
+ }
4091
+ }
4092
+ for (const key of Object.keys(object)) {
4093
+ let value = object[key];
4094
+ if (typeof value?.toBSON === 'function') {
4095
+ value = value.toBSON();
4096
+ }
4097
+ const type = typeof value;
4098
+ if (typeof key === 'string' && !ignoreKeys.has(key)) {
4099
+ if (key.match(regexp) != null) {
4100
+ throw new BSONError('key ' + key + ' must not contain null bytes');
4101
+ }
4102
+ if (checkKeys) {
4103
+ if ('$' === key[0]) {
4104
+ throw new BSONError('key ' + key + " must not start with '$'");
4105
+ }
4106
+ else if (key.includes('.')) {
4107
+ throw new BSONError('key ' + key + " must not contain '.'");
4108
+ }
4109
+ }
4110
+ }
4111
+ if (value === undefined) {
4112
+ if (ignoreUndefined === false)
4113
+ index = serializeNull(buffer, key, value, index);
4114
+ }
4115
+ else if (value === null) {
4116
+ index = serializeNull(buffer, key, value, index);
4117
+ }
4118
+ else if (type === 'string') {
4119
+ index = serializeString(buffer, key, value, index);
4120
+ }
4121
+ else if (type === 'number') {
4122
+ index = serializeNumber(buffer, key, value, index);
4123
+ }
4124
+ else if (type === 'bigint') {
4125
+ index = serializeBigInt(buffer, key, value, index);
4126
+ }
4127
+ else if (type === 'boolean') {
4128
+ index = serializeBoolean(buffer, key, value, index);
4129
+ }
4130
+ else if (type === 'object' && value._bsontype == null) {
4131
+ if (value instanceof Date || isDate(value)) {
4132
+ index = serializeDate(buffer, key, value, index);
4133
+ }
4134
+ else if (value instanceof Uint8Array || isUint8Array(value)) {
4135
+ index = serializeBuffer(buffer, key, value, index);
4136
+ }
4137
+ else if (value instanceof RegExp || isRegExp(value)) {
4138
+ index = serializeRegExp(buffer, key, value, index);
4139
+ }
4140
+ else {
4141
+ index = serializeObject(buffer, key, value, index, checkKeys, depth, serializeFunctions, ignoreUndefined, path);
4142
+ }
4143
+ }
4144
+ else if (type === 'object') {
4145
+ if (value[BSON_VERSION_SYMBOL] !== BSON_MAJOR_VERSION) {
4146
+ throw new BSONVersionError();
4147
+ }
4148
+ else if (value._bsontype === 'ObjectId') {
4149
+ index = serializeObjectId(buffer, key, value, index);
4150
+ }
4151
+ else if (value._bsontype === 'Decimal128') {
4152
+ index = serializeDecimal128(buffer, key, value, index);
4153
+ }
4154
+ else if (value._bsontype === 'Long' || value._bsontype === 'Timestamp') {
4155
+ index = serializeLong(buffer, key, value, index);
4156
+ }
4157
+ else if (value._bsontype === 'Double') {
4158
+ index = serializeDouble(buffer, key, value, index);
4159
+ }
4160
+ else if (value._bsontype === 'Code') {
4161
+ index = serializeCode(buffer, key, value, index, checkKeys, depth, serializeFunctions, ignoreUndefined, path);
4162
+ }
4163
+ else if (value._bsontype === 'Binary') {
4164
+ index = serializeBinary(buffer, key, value, index);
4165
+ }
4166
+ else if (value._bsontype === 'BSONSymbol') {
4167
+ index = serializeSymbol(buffer, key, value, index);
4168
+ }
4169
+ else if (value._bsontype === 'DBRef') {
4170
+ index = serializeDBRef(buffer, key, value, index, depth, serializeFunctions, path);
4171
+ }
4172
+ else if (value._bsontype === 'BSONRegExp') {
4173
+ index = serializeBSONRegExp(buffer, key, value, index);
4174
+ }
4175
+ else if (value._bsontype === 'Int32') {
4176
+ index = serializeInt32(buffer, key, value, index);
4177
+ }
4178
+ else if (value._bsontype === 'MinKey' || value._bsontype === 'MaxKey') {
4179
+ index = serializeMinMax(buffer, key, value, index);
4180
+ }
4181
+ else if (typeof value._bsontype !== 'undefined') {
4182
+ throw new BSONError(`Unrecognized or invalid _bsontype: ${String(value._bsontype)}`);
4183
+ }
4184
+ }
4185
+ else if (type === 'function' && serializeFunctions) {
4186
+ index = serializeFunction(buffer, key, value, index);
4187
+ }
4188
+ }
4189
+ }
4190
+ path.delete(object);
4191
+ buffer[index++] = 0x00;
4192
+ const size = index - startingIndex;
4193
+ startingIndex += NumberUtils.setInt32LE(buffer, startingIndex, size);
4194
+ return index;
4195
+ }
4196
+
4197
+ function isBSONType(value) {
4198
+ return (value != null &&
4199
+ typeof value === 'object' &&
4200
+ '_bsontype' in value &&
4201
+ typeof value._bsontype === 'string');
4202
+ }
4203
+ const keysToCodecs = {
4204
+ $oid: ObjectId,
4205
+ $binary: Binary,
4206
+ $uuid: Binary,
4207
+ $symbol: BSONSymbol,
4208
+ $numberInt: Int32,
4209
+ $numberDecimal: Decimal128,
4210
+ $numberDouble: Double,
4211
+ $numberLong: Long,
4212
+ $minKey: MinKey,
4213
+ $maxKey: MaxKey,
4214
+ $regex: BSONRegExp,
4215
+ $regularExpression: BSONRegExp,
4216
+ $timestamp: Timestamp
4217
+ };
4218
+ function deserializeValue(value, options = {}) {
4219
+ if (typeof value === 'number') {
4220
+ const in32BitRange = value <= BSON_INT32_MAX && value >= BSON_INT32_MIN;
4221
+ const in64BitRange = value <= BSON_INT64_MAX && value >= BSON_INT64_MIN;
4222
+ if (options.relaxed || options.legacy) {
4223
+ return value;
4224
+ }
4225
+ if (Number.isInteger(value) && !Object.is(value, -0)) {
4226
+ if (in32BitRange) {
4227
+ return new Int32(value);
4228
+ }
4229
+ if (in64BitRange) {
4230
+ if (options.useBigInt64) {
4231
+ return BigInt(value);
4232
+ }
4233
+ return Long.fromNumber(value);
4234
+ }
4235
+ }
4236
+ return new Double(value);
4237
+ }
4238
+ if (value == null || typeof value !== 'object')
4239
+ return value;
4240
+ if (value.$undefined)
4241
+ return null;
4242
+ const keys = Object.keys(value).filter(k => k.startsWith('$') && value[k] != null);
4243
+ for (let i = 0; i < keys.length; i++) {
4244
+ const c = keysToCodecs[keys[i]];
4245
+ if (c)
4246
+ return c.fromExtendedJSON(value, options);
4247
+ }
4248
+ if (value.$date != null) {
4249
+ const d = value.$date;
4250
+ const date = new Date();
4251
+ if (options.legacy) {
4252
+ if (typeof d === 'number')
4253
+ date.setTime(d);
4254
+ else if (typeof d === 'string')
4255
+ date.setTime(Date.parse(d));
4256
+ else if (typeof d === 'bigint')
4257
+ date.setTime(Number(d));
4258
+ else
4259
+ throw new BSONRuntimeError(`Unrecognized type for EJSON date: ${typeof d}`);
4260
+ }
4261
+ else {
4262
+ if (typeof d === 'string')
4263
+ date.setTime(Date.parse(d));
4264
+ else if (Long.isLong(d))
4265
+ date.setTime(d.toNumber());
4266
+ else if (typeof d === 'number' && options.relaxed)
4267
+ date.setTime(d);
4268
+ else if (typeof d === 'bigint')
4269
+ date.setTime(Number(d));
4270
+ else
4271
+ throw new BSONRuntimeError(`Unrecognized type for EJSON date: ${typeof d}`);
4272
+ }
4273
+ return date;
4274
+ }
4275
+ if (value.$code != null) {
4276
+ const copy = Object.assign({}, value);
4277
+ if (value.$scope) {
4278
+ copy.$scope = deserializeValue(value.$scope);
4279
+ }
4280
+ return Code.fromExtendedJSON(value);
4281
+ }
4282
+ if (isDBRefLike(value) || value.$dbPointer) {
4283
+ const v = value.$ref ? value : value.$dbPointer;
4284
+ if (v instanceof DBRef)
4285
+ return v;
4286
+ const dollarKeys = Object.keys(v).filter(k => k.startsWith('$'));
4287
+ let valid = true;
4288
+ dollarKeys.forEach(k => {
4289
+ if (['$ref', '$id', '$db'].indexOf(k) === -1)
4290
+ valid = false;
4291
+ });
4292
+ if (valid)
4293
+ return DBRef.fromExtendedJSON(v);
4294
+ }
4295
+ return value;
4296
+ }
4297
+ function serializeArray(array, options) {
4298
+ return array.map((v, index) => {
4299
+ options.seenObjects.push({ propertyName: `index ${index}`, obj: null });
4300
+ try {
4301
+ return serializeValue(v, options);
4302
+ }
4303
+ finally {
4304
+ options.seenObjects.pop();
4305
+ }
4306
+ });
4307
+ }
4308
+ function getISOString(date) {
4309
+ const isoStr = date.toISOString();
4310
+ return date.getUTCMilliseconds() !== 0 ? isoStr : isoStr.slice(0, -5) + 'Z';
4311
+ }
4312
+ function serializeValue(value, options) {
4313
+ if (value instanceof Map || isMap(value)) {
4314
+ const obj = Object.create(null);
4315
+ for (const [k, v] of value) {
4316
+ if (typeof k !== 'string') {
4317
+ throw new BSONError('Can only serialize maps with string keys');
4318
+ }
4319
+ obj[k] = v;
4320
+ }
4321
+ return serializeValue(obj, options);
4322
+ }
4323
+ if ((typeof value === 'object' || typeof value === 'function') && value !== null) {
4324
+ const index = options.seenObjects.findIndex(entry => entry.obj === value);
4325
+ if (index !== -1) {
4326
+ const props = options.seenObjects.map(entry => entry.propertyName);
4327
+ const leadingPart = props
4328
+ .slice(0, index)
4329
+ .map(prop => `${prop} -> `)
4330
+ .join('');
4331
+ const alreadySeen = props[index];
4332
+ const circularPart = ' -> ' +
4333
+ props
4334
+ .slice(index + 1, props.length - 1)
4335
+ .map(prop => `${prop} -> `)
4336
+ .join('');
4337
+ const current = props[props.length - 1];
4338
+ const leadingSpace = ' '.repeat(leadingPart.length + alreadySeen.length / 2);
4339
+ const dashes = '-'.repeat(circularPart.length + (alreadySeen.length + current.length) / 2 - 1);
4340
+ throw new BSONError('Converting circular structure to EJSON:\n' +
4341
+ ` ${leadingPart}${alreadySeen}${circularPart}${current}\n` +
4342
+ ` ${leadingSpace}\\${dashes}/`);
4343
+ }
4344
+ options.seenObjects[options.seenObjects.length - 1].obj = value;
4345
+ }
4346
+ if (Array.isArray(value))
4347
+ return serializeArray(value, options);
4348
+ if (value === undefined)
4349
+ return options.ignoreUndefined ? undefined : null;
4350
+ if (value instanceof Date || isDate(value)) {
4351
+ const dateNum = value.getTime(), inRange = dateNum > -1 && dateNum < 253402318800000;
4352
+ if (options.legacy) {
4353
+ return options.relaxed && inRange
4354
+ ? { $date: value.getTime() }
4355
+ : { $date: getISOString(value) };
4356
+ }
4357
+ return options.relaxed && inRange
4358
+ ? { $date: getISOString(value) }
4359
+ : { $date: { $numberLong: value.getTime().toString() } };
4360
+ }
4361
+ if (typeof value === 'number' && (!options.relaxed || !isFinite(value))) {
4362
+ if (Number.isInteger(value) && !Object.is(value, -0)) {
4363
+ if (value >= BSON_INT32_MIN && value <= BSON_INT32_MAX) {
4364
+ return { $numberInt: value.toString() };
4365
+ }
4366
+ if (value >= BSON_INT64_MIN && value <= BSON_INT64_MAX) {
4367
+ return { $numberLong: value.toString() };
4368
+ }
4369
+ }
4370
+ return { $numberDouble: Object.is(value, -0) ? '-0.0' : value.toString() };
4371
+ }
4372
+ if (typeof value === 'bigint') {
4373
+ if (!options.relaxed) {
4374
+ return { $numberLong: BigInt.asIntN(64, value).toString() };
4375
+ }
4376
+ return Number(BigInt.asIntN(64, value));
4377
+ }
4378
+ if (value instanceof RegExp || isRegExp(value)) {
4379
+ let flags = value.flags;
4380
+ if (flags === undefined) {
4381
+ const match = value.toString().match(/[gimuy]*$/);
4382
+ if (match) {
4383
+ flags = match[0];
4384
+ }
4385
+ }
4386
+ const rx = new BSONRegExp(value.source, flags);
4387
+ return rx.toExtendedJSON(options);
4388
+ }
4389
+ if (value != null && typeof value === 'object')
4390
+ return serializeDocument(value, options);
4391
+ return value;
4392
+ }
4393
+ const BSON_TYPE_MAPPINGS = {
4394
+ Binary: (o) => new Binary(o.value(), o.sub_type),
4395
+ Code: (o) => new Code(o.code, o.scope),
4396
+ DBRef: (o) => new DBRef(o.collection || o.namespace, o.oid, o.db, o.fields),
4397
+ Decimal128: (o) => new Decimal128(o.bytes),
4398
+ Double: (o) => new Double(o.value),
4399
+ Int32: (o) => new Int32(o.value),
4400
+ Long: (o) => Long.fromBits(o.low != null ? o.low : o.low_, o.low != null ? o.high : o.high_, o.low != null ? o.unsigned : o.unsigned_),
4401
+ MaxKey: () => new MaxKey(),
4402
+ MinKey: () => new MinKey(),
4403
+ ObjectId: (o) => new ObjectId(o),
4404
+ BSONRegExp: (o) => new BSONRegExp(o.pattern, o.options),
4405
+ BSONSymbol: (o) => new BSONSymbol(o.value),
4406
+ Timestamp: (o) => Timestamp.fromBits(o.low, o.high)
4407
+ };
4408
+ function serializeDocument(doc, options) {
4409
+ if (doc == null || typeof doc !== 'object')
4410
+ throw new BSONError('not an object instance');
4411
+ const bsontype = doc._bsontype;
4412
+ if (typeof bsontype === 'undefined') {
4413
+ const _doc = {};
4414
+ for (const name of Object.keys(doc)) {
4415
+ options.seenObjects.push({ propertyName: name, obj: null });
4416
+ try {
4417
+ const value = serializeValue(doc[name], options);
4418
+ if (name === '__proto__') {
4419
+ Object.defineProperty(_doc, name, {
4420
+ value,
4421
+ writable: true,
4422
+ enumerable: true,
4423
+ configurable: true
4424
+ });
4425
+ }
4426
+ else {
4427
+ _doc[name] = value;
4428
+ }
4429
+ }
4430
+ finally {
4431
+ options.seenObjects.pop();
4432
+ }
4433
+ }
4434
+ return _doc;
4435
+ }
4436
+ else if (doc != null &&
4437
+ typeof doc === 'object' &&
4438
+ typeof doc._bsontype === 'string' &&
4439
+ doc[BSON_VERSION_SYMBOL] !== BSON_MAJOR_VERSION) {
4440
+ throw new BSONVersionError();
4441
+ }
4442
+ else if (isBSONType(doc)) {
4443
+ let outDoc = doc;
4444
+ if (typeof outDoc.toExtendedJSON !== 'function') {
4445
+ const mapper = BSON_TYPE_MAPPINGS[doc._bsontype];
4446
+ if (!mapper) {
4447
+ throw new BSONError('Unrecognized or invalid _bsontype: ' + doc._bsontype);
4448
+ }
4449
+ outDoc = mapper(outDoc);
4450
+ }
4451
+ if (bsontype === 'Code' && outDoc.scope) {
4452
+ outDoc = new Code(outDoc.code, serializeValue(outDoc.scope, options));
4453
+ }
4454
+ else if (bsontype === 'DBRef' && outDoc.oid) {
4455
+ outDoc = new DBRef(serializeValue(outDoc.collection, options), serializeValue(outDoc.oid, options), serializeValue(outDoc.db, options), serializeValue(outDoc.fields, options));
4456
+ }
4457
+ return outDoc.toExtendedJSON(options);
4458
+ }
4459
+ else {
4460
+ throw new BSONError('_bsontype must be a string, but was: ' + typeof bsontype);
4461
+ }
4462
+ }
4463
+ function parse(text, options) {
4464
+ const ejsonOptions = {
4465
+ useBigInt64: options?.useBigInt64 ?? false,
4466
+ relaxed: options?.relaxed ?? true,
4467
+ legacy: options?.legacy ?? false
4468
+ };
4469
+ return JSON.parse(text, (key, value) => {
4470
+ if (key.indexOf('\x00') !== -1) {
4471
+ throw new BSONError(`BSON Document field names cannot contain null bytes, found: ${JSON.stringify(key)}`);
4472
+ }
4473
+ return deserializeValue(value, ejsonOptions);
4474
+ });
4475
+ }
4476
+ function stringify(value, replacer, space, options) {
4477
+ if (space != null && typeof space === 'object') {
4478
+ options = space;
4479
+ space = 0;
4480
+ }
4481
+ if (replacer != null && typeof replacer === 'object' && !Array.isArray(replacer)) {
4482
+ options = replacer;
4483
+ replacer = undefined;
4484
+ space = 0;
4485
+ }
4486
+ const serializeOptions = Object.assign({ relaxed: true, legacy: false }, options, {
4487
+ seenObjects: [{ propertyName: '(root)', obj: null }]
4488
+ });
4489
+ const doc = serializeValue(value, serializeOptions);
4490
+ return JSON.stringify(doc, replacer, space);
4491
+ }
4492
+ function EJSONserialize(value, options) {
4493
+ options = options || {};
4494
+ return JSON.parse(stringify(value, options));
4495
+ }
4496
+ function EJSONdeserialize(ejson, options) {
4497
+ options = options || {};
4498
+ return parse(JSON.stringify(ejson), options);
4499
+ }
4500
+ const EJSON = Object.create(null);
4501
+ EJSON.parse = parse;
4502
+ EJSON.stringify = stringify;
4503
+ EJSON.serialize = EJSONserialize;
4504
+ EJSON.deserialize = EJSONdeserialize;
4505
+ Object.freeze(EJSON);
4506
+
4507
+ const BSONElementType = {
4508
+ double: 1,
4509
+ string: 2,
4510
+ object: 3,
4511
+ array: 4,
4512
+ binData: 5,
4513
+ undefined: 6,
4514
+ objectId: 7,
4515
+ bool: 8,
4516
+ date: 9,
4517
+ null: 10,
4518
+ regex: 11,
4519
+ dbPointer: 12,
4520
+ javascript: 13,
4521
+ symbol: 14,
4522
+ javascriptWithScope: 15,
4523
+ int: 16,
4524
+ timestamp: 17,
4525
+ long: 18,
4526
+ decimal: 19,
4527
+ minKey: 255,
4528
+ maxKey: 127
4529
+ };
4530
+ function getSize(source, offset) {
4531
+ try {
4532
+ return NumberUtils.getNonnegativeInt32LE(source, offset);
4533
+ }
4534
+ catch (cause) {
4535
+ throw new BSONOffsetError('BSON size cannot be negative', offset, { cause });
4536
+ }
4537
+ }
4538
+ function findNull(bytes, offset) {
4539
+ let nullTerminatorOffset = offset;
4540
+ for (; bytes[nullTerminatorOffset] !== 0x00; nullTerminatorOffset++)
4541
+ ;
4542
+ if (nullTerminatorOffset === bytes.length - 1) {
4543
+ throw new BSONOffsetError('Null terminator not found', offset);
4544
+ }
4545
+ return nullTerminatorOffset;
4546
+ }
4547
+ function parseToElements(bytes, startOffset = 0) {
4548
+ startOffset ??= 0;
4549
+ if (bytes.length < 5) {
4550
+ throw new BSONOffsetError(`Input must be at least 5 bytes, got ${bytes.length} bytes`, startOffset);
4551
+ }
4552
+ const documentSize = getSize(bytes, startOffset);
4553
+ if (documentSize > bytes.length - startOffset) {
4554
+ throw new BSONOffsetError(`Parsed documentSize (${documentSize} bytes) does not match input length (${bytes.length} bytes)`, startOffset);
4555
+ }
4556
+ if (bytes[startOffset + documentSize - 1] !== 0x00) {
4557
+ throw new BSONOffsetError('BSON documents must end in 0x00', startOffset + documentSize);
4558
+ }
4559
+ const elements = [];
4560
+ let offset = startOffset + 4;
4561
+ while (offset <= documentSize + startOffset) {
4562
+ const type = bytes[offset];
4563
+ offset += 1;
4564
+ if (type === 0) {
4565
+ if (offset - startOffset !== documentSize) {
4566
+ throw new BSONOffsetError(`Invalid 0x00 type byte`, offset);
4567
+ }
4568
+ break;
4569
+ }
4570
+ const nameOffset = offset;
4571
+ const nameLength = findNull(bytes, offset) - nameOffset;
4572
+ offset += nameLength + 1;
4573
+ let length;
4574
+ if (type === BSONElementType.double ||
4575
+ type === BSONElementType.long ||
4576
+ type === BSONElementType.date ||
4577
+ type === BSONElementType.timestamp) {
4578
+ length = 8;
4579
+ }
4580
+ else if (type === BSONElementType.int) {
4581
+ length = 4;
4582
+ }
4583
+ else if (type === BSONElementType.objectId) {
4584
+ length = 12;
4585
+ }
4586
+ else if (type === BSONElementType.decimal) {
4587
+ length = 16;
4588
+ }
4589
+ else if (type === BSONElementType.bool) {
4590
+ length = 1;
4591
+ }
4592
+ else if (type === BSONElementType.null ||
4593
+ type === BSONElementType.undefined ||
4594
+ type === BSONElementType.maxKey ||
4595
+ type === BSONElementType.minKey) {
4596
+ length = 0;
4597
+ }
4598
+ else if (type === BSONElementType.regex) {
4599
+ length = findNull(bytes, findNull(bytes, offset) + 1) + 1 - offset;
4600
+ }
4601
+ else if (type === BSONElementType.object ||
4602
+ type === BSONElementType.array ||
4603
+ type === BSONElementType.javascriptWithScope) {
4604
+ length = getSize(bytes, offset);
4605
+ }
4606
+ else if (type === BSONElementType.string ||
4607
+ type === BSONElementType.binData ||
4608
+ type === BSONElementType.dbPointer ||
4609
+ type === BSONElementType.javascript ||
4610
+ type === BSONElementType.symbol) {
4611
+ length = getSize(bytes, offset) + 4;
4612
+ if (type === BSONElementType.binData) {
4613
+ length += 1;
4614
+ }
4615
+ if (type === BSONElementType.dbPointer) {
4616
+ length += 12;
4617
+ }
4618
+ }
4619
+ else {
4620
+ throw new BSONOffsetError(`Invalid 0x${type.toString(16).padStart(2, '0')} type byte`, offset);
4621
+ }
4622
+ if (length > documentSize) {
4623
+ throw new BSONOffsetError('value reports length larger than document', offset);
4624
+ }
4625
+ elements.push([type, nameOffset, nameLength, offset, length]);
4626
+ offset += length;
4627
+ }
4628
+ return elements;
4629
+ }
4630
+
4631
+ const onDemand = Object.create(null);
4632
+ onDemand.parseToElements = parseToElements;
4633
+ onDemand.ByteUtils = ByteUtils;
4634
+ onDemand.NumberUtils = NumberUtils;
4635
+ Object.freeze(onDemand);
4636
+
4637
+ const MAXSIZE = 1024 * 1024 * 17;
4638
+ let buffer = ByteUtils.allocate(MAXSIZE);
4639
+ function setInternalBufferSize(size) {
4640
+ if (buffer.length < size) {
4641
+ buffer = ByteUtils.allocate(size);
4642
+ }
4643
+ }
4644
+ function serialize(object, options = {}) {
4645
+ const checkKeys = typeof options.checkKeys === 'boolean' ? options.checkKeys : false;
4646
+ const serializeFunctions = typeof options.serializeFunctions === 'boolean' ? options.serializeFunctions : false;
4647
+ const ignoreUndefined = typeof options.ignoreUndefined === 'boolean' ? options.ignoreUndefined : true;
4648
+ const minInternalBufferSize = typeof options.minInternalBufferSize === 'number' ? options.minInternalBufferSize : MAXSIZE;
4649
+ if (buffer.length < minInternalBufferSize) {
4650
+ buffer = ByteUtils.allocate(minInternalBufferSize);
4651
+ }
4652
+ const serializationIndex = serializeInto(buffer, object, checkKeys, 0, 0, serializeFunctions, ignoreUndefined, null);
4653
+ const finishedBuffer = ByteUtils.allocateUnsafe(serializationIndex);
4654
+ finishedBuffer.set(buffer.subarray(0, serializationIndex), 0);
4655
+ return finishedBuffer;
4656
+ }
4657
+ function serializeWithBufferAndIndex(object, finalBuffer, options = {}) {
4658
+ const checkKeys = typeof options.checkKeys === 'boolean' ? options.checkKeys : false;
4659
+ const serializeFunctions = typeof options.serializeFunctions === 'boolean' ? options.serializeFunctions : false;
4660
+ const ignoreUndefined = typeof options.ignoreUndefined === 'boolean' ? options.ignoreUndefined : true;
4661
+ const startIndex = typeof options.index === 'number' ? options.index : 0;
4662
+ const serializationIndex = serializeInto(buffer, object, checkKeys, 0, 0, serializeFunctions, ignoreUndefined, null);
4663
+ finalBuffer.set(buffer.subarray(0, serializationIndex), startIndex);
4664
+ return startIndex + serializationIndex - 1;
4665
+ }
4666
+ function deserialize(buffer, options = {}) {
4667
+ return internalDeserialize(ByteUtils.toLocalBufferType(buffer), options);
4668
+ }
4669
+ function calculateObjectSize(object, options = {}) {
4670
+ options = options || {};
4671
+ const serializeFunctions = typeof options.serializeFunctions === 'boolean' ? options.serializeFunctions : false;
4672
+ const ignoreUndefined = typeof options.ignoreUndefined === 'boolean' ? options.ignoreUndefined : true;
4673
+ return internalCalculateObjectSize(object, serializeFunctions, ignoreUndefined);
4674
+ }
4675
+ function deserializeStream(data, startIndex, numberOfDocuments, documents, docStartIndex, options) {
4676
+ const internalOptions = Object.assign({ allowObjectSmallerThanBufferSize: true, index: 0 }, options);
4677
+ const bufferData = ByteUtils.toLocalBufferType(data);
4678
+ let index = startIndex;
4679
+ for (let i = 0; i < numberOfDocuments; i++) {
4680
+ const size = NumberUtils.getInt32LE(bufferData, index);
4681
+ internalOptions.index = index;
4682
+ documents[docStartIndex + i] = internalDeserialize(bufferData, internalOptions);
4683
+ index = index + size;
4684
+ }
4685
+ return index;
4686
+ }
4687
+
4688
+ var bson = /*#__PURE__*/Object.freeze({
4689
+ __proto__: null,
4690
+ BSONError: BSONError,
4691
+ BSONOffsetError: BSONOffsetError,
4692
+ BSONRegExp: BSONRegExp,
4693
+ BSONRuntimeError: BSONRuntimeError,
4694
+ BSONSymbol: BSONSymbol,
4695
+ BSONType: BSONType,
4696
+ BSONValue: BSONValue,
4697
+ BSONVersionError: BSONVersionError,
4698
+ Binary: Binary,
4699
+ ByteUtils: ByteUtils,
4700
+ Code: Code,
4701
+ DBRef: DBRef,
4702
+ Decimal128: Decimal128,
4703
+ Double: Double,
4704
+ EJSON: EJSON,
4705
+ Int32: Int32,
4706
+ Long: Long,
4707
+ MaxKey: MaxKey,
4708
+ MinKey: MinKey,
4709
+ NumberUtils: NumberUtils,
4710
+ ObjectId: ObjectId,
4711
+ Timestamp: Timestamp,
4712
+ UUID: UUID,
4713
+ bsonType: bsonType,
4714
+ calculateObjectSize: calculateObjectSize,
4715
+ deserialize: deserialize,
4716
+ deserializeStream: deserializeStream,
4717
+ onDemand: onDemand,
4718
+ serialize: serialize,
4719
+ serializeWithBufferAndIndex: serializeWithBufferAndIndex,
4720
+ setInternalBufferSize: setInternalBufferSize
4721
+ });
4722
+
4723
+ exports.BSON = bson;
4724
+ exports.BSONError = BSONError;
4725
+ exports.BSONOffsetError = BSONOffsetError;
4726
+ exports.BSONRegExp = BSONRegExp;
4727
+ exports.BSONRuntimeError = BSONRuntimeError;
4728
+ exports.BSONSymbol = BSONSymbol;
4729
+ exports.BSONType = BSONType;
4730
+ exports.BSONValue = BSONValue;
4731
+ exports.BSONVersionError = BSONVersionError;
4732
+ exports.Binary = Binary;
4733
+ exports.ByteUtils = ByteUtils;
4734
+ exports.Code = Code;
4735
+ exports.DBRef = DBRef;
4736
+ exports.Decimal128 = Decimal128;
4737
+ exports.Double = Double;
4738
+ exports.EJSON = EJSON;
4739
+ exports.Int32 = Int32;
4740
+ exports.Long = Long;
4741
+ exports.MaxKey = MaxKey;
4742
+ exports.MinKey = MinKey;
4743
+ exports.NumberUtils = NumberUtils;
4744
+ exports.ObjectId = ObjectId;
4745
+ exports.Timestamp = Timestamp;
4746
+ exports.UUID = UUID;
4747
+ exports.bsonType = bsonType;
4748
+ exports.calculateObjectSize = calculateObjectSize;
4749
+ exports.deserialize = deserialize;
4750
+ exports.deserializeStream = deserializeStream;
4751
+ exports.onDemand = onDemand;
4752
+ exports.serialize = serialize;
4753
+ exports.serializeWithBufferAndIndex = serializeWithBufferAndIndex;
4754
+ exports.setInternalBufferSize = setInternalBufferSize;
4755
+ //# sourceMappingURL=bson.rn.cjs.map